Skip to content

Instantly share code, notes, and snippets.

@craigbeck
craigbeck / ingredient.pegjs
Created January 2, 2015 07:51
PEG.js syntax for parising ingredient line of recipe
start
= lines
lines
= line+
line
= val:ingredientLine "/n"? { return val }
@craigbeck
craigbeck / sigtest.sh
Created November 15, 2014 06:28
signals in bash
#!/bin/sh -e
function do_exit() {
echo
echo "exiting..."
exit 0
}
trap do_exit INT
@craigbeck
craigbeck / Vagrantfile.rb
Created November 14, 2014 21:31
Fedora/Rails/Docker Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
RAILS_PORT = 3000
RVM_RUBY_VERSION = "1.9.3-p448"
@craigbeck
craigbeck / install.sh
Last active August 29, 2015 14:09
install docker on Fedora/RHEL
sudo yum -y install docker-io && \
sudo service docker start && \
sudo chkconfig docker on
# add vagrant user to docker group so sudo not required
sudo usermod -aG docker vagrant
# must logout and login again for gorup to be applied
# verify docker
# sudo docker run -i -t fedora /bin/bash
@craigbeck
craigbeck / 0_reuse_code.js
Created July 15, 2014 06:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@craigbeck
craigbeck / cors-example.java
Created July 10, 2014 23:43
Enable cross origin requests (CORS) using the Jersey CrossOriginFilter to Dropwizard 0.7.1
// in run method of your application:
final FilterRegistration.Dynamic cors = environment.servlets().addFilter("crossOriginRequsts", CrossOriginFilter.class);
cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

Keybase proof

I hereby claim:

  • I am craigbeck on github.
  • I am keymaster (https://keybase.io/keymaster) on keybase.
  • I have a public key whose fingerprint is 9690 9DA8 AE6E 9444 959E D148 D9E6 0298 0B77 2938

To claim this, I am signing this object:

@craigbeck
craigbeck / license.txt
Created September 11, 2013 17:57
Blessing License
The author disclaims copyright to this source code. In place of a legal
notice, here is a blessing:
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.
It is based on a snipped found in this project:
https://github.com/martinblech/mimerender
@craigbeck
craigbeck / find-builds.sh
Last active December 22, 2015 11:58
find files by pattern but don't look in certain directories
#!/bin/sh
# as @nobody
find . -not \( -path */archive -prune \) -name *-Linux-*.tar.gz
'use strict';
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);