Skip to content

Instantly share code, notes, and snippets.

View jenkoian's full-sized avatar
👨‍💻
Works on my machine

Ian Jenkins jenkoian

👨‍💻
Works on my machine
View GitHub Profile
@jenkoian
jenkoian / chris-collins.md
Created June 19, 2017 14:50
Chris Collins
  1. When Chris Collins throws exceptions, it’s across the room.
  2. All arrays Chris Collins declares are of infinite size, because Chris Collins knows no bounds.
  3. Chris Collins doesn’t have disk latency because the hard drive knows to hurry the hell up.
  4. Chris Collins writes code that optimizes itself.
  5. Chris Collins can’t test for equality because he has no equal.
  6. Chris Collins doesn’t need garbage collection because he doesn’t call .Dispose(), he calls .DropKick().
  7. Chris Collins’s first program was kill -9.
  8. Chris Collins burst the dot com bubble.
  9. All browsers support the hex definitions #chris and #collins for the colors black and blue.
  10. MySpace actually isn’t your space, it’s Chris’s (he just lets you use it).
echo "Remove vendor folder"
rm -rf ./vendor/*
echo "Get all vendors again but with the .git folder
composer install --prefer-source
echo "Find a list of all repositories Tobias Nyholm has contributed to
find . -name .git -type d -prune -exec bash -c "cd '{}' && git shortlog -snc | grep 'Tobias Nyholm' > /dev/null && echo '{}' " \;
@jenkoian
jenkoian / dep-questions.md
Last active September 3, 2019 15:34
So you want to use a third party dependency eh?

Questions to ask before deciding on a third party dependency

  • Is it popular? (is it known by the community, does it have a large number of stars on github, large number of downloads etc.)
  • Is it of sufficient quality? (is it well tested etc.)
  • Is it well documented?
  • Are there multiple active maintainers?
  • How will you manage the dependency should it fall in to abandonment?
  • Can you easily write a wrapper for the dependency? (ports and adapters and all that jazz)
  • Is it quicker to write the functionality than it would be to write a wrapper? (if so, consider rolling your own?)
  • Does it have a small footprint? (i.e. doesn't bring in loads of other dependencies itself)
@jenkoian
jenkoian / gaufrette-flysystem-example.php
Created March 7, 2017 09:26
Gaufrette Flysystem example
<?php
// Get legacy gaufrette adapter
$legacyGaufretteAdapter = $legacyService->getFilesystem();
// Create a flysystem adapter
$flysystemAdapter = new GaufretteAdapter($legacyGaufretteAdapter);
// Create your filesystem
$fileSystem = new Filesystem($flysystemAdapter);
@jenkoian
jenkoian / site-snuggler.js
Created October 21, 2016 15:08
Mirror of Mcvities site snuggler so it works over https http://www.mcvities.co.uk/extras/site-snuggler
if(window.SNUGGLE) { SNUGGLE.snug(); }
window.SNUGGLE || (function(window){
window.SNUGGLE = {
snug: function(){
var viewportWidth = document.documentElement.clientWidth,
viewportHeight = document.documentElement.clientHeight;
var body = document.getElementsByTagName('body');
@jenkoian
jenkoian / site-snuggler.css
Created October 21, 2016 15:07
Mirror of Mcvities site snuggler so it works over https http://www.mcvities.co.uk/extras/site-snuggler
#mcvities_snuggletWrapper {
position:fixed;
bottom:0;
width:100%;
height:1px;
pointer-events:none;
z-index: 2147483640;
}
#mcvities_snuggletWrapper.down {
@jenkoian
jenkoian / done-yet.sh
Created September 22, 2016 10:48
Is it done yet?
status=$(curl -L -s -o /dev/null -w "%{http_code}" "http://url/to/check");
if [ "200" == "${status}" ]; then say -v "Good News" "ALL DONE YO!"; elif [ "502" == "${status}" ]; then say -v Whisper "Still Fucked"; else say -v "Bad News" "Not yet"; fi;
@jenkoian
jenkoian / permission-facade-usage-example.php
Created March 21, 2016 11:14
PermissionFacade usage example
<?php
//...
if (PermissionFacade::isGranted(‘add_content’)) {
echo ‘<button>Add content</button>’;
}
@jenkoian
jenkoian / PermissionFacade.php
Created March 21, 2016 11:14
PermissionFacade
<?php
//...
class PermissionFacade
{
/**
* Global static helper for using isGranted from legacy codebase.
* @param $attributes
* @param null $object
* @return bool|void
*/
@jenkoian
jenkoian / PermissionVoter.php
Created March 21, 2016 11:13
PermissionVoter
<?php
//...
class PermissionVoter implements VoterInterface
{
//...
/**
* {@inheritdoc}
*/
public function vote(TokenInterface $token, $object, array $attributes)