This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const heroes = `NickName: Chapolin, Power: Hammer | |
Nick: Batman, Power: Money | |
` | |
const exp = /(NickName|Nick):\s(?<nickname>\w+),\sPower:\s(?<power>\w.*)/gm | |
const matchAll = [...heroes.matchAll(exp)].map(({ | |
groups: { | |
nickname, | |
power | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm i axios stream-concat | |
import { pipeline } from 'stream/promises' | |
import StreamConcat from 'stream-concat' | |
import axios from 'axios' | |
const API_01 = 'http://localhost:3000' | |
const API_02 = 'http://localhost:4000' | |
const streams = (await Promise.all([ | |
axios({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Context { | |
static printSomething() { console.log('context working',) } | |
static initializeTerminalWithClosure() { return () => this.printSomething() } | |
static initializeTerminal() { this.printSomething() } | |
} | |
setTimeout(Context.initializeTerminal) | |
// erro pois "this" é do contexto de setTimeout | |
setTimeout(Context.initializeTerminal.bind(Context)) | |
// com bind você fala o que é para ter no "this" da função |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
class GDEAPI { | |
constructor({ token }) { | |
this.token = token | |
} | |
async submitContributions(body) { | |
const headers = { | |
"accept": "application/json, text/plain, */*", | |
"accept-language": "en-US,en;q=0.9", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const YOUTUBE_KEY = "YOUR YOUTUBE KEY" | |
import axios = from 'axios'; | |
function getVideoId(link) { | |
const videoId = link.match(/v=(?<videoId>.*)/)?.groups?.videoId | |
return videoId | |
} | |
async function getVideoViews(link) { | |
const videoId = getVideoId(link) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste this file on a empty directory | |
// npm i axios | |
// You should go to your browser on Cookie session and get JSESSIONID and li_at from Linkedin Section | |
const JSESSIONID = 'YOUR JSESSIONID' | |
const liAT = 'YOUR li_at' | |
import axios from 'axios' | |
const headers = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diskutil list | |
NAME=SD_NAME | |
sudo diskutil eraseDisk FAT32 $NAME MBRFormat /dev/disk2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <Ps3Controller.h> | |
// https://wouterdeschuyter.be/blog/configure-a-ps3-controller-to-automatically-connect-to-a-raspberry-pi | |
// http://www.squids.com.br/arduino/index.php/projetos-arduino/projetos-squids/intermediario/305-i08-como-controlar-motores-dc-com-o-driver-ponte-h-l9110-e-arduino | |
// Motor A | |
const uint8_t RIGHT_WHEEL_A1_A_DIR = 32; //M-A1-A | |
const uint8_t RIGHT_WHEEL_A1_B_PWM = 33; //M-A1-B // PWM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'N,.ã_o)d-á'.replace(/([^A-zÀ-ÿ]|_)/g, '') | |
// "Nãodá" | |
// ( => starts a group | |
// [^A-zÀ-ÿ]=> find only not words including with accents | |
// |_ => or find _ literally | |
// ) => ends a group | |
// g => global - keep searching 'till the end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make a request | |
const options = { | |
port: 1337, | |
host: 'localhost', | |
headers: { | |
'Connection': 'Upgrade', | |
'Upgrade': 'websocket' | |
} | |
}; | |
const protocol = 'http' |