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: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
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
sudo apt-get install libmysqlclient-dev
sudo apt-get install libsphinxclient-dev
Get the tar
Configure the source code: ./configure –prefix=/usr/local
Run: make
Run: sudo make install
sudo pear install pecl/sphinx
/** @jsx React.DOM */
var LopMonHoc = React.createClass({
getInitialState: function(){
return {data: []}
},
loadData: function(){
$.ajax({
url: '/daotao/lops',
success: function(data){