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 | |
from flask_cors import CORS | |
from flask_socketio import SocketIO, emit | |
import os | |
app = Flask(__name__) | |
CORS(app) | |
socketio = SocketIO(app, cors_allowed_origins="*") | |
@socketio.on('connect', namespace="/items") |
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, date, time, timezone | |
dt = datetime.utcnow() | |
print(dt) | |
newtime = dt.replace(microsecond=0) | |
print(newtime) |
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
/** | |
HTML: | |
<header style="display: flex; justify-content: space-between;"> | |
<div class="dropdown--container"> | |
<button>Menu</button> | |
<div class="dropdown--content"> | |
<ul> | |
<li><a href="#">Link</a></li> |
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 React, { Component, useEffect, useRef, useState } from 'react'; | |
import { render } from 'react-dom'; | |
import './style.css'; | |
interface AppProps {} | |
interface AppState { | |
name: string; | |
} | |
function useDropdown(props: any) { |
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 { Todo } from '../models/todo.model'; | |
const TodoService = { | |
get: () => { | |
return new Promise((resolve) => { | |
return fetch('http://localhost:5000/todos') | |
.then((resp) => resp.json()) | |
.then((data) => { | |
resolve(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
items = { | |
"123": { | |
"id": '123', | |
"title": 'title1', | |
"description": 'Description text', | |
"tag": 'Tag1', | |
"timestamp": '2021-06-21', | |
}, | |
"456": { | |
"id": '456', |
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 datetime | |
timestamps = [] | |
for i in range(30): | |
new_date = datetime.datetime(2021, 7, i+1, 12, 00, 00, 000, | |
tzinfo=datetime.timezone.utc) | |
timestamp = int(datetime.datetime.timestamp(new_date) * 1000) | |
timestamps.append(timestamp) |
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
#include "include/SFML/Audio.hpp" | |
#include "include/SFML/Graphics.hpp" | |
#include "include/box2d/box2d.h" | |
#include <iostream> | |
// g++ -std=c++11 sfml_grid.cpp -o sfml_grid -I include -L lib -l sfml-graphics -l sfml-window -l sfml-system -l sfml-audio -Wl,-rpath ./lib | |
int main(int, char const **) | |
{ | |
// Create the main window |
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 datetime | |
# Create utc datetime object. | |
utcdatetime = datetime.datetime.utcnow() | |
print(utcdatetime) | |
# Create unix epoch timestamp from datetime. | |
milliseconds = int(datetime.datetime.timestamp(utcdatetime) * 1000) | |
timestamp = datetime.datetime.timestamp(utcdatetime) | |
print(milliseconds) |
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 os | |
import matplotlib.pyplot as plt | |
import numpy as np | |
my_path = os.path.dirname(os.path.abspath(__file__)) | |
timestamps = [1625086800000, | |
1625173200000, | |
1625259600000, | |
1625346000000, |