Skip to content

Instantly share code, notes, and snippets.

View maerzbow's full-sized avatar

Markus Merzinger maerzbow

View GitHub Profile
@maerzbow
maerzbow / gist:995089
Created May 27, 2011 11:50
Eclipse dictionary - German
juskhe
merzma
credentials
cognos
pwd
google
apache
html
auth
eg
@maerzbow
maerzbow / .bash_aliases
Created July 18, 2011 19:57
My bash aliases
# aliases
alias l="ls -l"
alias ll="ls -alh"
alias ..="cd .."
alias ...="cd ../.."
alias psa="ps aux"
alias rmr="rm -r"
alias cl="clear"
@maerzbow
maerzbow / .vimrc
Created July 18, 2011 20:00
Minimal .vmrc
set nocompatible " must be the first line
filetype on
filetype indent on
filetype plugin on
set laststatus=2
syntax on
set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
set background=dark
@maerzbow
maerzbow / file_encoding_tag.rb
Created May 27, 2012 20:36
.rb file encoding tag
# encoding : utf-8
# ... or ...
# -*- encoding : utf-8 -*-
class ApplicationController < ActionController::Base
GERMAN_STRING = "muß grösser sein"
@maerzbow
maerzbow / codepoints_vs_bytes.rb
Created May 28, 2012 10:42
codepoints_vs_bytes.rb
german_string = "muß grösser sein"
# to retrieve the encoding of a String
puts german_string.encoding.name # >> UTF-8
# the character count
puts german_string.size # >> 16
# the actual bytes of this UTF-8 string
puts german_string.bytesize # >> 18
@maerzbow
maerzbow / read_file_with_encoding.rb
Created May 29, 2012 23:40
read file with encoding
file = File.open('iso-8859-1.txt', 'r:iso-8859-1')
puts file.external_encoding.name # >> ISO-8859-1
file_content = file.read
puts file_content.encoding.name # >> ISO-8859-1
file = File.open('iso-8859-1.txt', 'r:iso-8859-1:utf-8')
puts file.external_encoding.name # >> ISO-8859-1
file_content = file.read
puts file_content.encoding.name # >> UTF-8
@maerzbow
maerzbow / ensure_encoding_sniff.rb
Created July 22, 2012 19:28
ensure_encoding with :sniff option
input.ensure_encoding('UTF-8', :external_encoding => :sniff, :invalid_characters => :transcode)
@maerzbow
maerzbow / ensure_encoding_given.rb
Created July 22, 2012 19:53
ensure_encoding with input encodings given
input.ensure_encoding('UTF-8',
:external_encoding => [::Encoding::UTF_8, ::Encoding::UTF_16LE, ::Encoding::UTF_16BE,
::Encoding::ISO_8859_1],
:invalid_characters => :transcode)
@maerzbow
maerzbow / example.resjson
Created November 15, 2012 09:00
resjson example
{
"sc7MessageCount" : "Anzahl der Nachrichten: <span data-win-bind=\"innerText:count\" ></span>",
"_sc7MessageCount.source" : "You have <span data-win-bind=\"innerText:count\"></span> message(s)",
"_sc7MessageCount.comment" : "Do not change the HTML markup.",
"sc9AddressLabel" : "Adresse:",
"_sc9AddressLabel.source" : "Address",
"_sc9AddressLabel.comment" : "the address of the user"
}
@maerzbow
maerzbow / retrieve_resource_files.sh
Created January 19, 2013 20:16
retrieving resource files from lingohub using the lingohub CLI client. see: https://www.ruby-toolbox.com/projects/lingohub
lingohub resource:down --locale 'en' --directory config/locales/en --project 'lht' --all
lingohub resource:down --locale 'de' --directory config/locales/de --project 'lht' --all
lingohub resource:down --locale 'ja' --directory config/locales/ja --project 'lht' --all