Skip to content

Instantly share code, notes, and snippets.

View ericzon's full-sized avatar
🏠
Working from home

Eric ericzon

🏠
Working from home
View GitHub Profile
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;
@prestarocket
prestarocket / prestashop gitignore
Created July 8, 2011 00:43
Prestashop gitignore
# This is a template .gitignore file for git-managed Prestashop projects. Inspired by micahwalter wordpress gitignore
#Ignore ds_store
*.DS_Store
# Ignore everything in the root except modules, themes and override.
/*
!modules/
!themes/
@asabaylus
asabaylus / git-vlog
Last active June 21, 2022 20:45
Git visual log for the console
# Git visual log displays commit tree view with who did what when and in which branch
git config --global alias.vlog 'log --graph --date-order --date=relative --pretty=format:"%C(cyan)%h: %Cblue - %an - %Cgreen %C(cyan)%ar:%Creset%n%s%n" --color'
@asabaylus
asabaylus / index.js
Created December 14, 2011 02:32
Node.js turn querystring params into JSON
var http = require('http'),
url = require('url'),
util = require('util');
http.createServer( function (req, res) {
res.writeHead( 200, {'Content-Type': 'text/plain'} );
var qs = url.parse( req.url, true );
res.write( util.inspect( qs.query ) );
@greghelton
greghelton / cookbook.sql
Created January 1, 2012 06:41
MySQL Database for Cookbook, Recipes, Ingredients
-- start the server: $ mysqld --console
-- login: $ mysql -u root --password=wxyz
-- run the script: mysql> source /Users/javapro/dev/src/sql/Cookbook.sql
-- the script:
drop database if exists Cookbook;
create database Cookbook;
connect Cookbook;
@alejandro
alejandro / helpers.js
Created January 21, 2012 21:39
DynamicHelpers Ejemplo
// Extraido de https://github.com/visionmedia/finance/blob/master/lib/helpers.js
/**
* Months.
*/
var months = [
'January'
, 'February'
, 'March'
@shiawuen
shiawuen / call-method.js
Created March 6, 2012 02:15
Can instance methods not be called from within other instance methods?
var goose = require('mongoose')
, db = goose.connect('mongodb://localhost/testmongo')
, Schema = goose.Schema
, sc = new Schema({
a: String,
b: Date
})
sc.methods.bbb = function() {
return this.b.getFullYear()
@remi
remi / .gitconfig
Created March 20, 2012 19:20
Find the most used verbs in your Git commit messages
[alias]
verbs = !git log --pretty=format:'%s' | cut -d \" \" -f 1 | sort | uniq -c | sort -nr
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ibeex
ibeex / foo.log
Created August 4, 2012 13:46
Flask logging example
A warning occurred (42 apples)
An error occurred