Skip to content

Instantly share code, notes, and snippets.

@stevelaz
stevelaz / post-commit
Created July 3, 2014 15:24
git post-commit hook with programmerexcuses.com output
echo "You just commited the following:"
git log -1 HEAD
echo "----------------------------------------------"
echo ""
curl -s programmerexcuses.com | sed -n '/<a.*>/{s/<[^>]*>//g;p}'
echo ""
require 'statsd'
class RackGcHeapInstrumentation
def initialize(app)
@app = app
@statsd = Statsd.new('localhost', 8125)
end
def call(env)
GC.enable # Ensure garbage colletion is enabled
ret = @app.call(env)
@lsmith77
lsmith77 / gist:648702
Created October 27, 2010 09:04
multiplexer to json-ify any controller as well as call multiple separate controllers via one request
<?php
namespace Application\FooBundle\Controller;
class MultiplexController
{
/**
* Request
* @var Symfony\Component\HttpFoundation\Request
*/
# add your user to www-data and vise versa
sudo usermod -a -G www-data myusername
sudo usermod -a -G myusername www-data
# override umask in ~/.bashrc and /etc/init.d/apache2
umask 002
#restart
@makeusabrew
makeusabrew / 1) uglify.js
Created October 25, 2011 11:54
Watch a specified directory's JavaScript files and recompile a specified output file if any changes are detected
/**
* Sample usage - note that the trailing slash on the watch directory is important!
*
* node uglify.js /path/to/my/src/directory/ /path/to/my/output/file.js
*/
var jsp = require('uglify-js').parser,
pro = require('uglify-js').uglify,
fs = require('fs');
#!/usr/bin/env python
import sys
import pprint
from time import sleep
import twitter
import redis
API_CREDENTIALS = {
@grahamc
grahamc / call.php
Created December 6, 2011 15:45
Robocall a whole bunch of people from PayPal about this Regretsy disaster.
<?php
// Note: CA state law says no robocalls before 9AM, so wait until 12PM EST.
$sid = 'Your SID';
$token = 'Your Token';
$telephoneNumber = 'Your Telephone Number, the one that Twilio gives you.';
$client = new Services_Twilio($sid, $token);
@vindia
vindia / gist:2133015
Created March 20, 2012 08:54
Campfire Notification for Capistrano deploys
namespace :campfire do
desc "Notify deploy"
task :notify do
room_id = 123456 # Room ID for the Campfire Room you want this notification to appear in
token = ENV['CAMPFIRE_TOKEN'] || 'YOUR_CAMPFIRE_TOKEN' # Enter your campfire token here
if (token == 'YOUR_CAMPFIRE_TOKEN')
user_name_is = `whoami` + ' is'
else
user_name_is = "I am"
@davedevelopment
davedevelopment / app_bootstrap.php
Created November 26, 2012 23:45
Silex Route Helpers
<?php
use Silex\Application;
use Demo\Entity\Post;
use Demo\Controller\PostController;
$app = new Application;
$app['route_class'] = 'CustomRoute';
$app['dispatcher']->addSubscriber(new TemplateRenderingListener($app));
@marcy-terui
marcy-terui / file0.txt
Last active December 9, 2015 11:12
HubotにOpsWorksのDeploymentを監視させてSlackに流す ref: http://qiita.com/Marcy/items/ae46c336b9956d2bf8d0
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"opsworks:Describe*"
],
"Resource": [
"*"