Skip to content

Instantly share code, notes, and snippets.

View srowhani's full-sized avatar

Seena Rowhani srowhani

View GitHub Profile
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
Byobu is a suite of enhancements to tmux, as a command line
tool providing live system status, dynamic window management,
and some convenient keybindings:
F1 * Used by X11 *
Shift-F1 Display this help
F2 Create a new window
Shift-F2 Create a horizontal split
Ctrl-F2 Create a vertical split
Ctrl-Shift-F2 Create a new session
function * currentWeatherInSf () {
const { temperature } = yield new Promise(
resolve => setTimeout(() => resolve({ temperature: '5deg' }), 250)
)
return temperature
}
const weatherIterator = currentWeatherInSf()
const { value: fetchPromise } = weatherIterator.next()
function pushBackIntoGeneratorExample * () {
const receivedValue = yield null
return receivedValue
}
const iteratorInstance = pushBackIntoGeneratorExample()
iteratorInstance.next('new value') // => { value: null, done: false }
iteratorInstance.next() // => { value: 'new value', done: true }!
function * generatorFn () {
for (let i = 0; i < 5; i++) {
yield i
}
}
const iteratorInstance = generatorFn()
for (let value of iteratorInstance) {
console.log(value)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
const sum = (a, b, c) => a + b + c
const boundSum = sum.bind(null, 1, 2)
// console.log(boundSum(3)) => 6!
@srowhani
srowhani / basic_currying.js
Created December 17, 2018 19:09
Currying
const sum = (a, b, c) => a + b + c
const curriedSum = a => b => c => sum(a, b, c)
// sum(1, 2, 3) => 6
// sum(1)(2)(3) => 6
@srowhani
srowhani / humanize.js
Created October 10, 2018 20:09
Better humanize for moment (pluralize from ember-inflector)
import { pluralize } from 'ember-inflector'
export function humanize (duration) {
const durationComponents = [
{ value: duration.years(), unit: 'year' },
{ value: duration.months(), unit: 'month' },
{ value: duration.days(), unit: 'day' },
{ value: duration.hours(), unit: 'hour' },
{ value: duration.minutes(), unit: 'minute' },
{ value: duration.seconds(), unit: 'second' },