Skip to content

Instantly share code, notes, and snippets.

@ashking
ashking / array_diff.js
Created February 18, 2015 10:02
Compare and diff two array of objects
//Requires underscores.js
//Verbose:
var a = [{'id':1, 'value':10}, {'id':2, 'value':20}];
var b = [{'id':1, 'value':10}, {'id':4, 'value':40}];
var arr1 = _.pluck(a, "id");
var arr2 = _.pluck(b, "id");
var diff = _.difference(arr1, arr2);
@ashking
ashking / yo-backbone-grunt-serve.md
Last active August 29, 2015 14:14
yo backbone => grunt serve issue

##Guys, whenever you encounter a similar error

Running "compass:server" (compass) task
Errno::ENOENT on line ["33"] of C: No such file or directory @ realpath_rec - D:
/Ashwin/workspace/yoApp3/app/bower_components
Run with --trace to see the full backtrace

##try the following

@ashking
ashking / 0_reuse_code.js
Created August 18, 2014 20:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
GHBU_BACKUP_DIR=${GHBU_BACKUP_DIR-"github-backups"} # where to place the backup files
GHBU_ORG=${GHBU_ORG-"<CHANGE-ME>"} # the GitHub organization whose repos will be backed up
# (if you're backing up a user's repos instead, this should be your GitHub username)
GHBU_UNAME=${GHBU_UNAME-"<CHANGE-ME>"} # the username of a GitHub account (to use with the GitHub API)
GHBU_PASSWD=${GHBU_PASSWD-"<CHANGE-ME>"} # the password for that account
GHBU_GITHOST=${GHBU_GITHOST-"github.com"} # the GitHub hostname (see comments)
GHBU_PRUNE_OLD=${GHBU_PRUNE_OLD-true} # when `true`, old backups will be deleted
@ashking
ashking / Installing Cloud9 IDE.md
Created September 2, 2013 02:58
Steps to install Cloud9 IDE

###Step 1: Update system for latest packages sudo apt-get -y update or sudo yum -y update

###Step 2: Install dependencies sudo apt-get -y install libssl-dev git-core pkg-config pkgconfig build-essential curl gcc g++ libxml2-dev or sudo yum -y install libssl-dev git-core pkg-config pkgconfig build-essential curl gcc g++ libxml2-dev

@ashking
ashking / Cloud9.sh
Created August 25, 2013 13:11
Install Cloud9 IDE locally on you machine in easy steps
#!/bin/sh
#######################################################################################
# _______ _ _______ ______ _____ _________ ______ _______ #
# ( ____ \( \ ( ___ )|\ /|( __ \ / ___ \ \__ __/( __ \ ( ____ \ #
# | ( \/| ( | ( ) || ) ( || ( \ )( ( ) ) ) ( | ( \ )| ( \/ #
# | | | | | | | || | | || | ) |( (___) | | | | | ) || (__ #
# | | | | | | | || | | || | | | \____ | | | | | | || __) #
# | | | | | | | || | | || | ) | ) | | | | | ) || ( #
# | (____/\| (____/\| (___) || (___) || (__/ )/\____) ) ___) (___| (__/ )| (____/\ #