Skip to content

Instantly share code, notes, and snippets.

# From http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
function is_git_svn {
git config --get svn-remote.svn.url > /dev/null
if [ $? == 0 ]; then
echo "(svn) "
require 'benchmark'
N = 1_000_000
a = []
100.times { a << (rand(10) > 5 ? true : false) }
Benchmark.bm(20) { |x|
x.report("String#to_i(base)") {
CmdUtils.CreateCommand({
name: "wowhead",
arguments: [{role: 'object', nountype: noun_arb_text, label: 'query'}],
icon: "http://www.wowhead.com/favicon.ico",
homepage: "http://www.wowhead.com",
author: { name: "Carlos Moll", email: "carlos@tallon.org"},
license: "MPL,GPL",
description: "Search Wowhead",
help: "Search for an item, quest, NPC, etc on Wowhead",
#!/usr/bin/perl -w
#
# Simple Flash Socket Policy Server
# http://www.lightsphere.com/dev/articles/flash_socket_policy.html
#
# Copyright (C) 2008 Jacqueline Kira Hamilton
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
[user]
name = Jason Roelofs
email = jameskilton@gmail.com
[color]
diff = auto
status = auto
branch = auto
[color "branch"]
current = yellow reverse
local = yellow
// leaks memory because a copy of the value of scene is returned and the pointer is never deleted
Image Scene::draw() const {
Image scene = *(new Image());
// build the scene
return *scene;
}
// doesn't leak memory, but is ugly
// Turn this:
$.post("/cameras/" + cameraId + "/wireless", {
"_method": "delete"
},
function(response) {
$.prompt(
"<h3>Disconnecting from Wireless</h3>" +
"<ul><li class=\"processing\">Sending Request to Camera</li></ul>", {
def some_method
4
end
some_method {|ret_val| puts ret_val} #=> 4
diff --git a/lib/gamebox/template_app/crate_boot.c b/lib/gamebox/template_app/crate_boot.c
index ebb0c76..0126574 100644
--- a/lib/gamebox/template_app/crate_boot.c
+++ b/lib/gamebox/template_app/crate_boot.c
@@ -173,6 +173,9 @@ int main( int argc, char** argv )
/* initialize all extensions */
Init_ext();
+ /* Force setup of amalgamite */
+ Init_amalgalite3();
>> "#1123:somethinghere" =~ /(#[\d.]+)(?:\(.+?\))?/
=> 0
>> $1
=> "#1123"