Skip to content

Instantly share code, notes, and snippets.

View BolajiAyodeji's full-sized avatar
🥑
I'm looking for work. Let's talk!

Bolaji Ayodeji BolajiAyodeji

🥑
I'm looking for work. Let's talk!
View GitHub Profile
const fs = require("fs");
const url =
"https://bolajiayodeji.github.io/fed-unis-perf-eval/lighthouse%20report/";
fs.readFile("text.txt", "utf8", function (err, links) {
// get all text per line in links
const lines = links.split("\n");
//replace spaces with %20
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
tweets = [
"Wow, what a great day today!! #sunshine",
"I feel sad about the things going on around us. #covid19",
"I'm really excited to learn Python with @JovianML #zerotopandas",
"This is a really nice song. #linkinpark",
"The python programming language is useful for data science",
"Why do bad things happen to me?",
"Apple announces the release of the new iPhone 12. Fans are excited.",
"Spent my day with family!! #happy",
"Check out my blog post on common string operations in Python. #zerotopandas",
@BolajiAyodeji
BolajiAyodeji / array-sets.js
Created August 25, 2021 06:35
Find duplicate emails (or any data type) in an array and the intersection, difference, symmetrical difference, and union of two arrays.
const dataA = []
const dataB = []
const arrA = dataA.map(e => e.toLowerCase().replace(/\s/g, ''));
const arrB = dataB.map(e => e.toLowerCase().replace(/\s/g, ''));
console.log(arrA.length, arrB.length)
// Find duplicates in array A
@BolajiAyodeji
BolajiAyodeji / .gitignore
Last active June 12, 2021 07:27
Sample .gitignore file
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
@BolajiAyodeji
BolajiAyodeji / toggle.md
Last active May 21, 2021 20:35
Markdown toggle demo
Click to toggle contents of the toggle

Here's a sample code:

ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
@BolajiAyodeji
BolajiAyodeji / commercelayer_cli_order_place.md
Last active May 7, 2021 09:17 — forked from silviorelli/commercelayer_cli_order_place.md
Place an order via the Commerce Layer CLI

Place an order for a t-shirt via the Commerce Layer CLI

  1. Search for the desired t-shirt:
commercelayer resources:get skus -w name_i_cont_all=t-shirt,pink -w name_not_i_cont_all=women,white

Example ID of t-shirt selected: NzWOpOSyBx.

Javascript is the new cool 1 and you really need to learn Python to access the new cool 2

Footnotes

  1. This is the first footnote.

  2. This is the second footnote with more paragraphs. Yes yes

    { console.log("Hashnode"}
    
@BolajiAyodeji
BolajiAyodeji / regexCheatSheet.js
Created April 16, 2019 19:40
A Regular Expressions Cheat Sheet
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"

POSTGRESQL CHEATSHEET

Basic commands

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)