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
//Go to http://kuku-kube.com/ paste this on the console and hit enter | |
//Have fun | |
(function(){ | |
$('.play-btn').trigger('click'); | |
var win = function(){ | |
$('#box').find('span').each(function(){ | |
if($(this).data().type=='a'){ | |
$(this).trigger('click'); | |
}; |
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
$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo | |
$ yum install devtoolset-2-gcc devtoolset-2-binutils | |
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran | |
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 edificios = [ | |
[2, 9, 10], | |
[2, 4, 12], | |
[3, 7, 15], | |
[5, 12, 12], | |
[15, 20, 10], | |
[19, 24, 8] | |
] | |
function skyline(buildings){ |
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
import Data.List | |
data Peg = Red | Green | Blue | Yellow | Orange | Purple deriving (Show, Eq, Ord) | |
type Code = [Peg] | |
data Move = Move Code Int Int deriving (Show, Eq) | |
colors :: [Peg] | |
colors = [Red, Green, Blue, Yellow, Orange, Purple] | |
exactMatches :: (Eq a) => [a] -> [a] -> Int |
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 http://forwardjs.com/university/a-million-ways-to-fold-in-js | |
'use strict' | |
const first = (xs) => xs[0] | |
const rest = (xs) => xs.slice(1) | |
const concat = (xs1, xs2) => xs1.concat(xs2) | |
// recursion | |
const sum = (xs) => { |
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
# app deps | |
sudo yum install git | |
# erlang deps | |
sudo yum groupinstall "Development Tools" | |
sudo yum install ncurses-devel | |
# erlang | |
wget http://www.erlang.org/download/otp_src_18.1.tar.gz | |
tar -zxvf otp_src_18.1.tar.gz |
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
const neighbours = (pos, transf) => { | |
const x = pos[0] | |
const y = pos[1] | |
return [[x-1, y-1],[x, y-1],[x+1, y-1],[x-1, y],[x,y],[x+1, y],[x-1, y+1],[x, y+1],[x+1, y+1]].map(transf) | |
} | |
const maxSumRect = (rows, cols, nums) => { | |
const revVirtMatrix = pos => [parseInt(pos / cols), pos % cols] | |
const virtualMatrix = pos => (pos[0] * cols + pos[1]) | |
return nums.reduce((max, val, idx) => { |
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
const findAnagramIndexes = (w1, w2) => { | |
let result = []; | |
let control = []; | |
for(let i = 0; i < w1.length; i++){ | |
if(control[i] === undefined) control[i] = w2.split(''); | |
for(let j = 0; j < control.length; j++) { | |
if(control[j] === null) continue; | |
if(Array.isArray(control[j]) && control[j].length === 0) continue; | |
let indexOfLetter = control[j].indexOf(w1[i]); |
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
// Function Composition | |
const identity = x => x | |
const compose = (f, g) => x => f(g(x)) | |
const composer = fnArr => fnArr.reduce(compose, identity) | |
// Map implemented in terms of reduce | |
const mmap = fn => reducer => (acc, val) => reducer(acc, fn(val)) | |
// Filter implemented in terms of reduce | |
const mfilter = fn => reducer => (acc, val) => fn(val) ? reducer(acc, val) : acc |
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
const encode = msg => { | |
const abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
const morsecode =[ | |
'.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', | |
'..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', | |
'--.-', '.-.', '...', '-', '..-', '...-', '.--', '-..-', | |
'-.--', '--..' | |
] | |
const words = msg.toUpperCase().split(' ') | |
OlderNewer