Skip to content

Instantly share code, notes, and snippets.

blimmer /
Last active Jun 17, 2020
A helper tool to fix local clones after renaming "master" branches to "main"
#! /bin/bash
set -e
if ! git diff-index --quiet HEAD --; then
echo "ERROR: you have uncommited changes. Please stash or commit before running this script."
exit 1
git fetch
View components.card-thingy.js
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['card-thingy'],
click() {
blimmer / monkeypatch.rb
Created Mar 21, 2018
Rails Issue #30947 Workaround
View monkeypatch.rb
# This patch is to work around this bug in Rails 5.0.x and 5.1.x
# Because we use SQLite for tests and MySQL in prod, having the options hash
# containing ENGINE=InnoDB causes problems when we try to prepare the test database.
# Because of this, we need to remove those options from the generated schema.rb file.
# Here is the source that's setting `options`
# This should be removed for Rails 5.2 ++
import Ember from 'ember';
export default Ember.Component.extend({
array: Ember.A([]),
setSomeStuff() {
this.get('array').pushObjects(['foo', 'bar', 'baz']);
blimmer /
Created Oct 31, 2017
ember concurrency example for joey
import Ember from 'ember';
import { task, timeout } from 'ember-concurrency';
export default Ember.Component.extend({
myVal: null,
asyncPoll: task(function * () {
this.set('myVal', Math.random());
yield timeout(1000); // ms
this.get('asyncPoll').perform(); // requeue myself
blimmer / foo_for_caching.rb
Created Sep 27, 2017
Rails Issue 30680 Workaround
View foo_for_caching.rb
# This class exists to make the caching of Foo objects more efficient.
# Marshaling full activerecord objects is expensive, especially in Rails 5
# because of this bug:
# This simple ruby class selects a very small subset of parameters needed
# for common operations on these objects. It also acts like Foo, by
# passing attributes through to an in-memory Foo model.
class FooForCaching
attr_accessor :attributes
# This is a list of attributes we want to save in cache
blimmer / bug_report.rb
Last active Sep 16, 2021
ActiveRecord 5 Bug Report - marshal slow loading
View bug_report.rb
# frozen_string_literal: true
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
blimmer / components.user-info.js
Created Aug 9, 2017
wip multipage validations
View components.user-info.js
import Ember from 'ember';
import { validator, buildValidations } from 'ember-cp-validations';
import { userInfoValidations } from '../models/order';
const Validations = buildValidations(userInfoValidations);
export default Ember.Component.extend(Validations, {
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'