Skip to content

Instantly share code, notes, and snippets.

View nooga's full-sized avatar
😎

Marcin Gasperowicz nooga

😎
View GitHub Profile
@nooga
nooga / gist:1205816
Created September 9, 2011 09:16
An attempt to mimic OOP syntax in C
#include <stdlib.h>
#include <stdio.h>
// How it should look like:
/**
class Point {
int x,y;
new(int, int) {...};
void moveBy(Point) {...};
@nooga
nooga / gist:1206470
Created September 9, 2011 15:08
Grammar for C
/* $Id: parser.y,v 1.4 1997/11/23 12:52:22 sandro Exp $ */
/*
* Copyright (c) 1997 Sandro Sigala <ssigala@globalnet.it>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
/* category.js */
var mongoose = require('mongoose')
, Schema = mongoose.Schema
, ObjectId = Schema.ObjectId;
var Category = new Schema({
...
});
Category.statics.foobar = function() {
@nooga
nooga / ostatnideadline.txt
Created October 12, 2012 10:11
Piosenka "Ostatni Deadline"
"Ostatni Deadline" (w oparciu o "Ostatnia Nocka" by Maciej Maleńczuk & Yugopolis)
słowa: Marcin Gasperowicz
Boli mnie głowa a nie mogę spać, a GC
chociaż dokoła wszyscy już posnęli, F E
nie mogę siedzieć a nie mogę wstać,
mija ostatni termin beznadziei.
ref.:
Tylko kod, kod, kod, płoną światła lamp,
@nooga
nooga / robot.js
Created December 4, 2012 15:55 — forked from AndreMeira/robot.js
skaicoo
//FightCode can only understand your robot
//if its class is called Robot
var id;
var Robot = function(robot) {
id = this.id;
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
@nooga
nooga / ghettomacro.js
Created June 17, 2013 13:01
Silly experiments with "macros" in JS.
function macro(mfun) {
var fstr = mfun.toString(),
params = fstr
.match(/^function\s*\((.*)\)/)[1]
.replace(/\s+/,'').split(','),
msrc = fstr.match(/^function\s*\(.*\)\s*\{((?:.|\n)*)\}\s*$/)[1];
console.log(fstr, params, msrc);
return function() {
var q = require('q');
function jednaDroga(p) {
//....
p.resolve(wartosc);
//....
}
function drugaDroga(p) {
//....
+ Setting up common submodule
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
There is something wrong with your source tree.
You are missing common/gst-autogen.sh
// save as humble.js
//$ node humble.js
// and then open http://localhost:9000/ in your browser (except Opera ;D)
var r = typeof require != "undefined" ? require : null, i = 1
a = function(l) { return l[0] }, d = function(l) { return l.slice(1) },
c = function(a,d) { return d.unshift(a) && d },
o = function(f,g) { return function(x) {return f(g(x))} },
m = function(f,l) { return a(l)?c(o(f,a)(l), m(f,d(l))):[] },
n = function(f,a,b) { return f(a)+f(b) }
function parse(text) {
return text.split('\n')
.map(function(l) {
return l.split(/\s+/).map(Number)
}) };
var fs = require('fs')
, filename = "myfile.txt"
, data = fs.readFileSync(filename, { encoding: 'utf8'} );