Skip to content

Instantly share code, notes, and snippets.

View djom202's full-sized avatar

Jonathan Olier djom202

View GitHub Profile
@djom202
djom202 / pbs_files_convert.js
Last active June 30, 2023 05:22
This script help to convert some file into the https://pokemonessentials.fandom.com/es/wiki/Archivos_PBS to json
const fs = require('fs');
const path = require('path');
const nReadlines = require('n-readlines');
const source = './src';
function getFiles() {
let arr = [];
const fullPath = path.join(__dirname, source);
const files = fs.readdirSync(fullPath, { withFileTypes: true });
@djom202
djom202 / helpers.ts
Created July 14, 2022 23:15
Paths to the endpoints
import { v4 as uuidv4 } from 'uuid'
export namespace Helpers {
export function randomUUID() {
return uuidv4()
}
}
@djom202
djom202 / findMultiples.js
Created March 24, 2022 18:30
Get a next multiple of 5 in this case
function findMultiples(x) {
return Math.ceil(x/5)*5
}
ul > li.active {
&::before {
content: '';
position: relative;
border-style: solid;
border-width: 25px 0px 28px 2px;
border-color: $ligth_blue;
display: block;
width: 1px;
z-index: 1;
@djom202
djom202 / code.js
Last active February 27, 2021 03:40
Amplify Schema
// Vue methods
saveVehicle() {
this.$store.dispatch('vehicles/add_vehicle', this.newVehicle)
this.$store.dispatch('vehicles/set_newvehicleform', false)
},
// Store
async add_vehicle({ commit, dispatch }, payload) {
console.log('payload', payload)
@djom202
djom202 / gist:c190a1668a11c14d0328dcdc79a42da0
Created October 27, 2020 01:33 — forked from timonweb/gist:3165322
Code to catch all PHP errors which result in 500 Error Code. Include this snippet at the beginning of index.php file
<?php
define('E_FATAL', E_ERROR | E_USER_ERROR | E_PARSE | E_CORE_ERROR |
E_COMPILE_ERROR | E_RECOVERABLE_ERROR);
define('ENV', 'dev');
//Custom error handling vars
define('DISPLAY_ERRORS', TRUE);
define('ERROR_REPORTING', E_ALL | E_STRICT);
@djom202
djom202 / jenkins-set-number-of-executors.groovy
Created October 31, 2019 20:27 — forked from ivan-pinatti/jenkins-set-number-of-executors.groovy
Jenkins - Set number of executors via groovy script - #jenkins #groovy
#!groovy
// imports
import jenkins.model.Jenkins
// parameter
Integer numberOfExecutors = 2
// get Jenkins instance
Jenkins jenkins = Jenkins.getInstance()
@djom202
djom202 / dijkstra.js
Created July 29, 2019 21:17 — forked from nybblr/dijkstra.js
Dijkstra's Algorithm in JavaScript.
var graph = [
'AB6',
'AC3',
'BD6',
'CD5',
'CE9',
'DF8',
'DE3',
'EG8',
'FG2'
@djom202
djom202 / Nested-Routers-Express.md
Created May 13, 2019 14:21 — forked from zcaceres/Nested-Routers-Express.md
Child Routers in Express

Nested Routers in Express.js

Express makes it easy to nest routes in your routers. But I always had trouble accessing the request object's .params when you had a long URI with multiple parameters and nested routes.

Let's say you're building routes for a website www.music.com. Music is organized into albums with multiple tracks. Users can click to see a track list. Then they can select a single track and see a sub-page about that specific track.

At our application level, we could first have a Router to handle any requests to our albums.

const express = require('express');
@djom202
djom202 / bike_share_time_series.csv
Created April 5, 2019 18:12
Bike Share time series
datetime season holiday workingday weather temp atemp humidity windspeed
2011-01-20 00:00:00 1 0 1 1 10.66 11.365 56 26.0027
2011-01-20 01:00:00 1 0 1 1 10.66 13.635 56 0
2011-01-20 02:00:00 1 0 1 1 10.66 13.635 56 0
2011-01-20 03:00:00 1 0 1 1 10.66 12.88 56 11.0014
2011-01-20 04:00:00 1 0 1 1 10.66 12.88 56 11.0014
2011-01-20 05:00:00 1 0 1 1 9.84 11.365 60 15.0013
2011-01-20 06:00:00 1 0 1 1 9.02 10.605 60 15.0013
2011-01-20 07:00:00 1 0 1 1 9.02 10.605 55 15.0013
2011-01-20 08:00:00 1 0 1 1 9.02 10.605 55 19.0012