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 'formula' | |
class Vim <Formula | |
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2' | |
homepage 'http://www.vim.org' | |
md5 '5b9510a17074e2b37d8bb38ae09edbf2' | |
depends_on 'ncursesw' | |
depends_on 'cscope' |
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
let rec omNoms start op from nto = | |
if from > nto then start | |
else op from (omNoms start op (from + 1) nto) | |
printfn "%d" (omNoms 0 (+) 1 100) |
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
(* | |
Problem 1 | |
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
Find the sum of all the multiples of 3 or 5 below 1000. | |
*) | |
[1..1000] | |
|> List.filter (fun n -> (n%3) = 0 || (n%5) = 0) | |
|> List.fold (+) 0 |
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
> let rec fib (start,step,list) = | |
if (start > 4000001) then (1,start, start::list) | |
else fib (start+step, start, (start::list)) | |
val fib : int * int * int list -> int * int * int list | |
> let start,max,list = fib (1,1,[]) | |
val start : int = 1 |
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
(* | |
Problem 3 | |
The prime factors of 13195 are 5, 7, 13 and 29. | |
What is the largest prime factor of the number 600851475143 ? | |
*) | |
let rec find_factors (count, target, list) = | |
if count < 2L then (1L,target,count::list) | |
else if (target % count = 0L) then find_factors((count-1L), target, count::list) | |
else find_factors((count-1L),target, list) |
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 | |
# This script converts xccolorthemes to dtvcolorthemes for porting xcode 3.x themes to xcode 4.x | |
# created by ashley towns <[email protected]> | |
# Public domain. | |
# ./dvtcolorconvert <inputfile> | |
# spits out a .dtvcolortheme file | |
require 'plist' | |
raise "Error: need a source file #{__FILE__} [file.xccolortheme]" if ARGV.length == 0 |
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
parseInt('005') | |
// => 5 | |
parseInt('006') | |
// => 6 | |
parseInt('007') | |
// => 7 | |
parseInt('008') | |
// => 0 | |
parseInt('009') | |
// => 0 |
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
// internode-usage.js | |
// written by ashley towns <[email protected]> | |
var _ = require("underscore"); | |
var request = require("request"); | |
var xml2js = require("xml2js-expat"); | |
// | |
var account_id = null; | |
var auth = null; |
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
javascript:i=0;setInterval(function(){i++;if(i==360){i=0;};document.getElementsByClassName('nyan-cat')[0].setAttribute("style","-webkit-transform:rotate("+i+"deg)")},50); |
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
javascript:i=0;setInterval(function(){i++;if(i==window.document.width){i=0;};document.getElementsByClassName('nyan-cat')[0].setAttribute("style","position: absolute; left:"+i+"px");},10); |
OlderNewer