Object drills Lesson 6.2
- Most Frequent Word -- https://jsbin.com/lejeye/edit?js,console
- Data Merge -- https://jsbin.com/xoxoxu/edit?js,console
- StackOverflow Nested Objects
- Recipe Factory -- https://jsbin.com/yiciso/edit?html,js,console,output
| /** | |
| * Allows you to subscribe to whether or not the window is currently printing (user invoked the system print dialog). | |
| * | |
| * @returns Whether or not the document is currently printing. | |
| */ | |
| export default function useIsPrinting(): boolean { | |
| const [printing, setIsPrinting] = useState( | |
| window.matchMedia('print').matches | |
| ); |
| name: Detox | |
| on: [push] | |
| jobs: | |
| build: | |
| runs-on: macOS-latest | |
| timeout-minutes: 15 | |
| env: |
| /* | |
| * Returns array of items de-duped based on primary key field | |
| * ie: id | |
| * */ | |
| function removeDuplications<T>(primaryKey: string, items: T[]): T[] { | |
| if (items && items.length === 0) { | |
| return []; | |
| } | |
| if (!items[0].hasOwnProperty(primaryKey)) { |
| import { Link } from 'react-router-dom' | |
| import { Badge, Col, Menu } from 'antd' | |
| const StyledBadge = styled(Badge)` | |
| .ant-badge-count { | |
| background-color: #7ECBBF; | |
| color: white; | |
| box-shadow: 0 0 0 1px #d9d9d9 inset; | |
| } | |
| ` |
| #!/bin/bash | |
| APIKEY="From Here https://api.slack.com/custom-integrations/legacy-tokens" | |
| SONG=$(osascript -e 'tell application "Spotify" to name of current track as string') | |
| URLSONG=$(echo "$SONG" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"') | |
| while true | |
| do | |
| curl -s -d "payload=$json" "https://slack.com/api/users.profile.set?token="$APIKEY"&profile=%7B%22status_text%22%3A%22"$URLSONG"%22%2C%22status_emoji%22%3A%22%3Amusical_note%3A%22%7D" > /dev/null | |
| sleep 60 | |
| done |
Object drills Lesson 6.2
| import React from 'react'; | |
| import { shallow } from 'enzyme'; | |
| import MyComponent from '../src/my-component'; | |
| const wrapper = shallow(<MyComponent/>); | |
| describe('(Component) MyComponent', () => { | |
| it('renders without exploding', () => { | |
| expect(wrapper).to.have.length(1); | |
| }); |
There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.
All other files should be in your own global gitignore file:
.gitignore in your home directory and add any filepath patterns you want to ignore.Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute
.config/git/ignorefor.gitignorein your home directory, if you prefer.
| #add 'node_modules' to .gitignore file | |
| git rm -r --cached node_modules | |
| git commit -m 'Remove the now ignored directory node_modules' | |
| git push origin <branch-name> |
| /** | |
| * A linear interpolator for hexadecimal colors | |
| * @param {String} a | |
| * @param {String} b | |
| * @param {Number} amount | |
| * @example | |
| * // returns #7F7F7F | |
| * lerpColor('#000000', '#ffffff', 0.5) | |
| * @returns {String} | |
| */ |