Skip to content

Instantly share code, notes, and snippets.

View haslo's full-sized avatar
<peon>work work</peon>

Guido Gloor Modjib haslo

<peon>work work</peon>
View GitHub Profile
@haslo
haslo / json_export.rb
Last active October 26, 2016 12:26
Exports a nested JSON into an Excel, to send to clients for translations
#!/usr/bin/env ruby
require 'json'
require 'spreadsheet'
def process_hash(translations, current_key, hash)
hash.each do |new_key, value|
combined_key = [current_key, new_key].delete_if { |k| k == '' }.join(".")
if value.is_a?(Hash)
process_hash(translations, combined_key, value)
@haslo
haslo / unity_proxy.md
Last active August 24, 2020 21:10
Proxy for Tabletop Simulator's Unity HTTPS problems
[alias]
cheat = !git add -A && git commit --amend -C HEAD && git push -f
branchdates = !git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate) %(authorname) %(refname:short)'
deletemerged = !git branch --merged | grep -v '^* master$' | grep -v '^ master$' | xargs git branch -d
cleanup = !git checkout master && git pull && git deletemerged && git branch
[log]
decorate = full
[color]
ui = true
@haslo
haslo / gist:43a8abd5cff600094cef
Created July 10, 2015 09:49
CSV-Export DB from Ruby / PostgreSQL
# inspired by: https://github.com/oxon/logistaegvm/blob/master/lib/tasks/export.rake
# required gems:
# * pg
# * rubyzip
unless ARGV.count == 1
puts 'Required argument: Output directory'
exit 1
end
@haslo
haslo / yml_export.rb
Last active October 26, 2016 12:26
Export locale files from YAML to CSV, for further processing by clients
#!/usr/bin/env ruby
require 'yaml'
require 'deep_merge'
require 'find'
require 'spreadsheet'
def process_hash(translations, current_key, hash)
hash.each do |new_key, value|
combined_key = [current_key, new_key].delete_if { |k| k == '' }.join(".")
@haslo
haslo / model_with_json_data.rb
Last active August 29, 2015 14:08
Getters and Setters for JSON Data Fields for ActiveRecord Models
module Concerns
module ModelWithJSONData
extend ActiveSupport::Concern
module ClassMethods
def json_data_field_descriptions
[]
end
end
@haslo
haslo / yosemite.md
Last active August 29, 2015 14:07
Yosemite Stuff