start new:
tmux
start new with session name:
tmux new -s myname
| var http = require("http"), | |
| url = require("url"), | |
| path = require("path"), | |
| fs = require("fs") | |
| port = process.argv[2] || 8888; | |
| http.createServer(function(request, response) { | |
| var uri = url.parse(request.url).pathname | |
| , filename = path.join(process.cwd(), uri); |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');Those suck for maintenance and they're ugly.
| ## within current branch, squashes all commits that are ahead of master down into one | |
| ## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case) | |
| ## commit any working changes on branch "mybranchname", then... | |
| git checkout master | |
| git checkout -b mybranchname_temp | |
| git merge --squash mybranchname | |
| git commit -am "Message describing all squashed commits" | |
| git branch -m mybranchname mybranchname_unsquashed | |
| git branch -m mybranchname |
| # Atom Cheatsheet. | |
| # Project Key Bindings. | |
| - 'cmd-shift-p': open the command palette. | |
| - 'cmd-p' or 'cmd-t': open the fuzzy finder to find a file. | |
| - 'cmd-b': look for a file that is already open. | |
| - 'cmd-shift-b': search the list of files modified and untracked in your project repository. | |
| - 'ctrl-0': open and focus the the tree view. |
| var copyProperties = require('react/lib/copyProperties'), | |
| Dispatcher = require('flux').Dispatcher, | |
| util = require('util'); | |
| function AppDispatcher() { | |
| Dispatcher.call(this); | |
| this._queue = []; | |
| } | |
| util.inherits(AppDispatcher, Dispatcher); |
In React's terminology, there are five core types that are important to distinguish:
React Elements
| /** | |
| * Return true/false if key is found in Object (one level) | |
| * @param {object} object where to try find key | |
| * @param {string} key - string to find in object | |
| * @return {boolean} true/false if key is found | |
| */ | |
| var foundInObject = function (object, key) { | |
| var keyFound = null; |
| #!/bin/bash | |
| files=$(git diff --cached --name-only | grep '\.js$') | |
| # Prevent ESLint help message if no files matched | |
| if [[ $files = "" ]] ; then | |
| exit 0 | |
| fi | |
| echo $files | xargs eslint |
| { | |
| // http://eslint.org/docs/rules/ | |
| "ecmaFeatures": { | |
| "binaryLiterals": false, // enable binary literals | |
| "blockBindings": false, // enable let and const (aka block bindings) | |
| "defaultParams": false, // enable default function parameters | |
| "forOf": false, // enable for-of loops | |
| "generators": false, // enable generators | |
| "objectLiteralComputedProperties": false, // enable computed object literal property names |