Skip to content

Instantly share code, notes, and snippets.

module AttrInit
def attr_init *attrs
class_eval <<-DEF
def initialize(#{attrs.join(', ')})
#{attrs.map{|a| "@#{a} = #{a}"}.join ?\n}
end
DEF
end
end
Class.send :include, AttrInit
sudo add-apt-repository ppa:finalterm/daily
sudo apt-get update
sudo apt-get install finalterm
echo "deb http://debian.sur5r.net/i3/ $(lsb_release -c -s) universe" >> /etc/apt/sources.list
apt-get update
apt-get --allow-unauthenticated install sur5r-keyring
apt-get update
apt-get install i3
echo exec i3 >> ~/.xinitrc
/usr/lib/lightdm/lightdm-set-defaults --session i3
/usr/lib/lightdm/lightdm-set-defaults --greeter lightdm-gtk-greeter
puts DATA.rewind && DATA.read
__END__
# update window title with command
function preexec {
commandline="$1" # the user-entered commandline is passed in as first arg
args=${${(z)commandline}[2,-1]} # get command's args
new_title=${args:-$PWD} # if no args, then use the pwd
set_window_title $new_title
}
@acook
acook / _LICENSE
Last active August 29, 2015 13:56
LICENSE EXCEPTIONS
Special exceptions (permissions) apply to this library above and beyond the
standard agreement to allow more permissive usage of this source code.
--------------------------------------------------------------------------------
"Classpath" style Exception:
Linking this library statically or dynamically with other modules is making a
class GreetingView
def initialize env
@env = env
end
def new
flash
print "Enter your name: "
end
module AnyOf # makes "OR" queries
def any_of *queries
queries.inject(arelify queries.pop) do |these, query|
these.or arelify query
end
end
private
def arelify query # tempting to move this into a "to_arel" method
relation = Model .where nil
table = relation.arel_table
first = table[:id] .eq 3
third = relation.where id: 1
where_third = third.arel.ast.cores.last.wheres
relation.where first . or where_third
server: open tcp://localhost:4321
until [error? try [insert server ask "R> "]]
close server