Skip to content

Instantly share code, notes, and snippets.

View tsungtingdu's full-sized avatar
Focusing

Tsung-Ting Tu tsungtingdu

Focusing
View GitHub Profile
@tsungtingdu
tsungtingdu / offers.json
Created March 8, 2024 06:52
offers.json
{
"offers": [
{
"id": "1",
"title": "Offer 1",
"description": "Offer 1 description",
"category": 1,
"merchants": [
{
"id": "1",
[
{
"id": 1,
"title": "Offer 1",
"description": "Offer 1 description",
"category": 1,
"merchants": [
{
"id": 1,
"name": "Offer1 Merchant1",
@tsungtingdu
tsungtingdu / figma-builder-test.js
Created October 13, 2023 01:35
figma-builder-test.js
import { Component } from "@angular/core";
@Component({
selector: "my-component",
template: `
<div class="div">
<div class="div-2">
<div class="div-3">
<img
loading="lazy"
*
* Complete the 'merchant_offers' function below.
*
* The function is expected to return a STRING.
* The function accepts following parameters:
* 1. STRING checkin
* 2. STRING offers_json
*/
@tsungtingdu
tsungtingdu / offer_matcher_refactoring.md
Last active December 20, 2023 00:56
interview/theodore_pinto

Offers Matcher - Refactoring Exercise

In this exercise, you will refactor certain parts of the "Offers Matcher" exercise you completed in HackerRank.

To begin, please access the updated mock dataset by visiting the following URL: https://interview-api.vercel.app/api/offers

Copy your original solution along with the mock dataset (preferably as a raw string) into an IDE of your choice. Run the code in the terminal.

Part 1 - API Simplification

@tsungtingdu
tsungtingdu / 2021-09-27-ronny.js
Last active September 30, 2021 13:02
2021-09-27-ronny.js
// favorite.js
const BASE_URL = "https://lighthouse-user-api.herokuapp.com";
const INDEX_URL = BASE_URL + "/api/v1/users/";
const users = JSON.parse(localStorage.getItem('favoriteUsers')) || [];
const dataPanel = document.querySelector("#data-panel");
const searchForm = document.querySelector("#search-form")
const searchInput = document.querySelector("#search-input")
const USERS_PER_PAGE = 10
const paginator = document.querySelector("#paginator")
@tsungtingdu
tsungtingdu / 000_2020-12th-ironman.md
Created October 21, 2020 05:16 — forked from qrtt1/000_2020-12th-ironman.md
ITHome 第 12 屆鐵人賽 (updated UTC 2020-10-19 00:40:39.204524)
## Problem
We have an Admin Panel to manage all back-office operations for our products.
The Admin Panel manages the below entities:
- Users
- CRUD, adjust balance
- Campaigns
- CRUD
const expedia_result = {
hot1: { price: 100, key: 'ex-1', additional: 'no children' },
hot2: { price: 200, key: 'ex-2' },
hot3: { price: 300, key: 'ex-3' },
hot4: { price: 400, key: 'ex-4' },
}
const agoda_result = {
hot1: { price: 110, key: 'ag-1' },
hot4: { price: 350, key: 'ag-4' },
// Compute a good value for the minimum run length; natural runs shorter
// than this are boosted artificially via binary insertion sort.
//
// If n < 64, return n (it's too small to bother with fancy stuff).
// Else if n is an exact power of 2, return 32.
// Else return an int k, 32 <= k <= 64, such that n/k is close to, but
// strictly less than, an exact power of 2.
//
// See listsort.txt for more info.