Skip to content

Instantly share code, notes, and snippets.

Routing in Ember

In Ember, the application's state manager handles routing. Let's take a look at a simple example:

App.stateManager = Ember.StateManager.create({
  start: Ember.State.extend({
    index: Ember.State.extend({
      route: "/",
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ryanb
ryanb / rails_3_1_update.txt
Created July 23, 2011 21:31
Possible output from a Rails 3.1 upgrade wizard
$ rake rails:update
Generating app/assets directory and content. (same as 3.1 app generator)
Do you want to move all public/stylesheets into app/assets/stylesheets? (recommended) [y]
Moving public/stylesheets into app/assets/stylesheets...
Existing application.css, merging content to the end of app/assets/stylesheets/application.css.

Currently the RubyGems index is stored as a Gzip file that is a marshalled array. Whenever Bundler needs to install a gem that is not yet installed it downloads the index, gunzips it and unmarshals it. It then looks for dependencies that are described in another file that is also a gzipped and marshalled file. There are several issues that arise from this setup:

  • The full index must be downloaded and parsed, but does not contain dependency data, which must then be downloaded and parsed. This is a relatively time consuming process.
  • The index must be centralized.

Additionally the gems themselves are currently centralized since there is nothing in the meta data that indicates where the gem should be downloaded from. However in order to allow this it is important to find ways of keeping the index from being poisoned (is this an issue in the centralized system?)

Dependency Resolution

@mattetti
mattetti / main.go
Created June 6, 2011 01:48
Go's reflection example
package main
import(
"fmt"
"reflect"
)
func main(){
// iterate through the attributes of a Data Model instance
for name, mtype := range attributes(&Dish{}) {
@mattetti
mattetti / gist:1009624
Created June 6, 2011 01:41
mango routed sample app example
package main
import(
"github.com/paulbellamy/mango"
"fmt"
)
func hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) {
env.Logger().Println("Got a", env.Request().Method, "request for", env.Request().RawURL)
return 200, mango.Headers{}, mango.Body("Hello World!")
@ryanb
ryanb / rails_3_1_rc4_changes.md
Created May 6, 2011 01:10
The Changelogs for Rails 3.1 Beta 1

Railties 3.1 RC4

  • The new rake task assets:clean removes precompiled assets. [fxn]

  • Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]

  • Fixed database tasks for jdbc* adapters #jruby [Rashmi Yadav]

  • Template generation for jdbcpostgresql #jruby [Vishnu Atrai]

@pamelafox
pamelafox / googl.py
Created April 29, 2011 21:27
Shortening URLS using goo.gl
import cgi
import urllib, urllib2
import logging
from django.utils import simplejson
class Googl():
def __init__(self, api_key):
self.api_key = api_key
self.base_url = 'https://www.googleapis.com/urlshortener/v1/url?key=%s' % self.api_key
@pamelafox
pamelafox / Completely Static App
Created January 11, 2011 18:20
For App Engine
application: oliverfoxmurals
version: 1
runtime: python
api_version: 1
handlers:
- url: /
static_files: static/index.html
upload: static/index.html
@idoru
idoru / XCode_SwapBetweenSpec.scpt
Created November 17, 2010 05:36
[Not compatible with XCode 4] Ever wanted to switch between Cedar specs and your implementation with a single keystroke? Well, there's a user script for that!
(*
SwapBetweenSpec.scpt
Get into the BDD groove with this Xcode user script which quickly toggles between your implementation (or header)
and its Cedar Spec. Bind it to your favorite shortcut key and enjoy the cycle.
Be sure to add this User Script to Xcode as an Applescript, not a shell script:
1. Paste the contents of the gist into ~/Library/Application Support/Developer/Shared/Xcode/User Scripts/SwapBetweenSpec.scpt
2. When adding to script in the "Edit User Scripts" window of Xcode, choose "Add Script File..." and not "New Shell Script" and then choose the file from (1)
3. Set Input to "No Input"