Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Gustavson kgust

  • Vanderbilt University Medical Center
  • Nashville, Tennessee USA
View GitHub Profile
View closest.php
<?php
// input misspelled word
$input = 'carrrot';
// array of words to check against
$words = array('apple','pineapple','banana','orange',
'radish','carrot','pea','bean','potato');
// no shortest distance found, yet
$shortest = -1;
@kgust
kgust / dark.md
Created Dec 4, 2018 — forked from a7madgamal/dark.md
Dark mode for Slack on MacOS
View dark.md
  1. Close slack
  2. Open this file /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
  3. Append this to it
document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css',
   success: function(css) {
     $("<style></style>").appendTo('head').html(css);
@kgust
kgust / php-phpdbg-proxy.sh
Created Nov 29, 2018 — forked from VeryStrongFingers/php-phpdbg-proxy.sh
PHPStorm - PHP-PHPDBG Interpreter proxy
View php-phpdbg-proxy.sh
#!/bin/bash
#### Dirty/Fake PHP Interpreter to trick PHPStorm into using PHPDBG for running tests with/without code coverage
## For Mac/Linux only, Window's ubuntu subsystem theoretically would work too
##
##
## Related JetBrain's issues/feature requests
## https://youtrack.jetbrains.com/issue/WI-21414
## https://youtrack.jetbrains.com/issue/WI-29112
##
@kgust
kgust / 00 README.md
Last active Aug 29, 2018
All Things PlantUML
View 00 README.md

PlantUML.com

This is the best resource for PlantUML details.

Important Points

When you add the PlantUML plugin to PHPStorm, it creates a number of UML* template files that are examples that you can edit.

PlantUML can be generated by programs. E.g. php-plantumlwriter) It's even simple enough that we can write our own programs to generate PlantUML for our own use.

View docker-nginx-fastcgi.conf
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
@kgust
kgust / box.json.dist
Created Aug 15, 2018
Can we create a PHAR of our application using box?
View box.json.dist
{
"chmod": "0755",
"main": "app/console",
"output": "console.phar",
"directories": ["src"],
"finder": [
{
"name": "*.php",
"exclude": ["test", "tests", "Tests"],
@kgust
kgust / Caddyfile
Created Aug 15, 2018
Playing with Docker dynamic frontend servers
View Caddyfile
irbosx-c02q307.dhcp.mc.vanderbilt.edu:80 {
gzip
fastcgi / 127.0.0.1:9001 php {
root /app001/www/irb
index web/app_dev.php
}
}
localhost:8000 {
root /Users/gustavkd/github.com/vanderbilt/irb/web/
@kgust
kgust / benchmark.php
Created Aug 15, 2018
I wanted to benchmark functional PHP vs loops...
View benchmark.php
<?php
/*
PHP Benchmark
Downloaded from: http://onlinephpfunctions.com
*/
class benchmark
{
@kgust
kgust / build.xml
Created Aug 15, 2018
Phing Build Script (replace with bash script)
View build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="DISCOVR-e" default="full-build">
<property name="basedir" value="."/>
<!-- Use this when the tools are managed by Composer in ${basedir}/vendor/bin -->
<property name="pdepend" value="${basedir}/bin/pdepend"/>
<property name="phpcpd" value="${basedir}/bin/phpcpd"/>
<property name="phpcs" value="${basedir}/bin/phpcs"/>
<property name="phpdox" value="${basedir}/bin/phpdox"/>
<property name="phploc" value="${basedir}/bin/phploc"/>
<property name="phpmd" value="${basedir}/bin/phpmd"/>
@kgust
kgust / cs_fixer.php
Last active Jun 17, 2020
Configurations for php-cs-fixer (we are using phpcs and phpcbf instead)
View cs_fixer.php
<?php
require('./vendor/autoload.php');
$finder = PhpCsFixer\Finder::create()
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVcs(true)