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
export default function registerContent(uri) { | |
const tree = {} | |
const files = fs.readdirSync(uri) | |
files.forEach((fileName) => { | |
const fileUri = path.join(uri, fileName) | |
if(fs.lstatSync(fileUri).isDirectory()) { | |
tree[fileName] = registerContent(fileUri) | |
} else { |
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
function getDistance(strA, strB) { | |
const matrix = []; | |
const arrA = strA.split(''); | |
const arrB = strB.split(''); | |
// fill matrix with a row for each character and | |
// for each row add a single column with incrementing (0 to length) | |
for(let a = 0; a < arrA.length + 1; a++) { | |
matrix[a] = [a] |
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
const subject$ = new Rx.Subject(); | |
const bindAction = (action) => (...args) => subject$.next(action(args)); | |
const doSomething = () => ({ type: 'DO_SOMETHING' }) | |
const doSomethingAsyncComplete = () => { | |
return { | |
type: 'DO_SOMETHING_COMPLETE' | |
} |
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
const HeaderAPI = {}; | |
HeaderAPI.updateAuthenticated = function() { | |
console.log('UPDATING!'); | |
} | |
class Header { | |
constructor() { | |
} | |
} |
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
const storiesEndpoint = 'https://hacker-news.firebaseio.com/v0/topstories.json?limit=10'; | |
const storiesFetch$ = Rx.Observable.fromPromise(fetch(storiesEndpoint)); | |
const decoder = new TextDecoder(); | |
const storyIds$ = storiesFetch$ | |
.map(response => response.body) | |
.map(body => body.getReader()) | |
.switchMap((reader) => { | |
return Rx.Observable.create((observer) => { | |
function search() { |
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 cycle from '@cycle/core'; | |
const Cycle = require('@cycle/core'); | |
// import Rx from 'rxjs'; | |
const mount = document.createElement('div'); | |
document.body.appendChild(mount) | |
function main(sources) { | |
const click$ = sources.DOM; | |
return { |
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
local function next(self, value) | |
for i = 1, self.observerCount do | |
self.observers[i](value) | |
end | |
end | |
local function subscribe(self, observer) | |
table.insert(self.observers, observer) | |
self.observerCount = self.observerCount + 1 | |
end |
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
./configure --with-lua=/usr/local --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0 |
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
# https://gist.github.com/bastman/5b57ddb3c11942094f8d0a97d461b430 | |
function cleandocker-images { | |
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) | |
} | |
function cleandocker-containers { | |
docker rm $(docker ps -qa --no-trunc --filter "status=exited") | |
} |
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
# resource "aws_ecs_service" "scraper" { | |
# name = "scraper_service" | |
# cluster = "${aws_ecs_cluster.scraper_cluster.name}" | |
# # Track the latest ACTIVE revision | |
# task_definition = "${aws_ecs_task_definition.scraper_task.family}:${max("${aws_ecs_task_definition.scraper_task.revision}", "${data.aws_ecs_task_definition.scraper_task.revision}")}" | |
# desired_count = 1 | |
# } | |
data "aws_ecs_task_definition" "scraper_task" { |