Skip to content

Instantly share code, notes, and snippets.

View alex-quiterio's full-sized avatar
🌀
using my coding skills to fight for the climate

aIex quiterio alex-quiterio

🌀
using my coding skills to fight for the climate
View GitHub Profile
class Allocator
# override new class method
def self.new(*args)
print "Hello "
ref = allocate
ref.send(:initialize, *args)
print "\n"
return ref
end
--- module ScottsSnake where
import Keyboard
import Random
import String
import Set
type Position = {x: Int, y: Int }
type Board = {w: Int, h: Int, wall: [Position]}
type Apple = Position
@alex-quiterio
alex-quiterio / puddles.go
Created August 3, 2014 00:14
Simple programming exercise with unionSets
package main
import "fmt"
type Set struct {
pos int
value int
}
func makeSet(position int, value int) Set {
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@alex-quiterio
alex-quiterio / proxy.rb
Last active August 29, 2015 14:21 — forked from torsten/proxy.rb
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
#
# Copyright (C) 2009-2014 Torsten Becker <torsten.becker@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@alex-quiterio
alex-quiterio / gist:c1642b78918da9479439
Last active August 29, 2015 14:28 — forked from josetapadas/gist:f9eec8ca7d9f214f0918
Dynamic single shot media query
var mediaQueryListElement = window.matchMedia("all and (min-width: 666px)");
function call_me(name) {
console.log("És um " + name);
mediaQueryListElement.removeListener(call_me.caller);
}
mediaQueryListElement.addListener(function() {
call_me("sugar");
});
@alex-quiterio
alex-quiterio / script.js
Created November 25, 2012 18:35
A CodePen by Chris Coyier.
new TWTR.Widget({
version: 2,
type: 'profile',
rpp: 5,
interval: 30000,
width: 400,
height: 600,
theme: {
shell: {
background: 'transparent',
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
@alex-quiterio
alex-quiterio / dabblet.css
Created March 1, 2013 12:05
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 12%;
border-ra
public class Test {
@Assertion("foo>0")
int foo=1;
@Assertion("bar%2==0")
long bar;
@Assertion("baz>foo")
int baz;