Skip to content

Instantly share code, notes, and snippets.

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

David Mallon ⚙ mallond

:electron:
-.- .--- --... -.- --. ---
View GitHub Profile
@mallond
mallond / MongoDB Cheats
Created July 13, 2013 17:27
MongoDB Cheats
Various Cheats found on the Web
mongo //Start Mongo
show dbs //Show databases
use mydb //User database named "­myd­b"
db //Show selected database
help //Get help
show collec­tion //Show collec­tions from a database
Finds - db.collection
@mallond
mallond / MongoDB Install Mac OS x
Last active December 21, 2015 18:39
MongoDB Install Mac OS x
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ "So easy"
1. brew update
2. brew install mongodb
3. start > mongod
4. test > open shell > mongo
db.test.save( { a: 1 } )
db.test.find()
Recommend installing XCode Command line Tools
@mallond
mallond / JQuery Include
Last active December 21, 2015 18:49
JQuery Include -
boilerplate
HTML Boilerplate - simple HTML includes using jquery
As a long time JSP developer, transitioning into the fabulous world of Pure HTML and JavaScript front-end development. There is a need to divide and conquer your web interface into manageable and reusable parts. This is a simple demo using JQuery that divides a front end website into three reusable parts.
Header
Main Container
Navigation
Footer
There is not much to it. JQuery does all the magic.
@mallond
mallond / gist:6518773
Created September 11, 2013 02:49
Local Storage: IE 9.0
if (window.addEventListener) {
window.addEventListener("storage", storageEventHandler, true);
} else if (window.attachEvent) {
document.attachEvent("onstorage", storageEventHandler);
}
@mallond
mallond / Raspberry PI - MongoDB
Last active August 29, 2015 14:02
Raspberry Pi - Project MongoDB
RASPBIAN Wheezy
RASPBIAN
Debian Wheezy
Version:January 2014
Release date:2014-01-07
Default login:pi / raspberry
URL:raspbian.org
Kernel version:3.10
http://www.raspberrypi.org/documentation/installation/installing-images/mac.md
@mallond
mallond / VI Cheat
Last active August 7, 2020 13:37
VI Cheat
Navigation Keys - These are used in command mode:
$ Move to end of line
^ Move to beginning of line
Save and Quit Commands - These are used in lastline mode:
:w Write buffer (Save changes and continue working in vi Editor)
:w new_filename Write buffer to new filename (continue working in vi)
:wq Write buffer (save changes) and quit vi
:q! Quit without saving changes
:wq! Write buffer (save changes) and quit vi
(The ! will override Read only permissions but only if you are the owner of the file.)
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}
@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;
@mallond
mallond / Elixir Cheet Sheet
Last active August 29, 2015 14:16
Elixir by Example (Cheet Sheet)
CLI elixir iex
@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',