Skip to content

Instantly share code, notes, and snippets.

View ptb's full-sized avatar

Peter T Bosse II ptb

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>UIActionSheet</title>
<meta name='viewport' content='initial-scale=1, minimum-scale=1, maximum-scale=1;'>
<meta name='apple-mobile-web-app-capable' content='yes'>
<style>
a, abbr, address, article, aside, audio, b, blockquote, body, canvas, caption, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, ul, var, video {
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>UINavigationBar</title>
<meta name='viewport' content='initial-scale=1, minimum-scale=1, maximum-scale=1;'>
<meta name='apple-mobile-web-app-capable' content='yes'>
<style>
a, abbr, address, article, aside, audio, b, blockquote, body, button, canvas, caption, cite, code, dd, del, details, dfn, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, html, i, iframe, img, ins, kbd, label, legend, li, mark, menu, nav, object, ol, output, p, pre, q, ruby, s, samp, section, small, span, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, time, tr, ul, var, video {
border: 0;
$m: 1
.checkmark:after
content: '\2714'
color: #358
font-size: (24px * $m)
.disclosure-indicator:after
display: block
content: ''
#!/bin/sh
USERTEMPLATE="$3/System/Library/User Template/English.lproj"
LIBPREFS='Library/Preferences'
TARGETFILE='SteerMouse.prefs'
/bin/cp -a "$USERTEMPLATE/$LIBPREFS/$TARGETFILE" "$HOME/$LIBPREFS/$TARGETFILE"
/usr/sbin/chown $USER:staff "$HOME/$LIBPREFS/$TARGETFILE"
#!/bin/sh
### General ###
/usr/bin/defaults write -g 'AppleAquaColorVariant' -int 6
/usr/bin/defaults write -g 'AppleHighlightColor' -string '0.600000 0.800000 0.600000'
/usr/bin/defaults write -g 'AppleShowScrollBars' -string 'Always'
@ptb
ptb / postflight.sh
Created August 8, 2011 14:58
Mac OS X Lion setup
#!/bin/sh
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
String one = "Target Temp";
String two = "Current Temp";
byte degreesf[8] = {
0b11000,
0b11000,
@ptb
ptb / iOSVersion.js
Created January 8, 2013 20:33
Javascript function returns an array of iOS 2.0 and later version integers.
var iOSversion = function() {
if (/iP(hone|od|ad)/.test(navigator.platform)) {
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
}
};
@ptb
ptb / hideurltextfield.js
Last active December 10, 2015 21:18
On iPhone and iPod touch, automatically hide Mobile Safari's URL text field on page load, orientation changes, and resize.
/*! gist.github.com/4494626 | (c) 2013 Peter T Bosse II | Apache license */
/*jshint camelcase:true, curly:true, eqeqeq:true, quotmark:single, unused:true, laxbreak:false, onevar:true, latedef:true, trailing:true, indent:2, white:true, strict:true, browser:true, devel:true, jquery:true, prototypejs:true, undef:true */
(function () {
'use strict';
// Inspired by: <http://www.apress.com/9781430230458>
// Beginning iPhone & iPad Web Apps: Scripting with HTML5, CSS3, & JS
// Chapter 4: Pages 85-86: Hiding Mobile Safari's Address Bar
@ptb
ptb / ioscssclasses.js
Last active December 10, 2015 23:58
On iOS devices, add CSS classes to <html> element for Retina display support, iPod or iPad device class, and iOS version. iPod touches and iPhones both use the 'ipod' class for brevity. Example result: <html class='ios1 ios2 ios3 ios4 ios5 ios6 ipod online portrait retina transform3d'>
/*! gist.github.com/4512971 | (c) 2013 Peter T Bosse II | Apache license */
/*! Portions from: jqtouch.com | (c) 2009-2013 Sencha Labs | MIT license */
/*jshint camelcase:true, curly:true, eqeqeq:true, quotmark:single, unused:true, laxbreak:false, onevar:true, latedef:true, trailing:true, indent:2, white:true, strict:true, browser:true, devel:true, jquery:true, prototypejs:true, undef:true */
(function () {
'use strict';
function iPod() {
return (/iP(hone|od)/.test(navigator.platform));
}