Skip to content

Instantly share code, notes, and snippets.

@sergioceron
sergioceron / Main.hs
Created September 20, 2022 23:14
PBG Minting
{-# LANGUAGE OverloadedStrings #-}
module Swap where
import Language.Marlowe.Extended.V1
main :: IO ()
main = printJSON $ contract
-- We can set explicitRefunds True to run Close refund analysis
-- but we get a shorter contract if we set it to False
@sergioceron
sergioceron / gist:b963db975165a612db5fae9b15b1a583
Created December 8, 2016 00:49 — forked from pocketkk/gist:e449cc89d40ce9744590
Swift - Add subview with transition
UIView.transitionWithView(self.view, duration: 0.5, options: UIViewAnimationOptions.TransitionNone,
animations: {self.view.addSubview(effectView)}, completion: nil)
#!/usr/bin/env sh
for i in `objdump -d $1 | tr '\t' ' ' | tr ' ' '\n' | egrep '^[0-9a-f]{2}$' ` ; do echo -n "\x$i" ; done
@sergioceron
sergioceron / cursos.list.xhtml
Created September 19, 2014 18:29
Eliminar con ajax mostrando un popup de confirmacion y propagando la conversacion
<h:commandLink>
Eliminar
<s:conversationPropagation type="begin" />
<f:setPropertyActionListener target="#{cursoController.curso}"
value="#{curso}"/>
<f:ajax execute="@this" render=":mod:popup"
onevent="showModal"/>
</h:commandLink>
@sergioceron
sergioceron / gist:9516914
Created March 12, 2014 21:35
Run process in background (SSH, Amazon)
sudo nohup command &
@sergioceron
sergioceron / gist:9475068
Created March 10, 2014 21:44
New initialization way to collections in java
List<String> list = new ArrayList<String>() {
{
add("String A");
add("String B");
add("String C");
}
};
#!/bin/bash
#
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
#
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
#
export BUILD_DIR="$PWD"
@sergioceron
sergioceron / gist:9215314
Created February 25, 2014 19:00
Use jQuery Datatables API with AngularJS
$scope.$watchCollection( 'myCollection', function( oldCollection, newCollection ) {
if( oldCollection === newCollection ) return;
// Gives the time to destroy dataTable, which is immediately
$( '#dataTable' ).dataTable().fnDestroy();
$timeout(function () {
// After a few time, create the dataTable when DOM render is complete
$( '#dataTable' ).dataTable();
});
});
@sergioceron
sergioceron / UIList.java
Created June 2, 2013 19:41
Detect double click on a JTable Cell
if (e.getClickCount() == 2) {
JTable target = (JTable) e.getSource();
int row = target.getSelectedRow();
Object value = target.getModel().getValueAt(row, 0);
for (ItemListener il : listeners) {
il.onItemDoubleClick(this, value, row);
}
}
@sergioceron
sergioceron / WakeOnLan.java
Created February 2, 2013 18:52
WakeOnLan
/**
* Created by IntelliJ IDEA.
* User: sergio
* Date: 7/12/12
* Time: 05:31 PM
* To change this template use File | Settings | File Templates.
*/
import java.io.*;
import java.net.*;