Skip to content

Instantly share code, notes, and snippets.

Ben Tedder bentedder

Block or report user

Report or block bentedder

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
@bentedder
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
bentedder / calendar.component.html
Last active Jun 25, 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>
<div class="year-nav">
<button (click)="prevYear()">&lt;</button>
<span>{{ currentDate.format('YYYY') }}</span>
View JWT Overview.md

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
bentedder / list.component.html
Last active May 15, 2018
Pagination Component
View list.component.html
<div>list of things</div>
<my-pagination
(goPage)="goToPage($event)"
(goNext)="onNext()"
(goPrev)="onPrev()"
[pagesToShow]="3"
[page]="page"
[perPage]="limit"
[count]="total"></my-pagination>
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
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"
});
thing.runAround();
});
View btrollup.php
<?php
/*
Plugin Name: Rollup Posts
Plugin URI: http://www.bentedder.com
Description: Rollup posts from specific categories with styles
Version: 1.0
Author: Ben Tedder
Author URI: http://www.bentedder.com
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';}\"";
You can’t perform that action at this time.