Skip to content

Instantly share code, notes, and snippets.

View oscarryz's full-sized avatar

Oscar Reyes oscarryz

View GitHub Profile
test.A {
testA() {
"I got %d nose and %d ears." .% (1, 2).println()
}
%( s: String, o : Object*) : String {
String.format( s, o )
}
}
@oscarryz
oscarryz / DbDao.java
Created June 3, 2011 21:43
SQL - Java binder
/*
* Copyright (c) 2011, Oscar Reyes.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the folLowing disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
@oscarryz
oscarryz / block.m
Created June 4, 2011 05:24
Blocks en Objective-C
[array do: ^(id obj) {
NSLog(@"Obj is %@", obj);
}];
@oscarryz
oscarryz / gist:1013781
Created June 8, 2011 04:38
Support use of local variables inside blocks
class _<T> {
public T _;
public _(T v){
_ = v;
}
}
interface Block0<T> {
public void run();
}
/*
@oscarryz
oscarryz / DoodlePlayer.java
Created June 9, 2011 19:19
To play @chochosmx twitter tunes in todays doodle
// Reduced timing to play faster songs.. add more spaces as needd
import java.awt.Robot;
class DoodlePlayer {
public static void main( String ... args ) throws Exception {
Robot robot = new Robot();
robot.delay( 2000 );
for( char c : args[0].toCharArray() ) {
if( c != ' ' ) {
robot.keyPress(c);
robot.keyRelease(c);
@oscarryz
oscarryz / gist:1020403
Created June 11, 2011 09:16
This could be my take on list comprenhension
//;Ryz code
//;http://en.wikipedia.org/wiki/List_comprehension
1.to(100)
.select((x:Int){ x.*x .> 3})
.collect((x:Int){2.*x})
@oscarryz
oscarryz / Imagen.java
Created June 23, 2011 19:27
Cómico!, visor de imagenes escrito por José Manuel Hernandez Farias
/**
* Aplicacion que simula ser un visor de imagenes...
* Creado por: Jose Manuel Hernandez Farias @author KaltWulx
* Version: 0.0.0.0 :D
* @warning: Hecho por un novice Lvl 1/1... D:
*/
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
@oscarryz
oscarryz / UsePersona.java
Created June 24, 2011 09:26
Lombok rockea! Usando la anotación @DaTa de Lombok ( http://projectlombok.org/ ) pasa esto
//Clase de prueba:
package test;
import demo.lombok.Persona;
public class UsePersona {
public static void main( String ... args ) {
System.out.println( new Persona("Oscar","Reyes", 0x20 ) );
System.out.println( new Persona("Oscar","Reyes",0x20).equals( new Persona("Oscar","Reyes",0x20)));
@oscarryz
oscarryz / gist:1044496
Created June 24, 2011 09:30
Debo de llegar a esto
//;Debo de llegar a esto:
import( lombok.Data )
@Data
demo.lombok.Persona {
name : String
lastName : String
age : Integer
}
@oscarryz
oscarryz / gist:1063873
Created July 4, 2011 20:18
Sample output
C:\Users\oreyes\code\java\demo>dir
El volumen de la unidad C es
El número de serie del volumen es:
Directorio de C:\Users\oreyes\code\java\demo
04/07/2011 03:16 p.m. <DIR> .
04/07/2011 03:16 p.m. <DIR> ..
0 archivos 0 bytes