Skip to content

Instantly share code, notes, and snippets.

View travist's full-sized avatar

Travis Tidwell travist

View GitHub Profile
@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: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: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: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: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 / 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 / timezones.json
Created July 30, 2015 15:23
Microsoft API TimeZones
[
{
"timezone": "Afghanistan Standard Time",
"display": "(GMT+04:30) Kabul"
},
{
"timezone": "Alaskan Standard Time",
"display": "(GMT-09:00) Alaska"
},
{
@travist
travist / middleware.js
Last active January 28, 2016 03:22
install.md
npm install -g formio/formio-cli#master
formio bind POST https://myapp.form.io/myform ./middleware.js
@travist
travist / selfdescriptivenum.js
Created January 9, 2016 02:41
Self Descriptive number solution
for (var i = 0; i < 9999999999; i++) {
var num = ("0000000000" + i).substr(-10,10);
var counts = [0,0,0,0,0,0,0,0,0,0];
for (var j = 0; j < 10; j++) {
counts[num[j]]++;
}
if (counts.join('') === num) {
console.log('Winner!' + num);
break;
}
@travist
travist / middleware.js
Last active June 6, 2020 02:29
Remote Middleware Example
module.exports = function(req, next) {
// Append .example.com to emails for testing purposes...
req.body.data.email += '.example.com';
next(null);
};