Skip to content

Instantly share code, notes, and snippets.

View adambiggs's full-sized avatar
👋
We're hiring!

Adam Biggs adambiggs

👋
We're hiring!
View GitHub Profile
Spine = require('spine')
Accounting = require('accounting')
class Charge extends Spine.Model
@key 'amount', required: true
@key 'description'
@key 'token'
@key 'status'
@key 'outgoing', Boolean
@key 'created_at', Date
@maccman
maccman / canvas.physics.coffee
Created April 11, 2013 02:52
A canvas physics engine in 160 lines of CoffeeScript.
class Point
constructor: (@x = 0, @y = 0) ->
if isNaN(@x) or isNaN(@y)
throw new Error('Invalid coords')
add: (point) ->
@x += point.x
@y += point.y
subtract: (point) ->
"chuck this in ~/.vim/nerdtree_plugin/coffee_filter.vim (see what I did there?)
if exists("g:loaded_nerdtree_js_filter")
finish
endif
let g:loaded_nerdtree_js_filter = 1
let s:extMatch = '\.\(js\|js\.map\)$'
call g:NERDTree.AddPathFilter("FilterCoffee")
const _ = require('lodash');
const Busboy = require('busboy');
const getContentType = (event) => {
// Serverless offline is passing 'Content-Type', AWS is passing 'content-type'
let contentType = _.get(event, 'headers.content-type');
if (!contentType) contentType = _.get(event, 'headers.Content-Type');
return contentType;
};
# IMPORTANT: this example is potentially out of date. The latest version can be found here: https://github.com/papertrail/remote_syslog2/blob/master/examples/remote_syslog.ebextensions.config
# See http://help.papertrailapp.com/kb/hosting-services/aws-elastic-beanstalk/
# Usage:
# - replace <VERSION> with the version of remote_syslog2 you want to use. Example: .../download/v0.14/remote_syslog_linux_amd64.tar.gz
# - replace <YOUR-TRACKED-FILES> with the files you want to monitor for new log lines. Example: - /var/log/httpd/access_log
# - replace <YOUR-APP-NAME> with the name of the application
# - replace <YOUR-LOG-DESTINATION> and <YOUR-PORT-NUMBER> with the values shown under log destinations: https://papertrailapp.com/account/destinations
sources:
@mackensen
mackensen / gulpfile.js
Created October 21, 2014 15:35
This is an example gulpfile for managing a WordPress theme with a custom (non-LESS) CSS stylesheet. It includes tools for bumping the version and updating the version references.
// List of modules used.
var gulp = require('gulp'),
bump = require('gulp-bump'), // Generates new version.
argv = require('yargs')
.default('release', 'patch')
.argv, // CLI parser.
fs = require('fs'), // Used by bump.
semver = require('semver'), // Used by bump.
git = require('gulp-git'), // Git wrapper.
jshint = require('gulp-jshint'), // Lints JS.
@tlrobinson
tlrobinson / post-receive
Last active December 7, 2022 08:15
Super simple git post-receive hook for Node.js + nvm + npm + node-foreman + init (Ubuntu) deployment
#!/usr/bin/env bash
set -u
set -e
export GIT_WORK_TREE="/var/www/example.com"
export NODE_VERSION="0.10"
echo "--> Checking out..."
git checkout -f
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@deiu
deiu / webcryptoapi.html
Last active January 7, 2024 21:18
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
@christian-blades-cb
christian-blades-cb / vpn_fix.sh
Last active January 23, 2024 15:09
Fix issues with using boot2docker with Cisco's AnyConnect
#!/usr/bin/env bash
# If you're using docker-machine, call this script with your
# environment name
# Ex: ./vpn_fix dev
DEFAULTVM="boot2docker-vm"
[ $(id -u) = 0 ] || { echo "You must be root (or use 'sudo')" ; exit 1; }
report_success ()