Skip to content

Instantly share code, notes, and snippets.

View guntanis's full-sized avatar

Jorge Guntanis guntanis

  • Guntanis Morse & Lovelace
  • San Jose, Costa Rica
View GitHub Profile
var map = function(){
emit(this.DateTime+this.TrunkId+this.OriginatingNumber+this.DialedNumber+this.AuthIP+this.RatedLength+this.ActualLength, {count:1, id: this._id});
}
var reduce = function(key, values){
var result = {count:0, id:0};
values.forEach(function(value) {
result.count += value.count;
result.id = value.id;
});
<?
require_once 'AWSSDKforPHP/aws.phar';
use Aws\Sqs\SqsClient;
class Queue
{
private static $_db;
private $_client;
@guntanis
guntanis / gist:7713006
Created November 29, 2013 22:45
jQuery mouse follow/bouncy effect for images
(function ( $ ) {
$.fn.bounce = function(e) {
$(this).mousemove(function(e)
{
if (this.isAlreadyAnimating) return;
var baseExpX = 3;
var baseExpY = 3;
@guntanis
guntanis / gist:7314259
Last active December 27, 2015 10:49
Ejemplo de implementación de generador de laberintos usando grafos y backtracking aleatorio
<?php
/**
* Ejemplo de implementación de generador
* de laberintos usando grafos y backtracking
* aleatorio
*
* laberinto.php
*
* PHP version 5.5.5
*
@guntanis
guntanis / gist:6217781
Created August 13, 2013 04:00
Parse SMS UDH in PHP
/**
* Parse SMS UDH
* @return array
*/
function parseUDH($value) {
$udhArray = str_split($value,2);
$udh['udhLenght'] = $udhArray[0]; // UDH Lenght
$udh['iei'] = $udhArray[1]; // Information Element Identifier
$udh['headerLenght'] = $udhArray[2]; // Length of the header, excluding the first two fields.