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
bucket = ENV['S3_BUCKET'] | |
access_key = ENV['S3_KEY'] | |
secret = ENV['S3_SECRET'] | |
key = "temp/" | |
content_type = "application/pdf" | |
expiration = 5.hours.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z') | |
max_filesize = 500.megabytes | |
acl = 'public-read' | |
policy = Base64.encode64( | |
"{'expiration': '#{expiration}', |
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 "VCPlugInHeaders.h" | |
// Interface includes: | |
#include "ISession.h" | |
#include "IApplication.h" | |
#include "IDialogMgr.h" | |
#include "IDialog.h" | |
#include "IDialogCreator.h" | |
#include "IK2ServiceProvider.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
# To show SQL Statements in the rails console | |
# copy this code to ~/.irbrc | |
# code found there http://frozenplague.net/2008/12/showing-sql-statements-in-scriptconsole/ | |
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
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
# Given a chinese character, fetch its ethymology through http://www.internationalscientific.org/ | |
# | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
require 'cgi' | |
def get_ethymology(chinese) | |
doc = Hpricot(open("http://www.internationalscientific.org/CharacterASP/CharacterEtymology.aspx?characterInput=#{ CGI.escape(chinese) }")) |
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
# Extracts the hexadecimal code from a string and converts it into the corresponding unicode character | |
# | |
# code found there -> http://www.nabble.com/Euro-currency-symbol-td22795833.html ( by David Wright ) | |
def convert(code) | |
return [code.gsub("U+", "").hex].pack("U") | |
end | |
puts convert("U+634F") # -> 捏 |
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
/* Scroll to the bottom of an element using Prototype and Scriptaculous | |
wokrs under Firefox and Safari (not tested under ie) | |
*/ | |
function scrollToBottom(element) | |
{ | |
var offset= window.innerHeight - $(element).getHeight() -10 ; | |
Effect.ScrollTo(element, {offset:-offset}) | |
} |
NewerOlder