Skip to content

Instantly share code, notes, and snippets.

View underhilllabs's full-sized avatar

Bart Lantz underhilllabs

View GitHub Profile
@josegonzalez
josegonzalez / category.rb
Created August 14, 2010 21:41
Category plugin for Jekyll
module Jekyll
class CategoryIndex < Page
def initialize(site, base, dir, category)
@site = site
@base = base
@dir = dir
@name = 'index.html'
self.process(@name)
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
@knitfaced
knitfaced / RavelryClientSignin.java
Created November 1, 2010 21:46
snippet to connect to the Ravelry API
private String createShopSearchQuery() throws NoSuchAlgorithmException, InvalidKeyException, UnsupportedEncodingException {
String jsonAction = "http://api.ravelry.com/shops/search.json?";
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ");
Calendar now = Calendar.getInstance();
String timestamp = df.format(now.getTime());
String searchTerm = "yarn";
int shop_type_id = 1;
String query = jsonAction;
query += "access_key=" + urlEncode(ACCESS_KEY);
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@joshuajabbour
joshuajabbour / gist:864614
Created March 10, 2011 18:38
Git(Hub) Drupal Project Development Model

Setup

Configure git by using the template for .gitconfig, and adding commands for a Git-aware prompt to .profile.

To clone the repository (the "template" parameter is important):
git clone git@github.com:user/repo.git --template=/PATH/TO/TEMPLATES

Also run (this will set up the repository so a branch can be pushed only while on that branch):
git config remote.origin.push HEAD

@joshuajabbour
joshuajabbour / .gitconfig
Created March 10, 2011 18:43
Git Config: Rename this file ".gitconfig" and place inside your home directory.
##
# This file should be renamed ".gitconfig" and placed inside your home directory.
##
[user]
name = YOUR_NAME
email = YOUR_EMAIL
[github]
user = YOUR_GITHUB_USERNAME
token = YOUR_GITHUB_TOKEN
@joshuajabbour
joshuajabbour / .profile
Created March 10, 2011 18:44
Git Bash tools: Bash completion and shell prompt to list current branch/dirty status. Add this code to your .profile or .bash_profile or .bashrc.
##
# Bash completion scripts
##
if type brew > /dev/null 2>&1 && [ -f `brew --prefix`/etc/bash_completion ]; then
# Homebrew: http://mxcl.github.com/homebrew/
. `brew --prefix`/etc/bash_completion
fi
if [ -f /contrib/completion/git-completion.bash ]; then
@caleywoods
caleywoods / gist:1197657
Created September 6, 2011 14:15
CentOS install
#!/usr/bin/env bash
echo "Checking for SSH key, generating one if it exists ..."
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa
echo "Copying public key to clipboard. Paste it into your Github account ..."
[[ -f ~/.ssh/id_rsa.pub ]] && cat ~/.ssh/id_rsa.pub | xclip
open https://github.com/account/ssh
echo "Using yum to install OS packages so let's update it first ..."
@mislav
mislav / aprompt.png
Last active February 11, 2024 06:40
My zsh prompt. No oh-my-zsh needed
aprompt.png
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@underhilllabs
underhilllabs / include_math.md
Created May 20, 2012 20:40
gcc #include <math.h>

from gcc FAQ

gcc faq

14.3: I'm trying to do some simple trig, and I am #including <math.h>, but I keep getting "undefined: sin" compilation errors.

A: Make sure you're actually linking with the math library. For instance, due to a longstanding bug in Unix and Linux systems, you usually need to use an explicit -lm flag, at the end of