- create a repo
- add a package.js, .gitiginroe, .travis.yml, test/dummy-test.js
- setup a github repo and add team mates as colaborators
- enable travis
- In the repo settings, make the master branch a protected branch
- Require pull request reviews before merging
- Require review from Code Owners
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
// great for perioticly limiting events | |
throttle = (fn, ms) => { | |
let ready = true; | |
return (...args) => { | |
if(ready){ | |
ready = false | |
setTimeout(() => ready = true, ms) | |
return fn(...args) | |
} | |
} |
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
fs = require('fs'); | |
promisify = fn => (...args) => | |
new Promise((resolve, reject) => | |
fn(...args, (err, data) => err ? reject(err) : resolve(data))) | |
filePath = process.argv[2] | |
promisify(fs.readFile)(filePath) | |
.then(buf => console.log(buf.toString())) | |
.catch(console.error) |
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
fileToDataURL = (file) => { | |
return new Promise((resolve, reject) => { | |
let reader = new FileReader() | |
reader.addEventListener('error', reject) | |
reader.addEventListener('load', () => { | |
resolve(reader.result) | |
}) | |
if(file) |
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
factory = (props, methods, proxy) => new Proxy(Object.assign(Object.create(methods), props), proxy) | |
DLL = (value, next=null) => { | |
let props = {value, next, prev: null} | |
let methods = { | |
map: function (cb) { | |
let result = DLL(null) | |
let current = this | |
let i=0 | |
while(current){ |
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
'use strict' | |
factory = (props, methods, proxy) => new Proxy(Object.assign(Object.create(methods), props), proxy) | |
// helper used with reducers | |
cleanHead = (node) => (node.prev = null) || node | |
DLL = (value, next=null) => { | |
let props = {value, next, prev: null} | |
let methods = { |
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
// paste this in the console on jquery.com to tests | |
redditFetch = (title) => $.getJSON(`https://www.reddit.com/r/${title}.json`) | |
reddit = new Proxy({}, { | |
get: (obj, prop) => redditFetch(prop).then(res => res.data) | |
}) | |
// reddit.(anyredditpage).then(callback) | |
reddit.programming.then(console.log) |
Week | Sudent | teacher |
---|---|---|
Week 6A | ipsum | todo mvc |
Week 6B | kanban | budget tracker |
Week 7 | audio/video gallery | photo gallery |
Week 8 | travel blog | craislist |
Week 9 | slugcaht | ?? |
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
// extendy is a higher-order frunction that wraps to constructors | |
// and allows b to "inherit" from a | |
extendy = (a) => ( b) => (opts={}) => Object.assign({}, a(opts.super || {}), b(opts)) | |
| |
// create a cow "constructor" | |
cow = (opts={}) => ({utters: opts.utters || 4, milk: () => "got milk?"}) | |
| |
// create a stawbery cow "constructor" that extends cow | |
strawbery = extendy(cow)((opts={}) => ({flavor: 'strawbery', expires: opts.expires || 'tomorrow'})) | |
|
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 cool = prompt('are you cool'); | |
alert('you are cool:' + cool); |