command | description |
---|---|
ctrl+a | Move cursor to the start of the line |
ctrl+e | Move cursor to the end of the line |
ctrl+b | Move cursor back one character |
ctrl+f | Move cursor forward one character |
This file contains 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
require 'rubygems' | |
require 'matrix' | |
require 'lingua/stemmer' | |
require 'csv' | |
require 'erb' | |
require 'iconv' | |
require 'sanitize' | |
require './cleaner.rb' | |
STEMMER = Lingua::Stemmer.new |
This file contains 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 USCode | |
SEARCH_ENDPOINT = "http://uscode.house.gov/uscode-cgi/fastweb.exe?search" | |
@@search_params = { | |
:view => "uscview", | |
:db2 => "t01t04" , | |
:db3 => "t05t08" , | |
:db4 => "t09t12" , | |
:db5 => "t13t16" , | |
:db6 => "t17t20" , | |
:db7 => "t21t25" , |
This file contains 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 ruby | |
input = STDIN.read | |
input.gsub!(/^\=+\n ?(.*?)\n\=+/,"# \\1") | |
input.gsub!(/^-+\n\d+ (.*?)\n-+/,"## \\1") | |
input.gsub!(/^\d+\.\d+ (.*)/,"### \\1") | |
input.gsub!(/^\d+\.\d+\./,"@") | |
input.gsub!(/^@\d+ /,"- ") | |
input.gsub!(/^@\d+\.\d+ /,"\t- ") |
This file contains 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 php | |
<?php | |
$str = `pbpaste`; | |
$find = array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"); | |
$replace = array("'", "'", '"', '"', '-', '--', '...'); | |
echo str_replace($find, $replace, $str); |
This file contains 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 php | |
<?php | |
$str = `pbpaste`; | |
$str = preg_replace('/(^|[-\xe2\x80\x94\/(\[{"\s])\'/', "$1\xe2\x80\x98", $str); | |
$str = preg_replace('/\'/', "\xe2\x80\x99", $str); | |
$str = preg_replace('/(^|[-\xe2\x80\x94\/(\[{\xe2\x80\x98\s])"/', "$1\xe2\x80\x9c", $str); | |
$str = preg_replace('/"/', "\xe2\x80\x9d", $str); | |
$str = preg_replace('/--/', "\xe2\x80\x94", $str); | |
$str = preg_replace('/\.\.\./', "\xe2\x80\xa6", $str); | |
echo $str; |
NewerOlder