Skip to content

Instantly share code, notes, and snippets.

View jonlabelle's full-sized avatar

Jon LaBelle jonlabelle

View GitHub Profile
(function() {
var jonJS = {
version: "1.1"
};
jonJS.Browser = function() {
var ua = navigator.userAgent.toLowerCase();
// -------------------------
@jonlabelle
jonlabelle / speedtracer-chrome.sh
Created June 13, 2012 18:30
Launch Google Chrome w/ SpeedTracer enabled
#!/bin/sh
open /Applications/Google\ Chrome.app --args --enable-extension-timeline-api
@jonlabelle
jonlabelle / sublime_text_console_event_logger.py
Last active October 12, 2015 07:18
Quick-and-dirty Sublime Text 2 console event logger.
import sublime
import sublime_plugin
import time
class EventLog(sublime_plugin.EventListener):
def __init__(self):
print "--- Event Log Initialized ---"
sublime.status_message('--- Event Log Initialized ---')
@jonlabelle
jonlabelle / secureRouteFilter.php
Last active December 18, 2015 20:49
A Laravel 4 route filter that redirects an HTTP request to HTTPS.
Route::filter('scrf', function()
{
if ( !Request::secure() ) return Redirect::secure( Request::path('/toSecureURL') );
});
@jonlabelle
jonlabelle / sublime-text-shortcuts.txt
Last active December 21, 2015 12:19
Sublime Text keyboard shortcuts.
-----------------------------------------------------------------------------
General
-----------------------------------------------------------------------------
Command palette:
cmd + shift + p
Go to method:
cmd + r
@jonlabelle
jonlabelle / mdpreview.sh
Last active December 23, 2015 19:09
A simple Sublime Text Build System for Markdown source.
#!/usr/bin/env bash
#
# Sublime Text 2|3 Markdown Build System
#
# This Sublime Text 2|3 build system simply takes Markdown source as an
# arg(1) and parses the HTML for previewing in a browser window.
#
# **Requirements**
#
# - Sublime Text 3 <http://www.sublimetext.com>
@jonlabelle
jonlabelle / atomic_time.py
Last active December 25, 2015 03:39
Fetch atomic time for your current locale in Python.
#!/usr/bin/env python
import re
import urllib2
def fetch_data():
return str(urllib2.urlopen('http://time.is').read())
@jonlabelle
jonlabelle / rp.py
Last active December 25, 2015 05:49
Return the canonical path (real path) of the specified filename, eliminating any symbolic links encountered in the path.
#!/usr/bin/env python
import os.path as filepath
import sys
from optparse import OptionParser
def main():
parser = OptionParser(
prog='rp', usage="%prog [path]\n\nReturn the canonical path of the specified filename\n\n [path]\tpath of file to check\n\n when *no args* are passed, the current working directory\n will be set as [path].")
@jonlabelle
jonlabelle / update-sublime-packages.sh
Last active December 26, 2015 04:28
A Bash function that updates Sublime Text packages which aren't under package control, and have git repositories.
# update all non-sublime package control packages (osx)
function update_sublimetext_packages()
{
echo ""
echo "==> Updating Sublime Text Packages"
echo ""
local cwd=$(pwd)
local subl_pkgs_dir=~/Library/Application\ Support/Sublime\ Text\ 3/Packages
local repo=
@jonlabelle
jonlabelle / laravel4-log-sql-queries-and-url.php
Created July 8, 2013 18:06
Laravel 4: Log all SQL queries and request URL. You can add it in `app/routes.php`.
Event::listen('illuminate.query', function($sql)
{
Log::info('Request URL: '.Request::url() .' Query: '.$sql);
});