Skip to content

Instantly share code, notes, and snippets.

curl curl bang bang

Dorin Dumitrascuta JestVA

curl curl bang bang
View GitHub Profile
View thankYouAlonzo.js
// 🗝 "The greatest invention of manking is the concept of variable" - Alonzo Church
// In Javascript, everything that you would use as a variable, can be a function
// they can be sent to other functions as arguments
const logMessage = logger => logger('Lambda calculus')
logMessage(message => console.log(message)) // Lambda calculus
// they can be returned from other functions
const showJoy = expressJoy => joy => expressJoy(joy.toUpperCase() + '!!!')
View regexer
/,.+$/ // This expression matches anything that is after a , if in one line
for a string of this type:
"Friday May 2, 9am"
/,.+$/ expression would only match [ , 9am" ] if m flag is enabled i.e. /,.+$/m
. // matches any character except line breaks
View ES6
// Trick to destructure more than 1 property of an object in diff nested lvl
const { history: { action, location: { pathname } } } = props;
JestVA / ngrok
Created Aug 13, 2019
used to create a tunnel from localhost to a public pointing url very good for testing stuff on mobiles
View ngrok
Go to folder where ngrok is installed and:
`./ngrok http [port]` // where port is something like 3000
To access on mobile, you need to enter the forwarding url
View Select
-- SELECT clause
SELECT * FROM Employee
-- WHERE clause
WHERE id = 123 AND is_admin = 'true'
-- values are returned in the order they were asked (like an [ ] from a low level SQL database)
SELECT id, firstname, lastname FROM Employee
-- single quotes are used for string literals
-- Aliases (use the AS keyword to give a table or a column a local name or alias)
SELECT p.productname AS title FROM Product AS p