As front-end developers we all know the pain of coming up with meaningful component names for CSS classes. I created this gist as a place to collect terms that are suitable as user interface component names.
Please contribute your own ideas!
- button
| function keepTrying(otherArgs, promise) { | |
| promise = promise||new Promise(); | |
| // try doing the important thing | |
| if(success) { | |
| promise.resolve(result); | |
| } else { | |
| setTimeout(function() { | |
| keepTrying(otherArgs, promise); |
| function camelCaseToDash( myStr ) { | |
| return myStr.replace( /([a-z])([A-Z])/g, '$1-$2' ).toLowerCase(); | |
| } | |
| var myStr = camelCaseToDash( 'thisString' ); | |
| alert( myStr ); // => this-string |
| #!/bin/bash | |
| # Sync Homebrew installations between Macs via Dropbox | |
| # | |
| BREW="/usr/local/bin/brew" | |
| # first get local settings | |
| echo "Reading local settings ..." | |
| rm -f /tmp/brew-sync.* |
| find `pwd` -type d -maxdepth 3 -name 'node_modules' | xargs -n 1 tmutil addexclusion |
| let isRefreshing = false; | |
| let refreshSubscribers = []; | |
| const instance = axios.create({ | |
| baseURL: Config.API_URL, | |
| }); | |
| instance.interceptors.response.use(response => { | |
| return response; | |
| }, error => { |
| // for multiple requests | |
| let isRefreshing = false; | |
| let failedQueue = []; | |
| const processQueue = (error, token = null) => { | |
| failedQueue.forEach(prom => { | |
| if (error) { | |
| prom.reject(error); | |
| } else { | |
| prom.resolve(token); |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>Label</key> | |
| <string>com.user.time-machine-exclude-node-modules-job</string> | |
| <key>RunAtLoad</key> | |
| <false/> | |
| <key>KeepAlive</key> | |
| <false/> |
| function toTitleCase(str) { | |
| return str.replace(/\w\S*/g, function(txt){ | |
| return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); | |
| }); | |
| } | |
| // or in ES6: | |
| var text = "foo bar loo zoo moo"; | |
| const ucfirst = text => text.toLowerCase() |
| # finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx | |
| find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \; |