Skip to content

Instantly share code, notes, and snippets.

@calvinf
calvinf / pr.md
Created March 25, 2013 18:47 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@calvinf
calvinf / getCSSUrls.sh
Created July 26, 2012 01:16
ack command for CSS URL regex
ack 'url\(.*?(?!_V)\)' --css -o
@calvinf
calvinf / multiplication-table.js
Created July 17, 2012 18:12
Multiplication Table in node.js
var util = require('util'),
sprintf = require('sprintf').sprintf, // npm install sprintf
rows = 10
for(var i=1;i<=rows;i++) {
for(var j=1;j<=rows;j++) {
var num = sprintf('%3d', i * j)
process.stdout.write(num + " ")
}
process.stdout.write("\n")
@calvinf
calvinf / mobile-meta-links.html
Created March 31, 2012 00:55
iOS Web App Configuration
@calvinf
calvinf / .ackrc
Last active June 10, 2020 22:11
ackrc (ack config dotfile)
--color
--recurse
--html
--css
--js
--java
--type-add=typescript=.ts,.tsx
--typescript
--type-add=graphql=.graphql
--graphql
@calvinf
calvinf / cssUrlSearch.sh
Created June 8, 2011 01:00
Search CSS files for every background-image URL and output unique URLs in a list
ack -o -h --nogroup --css 'url\((.*)\)' --output "\$1" | ack -o "^['\"](.*)['\"]$" --output "\$1" --passthru | sort -u
@calvinf
calvinf / .vimrc
Last active September 3, 2024 05:20
.vimrc file
" Enable pathogen
call pathogen#infect()
" Standard Vim settings
filetype on
filetype indent on
filetype plugin on
syntax on
//for additional examples, see: http://www.stevesouders.com/p3pc/
var theOtherScript = 'http://example.com/js/script.js';
var el = document.createElement('script');
el.async = false;
el.src = theOtherScript;
el.type = 'text/javascript';
(document.getElementsByTagName('HEAD')[0]||document.body).appendChild(el);
@calvinf
calvinf / WordCountTestCase.js
Created December 10, 2010 08:53
Utility Functions, a Test Class, and test cases for counting words in input text
/*
* WordCountTestCase Class
* Expects: paragraph, integer for expected count, array of expected words, and a test name
* returns boolean, test results logged to console
*/
function WordCountTestCase(paragraph, expectedCount, expectedWords, testName) {
this.testName = testName || 'Test';
this.paragraph = paragraph;
this.expectedCount = expectedCount;
this.expectedWords = expectedWords;
@calvinf
calvinf / .tcshrc
Created December 8, 2010 19:12
TCSH Shell Configuration
# keyboard bindings: http://www.ibb.net/~anne/keyboard/keyboard.html
if ($term == "xterm" || $term == "vt100" \
|| $term == "vt102" || $term !~ "con*") then
# bind keypad keys for console, vt100, vt102, xterm
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete
bindkey "\e[4~" end-of-line # End
bindkey "\e[8~" end-of-line # End rxvt