Skip to content

Instantly share code, notes, and snippets.

View trepichio's full-sized avatar
🧠
Talk is cheap. Show me the code!

João Trepichio trepichio

🧠
Talk is cheap. Show me the code!
View GitHub Profile
@trepichio
trepichio / adaptive.md
Last active December 27, 2023 18:50
SOMOS

Payload da exchange 'plurall::adaptative.indexer.assessment':

Assessement [{ "student_id": "1234 "event_id": "999" "event_name": " "abilities": [{ "ability_code": "MT_5E2.2", "content_code": "ACGTEFIMA5_OBEFIMA78_CN1EFIMA219_CN2EFIMA143",

@trepichio
trepichio / add_port_plugin_management.md
Last active January 21, 2022 19:44
Fix rabbitmq worker

Add plugin management port in rabbitmq.conf file

management.tcp.port = 15672

if plugin is not enabled, enable it adding the following file enabled_plugins in data/rabbitmq/etc/ with content:

[rabbitmq_management].
@trepichio
trepichio / TypedBuilder.ts
Last active May 15, 2022 04:25
Typescript
type Definition = {
vals: number[];
};
type ErrorBrand<Err extends string> = Readonly<{
[k in Err]: void;
}>;
// Entry point for our builder. Unlike the value builder
// pattern example, we don't need a definition value storing the set of
@trepichio
trepichio / flexbox_layouts.md
Last active October 18, 2021 03:19
Flexbox layouts
@trepichio
trepichio / js_one_liner_snippets.js
Last active February 22, 2022 23:43
JS One liners
/* If-else functional */
export const conditionally = (config) => (props) => {
return config.if(props) ?
config.then(props) : config.else(props);
};
/* Try-catch functional */
export function tryCatch({
tryer,
catcher
@trepichio
trepichio / converthtaccess2netilify.sh
Last active November 13, 2021 01:15
Convert htaccess to Netlify redirects
#Convert htaccess to netlify _redirects
grep DirectoryIndex htaccess | awk -F' ' '{print "/", "/"$2, 200}' > _redirects
grep RewriteRule htaccess | grep -v 'robots'| awk -F' ' '{print $2, $3, 200}' | sed -e 's/\^/\//g' | sed -e 's/\$//g' >> _redirects
@trepichio
trepichio / .htaccess
Last active October 13, 2021 22:33
Maintenance page
# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>
@trepichio
trepichio / deploy-vue-heroku.md
Last active September 28, 2021 15:13
Deploy Vue to Heroku
  • Add a node server to serve your files. For this we need a simple express server like this one
const express = require('express');
const serveStatic = require("serve-static")
const path = require('path');
app = express();
app.use(serveStatic(path.join(__dirname, 'dist')));
const port = process.env.PORT || 80;
app.listen(port);
@trepichio
trepichio / deploy_nestjs.md
Last active September 18, 2021 06:02
How to Deploy NestJS Application?: The Platform Generic Steps

How to Deploy NestJS Application?: The Platform Generic Steps

  • [OPTIONAL] Modify src/main.ts to enable CORS:
async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.enableCors();
  await app.listen(process.env.PORT || 3000);
}
@trepichio
trepichio / vscode-repo-badge.md
Last active July 9, 2021 17:39
open-vscode-badge

Replace organization/repo with your GitHub organization and repo.

Open in Visual Studio Code