Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
42% concentrating, optimistically

Matthew J. Sorenson emjayess

💭
42% concentrating, optimistically
View GitHub Profile
View arrays-for-conditions-cases.php
<?php
/**
* shorthand laravel php syntax tips via)
* Laravel Business: https://www.youtube.com/post/UgzGftWbzdljAptGJOR4AaABCQ
* via Caleb Porzio: https://laravel-livewire.com/screencasts/s7-simple-table
*/
// instead of if/else
if ( $status == 'processing' ) {
return 'blue';
View php-anon-fn.php
<?php
// short syntax available in php 7.4 and up
Project::with('user')
// regular anonymous php function expression
->whereHas('user', function($query) {
$query->where('role', 'admin');
})
View closure-as-callable-variable.php
<?php
/**
* What is this: 'thisInterval()' as a closure-as-callable-php-variable
*
* Explainer: imagine having a job scheduler with a production accuracy requirement to the minute..
* Now imagine desiring an easy way to loosen that accuracy constraint, for sake of easier tests..
* With an approach like this, just put the accuracy setting into configuration, e.g. .env file.
*/
// this $cfg could come from a per-environment .env file, for example
@emjayess
emjayess / git_branching_model_considered.md
Last active Feb 17, 2021
A Git branching model considered...
View git_branching_model_considered.md

Feature development - proposed branching model (graph)

Take a feature: like 'OBH'

__ master ______________________________________.___________________
  \                                            / (pull request ^)
   \__ develop ____________________________.__/_____________________
      \                                   / (pull request ^)
       \__ develop/obh/master _[._._._.]_/                          
@emjayess
emjayess / getinsights.zsh
Last active May 26, 2019
'getinsights' shortcut for @nunomaduro's phpinsights
View getinsights.zsh
# added to ohmyzsh custom aliases; for laravel / artisan
getinsights() {
composer require nunomaduro/phpinsights --dev
php artisan vendor:publish --provider="NunoMaduro\PhpInsights\Application\Adapters\Laravel\InsightsServiceProvider"
php artisan insights
}
@emjayess
emjayess / keybase.md
Created Apr 5, 2018
keybase claimant
View keybase.md

Keybase proof

I hereby claim:

  • I am emjayess on github.
  • I am mattso (https://keybase.io/mattso) on keybase.
  • I have a public key ASAbqQc40ZibE2hPbrsmrGPfIiIxd1EfQL2zIHSr80PsEgo

To claim this, I am signing this object:

@emjayess
emjayess / 1.Enter-pyspark-shell
Last active Aug 29, 2015
Apache Spark & 'mcmath' NormTermOrder 10k
View 1.Enter-pyspark-shell
macarooni:geekout emjayess$ pyspark
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Spark assembly has been built with Hive, including Datanucleus jars on classpath
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
15/02/03 09:18:31 INFO SecurityManager: Changing view acls to: emjayess
15/02/03 09:18:31 INFO SecurityManager: Changing modify acls to: emjayess
15/02/03 09:18:31 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(emjayess); users with modify permissions: Set(emjayess)
15/02/03 09:18:32 INFO Slf4jLogger: Slf4jLogger started
@emjayess
emjayess / davinci-cover-letter.md
Created Nov 24, 2014
Leonardo da Vinci's job application/appeal to Ludovico Sforza
View davinci-cover-letter.md

The Skills of Leonard da Vinci

via Letters of Note

My Most Illustrious Lord,

Having now sufficiently seen and considered the achievements of all those who count themselves masters and artificers of instruments of war, and having noted that the invention and performance of the said instruments is in no way different from that in common usage, I shall endeavour, while intending no discredit to anyone else, to make myself understood to Your Excellency for the purpose of unfolding to you my secrets, and thereafter offering them at your complete disposal, and when the time is right bringing into effective operation all those things which are in part briefly listed below:

  1. I have plans for very light, strong and easily portable bridges with which to pursue and, on some occasions, flee the enemy, and others, sturdy and indestructible either by fire or in battle, easy and convenient to lift and place in position. Also means of burning and destroy
View gist:95555934ebf1ed6a8162
This file has been truncated, but you can view the full file.
emjayess$ npm search express
npm info it worked if it ends with ok
npm verb cli [ 'node', '/usr/local/bin/npm', 'search', 'express' ]
npm info using npm@2.1.6
npm info using node@v0.10.33
npm verb node symlink /usr/local/bin/node
npm verb mapToRegistry name -/all
npm verb mapToRegistry uri https://registry.npmjs.org/-/all
npm info get /Users/emjayess/.npm/registry.npmjs.org/-/all/.cache.json
@emjayess
emjayess / drupal-cache-tables
Last active Aug 29, 2015
MySQL statement to show tables with 'cache' in the table name
View drupal-cache-tables
#mysql> show tables from `mydrupaldb` where `tables_in_mydrupaldb` like '%cache%';
mysql> show tables like '%cache%'; # this works, for just a single pattern match
+----------------------------------+
| Tables_in_mydrupaldb |
+----------------------------------+
| cache |
| cache_admin_menu |
| cache_apachesolr |
| cache_block |
| cache_bootstrap |