Skip to content

Instantly share code, notes, and snippets.

View pablorsk's full-sized avatar

Pablo Reyes pablorsk

View GitHub Profile
{
"generator-fountain-angular1": {
"version": "0.6.0",
"props": {
"framework": "angular1",
"modules": "webpack",
"js": "typescript",
"css": "scss",
"resolved": "/usr/lib/node_modules/generator-fountain-webapp/node_modules/generator-fountain-angular1/generators/app/index.js",
"namespace": "fountain-angular1",
#!/bin/bash
sudo -u mypleksuser /opt/plesk/php/7.0/bin/php /usr/lib64/plesk-9.0/composer.phar install
@pablorsk
pablorsk / CorsMiddleware.php
Last active August 15, 2020 20:23
CORS middleware for Lumen and PSR-7
<?php
namespace App\Http\Middleware;
use Closure;
class CorsMiddleware
{
/**
* Handle an incoming request.
@pablorsk
pablorsk / .htaccess
Last active December 4, 2017 00:12
apache .htaccess cors buster
<IfModule mod_headers.c>
RewriteCond %{REQUEST_METHOD} OPTIONS [NC]
# Only paths starting with /api/
RewriteCond %{REQUEST_URI} ^/api/ [NC]
RewriteRule ^(.*)$ $1 [L,R=204,ENV=CORS:true]
Header always set X-Content-Type-Options "nosniff"
Header always set X-XSS-Protection "1; mode=block"
Header always set Access-Control-Max-Age 1728000 env=CORS
@pablorsk
pablorsk / Simple-MercadoPago-PHP.md
Last active December 18, 2017 12:19
MercadoPago with PHP --> SIMPLE!

Send your users to https://www.mercadopago.com/mla/checkout/pay?pref_id=$pref_id

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,DELETE,PUT';
add_header 'Access-Control-Allow-Headers' 'authorization,content-type,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control';
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Access-Control-Allow-Credentials' true;
add_header 'Content-Security-Policy' 'default-src "self"';
@pablorsk
pablorsk / typescript_decorator_example_constructor.ts
Last active January 26, 2023 15:17
TypeScript Decorator: Run code before and after class constructor()
function ClassWrapper() {
return function(target: any) {
// save a reference to the original constructor
var original = target;
// the new constructor behaviour
var f: any = function (...args) {
console.log('ClassWrapper: before class constructor', original.name);
let instance = original.apply(this, args)
console.log('ClassWrapper: after class constructor', original.name);
@pablorsk
pablorsk / Dockerfile
Last active August 27, 2019 09:14
Kubernetes: Helm + Node “Hello world”
FROM busybox
ADD app/index.html /www/index.html
EXPOSE 8005
CMD httpd -p 8005 -h /www; tail -f /dev/null
@pablorsk
pablorsk / bitbucket-pipelines.yml
Created May 16, 2018 11:24
Nanobox on Bitbucket Pipeline
## WARNING!!!
## DONT WORK YET
image: susa4ostec/bitbucket-pipelines-php7.1-mysql
options:
docker: true
pipelines:
default:
@pablorsk
pablorsk / allpdftotext.sh
Created October 13, 2018 15:47
Convert all pdf to text file
#!/bin/bash
#
# Recorre todos los archivos .pdf del directorio actual y genera el .txt correspondiente
#
for file in ./*.pdf
do
echo "Converting $file to $file.txt"
pdftotext -layout "$file" "$file.txt"
done