Skip to content

Instantly share code, notes, and snippets.

@tal
tal / gist:1558164
Created January 4, 2012 02:32
Carousel slide interactions
class Visible
constructor: (@slides) ->
push: (slide) ->
slide.set('far_right')
@slides.push(slide)
unshift: (slide) ->
slide.set('far_left')
@slides.unshift(slide)
diff --git a/src/main/webapp/WEB-INF/public/javascripts/gilt/notify.js b/src/main/webapp/WEB-INF/public/javascripts/gilt/notify.js
index 604fba9..747b7fb 100644
--- a/src/main/webapp/WEB-INF/public/javascripts/gilt/notify.js
+++ b/src/main/webapp/WEB-INF/public/javascripts/gilt/notify.js
@@ -44,6 +44,7 @@ Gilt.Notify = Gilt.Notify || (function () {
subscribeMany,
unsubscribe,
unsubscribeMany,
+ NAMESPACE_SPLIT = '.',
log = Gilt.Util.logger("notify", "Notify");
@tal
tal / klass.new.js
Created January 18, 2012 19:28
Changing the way to define classes in js
GC.util.classSetup('GC.Page.Klass', function() {
return {
val1: val1,
val2: val2
}
});
console.originalLog = console.log;
console.log = function() {
console.log.history = console.log.history || [];
console.log.history.push(arguments);
console.originalLog.apply(null,arguments);
}
development: &defaults
# Configure available database sessions. (required)
sessions:
# Defines the default session. (required)
default: &default_session
# Defines the name of the default database that Mongoid can connect to.
# (required).
database: delight_development
# Provides the hosts the default session can connect to. Must be an array
# of host:port pairs. (required)
/**
* Path Set
* A libary for storing and generating paths for an application based on params
* @author Tal Atlas <[email protected]>
*
* ps = new PathSet({
* root: '/',
* album: '/albums/:id(.:format)',
* album_pictures: '/albums/:album_id/pictures(/:id)(.:format)'
* });
# Intended Behavior:
ExternalContactList.type_to_class('facebook') # => ExternalContactList::Facebook
UserIdentifier.type_to_class('facebook') # => UserIdentifier::Facebook
UserIdentifier::Facebook.type_to_class('facebook') # => UserIdentifier::Facebook
# Actual Behavior
ExternalContactList.type_to_class('facebook') # => UserIdentifier::Facebook
UserIdentifier.type_to_class('facebook') # => UserIdentifier::Facebook
module Helpers
def self.constantize(camel_cased_word)
names = camel_cased_word.split('::')
names.shift if names.empty? || names.first.empty?
constant = Object
names.each do |name|
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
end
constant
class Contact < Person
end
module RequestPagination
def self.included(klass)
klass.scope :paginate_from, ->(request,limit=nil) do
dset = self
if id = request.headers['X-delight-lt-id']
dset = dset.where(:_id.lt => id)
end
if limit = request.headers['X-delight-item-limit']||limit
dset = dset.limit(limit)