Skip to content

Instantly share code, notes, and snippets.

View vaporic's full-sized avatar
🏠
Working from home

Hugo Epinosa vaporic

🏠
Working from home
View GitHub Profile
@ikarius6
ikarius6 / rfc.php
Last active February 5, 2016 20:27
Registro Federal de Contribuyentes (RFC) regex PHP
<?php
/*
RFC Regex by Jack
Valid:
JACK880229AA1
JACK880229
Invalid:
JACK880230AA1
JACK890229AA1
@grexlort
grexlort / phonePrefixCodesWithCountry.php
Last active June 1, 2024 01:45
List of phone prefix codes with country in PHP array format prefix => country +xxx
// data from https://gist.github.com/andyj/7108917
$array = [
'44' => 'UK (+44)',
'1' => 'USA (+1)',
'213' => 'Algeria (+213)',
'376' => 'Andorra (+376)',
'244' => 'Angola (+244)',
'1264' => 'Anguilla (+1264)',
'1268' => 'Antigua & Barbuda (+1268)',
@frasurebuilds
frasurebuilds / cdn.html
Created October 7, 2015 17:18
Bootstrap Material Design CDN
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/css/roboto.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/css/material-fullpalette.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/css/ripples.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/js/material.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-material-design/0.3.0/js/ripples.min.js"></script>
<?php
/* PHP Headers for CSV File with UTF-8 - By MrJack*/
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=reporte_ganadores_".date("d-m-Y").".csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "\xEF\xBB\xBF"; //<--- here is the magic
echo "WHATÉVER";
@umrysh
umrysh / mailgun-webhook.php
Created January 29, 2015 23:11
Very simple PHP webhook for Mailgun that emails you on errors.
<?php
$key = "<API Key>";
$from = "[email protected]";
$to = "[email protected]";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(isset($_POST['timestamp']) && isset($_POST['token']) && isset($_POST['signature']) && hash_hmac('sha256', $_POST['timestamp'] . $_POST['token'], $key) === $_POST['signature'])
{
if($_POST['event'] == 'complained') {
@mlconnor
mlconnor / bootstrap_index.html
Last active April 3, 2020 00:44
Bootstrap 3 CDN Template
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 3 Template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap core CSS -->
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" media="screen">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

#Deploy de un sitio web estático en heroku

Supongamos que tienes un archivo index.html con contenido estatico. Renombralo a home.html.

Crea index.php y agrega la siguiente linea:

<?php include_once("home.html"); ?>
<?php
/* Regex generator for valid TLDs - By MrJack*/
$txt = file_get_contents('http://data.iana.org/TLD/tlds-alpha-by-domain.txt');
$tlds = preg_split('/\s+/', $txt);
$valid_tld = array();
foreach($tlds as $tld){
if (! preg_match('/[^a-z]+/i', $tld, $matches)){
if(strlen($tld) > 3){
array_push($valid_tld, strtolower($tld));
}
<?php
$sites = "http://www.broadcastsolutions.com.au/
http://www.kvm.com.au/
http://www.ambertech.com.au/";
$sites = preg_split('/\r\n|\r|\n/', $sites);
echo "