Skip to content

Instantly share code, notes, and snippets.

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

José Carlos Q. S. josecarlosqs

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<meta charset="UTF-8">
</head>
<body>
<div class="container" style="margin-top: 20px;">
<div class="row">
<?php
@josecarlosqs
josecarlosqs / web-servers.md
Created December 3, 2016 05:37 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
<?php
// Replace special chars to a alphabetical equivalent.
// Reemplaza caracteres especiales a un equivalente alfabético.
function alphabetize_special_chars($str){
$chars = array('á','Á','à','À','â','Â','å','Å','ã','Ã','ä','Ä','æ','Æ','ç','Ç','é','É','è','È','ê','Ê','ë','Ë','í','Í','ì','Ì','î','Î','ï','Ï','ñ','Ñ','ó','Ó','ò','Ò','ô','Ô','ø','Ø','õ','Õ','ö','Ö','ß','ú','Ú','ù','Ù','û','Û','ü','Ü','ÿ');
$replacement = array('a','A','a','A','a','A','a','A','a','A','a','A','ae','AE','c','C','e','E','e','E','e','E','e','E','i','I','i','I','i','I','i','I','n','N','o','O','o','O','o','O','o','O','o','O','o','O','B','u','U','u','U','u','U','u','U','y');
$str = str_replace($chars,$replacement,$str);
return preg_replace("/[^a-z0-9]/i", "", $str);
}
function obtenerDominio($str){
$str = preg_replace('/[^a-zA-Z\:\/\.]/', '', $str);
$str = preg_replace('/http[s]{0,1}\:\/\/w{0,3}\.{0,1}/', '', $str);
$str = explode("/", $str);
return $str[0];
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gamma de colores</title>
<style>
td{
padding:1px;
}
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gamma de colores</title>
<style>
table{
width: 100%;
}
td{
@josecarlosqs
josecarlosqs / gist:ab86d413c0f309ee25a7
Created September 13, 2014 11:09
Entero aleatorio JAVA
public int genAleatorio(int a, int b){
int min = Math.min(a,b);
int max = Math.max(a,b);
return (int)(Math.random*(max-min+1)+min);
}