Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View iambriansreed's full-sized avatar
🏠
Working from my office at home

Brian Reed iambriansreed

🏠
Working from my office at home
View GitHub Profile
@iambriansreed
iambriansreed / command.js
Last active May 18, 2017 14:52
Clear All Cookies - a Backtick Cmd
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
function http_response_code($code = NULL) {
if ($code !== NULL) {
switch ($code) {
case 100: $text = 'Continue'; break;
case 101: $text = 'Switching Protocols'; break;
case 200: $text = 'OK'; break;
case 201: $text = 'Created'; break;
case 202: $text = 'Accepted'; break;
@iambriansreed
iambriansreed / osx-volume-control-lag-fix.txt
Created March 29, 2017 02:36
Running the following commands fixes the audio volume controls and brightness lag response issues.
Running the following commands fixes the audio volume controls and brightness lag response issues.
~  sudo killall coreaudiod
~  sudo launchctl unload /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist
~  sudo launchctl load /System/Library/LaunchDaemons/com.apple.audio.coreaudiod.plist
Thanks to: http://apple.stackexchange.com/questions/116572/delay-when-using-the-volume-buttons
@iambriansreed
iambriansreed / progress-with-indicator.html
Created March 10, 2017 15:51
Bootstrap progress bar with value.
<style>
$percentage-width: 3.75em;
.progress-indicator {
overflow: hidden;
margin: 1em 0;
.indicator {
float: none;
@iambriansreed
iambriansreed / lets-encrypt-index.php
Last active March 21, 2017 19:34
Add this to the beginning of your index.php file. Useful when adding SSL to Wordpress applications.
$request = 'code_in_the_url';
$response = 'code_returned';
if ( $_SERVER['REQUEST_URI'] === ( '/.well-known/acme-challenge/' . $request ) ) {
echo $request . '.' . $response;
exit;
}
<?php
/*
* tl;dr
* Adding `Helpers::add_hooks($this);` to your class constructor loads any needed add_action and add_filters hooks.
*/
class Class_Helpers {
/**
@iambriansreed
iambriansreed / angular ui state loading logging
Last active December 10, 2016 20:02
Log new Angular UI State loading logging
_.each(['onStart', 'onBefore', 'onRetain', 'onSuccess', 'onError', 'onExit', 'onFinish'],
transitionHook => {
$transitions[transitionHook]({}, function () {
console.log(transitionHook);
});
});
Find:
function ([a-z_]+)\(([a-z $,_]+)\s\)
Replace:
function $1( $2 )
@iambriansreed
iambriansreed / class-shortcodes-base.php
Last active October 26, 2016 02:36
Shortcodes Base Class
<?php
/**
* Shortcodes Base Class
*
* Adds dynamically named shortcodes using a child class's functions.
* Shortcode will not be created for functions prefixed with an underscore (_);
* Prefix is optional (recommended).
*
*/
{"Awesome":true}