Skip to content

Instantly share code, notes, and snippets.

View bayleedev's full-sized avatar
🍿

Baylee Schmeisser bayleedev

🍿
View GitHub Profile
lastWeek = new Date('2014-05-07');
db.git_queue.find({notified_build: {$ne: null}, finished_build: {$ne: null}}).forEach(function(el) {
if (new Date(el.notified_build) > lastWeek) {
total_ms = new Date(el.finished_build) - new Date(el.notified_build);
total_secs = total_ms / 1000;
total_mins = total_secs / 60;
print(total_mins);
}
});
total = count = max = 0;
min = 999;
lastWeek = new Date('2014-05-07');
db.git_queue.find({status: {$ne: 'error'}, notified_build: {$ne: null}, finished_build: {$ne: null}}).forEach(function(el) {
if (new Date(el.notified_build) > lastWeek) {
total_ms = new Date(el.finished_build) - new Date(el.notified_build);
total_secs = total_ms / 1000;
total_mins = total_secs / 60;
count++;
total += total_mins;
<?php
$options = array(
'conditions' => array(
'type' => 'json',
'accept' => array('application/json'),
),
);
class Hubot
listen_for: {}
# @script_user
respond: (regex, callback) ->
@listen_for[regex] = callback
# @test_user
# @return bool Phrases matches one of the respond to callbacks.
@bayleedev
bayleedev / codesniff.sh
Last active August 29, 2015 14:03
Report PHP CodeSniffer errors and warnings to graphite.
GRAPHITE_PORT=2003
GRAPHITE_SERVER="127.0.0.1"
ERROR_PATH="project.codesniff.errors"
WARNING_PATH="project.codesniff.warnings"
APP_PATH="/var/www/apps/project/app"
APP_STANDARD="PEAR"
SETUP="cd ${APP_PATH} && git fetch origin > /dev/null 2>&1 && git reset --hard origin/dev > /dev/null 2>&1 && php composer.phar install > /dev/null 2>&1"
RESPONSE=`${SETUP} && ./bin/phpcs --standard=${APP_STANDARD} --report=summary ./ | grep TOTAL | awk -v ERROR_PATH=${ERROR_PATH} -v WARNING_PATH=${WARNING_PATH} '{ print ERROR_PATH,$4, strftime("%s") "\\\\n" WARNING_PATH, $7,strftime("%s") }'`
@bayleedev
bayleedev / repl.php
Created July 7, 2014 17:53
A simple php repl.
<?php
class Repl {
public function run() {
while (true) {
echo '>> ';
echo eval($this->input()) . PHP_EOL;
}
}
_.mixin
empty: (item) ->
item instanceof Array && item.length == 0 || '0' == item || !item
require 'pry'
class SolrRequest
attr_accessor :params
def initialize(params = {})
@params = params
end
require 'pry' # who doesn't want pry?
# Adds a `find` method to every model
module Finder
attr_accessor :types
def queries(*args)
@types = args
end
class Line
constructor: (one, two) ->
@one = one
@two = two
m: ->
(@two.y - @one.y) / (@two.x - @one.x)
b: ->