Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Making Yapp better all the time and likely working on some Ember.js OSS

Luke Melia lukemelia

💭
Making Yapp better all the time and likely working on some Ember.js OSS
View GitHub Profile
View redis_controller.rb
class RedisController < ApplicationController
private
def render_from_redis(prefix, variation = nil)
manifest_id = params[:manifest_id]
if manifest_id.blank?
current_manifest_key = if variation
"#{prefix}:#{variation}:current"
else
"#{prefix}:current"
@lukemelia
lukemelia / Brocfile.js
Created Aug 19, 2014
When you need an image to exist when your styles are processed by ember-cli
View Brocfile.js
function AssetImporterPlugin(options, appName) {
this.name = 'yapp-asset-importer';
this.appName = appName;
this.options = options || {};
}
AssetImporterPlugin.prototype.treeFor = function treeFor(name) {
if (name !== "styles") { return; }
return pickFiles('shared-assets', {
srcDir: '/images',
@lukemelia
lukemelia / index.js
Created Aug 24, 2014
Example of fetching json every 5 seconds and updating a route's controller with it
View index.js
Pd3.IndexRoute = Ember.Route.extend({
activate: function(){
var route = this;
this.recurringFetchId = window.setInterval(function() {
Ember.$.getJSON('/s/1.json').then(function(json){
Ember.run(function(){
route.controller.set('model', json);
});
});
}, 5*1000);
@lukemelia
lukemelia / image-load.js
Created May 15, 2015
mixins/image-load.js
View image-load.js
import Ember from 'ember';
var on = Ember.on;
var set = Ember.set;
var run = Ember.run;
var Mixin = Ember.Mixin;
var computed = Ember.computed;
var getWithDefault = Ember.getWithDefault;
export default Mixin.create({
View gist:42973
#features/steps/users_steps.rb:
Given "I'm a logged in member" do
@me = create_adult
logged_in_as @me
end
#features/support/env.rb:
class Cucumber::Rails::World
View gist:83377
require "benchmark"
x = 10_000
first_id = Sport.first.id
key = "Sport:#{first_id}"
Sport.set key, Sport.find(first_id) # prime cache
Benchmark.bm(20) do |b|
b.report "Sport.get" do
View gist:83390
74.201.152.100:8298 ->
==> /data/weplay/shared/log/mongrel.5002.log <==
** [Exceptional] Error contacting Exceptional: execution expired
** [Exceptional] /usr/lib64/ruby/1.8/timeout.rb:54:in `rbuf_fill'
/usr/lib64/ruby/1.8/timeout.rb:56:in `timeout'
/usr/lib64/ruby/1.8/timeout.rb:76:in `timeout'
/usr/lib64/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
/usr/lib64/ruby/1.8/net/protocol.rb:116:in `readuntil'
/usr/lib64/ruby/1.8/net/protocol.rb:126:in `readline'
/usr/lib64/ruby/1.8/net/http.rb:2029:in `read_status_line'
View gist:83579
m_local = MemCache.new('127.0.0.1:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>> m_remote = MemCache.new('ey04-s00298:11211')
=> <MemCache: 1 servers, ns: nil, ro: false>
>>
?> first_id = Sport.first.id
=> 1
>> key = "Sport:#{first_id}"
=> "Sport:1"
>> m_local.set key, Sport.find(first_id) # prime cache
View gist:146708
[22:38-focus!][weplay(master)]$ rake db:migrate --trace
(in /Users/lmelia/devprojects/weplay)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddJerseyNumberToMembership: migrating ====================================
-- add_column(:memberships, :jersey_number, :string, {:limit=>20})
-> 658.3954s
== AddJerseyNumberToMembership: migrated (658.3955s) =========================
View gist:157861
(::) failed steps (::)
expected 237 +/- (< 20), got 0 (Spec::Expectations::ExpectationNotMetError)
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/fail_with.rb:39:in `fail_with'
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/handler.rb:21:in `handle_matcher'
/Users/lmelia/devprojects/weplay/vendor/plugins/rspec/lib/spec/expectations/extensions/kernel.rb:27:in `should'
./features/steps/selenium/color_picker_steps.rb:101:in `/^the live preview should have new primary and secondary colors$/'
features/selenium/change_colors.feature:57:in `Then the live preview should have new primary and secondary colors'
expected element matching "#membership_136960 .children" to contain the text "(?-mix:Joe\ Player)", but was "" (Spec::Expectations::ExpectationNotMetError)