Skip to content

Instantly share code, notes, and snippets.

@younes0
younes0 / iso-3166-1-alpha3to2.sql
Last active June 8, 2018 11:54
convert ISO 3166-1 countries code from alpha-3 to alpha-2
UPDATE table SET column = 'AD' WHERE column = 'AND';
UPDATE table SET column = 'AE' WHERE column = 'ARE';
UPDATE table SET column = 'AF' WHERE column = 'AFG';
UPDATE table SET column = 'AG' WHERE column = 'ATG';
UPDATE table SET column = 'AI' WHERE column = 'AIA';
UPDATE table SET column = 'AL' WHERE column = 'ALB';
UPDATE table SET column = 'AM' WHERE column = 'ARM';
UPDATE table SET column = 'AN' WHERE column = 'ANT';
UPDATE table SET column = 'AO' WHERE column = 'AGO';
UPDATE table SET column = 'AQ' WHERE column = 'ATA';
@younes0
younes0 / RateLimitSubscriber.php
Last active December 4, 2015 09:13
Rate Limit Subscriber for Guzzle 4.x + Laravel
<?php
/**
* Todo: Decouple from Laravel's Caching system
**/
use GuzzleHttp\Collection;
use GuzzleHttp\Event\BeforeEvent;
use GuzzleHttp\Event\CompleteEvent;
use GuzzleHttp\Event\EmitterInterface;
@younes0
younes0 / DiscogsApi.md
Last active September 20, 2015 16:42
Setting up Discogs PHP API client with OAuth feature

Setting up Discogs PHP API client with OAuth feature

Get these composer packages

"guzzlehttp/guzzle": "4.1.x",
"guzzlehttp/oauth-subscriber": "0.1.x",
"league/oauth1-client": "~1.0",
@younes0
younes0 / react_native_styling.tsx
Created October 21, 2022 13:57
Styling React Native wirth NativeWind + Emotion
// =========================================================================
// tailwind.config.js
// =========================================================================
const { platformSelect } = require("nativewind");
module.exports = {
theme: {
// see: https://www.nativewind.dev/guides/theme-values
// see: https://tailwindcss.com/docs/configuration
extend: {
@younes0
younes0 / package.json
Last active September 19, 2024 12:57
LAN Forwarding to Metro (Expo / React Native) dev server under WSL
{
"private": true,
"scripts": {
"wsl:lan:start": "export env REACT_NATIVE_PACKAGER_HOSTNAME=$(powershell.exe -executionpolicy bypass -File wsl-get-lan-ip.ps1) && yarn wsl:port-forward && yarn start",
"wsl:port-forward": "powershell.exe -executionpolicy bypass -File wsl-port-forward.ps1",
}
}