Skip to content

Instantly share code, notes, and snippets.

View djaiss's full-sized avatar
👋
Maker of open source web softwares.

Regis Freyd djaiss

👋
Maker of open source web softwares.
View GitHub Profile
@djaiss
djaiss / gist:2938259
Created June 15, 2012 19:13
PHP List of countries
<?php
$countries =
array(
"AF" => "Afghanistan",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
#!/usr/bin/env bash
# ~/.osx — http://mths.be/osx
# Ask for the administrator password upfront
sudo -v
###############################################################################
# General UI/UX #
###############################################################################
@djaiss
djaiss / gist:85a0ada83e6bca68e41e
Last active April 27, 2026 12:46
Block Twitter/Facebook in your /etc/hosts
# Block Facebook IPv4
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com
127.0.0.1 www.fbcdn.com
127.0.0.1 static.ak.fbcdn.net
@djaiss
djaiss / timezone.php
Last active June 6, 2025 16:15
Timezone in PHP
<?php
return array (
'(UTC-11:00) Midway Island' => 'Pacific/Midway',
'(UTC-11:00) Samoa' => 'Pacific/Samoa',
'(UTC-10:00) Hawaii' => 'Pacific/Honolulu',
'(UTC-09:00) Alaska' => 'US/Alaska',
'(UTC-08:00) Pacific Time (US &amp; Canada)' => 'America/Los_Angeles',
'(UTC-08:00) Tijuana' => 'America/Tijuana',
'(UTC-07:00) Arizona' => 'US/Arizona',
@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
{
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active February 5, 2025 13:59
Laravel: Use progress bars in migrations
<?php
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Output\ConsoleOutput;
class DoSomething extends Migration
{
public function up()
{
$output = new ConsoleOutput();
@djaiss
djaiss / Laravel 6.x Github Action with SQLite
Created November 25, 2019 13:29
Working example on how to use SQLite with a Laravel 6.x installation.
name: Unit tests
on: [push]
jobs:
phpunit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Copy .env
font_family JetBrains Mono Regular Nerd Font Complete
bold_font JetBrains Mono Bold Nerd Font Complete
italic_font JetBrains Mono Italic Nerd Font Complete
bold_italic_font JetBrains Mono Bold Italic Nerd Font Complete
font_size 14
adjust_line_height 140%
cursor_blink_interval 0
enable_audio_bell 0
@djaiss
djaiss / error.blade.php
Last active November 17, 2023 01:55
Laravel flash notification with alpine which hide after a while
@if (session('error'))
<div x-data="{ show: true }" x-show="show" x-init="setTimeout(() => show = false, 3000)" class="pt-6 mx-auto max-w-xl px-2 sm:px-6 lg:px-8">
<div class="flex items-center overflow-hidden border border-red-200 bg-white shadow-sm dark:bg-gray-800 rounded sm:rounded-lg">
<div class="px-2 py-2 bg-orange-100 mr-2">
<x-heroicon-o-light-bulb class="h-5 w-5 text-red-500" />
</div>
<p>{{ session('error') }}</p>
</div>
</div>
<ItemFilter xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><name>Spriggan Form Thorn Totem Shaman Loot Filter</name><filterIcon>14</filterIcon><filterIconColor>10</filterIconColor><description>Strict Filter to farm only useful items. Loot Filter made for a guide "Walking Sim - Spriggan Form Thorn Totem Shaman Build Guide".</description><lastModifiedInVersion>0.9.2.5</lastModifiedInVersion><lootFilterVersion>2</lootFilterVersion><rules><Rule><type>HIDE</type><conditions><Condition i:type="RarityCondition"><rarity>NORMAL</rarity></Condition></conditions><color>0</color><isEnabled>true</isEnabled><levelDependent>false</levelDependent><minLvl>0</minLvl><maxLvl>0</maxLvl><emphasized>false</emphasized><nameOverride /></Rule><Rule><type>HIDE</type><conditions><Condition i:type="RarityCondition"><rarity>MAGIC</rarity></Condition></conditions><color>0</color><isEnabled>true</isEnabled><levelDependent>false</levelDependent><minLvl>0</minLvl><maxLvl>0</maxLvl><emphasized>false</emphasized><nameOverride /></Rule><Ru