Skip to content

Instantly share code, notes, and snippets.

Avatar
🔐
[redacted]

Matt Todd mtodd

🔐
[redacted]
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am mtodd on github.
  • I am mtodd (https://keybase.io/mtodd) on keybase.
  • I have a public key whose fingerprint is C5BB 8DA1 86D5 1E58 CFF0 DE41 CBAD C21E 22F3 20F3

To claim this, I am signing this object:

View Bug.md

[ ] a [ ] b

  • c
  • d

If user is careless, forgetting to put "- " before "[ ]", TODO list could get buggy.

Steps to reproduce bug:

  • on parsed MD page of list above, tick "c" to note that "c" is done.
  • Now, edit the file.
View nested-search-pdus.rb
[#<Net::LDAP::PDU:0x007fa610a7bf58
@app_tag=4,
@ldap_controls=[],
@message_id=3,
@search_entry=
#<Net::LDAP::Entry:0x007fa610a7be90
@myhash=
{:dn=>["uid=user1,ou=People,dc=rubyldap,dc=com"],
:uid=>["user1"],
:cn=>["user1"],
@mtodd
mtodd / App.java
Created Jul 31, 2008 — forked from anonymous/App.java
undefined
View App.java
import java.util.HashMap;
public class App {
private static int installWindowWidth = 500, installWindowHeight = 350;
private static int adminWindowWidth = 400, adminWindowHeight = 275;
private static String server = "168.28.247.195", port = "3306", database = "software";
private static String user = "root", password = "";
private static String axeServer = "https://168.28.245.221:6467";
private static String webServer = "http://168.28.247.195:3000";
View 2008-09-08
~$ traceroute google.com
traceroute: Warning: google.com has multiple addresses; using 64.233.187.99
traceroute to google.com (64.233.187.99), 64 hops max, 40 byte packets
1 192.168.1.1 (192.168.1.1) 2.136 ms 1.434 ms 1.426 ms
2 * * *
3 ge-2-5-ur01.c1morrow.ga.atlanta.comcast.net (68.86.108.121) 11.438 ms 12.103 ms *
4 te-9-2-ur01.a4atlanta.ga.atlanta.comcast.net (68.86.106.82) 11.168 ms 11.103 ms 9.297 ms
5 te-9-4-ur01.a5atlanta.ga.atlanta.comcast.net (68.86.106.25) 9.752 ms 12.648 ms 13.381 ms
6 te-9-4-ur01.a6atlanta.ga.atlanta.comcast.net (68.86.106.21) 10.468 ms 11.096 ms 9.582 ms
7 te-8-1-ar02.b0atlanta.ga.atlanta.comcast.net (68.86.90.122) 10.394 ms 11.899 ms 12.045 ms
View README.textile

The Problem


app = Rack::Builder.new do
  use Rack::CommonLogger
  use Rack::Reloader # this is the interesting part
  use Rack::ShowExceptions
  run HelloWorld.new
end
View subdomain_to_path_info.rb
class SubdomainToPathInfo # man I'm bad with names
def initialize(app)
@app = app
end
def call(env)
@app.call(filter(env))
end
View logger.rb
class Rack::Logger
def initialize(app, logger)
@app = app
@logger = logger
end
def call(env)
env["rack.logger"] = @logger
result = @app.call(env)
@logger.flush if @logger.respond_to?(:flush)
View limit_post_body_size.rb
class LimitPostBodySize
attr_accessor :app, :max_size
def initialize(app, max_size); @app, @max_size = app, max_size; end
def call(env)
if env['rack.input'].stat.size < @max_size
@app.call(env)
else
[413, {'Content-Type' => 'text/plain'}, 'Request Entity Too Large']
end
end