Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* An improvised Gist from
* https://gist.github.com/zmsaunders/5619519
* https://gist.github.com/garagesocial/6059962
*/
App::after(function($request, $response)
{
if(App::Environment() != 'local')
# Optimized for writes, sort on read
# LVC
redis.hset("bonds|1", "bid_price", 96.01)
redis.hset("bonds|1", "ask_price", 97.53)
redis.hset("bonds|2", "bid_price", 95.50)
redis.hset("bonds|2", "ask_price", 98.25)
redis.sadd("bond_ids", 1)
redis.sadd("bond_ids", 2)
@michaellouieloria
michaellouieloria / gist:844a6305d31771cc5db9
Created September 18, 2014 05:25
Gulp Uncss multiple files
npm install glob --save-dev
npm install gulp-uncss --save-dev
var uncss = require('gulp-uncss');
var glob = require('glob');
gulp.task('uncss', function() {
gulp.src('public/css/dirty.css')
.pipe(uncss({
html: glob.sync('app/views/**/*.*')
@michaellouieloria
michaellouieloria / gist:0ff4376475b68e1e78c2
Created September 18, 2014 08:04
PDFtk commands to create fdf and fill form
create fdf
pdftk form.pdf generate_fdf output data.fdf
fill form
pdftk form.pdf fill_form data.fdf output form_with_data.pdf
@michaellouieloria
michaellouieloria / gist:0785f636985477c8da7e
Created September 18, 2014 10:57
Testing in Laravel which needs Sentry authentication
public function setUp()
{
parent::setUp();
$user = Sentry::getUserProvider()->findById(1);
Sentry::login($user);
}
public function tearDown()
{
Sentry::logout();
@michaellouieloria
michaellouieloria / gist:af4b462cd7166fde22eb
Last active August 29, 2015 14:06
Install Django in Ubuntu
sudo apt-get install python-setuptools
sudo easy_install virtualenv
virtualenv --no-site-packages django
source django/bin/activate
cd django
easy_install django
django-admin.py startproject myproject
cd myproject
python manage.py runserver [::]:8000
@michaellouieloria
michaellouieloria / gist:8a2066e05499614e7892
Created October 8, 2014 05:37
Nginx 1.6.2 breaking PHP site solution
http://superuser.com/questions/814726/error-install-nginx-version-1-6-2-in-ubuntu-14-04
add line
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
example:
location ~ \.php$ {
try_files $uri =404;
# -*- 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|
config.vm.box = "hashicorp/precise64"
config.vm.provision "docker" do |d|
require 'mongoid'
Mongoid::Config.instance.from_hash({"database" => "oid"})
class Tweeter
include Mongoid::Document
field :user
embeds_many :tweets
end
@michaellouieloria
michaellouieloria / gist:f2ee272d1709a0e80f71
Last active August 4, 2019 12:10
Phantomjs in Facebook PHP webdriver
Use phantomjs. Start it:
$ phantomjs --webdriver=127.0.0.1:8910
Use:
require_once('lib/__init__.php');
$host = '127.0.0.1:8910';
$capabilities = array(
WebDriverCapabilityType::BROWSER_NAME => 'phantomjs',