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
times in msec | |
clock self+sourced self: sourced script | |
clock elapsed: other lines | |
000.015 000.015: --- VIM STARTING --- | |
000.132 000.117: Allocated generic buffers | |
000.599 000.467: locale set | |
000.606 000.007: window checked | |
001.068 000.462: inits 1 | |
001.076 000.008: parsing arguments |
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
Xerox | |
Groupon | |
Kleenex |
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
namespace :ckeditor do | |
desc 'Create nondigest versions of all ckeditor digest assets' | |
task :create_nondigest_assets do | |
fingerprint = /\-([0-9a-f]{32})\./ | |
for file in Dir['public/assets/ckeditor/**/*'] | |
next unless file =~ fingerprint | |
nondigest = file.sub(fingerprint, '.') | |
filename = nondigest.sub('public/assets/', '').sub(/.gz$/, '') |
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 InWords | |
def in_words | |
num_array = self.to_s.split('') | |
ones_place = {"0" => "", "1" => "one", "2" => "two", "3" => "three", "4" => "four", "5" => "five", "6" => "six", | |
"7" => "seven", "8" => "eight", "9" => "nine"} | |
final_digit_in_words = ones_place[num_array[-1]] | |
tens_place = {"0" => "", "1" => "", "2" => "twenty", "3" => "thirty", "4" => "forty", "5" => "fifty", "6" => "sixty", "7" => "seventy", "8" => "eighty", | |
"9" => "ninety"} |
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 Fixnum | |
def factorial | |
if self < 0 | |
raise "You can't take the factorial of a negative number." | |
elsif | |
self == 0 | |
1 | |
else | |
self * (self-1).factorial | |
end |
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 Integer | |
def fibonacci(arr=[0,1]) | |
arr[self] ||= (self-1).fibonacci(arr) + (self-2).fibonacci(arr) | |
# if arr[self].nil? | |
# arr[self] = (self-1).fibonacci(arr) + (self-2).fibonacci(arr) | |
# end | |
# arr[self] |
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 Integer | |
def fibonacci | |
first = 0 | |
last = 1 | |
(self-1).times do | |
current = first + last | |
first = last | |
last = current | |
end | |
return last |
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 InWords | |
def magic | |
ones_array = %w{ not_called one two three four five six seven eight nine ten} | |
tens_array = %w{ not_called not_called twenty thirty forty fifty sixty seventy eighty ninety} | |
teens_array = [ "" ] + %w{ one two three four five six seven eight nine ten eleven twelve | |
thirteen fourteen fifteen sixteen seventeen eighteen nineteen} | |
# if self == 0 | |
# return "zero" | |
# end |
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
def Calculator | |
def add(num1,num2) | |
@num1= num1 | |
@num2 = num2 | |
output("sum", num1 + num2) | |
end | |
def subtract(num1,num2) | |
@num1= num1 |
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 Dictionary | |
attr_accessor :this_dictionary | |
def initialize | |
this_dictionary = {} | |
@this_dictionary = this_dictionary | |
end | |
def entries |
OlderNewer