Skip to content

Instantly share code, notes, and snippets.

View etoxin's full-sized avatar

Adam Lusted etoxin

View GitHub Profile
@etoxin
etoxin / terminal.sh
Created November 20, 2014 12:16
Terminal Tips
# Search your command line history
history | grep 'Whatever'
# Discover what's eating your memory
top -o vsize
# Copy to the clipboard
echo "Boom" | pbcopy
# unzip archive into current directory
@etoxin
etoxin / jsOnce.js
Created November 3, 2014 05:56
Run a function Once
function once(fn, context) {
var result;
return function() {
if(fn) {
result = fn.apply(context || this, arguments);
fn = null;
}
return result;
@etoxin
etoxin / app.js
Created October 21, 2014 10:33
ArdunioTempSetter CouchDB
var express = require('express');
var http = require('http');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var nodeCouchDB = require("node-couchdb");
var couch = new nodeCouchDB("192.168.0.12", 5984);
var app = express();
@etoxin
etoxin / console.js
Created October 7, 2014 05:40
Highlight HTML elements via console api
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})
@etoxin
etoxin / faqCopy.js
Last active August 29, 2015 14:07
Grab Copy convert to jekyll
(function(){
console.log( $('#category-sales-content').html() + ':' );
$('.faq-list').each(function(i, item){
var $item = $(item);
console.log( $item.find('.faq-title').html() );
});
})()
@etoxin
etoxin / Async2.js
Last active August 29, 2015 14:07
Asynchronous Callbacks
function logItem(item) {
console.log(item);
}
function asyncEach3(arr, callback) {
// Utility inner function to create a wrapper function for the callback
function makeCallbackWrapper(arr, i, callback) {
// Create our function scope for use inside the loop
return function() {
callback(arr[i]);
@etoxin
etoxin / jsdoc.js
Last active August 29, 2015 14:05
jsdoc
// @type documentation http://usejsdoc.org/tags-type.html
/** @type {Array.<jQuery>} An array of jQuery elements */
var elements = $('div');
@etoxin
etoxin / gist:89edbf36f79691ab5026
Created August 12, 2014 04:49
run multiple jQuery instances.
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- load jQuery 1.11.1 -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
var jQuery_1_11_1 = $.noConflict(true);
</script>
@etoxin
etoxin / git.md
Last active April 14, 2026 02:02
GIT Bash Commands

search (regex)

git grep "regex"

list all branches

git branch -a
@etoxin
etoxin / spacers.html
Created July 31, 2014 05:17
SCSS Vertical Spacers
<div class="spacer50"></div>