Skip to content

Instantly share code, notes, and snippets.

View sander3's full-sized avatar

Sander de Vos sander3

View GitHub Profile
<?php
declare(strict_types=1);
use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\StaticCall\RemoveParentCallWithoutParentRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\PHPUnit\AnnotationsToAttributes\Rector\ClassMethod\DataProviderAnnotationToAttributeRector;
@sander3
sander3 / install.sh
Last active July 18, 2021 19:16
install.sh
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
mkdir -p .local/bin
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zprofile
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin:$PATH"' >> ~/.zprofile
@sander3
sander3 / gist:94662eb23138c8d5009ab8ffa20d1d71
Created June 29, 2021 21:57
Preferences.sublime-settings
// Settings in here override those in "Default/Preferences.sublime-settings",
// and are overridden in turn by syntax-specific settings.
{
"rulers": [80, 120],
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": "all",
"trim_only_modified_white_space": false,
"ensure_newline_at_eof_on_save": true,
"bold_folder_labels": true,
"show_git_status": false,
@sander3
sander3 / elasticsearch.sh
Created June 16, 2020 10:37
Temporarily downgrade Elasticsearch to 6.8.8
brew services stop elasticsearch
sleep 2
brew uninstall elasticsearch
rm -Rf /usr/local/etc/elasticsearch
rm -Rf /usr/local/var/lib/elasticsearch/
brew install https://raw.githubusercontent.com/ankane/homebrew-core/63f95f490c63758eba124d97803f26be3e3362ba/Formula/elasticsearch.rb
brew services start elasticsearch
sleep 35
open -a http://localhost:9200
@sander3
sander3 / xcode.md
Last active April 24, 2020 09:18
gyp: No Xcode or CLT version detected!

Problem

You might encounter the following error between Yarn upgrades using Brew on macOS: "gyp: No Xcode or CLT version detected!"

Normally you'd easily resolve this issue by installing Xcode command line tools. If you stumble upon the following message after an installation attempt, use the solution below. "xcode-select: error: command line tools are already installed, use "Software Update" to install updates"

Solution

sudo rm -R -f $(xcode-select --print-path)
@sander3
sander3 / mp-1-g3.md
Created October 3, 2018 16:05
Medium post 1, Gist 3
$teams = App\Team::whereHas('portfolios', function ($query) use ($user) {
    // Only include teams with portfolios where...
    $query->whereHas('wallets', function ($query) use ($user) {
        // ...there are wallets...
        $query->whereHas('transactions', function ($query) {
            // ...with pending transactions...
            $query->whereStatus('pending');
        });
@sander3
sander3 / mp-1-g2.md
Last active December 8, 2020 09:14
Medium post 1, Gist 2
$teams = App\Team::with([
    'portfolios' => function ($query) use ($user) {
        // Only include portfolios where...
        $query->whereHas('wallets', function ($query) use ($user) {
            // ...there are wallets...
            $query->whereHas('transactions', function ($query) {
                // ...with pending transactions...
                $query->whereStatus('pending');
            });
@sander3
sander3 / mp-1-g1.md
Created October 3, 2018 15:28
Medium post 1, Gist 1
$users = App\User::with(['posts' => function ($query) {
    $query->where('title', 'like', '%first%');
}])->get();
@sander3
sander3 / dragon.py
Last active May 11, 2018 19:13
WIP
import pickle
import os
import mimetypes
import face_recognition
from heapq import nsmallest
import shutil
dump = 'data.dat'
allowedMimetypes = [