Skip to content

Instantly share code, notes, and snippets.

View nossidge's full-sized avatar

Paul Thompson nossidge

View GitHub Profile
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
@jcppkkk
jcppkkk / OpenWithSublime.bat
Last active June 25, 2023 22:07 — forked from FoxColdMetal/OpenWithSublimeText.bat
[[[ Move to https://github.com/jcppkkk/OpenWithSublime !!! ]]] Add context menu to allow user open file or folder with Sublime as User (or as Admin).
@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(&+)"
@aparrish
aparrish / portnameteau.py
Created April 18, 2013 22:31
simple algorithm for mashing together two english words
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
@mudge
mudge / en.rb
Last active September 5, 2023 09:32
Using date ordinals in Rails through an I18n time format.
# This goes in config/locales/en.rb (*not* en.yml)
{
:en => {
:time => {
:formats => {
:full => lambda { |time, _| "%H:%M | %A, #{time.day.ordinalize} %B %Y" }
}
}
}
}