Skip to content

Instantly share code, notes, and snippets.

View chochos's full-sized avatar
💩
(╯°□°)╯︵ ┻━┻

Enrique Zamudio chochos

💩
(╯°□°)╯︵ ┻━┻
View GitHub Profile
@chochos
chochos / jvm.sh
Created March 19, 2014 16:40
A simple shell to switch between JDK 7 and 8 on Mac OS X. Save to `jvm`, chmod 700, put in your $PATH then `source jvm 8` (or 7)
#!/bin/bash
if [ "$1" == "7" ]; then
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home
elif [ "$1" == "8" ]; then
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home
else
echo Just pass 7 or 8 dude
fi
@chochos
chochos / simple.html
Created August 27, 2014 15:34
Very simple ceylon-js page with require-jquery
<html>
<head>
<title>simple ceylon-js test</title>
<script type="text/javascript" src="../ceylon-web-ide-backend/src/main/webapp/scripts/require-jquery.js" data-main="simple.js"></script>
</head>
<body>
</body></html>
@chochos
chochos / simple.html
Last active August 29, 2015 14:05
Example of entry point to use ceylon-js
<html>
<head>
<title>simple ceylon-jsjs test</title>
<script type="text/javascript" src="../ceylon-web-ide-backend/src/main/webapp/scripts/require.js" data-main="simple.js"></script>
</head>
<body>
</body></html>
@chochos
chochos / constructors.ceylon
Last active August 29, 2015 14:10
Simple constructors test
abstract class Padre() {
shared formal String nombre;
print("Creando Padre");
}
class A extends Padre {
shared actual String nombre;
print("Creando un A");
shared new A() extends Padre() {
nombre="Default";
}
value t1=[1, "2", 3.0];
value [a,b,c]=t1;
print(a==1);
print(b=="2");
print(c==3.0);
value d->e = "K"->1;
print(d=="K");
print(e==1);
value [f,g,[h,i,j]]=[9,10,t1];
print(f==9);
@chochos
chochos / keybase.md
Created January 13, 2015 18:40
keybase.md

Keybase proof

I hereby claim:

  • I am chochos on github.
  • I am chochos (https://keybase.io/chochos) on keybase.
  • I have a public key whose fingerprint is 064F FB7F 04CB 9FD1 EF11 7004 44AE 821F 3C43 F763

To claim this, I am signing this object:

@chochos
chochos / duh.java
Created April 16, 2015 23:44
Encode/Decode 16-bit unsigned integer
byte[] encode(int x) {
byte[] b = new byte[2];
b[0] = (byte)(x>>8 & 0xff);
b[1] = (byte)(x & 0xff);
return b;
}
int decode(byte[] b) {
return ((b[0] & 0xff) << 8) | (b[1] & 0xff);
}
@chochos
chochos / wtf.js
Created April 22, 2015 03:43
Go home, JavaScript, you're drunk...
function meta(f) {
console.log("en meta");
f();
}
var lista=[meta,meta,meta];
var fun=function() {
console.log("funcion");
}
for(var i=0;i<lista.length;i++) {
var item=lista[i];
@chochos
chochos / calendar.ceylon
Last active August 29, 2015 14:20
Calendar in Ceylon, similar to *nix `cal`
import ceylon.time {
today, date
}
import ceylon.time.base {
monthOf, Month, sunday, saturday
}
shared void run() {
value hoy = today();
value quarters = [ for (m in (1..12).partition(3)) m.collect(monthOf) ];
@chochos
chochos / build.gradle
Created August 1, 2015 18:46
Gradle run with watcher plugin
task watchConcurrently {
new Thread({
tasks.watch.execute()
} as Runnable).start()
}
run.dependsOn watchConcurrently