This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $file = file_get_contents('./products.json'); | |
| $json = json_decode($file, 1); | |
| $param = isset($_GET['page']) ? (int) $_GET['page'] : 1; | |
| $param = $param == 0 ? 1: $param; | |
| $per_page = 3; | |
| $data = array_slice($json, ($param * $per_page) - $per_page , 3); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // post data | |
| async function postData(url = '', data = {}) { | |
| return new Promise(function(resolve, reject) { | |
| fetch(url, { | |
| method: 'POST', | |
| mode: 'cors', | |
| cache: 'no-cache', | |
| credentials: 'same-origin', | |
| headers: { | |
| 'Content-Type': 'application/json' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const exchange = (arr)=> { | |
| let data = []; | |
| arr.forEach((origin)=> { | |
| let order = 1; | |
| arr.forEach((target)=> { | |
| if(target !== origin) { | |
| order *= target; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const cacheName = 'static-cache-v1'; | |
| const files = [ | |
| //'/', | |
| '/css/app.css', | |
| ]; | |
| const acceptFormat = ['.ico','.png','.jpg','.jpeg','.svg','.js','.css','.json']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <title>Title name</title> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> | |
| <meta name="description" content=""> | |
| <meta name="keywords" content=""> | |
| <meta name="author" content="FlipsFlopsTeam"> | |
| <meta property="og:locale" content="id_ID" /> | |
| <meta property="og:locale:alternate" content="en_GB" /> | |
| <meta property="og:site_name" content="" /> | |
| <meta property="og:url" content=""> | |
| <meta property="og:title" content="" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // today | |
| function today() { | |
| let date = new Date(); | |
| return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) | |
| } | |
| // tomorrow | |
| function tomorrow() { | |
| let date = new Date(); | |
| date.setDate(date.getDate() + 1); | |
| return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://drive.google.com/file/d/1Zm-3067Y1p_OFD6G8jfXgPuiLsl6_qMI/view?usp=drivesdk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; | |
| var address = protocol + window.location.host +'/example/dumy'; | |
| var socket = new WebSocket(address); | |
| socket.onopen = ()=> { | |
| socket.send("try autoload !"); | |
| }; | |
| socket.onmessage = (msg)=>{ | |
| console.log(msg.data); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const $ = function(elem) { | |
| return document.querySelectorAll(elem); | |
| } | |
| // object add event click | |
| Object.prototype.click = function(event) { | |
| return this.forEach(function(el) { | |
| el.addEventListener("click",function() { | |
| event() | |
| }) |