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
// Scanner that will read the integer | |
final Scanner in = new Scanner(System.in); | |
int inputInt; | |
do { // Loop until we have correct input | |
System.out.print("Specify an integer between 0 and 5: "); | |
try { | |
inputInt = in.nextInt(); // Blocks for user input | |
if (inputInt >= 0 && inputInt <= 5) { | |
break; // Got valid input, stop looping | |
} else { |
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
==> Downloading https://github.com/b4winckler/macvim/tarball/snapshot-63 | |
File already downloaded in /Users/Tomek/Library/Caches/Homebrew | |
/usr/bin/tar xf /Users/Tomek/Library/Caches/Homebrew/macvim-7.3-63.tgz | |
==> ./configure --with-features=huge --with-tlib=ncurses --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enable-tclinterp | |
./configure --with-features=huge --with-tlib=ncurses --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enable-tclinterp | |
checking whether make sets $(MAKE)... yes | |
checking for gcc... gcc | |
checking for C compiler default output file name... a.out | |
checking whether the C compiler works... yes | |
checking whether we are cross compiling... no |
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
$ ruby -v | |
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0] | |
$ rails -v | |
Rails 3.1.3 | |
$ rails new test_app | |
create | |
create README | |
create Rakefile | |
create config.ru | |
create .gitignore |
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
# it "converts message to upcased, alpha, 5 character groups with pads" do | |
# pad_message = "Code in Ruby, live long!" | |
# conversion = encrypter.convert_to_padded_alpha(pad_message) | |
# conversion.should == "CODEI NRUBY LIVEL ONGXX" | |
# end | |
def convert_to_padded_alpha(message) | |
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
def subtract(secret_num, keystream_num) | |
secret_num.zip(keystream_num).map do |secret, keystream| | |
secret = secret + 26 if keystream >= secret | |
secret - keystream | |
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
EM.run do | |
# Create both an evented and non evented redis handle | |
@evented_redis = EM::Protocols::Redis.connect | |
@non_evented_redis = Redis.new | |
# Setup lambda in order to properly rerun code using EventMachine's next_tick method | |
(popper = lambda do | |
@evented_redis.blpop("blpop:queue", 0) do |msg| | |
url = msg.last |
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' # if you use RubyGems | |
require 'daemons' | |
task1 = Daemons.call(:multiple => true) do | |
loop { | |
File.open("/tmp/daemon_test.log", "w") {|f| f.write(Time.now.to_s + "\n")} | |
sleep 5 | |
} | |
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
function getFrontPage() { | |
var req = new XMLHttpRequest(); | |
console.log("about to attempt a get!"); | |
req.open("GET", "http://www.reddit.com/r/listentothis.json", true); | |
req.onreadystatechange = function() { | |
console.log(req.status); |
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
beep |
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
# If ctypes is available, use it to find system routines for UUID generation. | |
_uuid_generate_random = _uuid_generate_time = _UuidCreate = None | |
try: | |
import ctypes, ctypes.util | |
# The uuid_generate_* routines are provided by libuuid on at least | |
# Linux and FreeBSD, and provided by libc on Mac OS X. | |
for libname in ['uuid', 'c']: | |
try: | |
lib = ctypes.CDLL(ctypes.util.find_library(libname)) |
OlderNewer