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
# This goes in config/locales/en.rb (*not* en.yml) | |
{ | |
:en => { | |
:time => { | |
:formats => { | |
:full => lambda { |time, _| "%H:%M | %A, #{time.day.ordinalize} %B %Y" } | |
} | |
} | |
} | |
} |
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
import re | |
import random | |
def vtoc_idx(s): | |
match_obj = re.search(r'[aeiou][^aeiou]', s.lower()) | |
if match_obj: | |
return match_obj.start() + 1 | |
else: | |
return None |
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
@echo off | |
:: Path to Sublime Text installation dir. | |
SET stPath=%~dp0sublime_text.exe | |
SET stPathOnly=%~dp0 | |
:: Key name for the registry entries. | |
SET UserEntry=Sublime Text | |
SET AdminEntry=Sublime Text As Admin | |
:: Context menu texts. | |
SET "UserMenuText=Open with Sublime(&-)" | |
SET "AdminMenuText=Open with Sublime As Admin(&+)" |
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 'rspec/expectations' | |
RSpec::Matchers.define :match_stream do |expected_stream| | |
match do |actual_stream| | |
loop do | |
actual_element = actual_stream.next rescue :eof | |
expected_element = expected_stream.next rescue :eof | |
return false unless actual_element == expected_element | |
return true if actual_element == :eof | |
end |