This file contains 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
/* | |
TBD: AGODA, BOOKING => Should be ID or Enum string ? | |
TBD: Demographic (ALL_GUEST, BUSINESS_TRAVELLER) => , | |
TBD: Score Category (OVERVIEW, CLEANLINESS) => Should be ID or Enum string ? | |
*/ | |
{ | |
reviews: { | |
displayingProviderId: AGODA, |
This file contains 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
// IDEA FROM: https://stackoverflow.com/questions/33929712/crypto-in-nodejs-and-ruby | |
var crypto = require('crypto'), | |
algorithm = 'aes-256-cbc', | |
key = 'SOME_RANDOM_KEY_32_CHR_123456789', // 32 Characters | |
iv = "0000000000000000"; // 16 Characters | |
function encrypt(text){ | |
var cipher = crypto.createCipheriv(algorithm,key,iv) | |
var crypted = cipher.update(text,'utf-8',"base64") |
This file contains 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
{ | |
"events": [ | |
{ | |
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", | |
"type": "message", | |
"timestamp": 1462629479859, | |
"source": { | |
"type": "user", | |
"userId": "U206d25c2ea6bd87c17655609a1c37cb8" | |
}, |
This file contains 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
// Step 1: Create rich menu, and retrieve richMenuId | |
client.createRichMenu({ | |
size: { width: 2500, height: 1686 }, // Define size of rich menu | |
selected: true, // Always display | |
name: 'CryptoCurrency Page 2', // rich menu name | |
chatBarText: 'CryptoCurrency', // show to user | |
areas: [ // Area and action of each boundary | |
{ | |
bounds: { | |
x: 0, |
This file contains 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
// File: index.js | |
// Express listen POST /webhook call and call handler.webhook() function | |
const app = express(); | |
app.post('/webhook', line.middleware(config), handler.webhook); | |
// File: handler/index.js | |
// Response {status: ok} to LINE call right away, but process the actual event in the background | |
const webhook = (req, res) => { | |
console.log("User id: " + req.body.events[0].source.userId) | |
Promise |
This file contains 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
QUERY PLAN | |
------------------------------------------------------------------------------------------------ | |
Custom Scan (Citus Real-Time) (cost=0.00..0.00 rows=0 width=0) | |
Task Count: 32 | |
Tasks Shown: All | |
-> Task | |
Node: host=10.140.0.4 port=5432 dbname=temp_db | |
-> Bitmap Heap Scan on record_102008 record (cost=10.74..31.37 rows=850 width=4) | |
Recheck Cond: (id < 3) | |
-> Bitmap Index Scan on record_pkey_102008 (cost=0.00..10.53 rows=850 width=0) |
This file contains 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
SELECT * from pg_dist_shard; | |
logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue | |
---------------+---------+--------------+---------------+--------------- | |
github_events | 102026 | t | 268435456 | 402653183 | |
github_events | 102027 | t | 402653184 | 536870911 | |
github_events | 102028 | t | 536870912 | 671088639 | |
github_events | 102029 | t | 671088640 | 805306367 | |
(4 rows) |
This file contains 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
SELECT create_distributed_table('table', 'id'); |
This file contains 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 Result = React.createClass({ | |
propTypes: { | |
filterPokemon: React.PropTypes.array, | |
}, | |
render: function() { | |
return (<div> | |
<div>--- Total Filter Pokemon: {this.props.filterPokemon.length} ---</div> | |
<ul> | |
{this.props.filterPokemon.map(function (item, i) { | |
return <li key={i}>{item.name} (Atk: {item.attack}, Def: {item.defense})</li> |
NewerOlder