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
# Can do this | |
object = | |
key: 1 | |
value: 2 | |
# But also presumably this... | |
object2 = new Ext.extend(Ext.Panel, | |
items: [] | |
dockedItems: [] | |
layout: 'fit' |
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
# Create a GET route, with named route segments for the latitude and longitude | |
app.get '/deals/:latitude/:longitude', (req, resp) -> | |
# Set the response content type to JSON | |
resp.contentType("application/json") | |
# Build the URI for retrieving deals from TreatMe | |
api_options = { | |
host: 'treatme.co.nz', | |
port: 80, |
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
app.get '/geocode', (req, resp) -> | |
# Set the content type of the response | |
resp.contentType("application/json") | |
# Assemble the base URL to Google's geocoding service | |
geocode_url = { | |
host: 'maps.googleapis.com', | |
port: 80, | |
path: '/maps/api/geocode/json?sensor=true' |
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
#!/usr/bin/env ruby | |
#### git-browse | |
### Open a github repository in the default browser | |
### Author: @sudojosh | |
### Usage: Run `git browse` inside a repo with at least one github remote | |
### Installation: Download, run `chmod +x git-browse`, and then copy somewhere on your path | |
### for example, /usr/local/bin/ | |
remotes = `git remote -v` |
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
# All this logic will automatically be available in application.js. | |
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | |
# | |
#= require jquery.jqplot | |
#= require jqplot.dateAxisRenderer | |
#= require jqplot.enhancedLegendRenderer | |
#= require jqplot.highlighter | |
class LolChart |
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 YourModel < ActiveRecord::Base | |
has_one :listing | |
accepts_nested_attributes_for :listing | |
attr_accessible :listing_attributes | |
# Make sure we always have a listing | |
after_initialize :build_listing, :unless => :listing | |
end |
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
# config/initializers/form_errors.rb | |
# | |
# Wraps a <div> tag around the field with an error with the | |
# correct classes for Twitter bootstrap to style the inputs | |
# with errors correctly (red border/red box-shadow) | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance_tag| | |
"<div class='control-group error'>#{html_tag}</div>".html_safe | |
end |
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
#!/usr/bin/env ruby | |
# You can skip this bit if you wish - you will need the 'ruby-trello' gem installed, and | |
# optionally, 'foreman' to run the script with. | |
require 'bundler/setup' | |
Bundler.require | |
require 'trello' | |
require 'csv' |
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
# You may want to call this something more specific - for example, in | |
# Latter, this is called 'GameModal' | |
class ApplicationModal | |
constructor: (options) -> | |
@options = $.extend { | |
header: 'Modal Heading' | |
content: '' | |
open_now: true |
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
# Image is your ActiveRecord model | |
Image.find_each do |image| | |
# file is your | |
image.file.reprocess! | |
end |