Skip to content

Instantly share code, notes, and snippets.

View sagalbot's full-sized avatar
🏔️

Jeff Sagal sagalbot

🏔️
View GitHub Profile
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
hg root >/dev/null 2>/dev/null && echo '☿' && return
# echo '○'
echo '→'
}
<style lang="scss">
.github-search {
&.panel-default {
border: none;
}
.panel-heading,
.panel-footer {
background: none;
}
@sagalbot
sagalbot / Container.php
Last active April 5, 2017 19:35
A bare-bones PHP IoC container.
<?php
interface Container
{
static function bind($name, Callable $resolver);
static function make($name);
}
@sagalbot
sagalbot / livetemplate
Created June 5, 2017 18:42
PHPStorm Live Template For PHPUnit Tests
/**
* @test
*/
public function $METHOD$()
{
// $TEST$$END$
}
@sagalbot
sagalbot / disable-xdebug.sh
Created August 4, 2017 19:35 — forked from hacfi/disable-xdebug.sh
OS X homebrew php 7.0 enable/disable xdebug extension script
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.1/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
echo "xdebug disabled"
@sagalbot
sagalbot / gulpfile.js
Last active April 13, 2018 05:03
Laravel Elixir + Vueify + Hot Reload. This will get you up and running with Browserify HMR + Vueify + BrowserSync in no time.
var elixir = require('laravel-elixir');
var gutil = require('gulp-util');
// If 'gulp watch' is run
if (gutil.env._.indexOf('watch') > -1) {
// Enable watchify for faster builds
elixir.config.js.browserify.watchify.enabled = true
@sagalbot
sagalbot / yarn_install.sh
Last active May 31, 2020 16:03
Quick Yarn Installs on Laravel Envoyer, share `node_modules` between deployments.
cd {{ release }}
# link node_modules from last deployment
ln -s {{ project }}/node_modules
# update linked folder with latest deps
yarn install
# remove the symlink
rm node_modules
@sagalbot
sagalbot / Modal.js
Last active June 16, 2020 15:11
Modal Escape Hanlding
// in setup() ..
// bind listeners on mount/unmount
useEscapeKeydownWhenMounted(() => {
emit('close');
});
// bind listeners based on condition
useEscapeKeydownWhen(toRef(props, 'open'), () => {
emit('close');
<?php
namespace App\View\Components;
use Illuminate\View\Component;
class Button extends Component
{
public static $class = "py-1 px-2 font-bold uppercase rounded";
@sagalbot
sagalbot / bootstrap.php
Created April 1, 2017 22:50
Testing boilerplate for a WooCommerce extension.
<?php
/**
* PHPUnit bootstrap file
*
* @package Cli_Tests
*/
$wc = getenv( 'WC_TESTS_DIR' ) ? getenv( 'WC_TESTS_DIR' ) : '/tmp/woocommerce/tests';
$wp = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';