To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.
- Homebrew
- Mountain Lion
| // Append a move method to the Array prototype | |
| Array.prototype.move = function(from, to) { | |
| this.splice(to, 0, this.splice(from, 1)[0]); | |
| return this; | |
| }; | |
| // Start with an existing array | |
| var orig = ["Sam", "Tom", "Ben", "Sophie"]; | |
| // Use the new method to move the last item in the array to the first position |
| self.addEventListener('install', (e) => { | |
| e.waitUntil( | |
| caches.open("precache").then((cache) => cache.add("/broken.png")) | |
| ); | |
| }); | |
| function isImage(fetchRequest) { | |
| return fetchRequest.method === "GET" && fetchRequest.destination === "image"; | |
| } |
To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.
| // original gist | |
| const shuffleArray = arr => arr.sort(() => Math.random() - 0.5); | |
| // fully random by @BetonMAN | |
| const shuffleArray = arr => ( | |
| arr | |
| .map(a => [Math.random(), a]) | |
| .sort((a, b) => a[0] - b[0]) | |
| .map(a => a[1]); | |
| ); |
| { | |
| "name": "my-app", | |
| "version": "1.0.0", | |
| "description": "My test app", | |
| "main": "src/js/index.js", | |
| "scripts": { | |
| "jshint:dist": "jshint src/js/*.js", | |
| "jshint": "npm run jshint:dist", | |
| "jscs": "jscs src/*.js", | |
| "browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js", |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000