Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View emjayess's full-sized avatar
💭
🪞 mirroring repos from gitlab

Matthew J. Sorenson emjayess

💭
🪞 mirroring repos from gitlab
View GitHub Profile
@emjayess
emjayess / drush-mac
Created April 18, 2024 19:06
temporary drush command file to use a specific brew-managed php installation on macos
#!/opt/homebrew/Cellar/php@8.1/8.1.27/bin/php
<?php
require __DIR__ . '/drush.php';
@emjayess
emjayess / amd-loading.js
Created July 17, 2012 19:13
alternative approaches / patterns to AMD-style module loading
/**
* AMD module loading patterns: 2 possible approaches
*/
define(['dojo/query', 'dojo/on'], function(query, on){
// my module code
});
// oft-favored for maintaining modules per line of code
define(function(require) {
if (App::environment(['local', 'staging'])) {
Route::get('phpinfo', phpinfo());
}
@emjayess
emjayess / gist:95555934ebf1ed6a8162
Created October 28, 2014 05:36
npm search express
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
npm WARN Building the local index for the first time, please be patient
@emjayess
emjayess / git_branching_model_considered.md
Last active February 17, 2021 16:09
A Git branching model considered...

Feature development - proposed branching model (graph)

Take a feature: like 'OBH'

__ master ______________________________________.___________________
  \                                            / (pull request ^)
   \__ develop ____________________________.__/_____________________
      \                                   / (pull request ^)
       \__ develop/obh/master _[._._._.]_/                          
<?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';
<?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');
})
@emjayess
emjayess / async-css.js
Created October 10, 2012 21:49
simple async loading patterns
// load a style
;(function(d) {
var lnk = d.createElement('link'), h = d.getElementsByTagName('head')[0];
lnk.href = 'css.css';
lnk.type = 'text/css';
lnk.rel = 'stylesheet';
h.appendChild(lnk);
}​(document))​​​​;
@emjayess
emjayess / percona-wizard-macaroni-mysql.cnf
Created September 17, 2012 17:31
sample mysql config via the percona configuration wizard
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
[mysql]
# CLIENT #
port = 3306
socket = /usr/local/mysql/data/mysql.sock
[mysqld]
<?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