Skip to content

Instantly share code, notes, and snippets.

View chadhietala's full-sized avatar
🎯
Focusing

Chad Hietala chadhietala

🎯
Focusing
View GitHub Profile
@chadhietala
chadhietala / Dynamic Youtube Video Builder
Created November 7, 2010 19:15
Uses jQuery, YQL, JSONp and creates the video object on the fly.
$(document).ready(function(){
var yqlurl= "http://query.yahooapis.com/v1/public/yql?q="
+ "select%20*%20from%20youtube.search%20where%20query%3D"
+"'umflint'%20limit%2010&format=json&diagnostics=true&env="
+"store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=?";
// Build this
var build = function(data){$.each(data.query.results.video, function(i, video){
$('<h1><a href="' + video.url +' target="_blank\"/></h1>')
@chadhietala
chadhietala / gist:866247
Created March 11, 2011 17:42
YQL Nested Object
{
"query": {
"count": 2,
"created": "2011-03-11T17:41:29Z",
"lang": "en-US",
"meta": {
"meta": ""
},
"results": {
"results": [
@chadhietala
chadhietala / .bashrc
Created April 12, 2011 19:33
.bashrc stuff
# set permissions for apache
setPermissions () {
sudo chown -R apache $1
sudo chgrp -R web $1
sudo chmod -R 775 $1
}
# Hide and show hidden files
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder"
@chadhietala
chadhietala / many to many
Created April 22, 2011 16:20
Many to many and sinatra
require 'sinatra'
require 'datamapper'
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/cal.db")
class Event
include DataMapper::Resource
@chadhietala
chadhietala / deferred
Created May 10, 2011 02:34
jQuery Deferred
var demo = {
init : function(){
var query = 'select * from music.artist.id where ids="289282"',
url = 'https://query.yahooapis.com/v1/public/yql?q='
+ encodeURIComponent(query) +'&format=json&env=store%3A%2F%2Fdatatables.org'
+'%2Falltableswithkeys&callback=?&_maxAge=3000',
getIt = demo.getData(url)
@chadhietala
chadhietala / gist:983564
Created May 20, 2011 19:09
New Project Hotness
newproject () {
gem update sass
gem update compass
gem update haml
gem update html5-boilerplate
compass create $1 -r html5-boilerplate -u html5-boilerplate --javascript-dir js --css-dir css
mvim $1
compass watch $1
}
@chadhietala
chadhietala / Quicksort in Javascript
Last active September 25, 2015 21:58
Quicksort in Javascript
var a = [34,2,121,4,66];
function quickSort(arr){
if (arr.length == 0)
return [];
var left = [],
right = [],
pivot = arr[0];
@chadhietala
chadhietala / css
Created August 17, 2011 23:44
Subtle Animate In
.item{ width: 120px; height: 200px; position:relative; background: red; opacity: 0; margin-top:100px; float:left; z-index:9999; margin-right: 20px;}
.item_copy{float: left; opacity:0; margin-top:130px; position:relative; z-index:1;}
@chadhietala
chadhietala / js
Created August 21, 2011 02:07
animate in one by one
$('.tag').each(function(i) {
setTimeout(function() {
$('.tag:eq('+i+')').css({ display: 'block', opacity: 0 }).stop().animate({ opacity: 1 }, 'easeInOutExpo');
}, 250 * (i + 1))
});
@chadhietala
chadhietala / gist:1836561
Created February 15, 2012 15:15
Brew Upgrade Node
->brew upgrade node
Error: undefined method `include?' for nil:NilClass
Please report this bug:
https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue
/usr/local/Library/Homebrew/formula.rb:332:in `canonical_name'
/usr/local/Library/Homebrew/formula.rb:364:in `factory'
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7:in `map'
/usr/local/Library/Contributions/examples/brew-upgrade.rb:7
/usr/local/bin/brew:47:in `require'