Skip to content

Instantly share code, notes, and snippets.

View petrosDemetrakopoulos's full-sized avatar

Petros Demetrakopoulos petrosDemetrakopoulos

View GitHub Profile
{
"compilerOptions": {
"target": "es5",
"types": [
"node",
"jest"
],
"lib": [
"dom",
"dom.iterable",
import '@testing-library/jest-dom/extend-expect';
import 'jest-styled-components'
"jest": {
"preset": "ts-jest",
"testEnvironment": "jest-environment-jsdom",
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"collectCoverageFrom": [
"src/**/*.{ts,tsx}"
],
"globals": {
import renderer, { act } from 'react-test-renderer'
import App from '../App'
const mockData = {
data: [
{ name: 'a fake name', surname: 'fake surname', email: '[email protected]' },
{
name: 'a fake name 2',
surname: 'fake surname 2',
email: '[email protected]',
import React from 'react'
import TableList from './TableList'
import './App.css'
import axios from 'axios'
function App() {
const [users, setUsers] = React.useState([])
React.useEffect(() => {
axios
@petrosDemetrakopoulos
petrosDemetrakopoulos / TableList.tsx
Created April 25, 2022 09:23
TableList custome component
import styled from 'styled-components'
const StyledTable = styled.table`
border: 2px solid black;
`
const StyledTh = styled.th`
border-bottom: 1px solid black;
`
@petrosDemetrakopoulos
petrosDemetrakopoulos / EthairBalloons_API_CRUD.js
Created January 18, 2022 22:00
EthairBalloons API CRUD operations
app.post('/create', (req,res) => {
const newCarObject = req.body;
Car.save(newCarObject, function (err, objectSaved) {
if (!err) {
res.json(objectSaved);
} else {
res.send(err)
}
});
})
@petrosDemetrakopoulos
petrosDemetrakopoulos / EthairBalloons_API_deploy.js
Last active January 18, 2022 21:55
EthairBalloons CRUD API deploy
app.get('/deploy', (req, res) => {
Car.deploy(function (err, success) {
if (!err) {
res.send("Contract deployed successfully!")
} else {
res.send("Contract deployment error" + err)
}
})
})
@petrosDemetrakopoulos
petrosDemetrakopoulos / EthairBalloons_API_deps.js
Created January 18, 2022 21:47
EthairBalloons API dependencies
const ethAirBalloons = require('ethairballoons');
const path = require('path');
const savePath = path.resolve(__dirname + '/contracts');
const express = require('express')
const bodyParser = require('body-parser')
const app = express()
const port = 3000
app.use(bodyParser.json())
const ethAirBalloonsProvider = ethAirBalloons('http://localhost:8545', savePath);
@petrosDemetrakopoulos
petrosDemetrakopoulos / ethairballoons_updateById.js
Created January 18, 2022 13:28
Ethairballoons updateById
var updatedCarObject = { engine: 'V9', wheels: 4 };
Car.updateById('Audi A4', updatedCarObject, function (err, updatedObject) {
if (!err) {
console.log('object updated successfully');
}
});