Skip to content

Instantly share code, notes, and snippets.

@egonelbre
egonelbre / Dockerfile
Created March 2, 2016 09:21
Deploying to ElasticBeanstalk
FROM alpine:3.1
RUN apk add --update ca-certificates && rm -rf /var/cache/apk/*
ADD . /app
WORKDIR /app/
ENV DEVELOPMENT true
ENV PORT 80
#include <stdio.h>
#include <assert.h>
#include <typeinfo>
namespace game {
class Object { virtual void _(){}; };
class Asteroid : public Object {};
class Ship : public Object {};
class Bullet : public Object {};
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"net/http"
"os"
"path"
package issue
type ID int
type Status string
const (
Created = Status("Created")
Closed = Status("Closed")
)
@egonelbre
egonelbre / include.html
Created August 10, 2015 07:32
html/template example
<link rel="stylesheet" type="text/css" href="main.css">
<link rel="stylesheet" type="text/css" href="main.js">
package main
const MaxLength = 1 << 20
var (
addr = flag.String("listen", ":8000", "listen for requests")
numprocs = flag.Int("p", runtime.NumCPU(), "number of workers to start")
maxqueue = flag.Int("q", runtime.NumCPU()*2, "largest queue size")
jobs chan Job
<link rel="import" href="/tv/task/List.html">
<link rel="import" href="/tv/task/Header.html">
<style>
.tv-task-header {
background: #f00;
}
</style>
<script>
// some random example
package("task", function(exports){
public static String replace(String pattern, String input, Function<String, String> translate){
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(input);
StringBuffer result = new StringBuffer();
while(m.find()){
String r = translate.apply(m.group());
m.appendReplacement(result, Matcher.quoteReplacement(r));
}
m.appendTail(result);
@egonelbre
egonelbre / dci.js
Last active August 29, 2015 14:21
injection based
DCI = {};
if(typeof window !== 'undefined'){ window.DCI = DCI; }
if(typeof global !== 'undefined'){ global.DCI = DCI; }
(function(DCI){
DCI.Context = function(init, roles){
var sfn = "";
sfn += "\tvar $C = {};\n";
sfn += "\tvar " + Object.keys(roles).join(", ") + ";\n";
function Account(code, balance) {
return {
get code(){ return code; },
get balance(){ return balance; },
increase: function(by){ balance += by; },
decrease: function(by){ balance -= by; }
};
}
function Bank(){