Skip to content

Instantly share code, notes, and snippets.

@UnquietCode
UnquietCode / Lava Lamp RNG.md
Created April 19, 2015 18:52
Lava Lamp Random Number Generator

Lava Lamp Random Number Generator

(extracted from the now defunct SGI project at http://lavarand.sgi.com/cgi-bin/how.cgi via the magical Internet Archive Wayback Machine)

Lava Lamps can be used as a source of randomness, which can be used to establish a random number generator. The output of the RNG can then be consumed by various computer applications.

Step 1: Establish a chaotic system

(Set up Lava Lite® lamps in a machine room.)

@branneman
branneman / better-nodejs-require-paths.md
Last active April 27, 2024 04:16
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@defunctzombie
defunctzombie / browser.md
Last active April 10, 2024 17:45
browser field spec for package.json
@dcuddeback
dcuddeback / after_commit_with_transactional_fixtures.rb
Created August 25, 2011 01:36
Patch ActiveRecord to fire after_commit callbacks at the appropriate time during tests with transactional fixtures.
module ActiveRecord
module ConnectionAdapters
module DatabaseStatements
#
# Run the normal transaction method; when it's done, check to see if there
# is exactly one open transaction. If so, that's the transactional
# fixtures transaction; from the model's standpoint, the completed
# transaction is the real deal. Send commit callbacks to models.
#
# If the transaction block raises a Rollback, we need to know, so we don't