Skip to content

Instantly share code, notes, and snippets.

View cyrildewit's full-sized avatar
💭
I may be slow to respond.

Cyril de Wit cyrildewit

💭
I may be slow to respond.
View GitHub Profile
interface ConfirmDialogConfig {
title: string;
text: string;
deleteButtonText: string;
}
/**
* A hook that will allow you to prompt a user for confirmation before doing a delete, by showing a "Are you sure" modal.
* @param action - the action to be performed when the user presses delete
@sirthxalot
sirthxalot / Countries.php
Last active July 6, 2021 12:09
Country List for Laravel's Enum
<?php namespace App\Enums;
use BenSampo\Enum\Enum;
use BenSampo\Enum\Contracts\LocalizedEnum;
final class Countries extends Enum
{
const AF = "Afghanistan";
const AL = "Albania";
const DZ = "Algeria";
@nonsocode
nonsocode / n-errorbag.js
Created August 9, 2018 13:19
A simple Frontend Validation Error bag meant to work with Laravel validation
class ErrorBag {
constructor(errors = {}) {
this.setErrors(errors);
}
hasErrors() {
return !!this.keys.length;
}
get keys() {
@sydgren
sydgren / app\Http\Controllers\Api\Controller.php
Created April 24, 2018 11:42
Laravel API versioning using the Accept-Version header
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller as BaseController;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
abstract class Controller extends BaseController
{
protected $realClass;
@NBZ4live
NBZ4live / LumenAdapter.php
Created March 6, 2018 14:30
PHP-PM Lumen adapter
<?php
namespace App\PHPPM;
use Illuminate\Container\BoundMethod;
use Illuminate\Support\ServiceProvider;
use PHPPM\Bootstraps\Laravel;
class LumenAdapter extends Laravel
{
@avataru
avataru / EloquentCheatSheet.md
Last active May 7, 2024 17:59
Eloquent relationships cheat sheet
@MWins
MWins / project-ideas01.md
Last active May 28, 2024 10:44
Back end Projects - list

Project Ideas

Ok. I'm going to list off some ideas for projects. You will have to determine if any particular idea is good enough to include in a portfolio. These aren't creative ideas. They likely already exist. Some are way too advanced while others are simplistic.

I will recommend to post any project you make to github and make a github project page for it. Explain in as much detail as possible how you made it, how it can be improved etc. Document it.

If you pick an advanced idea, setup a development roadmap and follow it. This will show some project management skills.

Another piece of advice for those who are design challenged. Use different front end frameworks and use different themes for those frameworks to provide appealing designs without looking like yet another bootstrap site.

@pvledoux
pvledoux / ApiVersion.php
Created September 12, 2017 09:18
Laravel 5.5 API versioning based header. It's not working because the route has already been binded, but I kept it here for the record
<?php namespace App;
/**
* ApiVersion class
*
* @author pvl
*/
class ApiVersion
{
private static $valid_api_versions = [
@actionm
actionm / deploy.sh
Created February 28, 2017 19:01
Zero downtime deployment script
# Deployment with zero downtime
# By default keeps 2 last deployments in KEEP_DEPLOYMENTS_DIR and current deployment
# Project domain
PROJECT_NAME=test.com
# Project directory
PROJECT_DIR=/home/forge/test.com
# Deployments directory
KEEP_DEPLOYMENTS_DIR=/home/forge/deploy
@BretFisher
BretFisher / docker-for-mac.md
Last active May 23, 2024 22:25
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1