Skip to content

Instantly share code, notes, and snippets.

@quipu
quipu / index.html
Created November 2, 2014 19:22
CSS Responsive Menu
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS Only Navigation Menu</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<label for="show-menu" class="show-menu">Show Menu</label>
@quipu
quipu / gist:b8e1f5f9bfaf575e5f8f
Last active August 29, 2015 14:06
Android ADB logcat-color for Cordova testing
logcat-color CordovaActivity:V CordovaWebView:V CordovaWebViewClient:V IceCreamCordovaWebViewClient:V CordovaLog:V *:S
@quipu
quipu / gist:1139aae048ec3f3dc7d6
Last active August 29, 2015 14:06 — forked from edasque/gist:bd8aa4087c843e31e38d
Cordova Android Logcat filter
logcat-color CordovaActivity:V CordovaWebView:V CordovaWebViewClient:V IceCreamCordovaWebViewClient:V CordovaLog:V *:S
@quipu
quipu / bootstrap.js
Created August 17, 2014 00:19 — forked from chrisjhoughton/bootstrap.js
GeoJSON queries using Mongo and SailsJS
module.exports.bootstrap = function (cb) {
// Ensure we have 2dsphere index on Property so GeoSpatial queries can work!
sails.models.YOURMODEL.native(function (err, collection) {
collection.ensureIndex({ coordinates: '2dsphere' }, function () {
// It's very important to trigger this callack method when you are finished
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
cb();
@quipu
quipu / BasicModulePattern.js
Created June 16, 2014 09:01
Example of basic module pattern.
var dom = (function() {
var _counter = 0;
return {
generateId : function () {
return "customId" + _counter++;
},
create : function(tagName, id) {
var el = document.createElement(tagName);
el.id = id || this.generateId();
@quipu
quipu / AMDPattern.js
Created June 16, 2014 08:58
Example module using Asynchronous Module Definition (AMD) design pattern.
define(function() {
var _counter = 0;
function generateId() {
return "customId" + _counter++;
}
function create(tagName, id) {
var el = document.createElement(tagName);
el.id = id || generateId();
return el;
@quipu
quipu / SingletonPattern.js
Created June 16, 2014 08:56
Example code demonstrating the singleton design pattern.
var dom = (function() {
var _counter = 0,
instance;
generateId = function () {
return "customId" + _counter;
};
create = function (tagName, id) {
var el = document.createElement(tagName);
@quipu
quipu / install.sh
Created March 25, 2014 09:54
Vagrant setup shell script for NodeJS, Express, MySQL
#!/usr/bin/env bash
echo "--- Good morning, master. Let's get to work. Installing now. ---"
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- MySQL time ---"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
@quipu
quipu / simplehttp.sh
Created March 8, 2014 20:00
Simple shell wrapper for pythons SimpleHTTP module
#!/usr/bin/env bash
if [ $1 ] ; then
echo "-- Starting web server on port $1 --"
python -m SimpleHTTPServer $1
else
echo "-- Starting web server on port 8000 --"
python -m SimpleHTTPServer
fi
@quipu
quipu / RevealingModulePattern.js
Last active October 13, 2015 13:17
Javascript Revealing Module pattern
var myRevealingModule = function () {
var privateVar = "Ben Cherry",
publicVar = "Hey there!";
function privateFunction() {
console.log( "Name:" + privateVar );
}
function publicSetName( strName ) {