Skip to content

Instantly share code, notes, and snippets.

@knomedia
knomedia / erb_each.sublime-snippet
Created August 14, 2012 15:55
ERB Sublime Text 2 snippets
<snippet>
<content><![CDATA[<% ${1:@Items}.each do |${2:item}| %>
$3
<% end %>
$0]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>each</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>text.html.ruby</scope>
<!-- Optional: Description to show in the menu -->
@knomedia
knomedia / embjerjs.com_traceroute
Created January 25, 2013 16:10
traceroute to emberjs.com
09:07 AM [~] $ traceroute emberjs.com
traceroute to emberjs.com (207.97.227.245), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 0.755 ms 0.512 ms 0.442 ms
2 c-71-195-254-1.hsd1.ut.comcast.net (71.195.254.1) 31.931 ms 14.808 ms 25.852 ms
3 te-8-3-ur02.orem.ut.utah.comcast.net (68.87.220.241) 10.947 ms 11.851 ms 11.561 ms
4 te-3-3-ar02.saltlakecity.ut.utah.comcast.net (69.139.247.29) 15.002 ms 15.186 ms 16.071 ms
5 pos-2-1-0-0-cr01.denver.co.ibone.comcast.net (68.86.90.237) 27.611 ms 27.539 ms 24.450 ms
6 4.79.82.57 (4.79.82.57) 23.298 ms 22.596 ms 24.680 ms
7 vlan52.ebr2.denver1.level3.net (4.69.147.126) 69.177 ms 74.488 ms 74.761 ms
8 ae-3-3.ebr1.chicago2.level3.net (4.69.132.62) 67.345 ms 76.961 ms 71.303 ms
# Using coffeescript with erb as a :js response
# works in development doesn't seem to work in production
# app/controller/posts.rb
class Posts < ApplicationController
respond_to :html, :js
def new
@post = Posts.new
end
@knomedia
knomedia / ember_template.rb
Last active December 26, 2015 09:09 — forked from steveklabnik/ember_template.rb
An ember template for rails with ember-tools
run "sed -i.bck '/turbolinks/d' Gemfile"
run "sed -i.bck 's/, \"data-turbolinks-track\" => true//' app/views/layouts/application.html.erb"
run "sed -i.bck '/turbolinks/d' app/assets/javascripts/application.js"
run "sed -i.bck '/coffee/d' Gemfile"
run "sed -i.bck '/jbuilder/d' Gemfile"
gem 'active_model_serializers'
run "sed -i.bck '/tree/d' app/assets/javascripts/application.js"
@knomedia
knomedia / new_eak_app
Created November 19, 2013 23:12
shell script for quickly starting a fresh ember-app-kit app.
#!/bin/bash
git clone git@github.com:stefanpenner/ember-app-kit.git $1
cd $1
echo "Removing old git files"
rm -rf .git
echo "Installing grunt-cli and bower"
npm install -g grunt-cli
define [
'../start_app',
'ember',
'ic-ajax',
'../../controllers/quiz_controller',
'../environment_setup',
], (startApp, Ember, ajax, QuizController) ->
App = null
@knomedia
knomedia / options
Created January 13, 2014 20:49
Ember Testing Options
When attempting to test elements in Ember it seems like you have the following options
1. Spin up your Ember app and pluck of the parts you are trying to test:
App.__container__.lookup("controller:quizzes")
2. Build a container, register dependencies on it.
cont = new Em.Container()
cont.register('controller:quizzes', Em.Object)
quizController = App.QuizController.create({container: cont})
define [
'ember'
'../start_app'
'../../components/assignment_group_grades_component'
'../shared_ajax_fixtures'
], (Ember, startApp, AGGrades, fixtures) ->
{ContainerView, run} = Ember
fixtures.create()
set encoding=utf-8
syntax on
" Load plugins with pathogen
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on
colorscheme ir_black
@knomedia
knomedia / ember_cli_rails.rake
Last active August 29, 2015 14:00
ember_cli_rails initial thoughts (see: https://github.com/knomedia/ember-cli-rails for a more complete solution)
require 'nokogiri'
namespace :ember_cli_rails do
desc "compile ember and update application.html.erb with ENV vars"
task :build => [:ember, :update_env] do
end
desc 'Build ember app and copies css and js files to rails'