Skip to content

Instantly share code, notes, and snippets.

View EdgardoRodriguezSolano's full-sized avatar
🎯
Focusing

Edgardo Rodríguez EdgardoRodriguezSolano

🎯
Focusing
  • Barranquilla, Colombia
View GitHub Profile
@EdgardoRodriguezSolano
EdgardoRodriguezSolano / didomi-ready.js
Last active December 1, 2022 14:05
Re-collection test suggestion for tcf v2
test('didomiOnReady functions are called with the Didomi object when UI is not loaded (already have consent)', async t => {
// Consent string with creation date from today
const consentString = generateTCFv2ConsentString({
purposeConsents: [1, 2, 3, 4, 7, 9, 10],
purposeLIs: [],
vendorConsents: [2],
vendorLIs: [],
specialFeatureOptins: [2],
created: new Date(),
lastUpdated: new Date(),
const fs = require('fs-extra');
const { difference } = require('lodash');
const { languages } = require('../config');
for (let i = 0; i < languages.length; i++) {
let checkResult = '✅';
// ******************************** COMMON DIRECTORY ********************************
const languageAbbreviation = languages[i];
let commonDirectoryData, commonDirectoryKeys;
try {
const fs = require('fs-extra');
const { languages } = require('../config');
for (let i = 0; i < languages.length; i++) {
const languageAbbreviation = languages[i];
const dir = `src/sdk/ui/common/locale/gdpr/${languageAbbreviation}`;
webData = fs.readFileSync(
`src/sdk/ui/gdpr/locale/${languageAbbreviation}/onesky.json`,
@EdgardoRodriguezSolano
EdgardoRodriguezSolano / createLocaleFolders.js
Last active November 7, 2022 09:38
Script to create dedicated web and ctv folders.
const fs = require('fs-extra');
const { languages } = require('../config');
for (let i = 0; i < languages.length; i++) {
const languageAbbreviation = languages[i];
const dir = `src/sdk/ui/common/locale/gdpr/${languageAbbreviation}`;
// This file is no longer needed
try {
@EdgardoRodriguezSolano
EdgardoRodriguezSolano / Categoria.js
Created May 26, 2020 03:47
GraphQL resolver function
function articulo(parent, args, context) {
return context.prisma.categoria({ id: parent.id}).articulo({
where: where(args),
skip: args.skip,
first: args.first});
}
@EdgardoRodriguezSolano
EdgardoRodriguezSolano / flatListComponent.js
Created May 26, 2020 01:02
React-native flatlist componente implementation (infinte scroll)
function FlatListComponent({ page, updated, fetchedData, updateState, refreshQuery, navigation, categorieID, subcategories = null}) {
const { loading, error, data } = subcategories ? useQuery(articlesBySubcategories(categorieID, ARTICLES_TO_FETCH * (page - 1)))
: useQuery(articlesByCategories(categorieID, ARTICLES_TO_FETCH * (page - 1)));
if (error) return <Text> { `Error! ${error}` } </Text>
if (!updated && !data) return <ActivityIndicatorComponent />
const newData = subcategories ? data['subcategorias'][0].articulo
: data['categorias'][0].articulo;
const hasMore = !(newData.length < ARTICLES_TO_FETCH);
if (!updated && !loading && data) updateState(newData);
return (
@EdgardoRodriguezSolano
EdgardoRodriguezSolano / sudoku-solver.js
Created January 1, 2020 02:22
This is a sudoku solver. The initial state of the sudoku board is defined between lines 4-14. The program outputs all the existing solutions (if any) for a particular initial state.
// Leaving this here for reference https://es.wikipedia.org/wiki/Sudoku
console.log("Sudoku solver is running...");
// Here we can change the initial board configuration. The sudoku that we are trying to solve.
let sudoku = [
[0,0,8,0,7,0,0,0,9],
[0,0,2,0,0,3,0,0,0],
[6,3,0,0,0,0,0,0,0],
[0,5,3,0,0,4,2,7,0],
[0,0,0,0,0,2,3,0,0],
[0,0,0,0,0,5,9,6,4],