Skip to content

Instantly share code, notes, and snippets.

View tbeseda's full-sized avatar
🦬

Taylor Beseda tbeseda

🦬
View GitHub Profile
@tbeseda
tbeseda / toucheventcaching.js
Created March 9, 2011 23:31
Capture the initial touch event in order to refer to it later during touchmove.
$('#object').live({
'touchstart': function(e){
window.firstTouch = e.originalEvent.touches[0].pageX || e.originalEvent.changedTouches[0].pageX;
},
'touchmove': function(e){
e.preventDefault();
var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
var elm = $(this).offset();
var x = touch.pageX - elm.left;
var y = touch.pageY - elm.top;
@tbeseda
tbeseda / gist:876429
Created March 18, 2011 17:01
Recursive templating is easy with jQuery tmpl
<script id="list-template" type="text/x-jquery-tmpl">
<li>
${name}
{{if children}}
<ul>{{tmpl(children) '#list-template'}}</ul>
{{/if}}
</li>
</script>
@tbeseda
tbeseda / comparatorWithPrimer.js
Created March 21, 2011 23:39
use with .sort() on an array of JSON objects.
var sort_by = function(field, reverse, primer){
reverse = (reverse) ? -1 : 1;
return function(a,b){
a = a[field];
b = b[field];
if (typeof(primer) != 'undefined'){
@tbeseda
tbeseda / gist:897432
Created March 31, 2011 22:57
Propane users, add this to your caveatPatchor.js file in ~/Library/Application Support/Propane/unsupported/ to get github repo descriptions when a link is pasted into your Campfire room. Screenshot: https://img.skitch.com/20110401-p7t6egkt1iedyfd7as5difk9
/*
Add github repo descriptions to your Campfire rooms in Propane (propaneapp.com).
Adapted from protocool's https://gist.github.com/825404
*/
var githubber = true;
if(githubber){
// github repo info inline
Campfire.GitHubber = Class.create({
initialize: function(chat) {
// either bootstrap or AJAX your data to search through
var DATAZ = []; // an array of JSON objects, each with a 'name' key
$('.autocomplete').bind('keyup focus', function(e){
$('.suggest').empty().hide(); // cleanup
var $this = $(this),
val = $this.val();
if(val.length < 1) return; // no need if nothing is there
$.support.cors = true
post =
type: 'POST'
url: 'https://remote.bar'
data: myData
xhrFields:
withCredentials: true
success: (data) ->
console.log 'tada', data
@tbeseda
tbeseda / Gemfile
Created June 28, 2011 02:11
Talk JSON(P) with Rdio via Sinatra
source :rubygems
gem 'sinatra'
gem 'oauth'
gem 'json'
@tbeseda
tbeseda / gist:1096141
Created July 20, 2011 23:05
Cakefile to watch and recursively concat and compile CoffeeScript automatically.
fs = require 'fs'
{exec} = require 'child_process'
util = require 'util'
growl = require 'growl'
appFiles = [
'src/hasToGoFirst.coffee' # put your files that must be loaded in first into the array
'src/notAsImportantButNeedsToGoBeforeTheRest.coffee'
]
@tbeseda
tbeseda / Preferences.sublime-settings
Last active September 27, 2015 05:58
My SublimeText 2 settings. A WIP.
{
"color_scheme": "Packages/Theme - Flatland/Flatland.tmtheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Inconsolata",
"font_size": 20.0,
"highlight_line": true,
"indent_guide_options":
[
"draw_normal",
"draw_active"
@tbeseda
tbeseda / gist:1296903
Created October 18, 2011 22:18
Finishing a Brew

For Finishing 5 gal. of Beer

Fermentation

  • a few oz of StarSan
  • 1 or 2 five gal brew buckets
    • 1 five gal carboy if only 1 bucket (preferred)
  • 1 airlock = 1 stopper + 1 s-lock
  • patience