Instantly share code, notes, and snippets.

Ben Tedder bentedder

View GitHub Profile
bentedder / .block
Created Mar 19, 2018 — forked from guypursey/.block
Wrapping long labels with D3 v4 (sample data)
View .block
license: gpl-3.0
View chart.component.scss
#myChart {
.axis {
path {
stroke: #ccc;
text {
fill: #999;
font-size: 0.6rem;
bentedder / calendar.component.html
Last active Jan 24, 2019
calendar component angular 4
View calendar.component.html
<div class="calendar">
<div class="calendar-navs">
<div class="month-nav">
<button (click)="prevMonth()">&lt;</button>
<span class="p4">{{ currentDate.format('MMMM') }}</span>
<button (click)="nextMonth()">&gt;</button>
<div class="year-nav">
<button (click)="prevYear()">&lt;</button>
<span>{{ currentDate.format('YYYY') }}</span>
View JWT

JSON Web Tokens

What they are

  • an open standard defining a compact and self-contained way for securely transmitting information between parties as a JSON object.

Why to use them

  • stateless sessions (load balancers, separated front and back-end)
  • easy logout
  • save on SQL queries to check user or permissions every request
bentedder / list.component.html
Last active May 15, 2018
Pagination Component
View list.component.html
<div>list of things</div>
View bool query
size: limit,
query: {
bool: {
must: {
multi_match: {
query: term,
fields: ['name', 'raw_name']
should: {
View Brew stuff
ps -ax | grep mysql
stop and kill any MySQL processes
brew remove mysql
brew cleanup
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/var/mysql
sudo rm -rf /usr/local/mysql*
sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
bentedder / app.js
Last active Aug 29, 2015
basic js pattern (with requirejs)
View app.js
require(["thing"], function(Thing) {
var thing = new Thing({
place: "Chicago"
View btrollup.php
Plugin Name: Rollup Posts
Plugin URI:
Description: Rollup posts from specific categories with styles
Version: 1.0
Author: Ben Tedder
Author URI:
License: GPL2
View custom-search-form.php
* This is used to override the WordPress search to ONLY search for a
* custom post type. I used it on a photographer's website (only wanted
* users to search for photo post types).
* I put this snippet somewhere in functions.php
function bt_customize_search($form, $search_text, $button_text) {
$onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
$onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";