Skip to content

Instantly share code, notes, and snippets.

View sergi's full-sized avatar
🎯
Focusing

Sergi Mansilla sergi

🎯
Focusing
View GitHub Profile
@sergi
sergi / range.js
Created October 30, 2012 13:19
Test creating
macro val {
case $var:ident = $expr => {
var $var = $expr
}
case $var:ident = $x:lit .. $y:lit => {
var $var = (function() {
var arr = []
for (var i = $x; i < $y; i++)
arr.push(i)
@sergi
sergi / stack.go
Last active December 10, 2015 11:48 — forked from bemasher/stack.go
package main
import (
"fmt"
)
type Stack struct {
top *Element
size int
}
function firstUnrepeated(str) {
var blacklist = [];
var once = {};
str.split("").forEach(function(e, pos) {
if (blacklist.indexOf(e) === -1) {
once[e] = pos;
blacklist.push(e);
}
else { delete once[e]; }
});
@sergi
sergi / dabblet.css
Created May 12, 2013 12:34
Circular Tooltip (SO)
/**
* Circular Tooltip (SO)
* http://stackoverflow.com/q/13132864/1397351
*/
* { margin: 0; padding: 0; }
body {
overflow: hidden;
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg);
}
/* generic styles for button & circular menu */
@sergi
sergi / redis_test.js
Last active December 20, 2015 05:29
Naive redis GET/SET server for Node.js.
// Try with `redis-benchmark -t GET,SET -n 100000`
'use strict';
var net = require('net');
var split = require('split');
var db = {};
net.createServer(function(socket) {
function sendError(err) {
console.error(err);
@sergi
sergi / redis_test2.js
Created July 25, 2013 14:18
Naive redis GET/SET server for Node.js. Version 2, no dependencies
'use strict';
var net = require('net');
var db = Object.create(null);
net.createServer(function(socket) {
function sendError(err) {
console.error(err);
socket.write("-ERR " + err + "\r\n")
}
@sergi
sergi / graphics-interaction.html
Created August 15, 2013 12:34
Test-case for issue #233 on pixi.js
<html>
<head>
<script src="pixi.js"></script>
</head>
<body>
<script>
var stage = new PIXI.Stage(0x66FF99, true);
var renderer = PIXI.autoDetectRenderer(500, 500);
var graphics = new PIXI.Graphics();
// Accumulators
// =============================================================================
//
// A tiny library for reactive programming that offers blazing fast generic
// collection manipulation, asyncronous flow control and the ability to
// represent infinitely large collections.
//
// Copyright Gordon Brander, 2013. Released under the terms of the [MIT license](http://opensource.org/licenses/MIT).
//
// Background:
@sergi
sergi / gist:7544434
Last active December 28, 2015 18:39
Shell helper function to launch Firefox OS test server
launch_tests() {
cd $GAIADIR
if [ ! -d profile/extensions/httpd ] ; then
DEBUG=1 make
fi
$NIGHTLY/firefox --no-remote -profile $GAIADIR/profile-debug/ http://test-agent.gaiamobile.org:8080/ &
make test-agent-server
}
diff --git a/apps/communications/contacts/test/unit/mock_iccmanager.js b/apps/communications/contacts/test/unit/mock_iccmanager.js
deleted file mode 100644
index 1df8692..0000000
--- a/apps/communications/contacts/test/unit/mock_iccmanager.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-
-var MockIccManager = function() {
- this.iccIds = [];