Skip to content

Instantly share code, notes, and snippets.

View wojtekmach's full-sized avatar

Wojtek Mach wojtekmach

View GitHub Profile
Gem::Specification.new do |s|
s.name = 'value'
s.version = '1.0.0.alpha'
s.description = 'value'
s.summary = 'value'
s.licenses = ['MIT']
s.homepage = 'https://gist.github.com/wojtekmach/5fb83f9dc97a02e9851a'
s.authors = ['Wojtek Mach']
s.email = ['wojtek@wojtekmach.pl']
@wojtekmach
wojtekmach / anima_ext.rb
Created March 14, 2015 10:07
anima_ext.rb
require 'anima'
class AnimaExt < Anima
module ClassMethods
def [](hash)
new(hash)
end
end
module InstanceMethods
foo
@wojtekmach
wojtekmach / enum.rb
Created February 6, 2015 00:41
enum.rb
# >> color = Enum.new("red", "green", "blue")
# >> color.values
# => ["red", "green", "blue"]
# >> color["red"]
# => "red"
# >> color["yellow"]
# ArgumentError: Invalid value: "yellow". Allowed: "red", "green", "blue".
class Enum
def initialize(*values)
@values = values
@wojtekmach
wojtekmach / README.rst
Last active August 29, 2015 14:07 — forked from mmerickel/README.rst

How to setup docker on OS X using boot2docker

Basic install

  1. Install Virtualbox
  2. Install XCode and the Command Line Tools
# Based on: https://gist.github.com/tmertens/9a3355c3c9a04d537a34
require 'benchmark/ips'
class Tester
def self.it(description)
description
end
def self.metadata
diff --git a/foo.rb b/foo.rb
index f23ba09..ff04a22 100644
--- a/foo.rb
+++ b/foo.rb
@@ -1,11 +1,13 @@
a = [
1,
2,
- 3
+ 3,
module ActiveSupport::JSON::Encoding
class JSONGemEncoder
# See: https://github.com/rails/rails/blob/8f15565de879bd40c8390884d1d31e52de240323/activesupport/lib/active_support/json/encoding.rb#L95
def stringify(jsonified)
::JSON.pretty_generate(jsonified, quirks_mode: true, max_nesting: false) + "\n"
end
end
end
# based on https://github.com/basecamp/pow/issues/428
if [ -f "$rvm_path/scripts/rvm" ]; then
source "$rvm_path/scripts/rvm"
fi
if [ -f ".rvmrc" ]; then
source ".rvmrc"
fi

Keybase proof

I hereby claim:

  • I am wojtekmach on github.
  • I am wojtekmach (https://keybase.io/wojtekmach) on keybase.
  • I have a public key whose fingerprint is BB14 74F7 937F 0321 39C7 7054 C3DA D70E 5262 D2F5

To claim this, I am signing this object: