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
'use strict' | |
// Create a random color: | |
function color() { | |
return '#'+(Math.random().toString(16) + '000000').slice(2, 8) | |
} | |
for (var i=0; i<10; i++) console.log(color()) |
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
'use strict' | |
const fib = m => (h => h(h, m))((g, n) => n < 2 ? n : g(g, n - 1) + g(g, n - 2)) | |
console.log([0,1,2,3,4,5,6,7].map(fib)) |
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/python | |
from random import choice | |
# from fractions import gcd #this is slower than the implementation below!! | |
def gcd(a, b): | |
while b != 0: | |
a, b = b, a%b | |
return a | |
def coprime(a, b): |
By Dany Shaanan
I've been to Cairo twice. Once in April 2005, and once in September 2010, three months before the events that sparked the Arab Spring. Before we arrived to Cairo, we decided that in public we will speak only English (even though our native tongue is Hebrew) and that we will tell people that we are from Budolina, which is an imaginary kingdom from a book by the same name. We quickly realised, however, that there was no need for any of that. We introduced ourselves as Israelis, and discovered a welcoming, happy people living in a vibrant and wonderful city.
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
from PIL import Image | |
backgroundColor = (0,)*3 | |
pixelSize = 9 | |
image = Image.open('input.png') | |
image = image.resize((image.size[0]/pixelSize, image.size[1]/pixelSize), Image.NEAREST) | |
image = image.resize((image.size[0]*pixelSize, image.size[1]*pixelSize), Image.NEAREST) | |
pixel = image.load() |
OlderNewer