Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / pre-commit
Created January 5, 2012 19:08 — forked from miketaylr/pre-commit
#!/bin/bash
# pre-commit hook to prevent html5 video or audio files from being checked
# into the repo. because large binary files in a git repo sucks. bad.
media_files=$(git diff --cached --name-only --diff-filter=ACR | \
egrep -i '\.(webm|mp4|ogg|mp3|ogv|m4v|avi|vp8|mov|oga|mp1|mp2|mpeg|3gp|wav)$')
if [[ "$media_files" ]]; then
echo 'Commit failed. Are you trying to check in media files into the repo?'
exit 1
@Protonk
Protonk / approx.js
Last active December 16, 2015 13:39
Hey guys, I totally fixed that floating point comparison problem.
var approx = function(a, b, eps) {
// http://en.wikipedia.org/wiki/Machine_epsilon
eps = eps || 5e-16;
return |a - b| < eps;
}
approx(0.1 * 0.2, 0.02) // true
@rwaldron
rwaldron / raf.js
Last active March 1, 2018 10:04
requestAnimationFrame, browser prefix detection
var rAF = "equestAnimationFrame";
window["r"+rAF] = window["r"+rAF] ||
window["webkitR"+rAF] ||
window["mozR"+rAF] ||
window["msR"+rAF] ||
window["oR"+rAF];
// A list
@nzakas
nzakas / gist:1164118
Created August 23, 2011 01:47
Ant target for autogenerating changelog based on Git tags
<!--
Ant target for autogenerating a changelog based on Git tags
Workflow:
1. Do all of your checkins for a given version.
2. When you're ready to officially create a new version, tag it using git tag, such as "git tag v0.3.0".
3. If you don't already have a file named CHANGELOG in the root directory, make one.
4. Run "ant changelog.update"
@brandenhall
brandenhall / Sample Usage
Created December 7, 2011 20:28
Secret Knock Detector module
// Shave-and-a-haircut, two bits! In the upper left corner
var secret = [{delay:0.5, x:0, y:0, radius:200},
{delay:0.25, x:0, y:0, radius:200},
{delay:0.25, x:0, y:0, radius:200},
{delay:0.5, x:0, y:0, radius:200},
{delay:1, x:0, y:0, radius:200},
{delay:0.5, x:0, y:0, radius:200},
{delay:0, x:0, y:0, radius:200}];
function allowInside() {

Node.js Resources

What is node.js?

Node.js is just JavaScript running on the server side. That's it. That's all there is to it.

Express

  • Express Docs, if you want to get started and already know JavaScript this is the place to be
@deadalusai
deadalusai / tasks.json
Last active September 23, 2023 03:18
VS Code tasks.json for Rust/Cargo
/*
Before using this tasks.json you may like to consider trying one of the following VS Code extensions:
rust-analyzer
Marketplace: https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer
Source: https://github.com/rust-analyzer/rust-analyzer
rls
Marketplace: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust
Source: https://github.com/rust-lang/rls-vscode
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//