Skip to content

Instantly share code, notes, and snippets.

View bdotdub's full-sized avatar

Benny Wong bdotdub

View GitHub Profile
@bdotdub
bdotdub / README.md
Last active August 29, 2015 13:55
Map for Brokelyn's Beer Book 6
var $apps = $(".app");
var costTable = function(csv, year, month, appName, $app, type) {
console.log(csv, appName, $app, type);
var $dynos = $app.find("." + type + " tbody tr");
for (var j = 0; j < $dynos.length; j++) {
var $dyno = $($dynos.get(j));
var $fields = $dyno.find("td");
if ($fields.length != 4) {

Keybase proof

I hereby claim:

  • I am bdotdub on github.
  • I am bdotdub (https://keybase.io/bdotdub) on keybase.
  • I have a public key whose fingerprint is B18B F283 8D8D AD9C 1ADA 4E47 6831 9EB8 C97E 1325

To claim this, I am signing this object:

@bdotdub
bdotdub / futurable1.rb
Last active August 29, 2015 13:59
This don't make nooo sense. In theory, it should be almost semantically equivalent, `Futurable1` making only one more access to `Celluloid::Actor[:Futurable1]`. The `||=` is essentially checking for `nil` before assigning. Why it's such a big difference, I'd love to know.
require "benchmark"
require "celluloid"
class Futureable1
include Celluloid
class << self
def p
if Celluloid::Actor[:Futureable1].nil?
Celluloid::Actor[:Futureable1] = Futureable1.pool(size: 2)
#!/bin/bash
hash fswatch 2>/dev/null || brew install fswatch
function stopping() {
echo "Done"
exit 0
}
trap stopping SIGINT
-- A script to have Paparazzi! <http://www.derailer.org/paparazzi/> take a screentshot
-- and save it.
-- by Benny Wong
-- 2008/10/02
--
-- Shamelessly adapted from <http://bbs.macscripter.net/viewtopic.php?pid=82666>
--
-- Usage:
-- $ osascript screenshotous.scpt URL FILENAME
--
@bdotdub
bdotdub / soundmanager2.js
Created December 9, 2008 20:46
Matching 'swf' at the end of line to avoid detecting it in the base paths
497c497
< if (smURL.match(/.swf/)) {
---
> if (smURL.match(/.swf$/)) {
@@ -95,8 +95,8 @@
this._defaultFlashVersion = 8;
this.filePatterns = {
- flash8: /.mp3/i,
- flash9: /.mp3/i
+ flash8: /\.mp3(\?.*)?$/i,
+ flash9: /\.mp3(\?.*)?$/i
};
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>canPlayUrl Test</title>
<script src="soundmanager2.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
--- a/lib/sinatra.rb
+++ b/lib/sinatra.rb
@@ -1260,7 +1260,8 @@ module Sinatra
request.env['rack.errors'] << msg
request.env['sinatra.error'] = e
- context.status(500)
+ status = e.class.respond_to?(:code) ? e.class.code : 500
+ context.status(status)
raise if options.raise_errors && e.class != NotFound