Skip to content

Instantly share code, notes, and snippets.

@meetbryce
meetbryce / index.html
Created November 21, 2012 00:22
A CodePen by Adem ilter. Countdown Clock
<div class="container">
<ul class="flip minutePlay">
<li>
<a href="#">
<div class="up">
<div class="shadow"></div>
<div class="inn">0</div>
</div>
<div class="down">
@meetbryce
meetbryce / remove-default-widgets
Created July 24, 2013 05:41
Remove Default Wordpress Widgets (add to functions.php)
function unregister_default_wp_widgets() {
unregister_widget('WP_Widget_Pages');
unregister_widget('WP_Nav_Menu_Widget');
unregister_widget('WP_Widget_Calendar');
unregister_widget('WP_Widget_Archives');
unregister_widget('WP_Widget_Links');
unregister_widget('WP_Widget_Meta');
unregister_widget('WP_Widget_Search');
unregister_widget('WP_Widget_Categories');
unregister_widget('WP_Widget_Recent_Comments');
@meetbryce
meetbryce / avg_or_sum_array_with_js.js
Last active May 12, 2019 19:36
Average or Sum the values in an array using Javascript (and Underscore.js)
// requires Underscore.js
// uses jQuery style funciton declaration (if you aren't using jQuery, simply re-arrange the declaration)
function sum(arr) {
// returns the sum total of all values in the array
return _.reduce(arr, function(memo, num) { return memo + num}, 0);
}
function average(arr) {
// returns the average of all values in the array
@meetbryce
meetbryce / Best Practice Wordpress Theme Title Code
Last active July 19, 2021 16:33
Best Practice Wordpress Theme Title Code
<title><?php
if (is_home () ) { echo sprintf('The %s Blog', get_bloginfo(‘name’)); }
elseif ( is_category() ) { single_cat_title(); echo ‘ - ‘ ; bloginfo(‘name’); }
elseif (is_single() ) { echo sprintf('%s – The %s Blog', single_post_title(false), get_bloginfo(‘name’));}
elseif (is_page() ) { single_post_title();}
else { wp_title('',true); echo sprintf(' Blog – %s', get_bloginfo(‘name’));}
?></title>
var gulp = require('gulp');
var electron = require('gulp-atom-electron');
var del = require('del');
gulp.task('clean:dist', function () {
return del(['dist/**', '!dist']);
})
gulp.task('default',['clean:dist'], function () {
var electronConfig = { version: '0.33.6', platform: 'darwin', token: '326cd8521a4fa11371bb89e1bec56a03f704a7e5' };
@meetbryce
meetbryce / Stop Permssion Errors on Firebase & AngularFire Logout - README.md
Last active February 22, 2019 03:08
Prevent permission denied errors from Firebase on logout (caused by active $firebaseArray & $firebaseObject connections not being destroyed). Example code follows John Papa's style guide.
@meetbryce
meetbryce / Add API stage as key, value (property) to POST data in API Gateway
Created September 11, 2016 14:06
Template for adding new key:value pair (property) to your AWS API Gateway Body Mapping Template
{
"stage" : "$context.stage",
#foreach( $key in $input.path('$').keySet() )
"$key": "$input.path('$').get($key)"#if($foreach.hasNext),
#end
#end
}
@meetbryce
meetbryce / setup.md
Created October 17, 2017 23:27 — forked from shashankmehta/setup.md
Setup PHP and Composer on OSX via Brew

First install Brew on your MAC

  • Setup Brew: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • brew update
  • brew tap homebrew/dupes
  • brew tap homebrew/php
  • Install PHP 7.0.+ brew install php70
  • Install mcrypt: brew install mcrypt php70-mcrypt
  • Finally, install composer: brew install composer
@meetbryce
meetbryce / script.js
Last active June 18, 2018 06:44
Calculate binary statistical significance (with 99% confidence)
// require('jStat');
function calculateSignificance(a_sessions, a_conversions, b_sessions, b_conversions) {
a_cr = a_conversions / a_sessions;
b_cr = b_conversions / b_sessions;
a_stdErr = Math.sqrt(a_cr * (1 - a_cr) / a_sessions);
b_stdErr = Math.sqrt(b_cr * (1 - b_cr) / b_sessions);
// get_z_score()
const z_score =
@meetbryce
meetbryce / .zshrc
Last active December 9, 2019 18:03
Autoload virtualenv from .venv when moving into a directory
# autoload venv if there's a .venv file
# Support for bash
PROMPT_COMMAND='prompt'
# Mirrored support for zsh. See: https://superuser.com/questions/735660/whats-the-zsh-equivalent-of-bashs-prompt-command/735969#735969
precmd() { eval "$PROMPT_COMMAND" }
function prompt()
{
if [ "$PWD" != "$MYOLDPWD" ]; then