Skip to content

Instantly share code, notes, and snippets.

View jsanta's full-sized avatar

Jose Ignacio Santa Cruz G. jsanta

View GitHub Profile
@jsanta
jsanta / WhatsApp_HD_Handbrake.json
Last active January 11, 2023 12:17
Handbrake video compression settings
{
"PresetList": [
{
"AlignAVStart": true,
"AudioCopyMask": [
"copy:mp3"
],
"AudioEncoderFallback": "mp3",
"AudioLanguageList": [],
"AudioList": [
@jsanta
jsanta / @scullyio+scully-plugin-puppeteer+2.1.41.patch
Created November 25, 2022 14:39
Hot patch for Scully puppeteer plugin
diff --git a/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js b/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js
index a9beeba..57b0ba7 100644
--- a/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js
+++ b/node_modules/@scullyio/scully-plugin-puppeteer/src/lib/plugins-scully-plugin-puppeteer.js
@@ -23,7 +23,7 @@ catch (e) {
// version = jsonc.parse(readFileSync(join(__dirname, '../../../package.json')).toString()).version || '0.0.0';
}
const puppeteerRender = (route) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
- const timeOutValueInSeconds = 25;
+ const timeOutValueInSeconds = scully_1.scullyConfig.renderTimeout ?? 25;
diff --git a/node_modules/strapi-plugin-rest-cache/server/services/cacheStore.js b/node_modules/strapi-plugin-rest-cache/server/services/cacheStore.js
index 97352f1..5476520 100644
--- a/node_modules/strapi-plugin-rest-cache/server/services/cacheStore.js
+++ b/node_modules/strapi-plugin-rest-cache/server/services/cacheStore.js
@@ -134,8 +134,8 @@ function createCacheStoreService({ strapi }) {
}
return keys
- .filter((key) => keysPrefixRe.test(key))
- .map((key) => key.replace(keysPrefixRe, ''));
@jsanta
jsanta / preload-css.plugin.ts
Created March 21, 2022 14:45
Base Scully configuration example for Angular App + PreloadCss plugin
import { registerPlugin } from '@scullyio/scully';
export const PreloadCssPlugin = 'PreloadCssPlugin';
export const preloadCssHandler = async (html: string): Promise<string> => {
html = html.replace(
/<link rel="stylesheet" href="([\w\d\.-]+\.css)">/g,
`<link rel="preload" as="style" href="$1">
<link rel="stylesheet" type="text/css" media="print" onload="this.media='all';" href="$1">
@jsanta
jsanta / server.ts
Created March 21, 2022 14:37
Fast Angular Universal SSR server example with Redis, compression, map "security" (for curious developers) and API proxy endpoint
import 'zone.js/node';
import 'dotenv/config';
import '@ng-web-apis/universal/mocks';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { join } from 'path';
import { AppServerModule } from './src/main.server';
import { APP_BASE_HREF } from '@angular/common';
@jsanta
jsanta / logger.service.ts
Created March 21, 2022 14:29
Angular logger service. Wrapper for console log, will log only on development environment (production === false)
import { isPlatformBrowser } from '@angular/common';
import { Inject, Injectable, PLATFORM_ID } from '@angular/core';
import { environment } from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class LoggerService {
constructor(@Inject(PLATFORM_ID) private platform: any) {
@jsanta
jsanta / abstract-cache.service.ts
Created March 21, 2022 14:25
Angular cache service + TTL & cache interceptor
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
// Ref https://medium.com/@AurelienLeloup/cache-http-requests-with-rxjs-for-angular-eb9bee93824d
type CacheItem<T> = {
date : Date,
value: Observable<T>
};
@Injectable({
@jsanta
jsanta / custom-puppeteer-render.plugin.ts
Created November 9, 2021 15:47
Puppeteer enterpise plugin for Scully. Basically a huge copy & paste from the original PuppeteerRender plugin, but with some extra attributes for configuration.
/**
* Patched to include timeout support
*/
// tslint:disable: no-string-literal
// const puppeteer = require('puppeteer');
import { HandledRoute, scullyConfig, log, logError, logWarn, createFolderFor, registerPlugin, getPluginConfig } from '@scullyio/scully';
import { scullySystem } from '@scullyio/scully/src/lib/pluginManagement/pluginRepository';
import { launchedBrowser, reLaunch } from '@scullyio/scully/src/lib/renderPlugins/launchedBrowser';
import { ssl, showBrowser } from '@scullyio/scully/src/lib/utils';
@jsanta
jsanta / motospeed_ck62.json
Created February 26, 2021 15:52
Karabiner configuration file for Motospeed CK62 mechanical keyboard
{
"title": "Motospeed CK62 nearly as Apple keyboard",
"rules": [
{
"description": "Modifiers position: Left Ctrl Alt/Option Command - Right Command Alt/Option Fn (CK62 Fn key is unused)",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "application"
@jsanta
jsanta / gist:231bb5c65a1faf7571c846dfc49a3263
Last active January 5, 2021 15:40
Example Angular component that loads external libraries
import { RemoteLibraryService } from './../services/remote-library.service';
import { Component, OnInit, AfterViewInit, OnDestroy } from '@angular/core';
declare global {
var externalLibrary: any;
var otherExternalLibrary: any;
}
@Component({
selector: 'app-wrapper',