Skip to content

Instantly share code, notes, and snippets.


iraklisg iraklisg

View GitHub Profile
fourstacks / TestCase.php
Created Sep 9, 2020
Example TestCase using Laravel 8 model factories
View TestCase.php
namespace Tests;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Illuminate\Support\Str;
abstract class TestCase extends BaseTestCase
thecrypticace / ParentChildHierarchy.php
Last active Feb 20, 2020
Eloquent recursive relationships
View ParentChildHierarchy.php
namespace App;
use Illuminate\Database\Eloquent\Collection;
class ParentChildHierarchy
public static function apply($entities, $primaryKey = "id", $parentKey = "parent_id", $parentRelation = "parent", $childRelation = "children")
mistic100 / vimeo-downloader.js
Created Sep 15, 2018
Download video from Vimeo (chopped m4s files)
View vimeo-downloader.js
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
EmadAdly /
Last active May 14, 2021
Adding eslint to your Laravel application

1. Add eslint and eslint-loader and eslint-plugin-vue to your projects package.json file

npm i eslint eslint-loader eslint-plugin-vue --save-dev

2. Create a base configuration by --init

automaticit /
Created Nov 21, 2017
Hide Firefox Quantum tab bar
# Based upon [[][How to hide tab bar (tabstrip) in Firefox 57+ Quantum]] by [[][VasyaNovikov]]
# This causes the [[][The Back Button is top right under the Red close button on my Mac]] issue.
# Resolve that by right-clicking the toolbar, then inserting three Flexible Space into the toolbar on the far-left-hand side.
case $( uname ) in
profile_dir=~/.mozilla/firefox/$( ls -tr ~/.mozilla/firefox/ | grep -v profiles.ini | tail -1 )
mentos1386 / Webstorm-Airbnb-Javascript-codeStyle.xml
Created Mar 12, 2017
Airbnb inspired Webstorm Javascript CodeStyle
View Webstorm-Airbnb-Javascript-codeStyle.xml
<code_scheme name="Airbnb">
<option name="RIGHT_MARGIN" value="100" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_ELEMENTS_TO_INSERT_NEW_LINE_BEFORE" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<case-options enabled="false">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
fideloper /
Last active Mar 18, 2021
Enable/Disable xDebug depending on env.
#!/usr/bin/env bash
# A CMD or ENTRYPOINT script for a Dockerfile to use to start a Nginx/PHP-FPM
# For more details, see 🐳
if [ ! "production" == "$APP_ENV" ] && [ ! "prod" == "$APP_ENV" ]; then
# Enable xdebug
ipbastola /
Last active May 5, 2021
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64


Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
yoavniran /
Last active May 14, 2021
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
ghinda / object-to-form-data.js
Last active May 10, 2021
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
View object-to-form-data.js
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {