Skip to content

Instantly share code, notes, and snippets.

View mitchellhislop's full-sized avatar

Mitchell Hislop mitchellhislop

View GitHub Profile
@mitchellhislop
mitchellhislop / directions_view.php
Created December 7, 2010 19:35
PHP Google Directions API
<head>
<title>Your Trail</title>
</head>
<body>
<h1>Your Trail</h1>
<?php
echo "<br />";
echo '<h1>Directions:</h1>';
echo '<h2>Start: '.$origin.'</h2>';
foreach ($directions->route as $route)
@mitchellhislop
mitchellhislop / gist:975092
Created May 16, 2011 19:09
Getting PHPStorm to autocomplete CodeIgniter 2.0
* @property CI_DB_active_record $db
* @property CI_DB_forge $dbforge
* @property CI_Benchmark $benchmark
* @property CI_Calendar $calendar
* @property CI_Cart $cart
* @property CI_Config $config
* @property CI_Controller $controller
* @property CI_Email $email
* @property CI_Encrypt $encrypt
* @property CI_Exceptions $exceptions
@mitchellhislop
mitchellhislop / all_sites_header.html
Last active June 22, 2018 19:57
Please insert content of all_sites_header.html between the <head> tags on the .de site
<link rel="alternate" href="https://tensewatch.com" hreflang="en-us" />
<link rel="alternate" href="https://tensewatch.ca" hreflang="en-ca" />
<link rel="alternate" href="https://www.tensewatch.de" hreflang="de-de" />
<link rel="alternate" href="https://tensewatch.com" hreflang="en" />
@mitchellhislop
mitchellhislop / removechars.sql
Created November 29, 2011 22:24
Removing special characters in MySQL
# FIRST, REPLACE UTF-8 characters.
UPDATE `t` SET `c` = REPLACE(`c`, 0xE28098, "'");
UPDATE `t` SET `c` = REPLACE(`c`, 0xE28099, "'");
UPDATE `t` SET `c` = REPLACE(`c`, 0xE2809C, '"');
UPDATE `t` SET `c` = REPLACE(`c`, 0xE2809D, '"');
UPDATE `t` SET `c` = REPLACE(`c`, 0xE28093, '-');
UPDATE `t` SET `c` = REPLACE(`c`, 0xE28094, '--');
UPDATE `t` SET `c` = REPLACE(`c`, 0xE280A6, '...');
# NEXT, REPLACE their Windows-1252 equivalents.
UPDATE `t` SET `c` = REPLACE(`c`, CHAR(145), "'");
@mitchellhislop
mitchellhislop / php.snippets
Created April 7, 2011 04:17 — forked from aaroneaton/php.snippets
snipMate.vim file for codeigniter 2.0
# SnipMate is required to use snippets
# Download SnipMate: http://www.vim.org/scripts/script.php?script_id=2540
# Put this file in ~/.vim/snippets/ then restart vim
# This snippet file includes many useful snippets for CodeIgniter. Please feel free to fork and contribute!
snippet php
<?php
${1}
?>
snippet ec
echo "${1:string}"${2};
@mitchellhislop
mitchellhislop / gist:4e870851bab15585b801dc23ee5e4a0a
Created August 2, 2016 21:43
Google Analytics: HTML5 Video Tracking
document.addEventListener('DOMContentLoaded', init, false)
var videoId = document.getElementById('video')
//var videoTitle = videoId.getAttribute('data-description')
var videoTitle = '宝宝身边有怪物'
function init () {
videoId.addEventListener('ended', videoEnd, false)
videoId.addEventListener('timeupdate', videoTimeUpdate, false)
videoId.addEventListener('play', videoPlay, false)
@mitchellhislop
mitchellhislop / Twitter.scala
Created August 21, 2013 03:07
Twitter boilerplate for scala + play
package controllers
import play.api.Play.current
import play.api.libs.oauth.{RequestToken, ServiceInfo, ConsumerKey, OAuth}
import play.api.mvc.{RequestHeader, Action, Controller}
import play.api.Play
object Twitter extends Controller {
val cfg = Play.application.configuration
@mitchellhislop
mitchellhislop / twittertypeahead.js
Created July 2, 2013 18:49
What a cool plugin. Fully awesome typeahead in ~25 lines.
$('#school .typeahead').typeahead({
name: 'schools',
prefetch: {
url: '/schoolsforstate/'+ state
filter: (data)->
$.each data, ()->
datumAdd = {
value: this.school_name
id: this.id
tokens:[
echo "main(i){for(i=0;;i++)putchar(((i*(i>>8|i>>9)&46&i>>8))^(i&i>>13|i>>6));}" | gcc -x c - && ./a.out | aplay
@mitchellhislop
mitchellhislop / application.conf
Last active December 18, 2015 21:58
Logback xml for Scala/Play logging
db.default.logStatements=true
//Add that to the application.conf, and comment out the Logger lines (~50 - ~60). Restart the play app, and you are now logging with gas!