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
<?xml version="1.0" encoding="utf-8" standalone="no"?> | |
<application xmlns="http://ns.adobe.com/air/application/2.6"> | |
<!-- Adobe AIR Application Descriptor File Template. | |
Specifies parameters for identifying, installing, and launching AIR applications. | |
xmlns - The Adobe AIR namespace: http://ns.adobe.com/air/application/2.0 | |
The last segment of the namespace specifies the version | |
of the AIR runtime required for this application to run. |
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/bash | |
x=1 | |
while [ $x -le 100 ] | |
do | |
if [[ 0 -eq "($x%3) + ($x%5)" ]] | |
then | |
# Check if divide by 3 & 5 # | |
echo "fizz buzz" | |
elif [[ 0 -eq "($x%5)" ]] | |
then |
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
function autoUnput(thefield, orig){ | |
if(orig){ | |
if(thefield.value == ''){ | |
thefield.value = orig; | |
} | |
} else if (thefield.defaultValue==thefield.value){ | |
thefield.value = ""; | |
} | |
} |
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/local/bin/ruby | |
pattern = ARGV[0] | |
files = ARGV[1..-1] | |
unless pattern || files | |
puts "Usage: ./untarzip_grep.rb pattern tar-gz-file ... \n" | |
exit | |
else | |
files.each do |f| | |
system("tar -O -xzf #{f} | grep #{pattern}") |
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
def time_it(&block) | |
start_time = Time.now | |
if block_given? | |
yield | |
end_time = Time.now | |
elapsed = end_time - start_time | |
out = "Took " | |
out += "#{(elapsed/3600).to_i} (h) " if (elapsed/3600).to_i > 0 | |
out += "#{((elapsed/60) > 60 ? (elapsed/60) % 60 : (elapsed/60)).to_i} (m) " if (elapsed/60).to_i > 0 | |
out += "#{'%.4f' % (elapsed > 60 ? elapsed % 60 : elapsed)} (s)" if (elapsed) |
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 'curl-multi' | |
require 'mocks' | |
CURL_NEW = Curl::Multi.method(:new) unless defined? CURL_NEW | |
# | |
# Example: | |
# mock_curl_next_request { |req| | |
# req.add_chunk("<xml>junk</xml>") | |
# req.do_success |
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 'socket' | |
require 'mocks' | |
TCP_NEW = TCPSocket.method(:new) unless defined? TCP_NEW | |
# | |
# Example: | |
# mock_tcp_next_request("<xml>junk</xml>") | |
# | |
class FakeTCPSocket |
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/ruby | |
# Secret Santa Solver | |
=begin | |
ruby secret_santa.rb | |
Luke Skywalker <luke@theforce.net> | |
Leia Skywalker <leia@therebellion.org> | |
Toula Portokalos <toula@manhunter.org> | |
Gus Portokalos <gus@weareallfruit.net> | |
Bruce Wayne <bruce@imbatman.com> | |
Jill Wayne <jilly@imbatmanswoman.com> |
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
function defined(obj){ | |
return (typeof obj != 'undefined'); | |
} | |
// function defined(obj){ | |
// return (typeof obj != 'undefined' || obj != null); | |
// } | |
// function defined(obj){ | |
// try{ |
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 'curl-multi' | |
require 'spec/mocks' | |
=begin | |
# Example: | |
require 'spec/mock_io' | |
mock_next_io(lambda{["We Mocked!"]}, lambda{"another block"}) | |
io = IO.new | |
io.write("log") | |
io.flush |