Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jlao
jlao / profile.ps1
Created August 29, 2012 07:09
My PowerShell profile customizations
function prompt
{
$loc = Get-Location
$parts = $loc.Path.split("\")
$shortparts = @($parts[0])
if ($parts.length -gt 2)
{
$shortparts += $parts[1..($parts.length - 2)] | % { $_[0] }
}
@jlao
jlao / MapPerf.scala
Created October 18, 2010 03:27
A simple performance test comparing the performance of java.util.HashMap, scala.collection.immutable.HashMap, scala.collection.mutable.HashMap.
import java.util.HashMap
object MapPerf {
def main(args: Array[String]) {
if ( args.length < 2 ) {
println("Usage: scala MapPerf <number of elements to insert> <num trials>")
return
}
@jlao
jlao / t-pain.c
Created September 13, 2010 05:54
#test return -18
//many tests catch special behaviour around tmin and tmax. this one tests for tpain.
int main()
{
int b; int o; int a; int t; int _____;
b = 1;
o = 2;
a = 4;
abstract class Status {
import java.util.Date
val id: Long
val text: String
val createdAt: Date
val user: User
val inReplyToStatusID: Option[Int]
val inReplyToUserID: Option[Int]
function p75_jw_player_handler( $matches, $attr, $url, $rawattr )
{
static $counter = 1;
if ( !empty($rawattr['width']) && !empty($rawattr['height']) ) {
$width = (int) $rawattr['width'];
$height = (int) $rawattr['height'];
} else {
list( $width, $height ) = wp_expand_dimensions(
get_option('p75_default_player_width'),