Skip to content

Instantly share code, notes, and snippets.

def some_method
4
end
some_method {|ret_val| puts ret_val} #=> 4
// 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>", {
// 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
[user]
name = Jason Roelofs
email = jameskilton@gmail.com
[color]
diff = auto
status = auto
branch = auto
[color "branch"]
current = yellow reverse
local = yellow
#!/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
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",
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)") {
# 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) "
function is_git_svn {
git config --get svn-remote.svn.url > /dev/null
if [ $? == 0 ]; then
echo "(svn) "
else
echo ""
fi
}
roelofs@trillian [method_properties]~/projects/rice $ make
Making all in rice
make[1]: Entering directory `/home/roelofs/projects/rice/rice'
make all-am
make[2]: Entering directory `/home/roelofs/projects/rice/rice'
g++ -DHAVE_CONFIG_H -I. -I/usr/lib/ruby/1.8/i686-linux -O2 -march=prescott -pipe -fno-strict-aliasing -fPIC -fPIC -I/usr/lib/ruby/1.8/i686-linux -MT Class.o -MD -MP -MF .deps/Class.Tpo -c -o Class.o Class.cpp
Module_impl.ipp: In member function 'Derived_T& Rice::Module_impl<Base_T, Derived_T>::define_method(Rice::Identifier, Func_T, const Rice::Method_Property&)':
Module_impl.ipp:147: error: there are no arguments to 'default_method_property' that depend on a template parameter, so a declaration of 'default_method_property' must be available
Module_impl.ipp:147: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Module_impl.ipp: In member function 'Derived_T& Rice::Module_impl<Base_T, Derived_T>::public_visibility()