Skip to content

Instantly share code, notes, and snippets.

View mikedfunk's full-sized avatar

Mike Funk mikedfunk

View GitHub Profile
@JeffreyWay
JeffreyWay / gist:5348385
Last active February 9, 2019 05:56
Quick reminder that you can get away with not injecting Facades. They can be swapped out with mocks quite easily.
<?php
class MyMailer {
public function deliver()
{
// This facade doesn't need to be injected into the class.
Mail::send('emails.welcome', [], function($m)
{
$m->to('[email protected]')
->subject('Welcome to the site')
@JeffreyWay
JeffreyWay / gist:5287312
Last active July 11, 2022 06:09
When you need to make a protected/private property public for testing/inspection.
<?php
# ignore
use \Way\Console\Guardfile;
use Mockery as m;
class GuardfileTest extends \PHPUnit_Framework_TestCase {
public function testCanOverrideDefaultPath()
{
@jpouellet
jpouellet / zbell.sh
Last active November 24, 2023 10:49
Makes Zsh print a bell when long-running commands finish. I use this in combination with i3 and throw big compile jobs (or whatever it may be) into another workspace to get a nice visual notification (workspace indicator turns red) when it's done so I don't need to waste time regularly checking on it.
#!/usr/bin/env zsh
# This script prints a bell character when a command finishes
# if it has been running for longer than $zbell_duration seconds.
# If there are programs that you know run long that you don't
# want to bell after, then add them to $zbell_ignore.
#
# This script uses only zsh builtins so its fast, there's no needless
# forking, and its only dependency is zsh and its standard modules
#
@spicycode
spicycode / .ctags
Created March 27, 2013 14:17
.ctags
-R
--exclude=.svn
--exclude=.git
--exclude=vendor
--exclude=*.min.js
--c++-kinds=+p
--fields=+iaS
--extra=+qf
--totals=yes
--tag-relative=yes
@nikic
nikic / php-5.5-features.md
Last active August 31, 2020 10:39
List of new features in PHP 5.5
@akuzemchak
akuzemchak / l4project.sh
Last active November 16, 2023 08:48
New L4 project with clean history
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
@JeffreyWay
JeffreyWay / reflection.php
Created March 19, 2013 15:31
Test PHP protected/private methods with ease using Reflection.
<?php
// ...
public function testProtected()
{
$dateFormatter = new DateFormatter;
$class = new \ReflectionClass('DateFormatter');
<!-- combine and minify js. add all js files to the first exec command. -->
<target name="compress_js" description="Combine javascript files to one file, compress with yui compressor.">
<tstamp />
<exec logoutput="true" checkreturn="true"
command="cat ${basedir}/assets/js/bootstrap.js ${basedir}/assets/js/bootstrap2.js > ${basedir}/build/tmp.js" />
<jsMin targetDir="${basedir}/assets/cache" suffix=".min.${DSTAMP}" failOnError="false">
<fileset dir="${basedir}/build">
<include name="tmp.js"/>
</fileset>
</jsMin>
@callado4
callado4 / behat-phantomjs-webdriver.md
Last active January 24, 2021 17:10
Instructions on how to make behat (with mink) use the phantomjs webdriver to run headless browser tests

Making behat use phantomjs for the tests

If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0

phantomjs:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://dev.local
            goutte: ~
            selenium2:
 wd_host: "http://localhost:8643/wd/hub" 
@kylefox
kylefox / gist:4512777
Created January 11, 2013 18:15
If you want to use Xcode's FileMerge as your git mergetool, this is how you set it up.
# Tell system when Xcode utilities live:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# Set "opendiff" as the default mergetool globally:
git config --global merge.tool opendiff