This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://rubinius.lighthouseapp.com/projects/5089/tickets/729-kernel-and-includedmodule | |
module M | |
def m | |
end | |
end | |
module K | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://rubinius.lighthouseapp.com/projects/5089/tickets/614-calling-a-class-method-on-an-object-s-metaclass-should-invoke-the-class-method-of-the-object-s-class#ticket-614-5 | |
class Object | |
# The hidden singleton lurks behind everyone | |
def metaclass; class << self; self; end; end | |
def meta_eval(&blk) | |
metaclass.instance_eval(&blk) | |
end | |
# Adds methods to a metaclass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://github.com/rtomayko/rack-contrib/commit/f2169bd780c17b4bcc11aacf2d6c1eb6f35bdbee | |
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.8.7') | |
class Symbol | |
def to_proc | |
lambda{ |*args| args.shift.__send__(self, *args) } | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://datamapper.lighthouseapp.com/projects/20609-datamapper/tickets/746-patch-raise-argumenterror-if-limitoffset-was-set-in-query-in-collectiondestroy | |
# it's surprising that Collection#destroy! doesn't use LIMIT/OFFSET | |
require 'rubygems' | |
require 'dm-core' | |
class Pet | |
include DataMapper::Resource | |
property :id, Serial | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% header_guard do %> | |
#include <boost/pool/object_pool.hpp> | |
#include <boost/thread/mutex.hpp> | |
#include <boost/thread/thread.hpp> | |
#define LOKI_CLASS_LEVEL_THREADING | |
#include <loki/Singleton.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
template <class T> | |
class None: public T{ | |
public: | |
static None<T>* none(){ | |
static None<T> _; | |
return &_; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
3 | |
345 | |
34567 | |
345 | |
3 | |
-} | |
module Main where | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts($stdin.read.split(/=/).reject{|a|a=="\n"}.map{|a|a=~/^[0-9A-Z]{2}/?[a[0..1],a[2..-1]]:a}.flatten.reject(&:empty?).map{|a|a=~/^[0-9A-Z]{2}$/?a.to_i(16):a.unpack('c*')}.flatten.pack('c*')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-TW"> | |
<head profile="http://www.w3.org/2005/10/profile"> | |
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/> | |
<title>test jquery submit event hook</title> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"/> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('#s1').click(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// author: | |
// http://joshkos.blogspot.com/2009/06/blog-post_13.html | |
#ifndef GETSET_HPP | |
#define GETSET_HPP | |
template<typename T, typename C, T C::* P> | |
struct Selector { // used for selecting which field to access | |
static T C::* const MP; | |
typedef T Type; |
OlderNewer