This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -gt 0 ]; then | |
git symbolic-ref HEAD refs/heads/$1 && | |
rm .git/index && | |
git clean -fdx && | |
git commit --allow-empty -m "Created empty $1 branch" | |
else | |
echo "No branch name specified!" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_color white | |
own_window_colour white | |
alignment top_right | |
max_user_text 16384 | |
max_specials 512 | |
gap_x 0 | |
gap_y 40 | |
no_buffers yes | |
uppercase no | |
cpu_avg_samples 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Probably the smallest script to initialize workflow of your projects. Usage: | |
# | |
# * copy script to your bin | |
# * make the $HOME/.workflow directory | |
# * write plain bash/sh bootstraper, eg: | |
# | |
# #!/bin/bash | |
# path=/path/to/your/project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
stty -echo | |
read -p "Password: " passw | |
stty echo | |
irssi -c irc.freenode.org -n nu7hatch -w $passw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nu7hatch@abyss:/home/nu7hatch/dev/erl/rebar-test$ ./rebar create-app appid=rebar-test | |
==> rebar-test (create-app) | |
ERROR: 'create-app' failed while processing /home/nu7hatch/dev/erl/rebar-test: {'EXIT',{undef,[{escript,foldl, | |
[#Fun<rebar_templater.0.114075285>,[], | |
"/home/nu7hatch/dev/erl/rebar-test/rebar"]}, | |
{rebar_templater,cache_escript_files,0}, | |
{rebar_templater,create,2}, | |
{rebar_core,run_modules,4}, | |
{rebar_core,execute,4}, | |
{rebar_core,process_dir,4}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyApp1 < Padrino::Application | |
register SassInitializer | |
register Padrino::Helpers | |
register Padrino::Mailer | |
register Padrino::Warden | |
enable :sessions | |
set :auth_use_referrer, true | |
set :auth_failure_path, "/login" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Padrino::Foundation::Simple | |
# ... some core things | |
end | |
module Padrino::Foundation::Complex | |
self.registered(app) | |
app.register Padrino::Rendering | |
app.register Padrino::Routing | |
app.register Padrino::Helpers | |
# ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
module Helpers | |
# Replace standard input with faked one StringIO. | |
def fake_stdin(*args) | |
begin | |
$stdin = StringIO.new | |
$stdin.puts(args.shift) until args.empty? | |
$stdin.rewind | |
yield |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It produces shorten version of given url. | |
# | |
# p truncate_url("http://example.com/hello.html") | |
# p truncate_url("http://example.com/yada-yada-yada/foobar/hello.html", :length => 40) | |
# | |
# will produce: | |
# | |
# "http://example.com/hello.html" | |
# "http://example.com/...foobar/hello.html" | |
def truncate_url(url, options={}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Line size can be calculated with system stty command (it works on linux/unix | |
# and windows): | |
# | |
# `stty size`.split.last.to_i | |
# | |
def line_break(text, line_size, delim="\n") | |
words, result, sum = text.split, [], 0 | |
words.each do |word| | |
result << delim and sum=0 if (sum+word.size) > line_size | |
result << word+" " |