This file contains 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
Run MongoDB and the Mongo Client from Docker | |
Step 1: Start the mongodb service via docker | |
$ docker run --name localmongo -p 27017:27017 -d mongo | |
Step 2: exec into the machine | |
$ docker exec -it localmongo mongo mongodb://localhost:27017 | |
Other: | |
Substitute the localhost:27017 string for remote access |
This file contains 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
# Merge a branch B1 in N1 with rebase | |
git checkout N1 | |
git pull | |
git checkout B1 | |
git rebase N1 | |
git checkout N1 | |
git rebase B1 | |
# Yet another approach | |
https://medium.com/@sda/git-rebase-based-workflow-cheat-sheet-3e37ad39da66#.lovwmnkbo |
This file contains 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
#firefox example | |
- Install XQuartz | |
open -a XQuartz | |
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}') | |
xhost + $ip |
This file contains 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
#!/bin/bash | |
# | |
# Crude script to backup an organisations repositories and its members forks. | |
# | |
# Name of organisation | |
ORG="change" | |
# Needed to talk to API |
This file contains 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
/** | |
* Created by dm on 2/19/16. | |
*/ | |
'use strict'; | |
const _ = require('underscore'); | |
const tableMemo = _.memoize(loadTable, function(input) { | |
return input.name; | |
}); |
This file contains 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 script = document.createElement("script"); | |
script.src = "https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"; | |
document.body.appendChild(script); |
This file contains 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
/** Copy All and run in Chrome inspect | |
* Simple Node Promise Example with Chaining | |
* @param input | |
* @returns {Promise} | |
*/ | |
function calculate(input) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
if (input.value===input.numberToReject) { | |
console.log('reject'); |
This file contains 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
// Forward to HTTP with Options | |
// Stop using SSLV3 (no good) | |
var options = | |
{ | |
host: config.uri_velocity.host, | |
port: config.uri_velocity.port, | |
path: config.uri_velocity.path, | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', |
This file contains 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
CLI elixir iex |
This file contains 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
//Time Complexity | |
function solution(int x, int y, int d) | |
{ | |
assert(x < y); // 1 | |
assert(d > 0); | |
int distance = y - x; // 2 | |
int steps = distance / d; // 3 | |
if(distance % d != 0) // 4 | |
++steps; |