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 / 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 / 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 / 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 / test.rb
Created January 27, 2012 02:47
test
# loops
3.times do |t|
puts t
end
# assignment
professors = ["Chambers", "Goldwasser", "Scannell"]
# iterators
professor.each do |professor|