Skip to content

Instantly share code, notes, and snippets.

View AlexZeitler's full-sized avatar
👷‍♂️
Building stuff

Alexander Zeitler AlexZeitler

👷‍♂️
Building stuff
View GitHub Profile
@AlexZeitler
AlexZeitler / gist:872b7ce1bf8c477e69b5
Created October 16, 2015 18:41 — forked from RubyTuesdayDONO/gist:5006455
logic revisions to pass test case
// Dependency resolution, adapted from https://gist.github.com/1232505/f16308bc14966c8d003c2686b1c258ec41303c1f
function resolve(graph) {
var sorted = [], // sorted list of IDs ( returned value )
visited = {}; // hash: id of already visited node => true
// 2. topological sort
Object.keys(graph).forEach(function visit(name, ancestors) {
if (!Array.isArray(ancestors)) ancestors = [];
ancestors.push(name);
visited[name] = true;
@AlexZeitler
AlexZeitler / .gitconfig
Created November 28, 2015 14:42 — forked from samsalisbury/.gitconfig
Git diff and merge with p4merge (OSX)
[merge]
keepBackup = false
tool = p4merge
[mergetool "p4merge"]
cmd = /Applications/p4merge.app/Contents/Resources/launchp4merge "\"$PWD/$BASE\"" "\"$PWD/$REMOTE\"" "\"$PWD/$LOCAL\"" "\"$PWD/$MERGED\""
keepTemporaries = false
trustExitCode = false
keepBackup = false
[diff]
tool = p4merge
[TestFixture]
public class InboundRouteTests
{
private Uri baseUri;
private HttpConfiguration config;
[TestFixtureSetUp]
public void FixtureSetUp()
{
baseUri = new Uri("https://tests.local");
require.config({
baseUrl: '/backbone-tests/',
paths: {
'jquery' : '/app/libs/jquery',
'underscore' : '/app/libs/underscore',
'backbone' : '/app/libs/backbone',
'mocha' : 'libs/mocha',
'chai' : 'libs/chai',
'chai-jquery' : 'libs/chai-jquery',
'models' : '/app/models'
@AlexZeitler
AlexZeitler / README.md
Created November 13, 2015 14:55 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@AlexZeitler
AlexZeitler / cpu-bound.js
Created October 25, 2016 11:18 — forked from MikeBild/cpu-bound.js
Node.js - CPU bound operations with Rx
const RxNode = require('rx-node');
const Rx = require('rx');
const spawn = require('child_process').spawn;
RxNode.fromStream(spawn('find', ['/','-type','f','-exec', 'cat', '{}', '\+']).stdout)
.map(x => x.toString())
.map(x => RxNode.fromStream(spawn('./word-count.js', [x]).stdout))
.mergeAll()
.map(x => x.toString())
.do(x => console.log(x))
@AlexZeitler
AlexZeitler / vm-resize-hard-disk.md
Last active February 12, 2017 16:44 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@AlexZeitler
AlexZeitler / gist:2c24a4d8ee10775f330447ff63bf19dc
Created February 12, 2017 20:13 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch
@AlexZeitler
AlexZeitler / node-cluster-messaging.js
Created April 29, 2017 07:33 — forked from jpoehls/node-cluster-messaging.js
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.
@AlexZeitler
AlexZeitler / async-either-with-promise.js
Created September 11, 2017 21:06 — forked from MikeBild/async-either-with-promise.js
Async Railway Oriented Programming in JS
#!/bin/env node
//thx to http://fsprojects.github.io/Chessie/a-tale-of-3-nightclubs.html
Promise.all([
suitablePersonEnterGayBar(),
unsuitablePersonEnterGayBar(),
])
.then(result => result.map((person, i) => `Person ${i+1}: ${person.cost || ''}${person.reasons.join(' ')}`))
.then(result => console.log(`Person entries\n${result.join('\n')}`));