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 reverse_str(str) | |
reversed = '' | |
i = str.length - 1 | |
until i == -1 do | |
reversed << str[i] | |
i -= 1 | |
end | |
reversed | |
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
var http = require('http'), | |
urls = [], | |
results = {} | |
for(var i = 2; i < process.argv.length; i++) { | |
urls.push(process.argv[i]) | |
} | |
var log_end_results = function() { | |
urls.forEach(function(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
var net = require('net'), | |
port = Number(process.argv[2]) | |
var process_connection = function(socket) { | |
var date = populate_datetime(new Date()) | |
socket.end(datetime_to_string(date)) | |
} | |
var zeroify = function(number) { | |
if (number.length < 2) |
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 String | |
class << self | |
def random_string | |
chars = [*('A'..'Z'),*('a'..'z'),*(0..9)] | |
chars.map { |c| [0,1].sample == 0 ? nil : c }.compact.shuffle.join | |
end | |
end | |
end |
NewerOlder