Skip to content

Instantly share code, notes, and snippets.

View connor's full-sized avatar

Connor Montgomery connor

View GitHub Profile
@connor
connor / weebly-website-improvements.js
Created June 22, 2011 09:59
Improvements in the overall UX via some more inclusive JS
updateNav: function() {
Element.show('hoverNav');
// if not first image in set, display prev image button
if((activeImage != 0) && ($("lightbox2").getStyle('display') === 'block')){ // only register these event handlers if the lightbox is active
Element.show('prevLink');
document.getElementById('prevLink').onclick = function() {
myLightbox.changeImage(activeImage - 1); return false;
}
@connor
connor / ruby-array-example.rb
Created June 23, 2011 04:29
Ruby array example
array = [ :zero, :one, :two, :three, :four ]
print array.length # 5
print :four == array[4] # true — zero-indexed, so array[4] is the 5th item.
print array[5].nil? # true
print array[6].nil? #true
print [] # nil
print array[5, 0] # nil
print [] == array[5, 0] # true b/c both are nil
@connor
connor / question for jon.txt
Created September 14, 2011 23:59
question for jon
hate to bother you. im having trouble adding a challege_group via the console. i can see that when i do the following:
u = User.find(4) # 4 is my user id
u.challenges # returns a blank array
I get the desired results. However, I'm just not 100% sure of the syntax to add a challenges_group. I've tried a bunch of different things, and still no luck.
@connor
connor / newSite.sh
Created September 15, 2011 05:53
newSite command to make a new site from the terminal
## please note: this assumes you have a folder called _StartingSiteTemplate in ~/Documents.
## i have uploaded a zip of my _StartingSiteTemplate here: http://cl.ly/1u2W1K2Q192Z3C0r2J0x
## that file above is based off of paul irish's html5 boilerplate - highly recommended!
## NOTE: this is using textmate and LESScss, but those are easily configurable.
## NOTE: if rsync isn't working for you, note the file paths I'm using.
newSite(){
echo "Please name the directory: "
read SITE_NAME
echo "Creating $SITE_NAME... zomg!"
@connor
connor / keysocket-rdio.js
Created January 1, 2012 23:55
Add keyboard shortcut to Rdio's web app
// goes with Boris Smus's keysocket extension <https://github.com/borismus/keysocket/>
var PREV = 20;
var PLAY = 16;
var NEXT = 19;
var fake_prev_el = document.createElement('div');
fake_prev_el.id = "fake_prev_el";
fake_prev_el.style.height = 0;
fake_prev_el.style.width = 0;
@connor
connor / manifest.json
Created January 1, 2012 23:59
manifest file to go along with rdio-keysocket
{
"name": "Key Socket Media Keys",
"permissions": [ "tabs" ],
"update_url": "http://clients2.google.com/service/update2/crx",
"version": "0.2",
"icons": { "16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png" },
"description": "Control your favorite web-based music player with your keyboard's media keys",
"permissions": ["tabs"],
@connor
connor / external-url.markdown
Created January 9, 2012 19:57
Example using external-url
@connor
connor / external-url.html
Created January 9, 2012 20:01
index file using external-url
---
layout: default
title: "Blog"
date: 2011-12-29 11:34
---
<h3 class="subhead small-margins">Posts</h3>
<ul class="posts">
{% assign index = true %}
@connor
connor / gist:1591714
Created January 10, 2012 22:53 — forked from founddrama/gist:1013614
a jshint pre-commit hook for git
#!/bin/sh
# A pre-commit hook for git to lint JavaScript files with jshint
# @see https://github.com/jshint/jshint/
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
@connor
connor / pre-commit.sh
Created January 11, 2012 22:14
Check your files against JSHint before committing
# WHAT IS THIS?
# This is a pre-commit hook that runs your js code against jshint before committing.
# If you ever want to make a commit without it running this, simply run:
# git commit -n
# INSTRUCTIONS:
# 1. Install jshint-runner: npm install -g jshint-runner
# 2. In your git project, rename .git/hooks/pre-commit.sample to .git/hooks/pre-commit
# 3. Create a .jshintrc file in ~/. This is simply an object with the options you want. See mine here: https://gist.github.com/1597131
# 4. Paste the code below line 14 in that ~/.jshintrc file