Skip to content

Instantly share code, notes, and snippets.

View HugoLiconV's full-sized avatar
🐛
Creating bugs

Hugo HugoLiconV

🐛
Creating bugs
View GitHub Profile
@HugoLiconV
HugoLiconV / sample-contacts-script.js
Created November 8, 2023 17:38
Create a list of contacts in .vcf format to import in an Android Emulator
import { faker } from "@faker-js/faker";
import fs from "fs";
const args = process.argv.slice(2);
const [count] = args;
if (!count) {
console.error("Please provide a count as an argument");
process.exit(1);
}
@HugoLiconV
HugoLiconV / Buffer.test.ts
Created June 23, 2020 18:05
Buffer for React Native
import BufferFactory from "./BufferFactory";
import AsyncStorage from "@react-native-community/async-storage";
describe("BufferFactory", () => {
beforeEach(async () => {
await AsyncStorage.clear()
})
it("should add items to the buffer", () => {
const buffer = BufferFactory(2);
const axios = require('axios');
const cheerio = require('cheerio');
const cron = require('node-cron');
const productPage =
'https://www.cyberpuerta.mx/Computo-Hardware/Monitores/Monitores/Monitor-Gamer-Curvo-ASUS-ROG-Strix-XG35VQ-LED-35-Quad-HD-Ultra-Wide-FreeSync-100Hz-HDMI-Negro-Gris-Rojo.html?nosto=shop_api_home0_1';
const selector = '.priceText';
const desiredPrice = 15000;
async function getHTML(url) {
@HugoLiconV
HugoLiconV / .zshrc
Created June 10, 2019 21:51
Oh My Zsh Conf
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/Users/Hugo/.oh-my-zsh
# add z
. /usr/local/etc/profile.d/z.sh
# Set name of the theme to load. Optionally, if you set this to "random"
@HugoLiconV
HugoLiconV / dontSleep.js
Last active March 20, 2019 05:48
Keep Heroku App Awake
function myFunction() {
var d = new Date();
var hours = d.getHours();
var currentTime = d.toLocaleDateString();
var counter = SpreadsheetApp.getActiveSheet().getRange('B1').getValues();
if (hours >= 6 && hours <= 18) {
var response = UrlFetchApp.fetch("your_heroku_app_address");
SpreadsheetApp.getActiveSheet().getRange('S' + counter).setValue('Visted at ' + currentTime + ' ' + hours + 'h');
SpreadsheetApp.getActiveSheet().getRange('B1').setValue(Number(counter) + 1);
@HugoLiconV
HugoLiconV / CurrencyToNumber.js
Created March 17, 2019 07:53
Convert a currency string to a double
let price = "$2,199.23"
const number = Number(price.replace(/[^0-9.-]+/g,""));
console.log(number) //2199.23
@HugoLiconV
HugoLiconV / gist:e63f9569c6f0d96cb5a29f467b30cbd2
Created November 2, 2018 06:54
Squashing multiple commits into one with GIT
git log --oneline
// Count the number of commits to squash, ex. 4
git rebase -i HEAD~4
pick 643km12 A
f 34kldf9 B
f jdsklss C
f ax23dx3 D