Skip to content

Instantly share code, notes, and snippets.

View JestVA's full-sized avatar
YANK

Dorin Dumitrascuta JestVA

YANK
View GitHub Profile
@JestVA
JestVA / Select
Last active August 29, 2019 08:37
-- 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
@JestVA
JestVA / ngrok
Created August 13, 2019 12:04
used to create a tunnel from localhost to a public pointing url very good for testing stuff on mobiles
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
@JestVA
JestVA / ES6
Created September 4, 2019 14:51
// Trick to destructure more than 1 property of an object in diff nested lvl
const { history: { action, location: { pathname } } } = props;
/,.+$/ // This expression matches anything that is after a , if in one line
for a string of this type:
"Friday May 2, 9am"
"jbjbkjbkjb"if
/,.+$/ expression would only match [ , 9am" ] if m flag is enabled i.e. /,.+$/m
. // matches any character except line breaks
{{lp|json_encode}}
// "The greatest invention of
// manking is the concept
// of variable" - 🗝 Alonzo Church
const showJoy = expressJoy => joy =>
expressJoy(joy.toUpperCase() + '!!!')
const functionalJoy = showJoy((message =>
console.log(message)))
functionalJoy('This was long overdue!')