Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Buchea joshbuchea

View GitHub Profile
View jsonp.php
<?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 / 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 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();
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@joshbuchea
joshbuchea / .gitignore
Last active Aug 29, 2015 — forked from octocat/.gitignore
Some common .gitignore configurations
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@joshbuchea
joshbuchea / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joshbuchea
joshbuchea / decodeUrlParameter.js
Last active Feb 19, 2016 — forked from bchapuis/decodeUrlParameter.js
Replace the plus sign which encode spaces in GET parameters using javascript.
View decodeUrlParameter.js
function decodeUrlParameter(str) {
return decodeURIComponent((str+'').replace(/\+/g, '%20'));
}
You can’t perform that action at this time.