Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
- ⌘ : Command key
- ⌃ : Control key
- ⌫ : Delete key
- ← : Left arrow key
- → : Right arrow key
- ↑ : Up arrow key
| // ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
| // ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
| // Merge a `source` object to a `target` recursively | |
| const merge = (target, source) => { | |
| // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
| for (const key of Object.keys(source)) { | |
| if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.
| title | slug | createdAt | language | preview |
|---|---|---|---|---|
Unit testing Angular.js app with node.js, mocha, angular-mocks and jsdom |
unit-testing-angular-js-app-with-node |
2015-07-05T18:04:33Z |
en |
Majority of search result about unit testing Angular.js apps is about how to do it by using test frameworks that run the tests in a real browser. Even though it's great to be able to test your code in multiple platforms, in my opinion it creates a lot of boilerplate code and makes it hard to run the tests in, for instance a CI-server. |
Lean unit tests with minimal setup
For background and further references see: Entity Component Systems on Wikipedia
entity = class: no logic + no data OR at most small set of frequently used data (ie position)component = class: logic + dataforeach entity in allEntities do
foreach component in entity.components do
| // go on you labels pages | |
| // eg https://github.com/cssnext/cssnext/labels | |
| // paste this script in your console | |
| // copy the output and now you can import it using https://github.com/popomore/github-labels ! | |
| var labels = []; | |
| [].slice.call(document.querySelectorAll(".label-link")) | |
| .forEach(function(element) { | |
| labels.push({ | |
| name: element.textContent.trim(), |
| var gulp = require('gulp'); | |
| var sourcemaps = require('gulp-sourcemaps'); | |
| var source = require('vinyl-source-stream'); | |
| var buffer = require('vinyl-buffer'); | |
| var browserify = require('browserify'); | |
| var watchify = require('watchify'); | |
| var babel = require('babelify'); | |
| function compile(watch) { | |
| var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel)); |
| func generateRandomColor() -> UIColor { | |
| let hue : CGFloat = CGFloat(arc4random() % 256) / 256 // use 256 to get full range from 0.0 to 1.0 | |
| let saturation : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from white | |
| let brightness : CGFloat = CGFloat(arc4random() % 128) / 256 + 0.5 // from 0.5 to 1.0 to stay away from black | |
| return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: 1) | |
| } |
#GoPro HERO4 (A tale of firmware leaks and marketing)
Written by /u/konrad-iturbe (Konrad Iturbe) and with help of /u/OverByThere's leaked firmware.
The GoPro HERO4 Black Adventure edition is 4x times more powerful than ever.
HERO4 cameras: