This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .railsrc | |
-B #Skip Bundle | |
-T #Skip Test-Unit | |
-d postgresql #Use postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Postgresql fancy datatypes! | |
* array | |
* hstore (=~ hash) | |
* json | |
* jsonb | |
Philippe Creux - [@pcreux](http://twitter.com/pcreux) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var arrays, basicObjects, deepClone, deepExtend, deepExtendCouple, isBasicObject, | |
__slice = [].slice; | |
deepClone = function(obj) { | |
var func, isArr; | |
if (!_.isObject(obj || _.isFunction(obj))) { | |
return obj; | |
} | |
if (_.isDate(obj)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rivets.configure({ | |
adapter: { | |
subscribe: function(obj, keypath, callback) { | |
obj.on('change:' + keypath, callback) | |
}, | |
unsubscribe: function(obj, keypath, callback) { | |
obj.off('change:' + keypath, callback) | |
}, | |
read: function(obj, keypath) { | |
return obj.get(keypath) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.scrollWindowTo = function(pos, duration, cb) { | |
if (duration == null) { | |
duration = 0; | |
} | |
if (pos === $(window).scrollTop()) { | |
$(window).trigger('scroll'); | |
if (typeof cb === "function") { | |
cb(); | |
} | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@events = Event.where("venue_id = ?", current_user.venue.id).past_events | |
@events = Event.where("venue_id = ?", current_user.venue.id).upcoming_events | |
class Events | |
def past_events | |
past ||= self.select{|event| event.date < Date.today} | |
end | |
def upcoming_events |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VenuesController < ApplicationController | |
def venue_thanks | |
@user = User.find(current_user) | |
@venue = Venue.where(:user_id => @user.id) | |
if @venue.blank? | |
@venue = Venue.new(:name => params[:name], :address => params[:address], :max_guest_allowed => params[:max_guest_allowed], :user_id => @user ) | |
@msg = "Thanks for creating a venue!" | |
@venue.save | |
else |