Skip to content

Instantly share code, notes, and snippets.

@mppatterson
mppatterson / gist:9134550
Created February 21, 2014 13:50
Use Different Ports on Apache
<VirtualHost *:80>
DocumentRoot /home/user/app/
<Directory /home/user/app/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
@mppatterson
mppatterson / install
Created February 21, 2014 20:00
Install Phabricator on Ubuntu
wget http://www.phabricator.com/rsrc/install/install_ubuntu.sh
bash install_ubuntu.sh
sudo vim /etc/apache2/sites-enabled/000-default
################
<VirtualHost *>
# Change this to the domain which points to your host.
ServerName codereview.localhost
@mppatterson
mppatterson / connect-to-analytics
Last active August 29, 2015 13:58
How to Connect to Google Analytics API
Login to the Google account which has access to your analytics
Create an OAuth key on https://console.developers.google.com/
Store the keyfile in your app (and add it to gitignore)
Add your "xxx@developer.gserviceaccount.com" account to Google Analytics as a "Read & Analyze" user
Use the code from https://developers.google.com/analytics/solutions/articles/hello-analytics-api to get started
// Sample from: https://developers.google.com/analytics/solutions/articles/hello-analytics-api
// Download the API Client on https://github.com/google/google-api-php-client/tree/master/src
// Require 'Google/Client.php' and set your include path to include the src dir, i.e.:
set_include_path(join(":", array(get_include_path(),
YOUR_APP_PATH.'/google-api-php-client/src',
)));
// Setup the service object
@mppatterson
mppatterson / google-analytics-service-object-php
Created April 2, 2014 14:12
Connecting to Google Analytics via a service object (server-to-server)
// Setup the service object
$client_id = 'xxx.apps.googleusercontent.com';
$service_account_name = 'xxx@developer.gserviceaccount.com';
$client_secret = 'notasecret';
$keyfile = 'path_to_your_key.p12';
$client->setClientSecret($client_secret);
$client->setAssertionCredentials(
new Google_Auth_AssertionCredentials(
@mppatterson
mppatterson / gist:9983408
Created April 4, 2014 21:22
Install phantomjs on linux
mkdir phantomjs
cd phantomjs
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2
bunzip2 phantomjs-1.9.7-linux-x86_64.tar.bz2
tar -xf phantomjs-1.9.7-linux-x86_64.tar
mv phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/
sudo mv phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/
@mppatterson
mppatterson / bash_aliases
Last active August 29, 2015 14:03
All of the bash aliases I use on a regular basis
function rails(){
bundle exec spring rails "$@"
}
function rake(){
bundle exec spring rake "$@"
}
function rspec(){
bundle exec spring rspec "$@"
@mppatterson
mppatterson / gist:186cba857fa63f55f96b
Last active August 29, 2015 14:04
Set clock to CST on Ubuntu
# Painful enough on multiple occasions to keep on file!
sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
@mppatterson
mppatterson / .gitconfig
Last active August 29, 2015 14:04
Git Aliaes
# From: http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
# color {{{
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = red reverse
@mppatterson
mppatterson / install.sh
Created October 10, 2014 01:18
Install Kohana Requirements
# Install Kohana Requirements
sudo apt-get install php-pear
sudo apt-get install php5-dev libcurl3-openssl-dev
sudo pecl install pecl_http
sudo apt-get install php5-mcrypt
echo "==================="
echo "Manual instructions"