Skip to content

Instantly share code, notes, and snippets.

View ryanmortier's full-sized avatar

Ryan Mortier ryanmortier

View GitHub Profile
<?php
namespace App\Providers;
use App\Permission;
use Illuminate\Support\Facades\Gate;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
@djaiss
djaiss / progress_bar_migration_laravel.php
Last active January 24, 2024 13:40
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();
@meigwilym
meigwilym / console.php
Last active March 5, 2024 02:20
Laravel Create User Command
<?php
// routes/console.php
// quickly create an user via the command line
Artisan::command('user:create', function () {
$name = $this->ask('Name?');
$email = $this->ask('Email?');
$pwd = $this->ask('Password?');
// $pwd = $this->secret('Password?'); // or use secret() to hide the password being inputted
\DB::table('users')->insert([
@afiqiqmal
afiqiqmal / SocialController.php
Last active January 12, 2024 03:25
Example usage of Socialite with one Controller in Laravel
<?php
namespace App\Http\Controllers;
use App\Traits\SocialUsers;
use Illuminate\Http\Request;
use Laravel\Socialite\Facades\Socialite;
class SocialController extends Controller
{
@Pathoschild
Pathoschild / stardew-mod-recommendations.md
Last active April 24, 2024 13:46
Stardew Valley mod recommendations

Here are the mods I recommend. These are all compatible with the latest versions of SMAPI and Stardew Valley on Linux/macOS/Windows. See the player's guide to using mods if you're interested.

Quality of life

I think the best mods are those which improve the game while maintaining its balance, lore, and style.

  • AutoGate
    Gates open automatically when you approach and close behind you.

  • Better Sprinklers Plus
    Customise the sprinkler radius, with a proportional change to their cost. If you're willing to mine all the ores you'll need, that makes the basic sprinklers useful early in the game and lets you do more than just watering crops every day.

// ...
let webpack = require("webpack");
mix.webpackConfig({
plugins: [
// Choose the language you want to keep (Ex: "fr")
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /fr/)
]
});
@isuzuki
isuzuki / .php_cs
Last active September 26, 2022 19:58
Config for PHP-CS-Fixer ver 2 (based on laravel .php_cs https://github.com/laravel/framework/blob/5.4/.php_cs)
<?php
/**
* Config for PHP-CS-Fixer ver2
*/
$rules = [
'@PSR2' => true,
// addtional rules
@othyn
othyn / factorio_headless_guide.md
Last active April 15, 2024 08:27
How to setup a Factorio Headless Server

[LINUX] Factorio Headless Server Guide

So, with credit to the Factorio wiki and cbednarski's helpful gist, I managed to eventually setup a Factorio headless server. Although, I thought the process could be nailed down/simplified to be a bit more 'tutorialised' and also to document how I got it all working for my future records.

The specific distro/version I'm using for this guide being Ubuntu Server 16.04.1 LTS. Although, that shouldn't matter, as long as your distro supports systemd (just for this guide, not a Factorio headless requirement, although most distros use it as standard now). The version of Factorio I shall be using is 0.14.20, although should work for any version of Factorio 0.14.12 and higher.

Just a note to newcomers: If there are any issues with the installation steps, people in the comments are doing a good job

Real-time Grid Component with Laravel, Vue.js, Vuex & Socket.io (Google Docs-like Functionality)

Motivation

The exercise of writing this tutorial -- as well as recording it as a screencast -- has helped me better understand the concepts behind a couple of my favorite open source tools. Both the tutorial and screencast will be of personal use in the future as references. If they are of help to others, that will be great too.

I love Google Docs' real-time, multi-user interactive capability, and I've have always been a fan of spreadsheets. I wanted to see if I could replicate that type of functionality. What I've done is taken the basic Vue.js Grid Component example and altered it a bit so that when a user clicks on a cell, that cell becomes highlighted or "active", not just in the user's browser but in any browser instance cur