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
{ | |
"editor.formatOnSave": false, | |
"[javascript, python]": { | |
"editor.formatOnSave": true | |
} | |
} |
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
const Queue = require('bull') | |
const q = new Queue('my-first-queue') | |
setTimeout(async () => { | |
const data = { message: "my task" } | |
await q.add(data) | |
}, 5000) | |
q.process((job, done) => { |
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: | |
redis: | |
image: redis:6-alpine | |
ports: | |
- 6379:6379 |
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
const Queue = require('bull') | |
const q = new Queue('my-first-queue', { | |
redis: { port: 6379, host: "localhost" } | |
}) | |
q.process((job, done) => { | |
done(null, 'succes') | |
}) | |
q.on('completed', (job) => { |
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
package main | |
import "fmt" | |
type A struct{} | |
func (a A) Test() { | |
fmt.Println("Printing A") | |
} |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
type tanah interface { | |
luas(size float32) float32 | |
} |
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
package main | |
import ( | |
"fmt" | |
"golang.org/x/text/currency" | |
"golang.org/x/text/language" | |
"golang.org/x/text/message" | |
"golang.org/x/text/number" | |
) |
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 from 'react' | |
import useWebSocket, { ReadyState } from 'react-use-websocket' | |
function getStatus(readyState) { | |
const connectionStatus = { | |
[ReadyState.CONNECTING]: 'Connecting', | |
[ReadyState.OPEN]: 'Open', | |
[ReadyState.CLOSING]: 'Closing', | |
[ReadyState.CLOSED]: 'Closed', | |
[ReadyState.UNINSTANTIATED]: 'Uninstantiated', |
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 from 'react' | |
import useWebSocket, { ReadyState } from 'react-use-websocket' | |
function getStatus(readyState) { | |
const connectionStatus = { | |
[ReadyState.CONNECTING]: 'Connecting', | |
[ReadyState.OPEN]: 'Open', | |
[ReadyState.CLOSING]: 'Closing', | |
[ReadyState.CLOSED]: 'Closed', | |
[ReadyState.UNINSTANTIATED]: 'Uninstantiated', |
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 { useState, memo, useCallback } from "react" | |
function todos({ todos, addTodo }) { | |
console.log("child render") | |
return ( | |
<> | |
<h2>My Todos</h2> | |
{todos.map((todo, index) => { | |
return <p key={index}>{todo}</p> | |
})} |