Skip to content

Instantly share code, notes, and snippets.

@luki3k5
luki3k5 / gist:6534069
Created September 12, 2013 07:37
brew doctor is broken
% brew doctor !10032
Error: undefined method `head' for #<SoftwareSpec:0x100a97210>
Please report this bug:
https://github.com/mxcl/homebrew/wiki/troubleshooting
/usr/local/Library/Formula/sphinx.rb:24
/usr/local/Library/Homebrew/formula.rb:722:in `instance_eval'
/usr/local/Library/Homebrew/formula.rb:722:in `resource'
/usr/local/Library/Formula/sphinx.rb:23
/usr/local/Library/Homebrew/formulary.rb:40:in `require'
/usr/local/Library/Homebrew/formulary.rb:40:in `klass'
class CashCounterService
CURRENCIES_BILLS = {
usd: [1, 2, 5, 10, 20, 50, 100],
eur: [1, 2, 5, 10, 20, 50, 100, 200]
}
def calculate_money_received(to_pay, currency=:eur)
to_pay = to_pay.ceil
CURRENCIES_BILLS[currency].each do |bill|
class CashCounterService
CURRENCIES_BILLS = {
usd: [1, 2, 5, 10, 20, 50, 100],
eur: [1, 2, 5, 10, 20, 50, 100, 200]
}
def calculate_money_received(to_pay, currency=:eur)
to_pay = to_pay.ceil
CURRENCIES_BILLS[currency].each do |bill|
@luki3k5
luki3k5 / gist:4745366
Created February 9, 2013 14:11
simply converting yaml translation files into the CSV for google spreadsheet upload (to be used with google_spreadsheet2yml gem)
require 'csv'
require 'yaml'
yaml_file_en = YAML::load( File.open( 'config/locales/en.yml' ) )
yaml_file_de = YAML::load( File.open( 'config/locales/de.yml' ) )
def flat_hash(hash, k = [])
return {k => hash} unless hash.is_a?(Hash)
hash.inject({}){ |h, v| h.merge! flat_hash(v[-1], k + [v[0]]) }
end
@luki3k5
luki3k5 / spreedsheet2yaml.rb
Created October 21, 2011 11:30
this is a module that allows flat hash to yaml compatible hash conversions (perfect for spreedsheet to yaml conversion)
# example:
#
# hash = { 'project.name' => "name of the project",
# 'project.date.start' => "start date of the project",
# 'project.date.end' => "end date of the project" }
#
# Spreedsheet2yaml.create_yaml(hash)
#
module Spreedsheet2yaml
@result = {}
require 'rest-client' if RAILS_ENV == "development"
require 'scalarium-api-wrapper' if RAILS_ENV == "development"
namespace :my_application do
namespace :scalarium do
desc "deploy to development"
task :deploy_to_dev, :comment, :needs => :environment do |t, args|
if RAILS_ENV == "development"