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
dictionary = File.read('dictionary.txt').split("\n") | |
five_letter_words = dictionary.select{|word| word.length == 5} | |
most_common_letters = five_letter_words.inject({}) do |result, word| | |
letters_array = word.chars | |
letters_counts = letters_array.tally | |
letters_counts.to_a.each_with_index do |(letter, count), index| | |
# next if letter == "s" && index == 4 |
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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
select | |
start_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver' | |
from | |
appointments | |
where | |
date(start_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver') = '2014-07-24'; |
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 MigrateTimeZones | |
attr_reader :old_zone, :new_zone | |
def initialize(old_zone = "Pacific Time (US & Canada)", new_zone = Company.current.time_zone) | |
@old_zone = ActiveSupport::TimeZone.new old_zone | |
@new_zone = ActiveSupport::TimeZone.new new_zone | |
end | |
def call | |
update_appointments | |
update_shifts |
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
" Define the wildignore from gitignore. Primarily for CommandT | |
let gitignore = '.gitignore' | |
if filereadable(gitignore) | |
let igstring = '' | |
for oline in readfile(gitignore) | |
let line = substitute(oline, '\s|\n|\r', '', "g") | |
if line =~ '^#' | con | endif | |
if line == '' | con | endif | |
if line =~ '^!' | con | endif | |
if line =~ '/$' | let igstring .= "," . line . "*" | con | endif |