JavaScript Array Methods
More information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
forEach
// Iterate over each item of an array
[1, 2, 3, 4].forEach(item => console.log(item))
#!/usr/bin/env node |
COMMIT_MSG_SCRIPT_URL=https://raw.githubusercontent.com/angular/angular.js/c94329a891a1c082567c490ccf58ba8592b464ad/validate-commit-msg.js | |
COMMIT_MSG_SCRIPT_LOCATION=.git/hooks/commit-msg | |
touch $COMMIT_MSG_SCRIPT_LOCATION | |
curl $COMMIT_MSG_SCRIPT_URL > $COMMIT_MSG_SCRIPT_LOCATION | |
chmod +x .git/hooks/commit-msg |
#!/usr/bin/env node | |
const exec = require('child_process').exec | |
const path = require('path') | |
const moment = require('moment') | |
const prependFile = require('prepend-file') | |
const pkg = require('./package') | |
const version = pkg.version | |
const SEP = '##_' |
const sinon = require('sinon') | |
const chai = require('chai') | |
const expect = chai.expect | |
const foo = callback => { | |
return Promise.resolve().then(() => { | |
setTimeout(() => { | |
callback() | |
}, 5000) | |
}) |
git branch -a --merged=master |
const bcrypt = require('bcrypt') | |
exports.encrypt = plainTextPassword => new Promise((resolve, reject) => { | |
bcrypt.hash(plainTextPassword, 10, (err, hash) => { | |
if (err) return reject(err) | |
return resolve(hash) | |
}) | |
}) | |
exports.compare = (plainTextPassword, hash) => new Promise((resolve, reject) => { |
const Hapi = require('hapi') | |
function createServer({conf, controllers}) { | |
const server = new Hapi.Server() | |
server.connection(conf) | |
app.routes([ | |
{ | |
method: 'GET', | |
path: '/users', |
angular | |
.module('app.moduleA', ['app.moduleB']) | |
.factory('FactoryA', (FactoryB) -> | |
factory = {} | |
factory.sayHello = () -> FactoryB() | |
return factory | |
) |
More information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
// Iterate over each item of an array
[1, 2, 3, 4].forEach(item => console.log(item))
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |