Skip to content

Instantly share code, notes, and snippets.

View swichers's full-sized avatar
👻
We must construct additional pylons!

Steven Wichers swichers

👻
We must construct additional pylons!
View GitHub Profile
@swichers
swichers / rename-mv-backups.sh
Created June 15, 2017 08:51
Renames files from somename-here.jpg.~#~ to somename-here.~#~.jpg
#/bin/env bash
# Renames files from somename-here.jpg.~#~ to somename-here.~#~.jpg
INDIR='./out'
REGEX='.*/[^\/]+?\.[a-z0-9]+\.~[0-9]+~'
set -e
echo "Searching in ${INDIR}"
@swichers
swichers / google-photos-organizer.sh
Last active August 16, 2019 08:07
Move files into subfolders based on common names.
#/bin/env bash
# Created to help group photos based on their similar naming instead of using
# the folders Google had them in.
INDIR='./Google Photos'
OUTDIR='out'
SUB_LEN=10
DEBUG=0
set -e
@swichers
swichers / d8-behat-fillInDrupalAutocomplete.inc
Last active May 18, 2020 07:37 — forked from johnennewdeeson/FeatureContext_fill_in_drupal_autocomplete.inc
Behat Step to select an autocomplete suggestion from a partial entry
<?php
use Behat\Mink\Extension\ElementNotFoundException;
use Drupal\DrupalExtension\Context\DrupalContext;
class FeatureContext extends DrupalContext {
/**
* Gives us acess to the other contexts so we can access their properties.
*
* @BeforeScenario
@swichers
swichers / d8-behat-iSelectFirstAutocomplete.php
Last active August 6, 2021 11:59 — forked from IslandUsurper/gist:12723643dddc9315ff71
Behat Step to select the first autocomplete suggestion
<?php
use Behat\Mink\Extension\ElementNotFoundException;
use Drupal\DrupalExtension\Context\DrupalContext;
class FeatureContext extends DrupalContext {
/**
* Gives us acess to the other contexts so we can access their properties.
*
@swichers
swichers / 2010-cost-of-living.csv
Created November 2, 2016 06:46
Cost of living data for 2010
Urban Area 100% Composite Index 13% Grocery Items 29% Housing 10% Utilities 12% Transportation 4% Health Care 32% Miscalaneous Goods and Services
Anniston-Calhoun, County, AL 91.2 101.2 74.8 111.2 88.8 89.3 96.6
Akron OH 100.2 105.1 99.7 107.9 107.1 86.8 96.0
Albany, GA 90.1 108.7 74.8 82.0 96.6 89.8 96.8
Albany, NY 108.1 105.0 112.6 101.0 102.8 111.7 108.6
Alexandria, LA 95.1 96.0 92.7 89.9 97.2 92.9 98.2
Amarillo, TX 89.5 89.9 89.4 80.4 92.1 95.2 90.8
Americus, GA 88.3 105.5 71.0 88.2 99.8 103.7 91.3
Ames, IA 96.8 93.7 104.8 82.3 101.8 98.4 93.7
Anchorage, AK 128.4 134.5 142.9 94.1 122.0 135.7 124.8
@swichers
swichers / markdown-link-checker.php
Last active March 28, 2016 22:22
Quick and dirty markdown link checker
@swichers
swichers / httpd-skeleton-ubuntu.conf
Last active March 23, 2016 01:55
httpd.conf skeleton for Ubuntu
<VirtualHost *:80>
ServerName example.local
ServerAlias www.example.local
ServerAdmin webmaster@localhost
DocumentRoot /path/to/project
<Directory "/path/to/project">
Options Indexes FollowSymLinks
AllowOverride All
@swichers
swichers / behat-iloginas.php
Last active August 29, 2015 14:23
iLoginAs Behat 2 method
<?php
/**
* Allows your feature to login as the specified user without specifying a password
*/
/**
* @Given /^I log in as "(?P<name>[^"]*)"$/
*/
public function iLogInAs($name) {
@swichers
swichers / drupal-block-render.php
Created June 19, 2015 23:49
The proper way to load and render a block in Drupal 7
<?php
// Other methods bypass certain hooks or skip parts of the theme layer.
$block = block_load($module, $delta);
$renderable_block = _block_get_renderable_array(_block_render_blocks(array($block)));
@swichers
swichers / add-mtime-file-url.php
Created June 19, 2015 23:43
Add mtime to files in Drupal
<?php
/**
* Implements hook_file_url_alter().
*/
function HOOK_file_url_alter(&$uri) {
// Client is complaining about images not refreshing immediately when the user
// changes one image for another (and the filename stays the same). Using the
// image path flush function doesn't trigger a browser cache refresh for the