Skip to content

Instantly share code, notes, and snippets.

Stefan Pretty pretty

Block or report user

Report or block pretty

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
sproogen / ChildComponent.vue
Last active May 15, 2019
Vee Validate - Child Component Example
View ChildComponent.vue
<input v-validate data-rules="required" :class="{'has-error': errors.has("textInput")}" id="textInput" name="textInput" type="text">
<span class="error" v-show="errors.has("textInput")">{{ errors.first("textInput") }}</span>
import { find, propEq } from 'ramda'
import bus from './bus'
orottier / retry.php
Last active May 16, 2019
Retry function for PHP with exponential backoff
View retry.php
* Retry function for e.g. external API calls
* Will try the risky API call, and retries with an ever increasing delay if it fails
* Throws the latest error if $maxRetries is reached,
* otherwise it will return the value returned from the closure.
* You specify the exceptions that you expect to occur.
emilysnothere / add_action.php
Last active Apr 9, 2019
Adding fields to the WordPress post submit box
View add_action.php
add_action('post_submitbox_misc_actions', createCustomField);
add_action('save_post', saveCustomField);
Vestride /
Last active Jul 15, 2019
Encoding video for the web

Encoding Video


Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
iansltx /
Last active Jul 18, 2019
Safari iframe cookie workaround
martindrapeau / jquery.cach-inputs.js
Created Dec 27, 2013
jQuery plugin to cache HTML inputs using local storage. Restores them upon next page load.
View jquery.cach-inputs.js
// Cache user inputs into HTML5 local storage. Restore them upon next page load.
// Usage:
// $('body').CacheInputs();
// Will store stringified JSON in local storage, against the key you specify
// or 'cache-inputs' if you omit it. See settings below.
// Author: Martin Drapeau
// Greatly inspired from Johnathan Schnittger
cou929 / detect-private-browsing.js
Last active Jul 15, 2019
Detect private browsing mode (InPrivate Browsing or Incognito).
View detect-private-browsing.js
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
if (current_trial++ > max_retry) {
Xeoncross / ajax.js
Last active May 9, 2019
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
View ajax.js
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
* @param string url
* @param object callback
* @param mixed data
* @param null x
function ajax(url, callback, data, x) {
try {
tleen / gist:6395808
Created Aug 31, 2013
Javascript array of Canadian Provinces
View gist:6395808
['Alberta', 'British Columbia', 'Manitoba', 'New Brunswick', 'Newfoundland and Labrador', 'Northwest Territories', 'Nova Scotia', 'Nunavut', 'Ontario', 'Prince Edward Island', 'Quebec', 'Saskatchewan', 'Yukon Territory']
tleen / gist:6299431
Created Aug 21, 2013
Javascript array of state names
View gist:6299431
['Alabama','Alaska','American Samoa','Arizona','Arkansas','California','Colorado','Connecticut','Delaware','District of Columbia','Federated States of Micronesia','Florida','Georgia','Guam','Hawaii','Idaho','Illinois','Indiana','Iowa','Kansas','Kentucky','Louisiana','Maine','Marshall Islands','Maryland','Massachusetts','Michigan','Minnesota','Mississippi','Missouri','Montana','Nebraska','Nevada','New Hampshire','New Jersey','New Mexico','New York','North Carolina','North Dakota','Northern Mariana Islands','Ohio','Oklahoma','Oregon','Palau','Pennsylvania','Puerto Rico','Rhode Island','South Carolina','South Dakota','Tennessee','Texas','Utah','Vermont','Virgin Island','Virginia','Washington','West Virginia','Wisconsin','Wyoming']
You can’t perform that action at this time.