Skip to content

Instantly share code, notes, and snippets.

View olivsinz's full-sized avatar
🎯
Focusing

OLIVIER Z. olivsinz

🎯
Focusing
View GitHub Profile
@JustSteveKing
JustSteveKing / pint.json
Last active July 20, 2024 05:13
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,
@mpdude
mpdude / fix-php-cs.yml
Created May 20, 2022 08:57
Run PHP-CS-Fixer on PRs and commit/push back changes
# .github/workflows/fix-php-cs.yml
on:
pull_request:
name: Coding Standards
jobs:
open-pr-for-cs-violations:
name: PHP-CS-Fixer
runs-on: ubuntu-20.04
@olivsinz
olivsinz / uniquable.php
Created May 23, 2020 12:23
PHP Script to Create a unique alphanumeric string like Voucher Code, Referral Code, Coupon Code, OTP or any kind of Promotional Code
<?php
/**
*
*/
trait Uniquable
{
// this function can create a unique alphanumeric string. To create a
// unique string contains letter and number (alphanumeric) with the character limit $limit. These kinds of
// unique string can be used as Voucher Code, Referral Code, Coupon Code, OTP or any kind of Promotional Code.
@danieldogeanu
danieldogeanu / MakePowerShellRememberSSHPassphrase.md
Last active July 22, 2024 22:17
How to make Powershell remember the SSH key passphrase.

You should not use the Open SSH client that comes with Git for Windows. Instead, Windows 10 has its own implementation of Open SSH that is integrated with the system. To achieve this:

  1. Start the ssh-agent from Windows Services:
  • Type Services in the Start Menu or Win+R and then type services.msc to launch the Services window;
  • Find the OpenSSH Authentication Agent in the list and double click on it;
  • In the OpenSSH Authentication Agent Properties window that appears, choose Automatic from the Startup type: dropdown and click Start from Service status:. Make sure it now says Service status: Running.
  1. Configure Git to use the Windows 10 implementation of OpenSSH by issuing the following command in Powershell:
git config --global core.sshCommand C:/Windows/System32/OpenSSH/ssh.exe
@swyxio
swyxio / 1.md
Last active February 8, 2024 22:30
Learn In Public - 7 opinions for your tech career

2019 update: this essay has been updated on my personal site, together with a followup on how to get started

2020 update: I'm now writing a book with updated versions of all these essays and 35 other chapters!!!!

1. Learn in public

If there's a golden rule, it's this one, so I put it first. All the other rules are more or less elaborations of this rule #1.

You already know that you will never be done learning. But most people "learn in private", and lurk. They consume content without creating any themselves. Again, that's fine, but we're here to talk about being in the top quintile. What you do here is to have a habit of creating learning exhaust. Write blogs and tutorials and cheatsheets. Speak at meetups and conferences. Ask and answer things on Stackoverflow or Reddit. (Avoid the walled gardens like Slack and Discourse, they're not public). Make Youtube videos

@BenSampo
BenSampo / deploy.sh
Last active July 16, 2024 07:53
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@joe-dempsey
joe-dempsey / Shopify add color swatches to collection pages.txt
Created June 4, 2018 12:29
Shopify add color swatches/dots to collection pages.
{% capture option_titles %}Color,color,Colour,colour{% endcapture %}
{% assign option_titles = option_titles | split:',' %}
{% for option in product.options %}
{% if option_titles contains option %}
{% capture option_index %}option{{ forloop.index }}{% endcapture %}
{% assign option_values = product.variants | map: option_index | uniq %}
{% if option_values.size != 1 %}
{% for opt in option_values %}
@standaniels
standaniels / after.sh
Last active March 9, 2022 06:08
Create supervisor program for Laravel queue worker in Homestead
#!/bin/sh
# This script creates a supervisor program for the Laravel queue worker and writes
# the log to the storage folder of the project. It also starts the http server on
# port 9001 so you need to add this port forwarding to your Homestead.yaml file.
sudo sh -c 'echo "[inet_http_server]
port = 9001
username = homestead
password = secret
@mazedlx
mazedlx / tailwindcss.blade.php
Created November 5, 2017 12:54
Tailwind CSS template for Laravel pagination
@if ($paginator->hasPages())
<div class="flex items-center">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<span class="rounded-l rounded-sm border border-brand-light px-3 py-2 cursor-not-allowed no-underline">&laquo;</span>
@else
<a
class="rounded-l rounded-sm border-t border-b border-l border-brand-light px-3 py-2 text-brand-dark hover:bg-brand-light no-underline"
href="{{ $paginator->previousPageUrl() }}"
rel="prev"
@aquasmit
aquasmit / laravel-query-many-to-many-relationship.md
Last active August 23, 2021 04:00
Laravel - Eloquent - query many to many relationship

Laravel - Eloquent - query many to many relationship

Example:

Table 1: posts

Table 2: categories

Pivot Table: category_post with foreign keys category_id, post_id