Skip to content

Instantly share code, notes, and snippets.

@trev
trev / config.yml
Created May 25, 2018 01:23
CircleCI 2.0 with parallelism & simplecov for Rails
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
defaults: &defaults
working_directory: ~/split_app
parallelism: 2
docker:
- image: circleci/ruby:2.5.0-node-browsers
@palkan
palkan / factory_doctor.rb
Created March 27, 2017 15:42
FactoryDoc: detect useless data generation in tests
module FactoryGirl
module Doctor
module FloatDuration
refine Float do
def duration
t = self
format("%02d:%02d.%03d", t / 60, t % 60, t.modulo(1) * 1000)
end
end
end
@itod
itod / split_keyboards.md
Last active June 12, 2024 12:08
Every "split" mechanical keyboard currently being sold that I know of
@strzibny
strzibny / unused_routes.rb
Created May 5, 2016 15:21
Find unused routes in Rails
#!/usr/bin/env ruby
# Extracted from traceroute gem + checking the presence of views as well
require_relative './config/environment.rb'
class Traceroute
def initialize(app)
@app = app
end
@ajosanchez
ajosanchez / FO4_terminal_hack.rb
Last active December 16, 2020 13:11
This will help you crack those tricky terminals in the Fallout series. Just run this ruby script and enter each word separated only with a slash and no spaces (ex: kid/cat/pop/dog). It will display each words' total matches minus any words that had no matches. Then once you guess enter in the guess word with the likeness returned from the termin…
class Hack
def initialize words
@words = words.downcase.split(/\/|\s|,\s|\,/)
@splitwords = []
@words.each { |w| @splitwords << w.split('') }
show_likely
end
def deduct
@remy
remy / fajitas.md
Last active July 28, 2017 18:46
Diet recipes

Fajitas

Serves 2

Ingredients

  • 1 large oninon
  • 350-400g of chicken breast chopped into cubes/chunks
  • Fajita seasoning
  • 1/2 tin of refried beans
@glittershark
glittershark / mock_geocoder.rb
Last active April 12, 2019 09:04 — forked from paveltyk/mock_geocoder.rb
Mock geocoding in Rspec, using the new 'expect' syntax
# In spec_helper:
# RSpec.configure do |config|
# ...
# config.include(MockGeocoder)
# end
#
# In your tests:
# it 'mock geocoding' do
# # You may pass additional params to override defaults
# # (i.e. :coordinates => [10, 20])
@hmans
hmans / gist:cd5e2e989ceff7ff163a
Last active August 29, 2015 14:03
Ruby Configuration Thingy
class ConfigurationProxy
attr_reader :data
def initialize
@data = {}
end
def method_missing(method, *args, &blk)
if args.any? || block_given?
if block_given?
@hmans
hmans / gist:cf18d182c51fb9191df6
Created June 29, 2014 12:07
PostgreSQL Large Object Data Store for Dragonfly
# This is a Dragonfly data store using PostgreSQL Large Objects. It appears to work fine,
# but I ended up using a different solution in my project. Anyway, here you go.
#
class PostgresDataStore
def write(content, opts={})
data_oid = store_lo(content.data)
meta_oid = store_lo(Marshal.dump(content.meta))
"#{data_oid}/#{meta_oid}"
end
@bl1nk
bl1nk / private.xml
Last active April 12, 2019 09:04
KeyRemap4MacBook private.xml to get CODE Keyboard-like media keys on all PC keyboards
<?xml version="1.0"?>
<root>
<item>
<name>CODE Keyboard-like media keys</name>
<item>
<name>Enable CODE Keyboard-like media keys</name>
<appendix>Holding down the app-key sends fn, just pressing it sends app-key</appendix>
<appendix>* Play/Pause to Ins & Home</appendix>
<appendix>* Volume Up to Pg Up</appendix>
<appendix>* Volume Down to Pg Dn</appendix>