Skip to content

Instantly share code, notes, and snippets.

View hpneo's full-sized avatar

Gustavo Leon hpneo

View GitHub Profile
@hpneo
hpneo / gist:4461707
Last active December 10, 2015 16:29
=begin
<STX>00000000119960614080000ABCDDDS 000000000000000000000000004CO|1<ETX><SUM>
<SEQUENCENUMBER> : 000000001
<DATETIMESTAMP> : 19960614080000
<PROVIDERCODE> : ABCD
<CUSTOMERCODE> : DDS
<MARKETINSTRUMENTCODE> : 0000
<SEQUENCENUMBERINST> : 000000000
<OPCODE> : 0000
@hpneo
hpneo / gist:4525033
Created January 13, 2013 16:55
Fonts
Quando
Enriqueta
Ultra
Port Lligat Slab
Cutive
Alike
Artifika
Marko One
IM Fell DW Pica
@hpneo
hpneo / palladium.rb
Created February 8, 2013 08:07
EventMachine based WebSocket server with em-websocket (https://github.com/igrigorik/em-websocket)
require 'em-websocket'
require 'json'
def parse_path(path)
data = path.split("/")
data.delete("")
{
:channel => data[0],
:event => data[1]
var Promise = function(url) {
var returned_values = {
complete : null,
fail : null
};
var xhr = new XMLHttpRequest();
xhr.open("GET", url, true, null, null);
this.getData = function() {
@hpneo
hpneo / gist:5050137
Created February 27, 2013 18:13
FileUpload with FormData
var data = new FormData();
data.append('videoshow[title]', 'FormData');
data.append('videoshow[logo]', $('#videoshow_logo')[0].files[0]);
var xhr = $.ajax({
url: '/admin/videoshows',
dataType : 'script',
contentType: false,
cache: false,
processData: false,
GMaps.MarkerCollection = function GMaps.MarkerCollection(markers, options) {
this.markers = markers || [];
var scopes = options.scopes;
for (var i in scopes) {
if (this[i] == undefined) {
this[i] = function() {
var new_collection = [];
@hpneo
hpneo / gist:5843329
Created June 23, 2013 01:17
Using gmaps.markerFilter
GMaps.prototype.markerFilter = function(conditions) {
var filtered_markers = [], i = 0, detail, marker;
for (i = 0; i < this.markers.length; i++) {
marker = this.markers[i];
if (conditions instanceof Array) {
if (conditions.indexOf(marker.detail.id) > -1) {
filtered_markers.push(marker);
}
@hpneo
hpneo / gist:6050659
Created July 22, 2013 01:07
Media queries
/* General */
@media screen and (max-device-width: 320px) and (max-device-height: 480px) and (device-pixel-ratio: 1.0) {
}
/* iPhone 4 (General with Pixel Ratio == 2.0) */
@media screen and (max-device-width: 320px) and (max-device-height: 480px) and (device-pixel-ratio: 2.0) {
}
@hpneo
hpneo / gist:6095953
Created July 27, 2013 19:19
Test JavaScript code with jsdom and express (using node.js)
var jsdom = require("jsdom").jsdom;
var document = jsdom();
var window = document.parentWindow;
var express = require('express');
var app = express();
app.get('/', function(request, response) {
var code = request.params.code || request.query.code;
var Gambit = function(options) {
var events = {};
var EventManager = {
on : function (event_name, fn, once) {
if (once == undefined) {
once = false;
}
if (!(event_name in events)) {