Skip to content

Instantly share code, notes, and snippets.

View BRMatt's full-sized avatar

Matt Button BRMatt

View GitHub Profile
@BRMatt
BRMatt / di.rb
Created December 17, 2013 12:13
module DependencyInjection
def inject(subject, *deps)
deps.each do |dep|
subject.send(:"#{dep}=", send(dep))
end
subject
end
end
<?php
function is_protected_post( $post_id = NULL ) {
global $post;
if ( $post_id === NULL )
$post_id = $post->ID;
foreach ( array(Memberful_Post_ACL::PRODUCT, Memberful_Post_ACL::SUBSCRIPTION) as $check ) {
@BRMatt
BRMatt / repo-gems.txt
Last active December 27, 2015 01:49
devise versions
Resolving dependencies... [86/1812]
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.7.9)
Using atomic (1.1.12)
Using thread_safe (0.1.2)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
require 'resque'
require 'resque_scheduler'
require 'sidekiq'
ENV['REDIS_URL'] = ENV['REDISTOGO_URL'] if ENV['REDISTOGO_URL']
delayed_jobs = Resque.delayed_queue_peek(0, 5000)
to_insert = delayed_jobs.inject([]) do |result, timestamp|
jobs_at_time = Resque.delayed_timestamp_peek(timestamp, 0, 50000).map do |hash|
/**
Title: White Hacker News
URL: http://stylebot.me/styles/55
Author: http://stylebot.me/users/vinodpillai
**/
body {
background-color: fff;
}
@BRMatt
BRMatt / console
Created July 13, 2012 17:21
A faster vagrant console
#/bin/bash
# Make sure we're in the same folder as the vagrant file
SOURCE="${BASH_SOURCE[0]}"
DIR="$( dirname "$SOURCE" )"
while [ -h "$SOURCE" ]
do
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
ActiveSupport::Cache::Store.instrument = true
ActiveSupport::Notifications.subscribe do |name, start, finish, id, payload|
Rails.logger.debug(["notification:", name, start, finish, id, payload].join(" "))
end
# .profile for bash users.
# Executed on all machines because we do not permit the use of /bin/bash
# as a user's login shell. Note, however, on Linux PCs, /bin/sh is the
# same as /bin/bash.
case $cputype in
linux*)
SHELL=/bin/bash
export SHELL
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
matt@matt-laptop:~$ tree /usr/share/php/PHPUnit/
/usr/share/php/PHPUnit/
├── Autoload.php
├── Extensions
│   ├── Database
│   │   ├── AbstractTester.php
│   │   ├── Constraint
│   │   │   ├── DataSetIsEqual.php
│   │   │   └── TableIsEqual.php
│   │   ├── DataSet