Skip to content

Instantly share code, notes, and snippets.

View roolo's full-sized avatar

Mailo Světel roolo

View GitHub Profile
@roolo
roolo / README.md
Last active August 29, 2015 13:57
Sort in Postgres

Try

sort sortme

Soubor locale zabývající se řazením

ls -l /usr/share/locale/cs_CZ.UTF-8/LC_COLLATE

Links

@roolo
roolo / no-eol.vim
Created March 18, 2014 13:04
No eol at eof in ViM
autocmd FileType php setlocal noeol binary fileformat=dos
@roolo
roolo / gist:9138472
Created February 21, 2014 17:07
AngularJS z konzole
var injector = angular.element($0).injector();
undefined
var perm = injector.get('models.users.permissions');
undefined
perm
Object {validate: function}
perm.validate('administrator', 'Contract', 'index');
true
perm.validate('administrator', 'Contract', 'show');
true
@roolo
roolo / gist:8538765
Last active January 3, 2016 23:59
Reset author in git
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Mailo Světel'
GIT_AUTHOR_EMAIL='development@rooland.cz'
GIT_COMMITTER_NAME='Mailo Světel'
GIT_COMMITTER_EMAIL='development@rooland.cz'
" HEAD
visit('page.com/which-make-sense')
click_button('send')
@roolo
roolo / output.log
Created December 9, 2013 23:05
Ansible – unarchive can't see path
╰─ vagrant provision 1 ↵
[default] Running provisioner: ansible...
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
<127.0.0.1> REMOTE_MODULE setup
ok: [default]
TASK: [Prepare dir for Pebble kit] ********************************************
@roolo
roolo / documentatar.rb
Created November 5, 2013 14:58
Sinatra basic documentation for API. This code as it is generates code for Markdown
after do
TEST_DOCUMENTATION_FILE << "\n## %s %s"%[request.request_method,request.path_info]
TEST_DOCUMENTATION_FILE << "\n### Request"
TEST_DOCUMENTATION_FILE << "\n "+JSON.pretty_generate(
JSON.parse(request.POST.to_json)
).gsub(/\n/, "\n ")
TEST_DOCUMENTATION_FILE << "\n### Response"
response_formatted = JSON.pretty_generate(
JSON.parse(response.body.first)
).gsub(/\n/, "\n ")
@roolo
roolo / replace.md
Created November 1, 2013 12:39
Strip trailing whitespaces

Replace:

/\n\s+\n/

With:

/\n\n/
@roolo
roolo / gist:7151356
Created October 25, 2013 08:28
Sinatra – json by default
before do
content_type 'application/json'
end
@roolo
roolo / gist:7040779
Created October 18, 2013 12:24
Prosody 0.9.1 install on OSX Lion
[~]$ brew install http://prosody.im/files/homebrew/prosody_0.9.1.rb [ruby-2.0.0-p247]
######################################################################## 100.0%
Installing http://www.luarocks.org/repositories/rocks/luasocket-2.0.2-5.src.rock...
Using http://www.luarocks.org/repositories/rocks/luasocket-2.0.2-5.src.rock... switching to 'build' mode
Archive: /private/tmp/luarocks_luarocks-rock-luasocket-2.0.2-5-7448/luasocket-2.0.2-5.src.rock
inflating: luasocket-2.0.2-5.rockspec
inflating: luasocket-2.0.2.tar.gz
cd src; make all
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -O2 -fPIC -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -fno-common -I/usr/local/opt/lua/include -c -o luasocket.o luasocket.c
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -O2 -fPIC -DLUASOCKET_DEBUG -DUNIX_HAS_SUN_LEN -fno-common -I/usr/local/opt/lua/include -c -o timeout.o timeout.c