Skip to content

Instantly share code, notes, and snippets.

Justin Endler justin-endler

Block or report user

Report or block justin-endler

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
View todo.sublime-snippet
<snippet>
<content><![CDATA[
// @todo
]]></content>
<tabTrigger>todo</tabTrigger>
<description>@todo</description>
</snippet>
View test.sublime-snippet
<snippet>
<content><![CDATA[
// @test
]]></content>
<tabTrigger>test</tabTrigger>
<description>@test</description>
</snippet>
@justin-endler
justin-endler / heroku-deploy.sh
Last active Dec 29, 2015
General node.js Express app deployment script for Heroku.
View heroku-deploy.sh
#!/bin/bash
# requires that node app.js be contained in a Procfile
# ./heroku-deploy.sh <NODE_ENV> <local_branch_to_push> <app_to_destroy_if_redeploy>
# validate minimal input
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Run with at least NODE_ENV and local_branch_to_push as arguments $1 and $2"
exit 1
fi
@justin-endler
justin-endler / console_info.sublime-snippet
Last active Dec 28, 2015
Sublime snippet for quick insertion of a labeled console.info()
View console_info.sublime-snippet
<snippet>
<content><![CDATA[
console.info('${1:thing}:', ${1}); // @test
]]></content>
<tabTrigger>info</tabTrigger>
<description>console.info()</description>
<scope>source.js</scope>
</snippet>
@justin-endler
justin-endler / storeUtil.js
Last active Dec 19, 2015
JavaScript utilities for use in a Drupal Commerce project.
View storeUtil.js
(function($) {
Drupal.behaviors.storeUtil = {
/**
* @param Number negative places to move the decimal left, positive to move it right
* @param String float
* @return String
*/
moveDecimal: function(places, f) {
// Move zero places.
if (!places) {
@justin-endler
justin-endler / endler-migrate-field-data.php
Created Dec 17, 2012
Simple Drush script skeleton to find string values in a node field and migrate them to other fields.
View endler-migrate-field-data.php
<?php
/**
* @file endler-migrate-field-data.php
*
* Drush script to migrate some string from one set of node fields to another.
*
* @author Justin Endler
*/
function update_node_fields($entity_id, $value) {
View regular-expressions-tool-link.txt
@justin-endler
justin-endler / endler-trim-backups.sh
Last active Dec 9, 2015
Set a maximum amount of files and trim to that amount for a particular location.
View endler-trim-backups.sh
#!/bin/bash
#
# Trim total files to maxbackups amount.
#
# Cron:
# http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/
#
# @author Justin Endler
#
@justin-endler
justin-endler / endler-wordpress-render-media-button.php
Created Dec 17, 2012
How to render a media button in WordPress post edit, making it work for WordPress 3.x.
View endler-wordpress-render-media-button.php
<?php
/**
* This assumes you'll be plugging in to media-upload.php in order to upload a file.
*
* @author Justin Endler
*/
// Get WordPress version.
$version = get_bloginfo('version');
@justin-endler
justin-endler / endler-d7-feature-review.sh
Created Dec 10, 2012
Sets up a local Drupal 7 branch review and attempts a merge with a forked-from repo.
View endler-d7-feature-review.sh
#!/bin/bash
#
# Sets up a local Drupal 7 branch review and attempts a merge with a forked-from repo.
#
# @author Justin Endler
#
defaultsettings="http://drupalcode.org/project/drupal.git/blob_plain/HEAD:/sites/default/default.settings.php"
echo -e "\nThis script is D7-specific."
You can’t perform that action at this time.