Skip to content

Instantly share code, notes, and snippets.

View halloffame's full-sized avatar

Ryan Hall halloffame

View GitHub Profile
function historySupport() {
return !!(window.history && window.history.pushState !== undefined);
}
function pushPageState(state, title, href) {
if (historySupport()) {
history.pushState(state, title, href);
}
}
@halloffame
halloffame / designer.html
Last active August 29, 2015 14:15
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-menu/core-submenu.html">
<polymer-element name="my-element">
@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 / dropbox_dump.rb
Created December 2, 2015 19:28
Ruby script to recursively download a given directory from your dropbox.
require 'dropbox_sdk' # gem install dropbox-sdk
require 'fileutils'
require 'thread'
# Example: downloads entire dropbox
# DropboxDump.new('your_access_token', '/download/destination').download("/")
class DropboxDump
attr_accessor :client, :dest, :work_q, :worker_count
def initialize(access_token, dest, max_workers = 3)
@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 / 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.