Skip to content

Instantly share code, notes, and snippets.

View trump_report_card.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
Campaign Promise,Kept,Good for America
Build a Wall,No. There are 7 out of 2000 miles complete. All other construction is repair work budgeted before he took office.,No. The border backlog is unimproved and will never be improved with 4th century technology.
Get Mexico to pay for it.,No. He diverted 2.5 billion in military construction projects. A lot of those were housing and schools for military families.,No. The military extends far beyond guns and ammo and he doesn’t understand troop morale at all.
Temporarily ban muslims,No. 3 versions have all been held up in court citing the same lack of planning.,No. All Muslims are no more Bin Laden than all Christians are Jim Jones. Extreme idiocy is scary no matter what rock you crawl from under.
Bring Manufacturing Back,Sorta. He’s attempting brute force through tariffs and easing restrictions which causes foreign countries to open factories here but with no real trade agreements our GDP stands to suffer. At least he’s doing something.,"Should be. Making it diffic
View amodds.cs
using System;
using System.Text.RegularExpressions;
namespace BreakEvenCalculator
{
// Parses strings into American Odds and converts to other formats.
public class AmericanOdds
{
private const string rx_string = @"^([\+-])(\d\d\d+)$";
View gist:f06276a1de0d76cadd4b265b2829bf03
{
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es2016" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"lib": [
"dom",
"es2016"
] /* Specify library files to be included in the compilation. */,
@joelstransky
joelstransky / wordpress-affix-title-admin.css
Created Apr 17, 2018
affix the title input in the wordpress admin
View wordpress-affix-title-admin.css
// affix the title input in the wordpress admin
#titlediv {
position: fixed;
width: calc( 100% - 180px);
z-index: 1010;
top: 32px;
background: white;
padding: 10px;
margin-left: -20px;
border: 1px solid black;
@joelstransky
joelstransky / .bash_profile
Created Dec 6, 2017
Add git branch to front of cli prompt.
View .bash_profile
PS1='`__git_ps1 "[%s] "`\u:\[$(tput sgr0)\]\[\033[38;5;45m\]\W\[$(tput sgr0)\]\[\033[38;5;15m\]\\$\[$(tput sgr0)\] '
if [ -f `brew --prefix`/etc/bash_completion.d/git-completion.bash ]; then
. `brew --prefix`/etc/bash_completion.d/git-completion.bash
fi
if [ -f `brew --prefix`/etc/bash_completion.d/git-prompt.sh ]; then
. `brew --prefix`/etc/bash_completion.d/git-prompt.sh
fi
@joelstransky
joelstransky / functions::custom_field_render.php
Created Dec 1, 2017
Alter Advanced Custom Field rendering in admin
View functions::custom_field_render.php
<?php
/*
* This snippet is from a project where I used an ACF Options gallery field to collect a set of icons.
* This fields data was then used to replace a radio field's options with the actual icons.
*/
class Special_Excerpt_Icon {
function __construct() {
// filter load_field on all 'radio' fields
add_filter('acf/load_field/type=radio', array($this, 'on_acf_load_radio_field' ) );
}
@joelstransky
joelstransky / functions::taxonomies.php
Created Aug 22, 2017
A working sort for taxonomy terms + numeric meta data
View functions::taxonomies.php
<?php
register_taxonomy( 'uh_service_type_taxonomy', array( 'contact_cpt' ), $args );
// add and 'Order' column to Service Type taxonomy terms
add_filter("manage_edit-uh_service_type_taxonomy_columns", "on_manage_edit_uh_service_type_taxonomy_columns");
function on_manage_edit_uh_service_type_taxonomy_columns( $columns ) {
$columns['term_order'] = __('Order');
return $columns;
}
@joelstransky
joelstransky / functions::get_connected_terms.php
Created Jun 9, 2017
Wordpress: Create relationship between two taxonomy's using ACF
View functions::get_connected_terms.php
<?php
$all_tax_a_terms = get_terms( array( 'taxonomy' => 'taxonomy_a', 'hide_empty' => false) );
foreach ($all_tax_a_terms as $a_term) {
$b_terms_set_to_a_term = get_terms( array(
'taxonomy' => 'taxonomy_b',
'meta_key' => 'acf-key-for-taxonomy-b',
'meta_value' => $a_term->slug,
'hide_empty' => false )
);
}
@joelstransky
joelstransky / functions::paginate_links_as_bootstrap.php
Last active May 25, 2017
Wraps WordPress paginate_links data in Twitter bootstrap pagination component
View functions::paginate_links_as_bootstrap.php
@joelstransky
joelstransky / functions::acf_settings_load_json.php
Created May 10, 2017
Advanced Custom Fields acf-json support for child themes
View functions::acf_settings_load_json.php
<?php
/**
* Child theme support for acf-json
* This will load acf-json from the parent theme first.
* That way if a child theme's acf-json folder contains a .json
* file with the same name as the parent, it will get loaded second
*/
add_filter('acf/settings/save_json', function() {
return get_stylesheet_directory() . '/acf-json';
});