Skip to content

Instantly share code, notes, and snippets.

View sjcotto's full-sized avatar

Santiago Cotto sjcotto

  • Delaware | Montevideo
View GitHub Profile
@sjcotto
sjcotto / gist:6237519
Created August 15, 2013 01:45
java postgress integration
public Tarea4Parte1{
public static void main(String[] args) {
//<dbhost> <dbport> <dbname> <username> <password> esto es lo que viene en el args[], de la letra
String dbhost = args[0];
String dbport = args[1];
String dbname = args[2];
String usuario = args[3];
String pass = args[4];
@sjcotto
sjcotto / perls-parsers
Created August 15, 2013 01:49
perl parsers laboratorio teoria de lenguajes
asfd
@sjcotto
sjcotto / gist:7274378
Created November 2, 2013 01:19
java exceute command line from ssh
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
@sjcotto
sjcotto / gist:bc0edabd9c250a09ce5c
Created June 26, 2014 01:07
Helpers Rest Comunication for Kona
//APIS para KONA.JS
//Comunicacion con RESTServices
var test = function(){
var request = {
url : "http://host.com/api",
method: HTTP.GET,
data: {
@sjcotto
sjcotto / gist:bb5d7cca92d59c7bb97e
Created June 26, 2014 01:21
Kona DB Comunication
//SQL SERVICE
var test = function(){
//example insert
var script = {
service : "myService1",
query : "inser...",
update : true
@sjcotto
sjcotto / gist:6142a317cbd9a1c93f39
Last active August 29, 2015 14:03
Apis Android Rest Json Client and Kona Client
MyPojo pojo = new MyPojo();
Request request = new Request(){
url = "http://host.com/api";
method = HTTP.POST;
data = pojo;
header = new HashMap(){
put("X-AUTH-TOKEN","ASDFN1309ASDF93JJAS471JJ3SNE");
}
public void onSuccess(Response res){
@sjcotto
sjcotto / gist:0289a606d1c9947bf878
Last active August 29, 2015 14:03
Api model relation
var test() {
var mc = model.open("modelId");
var entityId = "54afd345jn243a453";
var relation = mc.getRelation("persons").findBySource(entityId);
relation.add(someEntity);
relation.removeAll();
var model = kona.model.open('employee');
var find = function(req) {
var name = req.params.get("name");
var find = [
{
first : {
$regex : ".*" + name + ".*",
$options: 'i'
@sjcotto
sjcotto / kona.js
Last active August 29, 2015 14:08
/*
* @autor santiago
*/
var model = kona.model.open('User');
var post = function(req) { // POST User to KONA Backend
var item = req.body;
model.insert(item);
return item.get("_id").toString(); //return the id of the created object
<div class="scrollable-content section" ng-controller="UserController">
<input
type="text"
ng-model="user.name"
placeholder="Some user name"
/>
<input
type="text"