This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'chef/log' | |
keys = [] | |
search(:node, "keys_ssh_host_rsa_public") do |node| | |
keys << node | |
end | |
Chef::Log.info keys.inspect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2010, Jason Boxman <jasonb@edseek.com> | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without | |
modification, are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright | |
notice, this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright | |
notice, this list of conditions and the following disclaimer in the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pure JavaScript | |
var keys = ['name', 'display_name', 'status', 'logo'], | |
o = {}, | |
k; | |
while(k = keys.shift()) {o[k] = channel[k]} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> react-slingshot@5.0.0 build /Users/jasonb/projects/lb-take-2 | |
> babel-node tools/build.js && npm run open:dist | |
Generating minified bundle for production via Webpack. This will take a moment... | |
Webpack stats: Hash: 7e6d42bcd85a9382cecd | |
Version: webpack 1.13.1 | |
Time: 73872ms | |
Asset Size Chunks Chunk Names | |
favicon.ico 1.41 kB [emitted] | |
flags.png 28.1 kB [emitted] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rejectedPromise = Promise.reject(new Error('Whatever')); | |
const p = new Promise( | |
(fulfill, reject) => { | |
setTimeout(() => rejectedPromise.then(fulfill, reject), 1000); | |
} | |
); | |
p.then(value => console.log(value)).catch(console.log('rejected')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: https://raw.githubusercontent.com/dozoisch/koa-react-full-example/master/config/config.js | |
const path = require('path'); | |
const _ = require('lodash'); | |
const env = process.env.NODE_ENV = process.env.NODE_ENV || 'development'; | |
const base = { | |
app: { | |
root: path.normalize(path.join(__dirname, '../')), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/getify/You-Dont-Know-JS/blob/master/es6%20%26%20beyond/ch2.md#tagged-template-literals | |
function foo(strings, ...values) { | |
console.log( strings ); | |
console.log( values ); | |
} | |
var desc = "awesome"; | |
foo`Everything is ${desc}!`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = require('tape'); | |
const Random = require('random-js'); | |
/* | |
Game Input | |
Within an infinite loop, read the heights of the mountains from the standard | |
input and print to the standard output the index of the mountain to shoot. | |
Input for one game turn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addnMapReduce(...args) { | |
// Can do args.slice(1).reduce(..., args[0]) to skip num(0) no-op | |
return args.reduce((prev, cur) => () => add2(prev, cur), num(0))(); | |
} | |
function num(number) { | |
return () => number; | |
} | |
function add2(fn1, fn2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function *silentLog(p) { | |
function restoreLog() {return console.log = logg, undefined;} | |
const logg = console.log; | |
console.log = function() {} | |
const [fulfill, reject] = yield; | |
p().then(fulfill, reject).then(restoreLog, restoreLog); | |
} | |
function withSilentLog(youPromised, handleFulfill = function() {}, handleReject = function() {}) { | |
const it = silentLog(youPromised); |
OlderNewer