Example of different ways to bind instance methods so they persist access to this
This file contains hidden or 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
{ | |
"basics": { | |
"name": "Ben Duncan", | |
"label": "Senior Web Developer", | |
"picture": "https://example.com/photo.jpg", | |
"email": "[email protected]", | |
"phone": "+33 6 95 67 69 23", | |
"website": "https://thomasedison.com", | |
"summary": "I am a web developer with over 15 years of real-world experience, and have built production features serving millions of users. I am a based in France and am comfortable with remote work. I am particularly interested in improving user experiences on an ambitious and healthy remote-first team.", | |
"location": { |
This file contains hidden or 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
# reload configs | |
bind r source-file ~/.tmux.conf | |
# increase the scroll buffer size | |
set -g history-limit 10000 | |
# add the prefix key Ctrl+J | |
set-option -g prefix C-j | |
set-option -g prefix2 C-b |
This file contains hidden or 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
import fetch from './fetch-proxy.js'; | |
export async function saveImage(imageURI) { | |
return await fetch('user/picture', { | |
method: 'PUT', | |
body: { photoContent: imageURI }, | |
fileKeys: ['photoContent'], | |
}); | |
} |
This file contains hidden or 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
// Abstract creating an action that has a type and a payload: | |
// const addTodo = createAction(ADD_TODO); | |
// is equivalent to | |
// const addTodo = (payload) => ({ type: ADD_TODO, payload }); | |
// | |
// Optionally you can pass in a payloadMap when defining an action | |
// to reshape the payload before storing it on the action. | |
import { identity } from 'lodash'; |
This file contains hidden or 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
// This demo uses Babel for es2015 compilation and Promises, and superagent for requests. | |
// An example async pipeline, using a demo API | |
document.getElementById('run').addEventListener('click', (evt) => { | |
iteratePromises(function* () { | |
log('Requesting list of posts'); | |
let postsResponse = yield superagent.get( | |
'http://jsonplaceholder.typicode.com/posts/'); | |
log('Requesting author of first post'); |
This file contains hidden or 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
// Find symlinks that don't work and fix them. | |
// | |
// This is done by: | |
// 1. Getting a list of all file paths in a directory | |
// 2. Filtering for broken symlinks by reading binary content as unicode | |
// 5. Determining relative path between source and target | |
// 6. Deleting old link file | |
// 7. Creating new relative link file | |
var fs = require('fs'); |
This file contains hidden or 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
/** | |
* getProgressPlugin | |
* Return a progress plugin instance which outputs build progress percentages in realtime | |
* | |
* @return {Object} A ProgressPlugin instance | |
*/ | |
function getProgressPlugin() { | |
var chars = 0, lastState, lastStateTime; | |
return new webpack.ProgressPlugin(function(percentage, msg) { | |
var state = msg; |
This file contains hidden or 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 crossDomain = (function(){ | |
var top = null; | |
try { | |
top = window.top.location.host; | |
} catch(err) {} | |
return (top === null); | |
}()); |
This file contains hidden or 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
settings = { | |
jshint: true, | |
editor: { | |
theme: "monokai", | |
indentUnit: 4, | |
smartIndent: true, | |
lineWrapping: true, | |
lineNumbers: true, | |
matchBrackets: true | |
} |
NewerOlder