Skip to content

Instantly share code, notes, and snippets.

View davisshaver's full-sized avatar

Davis Shaver davisshaver

View GitHub Profile
@davisshaver
davisshaver / restart.sh
Created March 7, 2016 20:02
Restart latest build of `master` branch on Travis-CI.com
## Example output of travis `#6 passed: master Merge pull request #1 from org/branch-name`
lastrun=$(travis history --pro -r org/repo --limit 1 --branch master)
lastrunarr=(`echo ${lastrun}`)
number=$(echo $lastrunarr[1] | tr -cd '[[:digit:]]')
travis restart $number -r org/repo
@davisshaver
davisshaver / engineer.md
Last active October 29, 2015 20:26
Philadelphia Media Network – Tech/Product Jobs

The Philadelphia Media Network is seeking engineers to join a new development team within its Systems division. As an early engineering hire on this team, you will have a large role in shaping its culture, values, and workflow.

Engineer

Interested? Email us.

The technical stuff:

  • Rails experience would be great, but at least you should be willing to learn. We will be maintaining and enhancing a Rails CMS built to manage our new mobile app. Don’t worry though, you will be inheriting a stable, well-documented, and test-driven project.
  • “Fullstack” projects should be comfortable to you. We want engineers who are interested in the entire product development process – understanding needs, vetting technical approaches, planning work to be done, and engineering in an agile manner. Learning and problem solving are two of your favorite things to do.
  • Git, unit tests, and coding standards are all familiar to you, and you understand why we practice
@davisshaver
davisshaver / third-functions-sample.php
Last active August 29, 2015 14:25
Speed Bumps – Example code to accompany http://fus.in/1MidK1N
<?php
if ( current_user_can( 'manage_options' ) ) {
add_filter( 'speed_bumps_rickroll_constraints', '__return_false' );
}
@davisshaver
davisshaver / second-functions-sample.php
Created July 21, 2015 14:23
Speed Bumps – Example code to accompany http://fus.in/1MidK1N
<?php
add_filter( 'speed_bumps_rickroll_constraints', 'give_you_up', 10, 4 );
function give_you_up( $can_insert, $context, $args, $already_inserted ) {
if ( ! preg_match( '/give [^ ]+ up/i', $context['prev_paragraph'] ) ) {
$can_insert = false;
}
return $can_insert;
}
@davisshaver
davisshaver / first-functions-sample.php
Last active August 29, 2015 14:25
Speed Bumps – Example code to accompany http://fus.in/1MidK1N
<?php
register_speed_bump( 'rickroll', array(
'string_to_inject' => function() { return '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'; },
'minimum_content_length' => false,
'from_start' => false,
'from_end' => false,
));
add_filter( 'the_content', 'insert_speed_bumps', 1 );
@davisshaver
davisshaver / one.php
Created July 21, 2015 14:19
Speed Bumps – Example code
<?php
register_speed_bump( 'rickroll', array(
'string_to_inject' => function() { return '<iframe width="420" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" allowfullscreen></iframe>'; },
'minimum_content_length' => false,
'from_start' => false,
'from_end' => false,
));
add_filter( 'the_content', 'insert_speed_bumps', 1 );
@davisshaver
davisshaver / publishing-checklist-integration.php
Last active August 29, 2015 14:23
Snippet for adding a basic Publishing Checklist
<?php
add_action( 'publishing_checklist_init', function() {
$args = array(
'label' => esc_html__( 'Featured Image', 'demo_publishing_checklist' ),
'callback' => function ( $post_id, $id ) {
return has_post_thumbnail( $post_id );
},
'explanation' => esc_html__( 'A featured image is required.', 'demo_publishing_checklist' ),
'post_type' => array( 'post' ),
@davisshaver
davisshaver / class-publishing-checklist.php
Created June 26, 2015 16:02
Gist for adding a basic Publishing Checklists
<?php
class Publishing_Checklist {
private static $instance;
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new Publishing_Checklist;
self::$instance->setup_actions();
}
@davisshaver
davisshaver / brainstorming.md
Last active August 29, 2015 14:16
Brainstorming notes: YIP human centered design for elections

AGENDA

Go over ground rules

  • Defer judgement
  • Aim high
  • Yes, and
  • Focus
  • Quantity over quality

Draw me something

  • Make city government cool
@davisshaver
davisshaver / example.php
Created November 10, 2014 17:08
Registering a shortcode UI for pullquotes
<?php
add_action( 'init', 'register_fusion_pullquote_ui' );
function register_fusion_pullquote_ui() {
shortcode_ui_register_for_shortcode(
'fusion-pullquote',
array(
'label' => 'Pullquote',
'listItemImage' => 'dashicons-editor-quote',