View account.coffee
AccountSerializer = ActiveModelSerializer.extend | |
attrs: | |
defaultPreferences: | |
serialize: false | |
subscribed: | |
serialize: false | |
cancelled: | |
serialize: false | |
defaultPreferences: | |
serialize: false |
View emberjsupgrade.txt
I recently upgraded my ember-cli app running on Ember 1.13.x to Ember 2.0.1. Here's how I did it: | |
1. I updated to Ember 1.13.10 by editing the bower.json file and then running bower update. | |
2. I fixed all Ember deprecation warnings. Some of the deprecation warnings were from my code while others were from external libraries that I was using. | |
3. To update to Ember 2.0.1 I did the following: | |
made the following changes to bower.json | |
- changed "ember": "1.13.10" to "ember": "2.0.1" | |
- changed "ember-data": "1.13.11" to "ember-data": "2.0.0" | |
- changed "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3" to "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.5" | |
- changed "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5" to "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.7" |
View saved-indicator.coffee
`import Ember from 'ember'` | |
SavedIndicatorComponent = Ember.Component.extend | |
_saveCount: 0 | |
attrs: | |
saveCount: 0 | |
duration: 2000 | |
attributeBindings: ['style'] |
View application.coffee
`import DS from 'ember-data'` | |
ApplicationAdapter = DS.ActiveModelAdapter.extend | |
namespace: 'api/v1' | |
headers: | |
"X-CSRF-Token": $('meta[name="csrf-token"]').attr('content') | |
View deploy.rb
namespace :deploy | |
namespace :assets do | |
desc "precompile and sync assets to app servers" | |
task :sync do | |
on roles(:app), in: :parallel do |role| | |
run_locally do | |
execute "rsync -avr -e ssh ./public/assets/ #{role.username}@#{role.hostname}:#{release_path}/public/assets" | |
end | |
end | |
end |
View countCSSRules.js
function countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); | |
} | |
function countSheet(sheet) { |
View canvas.js
var canvas = document.getElementById("myCanvas"); | |
var ctx = canvas.getContext("2d"); | |
var x = 0; | |
var y = 0; | |
function drawShape() { | |
ctx.fillRect(x, y, 150, 80); | |
} |
View fancybox.js.coffee
$('a.some_class').bind 'click', (e) -> | |
e.preventDefault(); | |
$.get $(this).attr('href'), (data) -> | |
$.fancybox | |
content: $(data).find('#main_content_wrapper') |
View gist:2962628
# Rather than going nuclear and downgrading Xcode or using some other big GCC installer, | |
# this worked for me... | |
# From https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers | |
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb | |
# Path may vary slightly... | |
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 | |
# If you've attempted to install REE previously and it failed... |
View gist:1654849
require 'spec_helper' | |
def product_attributes | |
{ | |
:name => "Test Product", | |
:description => "hello world", | |
:sku => "my_sku", | |
:price => 100, | |
:on_hand => 10, | |
:deleted_at => nil, |
NewerOlder