Skip to content

Instantly share code, notes, and snippets.

View GBH's full-sized avatar
πŸ¦€
πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€

Oleg GBH

πŸ¦€
πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€πŸ¦€
View GitHub Profile
@GBH
GBH / gist:d601b212e1e473c62e90
Created April 1, 2015 18:35
Testing for translation consistency
require_relative '../test_helper'
class I18nIntegrationTest < ActionDispatch::IntegrationTest
def collect_combined_keys(hash, ns = nil)
hash.collect do |k, v|
keys = [ ]
keys << collect_combined_keys(v, "#{ns}.#{k}") if v.is_a?(Hash)
keys << "#{ns}.#{k}"
end.flatten
@GBH
GBH / each_with_alpha_index.rb
Last active August 29, 2015 14:20
each_with_alpha_index
module Enumerable
# Iterate through enumerable with alpha index instead of integers
def each_with_alpha_index(index = 'a')
each do |element|
yield element, index
index.next!
end
end
end
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
brew update && brew upgrade postgresql
initdb /usr/local/var/postgres9.5.1 -E utf8
pg_upgrade -d /usr/local/var/postgres -D /usr/local/var/postgres9.5.1 -b /usr/local/Cellar/postgresql/9.4.2/bin/ -B /usr/local/Cellar/postgresql/9.5.1/bin/ -v
rm -rf postgres
@GBH
GBH / merger.rb
Last active March 25, 2016 14:42
#!/usr/bin/env ruby
# Small script to join and clean-up ACA gpx files.
# Setup:
# - make sure you got nokogiri installed (gem install nokogiri)
# - throw this merger.rb in some directory
# - inside that directory create input/ folder
# - copy ACA .gpx files into that folder. Generally {direction}Main files plus Services files
# Usage:
# - from terminal run ./merger.rb
require 'yaml'
en_hash = YAML::load_file(File.expand_path('../config/locales/en.yml', File.dirname(__FILE__)))
locales = %w(en de es fr nl pt-BR zh-CN zh-TW)
def fix_locale(locale_hash, en_hash)
result_hash = locale_hash
# frozen_string_literal: true
gem "bundler", "< 1.16"
begin
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
end
@GBH
GBH / wiki
Created January 10, 2018 21:09
{{Infobox software
| name = ComfortableMexicanSofa
| developer = Oleg Khabarov
| released = {{release date|2010|10|13}}
| latest_release_version = <!-- If you update this, remember to also update [[List of content management systems]]--> 2.0.7<ref name="comfortable_mexican_sofa_release">https://rubygems.org/gems/comfortable_mexican_sofa/versions/2.0.7</ref>
| latest_release_date = {{release date|2017|12|24}}
| status = Active
| operating_system = [[Cross-platform]]
| platform = [[Ruby on Rails]]
| genre = [[Content management system]]