Skip to content

Instantly share code, notes, and snippets.

Avatar

Florian Vallen flov

View GitHub Profile
View kebase.md

Keybase proof

I hereby claim:

  • I am flov on github.
  • I am flowiz (https://keybase.io/flowiz) on keybase.
  • I have a public key ASAbLD0sVanmaKH6klM55CHROQvr40Ch2U4P44fqii6X-go

To claim this, I am signing this object:

View missing_translation_spec.rb
require 'i18n/tasks'
require 'ruby_cowsay'
require 'lolcat'
RSpec.describe 'I18n' do
let(:i18n) { I18n::Tasks::BaseTask.new }
let(:missing_keys) { i18n.missing_keys }
let(:cows) { [
"beavis.zen", "bong", "bud-frogs", "bunny", "cheese", "cower",
"daemon", "default", "dragon-and-cow", "dragon", "elephant-in-snake",
View notes_on_installing_ofd.md
  • I upgraded to ruby 2.2.2 since I had issues installing certain gems like nokogiri and others on ruby 1.9.3

  • I ran into an issue with polyglot which for some reason tried to require minitest: polyglot.rb:65:in require': cannot load such file -- minitest/unit (LoadError)` solution: add minitest to Gemfile

  • ran into a ruby 2.2.2 related error: dyld: Symbol not found: _rb_thread_select since ruby 2.2 this has been renamed to _rb_thread_select

View newrelic.yml
#
# This file configures the New Relic Agent. New Relic monitors
# Ruby, Java, .NET, PHP, and Python applications with deep visibility and low overhead.
# For more information, visit www.newrelic.com.
#
# Generated July 06, 2013
#
# This configuration file is custom generated for app16132110@heroku.com
@flov
flov / gist:3632726
Created Sep 5, 2012
Meta Programming!
View gist:3632726
class Supplier < ActiveRecord::Base
# delegate name, phone, description and contact if franchise is present
%w( name phone description contact ).each do |attribute|
define_method(attribute.to_sym) do
if self.attributes[attribute].present?
self.attributes[attribute]
elsif franchise.present?
franchise.send(attribute)
else
@flov
flov / vim tips
Created Jul 10, 2012
Learn Vim with it's most powerful commands, a brief description of the tips and tricks that I know and use day in day out
View vim tips
:r! echo '<p>PASTE IN</p>' | html2haml <--- Converts pasted code to haml
:r! rake routes <---- inserts output of rake routes in current file
Commands to explain:
- o, O, insert line below/above and change to insert mode
- A, go to insert mode at the end of line
- D, delete line from cursor till the end, does not jump into insert mode
- C, delete line from cursor till the end, jumps into insert mode
- f<character>/F<character> find next/previous character
- ci" ci' ci} ci) ca) ci) EXAMPLE: how to change what is inside the brackets in 'render_template(:edit)'
View get all states for countries and write them to yaml file
require 'open-uri'
require 'yaml'
h={}
(1..267).each do |x|
open("http://www.couchsurfing.org/get_option_values.html?cpaint_function=get_states_auto&cpaint_argument[]=#{x}") do |f|
if f.first
# anybody knows why it doesnt check if the string is empty before it executes the split ???
# I went through all x which dont work and substitude f.first with
# x!=112 and x!=122 and x!=124 and x!= 150 and x!=219 and x!= 240