Skip to content

Instantly share code, notes, and snippets.

@jdubwelch
jdubwelch / IDX Env Swap
Created October 9, 2013 19:42
IDX Bookmarklet to swap the URL from dev.lan to idxsandbox.com for easy environment switching.
javascript:(function(){var e=location.href;var t={sbx:"idxsandbox.com",dev:"dev.lan"};var n=e.match(t.sbx);var r=e.match(t.dev);if(n||r){var i,s;if(n){s=t.dev;i=t.sbx}else{i=t.dev;s=t.sbx}window.location=e.replace(i,s)}})()
@jdubwelch
jdubwelch / sbx to staging mini
Created November 7, 2013 20:23
IDX SBX --> Staging Bookmarklet
javascript:(function(){var e=location.href;var t={sbx:"idxsandbox",stg:"idxstaging"};var n=e.match(t.sbx);var r=e.match(t.stg);if(n||r){var i,s;if(n){s=t.stg;i=t.sbx}else{i=t.stg;s=t.sbx}window.location=e.replace(i,s)}})()
@jdubwelch
jdubwelch / BaseModel.php
Last active February 3, 2016 00:53
Multiple Database on Different Servers Laravel Solution
<?php
use Eloquent;
class BaseModel extends Eloquent {
/**
* The default connection
*/
protected $connection = 'db1-mysql';
@jdubwelch
jdubwelch / SassMeister-input.scss
Created November 7, 2014 23:05
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
@function color-diff($color-a, $color-b) {
$hue: hue($color-a) - hue($color-b);
$saturation: saturation($color-a) - saturation($color-b);
$lightness: lightness($color-a) - lightness($color-b);
@jdubwelch
jdubwelch / ctags
Created November 17, 2014 19:55
Ctags command for php project
ctags -R -f .tags --regex-php='/^[ \t]*trait[ \t]+([a-z0_9_]+)/\1/t,traits/i' --regex-php='/abstract class ([^ ]*)/\1/c/' --regex-php='/interface ([^ ]*)/\1/c/' --regex-php='/(public |static |abstract |protected |private )+ function +([^ \(]*)/\2/f/' --exclude=.git --exclude=.svn --exclude=node_modules
@jdubwelch
jdubwelch / Show-all-errors.php
Last active September 20, 2017 21:34
In PHP or Laravel and a type-hint is incorrect is display a blank page and is very difficult to trouble shoot even though display_errors may be on. This snippet found from Stack Overflow made the error display and saved my bacon.
<?php
// ----------------------------------------------------------------------------------------------------
// - Display Errors
// ----------------------------------------------------------------------------------------------------
ini_set('display_errors', 'On');
ini_set('html_errors', 0);
// ----------------------------------------------------------------------------------------------------
// - Error Reporting
@jdubwelch
jdubwelch / Preferences.sublime-settings
Last active August 8, 2016 15:47
My SublimeText 3 Settings... in case I ever delete them.
{
// User Interface Settings
"theme": "Material-Theme.sublime-theme",
"material_theme_small_statusbar": true,
"material_theme_compact_sidebar": true,
"material_theme_tree_headings": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"overlay_scroll_bars": "enabled",
"translate_tabs_to_spaces": true,
"caret_style": "phase",
javascript:
(function(){
var idxID, listingID;
idxID=prompt("MLS (or both):");
var regex = /(?<idxID>[a-z]{1}[0-9]{3})(\/|::listing::)(?<listingID>.*)/gm;
if (match = regex.exec(idxID)) {
idxID = match.groups.idxID;
listingID = match.groups.listingID;
@jdubwelch
jdubwelch / Vim.md
Last active April 3, 2019 19:29
My notes about Vim.
private function test()
{
$query['body']['aggs'] = [
'avg_price_per_month' => [
'date_histogram' => [
'field' => 'metaFields.soldDate',
'interval' => 'month',
'format' => 'M/d/YYYY'
],
[