Skip to content

Instantly share code, notes, and snippets.

View mklabs's full-sized avatar

Mickael Daniel mklabs

View GitHub Profile
@FGRibreau
FGRibreau / pid.js
Created February 16, 2012 18:41
Simple snippet for cross-platform .pid management in NodeJS. I use it for managing NodeJS apps with supervisord and monit
//
// Usage: require('./pid')("myapp");
//
var fs = require('fs');
module.exports = function(appname){
process.title = appname;
var PID_FILE = "/usr/local/var/run/"+process.title+".pid";
@mmalecki
mmalecki / travis-image.rb
Created February 10, 2012 00:53
Nice script for getting Travis build status image URL (in Markdown!)
#!/usr/bin/env ruby
if ARGV[0] and ARGV[1]
slug = ARGV[0] + "/" + ARGV[1]
else
url = `git config --get remote.origin.url`
return $?.exitstatus if $?.exitstatus != 0
m = /git@github\.com:([a-zA-Z0-9_-]+)\/([a-zA-Z0-9._-]+)\.git/.match(url)
slug = m[1] + "/" + m[2]
end
$stdout.write "[![Build Status](https://secure.travis-ci.org/#{slug}.png)](http://travis-ci.org/#{slug})"
@isaacs
isaacs / module-api-ref.json
Created February 9, 2012 04:47
This is an example format for the API reference documentation for a node module, in json
{ type: 'module',
name: 'cluster',
desc: 'The long html description thing at the beginning, examples, etc.',
events:
[ { type: 'event',
name: 'fork',
arguments: [ { name: 'worker', type: 'object', class: 'Worker' } ],
desc: 'blahblah long html description' },
{ type: 'event',
name: 'ready',
@jeffreyiacono
jeffreyiacono / Rakefile
Created February 8, 2012 20:15
rake task for precompiling assets using sprockets within a sinatra app + view helpers
require 'rubygems'
require 'bundler'
Bundler.require
require './application'
namespace :assets do
desc 'compile assets'
task :compile => [:compile_js, :compile_css] do
end
@fat
fat / index.js
Created January 12, 2012 17:43
Bootstrap Build Server
// ========================================================================
// bootstrap-builder v0.1.0
// http://twitter.github.com/bootstrap
// ========================================================================
// Copyright 2011 Twitter, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
@mmalecki
mmalecki / .travis.yml
Created January 7, 2012 01:44
Basic `.travis.yml` you should be using for your project
language: node_js
node_js:
- 0.4
- 0.6
@nikreiman
nikreiman / gist:1408399
Created November 30, 2011 08:06
Unix date formatting cheat sheet
Day
---
%a weekday, abbreviated Tue
%A weekday, full Tuesday
%d day of the month (dd), zero padded 22
%e day of the month (dd) 22
%j day of year, zero padded 001-366
%u day of week starting with Monday (1), i.e. mtwtfss 2
%w day of week starting with Sunday (0), i.e. smtwtfs 2
@madrobby
madrobby / i18n.coffee
Created November 14, 2011 15:45
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
@indexzero
indexzero / opensource-guidelines.md
Created November 9, 2011 01:54
The least amount of guidelines possible to maintain 150+ open source node.js modules

Guidelines for Open Source at Nodejitsu

README.md Outline

  • Header
    • Brief description (should match package.json)
  • Example (if applicable)
  • Motivation (if applicable)
  • API Documentation: This will likely vary considerably from library to library.
  • Installation
@indexzero
indexzero / jshint.json
Created October 4, 2011 23:48
JSHint settings used @nodejitsu
{
"passfail": false,
"maxerr": 100,
"browser": true,
"node": true,
"rhino": false,
"couch": true,
"wsh": true,
"jquery": true,