Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
AnthoniG / types.ts
Created January 14, 2021 14:43 — forked from ClickerMonkey/types.ts
Typescript Helper Types
// when T is any|unknown, Y is returned, otherwise N
type IsAnyUnknown<T, Y, N> = unknown extends T ? Y : N;
// when T is never, Y is returned, otherwise N
type IsNever<T, Y = true, N = false> = [T] extends [never] ? Y : N;
// when T is a tuple, Y is returned, otherwise N
// valid tuples = [string], [string, boolean],
// invalid tuples = [], string[], (string | number)[]
@AnthoniG
AnthoniG / Encryption.js
Last active April 9, 2025 10:33 — forked from ve3/Encryption.js
encrypt/decrypt (PHP & JavaScript).
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
@AnthoniG
AnthoniG / graphql_example.py
Created April 1, 2021 19:31 — forked from gbaman/graphql_example.py
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
"""Blackjack, by Al Sweigart [email protected]
The classic card game also known as 21. (This version doesn't have
splitting or insurance.)
More info at: https://en.wikipedia.org/wiki/Blackjack
This code is available at https://nostarch.com/big-book-small-python-programming
Tags: large, game, card game
[Youtube video] @ (https://www.youtube.com/watch?v=tu0lnL0EbGE)
"""
@AnthoniG
AnthoniG / install-firacode.sh
Created June 5, 2021 12:14 — forked from nikhita/install-firacode.sh
How to install FiraCode font on Linux
mkdir -p ~/.local/share/fonts
for type in Bold Light Medium Regular Retina; do wget -O ~/.local/share/fonts/FiraCode-$type.ttf "https://github.com/tonsky/FiraCode/blob/master/distr/ttf/FiraCode-$type.ttf?raw=true"; done
fc-cache -f
@AnthoniG
AnthoniG / User.php
Created September 18, 2021 04:49
Example of IsAdmin
<?php
namespace App;
use Carbon\Carbon;
use Hash;
use Illuminate\Auth\Notifications\ResetPassword;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
@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
@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 / 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 / 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