Skip to content

Instantly share code, notes, and snippets.

View joa's full-sized avatar

Joa Ebert joa

View GitHub Profile
// http://jsperf.com/double2int
function double2int=function(x){
if(isNaN(x))
return 0;
if(x==Infinity||x>0x7fffffff)
return 0x7fffffff;
if(x==-Infinity||x<-0x80000000)
return -0x80000000;
return x|0;
};
// java source
public static void main(String[] args) {
for(int i = 0; i < 10; ++i) {
System.out.println(Color.normalize(255));
System.out.println(i);
}
}
// defrac js
main = function(args){
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.List;
public final class Foo {
public static void main(String[] args) {
final Constructor<?>[] ctors = A.class.getDeclaredConstructors();
for(Constructor<?> ctor : ctors) {
System.out.println(Arrays.toString(ctor.getParameterTypes()));
System.out.println(Arrays.toString(ctor.getGenericParameterTypes()));
@joa
joa / glc_circles.js
Created January 6, 2016 12:12
glc circles
function onGLC(glc) {
glc.loop();
glc.size(400, 400);
glc.setDuration(2);
glc.setFPS(60);
glc.setMode('single');
glc.setEasing(false);
var list = glc.renderList,
width = glc.w,
height = glc.h,
@joa
joa / keybase.md
Created February 22, 2017 20:22
keybase.md

Keybase proof

I hereby claim:

  • I am joa on github.
  • I am joa (https://keybase.io/joa) on keybase.
  • I have a public key whose fingerprint is 5435 66F5 CEFD 8CD1 B9DF CE65 BD93 DD10 BF67 5F0F

To claim this, I am signing this object:

@joa
joa / Dockerfile
Last active October 19, 2018 12:00
in-cluster dh param generation with kubernetes and rbac
FROM alpine:latest as builder
WORKDIR /usr/local/bin
RUN apk add --no-cache curl && \
export KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) && \
curl -sLO https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl && \
chmod +x kubectl
FROM alpine:latest