Skip to content

Instantly share code, notes, and snippets.

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

Francisco Cordova Rios fecori

🏠
Working from home
View GitHub Profile
@fecori
fecori / server.js
Created February 16, 2024 20:49 — forked from leanazulyoro/server.js
Next.js SSR Cache using LRU Cache
const express = require('express')
const next = require('next')
const Cache = require('lru-cache');
const compression = require('compression')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
@fecori
fecori / browsersync.js
Created February 24, 2022 02:21 — forked from tristanisfeld/browsersync.js
Gulp 4 - Multifile tasks w/ external config. Basic gulpfile template for use with multiple task files, using gulp-load-plugins
// =========================================================
// Gulp Task: browsersync
// NOTE: Using gulp v4
// Description: Sync sass, typescript, html, and browser
// using external config or add modify src
// npm install --save-dev browser-sync gulp-typescript gulpjs/gulp.git#4.0 gulp-load-plugins
// Options: node-sass gulp-sass || gulp-ruby-sass
// =========================================================
var config = require('../config.js');
var browserSync = require('browser-sync').create();
<alignment jcr:primaryType="nt:unstructured"
name="./alignChildren"
fieldLabel="Alignment of components"
required="{Boolean}true"
selectionMode="single"
sling:resourceType="granite/ui/components/coral/foundation/form/buttongroup">
<items jcr:primaryType="nt:unstructured">
<default jcr:primaryType="nt:unstructured"
name="./default"
@fecori
fecori / thumbor-php
Created October 16, 2019 22:06
Generar imagenes thumbor con php
<?php
$imgTest = 'https://arc-anglerfish-arc2-prod-gruporepublica.s3.amazonaws.com/public/GDAJPDXRN5EJHNC22N6FTPAWEA.png';
function generarImagen($imgUrl, $witdh = 0, $height = 0)
{
if (!empty($imgUrl) && strpos($imgUrl, 'https') !== false) {
$thumbor_server = "SERVER";
$thumbor_key = "APIKEY";
$parametros = array(
$witdh . "x" . $height,
function convertHtmlToText() {
var inputText = document.getElementById("input").value;
var returnText = "" + inputText;
//-- remove BR tags and replace them with line break
returnText=returnText.replace(/<br>/gi, "\n");
returnText=returnText.replace(/<br\s\/>/gi, "\n");
returnText=returnText.replace(/<br\/>/gi, "\n");
//-- remove P and A tags but preserve what's inside of them
@fecori
fecori / sample-rss-2.0-feed.xml
Created May 14, 2019 23:39 — forked from ToddG/sample-rss-2.0-feed.xml
sample-rss-2.0-feed
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Example Feed</title>
<description>Insert witty or insightful remark here</description>
<link>http://example.org/</link>
<lastBuildDate>Sat, 13 Dec 2003 18:30:02 GMT</lastBuildDate>
<managingEditor>johndoe@example.com (John Doe)</managingEditor>
{
"@context":"http://schema.org",
"@type":"LiveBlogPosting",
"url":"https://elcomercio.pe/deporte-total/futbol-mundial/manchester-city-vs-leicester-vivo-online-ver-gratis-via-directv-sports-duelo-clave-premier-league-noticia-ver-goles-resumen-tendencia-viral-streaming-live-free-632586",
"publisher":{
"@id":"https://elcomercio.pe/#publisher"
},
// Register Custom Taxonomy
function ess_custom_taxonomy_Item() {
$labels = array(
'name' => 'Brands',
'singular_name' => 'Brand',
'menu_name' => 'Brands',
'all_items' => 'All Brands',
'parent_item' => 'Parent Brand',
'parent_item_colon' => 'Parent Brand:',
@fecori
fecori / schema.graphql
Created April 8, 2019 16:46
Example GraphQL schema
schema {
query: RootQueryType
mutation: RootMutationType
}
type RootQueryType {
currentUser: CurrentUser
billing: Billing
}
@fecori
fecori / index.js
Created March 12, 2019 19:22 — forked from sjehutch/index.js
s3-copy-files-node
var AWS = require("aws-sdk");
exports.handler = (event, context, callback) => {
var s3 = new AWS.S3();
var sourceBucket = "SOURCE-BUCKET";
var destinationBucket = "DESTINATION-BUCKET";
var objectKey = event.Records[0].s3.object.key;
var copySource = encodeURI(sourceBucket + "/" + objectKey);
var copyParams = { Bucket: destinationBucket, CopySource: copySource, Key: objectKey };
s3.copyObject(copyParams, function(err, data) {