C-h t
Tutorial
C-h m
Help for active mode
C-h k
Help for key sequence
C-h f
Help for function
C-h v
Help for variable
C-h a
Search help
C-h i
Info reader
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
require 'httparty' | |
class GitHub | |
include HTTParty | |
base_uri 'http://github.com/api/v2/yaml' | |
API_METHODS = { | |
:watched => '/repos/watched/' } | |
class << self |
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
# Get the official Emacs repo: | |
git clone http://repo.or.cz/r/emacs.git/ | |
# Get the fullscreen patch | |
git remote add typester git://github.com/typester/emacs.git | |
git fetch typester | |
# Create a patch and apply to HEAD | |
# I had merge conflicts when rebasing and | |
# build failures for origin/emacs-23 |
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
;;; Ruby/Rails development | |
;; RVM support | |
;; Ruby Version Manager | |
(require 'rvm) | |
(rvm-use-default) | |
;; automatically add 'end' after class, module, def etc. | |
;; automatically pair braces, single and double quotes | |
(require 'ruby-electric) |
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
(use '(incanter core charts io)) |
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
(ns step1) | |
(defn fact | |
[n] | |
(if (< n 2) 1 (* n (fact (dec n))))) | |
;; (fact 5) => 120 |
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
require 'date' | |
require 'rexml/document' | |
include REXML | |
doc = Document.new(File.new(ARGV[0])) | |
format = ARGV[1] || "apache" | |
formats = { | |
:apache => "RewriteRule ^%s$ /%s [R=301,L]", |
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 ruby | |
require 'json' | |
unless %w(status config).include?(ARGV[0]) | |
puts "Usage: #{File.basename($0)} status|config" | |
exit 1 | |
end | |
jj JSON.parse(`curl -s -H host:pow localhost/#{ARGV[0]}.json`) |
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
>> words = "foo bar baz qux foo bar lala" | |
#=> "foo bar baz qux foo bar lala" | |
>> # map (user-supplied) | |
.. mapped = words.split(/ /).map { |w| [w,1] } | |
#=> [["foo", 1], ["bar", 1], ["baz", 1], ["qux", 1], ["foo", 1], ["bar", 1], ["lala", 1]] | |
>> # aggregate (built-in) | |
.. aggregated = mapped.group_by { |w, c| w } | |
#=> {"foo"=>[["foo", 1], ["foo", 1]], "bar"=>[["bar", 1], ["bar", 1]], "baz"=>[["baz", 1]], "qux"=>[["qux", 1]], "lala"=>[["lala", 1]]} | |
>> # reduce (user-supplied) | |
>> aggregated.each_with_object({}) { |(k, v), h| h[k] = v.map(&:last).inject(:+) } |