Need to use array destruction
//Javascript, ES6
var addAndSubstract = function(a, b) {
return [(a + b), (a - b)]
};
[add_result, subs_result] = addAndSubstract(41, 42)
Native way to return multiple items
Need to use array destruction
//Javascript, ES6
var addAndSubstract = function(a, b) {
return [(a + b), (a - b)]
};
[add_result, subs_result] = addAndSubstract(41, 42)
Native way to return multiple items
| """ | |
| Demo file to have a reloading on change | |
| Run with '-reload' param to enable reloading | |
| change increment_value var to see the reloading | |
| -- | |
| Mechanism is copied from bottle-py framework implementaion - https://github.com/bottlepy/bottle/blob/master/bottle.py#L3633 | |
| """ | |
| import time |
| /** | |
| Sample call: node ./node_modules/autotranslate-ng/index client\app\components\account-information\account-information.html acc | |
| ount-information table | |
| Params (positional): | |
| - path_to | |
| - label prefix | |
| - tag/tag.class to exclude |
| var bus; | |
| const handleFileSelect = evt => { | |
| evt.stopPropagation(); | |
| evt.preventDefault(); | |
| var files = evt.dataTransfer.files; // FileList object. | |
| listFilesContent(files); | |
| }; | |
| const downloadFileHTML = item => { |
| body { | |
| background: #eee; | |
| font-family: Arial, 'sans-serif'; | |
| } | |
| #drop_zone { | |
| border: 2px dashed #bbb; | |
| -moz-border-radius: 5px; | |
| -webkit-border-radius: 5px; | |
| border-radius: 5px; | |
| padding: 25px; |
| 1) create: | |
| Request URL:http://remissionaire-admin-staging.herokuapp.com/api/v1/chats?load_from_source=1 | |
| Request Method:POST | |
| Status Code:200 OK | |
| payload: {"tags":"veg,vegan,ttttt-mew","load_from_source":1,"title":"test f-53"} | |
| NEW TAG: ttttt-mew | |
| ----------------- | |
| Request URL:http://remissionaire-admin-staging.herokuapp.com/api/v1/tag/add-new/ | |
| Request Method:POST |
| package main | |
| import ( | |
| "encoding/json" | |
| "net/http" | |
| "os/exec" | |
| log "github.com/Sirupsen/logrus" | |
| "github.com/gin-gonic/gin" | |
| ) |
| var list = [] | |
| jQuery('h2').each((index, el) => { | |
| list.push({ | |
| name: jQuery(el).find('a').text(), | |
| type: jQuery(el).next('p').find('a').text() || jQuery(el).next().next().find('a').text() | |
| }) | |
| }) | |
| copy(list) |
| [ | |
| {name: "Terms of Use", type: ""}, | |
| {name: "9 Pound Hammer", type: "Indica"}, | |
| {name: "Acapulco Gold", type: "Sativa"}, | |
| {name: "ACDC", type: "Hybrid"}, | |
| {name: "Afghani", type: "Indica"}, | |
| {name: "Afgoo", type: "Indica"}, | |
| {name: "AK-47", type: "Hybrid"}, | |
| //.. | |
| ] |
| [ | |
| {name: "9 Pound Hammer", type: 0}, | |
| {name: "Acapulco Gold", type: 1}, | |
| {name: "ACDC", type: 2}, | |
| {name: "Afghani", type:0}, | |
| {name: "Afgoo", type: 0}, | |
| {name: "AK-47", type: 2}, | |
| .. | |
| ] |