View pplog_to_twitter.js
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
javascript:(function(){window.open('http://twitter.com/' + window.location.href.match(/[a-zA-Z_0-9|-]+$/))})(); |
View ohai.rb
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 'ohai' | |
require 'pp' | |
pp ohai = Ohai::System.new | |
pp ohai.all_plugins | |
pp ohai.seen_plugins | |
pp kernel = ohai.kernel | |
pp kernel.keys | |
pp kernel[:name] | |
pp kernel[:release] |
View excel_edit.rb
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 'spreadsheet' | |
book = Spreadsheet::Workbook.new | |
sheet = book.create_worksheet | |
sheet[0,0] = 'test.' | |
book.write('example.xls') |
View haskel_and_yesod.hs
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
{-# LANGUAGE TypeFamilies, QuasiQuotes, MultiParamTypeClasses, | |
TemplateHaskell, OverloadedStrings #-} | |
import Yesod | |
data Links = Links | |
mkYesod "Links" [parseRoutes| | |
/ HomeR GET | |
/page1R Page1R GET | |
/page2R Page2R GET |
View fizzbuzz.hs
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
toStr :: Int -> String | |
toStr x = if x `mod` 15 == 0 then "FizzBuzz" | |
else if x `mod` 3 == 0 then "Fizz" | |
else if x `mod` 5 == 0 then "Buzz" | |
else show x | |
fizzbuzz :: Int -> [String] | |
fizzbuzz n = map toStr[1 .. n] | |
main = do | |
print (fizzbuzz 15) |
View div_spec.rb
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 'spec_helper' | |
describe "always divisible by 9" do | |
(1..100).each do |x| | |
first = x.to_s[0] | |
last = x.to_s[1] | |
next if first == last | |
next if first.nil? or last.nil? | |
swap_x = (last + first).to_i | |
new_x = (x - swap_x).abs |
View Guardfile
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
# Ignore Vim swap files | |
ignore /~$/ | |
ignore /^(?:.*[\\\/])?\.[^\\\/]+\.sw[p-z]$/ | |
group :unit do | |
guard 'minitest', test_folders: 'test/unit', test_file_patterns: '*_test.rb' do | |
watch(%r'^lib/blah/(.+)\.rb$') {|m| "test/unit/#{m[1]}_test.rb"} | |
watch(%r'^test/unit/.+_test\.rb$') |
View module.rb
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
module Greeting | |
def self.hello name | |
@name = name | |
"Hello #{name}" | |
end | |
def self.name | |
@name | |
end | |
end | |
puts Greeting.hello('John') #=> Hello John |
View preceed.cfg
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
#=============================================== | |
# BOOT SEQUENCE CONFIGURATIONS START | |
#=============================================== | |
d-i debian-installer/language string en | |
d-i debian-installer/country string US | |
d-i debian-installer/locale string en_US.UTF-8 | |
d-i console-setup/ask_detect boolean false | |
d-i console-setup/layoutcode string us | |
d-i console-setup/charmap select UTF-8 |
View practice.hs
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
madam = "Madam, I'm Adam." | |
remove chr str = [c | c <- str, c /= chr] | |
removeCommas str = remove ',' str | |
removeBlanks str = remove ' ' str | |
removePeriods str = remove '.' str | |
{-- | |
removeCommas str = [c | c <- str, c /= ','] | |
removeBlanks str = [c | c <- str, c /= ' '] | |
removePeriods str = [c | c <- str, c /= '.'] |
OlderNewer