Skip to content

Instantly share code, notes, and snippets.

@andrewle
andrewle / spacescroller.lua
Created April 13, 2010 03:40
Simple spaceship scroller game demo in Lua with the Love game engine
function love.load()
config = {
initial_x = 200,
initial_y = 400,
step = 500,
numStars = 100,
starSpeedFactor = 1
}
spaceship = {
@gtzilla
gtzilla / Configuring Daemontools for Ubuntu 10
Created September 3, 2010 08:17
setup daemontools on ubuntu
#!/bin/sh
## you'll have to do a couple extra steps to get this running
## there are probably other ways to handle svncanboot, but this is from the linux forum
set -e
if
touch /etc/_testr_file
then
@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active October 29, 2024 21:43
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@CasualSuperman
CasualSuperman / indexBy.js
Created December 22, 2011 17:58
Underscore.js indexBy mixin
/**
* Underscore function that combines _.find and _.indexOf
* Source: https://github.com/documentcloud/underscore/issues/413
*
* _.indexBy([2, 6, 4, 7, 9, 0], function(num) {
* return num % 2 === 1;
* });
* => 3
*/
@jpfuentes2
jpfuentes2 / rbenv-install-system-wide.sh
Created March 8, 2012 19:47
CentOS: rbenv install and system wide install
#!/bin/bash
# CentOS rbenv system wide installation script
# Forked from https://gist.github.com/1237417
# Installs rbenv system wide on CentOS 5/6, also allows single user installs.
# Install pre-requirements
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel \
make bzip2 autoconf automake libtool bison iconv-devel git-core
@mbostock
mbostock / .block
Last active May 21, 2019 14:04
Hive Plot (Links)
license: gpl-3.0
@mbostock
mbostock / .block
Last active April 25, 2016 23:02 — forked from mbostock/.block
Hive Plot (Areas)
license: gpl-3.0
@davidwood
davidwood / gist:3767666
Created September 22, 2012 20:13
Hash password
var crypto = require('crypto'),
saltLength = 10,
algorithm = 'sha1';
function hash(password) {
var salt = crypto.randomBytes(10).toString('binary'),
hash = crypto.createHmac(algorithm, salt).update(password).digest();
return { hash: hash, salt: salt };
}
@gordonbrander
gordonbrander / derp-modules.js
Created October 9, 2012 22:06
Simple, tiny, dumb JavaScript Modules
// Simple, tiny, dumb module definitions for Browser JavaScript.
//
// What it does:
//
// * Tiny enough to include anywhere. Intended as a shim for delivering
// browser builds of your library to folks who don't want to use script loaders.
// * Exports modules to `__modules__`, a namespace on the global object.
// This is an improvement over typical browser code, which pollutes the
// global object.
// * Prettier and more robust than the
@martinnormark
martinnormark / PopoverView.js
Last active November 29, 2016 10:58
Backbone implementation of the Twitter Bootstrap Popover view
(function () {
App.Views.PopoverView = Backbone.View.extend({
initialize: function (options) {
_.bindAll(this, "render", "setContent", "show", "hide", "toggle", "destroy", "remove");
this.offsetTop = 30;
this.offsetLeft = 0;