Skip to content

Instantly share code, notes, and snippets.

View halloffame's full-sized avatar

Ryan Hall halloffame

View GitHub Profile
@halloffame
halloffame / gist:2908739
Created June 11, 2012 06:30
Problem sorting by seg number when number is like this: 240.15-01 (it will stick all the lines with XX.XX-XX in the back behind all the ones without the '-')
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="#all">
<xsl:output method="xml" indent="yes"/>
<!-- Copy everything unless matched by another template -->
<xsl:template match="@*|node()|comment() " priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()|comment()"/>
@halloffame
halloffame / gist:4120338
Created November 20, 2012 19:14
Problem doing a joins in signups
# Problem: doing a .joins(:user) when using mySQL returns an empty array even when signups exist. The reason I am doing a joins is so that I can sort by user name.
### works in SQLlite ###
>>> o.signups.joins(:user).order('users.first_name ASC')
Signup Load (1.3ms) SELECT "signups".* FROM "signups" INNER JOIN "users" ON "users"."id" = "signups"."user_id" WHERE "signups"."occurrence_id" = 8 ORDER BY users.first_name ASC
=> [#<Signups ...>]
@halloffame
halloffame / jquery.embedforms.js
Last active October 13, 2015 22:17
This is a jQuery plugin for embedding forms lists into your web site.
/********* jquery.embedforms.js ***********
*
* Author: Ryan Hall - Biola University, IT
* Date Updated: July 15, 2015
*
* This is a jQuery plugin that allows you to list forms from forms.biola.edu on your own website.
* The forms API automatically filters forms by user permissions.
*
* To use:
* $('#selector').embedForms();
@halloffame
halloffame / vimrc
Created December 15, 2012 00:36
This is my default .vimrc file that you can put in your home directory to customize vim.
:set tabstop=2
:set expandtab
:set shiftwidth=2
:set autoindent
:set number
:set whichwrap+=<,>,h,l,[,]
@halloffame
halloffame / chef_solo_bootstrap.sh
Created December 15, 2012 09:05 — forked from ryanb/chef_solo_bootstrap.sh
This works with Ubuntu 12.04 32bit. Use lib64readline-gplv2-dev for 64 bit
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev libreadline-gplv2-dev libtool vim
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar -xvzf ruby-1.9.3-p327.tar.gz
cd ruby-1.9.3-p327/
./configure --prefix=/usr/local
make
@halloffame
halloffame / beginning.html
Created February 4, 2013 07:03
This goes through the basic structure of an html document.
<!-- This is a comment, anythign you put here won't be evaluated -->
<!doctype html>
<!-- this must be the very first thing in your HTML document (comments don't count).
This declaration tells the web browser what kind of document to expect.
You can see a list of compatible doctypes here http://www.w3schools.com/tags/tag_doctype.asp
For our purposes, we will always be using the above syntax. -->
<html>
<!-- This is the first tag in this document. It is the only one of it's kind and it's sole purpose is to wrap the entire document -->
@halloffame
halloffame / RubyDateFormats.md
Last active May 19, 2023 20:16
Quick reference for ruby date format abbreviations.

Date

Year

%Y - Year with century (can be negative, 4 digits at least) -0001, 0000, 1995, 2009, 14292, etc.

  • %C - year / 100 (round down. 20 in 2009)
  • %y - year % 100 (00..99)
@halloffame
halloffame / rebuild_database.sh
Last active December 16, 2015 00:49
One line script for destroying and rebuilding Rails database.
bundle exec rake db:reset db:migrate db:test:prepare db:seed
# This will reset your database and reload your current schema.
### OR ###
bundle exec rake db:drop db:create db:migrate db:test:prepare db:seed
# This will destroy your db, recreate it, and then migrate your current schema.
@halloffame
halloffame / skeleton.html
Created April 23, 2013 17:24
Skeleton html file to be used as a starting point.
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>Example</title>
<!-- <link rel="stylesheet" href="http://example.com/css/style.css" /> -->
</head>
<body>
<h1>Hello World!</h1>
function historySupport() {
return !!(window.history && window.history.pushState !== undefined);
}
function pushPageState(state, title, href) {
if (historySupport()) {
history.pushState(state, title, href);
}
}