Skip to content

Instantly share code, notes, and snippets.

class Singleton
instance = null
@get = ->
instance ?= value
module.exports = Singleton.get()
<!DOCTYPE html>
<html>
<head>
<title>Clicker</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<h1>Welcome to Clicker!</h1>
<p>You clicked the button <span id="count">0</span> times.</p>
<button id="click-me">Click me</button>
@blackcoat
blackcoat / Cakefile
Last active August 31, 2017 09:22
Sample Mocha test runner in CoffeeScript
# Required to run commands in the shell
# @see http://nodejs.org/api/child_process.html
{spawn} = require 'child_process'
# A basic command runner
run = (cmd, args) ->
console.log cmd, args.join ' '
spawn cmd, args, stdio: 'inherit'
# Set up default arguments for running our Mocha tests.
@blackcoat
blackcoat / gist:3240588
Created August 2, 2012 20:57
Meteor crashes with should.js in Mocha tests
$ meteor
[[[[[ /Library/WebServer/Documents/personal/test-game ]]]]]
Running on: http://localhost:3000/
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
ReferenceError: require is not defined
at app/test/player.js:5:1
@blackcoat
blackcoat / deploy.rb
Created May 4, 2012 18:53 — forked from gabetax/deploy.rb
Capistrano deploy.rb for Rails 3.2 apps
# http://gembundler.com/deploying.html
require 'bundler/capistrano'
# http://guides.rubyonrails.org/asset_pipeline.html
load 'deploy/assets'
# http://beginrescueend.com/integration/capistrano/
# Also add rvm-capistrano to your Gemfile
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_type, :system # Copy the exact line. I really mean :system here
@blackcoat
blackcoat / index.php
Created August 24, 2011 20:01
CodeIgniter 1.7.x system detection
<?php
# This is an excerpt from a modified version of the CodeIgniter front controller, index.php
/*
|---------------------------------------------------------------
| SYSTEM FOLDER NAME
|---------------------------------------------------------------
|
| This variable must contain the name of your "system" folder.