Skip to content

Instantly share code, notes, and snippets.

View gregorynicholas's full-sized avatar
💀
alter.

gregory nicholas gregorynicholas

💀
alter.
View GitHub Profile
@ryankirkman
ryankirkman / auth_to_expressjs_with_curl.sh
Created March 29, 2011 08:43
How to authenticate to an express.js web service with curl
#!/bin/sh
## Save cookies to the "cookies.txt" file
## Assumes the web service expects username
## and password in a JSON object, submitted via POST.
curl --cookie-jar cookies.txt -H "Content-Type: application/json" -X POST http://localhost:3000/user/login -d "{\"username\": \"YOURUSERNAME\", \"password\": \"YOURPASSWORD\"}"
## Now to use the authenticated session:
## (Assuming your web service speaks JSON)
curl --cookie cookies.txt -X GET http://localhost:3000/user/SOMEID
@ento
ento / gist:903098
Created April 5, 2011 05:57
Steps to install pep8 pre-commit hook managed by git-hooks
# Repository developers
cd /path/to/somewhere
git clone https://github.com/kergoth/git-hooks
export PATH=/path/to/somewhere/git-hooks:$PATH
cd /path/to/project
git hooks --install
@abachman
abachman / 0. why
Created April 16, 2011 18:28
acclimating myself to the Mac keyboard layout by reclaiming keyboard shortcuts. https://twitter.com/#!/abachman/status/59323764772569088
For the last two years I've been using Ubuntu Linux for software development.
Last week I got a MacBook Pro and have been changing over. I run a heavily
customized vim setup, so the change was particularly difficult with regards to
my keyboard layout.
These step show what I did to make my Mac work like my Linux machines which all
have caps-lock remapped to control. I used OSX's built in keyboard setup tool
to remap my caps-lock key to be a command key, since command, for the most
part, takes the place of control as the primary shortcut key modifier.
@harperreed
harperreed / startups_need.md
Created April 25, 2011 16:54
Things startups do and don’t need

#Things startups do and don’t need

Initial list ripped from Chris Dixon's Things startups do and don’t need. I thought it would be good to place this list in a place that could be community editable/forkable/maintainable.
Gist here

###Things startups do need

  • Sunny office
  • Windows that open
  • Democratically controlled music system
@schacon
schacon / gist:942899
Created April 26, 2011 19:19
delete all remote branches that have already been merged into master
$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@wrttnwrd
wrttnwrd / linkscape-google-apps-script.js
Created April 29, 2011 02:36
Linkscape in Google Apps Script
function getLinkscape() {
lastRow = FindRows();
startRow = lastRow + 1;
var active_spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var utility_sheet = active_spreadsheet.getSheetByName("Utilities");
params = utility_sheet.getRange(5,3,7,3).getValues();
url = params[2][0];
AccessID = params[0][0];
secret = params[1][0];
method = "HMAC_SHA_1";
@mdornseif
mdornseif / replication.py
Created May 1, 2011 20:35
Replication of AppEngine & Minimal implementation for generating zipfiles. See also http://mdornseif.github.com/2011/05/01/writing-zipfiles-to-blobstore.html
#!/usr/bin/env python
# encoding: utf-8
"""
replication.py - extport data to external systems
Created by Maximillian Dornseif on 2011-05-01.
Copyright (c) 2011 HUDORA. All rights reserved.
"""
from __future__ import with_statement
@solsolomon
solsolomon / module.js
Created May 3, 2011 20:29
module pattern stub
var stub = function (settings) {
var _settings = {
$container: $('#container')
};
if (settings) {
$.extend(_settings, settings);
}
_returnObject = {
@amrnt
amrnt / rails.validations.js.coffee
Created May 6, 2011 16:13
Rails 3 Client Side Validations - CoffeeScript
###
* Rails 3 Client Side Validations - v3.0.4
* https://github.com/bcardarlela/client_side_validations
*
* Copyright (c) 2011 Brian Cardarella
* Licensed under the MIT license
* http://www.opensource.org/licenses/mit-license.php
*
* CoffeeScript Version is by Amr Numan Tamimi - v3.0.4.CoffeeScript
###
@soffes
soffes / blame.rb
Created May 12, 2011 17:31
Find the number of lines of code per person in a repository
# Put this file in the root of your git repository then run `ruby blame.rb`.
# You will need gsed. You can install gsed with `brew install gsed`.
# Crazy shell script taken from http://stackoverflow.com/questions/4589731/git-blame-statistics
input = `git ls-tree -r HEAD|gsed -re 's/^.{53}//'|while read filename; do file "$filename"; done|grep -E ': .*text'|gsed -r -e 's/: .*//'|while read filename; do git blame "$filename"; done|gsed -r -e 's/.*\\((.*)[0-9]{4}-[0-9]{2}-[0-9]{2} .*/\\1/' -e 's/ +$//'|sort|uniq -c`
aggregated = {}
input.lines.each do |line|
line.strip!