Skip to content

Instantly share code, notes, and snippets.

View toofff's full-sized avatar
🙃

Toofff toofff

🙃
View GitHub Profile
@dhh
dhh / linux-setup.sh
Last active April 18, 2024 14:12
linux-setup.sh
# CLI
sudo apt update -y
sudo apt install -y \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev \
redis-tools sqlite3 libsqlite3-0 libmysqlclient-dev \
rbenv apache2-utils
@mikedidomizio
mikedidomizio / cleanup.sh
Last active May 27, 2022 20:21
Script to delete branches that are stale and have no commits
#!/usr/bin/env bash
# Proceeds to go through remote branches and delete any branch that is over a year old and does not have a commit ahead of master
# Proceeds to output what it will delete
# ./cleanup.sh ../project-directory
# Proceeds to output and delete
# ./cleanup.sh ../project-directory --real-run
@soyuka
soyuka / PropertyMetadataFactory.php
Created February 18, 2021 13:36
API Platform use the Model namespace for the API and the Entity namespace for doctrine
<?php
declare(strict_types=1);
namespace App\Metadata;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\PropertyMetadata;
final class PropertyMetadataFactory implements PropertyMetadataFactoryInterface
@GregoireHebert
GregoireHebert / API-Platform-2.6-admin-login.md
Last active February 17, 2021 13:55
How to create a login experience from the admin with API Platform 2.6

Creating a login experience from the Admin with API Platform 2.6

You can use whatever authentication mode you want, but for the sake of the demonstration let's use JWT.

I'll grab a freshly downloaded api-platform distribution.

from the php container :

	composer require jwt-auth
	apk add openssl

Liste d'acronymes utilisés dans la programmation

Acronyme Définition
Les principes SOLID :
• SRP Single Responsibility Principle
• OCP Open/Closed principle
• LSP Liskov Substitution Principle (un acronyme féministe, du nom de la mathématicienne Barbara Liskov !)
• ISP Interface Segregation Principle (tu vois que ça fait conflit avec "ISP - Internet Service Provider", LAULE)
• DIP Dependency Inversion Principle
@Pierstoval
Pierstoval / Makefile
Last active March 2, 2021 14:38
"Check requirements" command for your Makefile
# Use it like this:
#
# $ printf $(_TITLE) "Something in green" "The message"
#
# This will output something like this:
#
# [Something in green] The message
#
# (of course, with proper colors)
_TITLE := "\033[32m[%s]\033[0m %s\n" # Green text
@vedam
vedam / svelte-summit-2020-summary.md
Last active February 17, 2024 12:45
links and ressources from the svelte-summit-2020 talks

You'll find the talks here


Morgan Williams @mrgnw

The Zen of Svelte

Approaching frontend as a backend developer, Svelte feels surprisingly pythonic. Let's take a quick look at what's familiar, what's foreign, and how to explore the gap.

@versedi
versedi / webpack.config.js
Last active January 18, 2024 13:21
Webpack Encore + Sass + MiniCSSExtractPlugin + PurgeCSS + OptimizeCss + Babel + Typescript
/* eslint-disable no-useless-escape */
const Encore = require('@symfony/webpack-encore');
const TerserPlugin = require('terser-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const HtmlCriticalWebpackPlugin = require('html-critical-webpack-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const PurgeCssPlugin = require('purgecss-webpack-plugin');
const WebpackBar = require('webpackbar');
const path = require('path');
@GregoireHebert
GregoireHebert / ApiResourcesConvertConfigurationCommand.php
Last active November 3, 2022 14:11
Transform ApiResource configuration to XML
<?php
declare(strict_types=1);
namespace App\Command;
use App\Command\DataTransformers\XmlTransformer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
@whoisryosuke
whoisryosuke / nextjs-hoc-authorization.js
Created June 26, 2018 22:24
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side