The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
| VERSION By Unix Timestamps | |
| { | |
| "scripts": { | |
| "postbuild": "VERSION=`date +%s` && sed -i -- 's/js\"/js?v='${VERSION}'\"/g' build/index.html && sed -i -- 's/css\"/css?v='${VERSION}'\"/g' build/index.html && npx rimraf build/**/*.map", | |
| "build": "GENERATE_SOURCEMAP=false react-scripts-ts build && npm run postbuild && gzipper --verbose ./build" | |
| } | |
| } | |
| VERSION by latest commit hash | |
| { |
| I have ever can not open vi or vim or my bash does not work. | |
| I remember what I did. | |
| Because I changed PATH on ~/.zshrc :D | |
| So, for restore you can run this command: | |
| `export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin` |
| console style: | |
| console.log('%c Bhinneka', 'color: red; font-weight: bold; font-size: 40px'); | |
| console.log('%c PT. Bhinneka MentariDimensi', 'color: #000; font-size: 18px'); | |
| console.log('join us: "http://career.bhinneka.com"'); |
| Build image: | |
| $ docker build -t yudapc/sailsjs:0.0.1 . | |
| Build container: | |
| $ docker-compose up -d | |
| Stop Container: | |
| $ docker-compose down -v |
| // | |
| // Javascript Format NPWP | |
| // | |
| function formatNpwp(value) { | |
| if (typeof value === 'string') { | |
| return value.replace(/(\d{2})(\d{3})(\d{3})(\d{1})(\d{3})(\d{3})/, '$1.$2.$3.$4-$5.$6'); | |
| } | |
| } |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| Cheat moment: | |
| http://momentjs.com/ | |
| http://momentjs.com/timezone/ | |
| moment = require('moment-timezone') | |
| get current time AM/PM | |
| moment().format('hh:mm A') | |
| // 09:54 PM |
| // controllers/LoginController.js | |
| module.exports = { | |
| index: function(req, res) { | |
| var email = req.param('email'); | |
| var password = req.param('password'); | |
| // delay everthing to prevent bruteforce, dos and timing attacks | |
| setTimeout(function() { |
| import React, { Component } from 'react'; | |
| import { ScrollView, View, Text, Dimensions } from 'react-native'; | |
| const widthLeftSide = 0.7; // 70% | |
| const widthDevice = Dimensions.get('window').width * widthLeftSide; | |
| const column = 3; | |
| const padding = 16; | |
| const totalPadding = padding * (column * 2); | |
| const cardBoxWidth = (widthDevice - totalPadding) / column; | |
| const customPaddingRight = 4 * 6.5; |