Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
package main
import (
"fmt"
"net/http"
"github.com/codegangsta/negroni"
)
func main() {
def quickSort(xs: Array[Int]) {
def sort1(l: Int, r: Int) {
val pivot = xs((l + r) / 2)
var i = l;
var j = r;
while (i <= j) {
while (xs(i) < pivot) {
i += 1
}
(import (scheme base)
(scheme write))
;; graph lib
(define-record-type <edge>
(edge x y z)
edge?
(x from from-set!)
(y to to-set!)
void
_start() {
__asm__(
"movl $1, %eax;"
"xorl %ebx, %ebx;"
"int $0x80;"
);
}
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
/**
* The MIT License (MIT).
*
* Copyright (c) 2014 Jonathan Barronville ([email protected])
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
@jonathanmarvens
jonathanmarvens / λ.js
Last active August 29, 2015 14:03
A tiny utility for playing with the lambda calculus ;p .
/**
* The MIT License (MIT).
*
* Copyright (c) 2014 Jonathan Barronville ([email protected]).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TOR
#include <stdio.h>
#include <mruby.h>
#include <mruby/compile.h>
int main(int argc, char ** argv)
{
mrb_state * mrb = mrb_open();
char code[250];
while (1) {
printf("[max:250]> ");
# Build an inverted index for a full-text search engine with Redis.
# Copyright (C) 2009 Salvatore Sanfilippo. Under the BSD License.
# USAGE:
#
# ruby invertedindex.rb add somedir/*.c
# ruby invertedindex.rb add somedir/*.txt
# ruby search your query string
require 'rubygems'
require 'redis'
@jonathanmarvens
jonathanmarvens / express-app.js
Created May 23, 2014 04:11
I was just going through some old Node.js code, and I thought I'd share how I usually organize Express-based apps.
'use strict';
var
app,
appConfig,
cors,
express
;
appConfig = require('./app-config');