Skip to content

Instantly share code, notes, and snippets.

View slyphon's full-sized avatar

Jonathan Simms slyphon

View GitHub Profile
@slyphon
slyphon / gist:5096404
Created March 6, 2013 03:11
Oh ho ho, you think you're SOOOOOO clever, don't you?
scala> '0'.intValue
<console>:9: error: type mismatch;
found : Char(\'0\')
required: ?{val intValue: ?}
Note that implicit conversions are not applicable because they are ambiguous:
both method charWrapper in class LowPriorityImplicits of type (c: Char)scala.runtime.RichChar
and method int2Integer in object Predef of type (x: Int)java.lang.Integer
are possible conversion functions from Char(\'0\') to ?{val intValue: ?}
'0'.intValue
^
@slyphon
slyphon / when.ccies.get.bored.txt
Created February 9, 2013 19:38
when.ccies.get.bored by.ryan.werber
[20130209-19:32:31]-❯ traceroute 216.81.59.173
traceroute to 216.81.59.173 (216.81.59.173), 64 hops max, 52 byte packets
1 192.168.1.1 (192.168.1.1) 3.703 ms 0.696 ms 0.631 ms
2 l100.nycmny-vfttp-122.verizon-gni.net (71.183.222.1) 29.121 ms 103.986 ms 10.173 ms
3 g1-5-5-3.nycmny-lcr-22.verizon-gni.net (130.81.190.226) 12.131 ms * 11.420 ms
4 ae0-0.ny5030-bb-rtr1.verizon-gni.net (130.81.209.118) 15.120 ms 78.844 ms 16.973 ms
5 0.xe-6-1-1.xt1.nyc4.alter.net (152.63.10.57) 9.710 ms 9.994 ms 9.736 ms
6 tengige0-6-1-0.gw8.nyc4.alter.net (152.63.21.113) 13.297 ms
tengige0-6-4-0.gw8.nyc4.alter.net (152.63.21.121) 12.726 ms 12.255 ms
7 tinet-gw.customer.alter.net (152.179.72.122) 127.419 ms 104.796 ms 106.872 ms
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@slyphon
slyphon / Louis-ck-email.md
Created November 4, 2012 10:52 — forked from sippey/Louis-ck-email.md
Louis CK email

Hello. Its louis here. I'm clacking this to you on my phone in my dressing room here at studio 8H, right in 30 rockefeller center, in Manhattan, new york city, new york, america, world, current snapshot of all existence everywhere.

Tonight I'm hosting Saturday Night Live, something I zero ever in my life saw happening to me. And yet here it is completely most probably happening (I mean, ANYTHING could NOT happen. So we'll see).

I've been working here all week with the cast, crew, producers and writers of SNL, and with Lorne Michaels. Such a great and talented group of people.

And here we are in the middle of New York City, which was just slammed by a hurricane, leaving behind so much trouble, so much difficulty and trauma, which everyone here is still dealing with every day.

Last night we shot some pre-tape segments in greenwich Village, which was pitch black dark for blocks and blocks, as it has been for a week now.

@slyphon
slyphon / h2WithQuerulous.scala
Created October 27, 2012 00:32
some nasty hackery to get querulous working w/ h2database
package com.slyphon.example
import com.twitter.querulous.query.SqlQueryFactory
import com.twitter.querulous.database.{DatabaseFactory, Database}
import java.sql.{SQLException, Connection}
import com.twitter.conversions.time._
import com.twitter.util.Duration
import org.apache.commons.dbcp.DriverManagerConnectionFactory
import com.twitter.querulous.evaluator.StandardQueryEvaluator
@slyphon
slyphon / gist:3708808
Created September 12, 2012 18:19 — forked from anonymous/gist:1406238
yammer scala email
Originally:
https://gist.github.com/7565976a89d5da1511ce
Hi Donald (and Martin),
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I
appreciate the tone. This is a Yegge-long response, but given that you and
Martin are the two people best-situated to do anything about this, I'd rather
err on the side of giving you too much to think about. I realize I'm being very
critical of something in which you've invested a great deal (both financially
@slyphon
slyphon / dicepass.rb
Created August 17, 2012 01:30
a ruby implementation of the passphrase generation algo described here: http://is.gd/Yho3KI
#!/usr/bin/env ruby
require 'pp'
require 'optparse'
class DicewarePassphrase
BANNER = <<-STR
Usage: #{File.basename($0)} [opts]
Generate a random but memorable passphrase using the Diceware Passphrase Algorithm
require 'thread'
# This seems to crash 1.8.7
10.times { Thread.new { Queue.new.pop } }
Process.waitpid fork { GC.start; puts "In child: #{$$}" }
class Module
# Use this to replace a method in an alias_method_chain
def inject_alias_method_chain(target, method_to_replace, method_to_use)
method_instance_to_replace = instance_method(method_to_replace)
meths = (private_instance_methods | instance_methods).sort.grep(/^#{target}/)
found = meths.detect do |m|
m != method_to_replace.to_s && instance_method(m) == method_instance_to_replace
end
if found
alias_method found, method_to_use
#
# Ideas stolen from lograge and brought to Rails 2.3
# https://github.com/mattmatt/lograge/blob/master/lib/lograge/log_subscriber.rb
#
module ImprovedControllerLogging
def self.included(base)
base.alias_method_chain :log_processing, :fixup
base.inject_alias_method_chain :perform_action,
:perform_action_with_benchmark,