#Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a simple/configurable rake task that generates some random fake data for the app (using faker) at various sizes | |
# NOTE: requires the faker or ffaker gem | |
# sudo gem install faker - http://faker.rubyforge.org | |
# OR | |
# sudo gem install ffaker - http://github.com/EmmanuelOga/ffaker | |
require 'faker' | |
class Fakeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(newDoc, oldDoc, userCtx) { | |
if (userCtx.roles.indexOf('_admin') !== -1) { | |
return; | |
} else { | |
throw({forbidden: 'Only admins may edit the database'}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is an event.d (upstart) script to keep monit running. | |
# To install disable the old way of doing things: | |
# | |
# /etc/init.d/monit stop && update-rc.d -f monit remove | |
# | |
# then put this script here: | |
# | |
# /etc/init/monit.conf | |
# | |
# and reload upstart configuration: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function keepTrying(otherArgs, promise) { | |
promise = promise||new Promise(); | |
// try doing the important thing | |
if(success) { | |
promise.resolve(result); | |
} else { | |
setTimeout(function() { | |
keepTrying(otherArgs, promise); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redcar { | |
if [ -f plugin.rb ]; then | |
echo "Found 'plugin.rb'!" | |
echo "Assuming this directory is a Redcar plugin." | |
echo "Running with --show-log, --log-level=debug, and without --fork." | |
wrapped_redcar --show-log --log-level=debug $* | |
elif [ -f lib/redcar.rb ] && [ -f bin/redcar ]; then | |
echo "Found 'lib/redcar.rb' and 'bin/redcar'!" | |
echo "Assuming this is the Redcar application directory." | |
echo "Running with --show-log, --log-level=debug, and without --fork." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_run_options[:pty] = true | |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
require 'capistrano' | |
require 'rubygems' | |
require 'railsless-deploy' | |
set :application, "vault42.org" | |
set :deploy_to, "/usr/local/www/#{application}" | |
set :backup_dir, "/home/tomislav/backup" | |
set :use_sudo, false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* HTML5 ✰ Boilerplate | |
* | |
* What follows is the result of much research on cross-browser styling. | |
* Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal, | |
* Kroc Camen, and the H5BP dev community and team. | |
* | |
* Detailed information about this CSS: h5bp.com/css | |
* | |
* ==|== normalize ========================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original - @Gozola. This is a reimplemented version (with a few bug fixes). | |
window.WeakMap = window.WeakMap || (function () { | |
var privates = Name() | |
return { | |
get: function (key, fallback) { | |
var store = privates(key) | |
return store.hasOwnProperty("value") ? | |
store.value : fallback | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findPerpendicularDistance = ( point, line ) -> | |
[pointX,pointY] = point[0..1] | |
lineStart = x: line[0][0], y: line[0][1] | |
lineEnd = x: line[1][0], y: line[1][1] | |
slope = ( lineEnd.y - lineStart.y ) / ( lineEnd.x - lineStart.x ) | |
intercept = lineStart.y - ( slope * lineStart.x ) | |
Math.abs( slope * pointX - pointY + intercept ) / Math.sqrt( Math.pow( slope, 2) + 1) | |
douglasPeucker = ( points, epsilon ) -> | |
maxIndex = maxDistance = 0 |
OlderNewer