Skip to content

Instantly share code, notes, and snippets.

View AsadSaleh's full-sized avatar
💭
Building better future

As'ad Saleh Umar AsadSaleh

💭
Building better future
View GitHub Profile
@AsadSaleh
AsadSaleh / index.js
Created March 25, 2023 03:45
Bare minimum example auth in express js
const express = require('express');
const app = express();
const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const session = require('express-session');
// User model
const User = require('./models/user');
// Login form
@AsadSaleh
AsadSaleh / js-challenge-3.js
Created January 18, 2023 14:59
gas pollll
// 1. Buat fungsi "calculateDiscountedPrice" yang menerima number, lalu mengembalikan number
// dengan value yang sudah dipotong 20% dari harga aslinya.
function calculateDiscountedPrice(inputNumber) {
return; // todo
}
// 2. Buat fungsi "convertIntoDiscountedItem" yang menerima input berbentuk { name:string, price:number }
// lalu menghasilkan output { name:string, price:number } (sama) dengan property price-nya dipotong 20%
function convertIntoDiscountedItem(inputObj) {
return; //todo
@AsadSaleh
AsadSaleh / js-challenge-2.js
Last active January 18, 2023 14:20
Gasssss
// 1. Buat fungsi "plusOne" yang menghasilkan 1 + input yang diberikan.
function plusOne(input) {
return; // todo
}
console.log(plusOne(1));
console.log(plusOne(2));
console.log(plusOne(5));
// 2. buat fungsi "minusOne" yang menghasilkan input - 1.
function minusOne(input) {
@AsadSaleh
AsadSaleh / js-challenge.js
Created January 18, 2023 13:12
Soal latihan JavaScript!!!!
// 1. Ubah data ini menjadi number
const stringNumber = "1285";
// 👇👇👇👇👇👇 Ubah code di bawah ini
const number = 0;
// 👆👆👆👆👆👆 Ubah code di atas ini
console.log(number === 1285 ? "Bener" : "Salah");
// 2. Apa hasil console.log di bawah?
@AsadSaleh
AsadSaleh / soal3.js
Created August 22, 2021 04:10
soal3.js
var movies = [
{
"id": 70111470,
"title": "Die Hard",
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 4.0,
"bookmark": []
},
{
var movieLists = [
{
name: "New Releases",
videos: [
{
"id": 70111470,
"title": "Die Hard",
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": 4.0,
var newReleases = [
{
"id": 70111470,
"title": "Die Hard",
"boxart": "http://cdn-0.nflximg.com/images/2891/DieHard.jpg",
"uri": "http://api.netflix.com/catalog/titles/movies/70111470",
"rating": [4.0],
"bookmark": []
},
{
@AsadSaleh
AsadSaleh / Motors.jsx
Created January 9, 2020 05:49
Example usage of BottomSheet in React Native 0.61
import React, {useState} from 'react';
import {
Dimensions,
FlatList,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import {useSelector} from 'react-redux';