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
<?php | |
$ankoder_access_key = "GET YOUR ACCESS KEY FROM SETTINGS"; | |
$private_key = "GET YOUR ACCESS KEY FROM SETTINGS"; | |
$ankoder_date = date("r"); | |
$ankoder_action = "GET"; | |
$ankoder_path = "/video.xml"; | |
$string = "-{$ankoder_date}-{$ankoder_action}-{$ankoder_path}-"; | |
$salt = substr(sha1($string),0, 20); |
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
/* | |
Sample Code for Ankoder API called via .NET C# | |
Written by William Yeung @ Gearbox Software (http://www.gearboxsoft.com) | |
*/ | |
const string PrivateKey = "YOUR_ANKODER_KEY"; | |
var ascii = Encoding.ASCII; | |
var date = DateTime.Now.ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss") + " GMT"; | |
var action_url = "video.xml"; | |
string token=string.Format("-{0}-GET-/{1}-", date, action_url); |
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 | |
require 'rubygems' | |
require 'roo' | |
pwd = File.dirname(__FILE__) | |
Dir.glob("#{pwd}/*.xls") do |file| | |
file_path = "#{pwd}/#{file}" | |
file_basename = File.basename(file, ".xls") | |
xls = Excel.new(file_path) |
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 | |
require 'rubygems' | |
require 'roo' | |
pwd = File.dirname(__FILE__) | |
file = ARGV[0] | |
file_path = "#{pwd}/#{file}" | |
xls = Excel.new(file_path) | |
xls.to_csv("#{pwd}/#{file}.csv") |
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
# I put this as spec/support/factory_girl_singleton.rb | |
# this get required from spec_helper.rb | |
# creates a class variable for factories that should be only created once | |
class Factory | |
@@singletons = {} | |
def self.singleton(factory_key) | |
begin | |
@@singletons[factory_key] = Factory.create factory_key | |
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique | |
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
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Sunburst.tmTheme", | |
"detect_indentation": false, | |
"ensure_newline_at_eof_on_save": true, | |
"font_face": "Menlo", | |
"font_size": 11.0, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], |
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
export BASH_COMMON_PATH=~/.bash_common | |
source $BASH_COMMON_PATH/bashrc | |
export PROMPT_COLOR=32 | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # rvm | |
# [ -f ~/.bundler-exec.sh ] && source ~/.bundler-exec.sh | |
alias gs="git status" | |
alias e="subl" |
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 User < ActiveRecord::Base | |
after_create :deadlock_on_first_try | |
def deadlock_on_first_try | |
raise ActiveRecord::StatementInvalid.new("Lock wait timeout exceeded") if @deadlocked.nil? | |
ensure | |
@deadlocked = true | |
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
# set_trace_func proc { |event,file,line,id,binding,classname| printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname } |
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
UIScreen.mainScreen | |
sessions | |
app = UIApplication.sharedApplication | |
delegate = app.delegate | |
repl(delegate) | |
quit | |