Skip to content

Instantly share code, notes, and snippets.

@passy
passy / jade.md
Last active August 17, 2020 09:35
Using Yeoman and Jade

Using Yeoman and Jade

Getting started

  • Make sure you have yo installed: npm install -g yo
  • Run: yo webapp
  • Install grunt-contrib-jade: npm install grunt-contrib-jade --save-dev

Customization

@jacobrask
jacobrask / domsugar.js
Created August 30, 2012 08:24 — forked from neilj/gist:1532562
DOM sugar
// DOM sugar
// ==================================================================
// Modified version of Neil Jenkins' "Sugared DOM" <https://gist.github.com/3524145>
//
// Usage
// ------------------------------------------------------------------
// var make = domsugar(document);
//
// make( 'p.foo#bar', { hidden: true }, [ make( 'span' ) ] );
// => <p class="foo" id="bar" hidden><span></span></p>
@jacobvosmaer
jacobvosmaer / gist:3187346
Created July 27, 2012 10:35
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

git diff --name-only | uniq | xargs mvim

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

@vene
vene / magic_memit.py
Created June 30, 2012 06:55
memit: magic memory usage benching for IPython
# Author: Vlad Niculae <vlad@vene.ro>
# Makes use of memory_profiler from Fabian Pedregosa
# available at https://github.com/fabianp/memory_profiler
from IPython.core.magic import Magics, line_magic, magics_class
class MemMagics(Magics):
@line_magic
def memit(self, line='', setup='pass'):
@bhang
bhang / install_graphite_statsd_ubuntu_precise.sh
Created May 15, 2012 17:41
Install Graphite and statsd on Ubuntu 12.04 LTS (Precise Pangolin)
#!/bin/bash
# node.js using PPA (for statsd)
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
# Install git to get statsd
sudo apt-get install git
@jtratner
jtratner / rest_to_markdown.vim
Created May 4, 2012 06:39
Checks your vim regexp escapes -- save yourself tons of hassle!
command! -range -nargs=* CheckRegexpEscapes :call CheckRegexpEscapes(<f-args>)
" call with either no arguments or a:1 for escape character +
" an argument for each character to be escaped
" e.g. CheckRegexpEscapes('\\','(',')','_') ->
" checks that you put in '\\' behind each of '(',')','_',')'
" and prompts you to change it
" always asks to substitute
function! CheckRegexpEscapes(...)
" NonEscapedCharRegexp:
@jtratner
jtratner / makegraphs.py
Created May 2, 2012 01:34
DefaultColor(defaultdict)
matplotcolors= ['b','g','r','c','m','y','k']
defaultcolorlist = ["#00af64","#0b61a4","#ff9200","#ff4900","#9c02a7"]
defaultcolorlist.extend(matplotcolors)
from collections import defaultdict
class DefaultColor(defaultdict):
""" defaultdict that returns sequential elements of a list(if not specified, a color) each time it is
called Note that if input list is len(1) it will always return the same
value"""
def __init__(self,colorlst = defaultcolorlist):
@barraponto
barraponto / git-submodule-rm.sh
Created April 25, 2012 16:36
git submodule-rm
#!/bin/bash
function actual_path() {
if [ [ -z "$1" ] -a [ -d $1 ] ]; then
echo $(cd $1 && test `pwd` = `pwd -P`)
return 0
else
return 1
fi
}
@lpar
lpar / pwgen.rb
Created June 17, 2011 18:10
Simple generation of readable random passwords using Ruby
#!/usr/bin/env ruby
# encoding: UTF-8
# Simple password generation in Ruby.
#
# Generate reasonably secure random passwords of any chosen length,
# designed to be somewhat easy for humans to read and remember.
# Each password has a capitalized letter and a digit.
#
# Example:
@tranminhan
tranminhan / ExcelReading.java
Created May 25, 2011 15:43 — forked from Munawwar/ExcelReading.java
Java - Apache POI - Convert XLS/XLSX to CSV
/*
* Dependencies: Apache POI Library from http://poi.apache.org/
*/
package poi_excels;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;