Skip to content

Instantly share code, notes, and snippets.

@ianlintner-wf
ianlintner-wf / compare-cutoff.js
Last active February 3, 2020 22:03
Replace Github Pull Request Compare Cutoff for big! pull request with something funny. JS
let cliche_quote = ' Nice! ';
$('.compare-cutoff').textContent = $('.compare-cutoff').textContent.replace('big!', `big! ${cliche_quote}`);
func generate_voronoi_diagram(imgSize : Vector2, num_cells: int):
var img = Image.new()
img.create(imgSize.x, imgSize.y, false, Image.FORMAT_RGBH)
var points = []
var colors = []
for i in range(num_cells):
points.push_back(Vector2(int(randf()*img.get_size().x), int(randf()*img.get_size().y)))
@ianlintner-wf
ianlintner-wf / cookieManager.js
Last active December 20, 2019 22:11
Simple JS Cookie Helper Class
/***
* Cookie Manager Class w/Static Methods
*/
export default class CookieManager {
/***
* Check if value exists in cookie that is a csv list.
*
* @param {string} key
* @param {string} value
* @return {bool}
@ianlintner-wf
ianlintner-wf / video.handlebars
Last active December 11, 2019 16:20
Wistia Templates for Generating IFrame
<!-- Responsive Template -->
<script charset="ISO-8859-1" src="//fast.wistia.com/assets/external/E-v1.js" async></script>
<div class="wistia_responsive_padding" style="padding:56.25% 0 28px 0;position:relative;">
<div class="wistia_responsive_wrapper" style="height:100%;left:0;position:absolute;top:0;width:100%;">
<div class="wistia_embed wistia_async_{{wistia_id}} videoFoam=true" style="height:100%;width:100%">&nbsp;</div>
</div>
</div>
@ianlintner-wf
ianlintner-wf / docker-machine-update-hosts.sh
Last active October 29, 2019 20:16
A basic shell script to use a configuration file to update local development hosts ip running on docker-machine (virtual box) and Mac OSX
#!/usr/bin/env bash
#Usage docker-machine-update-hosts.sh hosts.conf default
#arg1 is a configuration file with hosts
#arg2 is the docker-machine name e.g. default
DOCKER_IP=$(docker-machine ip $2)
echo "$2 ip: $DOCKER_IP"
#Remove existing lines from hosts
while IFS='' read -r line || [[ -n "$line" ]]; do
@ianlintner-wf
ianlintner-wf / redis_cache_clear_phpsimplesaml.php
Created April 2, 2019 18:58
Redis custom cache for simple saml cache clear all
<?php
$config = \SimpleSAML_Configuration::getInstance();
$red = new \SimpleSAML\Store\Redis();
$conf = array(
'host' => $config->getString('store.redis.host', 'localhost'),
'port' => $config->getInteger('store.redis.port', 6379),
'prefix' => $config->getString('store.redis.prefix', 'SimpleSAMLphp'),
'scheme' => 'tcp',
);
@ianlintner-wf
ianlintner-wf / cordova-google-services-version-gradle-fix.js
Last active February 19, 2019 10:10
This is to fix version issues between multiple google services plugins in Ionic & cordova builds. Cordova before_prepare hook.
#!/usr/bin/env node
// Define hook in your config <hook src="scripts/cordova-google-services-version-gradle-fix.js" type="before_prepare" />
var sourceDir = '';
var platformDir = 'platforms/android';
var fs = require('fs');
var path = require('path');
var readline = require("readline");
@ianlintner-wf
ianlintner-wf / docker.aliases.drushrc.php
Last active March 9, 2017 16:33
Docker & Drupal Local Alias via seperate dockerized SSH Container
$aliases['loc'] = array (
// This is the full site alias name from which we inherit its config.
'parent' => '@docker.loc' //alias name,
'uri' => 'docker.loc' //Drupal URL,
'root' => '/var/www/' //Drupal full path on disk,
'ssh-options' => '-p 2222',
'remote-host' => '192.168.99.100' //DOCKER/DOCKER MACHINE IP,
);
@ianlintner-wf
ianlintner-wf / varnish.test.sh
Created March 7, 2017 17:29
Simple Varnish Test Via Curl
#$1 is url
#$2 is cookie file
curl -I -b $2 -c $2 $1 > /tmp/vtest
echo 'Varnish Enabled: '
grep -i 'Via.?varnish' < /tmp/vtest
echo 'Varnish Hit: '
grep -i 'X-Cache:.HIT' < /tmp/vtest
@ianlintner-wf
ianlintner-wf / phpcs_ci.task.sh
Last active February 23, 2017 21:12
PHP Code Sniffer / CI / Bamboo / Jenkins / Drupal / Check Style script
#!/bin/bash
# PHP CodeSniffer CI Task
#
# Based off of git pre-commit hook
# https://github.com/s0enke/git-hooks/tree/master/phpcs-pre-commit
#
# Export Variables to be set by CI Agent / Bot
# PHPCS_BIN=/usr/bin/phpcs
# PHPCS_CODING_STANDARD=PEAR
# PHPCS_IGNORE=