Skip to content

Instantly share code, notes, and snippets.

View loureirorg's full-sized avatar

Daniel Loureiro loureirorg

View GitHub Profile
@loureirorg
loureirorg / zip_to_state.php
Created November 11, 2018 19:42
State from a zipcode (US)
<?php
function zipToState($zipcode)
{
/* 000 to 999 */
$zip_by_state = [
'--', '--', '--', '--', '--', 'NY', 'PR', 'PR', 'VI', 'PR', 'MA', 'MA', 'MA',
'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA', 'MA',
'MA', 'MA', 'RI', 'RI', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH', 'NH',
'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'ME', 'VT', 'VT',
'VT', 'VT', 'VT', 'MA', 'VT', 'VT', 'VT', 'VT', 'CT', 'CT', 'CT', 'CT', 'CT',
This is a gist that stores images for apps that I am working on.
@loureirorg
loureirorg / metadata-idp.php
Created November 29, 2020 09:58
PHP script to generate an IDP metadata
<?php
/** Composer. */
require 'vendor/autoload.php';
/** My domain and cert. */
$url = 'https://learnwithdaniel.com';
$cert_path = './my.crt';
function x509_content($str) {
$header = '/-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----/sm';