Skip to content

Instantly share code, notes, and snippets.

View cristobal's full-sized avatar
💭
¯\_(ツ)_/¯

Cristobal Dabed cristobal

💭
¯\_(ツ)_/¯
View GitHub Profile
@cristobal
cristobal / serialize.lua
Created September 6, 2012 10:38
Lua php serialize port
--[[
LUA variant of the php serialize function
Port of http://phpjs.org/functions/unserialize
]]--
function serialize (mixed_value)
-- body
local val, key, okey,
ktype, vals, count, _type;
ktype = ''; vals = ''; count = 0;
@cristobal
cristobal / AbstractError.js
Last active December 14, 2016 12:18
AbstractError + CustomError
// @see https://github.com/bjyoungblood/es6-error
// @see http://dailyjs.com/2014/01/30/exception-error/
import {map} from 'lodash';
const defineProperty = (obj, prop, value) => {
Object.defineProperty(obj, prop, {
configurable: true,
enumerable: false,
value
});
@cristobal
cristobal / reduce-promises-over-x.js
Created September 1, 2016 11:42
Reduce a set of promises (S) over a a value x
const reducePromises = (S, x) =>
S.reduce((f, g) => f.then(g), Promise.resolve(x));

Keybase proof

I hereby claim:

  • I am cristobal on github.
  • I am cristobal (https://keybase.io/cristobal) on keybase.
  • I have a public key ASAs5cvXRdcF-ajmMlIOsVqdbEkEVN0SUSEyZUPhWZ0OAgo

To claim this, I am signing this object:

@cristobal
cristobal / # mosml - 2016-03-19_16-50-37.txt
Created March 19, 2016 19:53
mosml on OS X 10.11.3 - Homebrew build logs
Homebrew build logs for mosml on OS X 10.11.3
Build date: 2016-03-19 16:50:37
@cristobal
cristobal / Intellij.desktop
Created October 14, 2013 12:50
Intellij Desktop Entry for Ubuntu
[Desktop Entry]
Name=IntelliJ
Comment=The Best Java and Polyglot IDE
Exec=/home/cristobal/Applications/idea-<version>/bin/idea.sh
Icon=/home/cristobal/Applications/idea-<version>/bin/idea.png
Terminal=false
StartupNotify=true
Type=Application
Categories=Development;IDE;
@cristobal
cristobal / CustomContainer.java
Last active December 24, 2015 12:19
Custom Wicket Event Message Example
class CustomContainer extends WebMarkupContainer {
public CustomContainer(String id) {
super(id);
}
@override
public void onBeforeRender() {
// Some form do forward message passing for
// All Pages/Componets implements IEventSource
# Start numbering at 1
set -g base-index 1
# Allows for faster key repetition
set -s escape-time 0
# Rather than constraining window size to the maximum size of any client
# connected to the *session*, constrain window size to the maximum size of any
# client connected to *that window*. Much more reasonable.
setw -g aggressive-resize on
@cristobal
cristobal / zepto.visible.js
Created May 2, 2013 15:44
Zepto Visible filter.
$.fn.visible = function() {
return this.map(function () {
if (!_.contains(['none', 'hidden'], $(this).css('display'))) {
return this;
}
})
};
@cristobal
cristobal / ucs2_encode.lua
Last active December 16, 2015 17:39
UCS2 encode a string for sending via AT modem using `%04x` hex format.
local function ucs2_encode(str)
local cc = {}
local bv = {1, 2, 4, 8, 16, 32, 64, 128}
local fmt = "%04x"
-- bit_set taken from http://ricilake.blogspot.no/2007/10/iterating-bits-in-lua.html
local function bit_set(x, p)
return x % (p + p) >= p
end