Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
@fgarcia
fgarcia / long_lines.vim
Created March 22, 2014 10:23
Highlight long lines (>80) and provide a toggle command
" Highlight long lines (>80)
autocmd BufEnter * highlight OverLength ctermbg=darkgrey guibg=#592929
autocmd BufEnter * match OverLength /\%81v.*/
autocmd BufEnter * let w:long_line_match = 1
fu! LongLineHighlightToggle()
highlight OverLength ctermbg=darkgrey guibg=#592929
if exists('w:long_line_match')
match OverLength //
# Goal: put a non-Rails-aware Ruby library using normal `require`s in
# lib/sim. Have it transparently reloaded between requests like Rails app
# code is.
#
# The code here goes inside of your configure block in
# config/environments/development.rb. There are two parts, commented inline.
# Reload code whenever the simulator changes.
config.watchable_dirs["lib/sim"] = [:rb]
config.watchable_files << "lib/sim.rb"
@henrik
henrik / ruby_2.1_experiment.rb
Last active January 4, 2016 09:49
Toying with Ruby 2.1 methods returning symbols.
module Wrapping
def wrap(method_name, &block)
# Alternative implementations: either will do the trick.
wrap_with_prepend(method_name, &block)
#wrap_with_bind(method_name, &block)
end
private
def wrap_with_prepend(method_name)
@dblandin
dblandin / .env
Created January 19, 2014 19:06
Managing RubyMotion environment variables
TESTFLIGHT_APP_TOKEN=90210
TESTFLIGHT_TEAM_TOKEN=90210
TESTFLIGHT_API_TOKEN=90210
BUGSENSE_API_KEY=90210
BUGSENSE_API_TOKEN=90210
DEVELOPMENT_CERTIFICATE_NAME="iPhone Developer: yourName"
DEVELOPMENT_PROVISIONING_PROFILE_PATH="/path/to/development.mobileprovision"
@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

@ToJans
ToJans / InventoryItems.hs
Last active December 21, 2024 10:20
Haskell implementation of Greg Young's CQRS sample: https://github.com/gregoryyoung/m-r Love the sheer elegance of Haskell; no need for all that infrastructure crap
module InventoryItems(Command(..), Event(..), handle) where
import Data.Maybe(isJust)
type Id = String
type Name = String
type Amount = Int
data Command = CreateInventoryItem Id
| RenameInventoryItem Id Name
@nicholasjhenry
nicholasjhenry / foo_curry.rb
Last active December 31, 2015 07:39
Make a service class support currying, uh partial application?
module Curryable
def curry(arity=nil)
method(:call).to_proc.curry(arity)
end
end
class Foo
include Curryable
def call(x, y, z)
@thbar
thbar / maintenance.rake
Created November 28, 2013 10:10
Quick, slow, dirty way to verify how aged your gems are.
task :outdated => :environment do
include ActionView::Helpers::DateHelper
regexp = /\* ([^ ]+) \((\S+) > ([^)]+)\)/
outdated = `bundle outdated`.scan(regexp)
outdated.each do |gem_name, available, current|
data = JSON.parse(`curl --silent https://rubygems.org/api/v1/versions/#{gem_name}.json`)
version = data.find { |e| e['number'] == current }
age = distance_of_time_in_words_to_now(Time.parse(version['built_at']))
puts " * #{gem_name}: (#{available} > #{current}, built #{age} ago)"
end
# Hook into unicorn, unicorn middleware, not rack middleware
#
# Since we need no knowledge about the request we can simply
# hook unicorn
module Middleware::UnicornOobgc
MIN_REQUESTS_PER_OOBGC = 5
MAX_DELTAS = 20

NOTE TO CONTRIBUTORS : Take this wherever you like. If you have articles that really helped you, add them to the list of resources at the end. All content added to this EtherPad is considered public domain. Add your name to the list of contributors at the end of you want attribution.

Suggestions on where to eventually take this content are welcome. I was thinking of making it into a Github pages branch, or maybe on a wiki somewhere?

Testing Chef Cookbooks : A Landscape

There seem to be many approaches to test driving your Chef infrastructure, and the amount of projects to pick from is overwhelming. This document tries to provide some overview.