Skip to content

Instantly share code, notes, and snippets.

@ixtk
ixtk / app.py
Created June 14, 2021 06:55
Python code example of OSU! API v2 usage
import requests
from pprint import pprint
from os import getenv
API_URL = 'https://osu.ppy.sh/api/v2'
TOKEN_URL = 'https://osu.ppy.sh/oauth/token'
def get_token():
data = {
'client_id': getenv('CLIENT_ID'),
@ixtk
ixtk / links.txt
Created June 15, 2021 12:31
Links and titles for some Social Empires images
[
{
"image": "https://s3.amazonaws.com/thumbnails.thecrimson.com/photos/2020/10/26/232756_1346454.jpg.1500x999_q95_crop-smart_upscale.jpg",
"title": "Inception - amazing movie with complex plot!",
"spoiler": false
},
{
"image": "https://variety.com/wp-content/uploads/2018/04/avengers-infinity-war-19.jpg?w=1000",
"title": "Let's talk about the ending of Avengers: Infinity war!",
"spoiler": true
@ixtk
ixtk / topics.js
Last active November 6, 2023 15:09
const name = "John" // string
// name = "toma"
const age = 11 // number
const isRaining = false // boolean
const fruits = ["apple", "banana", "cherry"] // object (list)
const car = {
color: "red",
model: "Tesla",
import "./App.css"
import { useState } from "react"
function App() {
const [todoText, setTodoText] = useState("")
const [todoList, setTodoList] = useState([
{ value: "do homework", isChecked: false },
{ value: "watch a movie", isChecked: true },
{ value: "make bed", isChecked: true }
])
@ixtk
ixtk / app.jsx
Created November 15, 2023 12:39
import "./App.css"
import { useState } from "react"
function App() {
const [todoText, setTodoText] = useState("")
const [todoList, setTodoList] = useState([
{ value: "do homework", isChecked: true, id: 0 },
{ value: "watch a movie", isChecked: false, id: 1 },
{ value: "make bed", isChecked: true, id: 2 }
])
```
const CustomErrorMessage = (props) => {
// state simulation
const errorMessage = "Fullname is required"
// fun one liner
// return props.children?.(errorMessage) || <span>{errorMessage}</span>
if (props.children) {
return props.children(errorMessage)
import "./App.css"
import { useState } from "react"
function App() {
const [loading, setLoading] = useState(false)
const demoFetch1 = () => {
fetch("https://jsonplaceholder.typicode.com/comments")
.then((response) => {
import express from "express"
import mongoose from "mongoose"
import { customAlphabet } from "nanoid"
const app = express()
app.use(express.json())
const nanoid = customAlphabet("1234567890abcdef", 8)