Skip to content

Instantly share code, notes, and snippets.

View mallond's full-sized avatar
:electron:
-.- .--- --... -.- --. ---

David Mallon ⚙ mallond

:electron:
-.- .--- --... -.- --. ---
View GitHub Profile
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
# 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
@mallond
mallond / gist:ec9c41a3fb206a29ae0cd4a7a4083e14
Last active November 1, 2016 20:02
Mac osx X11 Docker Example
#firefox example
- Install XQuartz
open -a XQuartz
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost + $ip
@mallond
mallond / Git Backup
Last active February 24, 2017 22:54
GIT Download All
#!/bin/bash
#
# Crude script to backup an organisations repositories and its members forks.
#
# Name of organisation
ORG="change"
# Needed to talk to API
/**
* Created by dm on 2/19/16.
*/
'use strict';
const _ = require('underscore');
const tableMemo = _.memoize(loadTable, function(input) {
return input.name;
});
@mallond
mallond / Load Underscore into Chrome Console
Created January 29, 2016 01:32
Javascript Cool Tricks
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);
@mallond
mallond / Simple Node Promise Example with Chaining
Last active January 29, 2016 01:30
Simple Node Promise Example with Chaining
/** 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');
@mallond
mallond / gist:f2bfbe09f353a3d0c0f5
Created April 30, 2015 20:54
secureProtocal SSL
// 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',
@mallond
mallond / Elixir Cheet Sheet
Last active August 29, 2015 14:16
Elixir by Example (Cheet Sheet)
CLI elixir iex
@mallond
mallond / Frog-Jmp.js
Last active August 29, 2015 14:13
Test code snippets - Javascript
//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;