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
# workaround for https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6634-railsrack-inconsistency-about-expires_afterexpires-cookie-option#ticket-6634-3 | |
# expiration issue | |
# drop into RAILS_ROOT/config/initializers/expires_fix_2311.rb | |
# | |
require 'rack' | |
Rack::Utils.class_eval do | |
class << self | |
def set_cookie_with_expire!(header, key, value) | |
if value[:expires].blank? && value[:expire_after] |
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 Kernel | |
alias require_orig_bench require | |
def require(*args) | |
from = Time.now.to_f | |
$__deep ||= 0; $__deep += 1 | |
require_orig_bench(*args) | |
$stderr.puts %Q[ #{" " * ($__deep - 1) } #{(Time.now.to_f - from)} in #{args.inspect} ] | |
$__deep -= 1 |
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 Fixnum | |
def upto2(n) | |
(self..n).to_a.map{|k| yield k } | |
end | |
end | |
class A | |
def sum(n) | |
sum = 0 | |
1.upto(n) do |i| |
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
bills = [ | |
{:name=>"bill[attachment]", | |
:filename=>"/data/data/com.rhomobile.imageupload/rhodata/apps/rhoconfig.txt"}, | |
{:name=>"bill[amount]", | |
:body=>nil}] | |
Rho::AsyncHttp.upload_file( | |
:url => 'http://localhost:3000/bills.json', | |
:callback => url_for(:action => :push_callback), | |
:multipart => bills) |
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
# looks like Content-type is set to application/octet-stream for nil values | |
# | |
User-Agent: Mozilla-5.0 (ANDROID; generic; 2.2) | |
I/APP ( 3006): Content-Length: 3531 | |
I/APP ( 3006): Content-Type: multipart/form-data; boundary=----------------------------44729c969b01 | |
I/APP ( 3006): | |
I/APP ( 3006): I 12/04/2010 20:55:34:609 0066c790 Net| => Send data (818 bytes): ------------------------------44729c969b01 | |
I/APP ( 3006): Content-Disposition: form-data; name="bill[amount]" | |
I/APP ( 3006): Content-Type: application/octet-stream | |
I/APP ( 3006): Content-Length: 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
From 6737da2323d9896fe30de66394a659de2b41e9b1 Mon Sep 17 00:00:00 2001 | |
From: gmarik <gmarik@gmail.com> | |
Date: Tue, 16 Nov 2010 22:05:27 -0600 | |
Subject: [PATCH] Do not set Content-Type header when body defined | |
--- | |
platform/shared/net/AsyncHttp.cpp | 1 - | |
1 files changed, 0 insertions(+), 1 deletions(-) | |
diff --git a/platform/shared/net/AsyncHttp.cpp b/platform/shared/net/AsyncHttp.cpp |
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
# Return the directories where we need to load configuration files | |
def process_model_dirs(app_manifest_filename=nil) | |
File.open(app_manifest_filename).each do |line| | |
str = line.chomp | |
if str != nil and str.length > 0 | |
#puts "model file: #{str}" | |
modelName = File.basename(File.dirname(str)) | |
Rhom::RhomObjectFactory.init_object(modelName) | |
require str |
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
$ ARCHFLAGS="-arch i386 -arch x86_64" gem install -V mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
GET http://cdscm/latest_specs.4.8.gz | |
200 OK | |
GET http://rubygems.org/latest_specs.4.8.gz | |
302 Moved Temporarily | |
GET http://production.s3.rubygems.org/latest_specs.4.8.gz | |
200 OK | |
GET http://gemcutter.org/latest_specs.4.8.gz | |
302 Moved Temporarily | |
GET http://production.s3.rubygems.org/latest_specs.4.8.gz |
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
#!/usr/bin/env ruby | |
# | |
# http://gmarik.info/blog/2010/10/16/scraping-asp-net-site-with-mechanize | |
require 'rubygems' | |
require 'mechanize' | |
require 'logger' | |
user = 'user' | |
pass = 'pass' |
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
#!/bin/sh | |
which rvm >/dev/null 2>&1 || (echo 'requires RVM' && exit 1) | |
RUBY=$(rvm list default string) | |
function install() | |
{ | |
echo " | |
Plan: |