Skip to content

Instantly share code, notes, and snippets.

View ghedamat's full-sized avatar
🏔️
YakShaving

Mattia Gheda ghedamat

🏔️
YakShaving
View GitHub Profile
@elucid
elucid / .profile
Created November 30, 2016 15:56
fix ssh auth sock on tmux attach
# Predictable SSH authentication socket location.
SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $SOCK ]
then
rm -f $SOCK
ln -sf $SSH_AUTH_SOCK $SOCK
export SSH_AUTH_SOCK=$SOCK
fi
@mixonic
mixonic / dependency-injection-and-service-lookup.md
Last active August 29, 2015 14:03
Dependency Injection & Service Lookup

Dependency Inject & Service Lookup

Dependency injection and service lookup are two important framework concepts. The first, dependency injection, refers a dependent object being injected onto another object during instantiation. For example, all route objects have the property router set on them during instantiation. We say that the dependency of the router has been injected onto the route objects.

App.IndexRoute = Ember.Route.extend({
  actions: {
    showPath: function(){
      // Dependency injection provides the router object to our
      // route instance.
@machty
machty / ember-router.md
Last active December 14, 2015 21:09
Funnel through actions

Transition Handlers for Ember Router

Proposal

Add transitions hash to Ember.Route, which contains transition handlers for preventing/redirecting/decorating attempted transitions, whether initiated by transitionTo or URL change (handleURL).

Rationale

  1. Seal the app from unconstrained URL changes breaking your app's state machine
  2. Bring back router v1's state-based patterns while maintaining v2's lovely DSL for defining routes
@gutenye
gutenye / ember-with-middleman.md
Last active December 10, 2015 01:58
Write Ember.js App With Middleman

I. Create a Middleman project with middleman-ember-template

$ middleman init hello --template=ember

II. Install ember.js package

$ bower install ember
@jwo
jwo / registrations_controller.rb
Created September 30, 2011 23:11
API JSON authentication with Devise
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@mackato
mackato / rails_guides_to_epub.rb
Created June 4, 2010 03:24
Ruby on Rails Guides ePub convert ruby script
require 'rubygems'
require 'nokogiri'
require 'eeepub'
DOC_TITLE = 'Ruby on Rails Guides'
def get_pages(src_dir)
index_file = File.join(src_dir, 'index.html')
section = nil
pages = [{ :section => section, :title => DOC_TITLE, :path => index_file }]