Skip to content

Instantly share code, notes, and snippets.

View mrgenixus's full-sized avatar

Ben West mrgenixus

View GitHub Profile
module Starbucks
def self.order(&block)
order = Order.new
order.instance_eval(&block)
return order.drinks
end
class Order
@mrgenixus
mrgenixus / console.log short
Last active October 15, 2015 01:01 — forked from DaveVoyles/console.log short
Got tired of writing console.log everywhere
var c = console.log.bind(console); // allows you to replace console.log(message) in your code with c(message)
@mrgenixus
mrgenixus / active_model_lint.rb
Created February 26, 2016 14:26 — forked from dmitriy-kiriyenko/active_model_lint.rb
ActiveModel lint tests for rspec
# put the file into spec/support
shared_examples_for "ActiveModel" do
include ActiveModel::Lint::Tests
# to_s is to support ruby-1.9
ActiveModel::Lint::Tests.public_instance_methods.map{|m| m.to_s}.grep(/^test/).each do |m|
example m.gsub('_',' ') do
send m
end
end
@mrgenixus
mrgenixus / no-select.scss
Created February 1, 2017 18:16 — forked from nathos/no-select.scss
Sass (SCSS) mixin to disable user-select on an element
@mixin no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-ms-text-size-adjust: none;
@mrgenixus
mrgenixus / isDblTouchTap.js
Created May 22, 2017 16:44 — forked from MoOx/isDblTouchTap.js
Double touch tap workaround for React based on onTouchTap (react-tap-event-plugin)
const dblTouchTapMaxDelay = 300
let latestTouchTap = {
time: 0,
target: null,
}
export default function isDblTouchTap(event) {
const touchTap = {
time: new Date().getTime(),
target: event.currentTarget,