Skip to content

Instantly share code, notes, and snippets.

View MizouziE's full-sized avatar
🚲

Sam MizouziE

🚲
View GitHub Profile
@kyleweiner
kyleweiner / PHP getCreditCardExpiryYears
Created November 3, 2012 00:48
PHP: A function that returns an array of years into the future (relative to the current year). Useful dynamically generating credit card expiry years.
// return an array of years relative to the current year
function getCreditCardExpiryYears($yearsFromNow = 10)
{
if ( ! is_numeric($yearsFromNow)) $yearsFromNow = 10;
$thisYear = date('Y');
$untilYear = $thisYear + $yearsFromNow; // e.g. 2012 + 10 = 2022
$years = array();
for ($i = $thisYear; $i <= $untilYear; $i++)
@djaiss
djaiss / laravel-test-job-dispatches-other-jobs.php
Created August 15, 2020 14:06
How to test that a job dispatches another job in Laravel
<?php
namespace Tests\Unit\Jobs;
use Tests\TestCase;
use Illuminate\Support\Facades\Queue;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class FirstJobTest extends TestCase
{
@ziadoz
ziadoz / Laravel-Container.md
Last active January 30, 2024 16:18 — forked from zhilinskiy/Laravel-Container.md
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Translations: Korean (by Yongwoo Lee)

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

@fanuch
fanuch / userscript.js
Last active April 9, 2025 12:45
Block Click to Edit on Jira Issue
// ==UserScript==
// @name Disable Jira Click Edit
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Disable click edit in Jira issue descriptions
// @author fanuch
// @match https://*.atlassian.net/browse/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=atlassian.net
// @grant none
// ==/UserScript==