Skip to content

Instantly share code, notes, and snippets.

View ammar-oker's full-sized avatar
:shipit:
Hello, world!

Ammar Oker ammar-oker

:shipit:
Hello, world!
View GitHub Profile
// Users (both customers and restaurants)
Table users {
id int [pk, increment] // Primary Key
username varchar
email varchar
password varchar
user_type enum('customer', 'restaurant') // Differentiate between customer and restaurant
created_at datetime
updated_at datetime
}
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 8.
"name","artists","id","energy","liveness","tempo","speechiness","acousticness","instrumentalness","danceability","loudness","valence","mood"
"The Sky Is A Neighborhood","Foo Fighters","3kdMzXOcrDIdSWLdONHNK5",0.549,0.22,130.749,0.0698,0.000798,0.00485,0.357,-7.843,0.531,"Energetic"
"Boomerang","Royal Republic","3rFEKOClXOdNFO6fQGuQ9j",0.975,0.16,129.022,0.0618,0.0000513,0.713,0.594,-3.21,0.899,"Energetic"
"Freeze Me","Death From Above 1979","4G3DWijMhNkWZwLcxnDI0H",0.724,0.237,130.037,0.0313,0.000827,0.000144,0.512,-5.912,0.531,"Energetic"
"Thank God I'm Not You","Himalayas","4YZVtRbdGOhHdGNi4JpCL5",0.828,0.06,126.037,0.0536,0.00175,0.0136,0.542,-3.91,0.785,"Energetic"
"Moving to New York","The Wombats","7GvkOFkNsM6Exnkyqeajqm",0.886,0.256,161.939,0.0714,0.0000293,0.00000533,0.252,-4.678,0.498,"Energetic"
"I Bet You Look Good On The Dancefloor","Arctic Monkeys","29EkMZmUNz1WsuzaMtVo1i",0.948,0.376,103.183,0.0356,0.00225,0,0.535,-4.19,0.778,"Energetic"
"The Way You Used to Do","Queens of the Stone Age","1wsnCf
name artists id energy liveness tempo speechiness acousticness instrumentalness danceability loudness valence mood
The Sky Is A Neighborhood Foo Fighters 3kdMzXOcrDIdSWLdONHNK5 0.549 0.22 130.749 0.0698 0.000798 0.00485 0.357 -7.843 0.531 Energetic
Boomerang Royal Republic 3rFEKOClXOdNFO6fQGuQ9j 0.975 0.16 129.022 0.0618 0.0000513 0.713 0.594 -3.21 0.899 Energetic
Freeze Me Death From Above 1979 4G3DWijMhNkWZwLcxnDI0H 0.724 0.237 130.037 0.0313 0.000827 0.000144 0.512 -5.912 0.531 Energetic
@ammar-oker
ammar-oker / async-loop-javascript-example.js
Last active August 23, 2023 11:29
Examples of asynchronous functions in JavaScript and how to use them inside loops.
// This function is a "sync" function,
// which means it will be executed immediately
function syncFunction() {
console.log('executing sync function')
}
// The next three other functions are "asynchronous" functions
// which means they're gonna return a Promise,
// a Promise can be awaited until the function is resolved by calling "resolve()"
function asyncFunctionOne() {
@ammar-oker
ammar-oker / nested-object-to-dot-notation.js
Last active September 17, 2021 15:45
Convert nested Javascript object to dot notation object
const sample = {
a: 1,
b: {
x: 2,
y: 3,
z: 4,
},
c: {
x: 6,
y: 7,
@ammar-oker
ammar-oker / url-params-to-js-object.js
Last active April 20, 2021 16:29
Parse URL Parameters into a Javascript Object
function getUrlParams(link) {
// get query string from url (optional) or window
var queryString = link ? link.split('?')[1] : window.location.search.slice(1);
// we'll store the parameters here
var obj = {};
// if query string exists
if (queryString) {
@ammar-oker
ammar-oker / .eslintrc.js
Last active April 9, 2021 19:51
Eslint Airbnb Configs for React + Typescript Project
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: [
'plugin:react/recommended',
'airbnb',
],