Skip to content

Instantly share code, notes, and snippets.

View c4milo's full-sized avatar
:octocat:

Camilo Aguilar c4milo

:octocat:
View GitHub Profile
anonymous
anonymous / mark-sweep-gc.js
Created December 27, 2012 20:01
The simplest algorithm of Mark and Sweep garbage collection technique.
/**
* Mark and Sweep Garbage Collection technique.
* MIT Style License
* by Dmitry Soshnikov
*/
// This diff describes the simplest version of mark and sweep
// GC in order to understand the basic idea. In real practice the
// implementation can be much tricker and more optimized.
package main
import (
"github.com/codegangsta/martini"
"github.com/codegangsta/martini-contrib/binding"
"github.com/codegangsta/martini-contrib/render"
"labix.org/v2/mgo"
)
type Wish struct {
@c4milo
c4milo / ejabberd.conf
Created May 18, 2014 18:47
Upstart script for Ejabberd
# Ubuntu upstart file at /etc/init/ejabberd.conf
respawn
respawn limit 20 5
start on runlevel [2345]
stop on runlevel [06]
script
exec start-stop-daemon --start --name ejabberd --user ejabberd --chuid ejabberd --exec /usr/local/sbin/ejabberdctl -- start
@jamiehodge
jamiehodge / slides.md
Created December 3, 2012 09:40
Hypermedia APIs

!SLIDE

Hypermedia APIs

"Follow your nose"

— Roy T. Fielding

!SLIDE

"build scalable, flexible implementations that do not simply run on the Web, but that actually exist in the Web"

@jakejscott
jakejscott / server.go
Created May 20, 2014 00:53
negroni + httprouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
@c4milo
c4milo / component.js
Last active June 4, 2018 00:56
Simple breadcrumb Ember 2 component.
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '', // Does not let Ember inject HTML into the component.
routing: Ember.inject.service('-routing'),
breadcrumbs: Ember.computed('routing.currentRouteName', function () {
let routeName = this.get('routing.currentRouteName');
let routeNames = routeName.split('.');
let len = routeNames.length;
@rauchg
rauchg / ms.md
Created December 21, 2011 00:25
Milliseconds conversion utility.
@creationix
creationix / convert.js
Last active March 31, 2020 07:15
Convert a hex string (base-16) to a base-65536 (16-bit) string.
function hexToBase65536(hex) {
var result = "";
for (var i = hex.length ; i > 0; i -= 4) {
result += String.fromCharCode(parseInt(hex.substring(i - 4, i), 16));
}
return result;
}
@c4milo
c4milo / yourservice.conf
Created April 25, 2011 18:05
upstart example script
# Ubuntu upstart file at /etc/init/yourservice.conf
pre-start script
mkdir -p /var/log/yourcompany/
end script
respawn
respawn limit 15 5
start on runlevel [2345]
@statico
statico / gist:3172711
Created July 24, 2012 21:15
How to use a PS3 controller on Mac OS X 10.7 (Lion)

How to use a PS3 controller on Mac OS X 10.7 (Lion)

  1. Open Apple menu -> System Preferences -> Bluetooth and disable Bluetooth on Mac as well as any other nearby Macs or devices which will try to pair with and confuse the controller.

  2. Reset PS3 controller by inserting paperclip into pinhole near L2 button.

  3. Connect PS3 controller to Mac with USB cable.

  4. Enable Bluetooth.