This file contains hidden or 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 { createContext, useState } from 'react'; | |
const ThemeContext = createContext() | |
const ThemeProvider = function({ children }) { | |
// children are subscribers | |
const [theme, setTheme] = useState("light"); | |
const toggleTheme = function() { | |
setTheme((preTheme) => { |
This file contains hidden or 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
# Docker Compose, a tool for defining and running multi-container Docker applications. | |
# Commands to Run | |
# docker-compose -f ./docker-compose.dev.yaml build | |
# docker-compose -f ./docker-compose.dev.yaml up -d | |
# docker-compose exec web python manage.py migrate --noinput | |
version: "3.9" | |
services: |
This file contains hidden or 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
# Commands to Run | |
# docker-compose -f ./docker-compose.prod.yaml build | |
# docker-compose -f ./docker-compose.prod.yaml up -d | |
# docker-compose -f ./docker-compose.prod.yaml exec web python manage.py migrate --noinput | |
# docker-compose -f ./docker-compose.prod.yaml exec web python manage.py createsuperuser | |
version: "3.9" | |
services: |
This file contains hidden or 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
version: "3.9" | |
services: | |
# pull and start rabbitmq container | |
rabbitmq: | |
image: rabbitmq | |
command: rabbitmq-server | |
expose: | |
- "5672:5672" #amqp |
This file contains hidden or 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, { Fragment } from 'react'; | |
import { useState, useEffect } from 'react'; | |
export default function Solution() { | |
const [totalSeconds, setTotalSeconds] = useState(0); | |
const [isPaused, setPaused] = useState(true); // Start with paused state | |
const [time_str, setTime_str] = useState("00:00"); | |
function MyStart() { | |
let seconds = parseInt(document.getElementById("secs").value); |
This file contains hidden or 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
/* | |
create `go.mod` (requirements.txt of go): | |
> go mod init myApp/web-service-gin | |
then run | |
> go get github.com/gin-gonic/gin | |
> github.com/thoas/go-funk | |
create `main.go` |
This file contains hidden or 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
// go run main.go | |
// create a static folder and create `static.html` | |
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) |
This file contains hidden or 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
// go run . | |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"log" | |
"math/rand" | |
"net/http" |
This file contains hidden or 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 re | |
import scrapy | |
from scrapy.http import Request, Response | |
class MyscraperSpider(scrapy.Spider): | |
""" | |
> scrapy runspider MyScraper.py -o quotes.jsonl | |
""" |
This file contains hidden or 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
// npm install axios | |
import axios from 'axios'; | |
import { useEffect, useState } from 'react'; | |
export default function StudentDataCompoenet(){ | |
const [data, setData] = useState([]); |