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 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 |
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
| sudo add-apt-repository ppa:finalterm/daily | |
| sudo apt-get update | |
| sudo apt-get install finalterm |
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
| 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 |
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
| puts DATA.rewind && DATA.read | |
| __END__ |
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
| # 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 | |
| } |
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
| 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 |
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 GreetingView | |
| def initialize env | |
| @env = env | |
| end | |
| def new | |
| flash | |
| print "Enter your name: " | |
| end |
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 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 |
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
| 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 |
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
| server: open tcp://localhost:4321 | |
| until [error? try [insert server ask "R> "]] | |
| close server |