Skip to content

Instantly share code, notes, and snippets.

View felipelavinz's full-sized avatar

Felipe Lavín Z. felipelavinz

View GitHub Profile
@felipelavinz
felipelavinz / subset-fonts.php
Created January 28, 2021 16:21
A simple PHP script that takes TTF files and produces subsetted WOFF2 files. Requires pyftsubset to perform the actual conversion
<?php
$subsets = [
"cyrillic-ext" => "U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F",
"cyrillic" => "+0400-045F, U+0490-0491, U+04B0-04B1, U+2116",
"greek-ext" => "U+1F00-1FFF",
"greek" => "U+0370-03FF",
"latin-ext" => "U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF",
"latin" => "U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD"
];
@import url("https://fonts.googleapis.com/css?family=Montserrat:400,500,700&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
font-family: "Montserrat", sans-serif;
}
@felipelavinz
felipelavinz / url-parse.js
Created November 4, 2020 19:14
Parsear parámetros URL iframe
var parametrosIframe = 'programas[0][ca]=CODIGO_ACADEMICO&programas[0][nombre]=Nombre+del+programa&programas[0][planificacion]=CODIGO_PLANIFICACION&programas[1][ca]=CODIGO_ACADEMICO_2&programas[1][nombre]=Nombre+programa+2&programas[1][planificacion]=CODIGO_PLANIFICACION_2';
var infoProgramas = [];
var urlParams = new URLSearchParams( parametrosIframe );
var regex = /programas\[(\d+)\]\[(\w+)\]/;
for ( var i of urlParams ) {
var matches = i[0].match(regex);
if ( typeof infoProgramas[ matches[ 1 ] ] === 'undefined' ) {
infoProgramas[ matches[ 1 ] ] = {};
}
infoProgramas[ matches[1] ][ matches[ 2 ] ] = decodeURIComponent( i[1] );
[
{
"elementType": "labels",
"stylers": [
{
"visibility": "off"
}
]
},
{
function base64ToBits( $validFor ) {
if ( empty( $validFor ) ) {
return '';
}
$validForBits = '';
$validForArr = str_split( $validFor );
$base64Chars = str_split('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/');
for ( $i = 0; $i < count( $validForArr ); $i++ ) {
$thisChar = $validForArr[ $i ];
$val = array_search( $thisChar, $base64Chars );
$HTTP["host"] =~ "sitios.ucsc.cl|www.sitios.ucsc.cl|admision.ucsc.cl|www.admision.ucsc.cl|fscu.ucsc.cl|rinie.ucsc.cl|foobar.ucsc.cl" {
# Configuraciónes Basicas
server.document-root = "/var/www/ucsc-minisitios/htdocs"
server.error-handler-404 = "/index.php?error=404"
$HTTP["url"] =~ "^/xmlrpc.php" {
url.access-deny = ( "" )
server.error-handler-404 = "/403.php"
}
{
"dimensions": [{
"id": 1,
"label": "Autonom\u00eda",
"values": [6, 1, 1, 1, 1, 2, 6, 1, 2, 3, 3, 3],
"indicators": [2, 3, 4, 1],
"score": 30,
"answered": 12,
"max": 72,
"min": 12,
@felipelavinz
felipelavinz / lighttpd.conf
Created March 22, 2018 21:17
Mitigación de CVE-2018-6389 para WordPress con lighttpd
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_accesslog",
"mod_evasive"
)
// webpack.config.js
var Encore = require('@symfony/webpack-encore');
var LiveReloadPlugin = require('webpack-livereload-plugin');
Encore
// directory where all compiled assets will be stored
.setOutputPath('dist/')
// what's the public path to this directory (relative to your project's document root dir)
.setPublicPath('/dist')
$HTTP["host"] =~ "www.domain.com|domain.com" {
# Configuraciónes Basicas
server.document-root = "/var/www/htdocs"
server.error-handler-404 = "/index.php?error=404"
$HTTP["url"] =~ "^/xmlrpc.php" {
url.access-deny = ( "" )
server.error-handler-404 = "/403.php"
}