Skip to content

Instantly share code, notes, and snippets.

View Jayphen's full-sized avatar
🏠
Working from home

Jayphen Jayphen

🏠
Working from home
View GitHub Profile
@Jayphen
Jayphen / Modernizr min-width extension
Created March 28, 2011 02:23
Extend modernizr to check if minwidth is supported or not
Modernizr.addTest('minwidth', function() {
var test = document.createElement('div'),
root = document.documentElement.appendChild(document.createElement('body'));
test.style.cssText = 'min-width:22px;padding:0;margin:0;position:absolute;top:0;left:0';
root.appendChild(test);
var ret = test.offsetWidth === 22;
root.removeChild(test);
@Jayphen
Jayphen / Modernizr Box-sizing
Created September 21, 2011 05:30
Modernizr box-sizing check
Modernizr.addTest('box-sizing', function() {
var test = document.createElement('div'),
root = document.documentElement.appendChild(document.createElement('body'));
test.style.cssText = '-moz-box-sizing:border-box;-webkit-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;padding:0 10px;margin:0;border:0;position:absolute;top:0;left:0;width:100px';
root.appendChild(test);
var ret = test.offsetWidth === 100;
root.removeChild(test);
@Jayphen
Jayphen / gist:2374987
Created April 13, 2012 07:59
Yield custom trackPageview parameters for Google Analytics
-if content_for?(:track_page_view)
="_gaq.push(['_trackPageview', #{yield(:track_page_view).gsub(/\s+/, '')} ]);"
-else
_gaq.push(['_trackPageview']);
@Jayphen
Jayphen / Regex: AU mobiles
Created July 10, 2012 05:45
Regex to match Aus mobile numbers. Remove spaces and brackets before running this
(^\+61\d{9}$)|(^04\d{8}$)
@Jayphen
Jayphen / New reminder from Launchbar
Created July 27, 2012 12:18
A script for quickly adding reminders to the Reminders app in Mountain Lion from Launchbar. Save this as a .scpt and drop it in ~/Library/Application\ Support/LaunchBar/Actions
on handle_string(str)
set arrayWithDate to my theSplit(str, "@")
if arrayWithDate's length > 1 then
set theDate to my parseDate(getArrayValue(arrayWithDate, 2))
end if
set arrayWithBody to my theSplit(getArrayValue(arrayWithDate, 1), "#")
if arrayWithBody's length > 1 then
set reminderBody to my getArrayValue(arrayWithBody, 2)
else
gulp = require 'gulp'
clean = require 'gulp-clean'
runWintersmith = require 'run-wintersmith'
cssshrink = require 'gulp-cssshrink'
uglify = require 'gulp-uglify'
uncss = require 'gulp-uncss'
image = require 'gulp-image'
deploy = require 'gulp-gh-pages'
concat = require 'gulp-concat'
@Jayphen
Jayphen / cVim
Last active August 29, 2015 14:08
cVim
set noautofocus
set cncpcompletion
let locale = "aus" "requires my fork
let qmark a = ["http://forums.overclockers.com.au/forumdisplay.php?f=77", "http://ozbargain.com.au/"]
let qmark s = "http://sfcu.com.au/smf202/index.php?action=unread"
let qmark z = "http://ozbargain.com.au"
let blacklists = ["https://mail.google.com/*","https://inbox.google.com/*","*://*trello.com/b/*","*://*feedly.com/*"]
unmap r
let mapleader = " "
@Jayphen
Jayphen / gist:f70d39b39e6ac2c9caee
Last active August 29, 2015 14:08
AMCSS Stylus helper
am($args)
if length($args) == 1
[am-{$args}]
{block}
else
$val = ()
for i in 1...length($args)
push($val, $args[i])
[am-{$args[0]}~=\"{join(' ', $val)}\"]
{block}
[am-Nav]
position: absolute
left: 0
top: -rhythm(2, 12px)
height: 100%
z-index: 20 // Footer is 30 zindex
color: #6E8A99
adjust-font-size-to(12px, 1, 16px)
+ #outer-wrap
@Jayphen
Jayphen / gist:0a60c16c7e67118446aa
Created February 6, 2015 01:26
Pbcopy from remote SSH session back to OSX

Enable reverse tunelling on port 2224 locally…

echo "RemoteForward 2224 localhost:2224" >> ~/.ssh/config

SSH in to your server (I've only tried this on an Amazon AMI) and cat something

cat large-file.txt | nc localhost 2224