Skip to content

Instantly share code, notes, and snippets.

View julik's full-sized avatar
💭
🎺

Julik Tarkhanov julik

💭
🎺
View GitHub Profile
exceptions = []
tree = {}
ObjectSpace.each_object(Class) do |cls|
next unless cls.ancestors.include? Exception
next if exceptions.include? cls
next if cls.superclass == SystemCallError # avoid dumping Errno's
exceptions << cls
cls.ancestors.delete_if {|e| [Object, Kernel].include? e }.reverse.inject(tree) {|memo,cls| memo[cls] ||= {}}
end
odd
From 2c9be0a2e7d52ba35b3d1f67766d637eb28aade2 Mon Sep 17 00:00:00 2001
From: julik <julik@65967661-7906-0410-b21e-e24373c15fab>
Date: Fri, 19 Dec 2008 03:08:58 +0000
Subject: [PATCH] Add Rubyforge version
---
Rakefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Rakefile b/Rakefile
# PostalTimecode is a Timecode extension which supports soft_parse in new()
class PostalTimecode < Timecode
FH = ActionView::Helpers
TC_LENGTH = Timecode.new(0).to_s.length # by example
# Guarantee that PostalTimecode.new happens via soft_parse
def self.new(from, fps = Timecode::DEFAULT_FPS)
from.is_a?(String) ? soft_parse(from, fps) : super(from, fps)
end
(function(){
var methods = {
labelActsAsHint: function(element){
element = $(element);
element._default = element.value;
return element.observe('focus', function(){
if(element._default != element.value) return;
element.removeClassName('hint').value = '';
}).observe('blur', function(){
require 'rubygems'
require 'depix'
sources, renders = %w( in/*.DPX out/*.DPX ).map{|e| Dir.glob(e) }
sources.zip(renders).each do | (source, render) |
# Read the source TC and the target headers
from_dpx = Depix.from_file(source)
to_dpx = Depix::Editor.new(render)
# Copy the TC and the reel name over
# Stream wrapper that read's IOs in succession. Can be fed to Net::HTTP. We use it to send a mixture of StringIOs
# and File handles to Net::HTTP which will be used when sending the request, not when composing it. Will skip over
# depleted IOs. Can be also used to roll across files like so:
#
# tape = TapeIO.new(File.open(__FILE__), File.open('/etc/passwd'))
class TapeIO
attr_accessor :substreams
attr_accessor :release_after_use
def initialize(*any_ios)
module NestedParams
NESTED_PARAM_PREFIX = /^__nested_/i
module ControllerClassMethods
def expand_nested_params
before_filter :handle_params #{ |c| c.expand_nested_params(c.params) }
end
end
module ControllerInstanceMethods
class VideoUpload
def self.new(*posargs_or_options)
if posargs_or_options.length > 1 # use old-style positional args
YouTubeG.logger.error "Positional arguments for VideoUpload.new are deprecated"
new(translate_posargs(posargs_or_options)
else
super(any_args.first || {}) # use the kwargs, super is just vanilla constructor
end
end
Symptoms may include:
1. Knowing that you will have to write a router for the 10th time just because someone said YAGNI
(and knowing that having said "router" you would likely want it _both_ ways, yes I mean it thank you)
2. When talking about yourself as a developer you say
things like "I escape my URLs and preferably auto, and yes this includes the router"
3. You know you just don't need to rememder to have a form tag without do..end. because you use markaby anyway.
And you want your URL escaped
4. It doesn't feel right unless you have snatched escape_and_sanitize_ugly_html_gunk from bigframework and
of course you find out that it requires bigframework-*.gem, and the backing class for escape_and_sanitize