Skip to content

Instantly share code, notes, and snippets.

View jforaker's full-sized avatar

Jake Foraker jforaker

View GitHub Profile
@jforaker
jforaker / devise_controller.rb
Created March 12, 2014 19:27
open gem file
export BUNDLER_EDITOR=mine
bundle open devise
@jforaker
jforaker / SeatingChart.js
Created April 7, 2014 15:11
Sencha Touch multiple listeners on XTemplate DOM elements
listeners:{
tap: {
element: 'element',
delegate: '.student-seat .doc-box, .bubble-holder',
fn: function(e){
var me = this;
var url = e.target.name
@jforaker
jforaker / FeedItemView.js
Created April 10, 2014 22:21
Multiple tap listeners
listeners: {
tap: {
element: 'element',
delegate: '.app-box, .doc-box, .bubble-holder',
fn: function(e){
var url = e.target.name
, name = e.delegatedTarget.textContent
, divClassName = e.delegatedTarget.className
@jforaker
jforaker / People.js
Created April 23, 2014 15:49
scrollable config
scrollable: {
fps: 'auto',
direction : 'vertical',
directionLock: true,
indicators: false,
momentumEasing: {
momentum: {
acceleration: 30, // how slowly it stops - high # = stops less
friction: 0.7 // stick factor
},
@jforaker
jforaker / gist:441c2eaf6ee0be326e96
Created June 20, 2014 14:59
clone_www.rb :: Clone and build - phonegap
#!env ruby
require 'optparse'
require 'yaml'
DESTINATION_DIRECTORY = './www'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: clone_www.rb [options]"
@jforaker
jforaker / FeedItemView.js
Created August 13, 2014 18:41
Multiple tap events Sencha Touch
tap: {
element: 'element',
delegate: '.app-box, .doc-box, .bubble-holder',
fn: function(e){
var url = e.target.name,
name = e.delegatedTarget.textContent,
divClassName = e.delegatedTarget.className,
appbox = "app-box",
docbox = "doc-box",
@jforaker
jforaker / FeedItemView.js
Created August 13, 2014 18:44
Parse due dates with moment.js
dues: function (expiresdate){
var now = moment(),
due = moment(expiresdate).format("YYYY-MM-DD"),
todayMoment = moment().format("YYYY-MM-DD"),
dueFormatted = moment(expiresdate).format("MMMM Do YYYY"),
tmrw, yest,
dueInfo = {
color: '',
text: ''
};
@jforaker
jforaker / FeedItemView.js
Last active August 29, 2015 14:05
Sencha Touch swipe to navigate
listeners: {
swipe: {
element: 'element',
fn: function (e) {
var direction = e.direction,
feednav = Ext.ComponentQuery.query('FeederNav')[0];
if (direction == 'right') {
feednav.reset();
@jforaker
jforaker / Utility.js
Last active August 29, 2015 14:05
Switch statement alternative
function getDrink (type) {
var drinks = {
'beer': 'Budwieser',
'pepsi': 'Pepsi',
'lemonade': 'Lemonade',
'default': 'Default item'
};
return 'The drink I chose was ' + (drinks[type] || drinks['default']);
}
@jforaker
jforaker / php_localhost
Created September 7, 2014 22:37
Run php server in directory
php -S localhost:8080