Skip to content

Instantly share code, notes, and snippets.

View joshbuchea's full-sized avatar

Josh Buchea joshbuchea

View GitHub Profile
@joshbuchea
joshbuchea / select-50-states.html
Last active August 29, 2015 14:01
Select menu of all 50 United States and Minor Outlying Territories.
<select>
<optgroup>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
@joshbuchea
joshbuchea / select-countries.html
Last active August 29, 2015 14:01
A fairly comprehensive select menu of all the countries around the world.
<select>
<option value=" " selected>(please select a country)</option>
<option value="--">none</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<?php
// Note: The user-provided callback name must be filtered to prevent attack
// vectors. This script simply removes any symbols other than `[a-zA-Z0-9$_]`
// from the input. Sadly, this blocks the use of some valid JavaScript
// identifiers, and also accepts a few invalid ones. See
// http://mathiasbynens.be/notes/javascript-identifiers for details.
$callback = isset($_GET['callback'])
? preg_replace('/[^a-zA-Z0-9$_.]/s', '', $_GET['callback'])
: false;
@joshbuchea
joshbuchea / cordova-detect-ios7.js
Last active August 29, 2015 14:03
Cordova/PhoneGap - Detect iOS 7
var ios7 = (device.platform == 'iOS' && parseInt(device.version) >= 7);
if (ios7) {
// iOS 7
}
@joshbuchea
joshbuchea / devices.json
Created December 12, 2014 18:31
devices json
[
{
"Device Name":"Acer Iconia Tab A1-810",
"Platform":"Android",
"OS Version":"4.2.2",
"Portrait Width":"768",
"Landscape Width":"1024",
"Release Date":"2013-05"
},
{
@joshbuchea
joshbuchea / angular-filter-trusted.js
Last active August 29, 2015 14:12
AngularJS Trusted Resource Filter
.filter('trusted', ['$sce', function ($sce) {
return function(url) {
return $sce.trustAsResourceUrl(url);
};
}])
@joshbuchea
joshbuchea / ionic-splitview-fix.css
Created January 3, 2015 00:13
Hides side menu button while side menu is open
/* hide menu-toggle button while side menu is open */
.aside-open [menu-toggle] {
display: none !important;
}
@joshbuchea
joshbuchea / ionic-splitview-iphone6plus.html
Last active August 29, 2015 14:12
Ionic Split View Controller - iPhone 6 Plus & Larger
<ion-side-menu expose-aside-when="(min-width:736px)">
</ion-side-menu>
@joshbuchea
joshbuchea / ionic-directive-navclear.js
Last active August 29, 2015 14:12
Ionic navClear directive replacement for beta 14+
.directive('navClear', [
'$ionicHistory',
'$state',
'$location',
'$window',
'$rootScope',
function($ionicHistory, $location, $state, $window, $rootScope) {
$rootScope.$on('$stateChangeError', function() {
$ionicHistory.nextViewOptions(null);
});
@joshbuchea
joshbuchea / angular-filter-tel.js
Last active August 29, 2015 14:14
AngulaJS Telephone Format Filter
.filter('tel', function () {
return function (tel) {
if (!tel) { return ''; }
var value = tel.toString().trim().replace(/^\+/, '');
if (value.match(/[^0-9]/)) {
return tel;
}