Skip to content

Instantly share code, notes, and snippets.

@elranu
elranu / app.js
Created November 24, 2011 15:29
Socket.IO RedisStore and Rooms
//app.js Socket IO Test
var app = require('express').createServer(),
redis = require('socket.io/node_modules/redis'),
io = require('socket.io').listen(app);
var pub = redis.createClient(port, "url");
var sub = redis.createClient(port, "url");
var store = redis.createClient(port, "url");
pub.auth('pass', function(){console.log("adentro! pub")});
sub.auth('pass', function(){console.log("adentro! sub")});
@elranu
elranu / mongodb_db.js
Created December 14, 2011 20:02
ueberDB support for monogDB - etherpad-lite
/**
* Mariano Julio Vicario aka Ranu - TW: @el_ranu
* http://www.ranu.com.ar
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@elranu
elranu / gist:3740195
Created September 17, 2012 22:33
How a Ledger post (GeneralJournalEntry) is related with a General Journal Ledger.
public static LedgerJournalTable findByGeneralJournalEntry( GeneralJournalEntry journalEntry )
{
LedgerJournalTable journalTable;
LedgerEntryJournal journalLink;
;
select firstOnly * from journalLink where journalLink.RecId == journalEntry.LedgerEntryJournal
join journalTable where journalTable.JournalNum == journalLink.JournalNumber;// &&
//journalTable.dataAreaId == journalLink.LedgerJournalTableDataAreaId;
@elranu
elranu / xpo
Created September 17, 2012 22:37
How a General Journal Line is related with a Ledger post (GeneralJournalEntry)
LedgerJournalTable jourTable, origJornalTable;
LedgerJournalTrans jourTrans, origJournalTrans;
SubledgerVoucherGeneralJournalEntry jourLink;
;
origJornalTable = LedgerJournalTable::findByGeneralJournalEntry(journalEntry);
if(origJornalTable){
select * from origJournalTrans where origJournalTrans.JournalNum == origJornalTable.JournalNum
join jourLink where jourLink.GeneralJournalEntry == journalEntry.RecId && origJournalTrans.Voucher == jourLink.Voucher;
@elranu
elranu / gist:4586542
Created January 21, 2013 14:42
TableMapper: Automatic Table Mapper for Dynamics Ax http://ranu.com.ar Example
TableMapper mp = new TableMapper();
TestTable1 tb1;
TestTable2 tb2;
;
mp.MapTable(tb1, tb2)
.Bind("Int2", "SomeInt")
.Bind("Name","FullName")
.Bind("Url", "Web")
.Ignore("Utc")
@elranu
elranu / inheritance.js
Last active December 14, 2015 06:48
inheritance in javascript
//More info: http://javascript.crockford.com/private.html
function Vehicle() {
this.pepe = function(){
console.log('pepe');
};
}
Vehicle.prototype.drive = function () {
@elranu
elranu / gist:7237386
Created October 30, 2013 18:16
use Angular injector to reuse angular modules outside angular
var injector = angular.injector(['module1', module2, 'ng']);
var service = injector.get("serviceName");
@elranu
elranu / gist:7707374
Created November 29, 2013 15:33
Git remote branch tranking
git remote update
git checkout -t -b nameBranch remote/branch
git branch -vv (to check, two Vs)
@elranu
elranu / jsbin.UTonifOg.html
Created December 23, 2013 23:09
json to html Form simple script
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="json to html form" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
@elranu
elranu / gist:c1d142831379cf4844b1
Created June 2, 2014 18:09
apply and call example
var x, o1, o2, r1, r2, r3;
x = 4;
o1 = {x: 2};
o2 = {x: 7};
f = function(m, n) {return m * n * this.x;};
r1 = f(3, 1));
r2 = f.call(o1,3, 1));
r3 = f.apply(o2,[3, 1]));