Skip to content

Instantly share code, notes, and snippets.

View dguettler's full-sized avatar

Daniel Guettler dguettler

View GitHub Profile
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just
// put a "data-behaviors" attribute on your view elements, and then assign callbacks
// for those named behaviors via Behaviors.add.
var Behaviors = {
add: function(trigger, behavior, handler) {
document.observe(trigger, function(event) {
var element = event.findElement("*[data-behaviors~=" + behavior + "]");
if (element) handler(element, event);
});
#
# Created by Eric Lindvall <eric@sevenscale.com>
#
# WHAT: Provides a simple overview of memory allocation occuring during a
# require.
#
# For a longer explanation, see my post at:
#
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby
#
# Created by Eric Lindvall <eric@sevenscale.com>
#
# WHAT: Provides a simple overview of memory allocation occuring during a
# require.
#
# For a longer explanation, see my post at:
#
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby
#
# NOTE: The numbers provided are of self + children, meaning the same will
# app/controllers/books/base_controller.rb
class BooksController < ApplicationController
respond_to :html
before_filter :find_resource, :only => [:show, :edit, :update, :destroy]
def index
@books = context.page params[:page]
end
def show
@dguettler
dguettler / fix.sh
Created October 22, 2013 17:49 — forked from jcf/fix.sh
# Cleanup old GCC if it's installed
brew uninstall apple-gcc42
# Maybe unnecessary…
sudo xcode-select --reset
# Use developer preview of Xcode
sudo xcode-select --switch /Applications/Xcode5-DP3.app
# Wipe out existing Xcode
{{view Ember.SortableView itemViewClass=App.YourItemView content=items}}
willTransition: (transition) ->
context = @get 'context'
return false unless context
if context.get('isDirty') && !confirm 'You have unsaved changes are you sure you want to continue?'
transition.abort()
return false
if context.get('isNew')
context.deleteRecord()
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
App.Key.reopen
################################################
##### Transaction setup handlers
################################################
transactionArray: []
setupTransaction: ->
@set 'transactionArray', []
App.PushClient = Em.Object.extend
members: prop ->
Em.A()
connect: (key, userId) ->
return unless Pusher?
@pusher?.disconnect()
@pusher = new Pusher key,