Skip to content

Instantly share code, notes, and snippets.

View royduin's full-sized avatar

Roy Duineveld royduin

View GitHub Profile
@t04glovern
t04glovern / spell-check-post.py
Last active December 6, 2024 12:46
Quick and Dirty OpenAI spell checker for your markdown files
#!/usr/bin/env python3
#
# pip install python-frontmatter openai
# ./spell-check-post.py content/blog/amazon-eventbridge-slack-notification-on-event/index.mdx
#
# The following file will be created:
# content/blog/amazon-eventbridge-slack-notification-on-event/index.new.mdx
#
# Follow the stream of content:
# tail -f content/blog/amazon-eventbridge-slack-notification-on-event/index.new.mdx
@thijsbouwes
thijsbouwes / BedrockPublicValetDriver.php
Last active January 24, 2020 08:05
Valet bedrock driver, serving from the public folder instead of the web folder. Also see: https://github.com/laravel/valet/blob/master/cli/drivers/BedrockValetDriver.php
<?php
class BedrockPublicValetDriver extends BasicValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
@laravel-shift
laravel-shift / .php-cs-fixer.php
Last active March 29, 2025 12:18
PHP CS Fixer - Laravel Coding Style Ruleset
<?php
use PhpCsFixer\Config;
use PhpCsFixer\Finder;
$rules = [
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'default' => 'single_space',
@baranovxyz
baranovxyz / Map.vue
Last active October 30, 2021 13:46
Example of using datamaps with vuejs
<template>
<div class="map" :style="`height: ${height}px;`">
<svg ref="svg" class="map-container"
xmlns="http://www.w3.org/2000/svg"
:width="width" :height="height"
shape-rendering="geometricPrecision"
:viewBox="`500 100 200 400`"
>
</svg>
</div>
@dunglas
dunglas / example.php
Created April 19, 2018 06:25
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@lamberttraccard
lamberttraccard / Permission.php
Last active July 6, 2022 15:54
Middleware Permission to dynamically authorize users for spatie/laravel-permission
<?php
namespace App\Http\Middleware;
use App\Exceptions\UnauthorizedException;
use App\Http\Controllers\UsersController;
use Closure;
class Permission
{
@simonhamp
simonhamp / AppServiceProvider.php
Last active May 2, 2025 14:33
A pageable Collection implementation for Laravel
<?php
namespace App\Providers;
use Illuminate\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
class AppServiceProvider extends ServiceProvider
{
public function boot()
@Mevrael
Mevrael / mysql_5.7_join_json_column_id.sql
Last active January 11, 2024 16:58
MySQL 5.7 JOIN on JSON column of IDs
# Example for MySQL 5.7 how to use JOIN on 2 tables without junction table using new JSON column type.
# Let say we have 2 tables: posts and users
# Users may like posts
# We store the IDs of users who liked each post in posts.liked column which is a JSON array
# which might have a content like "[1, 2, 5, 10]"
SELECT posts.id AS post_id, users.id AS liked_by_user_id FROM posts JOIN users ON JSON_CONTAINS(posts.liked, CAST(users.id AS CHAR))
@jbanety
jbanety / build_pcntl.sh
Last active February 6, 2024 02:50
(Updated) Build PCNTL ext for MAMP PHP 7.4.2
#!/bin/bash
PHP_VERSION=7.4.2
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl lzlib curl imap-uw readline postgresql gettext libxslt libiconv bison pkg-config krb5 bzip2 openldap tidy-html5
# Dirs
@0b10011
0b10011 / Converter.php
Created July 10, 2015 05:06
YouTube Video Renderer for CommonMark
<?php
namespace CommonMark;
use CommonMark\Inline\Processor\YouTubeVideoProcessor;
use CommonMark\Inline\Renderer\YouTubeVideoRenderer;
use League\CommonMark\Converter;
use League\CommonMark\Environment;
use League\CommonMark\DocParser;