Skip to content

Instantly share code, notes, and snippets.

View paradoja's full-sized avatar

Abby Henríquez Tejera paradoja

View GitHub Profile
@paradoja
paradoja / fizbuzz.hs
Created May 4, 2012 20:53
Haskell's brute force Scala-like inverse fizzbuzz
-- http://www.jasq.org/2/post/2012/05/inverse-fizzbuzz.html
import Control.Applicative -- para <*>
import Data.List -- para sortBy
import qualified Data.Map as M
divides m n = n `mod` m == 0
fizzbuzzTest n = [divides 3, divides 5] <*> [n]
@paradoja
paradoja / factorial.java
Created May 31, 2012 08:44
Recursividad final
/* Este factorial es recursivo, pero operamos de alguna forma la
* llamada recursiva (la multiplicamos por n).
*/
long factorial(long n) {
if (n == 0) {
return 1;
}
else {
return n * factorial(n-1);
@paradoja
paradoja / index.html
Created June 3, 2012 20:07
Playing with node
<html>
<head>
<title> ¡Hola! </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var server = io.connect('http://localhost:8080');
document.onkeypress = manda;
function manda(event) {
def is_ancestor_of?(other_page)
other_page.is_descendant_of? self
end
@paradoja
paradoja / ghci.hs
Created November 5, 2012 03:15
Compressed powerset
import Control.Monad
import Data.List
let unRoll = join .map (uncurry $ flip replicate)
let roll = map $ map (\l@(x:_) -> (x, length l)) . group:: [String] -> [[(Char, Int)]]
let powerSet = roll . nub . filterM (const [True, False]) . unRoll
powerSet [('a',2), ('b',2)]
# $Id: screen-keys.conf,v 1.7 2010-07-31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
for i in `find .`; do echo $i `grep -c PATTERN $i` | awk '{ if ($2 > 1) print $1}' ; done
for i in `ls -rt DIRECTORY`; do; if [ -f DIRECTORY/$i ]; then grep -H PATTERN DIRECTORY/$i; fi; done
@paradoja
paradoja / App.java
Created March 16, 2015 18:38
Test Java Neo4j JDBC Rest connection
package gdbTest;
import org.neo4j.jdbc.Driver;
import org.neo4j.jdbc.Neo4jConnection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
@paradoja
paradoja / open-ec
Created July 7, 2015 08:18
It's All Text! emacsclient launcher
!#/bin/bash
/usr/local/bin/emacsclient -c "$@"