Skip to content

Instantly share code, notes, and snippets.

@bafonins
bafonins / settings.json
Created January 8, 2023 18:02
default vscode settings.json
{
"editor.bracketPairColorization.independentColorPoolPerBracketType": true,
"editor.guides.bracketPairs": true,
"editor.renderWhitespace": "boundary",
"editor.fontFamily": "Cascadia Code",
"editor.fontSize": 14,
"editor.fontWeight": "600",
"editor.letterSpacing": -0.2,
"editor.lightbulb.enabled": false,
"editor.rulers": [80, 100, 120],
@bafonins
bafonins / light-control-example.js
Created May 28, 2021 09:17
light-control-example.js
// uplink-payload.js
const _ = require("lodash");
class UplinkPayload {
constructor(payload) {
const jsonPayload = JSON.parse(payload.toString());
this._payload = jsonPayload;
}
@bafonins
bafonins / dr-sdk-test.js
Last active January 21, 2021 11:29
Device repository test script for js sdk service.
import TTN, { STACK_COMPONENTS_MAP, AUTHORIZATION_MODES } from '.'
const stack = {
[STACK_COMPONENTS_MAP.is]:
process.env.TTN_LW_CONSOLE_UI_IS_BASE_URL || 'http://localhost:8080/api/v3',
[STACK_COMPONENTS_MAP.gs]:
process.env.TTN_LW_CONSOLE_UI_GS_BASE_URL || 'http://localhost:8080/api/v3',
[STACK_COMPONENTS_MAP.ns]:
process.env.TTN_LW_CONSOLE_UI_NS_BASE_URL || 'http://localhost:8080/api/v3',
[STACK_COMPONENTS_MAP.as]:
const assert = require('assert')
const TTN = require('ttn-lw').default
const IS = process.env.TTN_LW_CONSOLE_UI_IS_BASE_URL || 'http://localhost:1885'
const AS = process.env.TTN_LW_CONSOLE_UI_AS_BASE_URL || 'http://localhost:1885'
const token = process.env.access_token
const ttnClient = new TTN(token, {
stackConfig: { is: `${IS}/api/v3`, as: `${AS}/api/v3` },
connectionType: 'http',
proxy: false,
const assert = require('assert')
const TTN = require('ttn-lw').default
const IS = process.env.TTN_LW_CONSOLE_UI_IS_BASE_URL || 'http://localhost:1885'
const AS = process.env.TTN_LW_CONSOLE_UI_AS_BASE_URL || 'http://localhost:1885'
const token = process.env.access_token
const ttnClient = new TTN(token, {
stackConfig: { is: `${IS}/api/v3`, as: `${AS}/api/v3` },
connectionType: 'http',
proxy: false,
const assert = require('assert')
const TTN = require('ttn-lw').default
const is = process.env.TTN_LW_IDENTITY_SERVER_ADDRESS
const token = process.env.access_token
const ttnClient = new TTN(token, {
stackConfig: { is: `${is}/api/v3` },
connectionType: 'http',
proxy: false,
})
// Copyright © 2019 The Things Network Foundation, The Things Industries B.V.
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
const TTN = require('ttn-lw').default
const ns = process.env.TTN_LW_NETWORK_SERVER_ADDRESS
const token = process.env.access_token
const ttnClient = new TTN(
token,
{
stackConfig: { ns: `${ns}/api/v3` },
connectionType: 'http',
const TTN = require('ttn-lw').default
const js = process.env.TTN_LW_JOIN_SERVER_ADDRESS
const token = process.env.access_token
const ttnClient = new TTN(
token,
{
stackConfig: { js: `${js}/api/v3` },
connectionType: 'http',
proxy: false,
import React from 'react'
import Spinner from '../../components/spinner'
const withRequest = (
isFetchingTest = () => false,
isUpdatedTest = () => false
) => Component =>
class WithRequest extends React.Component {