Skip to content

Instantly share code, notes, and snippets.

View whatthewhat's full-sized avatar

Mikhail Topolskiy whatthewhat

View GitHub Profile
@whatthewhat
whatthewhat / components.item\.js
Created April 28, 2020 09:28
3-17-willdestroyelement-bug
import Component from '@ember/component';
export default class extends Component {
willDestroyElement() {
alert(`willDestroyElement called for ${this.item.name}`)
}
}
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
createItems() {
this.store.createRecord('item', {name: 'item 1'});
this.store.createRecord('item', {name: 'item 2'});
}
}
require 'benchmark/ips'
DATA_POINTS = (1..10000).map { |i|
if i > 8000 # 20%
{ value: nil }
else
{ value: 1 }
end
}
@whatthewhat
whatthewhat / gist:cb6a62532a8a0984adbe
Created July 21, 2014 09:03
Find scheduled sidekiq job by id
require 'sidekiq/api'
Sidekiq::ScheduledSet.new.find_job("61374d5d51db323507376158")
@whatthewhat
whatthewhat / i18n_lookup_debug.rb
Created December 9, 2013 08:46
Debug rails i18n lookup
module I18n
class << self
def translate_with_debug(*args)
puts "Translate : #{args.inspect}"
translate_without_debug(*args)
end
alias_method_chain :translate, :debug
end
end
@whatthewhat
whatthewhat / will_paginate.rb
Created October 14, 2011 11:46 — forked from isaacbowen/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@whatthewhat
whatthewhat / gist:966272
Created May 11, 2011 10:45
Robotium sample test
// Create a new card
public void testCreateCard(){
solo.clickOnButton("Login");
solo.sendKey(Solo.MENU);
solo.clickOnText("New");
solo.clickOnText("Card");
solo.clickOnText("Password");
solo.enterText(0, "My password");
solo.enterText(1, "User");
solo.enterText(2, "12345");