I hereby claim:
- I am jrotolo on github.
- I am jarrodrotolo (https://keybase.io/jarrodrotolo) on keybase.
- I have a public key ASCQRWa5lItLHjVZIYjZ68Gfcs8m-ubcdXXtx6KN95CggQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
ALPHABET = %w(0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) | |
def change_base(number, base, result) | |
if number <= 0 | |
puts result | |
else | |
result = ALPHABET[number % base] << result | |
change_base(number / base, base, result) | |
end | |
end |
// Reverse each word in string | |
function reverseWords(str) { | |
return str.split(' ').map(function(word) { | |
return word.split('').reverse().join(""); | |
}).join(" "); | |
} | |
// Reverse whole string | |
function reverse(str) { | |
return str.split("").reverse().join(""); |
// A Simple Trim Example from Javascript The Good Parts | |
Function.prototype.method = function (name, func) { | |
if (!this.prototype[name]) { | |
this.prototype[name] = func; | |
} | |
return this; | |
}; | |
String.method('trim', function () { | |
return this.replace(/^\s+|\s+$/g, ''); |
#!/bin/sh | |
cleanup() | |
{ | |
DIR=~/Downloads | |
if [ "$(ls -A $DIR)" ]; then | |
echo "Total size of $DIR in KB: $(du -k $DIR | sed 's/\([0-9][0-9]*\).*/\1/')" | |
printf "Confirm deletions? (yes/no) " | |
read ANSWER |
# Some simple array functions | |
# more from the enumerable module to come | |
# Filter array based on predicate | |
old = [3, 5, 9, 24, 2, 1, 21, 54] | |
new = old.keep_if { |x| x < 8 } | |
# Sum of every element in array | |
arr.reduce { |x, y| x + y } |
#lang racket | |
(require xml net/url) | |
(define (serve port-no) | |
(define main-cust (make-custodian)) | |
(parameterize ([current-custodian main-cust]) | |
(define listener (tcp-listen port-no 5 #t)) | |
(define (loop) | |
(accept-and-handle listener) |
(defvar *db* nil) | |
(defun make-dvd (title director genre rating resolution fformat) | |
(list :title title :director director :genre genre :rating rating | |
:resolution resolution :fformat fformat)) | |
(defun add-record (dvd) (push dvd *db*)) | |
(defun dump-db () | |
(format t "~{~{~a:~12t~a~%~}~%~}" *db*)) |