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 add = | |
(a, b) => a + b | |
const subtract = | |
(a, b) => a - b | |
const multiply = | |
(a, b) => a * b | |
const divide = | |
(a, b) => a / b | |
module.exports = { | |
add,subtract,multiply,divide |
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 {add, | |
subtract, | |
divide, | |
multiply} = require('./utils') | |
module.exports = {add,subtract, divide, multiply} |
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 { | |
add, subtract, divide, multiply, | |
} = require('.'); | |
assert = require('chai').assert; | |
describe('Sum', () => { | |
context('Adding 1 and 1', () => { | |
it('should return 2', () => { | |
assert(add(1, 1) === 2); | |
}); |
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
"husky": { | |
"hooks": { | |
"pre-commit": "pretty-quick --staged && npm run lint && npm test" | |
} | |
} |
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
function LoadBackground() { | |
const [isLoading, setIsLoading] = React.useState(true); | |
const [data, setData] = React.useState([]); | |
React.useEffect(() => { | |
const url = "https://randomuser.me/api/?results=15"; | |
fetch(url) | |
.then((response) => response.json()) | |
.then((json) => setData(json['results'])) | |
.catch((error) => console.log(error)); |
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
from flask import Flask,request,json | |
app = Flask(__name__) | |
@app.route('/') | |
def hello(): | |
return 'Webhooks with Python' | |
if __name__ == '__main__': | |
app.run(debug=True) |
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
@app.route('/githubIssue',methods=['POST']) | |
def githubIssue(): | |
data = request.json | |
print(f'Issue {data["issue"]["title"]} {data["action"]}') | |
print(f'{data["issue"]["body"]}') | |
print(f'{data["issue"]["url"]}') | |
return data |
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
from datetime import datetime | |
from dotenv import load_dotenv, main | |
import os | |
from influxdb_client import InfluxDBClient, Point, WritePrecision | |
from influxdb_client.client.write_api import SYNCHRONOUS | |
load_dotenv() | |
# You can generate a Token from the "Tokens Tab" in the UI | |
token = os.getenv('TOKEN') | |
org = os.getenv('ORG') |
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
class InfluxClient: | |
def __init__(self,token,org,bucket): | |
self._org=org | |
self._bucket = bucket | |
self._client = InfluxDBClient(url="http://localhost:8086", token=token) |
OlderNewer