Skip to content

Instantly share code, notes, and snippets.

View amasad's full-sized avatar
🎱
balling

Amjad Masad amasad

🎱
balling
View GitHub Profile
@amasad
amasad / game-of-life.rkt
Last active December 29, 2015 21:18
Conway's Game of Life
#lang racket
(require 2htdp/image
2htdp/universe)
; Cell object.
(define make-cell
(lambda (x y)
(list (list x y) #f)))
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@Janiczek
Janiczek / ProjectEuler.coffee
Created May 31, 2011 21:57
First few Project Euler problems solved in CoffeeScript. Comments on how to make it more beautiful (in terms of CoffeeScript, not algorithm) highly appreciated!
@_1 = ->
# sum of multiples of 3 or 5 (not both) under 1K
answer = 0
for n in [1...1000]
if n % 3 == 0 or n % 5 == 0
answer += n
@DmitrySoshnikov
DmitrySoshnikov / classes.txt
Created May 17, 2011 18:19
Classification of classes
// by Dmitry Soshnikov <dmitry.soshnikov@gmail.com>
// MIT Style License
*Classification of classes:*
=============================================================================
| Dynamic | Static
-----------------------------------------------------------------------------
| |
| Coffee, Python, Ruby, | SmallTalk, built-in
@DarrenN
DarrenN / Euler3.coffee
Created December 21, 2010 18:17
Project Euler #3 in pure CoffeeScript
# Project Euler #3 -> http://projecteuler.net/index.php?section=problems&id=3
# Q: What is the largest prime factor of the number 600851475143 ?
# Generate a Sieve of Eratosthenes (an array loaded with prime numbers)
primes = []
sieve = (set, pos) ->
return false if pos >= set.length
if set[pos] * set[pos] < set[set.length-1]
primes = (x for x in set when x == set[pos] or x % set[pos] != 0)
return sieve(primes,pos+1)