Skip to content

Instantly share code, notes, and snippets.

Avatar

Francois Harbec rounders

View GitHub Profile
View account.coffee
AccountSerializer = ActiveModelSerializer.extend
attrs:
defaultPreferences:
serialize: false
subscribed:
serialize: false
cancelled:
serialize: false
defaultPreferences:
serialize: false
@rounders
rounders / emberjsupgrade.txt
Last active Sep 10, 2015
How I upgraded from ember 1.13.10 to Ember 2.0.1
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')
@rounders
rounders / deploy.rb
Created May 25, 2015
capistrano 3 compile assets locally then rsync
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);
}
@rounders
rounders / fancybox.js.coffee
Created Sep 6, 2012
load url via ajax, extract only the content you need and display in a fancybox
View fancybox.js.coffee
$('a.some_class').bind 'click', (e) ->
e.preventDefault();
$.get $(this).attr('href'), (data) ->
$.fancybox
content: $(data).find('#main_content_wrapper')
@rounders
rounders / gist:2962628
Created Jun 20, 2012 — forked from jmcnevin/gist:2558928
Installing REE with RVM, Homebrew, XCode 4.3+ on OS X Lion
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...
@rounders
rounders / gist:1654849
Created Jan 22, 2012
testing product creation
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,