Skip to content

Instantly share code, notes, and snippets.

@fadziljusri
fadziljusri / qrcode.js
Created July 25, 2019 11:19
QR Code Reader from mobile website
/* Packed with Google Closure
*
* Ported to JavaScript by Lazar Laszlo 2011
* [email protected], www.lazarsoft.info
*
* Copyright 2007 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@fadziljusri
fadziljusri / feeds.js
Created April 12, 2019 11:37
Feeds DS
let feeds = "feeds": [
// type: status
{
fId: "f1",
content: "Check in to Table 2",
time: "2018-12-04 00:49:02",
oid: 1167,
uid: 88,
tableNo: 22,
@fadziljusri
fadziljusri / questions.json
Last active March 20, 2019 11:39
OrderReviewQuestions
{
"questions": [
{
"text": "How was your serving time?",
"answer": "",
"type": "likertitem",
"config": {
"items": [
{
"text": "Terrible",
[
{
"areaId": "a01_2rd2ixi",
"name": "R&R Serdang",
"description": "Located at R&R Serdang. Lai-lai meh got delicious food meh =)",
"imgSrc": "http://lorempixel.com/400/400/city/?12",
"restaurants": [
{
"restId": "a01_rest01_yuiyiqwe",
"name": "Kedai Makan Kak Mah",
@fadziljusri
fadziljusri / mergeRanges.js
Last active November 27, 2018 07:30
HiCal - Vase.ai Interview
var input = [
{ startTime: 1, endTime: 2 },
{ startTime: 3, endTime: 4 },
{ startTime: 5, endTime: 6 },
{ startTime: 2, endTime: 5 },
{ startTime: 7, endTime: 8 },
{ startTime: 9, endTime: 10 },
{ startTime: 10, endTime: 12 }
]
["2018-07-30", "2018-08-15", "2018-11-02", "2018-11-09"]
@fadziljusri
fadziljusri / nricToDateParser.js
Created September 27, 2018 03:40
Malaysia Indentification Card Number (IC) to Date parser
let ic = '901212106329';
// return date is valid, ic if invalid
if (ic.match(/^(\d{2})(\d{2})(\d{2})-?\d{2}-?\d{4}$/)) {
let year = RegExp.$1;
let month = RegExp.$2;
let day = RegExp.$3;
// console.log(year, month, day);
@fadziljusri
fadziljusri / sortBy.js
Last active September 27, 2018 03:08
sorts and return the original array
// objs = [{age: 12, age: 10, age:1523}]
// objs.sortBy('age');
Array.prototype.sortBy = function(p) {
return this.slice(0).sort(function(a, b) {
return (a[p] > b[p]) ? 1 : (a[p] < b[p]) ? -1 : 0;
});
}
@fadziljusri
fadziljusri / menu.json
Last active January 15, 2019 03:41
kcafe menu
[
{
"restaurant": "Home Catering",
"available_day": "Sat, Sun",
"items": [
{
"food": "Kobideh Kebab",
"price": 12,
"dateInserted": "2019-01-14",
"qtty": 1,
@fadziljusri
fadziljusri / GULP-INIT.md
Last active September 4, 2018 08:41
Gulp starter - automating static website

Gulp Init

Automating your static website developement.

Pre-requisites

Directory layout

|── app             # Contains all static files
|   |── **