Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabio Kreusch fabiokr

View GitHub Profile
View gist:62aa8ec8184ef16c96a3
Verifying that +fkreusch is my blockchain ID. https://onename.com/fkreusch
View ansible.html.erb
<html>
<head>
<style>
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
View ansible-colored-html.rb
require 'erb'
class Ansible
class TemplateParams
attr_accessor :content, :helper
# Public: Initializes the Template Params context.
#
# content - the Ansible content
def initialize(content)
View keybase.md

Keybase proof

I hereby claim:

  • I am fabiokr on github.
  • I am fabiokr (https://keybase.io/fabiokr) on keybase.
  • I have a public key whose fingerprint is 45B2 ADBB D9C9 89CC 4EC0 3B1E 71D8 FFF7 14DE 4EDF

To claim this, I am signing this object:

View 0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@fabiokr
fabiokr / .irbrc.rb
Last active Dec 11, 2015
Install Pry + AwesomePrint globally
View .irbrc.rb
# Requires a gem outside of Bundler.
#
# gem - the gem name
# const - only requires the gem if const is not yet defined
#
# Reference: https://gist.github.com/3894925
def unbundled_require(*gems)
if defined?(::Bundler)
gems.each do |gem|
spec_path = Dir.glob("#{Gem.dir}/specifications/#{gem}-*.gemspec").last
View gist:4089428
class Example
attr_accessor :var_1, :var_2
def with_self(var)
self.var_1 = var
end
def without_self(var)
var_2 = var
end
View gist:4032236
#!/usr/bin/env ruby
#
# Usage: rebundle gem_name
#
# The script will remove the gem dependency tree from the lockfile and bundle.
LOCKFILE_NAME = "Gemfile.lock"
lockfile = File.readlines(LOCKFILE_NAME)
View gist:4032230
#!/usr/bin/env ruby
LOCKFILE_NAME = "Gemfile.lock"
lockfile = File.readlines(LOCKFILE_NAME)
# Finds where the gem dependency tree begins
def beginning(gem_name, lockfile)
lockfile.each_with_index do |line, index|
if line.include?("specs:") && lockfile[index+1].include?(gem_name)
@fabiokr
fabiokr / snippet_backend.rb
Created Aug 24, 2012 — forked from pacoguzman/snippet_backend.rb
I18n that include pluralization rules for spanish within Rails - http://www.viget.com/extend/rails-internationalization-and-tu/
View snippet_backend.rb
module I18n
module Backend
class SnippetBackend < Simple
protected
def init_translations
load_translations(*I18n.load_path.flatten)
load_translations_from_database
@initialized = true
end
You can’t perform that action at this time.