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
makeSearchCommand({ | |
name: "s21g-blog-search", | |
url: "http://blog.s21g.com/?query={QUERY}", | |
icon: "http://blog.s21g.com/favicon.ico", | |
description: | |
"Searches <a href=\"http://blog.s21g.com/\">s21g blog</a> for your words." | |
}); |
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
CmdUtils.CreateCommand({ | |
name: "formula", | |
takes: {"expression in LaTeX": noun_arb_text}, | |
homepage: "http://blog.s21g.com/genki", | |
author: {name: "Genki Takiuchi", homepage: "http://blog.s21g.com/genki"}, | |
license: "MPL", | |
preview: function( pblock, what ) { | |
var base = "https://secure.s21g.com/formula/formulae/preview_with_auth"; |
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
gem install merb | |
Building native extensions. This could take a while... | |
Successfully installed extlib-0.9.8 | |
Successfully installed json_pure-1.1.3 | |
Successfully installed rspec-1.1.11 | |
Successfully installed thor-0.9.8 | |
Successfully installed merb-core-1.0.1 | |
Successfully installed ZenTest-3.11.0 | |
Successfully installed RubyInline-3.8.1 | |
Successfully installed sexp_processor-3.0.0 |
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
module Merb | |
class Request | |
def message | |
return {} unless params[:_message] | |
begin | |
Marshal.load(params[:_message].unpack("m").first) | |
rescue ArgumentError, TypeError | |
{} | |
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
class Merb::Controller | |
class_inheritable_accessor :_before_render_filters | |
class_inheritable_accessor :_after_render_filters | |
self._before_render_filters = [] | |
self._after_render_filters = [] | |
def self.before_render(filter = nil, opts = {}, &block) | |
add_filter(self._before_render_filters, filter || block, opts) | |
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
>> class DataMapper::Property;include Extlib::Hook;before(:typecast){|v| @before_typecast=v};attr :before_typecast end | |
=> nil | |
>> a = User.new | |
=> #<User activated_at=nil activation_code=nil id=nil login=nil name=nil email=nil timezone=nil crypted_password=nil salt=nil> | |
>> a.id = "hello" | |
=> "hello" | |
>> a.id | |
=> nil | |
>> a.send(:properties)[:id] | |
=> #<Property:User:id> |
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 <ruby/ruby.h> | |
#define GetCoreDataFromValue(obj, type, ptr) do { \ | |
ptr = (type*)DATA_PTR(obj); \ | |
} while (0) | |
#define GetISeqPtr(obj, ptr) \ | |
GetCoreDataFromValue(obj, rb_iseq_t, ptr) | |
typedef struct rb_proc_struct rb_proc_t; |
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
module Merb | |
module Fixtures | |
class Hash | |
def code_to_create_record(model, hash) | |
resource = model.new(hash) | |
resource.send :hookable__create_nan_before_advised | |
resource | |
end | |
def code_to_create_child_record(parent_record, relation_name, hash) |
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
class LoggingMemcachedStore < Merb::Cache::MemcachedStore | |
include Extlib::Hook | |
before :read do |key, params| | |
if exists?(key, params) | |
Merb.logger.debug "Cache Hit: #{key}" | |
else | |
Merb.logger.debug "Cache Miss: #{key}" | |
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
def eager_cache(action, conditions = {}, params = request.params.dup, env = request.env.dup, &blk) | |
unless @_skip_cache | |
if action.is_a?(Array) | |
klass, action = *action | |
else | |
klass = self.class | |
end | |
run_later do |
OlderNewer