Skip to content

Instantly share code, notes, and snippets.

View martio's full-sized avatar

Marcin Lewandowski martio

View GitHub Profile
@monkeyphysics
monkeyphysics / App\Casts\Point.php
Last active April 12, 2025 13:51
Laravel MySQL Point Cast class
<?php
namespace App\Casts;
use Illuminate\Support\Facades\DB;
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
// todo: make it even better by implementing a Point class and working with that
class Point implements CastsAttributes
@JustSteveKing
JustSteveKing / pint.json
Last active November 15, 2025 13:30
Laravel Pint configuration
{
"preset": "per",
"rules": {
"align_multiline_comment": true,
"array_indentation": true,
"array_syntax": true,
"blank_line_after_namespace": true,
"blank_line_after_opening_tag": true,
"combine_consecutive_issets": true,
"combine_consecutive_unsets": true,
@Daniyal-Javani
Daniyal-Javani / docker-compose.yml
Last active August 3, 2025 13:45
Laravel sail with phpMyAdmin
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
environment:
@martio
martio / SetLocale.php
Created December 30, 2020 20:30
Detect language and set locale in Laravel using middleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class SetLocale
{
/**
@robhrt7
robhrt7 / MySQL_5-7_macOS.md
Last active October 5, 2025 11:57 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@DawidMyslak
DawidMyslak / vue.md
Last active April 22, 2024 12:49
Vue.js and Vuex - best practices for managing your state

Vue.js and Vuex - best practices for managing your state

Modifying state object

Example

If you have to extend an existing object with additional property, always prefer Vue.set() over Object.assign() (or spread operator).

Example below explains implications for different implementations.

@yosukehasumi
yosukehasumi / readme.md
Last active October 22, 2021 15:12
DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

DigitalOcean Rails/Ubuntu/NGINX (16.04) Setup

  1. Setup
  2. Swapfile
  3. NGINX
  4. ElasticSearch
  5. RVM
  6. Rails
  7. Postgres
  8. Capistrano
@vielhuber
vielhuber / script.sh
Last active November 26, 2025 02:19
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@beiker
beiker / laravel-project.sh
Last active October 2, 2019 20:39
Bash script that creates a new laravel project and performs all Homestead configurations for you
#!/bin/bash
# This script creates a new laravel project and performs all Homestead configuration for you.
#
# This are some other things that the script do for you:
#
# - Add the new site to the /etc/hosts file
# - Add the configurations (folders, sites, databases) to the Homestead.yaml file
# - Creates the database in mysql or postgres
# - Serve the new site in homestead
@sangar82
sangar82 / gist:e83e255da149882582b8
Last active April 17, 2025 09:48
Redis laravel example
Route::get('redis', array('as' => 'cache', 'do' => function()
{
$redis = Redis::connection();
//STRING
$redis->set('name', 'Taylor');
$name = $redis->get('name');
// LIST
// A list is a series of ordered values. Some of the important commands for interacting with lists are RPUSH, LPUSH, LLEN, LRANGE, LPOP, and RPOP.