Skip to content

Instantly share code, notes, and snippets.

View k33g's full-sized avatar
💭
Read my code at https://gitlab.com/k33g

Philippe Charrière k33g

💭
Read my code at https://gitlab.com/k33g
View GitHub Profile
@k33g
k33g / gist:3765084
Created September 22, 2012 04:12
Scala
@k33g
k33g / gist:3959903
Created October 26, 2012 16:57
Patterns & Typescript

##The Singleton Pattern

class SantaClaus {

	private static uniqueInstance : SantaClaus;
	
@k33g
k33g / gist:4011472
Created November 4, 2012 11:23
Backbone en Typescript
/// <reference path="d.ts/backbone-0.9.ts"/>
declare var $: any;
declare var _: any;
declare var Mustache: any;
module Earth {
export class Human extends Backbone.Model {
@k33g
k33g / bb.md
Created November 9, 2012 12:16

##Template

    <!-- ìci notre template -->
    <script type="text/template" id="articles-collection-template">
        <% _.each(articles, function(article) { %>
        <h1><%= article.title %></h1>
        <p><%= article.content %></p>

<% }); %>

@k33g
k33g / quick.html
Created November 13, 2012 18:29
Bob
/* --- quick starter --- */
/// <reference path="../../ts/lib/bob.ts"/>
declare var $: any;
declare var Mustache: any;
//define human model
class Human extends Bob.Model {}
var MustacheView = Backbone.View.extend({
initialize : function (data) {
if(this.template) this.mustacheTemplate = this.template.html();
this.data = data!==undefined ? data : [];
},
render : function () {
var view = this;
var _render = function() {
[].slice.apply(document.querySelectorAll("emmerdes")).forEach(function(item){item.innerHTML="QUE DU BONHEUR POUR 2013"})
@k33g
k33g / gist:4694212
Created February 1, 2013 21:18
Promise notation for N3rd.stack (and fast!>>forward)
Promise<String> promise = new Promise<String>("My batchTask as String Promise", new Batch() {
public String run() throws InterruptedException {
long duration=(long)(Math.random()*10);
System.out.println("Waiting for "+duration+" seconds for results.");
TimeUnit.SECONDS.sleep(duration);
System.out.println("Hello World by anonymous class");
return "Hello World by Anonymous";
}
});
@k33g
k33g / golo.sublime-build
Created March 3, 2013 08:07
golo sublime build
{
"cmd": ["/Users/k33g_org/Dropbox/golo/r0/bin/gologolo","$file"],
"selector": "source.golo",
"osx":
{
"path": "/usr/local/bin:$PATH",
"env":{
"JAVA_HOME":"/Library/Java/JavaVirtualMachines/ea.jdk1.8.0/"
}
}
@k33g
k33g / glloq.golo
Last active December 14, 2015 16:59
le "Glloq", 1er DSL pour enfants en Golo
module glloq
function boite = -> DynamicObject():
op(""):
value(0):
nbCailloux(0):
nbAllumettes(0):
define("alumette", |this| {
if this: op(): equals("+") { this: nbAllumettes(this: nbAllumettes() + this: value())}
if this: op(): equals("-") { this: nbAllumettes(this: nbAllumettes() - this: value())}