Skip to content

Instantly share code, notes, and snippets.

View jeffturcotte's full-sized avatar

Jeff Turcotte jeffturcotte

View GitHub Profile
var Module = (function(){
this.myMethod = function(x) {
return x
};
return this;
})();
import sublime, sublime_plugin, subprocess
class DocsendCommand(sublime_plugin.TextCommand):
def run(self, edit):
script = """
on run
ignoring application responses
tell application "Transmit"
open POSIX file "%s"
end tell
@jeffturcotte
jeffturcotte / isItScrollableWithoutVisibleScrollbars.js
Created July 22, 2011 19:02 — forked from jlbruno/isItScrollableWithoutVisibleScrollbars.js
a function to check if a certain element is scrollable, but is NOT showing scrollbars. Useful to use as a test for when you might want to implement another scrolling solution, such as iScroll for iPad.
var isItScrollableWithoutVisibleScrollbars = function(el) {
return (el && (el.scrollHeight > el.offsetHeight) && !(el.offsetWidth > el.scrollWidth));
};
@jeffturcotte
jeffturcotte / gist:4512498
Last active December 10, 2015 23:49
fActiveRecord Builder plugin example
<?php
$builder = new Builder('Page', array(
'name' => 'asc'
));
$builder->register('buildActive', function(&$where) {
$where['status='] = 'active';
});
$builder->extend('buildActive', 'buildActivePublished', function(&$where) {
@jeffturcotte
jeffturcotte / .tmux.conf
Last active December 10, 2015 23:58
tmux conf
# osx copy/paste
set-option -g default-command "reattach-to-user-namespace -l bash"
# 256 colors
set -g default-terminal "xterm-256color"
# history
set -g history-limit 20000
# set vi keys
<?php
/**
* A class to help with adding build methods
* to your fActiveRecord models.
*
* @author Jeff Turcotte <jeff.turcotte@gmail.com>
* @license MIT
* @version 1.0
*
* Usage:
@jeffturcotte
jeffturcotte / gist:6501188
Last active December 22, 2015 16:39
Cycle 2 BG lookahead plugin
/*! Cycle2 lookahead plugin for backgrounds
* Copyright (c) 2013 M. Alsup; Dual licensed: MIT/GPL
* @author Jeff Turcotte <jeff@imarc.net>
*/
(function($) {
"use strict";
$(document).on( 'cycle-initialized', function(e, opts) {
var key = 'cycle-look-ahead';
@jeffturcotte
jeffturcotte / gist:7414813
Created November 11, 2013 15:21
device pixel ratio media query
#logo {
background-image: url('/images/my_image.png');
}
@media all and (-webkit-min-device-pixel-ratio: 1.5) {
#logo {
background-image: url('/images/my_image@2x.png');
background-size: 200px 100px;
}
}
@jeffturcotte
jeffturcotte / Template.html
Last active December 27, 2016 12:03
RequireJS per page module
<!doctype html>
<html>
<head>
<title>{{ title|title }}</title>
<link rel="stylesheet" href="/styles/common.css" />
<link rel="stylesheet" href="/styles/layout.css" />
</head>
<body>
{{ include('header.html') }}
@jeffturcotte
jeffturcotte / gist:9557854
Last active August 29, 2015 13:57
Injector register method
<?php
/**
* Register a dependency. The following formats are allowed:
*
* 1. Fully qualified class (or interface) name with factory closure:
* $injector->register('Fully\Qualified\ClassName', function { .... });
*
* 2. Fully qualified class (or interface) name with instance of said class:
* $injector->register('Fully\Qualified\ClassName', $instance);
*