Skip to content

Instantly share code, notes, and snippets.

Josh Buchea joshbuchea

Block or report user

Report or block joshbuchea

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joshbuchea
joshbuchea / ionic-directive-navclear.js
Last active Aug 29, 2015
Ionic navClear directive replacement for beta 14+
View ionic-directive-navclear.js
.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 Aug 29, 2015
AngulaJS Telephone Format Filter
View angular-filter-tel.js
.filter('tel', function () {
return function (tel) {
if (!tel) { return ''; }
var value = tel.toString().trim().replace(/^\+/, '');
if (value.match(/[^0-9]/)) {
return tel;
}
@joshbuchea
joshbuchea / cordova-native-notifications.js
Created Feb 5, 2015
Cordova - window.alert → Native Notifications
View cordova-native-notifications.js
document.addEventListener('deviceready', function () {
if (navigator.notification) { // Override default HTML alert with native dialog
window.alert = function (message) {
navigator.notification.alert(
message, // message
null, // callback
"Notification Title", // title
'OK' // buttonName
);
};
@joshbuchea
joshbuchea / get-url-params.js
Last active Mar 12, 2019
JavaScript - Get URL Query Params
View get-url-params.js
/**
* Returns a bare object of the URL's query parameters.
* You can pass just a query string rather than a complete URL.
* The default URL is the current page.
*/
function getUrlParams (url) {
// http://stackoverflow.com/a/23946023/2407309
if (typeof url == 'undefined') {
url = window.location.search
}
@joshbuchea
joshbuchea / osx-10.10-setup-COPY.md
Last active Aug 29, 2015 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup
View osx-10.10-setup-COPY.md
View html-email-template.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
View canvas-upload.php
<?php
// requires php5
define('UPLOAD_DIR', 'images/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
View Jekyll Filer.rb
require 'fileutils'
# An OS X System Service for quickly filing image files to a Jekyll blog folder,
# putting Markdown links to the files on the clipboard.
# Copyright Brett Terpstra 2013
# Config
# ======
# Where to store the images
base_path = '~/Sites/dev/octopress/source/uploads/'
View angular-filter-moment.js
// REQUIRES:
// moment.js - https://github.com/moment/momentjs.com
// USAGE:
// {{ someDate | moment: [any moment function] : [param1] : [param2] : [param n]
// EXAMPLES:
// {{ someDate | moment: 'format': 'MMM DD, YYYY' }}
// {{ someDate | moment: 'fromNow' }}
View gist:c32ff358aa810bd58cb5
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
You can’t perform that action at this time.