Skip to content

Instantly share code, notes, and snippets.

View jherdman's full-sized avatar

James Herdman jherdman

View GitHub Profile
@jherdman
jherdman / intersect_with_matcher.rb
Created December 2, 2009 22:32
An RSpec matcher to check for intersection between two enumerables
Spec::Matchers.define :intersect_with do |challenge_range|
# Check to see if any elements exist in the intersection
match do |current_range|
[current_range.to_a & challenge_range.to_a].flatten.any?
end
failure_message_for_should do |current_range|
"#{current_range.inspect} doesn't overlap with #{challenge_range.inspect}"
end
@jherdman
jherdman / README.md
Last active January 11, 2022 05:49 — forked from ankane/README.md
A Gem loading benchmark script

Benchmark Bundler

Because loading gems can take longer than you think

$ curl -fsSL https://gist.github.com/jherdman/5025684/raw/a3ccd4b5308723245706b4ae315845fe951b4473/benchmark.rb | ruby
............................................................[DONE]

Gem                            Time(sec)     Pct %
--------------------------------------------------
  1. Start Neovim
  2. :CocConfig
  3. Paste the below:
{
  "coc.preferences.formatOnSaveFiletypes": ["javascript"],
  "prettier.requireConfig": true
}
defmodule RovrApiWeb.ChangesetView do
use RovrApiWeb, :view
@doc """
Traverses and translates changeset errors.
See `Ecto.Changeset.traverse_errors/2` and
`RovrApiWeb.ErrorHelpers.translate_error/1` for more details.
"""
def translate_errors(changeset) do
@jherdman
jherdman / controllers.application.js
Last active August 22, 2019 18:56
strange-else-problem
import Controller from '@ember/controller';
import { equal, gt } from '@ember/object/computed';
export default Controller.extend({
init() {
this._super(...arguments);
this.cars = [];
this.set('counter', 0);
},
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
onChange() {
this.set('msg', 'i heard a change event');
},
},
});
@jherdman
jherdman / controllers.application.js
Created April 25, 2018 15:06 — forked from samselikoff/controllers.application.js
Mirage: create with polymorphic
import Ember from 'ember';
export default Ember.Controller.extend({
});
Hello friends.
I'm writing today to tell you that my trusty friend, my La Sportiva Lady Solutions, have died. Last night the strap broke rendering the right shoe dead as a door knob. I've attached a picture in case you have a wall of hero shoes. It helped me through my first 7b, and was there for me throughout the past 9 months. I'm sure it'll be a fine addition next to Nalle's portrait.
See, the thing, though, is that I keep breaking that stupid wimpy strap. I've done this now on at least two other pairs of Solutions, and on two pairs of Futuras. At nearly $230 CAD a pop, I just can't justify it any more.
Have you seen the strap on the Evolv shoes (attached for your viewing pleasure)? Now those are straps. If I break one of these, I deserve a medal.
I'm writing to implore you to reconsider the strap design in 2019, as it's clear 2018's shoes are still using the same wimpy strap. Please, please, please! The shoes are basically perfect otherwise. Sensitive, snug, and readily available in my size.
@jherdman
jherdman / controllers.application.js
Created September 28, 2017 14:08
sadness-routing
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@jherdman
jherdman / components.range-element-spy.js
Created February 24, 2017 21:43
range elements report wrong initial value
import Ember from 'ember';
export default Ember.Component.extend({
didRender() {
let nativeValue = this.$('#native').val();
this.set('nativeValue', nativeValue);
let emberValue = this.$('#ember-helper').val();
this.set('emberValue', emberValue);
},