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
const isPromise = (candidate) => candidate && typeof candidate?.then === 'function' | |
beforeEach(() => { | |
jest.spyOn(console, 'debug') | |
jest.spyOn(console, 'log') | |
jest.spyOn(console, 'warn') | |
jest.spyOn(console, 'error') | |
}) | |
afterEach(() => { |
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
#!/usr/bin/env node | |
/* | |
* ModBus configuration for Dio Smart MBSL32DI 32-channel digital input module | |
* https://www.aliexpress.com/item/4001220947199.html | |
*/ | |
//////////////// | |
// CONFIGURATION | |
//////////////// |
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
// SET PROPER VALUES | |
let authToken = 'token zxcvbnmsdfhjkqwrt' | |
let end = '2021-00-00T00:00:00Z' | |
let repo = 123456 | |
// runtime variables | |
let finished = false | |
let data = [] | |
let offset = 0 | |
let limit = 50 | |
// the main cycle |
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
#!/usr/bin/env node | |
/* | |
* ModBus read for Noark Ex9EM 1P 1M 80A MO MT Electric Meter | |
* https://www.noark.com.hr/en/products/107281 | |
*/ | |
//////////////// | |
// CONFIGURATION | |
//////////////// |
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
#!/usr/bin/env node | |
/* | |
* ModBus read for Sinotype DDS024MR Electric Meter | |
* https://s.click.aliexpress.com/e/_eNIqlR | |
*/ | |
//////////////// | |
// CONFIGURATION | |
//////////////// |
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
#!/usr/bin/env node | |
/* | |
* ModBus read for Sinotype DDS519MR Electric Meter | |
* https://s.click.aliexpress.com/e/_eNvkb3 | |
*/ | |
//////////////// | |
// CONFIGURATION | |
//////////////// |
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
import { act } from 'react-dom/test-utils' | |
class UniqueNumber extends Number {} | |
/** | |
* Mock specific timer and allow the others to passthrough normally | |
*/ | |
export default class MockTimer { | |
/** | |
* timeout value to pass to setTimeout as second parameter |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<?php | |
// List of allowed origins, should be in some config place, or even loaded from env | |
$ALLOWED_ORIGINS = array( | |
'http://localhost:8080', | |
'... any other origin', | |
); | |
// Validate request is allowed - should be in every entry file | |
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { |
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
import java.lang.Math; | |
import java.lang.System; | |
public class fast_roulette { | |
/* program n_select=1000 times selects one of n=4 elements with weights weight[i]. | |
* Selections are summed up in counter[i]. For the weights as given in the example | |
* below one expects that elements 0,1,2 and 3 will be selected (on average) | |
* 200, 150, 600 and 50 times, respectively. In good agreement with exemplary run. | |
*/ | |
NewerOlder