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
//Touch Event | |
public boolean onTouchEvent(MotionEvent event) { | |
if (event != null) { | |
if (event.getAction() == MotionEvent.ACTION_DOWN) { | |
Log.d(TAG, "Touch Event"); | |
return true; | |
} | |
} | |
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
//Callback Tast | |
class CallbackTask implements Runnable { | |
private final Runnable task; | |
private final Callback callback; | |
CallbackTask(Runnable task, Callback callback) { | |
this.task = task; |
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
//Added alpha to the red circle in circle template | |
re.e('circle align update') | |
.attr({ | |
alpha: 0.3, | |
radius:10, | |
speed:15, | |
color:'#ff0000' | |
}) |
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
post '/' do | |
session = login(params[:username], params[:password]) | |
get_courses(session, params[:username]) | |
erb :index | |
end | |
def login(username, password) | |
#login = Savon::Client.new($LOGIN_WSDL) | |
#login.http.auth.ssl.verify_mode = :none |
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
require 'axlsx' | |
p = Axlsx::Package.new | |
wb = p.workbook | |
wb.styles do |s| | |
head = s.add_style :bg_color => "00", :fg_color => "FF" | |
wb.add_worksheet(:name => "Bug Example") do |sheet| | |
sheet.add_row ['This row should not be styled','but it is'] | |
sheet.add_row ['The bug drops the trailing 0', 'so 10 -> 1'] | |
sheet.add_row ['I havent tested to 100 rows', 'so not sure there'] | |
sheet.add_row ['Row', '4'] |
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
now = new Date(); | |
alert now | |
alert now.toUTCString() | |
alert now.toJSON() |
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
ssh_my_server.rb | |
require 'open-uri' | |
#not real names | |
Server = "MyServer" | |
bootstrap_data_json = open('http://my_iris.iriscouch.com/bootie/' + Server){|f| f.read} | |
bootstrap_data_raw = JSON.parse(bootstrap_data_json) | |
srv_name = bootstrap_data_raw["_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
require 'json' | |
#Get Instance IP Address | |
my_ip = `curl -s http://instance-data/latest/meta-data/public-ipv4` | |
#not real names | |
my_server_name = "MyServer" | |
bootstrap_db = "http://my_iris.iriscouch.com/bootie" | |
#url for the record data | |
record_loc = bootstrap_db + "/" + my_server_name |
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 :old_req :require | |
def require(*args) | |
puts "Require called with: #{args}" | |
old_req *args | |
end | |
end | |
require 'pp' |
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
#This captures the Array#sort method and stores it in m | |
m = Array.instance_method(:sort) | |
#Shows that sort still works | |
[3,2,1].sort | |
#=> [1,2,3] | |
#Here we override the array sort method | |
#Array#sort no longer works | |
[3,2,1].class.send(:define_method, :sort){nil} |