Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
AnthoniG / image.ts
Created May 25, 2022 17:49 — forked from jacob-ebey/image.ts
Remix Image Component
import { createHash } from "crypto";
import fs from "fs";
import fsp from "fs/promises";
import path from "path";
import https from "https";
import { PassThrough } from "stream";
import type { Readable } from "stream";
import type { LoaderFunction } from "remix";
import sharp from "sharp";
import type { Request as NodeRequest } from "@remix-run/node";
@AnthoniG
AnthoniG / sw-test-cleaup.js
Created May 3, 2022 10:52 — forked from gauntface/sw-test-cleaup.js
Function to unregister SW and clear out old caches.
window.__testCleanup = () => {
const unregisterSW = () => {
return navigator.serviceWorker.getRegistrations()
.then((registrations) => {
const unregisterPromise = registrations.map((registration) => {
return registration.unregister();
});
return Promise.all(unregisterPromise);
});
};
@AnthoniG
AnthoniG / Skrotlin.kt
Created April 22, 2022 15:11 — forked from marquesds/Skrotlin.kt
A simple web scraping with Kotlin
// Crawler.kt
import kotlinx.coroutines.*
import org.json.JSONObject
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import org.jsoup.select.Elements
class Crawler {
@AnthoniG
AnthoniG / convert_bytes.php
Last active March 16, 2022 14:38 — forked from eusonlito/foldersize.php
PHP function to get the folder size including subfolders
function sizeFilter($bytes)
{
$label = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
for ($i = 0; $bytes >= 1024 && $i < (count($label) - 1); $bytes /= 1024, $i++) ;
return (round($bytes, 2) . " " . $label[$i]);
}
@AnthoniG
AnthoniG / AppServiceProvider.php
Created March 13, 2022 21:06 — forked from simonhamp/AppServiceProvider.php
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()
@AnthoniG
AnthoniG / CMakeLists.txt
Created March 5, 2022 20:13 — forked from silvercircle/CMakeLists.txt
Sample CMake Qt Project for CLion
#
# sample CMakeLists.txt for a simple Qt project using CLion IDE
# shows how to use AUTOMOC, AUTOUIC
#
# sources are expected in source/
# includes in include/
#
cmake_minimum_required(VERSION 3.0)
set(TARGET_NAME Qttest)
@AnthoniG
AnthoniG / README.md
Created January 24, 2022 23:12 — forked from kiliman/README.md
Debug server-side Remix using VSCode

💡 HOWTO: Debug your server-side Remix code using VSCode

In VSCode, I'm using the Attach by Process ID config, so I can select the node process running Express, and voila!

Debugging session even survives edits and Live Reload.

View screencast on YouTube: https://youtu.be/pf9A9nBOnRc

🐛 Launch VSCode debugger

Pick the node process that is running the ./server/index.js file

@AnthoniG
AnthoniG / postman install.md
Last active November 28, 2021 19:47 — forked from trfiladelfo/script.md
install postman in linux mint

When it comes to API development, my weapon of choice for testing my code is Postman. I start using Postman since it's still a Chrome App. Now it encourages its user to use Postman Native app. I definitely love the idea, but all I can find is a download link without any installation document for Linux Mint.

So, here's what I did:

Download postman
$ wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz

Extract archive
$ sudo tar -xzf postman.tar.gz -C /opt
@AnthoniG
AnthoniG / svelte-summit-2020-summary.md
Created November 21, 2021 00:43 — forked from vedam/svelte-summit-2020-summary.md
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.

@AnthoniG
AnthoniG / .htaccess
Created October 15, 2021 21:43 — forked from morcegon/.htaccess
.htaccess optimized for laravel
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache
# config if possible: httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com