Skip to content

Instantly share code, notes, and snippets.

View rounders's full-sized avatar

Francois Harbec rounders

View GitHub Profile
@rounders
rounders / account.coffee
Created December 9, 2015 21:41
phantomjs problem
AccountSerializer = ActiveModelSerializer.extend
attrs:
defaultPreferences:
serialize: false
subscribed:
serialize: false
cancelled:
serialize: false
defaultPreferences:
serialize: false
@rounders
rounders / emberjsupgrade.txt
Last active September 10, 2015 16:40
How I upgraded from ember 1.13.10 to Ember 2.0.1
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"
`import Ember from 'ember'`
SavedIndicatorComponent = Ember.Component.extend
_saveCount: 0
attrs:
saveCount: 0
duration: 2000
attributeBindings: ['style']
@rounders
rounders / application.coffee
Created June 18, 2015 20:52
ApplicationAdapter
`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 04:55
capistrano 3 compile assets locally then rsync
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
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) {
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 September 6, 2012 01:11
load url via ajax, extract only the content you need and display in a fancybox
$('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 June 20, 2012 22:30 — forked from jmcnevin/gist:2558928
Installing REE with RVM, Homebrew, XCode 4.3+ on OS X Lion
# 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 January 22, 2012 00:57
testing product creation
require 'spec_helper'
def product_attributes
{
:name => "Test Product",
:description => "hello world",
:sku => "my_sku",
:price => 100,
:on_hand => 10,
:deleted_at => nil,