Skip to content

Instantly share code, notes, and snippets.

@toomuchpete
toomuchpete / refund_log.txt
Created April 25, 2020 02:58
AFDC Spring COVID Refunds
irb(main):003:0> cobb_spring.registrations.each {|r| r.refund!}
[Braintree] [24/Apr/2020 05:57:44 UTC] POST /transactions/5btqqekd/refund 201
[Braintree] [24/Apr/2020 05:57:44 UTC] POST /transactions/bwmfkxc0/refund 201
[Braintree] [24/Apr/2020 05:57:48 UTC] POST /transactions/3tyhd22a/refund 201
[Braintree] [24/Apr/2020 05:57:53 UTC] POST /transactions/qhmvq798/refund 201
[Braintree] [24/Apr/2020 05:57:56 UTC] POST /transactions/kcevamhf/refund 201
[Braintree] [24/Apr/2020 05:57:59 UTC] POST /transactions/652c1rca/refund 201
[Braintree] [24/Apr/2020 05:58:04 UTC] POST /transactions/g03qe6cx/refund 201
[Braintree] [24/Apr/2020 05:58:04 UTC] POST /transactions/fbmsbrja/refund 201
[Braintree] [24/Apr/2020 05:58:09 UTC] POST /transactions/aphbt3rn/refund 201
class Whatever
# Some stuff here
def [](key)
return nil unless self.respond_to?(key)
self.public_send(key)
end
end
@toomuchpete
toomuchpete / bug.py
Created August 3, 2017 20:10
Is this a bug?
if False:
print 'Goodbye'
print 'hello'
@toomuchpete
toomuchpete / get_pages.php
Created February 6, 2017 16:55
Windows Page Number Expansion
<?php
$pages = '3,5,8-12,15,16,20-22';
#remove all whitespace
#validate format
$page_list = explode(',', $pages);
$page_expander = function($element) {
$pages = explode('-', $element);

Keybase proof

I hereby claim:

  • I am toomuchpete on github.
  • I am peteholiday (https://keybase.io/peteholiday) on keybase.
  • I have a public key whose fingerprint is 24F9 122C C902 6CAC 5B37 1962 89D6 A42A 9E38 372A

To claim this, I am signing this object:

@toomuchpete
toomuchpete / load_modules.php
Last active August 29, 2015 14:25
Module Autoloader
<?php
function loadThingsMagically($folder_path) {
// Cache pre-existing
$preExistingClasses = count(get_declared_classes());
requireAllFromFolder($folder_path);
foreach (array_slice(get_declared_classes(), $preExistingClasses) as $class) {
if (method_exists($class, 'loadCoolModule')) {
$class::loadCoolModule();
@toomuchpete
toomuchpete / food.md
Last active August 29, 2015 14:19
RailsConf 2015 Food Recommendations
@toomuchpete
toomuchpete / Vagrantfile
Created November 24, 2014 17:42
AFDC Leagues Site
Vagrant.configure("2") do |config|
config.vm.box = "afdc-vm"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.102"
config.hostsupdater.aliases = %w(www.afdc.local leagues.afdc.local)
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
@toomuchpete
toomuchpete / header_timer.py
Last active August 29, 2015 14:03
Time header responses from http/https requests
import socket, ssl, sys, time
from pprint import pprint as pp
from urlparse import urlparse
if len(sys.argv) != 2:
print "ERROR: You must supply a url to profile."
sys.exit(-2)
url = sys.argv[1]