Skip to content

Instantly share code, notes, and snippets.

View travist's full-sized avatar

Travis Tidwell travist

View GitHub Profile
@travist
travist / Gruntfile.js
Last active August 29, 2015 14:08
Gruntfile to easily deploy code changes in a project to multiple servers as you change code.
module.exports = function(grunt) {
// The hosts we wish to deploy to.
var hosts = ['server1', 'server2'];
// The folders to watch.
var watchFolder = 'src/**/*';
// Rsync src folder.
var rsyncSRC = './src/';
@travist
travist / gist:6437b0709f59e0009184
Created October 2, 2014 04:06
Upgrade Node.js & NPM
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
sudo npm install -g npm
@travist
travist / gist:5659115914b9bdd4ba26
Last active August 29, 2015 14:02
Installing xdebug on Ubuntu.

Install xdebug with PECL.

sudo pecl install xdebug

Create the following file @ /etc/php5/conf.d/xdebug.ini

zend_extension = /usr/lib/php5/20090626/xdebug.so
@travist
travist / gist:11381206
Last active August 29, 2015 14:00
Shell Command line to return all of PHP configurations in a list.
php -i | grep 'Configure Command =>' | awk '{for(i=5; i<=NF; i++) {print substr($i, 2, (length($i) - 2))}}'
@travist
travist / gist:9094159
Created February 19, 2014 15:21
Bitmap to lookup word indexes and offsets.
0 4 8 1 1 2 2 2 3 3 4 4 4
2 6 0 4 8 2 6 0 4 8
1 0000
2 0000
3 0000
4 0000
5 0000
6 0000
7 0000
8 0000
@travist
travist / gist:3890434
Created October 15, 2012 01:47
OSM Player minimal code.
<html>
<head>
<title>Open Standard Media (OSM) Player: PHP Demo</title>
<script type='text/javascript' src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dark-hive/jquery-ui.css">
<script type="text/javascript" src="/osmplayer/bin/osmplayer.compressed.js"></script>
<link rel="stylesheet" href="/osmplayer/templates/default/css/osmplayer_default.css">
<script type="text/javascript" src="/osmplayer/templates/default/osmplayer.default.js"></script>
@travist
travist / gist:2914228
Created June 12, 2012 02:48
Ignoring a modified settings.php (Drupal) file if managed in GIT.
git update-index --assume-unchanged sites/default/settings.php
@travist
travist / gist:2863998
Last active October 5, 2015 19:37
Dynamically add javascript to your page
// Conditionally loads scripts.
var loadScripts = function(params) {
// Iterate over each source.
var eachSource = function(callback) {
if (typeof params.scripts == 'string') {
callback(params.scripts);
}
else {
for (var i=0; i < params.scripts.length; i++) {
@travist
travist / gist:2694333
Created May 14, 2012 14:31
To use weinre to debug mobile Drupal sites.
/**
* Add this to your module file.
*/
function mymodule_init() {
drupal_add_js('http://192.168.1.5:8080/target/target-script-min.js#anonymous', array(
'type' => 'external',
'group' => JS_LIBRARY,
'weight' => -1000
));
}
@travist
travist / gist:2562314
Created April 30, 2012 20:10
Warning: remote port forwarding failed for listen port 9000
Do the following to fix this error.
ttidwell@a:~:->$ sudo lsof|grep 9000
sshd 31533 ttidwell 9u IPv6 506614 0t0 TCP [::1]:9000 (LISTEN)
sshd 31533 ttidwell 10u IPv4 506615 0t0 TCP localhost:9000 (LISTEN)
ttidwell@a:~:->$ kill 31533