npm install eslint-plugin-html eslint-config-prettier eslint-plugin-prettier tslint-config-prettier --dev
or
require 'active_support/concern' | |
require 'active_support/core_ext/class/attribute' | |
module PatternMatchingMethods | |
extend ActiveSupport::Concern | |
included do | |
class_attribute :defined_pattern_matching_methods, default: [] | |
def send_match(name, input) |
I hereby claim:
To claim this, I am signing this object:
require 'optparse' | |
require_relative './proof_of_work' | |
options = {} | |
OptionParser.new do |opts| | |
opts.on('--input INPUT', 'Input data') { |v| options[:input] = v } | |
opts.on('--difficulty DIFFICULTY', 'Difficulty (leading zeroes)') { |v| options[:difficulty] = v } | |
end.parse! | |
start_time = Time.now |
def visual_diff_scroll_fx(page, id:, name:) | |
page.evaluate_script('window.scrollTo(0,0)') | |
scroll_top = page.evaluate_script( | |
"document.getElementById('#{id}').getBoundingClientRect().top" | |
) | |
page.evaluate_script("window.scrollTo(0, #{scroll_top})") | |
sleep 0.1 | |
Percy::Capybara.snapshot(page, name: name) |
class SheetColumnIdentifiers | |
def initialize | |
@alphabet = ('A'..'Z').to_a | |
end | |
def [](index) | |
return alphabet[index] if index < alphabet.length | |
pad_index = (index / alphabet.length) - 1 | |
self[pad_index] + self[index % alphabet.length] |
webpack-rails
https://github.com/mipearson/webpack-railsProcfile
from webpack-rails can be renamed to Procfile.dev
to not conflict with Heroku, then run in dev with foreman start -f Procfile.dev
bin/dev
(chmod +x): foreman start -f Procfile.dev
webpack:compile
step https://github.com/patbenatar/heroku-buildpack-webpackwebpack-dev-server
in non-dev environments: config.webpack.dev_server.enabled = false
Reference implementation on cardsorter: https://github.com/philosophie/cardsorter/commit/46285b42383ecfd77706fbedaf6654bdd14ebe99
gemfile = File.read('Gemfile') | |
locks = Bundler.locked_gems | |
specs = locks.specs | |
# Naively convert to single quotes | |
gemfile.gsub! '"', "'" | |
specs.each do |gem| | |
# Don't try to set versions on git or github sources |
class ApplicationController < ActionController::Base | |
before_filter :sign_in_with_facebook_signed_request | |
protect_from_forgery | |
private | |
def sign_in_with_facebook_signed_request | |
return true unless params[:signed_request] |