Skip to content

Instantly share code, notes, and snippets.

View martindilling's full-sized avatar
🏴‍☠️

Martin Dilling-Hansen martindilling

🏴‍☠️
View GitHub Profile
@ShawnMcCool
ShawnMcCool / 0---Overview.md
Last active October 7, 2022 07:37
Testing at Boundaries with Test Doubles and Fixtures: A Vertical Slice

Overview

In this gist, I attempt to communicate techniques for defining explicit boundaries over naturally occuring boundaries (in this case, the boundary between domain and service/data layers) to empower both testing and to improve comprehensibility of the system.

In my view, testing and application code are one-and-the-same and should evolve together. Testing code should not be an after-thought. I believe that haphazardly designing application code and test code leads to lead-time penalities.

If you'd like to reply, consider replying to this twitter thread. Additionally, I am available on Twitter @ShawnMcCool.

Note: I acknowledge that no techniques are right for everyone. But I have a long history with these techniques and I found them quite adequate for large and small-scale systems.

@jacobmllr95
jacobmllr95 / imagick3.4.3-PHP7.1-forge.sh
Last active November 28, 2019 01:43 — forked from pascalbaljet/imagick-3.4.0-PHP7-forge.sh
Install Imagick 3.4.3 on PHP 7.1 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.3.tgz
tar xvzf imagick-3.4.3.tgz
# Welcome to Sonic Pi v2.9.0-dev-d0d5c
use_sample_bpm :loop_amen
use_bpm_mul 2
live_loop :foo do
#sync :dr if spread(1,16).tick(:sync)
sample :bd_haus if spread(2,4).tick(:bd)
with_fx :reverb, room: 0.1, damp: 0.1 do
with_fx :echo, mix: 0.1 do
@artzub
artzub / make.sh
Last active September 19, 2024 20:43
Install JetBrains Hub + YouTrack + UpSource + Nginx
#!/bin/bash
apt-get install mc htop git unzip wget curl -y
echo
echo "====================================================="
echo " WELCOME"
echo "====================================================="
echo
echo "Hub"
@ShawnMcCool
ShawnMcCool / instance-reference-sugar-rfc-0.2.php
Last active August 29, 2015 14:16
PHP RFC: Instance Reference Sugar 0.2
====== PHP RFC: Instance Reference Sugar ======
* Version: 0.2
* Date: 2015-03-09
* Author: Shawn McCool, shawn@heybigname.com
* Status: In Discussion
===== Summary =====
In order to access instance variables and methods, one must use the `$this->` prefix.
@xavriley
xavriley / auto_dubstep.rb
Created June 10, 2014 21:33
Auto generating dubstep with Sonic Pi
# DUBSTEP
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
# WOBBLE BASS
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
@laracasts
laracasts / ApiTester.php
Last active February 6, 2020 15:57
Incremental APISs: Refactoring Tests and Traits
<?php
use Faker\Factory as Faker;
abstract class ApiTester extends TestCase {
/**
* @var Faker
*/
protected $fake;

My Validation Base Class

I was asked how I deal with validation / create and update validation rulesets. Well here is one method I have used. Don't be afraid to build on top of what the framework has already given you. In my projects I use a base class for almost anything. You never know when you want your classes to inherit some common functionality. My BaseValidator actually has some pretty useful methods and properties in it.

<?php

namespace FooProject\Internal\Validators;

use FooProject\Internal\Sanitizers\BaseSanitizer;
@wooorm
wooorm / treebankTokenizer.js
Created January 19, 2014 12:58
Penn Treebank Tokenizer in JavaScript. Based on both the Sed script by Robert McIntyre ([cis.upenn.edu][1]), and the Python port by Edward Loper and Michael Heilman ([nltk.org][2]). [1]: http://www.cis.upenn.edu/~treebank/tokenizer.sed [2]: http://nltk.org/_modules/nltk/tokenize/treebank.html
/**
* Author: Titus Wormer <tituswormer@gmail.com>
* URL: http://wooorm.com/penn-treebank-tokenizer-in-javascript.html
*
* The Treebank tokenizer uses regular expressions to tokenize text as in
* Penn Treebank. This implementation is a based on both the Sed script
* written by Robert McIntyre (available at
* [http://www.cis.upenn.edu/~treebank/tokenizer.sed]), and the Python port
* by Edward Loper and Michael Heilman (available at
* [http://nltk.org/_modules/nltk/tokenize/treebank.html]).
<?php
public function update($id, $title, $content, $slug, array $tags, $active, DateTime $publish_date)
{
$post = $this->find($id);
if (Config::get('wardrobe.cache'))
{
// Forget the old cache
Cache::forget('post-'.$post->slug);
}