Helpers/middlewares to formats API responses into stuctured and human-readable way (especially for frontend dev)
const { Res200 } = require("./httpResponses")| (\+?01)[0-46-9]-*[0-9]{7,8} |
| import _axios from 'axios'; | |
| export const axios = _axios.create({ | |
| headers: { | |
| 'Content-Type': 'application/json;charset=UTF-8', | |
| } | |
| }); | |
| export const handleResponse = function (response) { |
| from time import sleep | |
| do_error = None | |
| def run(retry=0): | |
| try: | |
| print(do_error[1]) | |
| except Exception as e: | |
| err_type = e.__class__.__name__ | |
| if err_type: |
Helpers/middlewares to formats API responses into stuctured and human-readable way (especially for frontend dev)
const { Res200 } = require("./httpResponses")| -- KENA BELANJA TONY ROMA'S NI HMMMMH 🤔 (AKU DAH SACRIFICE ALMOST HALF HOUR UTK KAU) | |
| -- 1. Find the titles of all movies directed by Steven Spielberg. | |
| SELECT title | |
| FROM Movie | |
| WHERE director = 'Steven Spielberg'; | |
| -- 2. Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order |
| def flatten_json(nested_json): | |
| """ | |
| Flatten json object with nested keys into a single level. | |
| Args: | |
| nested_json: A nested json object. | |
| Returns: | |
| The flattened json object if successful, None otherwise. |
| String.prototype.isDate = function () { | |
| // let format = /^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$/; // MM/DD/YYYY | |
| let format = /([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))/; // YYYY-MM-DD | |
| return (format.test(this)) | |
| ? new Date(this).toISOString() === this | |
| : false | |
| } |
| const DEFINED = require('./malaysia'); | |
| String.prototype.toTitleCase = function () { | |
| return this.toLowerCase().replace(/\b(\w)/g, s => s.toUpperCase()); | |
| } | |
| String.prototype.formatAdrressText = function() { | |
| return this.replace(/[,.\n]/g, "") // remove unwanted chars | |
| .toLowerCase() | |
| .replace(new RegExp("malaysia", 'g'), "") // unnecessary |
| <template> | |
| <input ref="fileupload" type="file" @change="onFileChange" accept=".xlsx, .xls, .csv" /> | |
| </template> | |
| <script> | |
| /*** | |
| * Spreadsheet data toolkit https://github.com/SheetJS/js-xlsx | |
| * npm i xlsx | |
| */ | |
| import XLSX from "xlsx"; |