Skip to content

Instantly share code, notes, and snippets.

View treevis's full-sized avatar

Travis Forden treevis

View GitHub Profile
@adactio
adactio / datalist.html
Created January 9, 2011 17:24
Progressive enhancement with datalist
<!DOCTYPE html>
<title>Datalist test</title>
<meta charset="utf-8">
<form>
<label for="source">How did you hear about us?</label>
<datalist id="sources">
<select name="source">
<option>please choose...</option>
<option value="television">Television</option>
<option value="radio">Radio</option>
@mikesusz
mikesusz / pre-commit.sh
Created February 1, 2011 16:52
a git pre-commit hook for compass compiling of sass to css
#!/bin/sh
#
# this pre-commit script uses compass to compile and compress stylesheet partials
compass compile wp-content/themes/mytheme/ -s compact --force --no-line-comments
wait $!
git add wp-content/themes/mytheme/style.css
@millermedeiros
millermedeiros / gist:1188835
Created September 2, 2011 14:58
reply to position-absolute.com post: Organizing events with jQuery
// -----------------------
// refactor by Miller Medeiros (http://blog.millermedeiros.com)
// of code samples present on position-absolute.com blog post:
// http://www.position-absolute.com/articles/organizing-events-with-jquery/
// -----------------------
//just so we make sure `myApp` does exist
window.myApp = window.myApp || {};
@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@Zettt
Zettt / dayprojects.applescript
Last active February 19, 2019 04:25
Day Projects for OmniFocus
-- Day Projects
--
-- Created by Zettt on 2011-11-28
-- Mac OS X Screencasts.
--
-- This script creates "Day Projects" in OmniFocus.
--
-- I use these "Day Projects" to put stuff, that I need to
-- do on a specific day, but aren't big enough to be their own project.
-- Things like "Call the doctor on Wednesday" or
@vanto
vanto / README.md
Last active December 23, 2021 21:28
OEmbed Liquid Tag for Jekyll

OEmbed Liquid Tag for Jekyll

This is a simple liquid tag that helps to easily embed images, videos or slides from OEmbed enabled providers. It uses Magnus Holm's great oembed gem which connects to the OEmbed endpoint of the link's provider and retrieves the HTML code to embed the content properly (i.e. an in-place YouTube player, Image tag for Flickr, in-place slideshare viewer etc.). By default it supports the following OEmbed providers (but can fallback to Embed.ly or OoEmbed for other providers):

  • Youtube
  • Flickr
  • Viddler
  • Qik
  • Revision3
  • Hulu
  • Vimeo
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

@stephenmckinney
stephenmckinney / osx_developer_installation.md
Created February 26, 2012 11:51 — forked from stefanfoulis/osx_developer_installation.rst
Instructions on how to setup an OSX developer machine for (python/django/ruby/rails) development

OSX Developer System Installation

This guide assumes you are upgrading from Mac OSX 10.6 Snow Leopard to 10.7 Lion.


Starting Clean

Uninstall XCode

@trongthanh
trongthanh / gist:2779392
Last active June 25, 2024 08:04
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@amejiarosario
amejiarosario / rails_migration_cheatsheet.md
Created June 18, 2012 21:40
Rails Migration - Cheatsheet