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 Foundation | |
class Dragon: Enemy { | |
let wings = 2 | |
override var type: String { | |
"Dragon" | |
} | |
override init(strength: Int) { | |
super.init(strength: strength * 2) |
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 UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var bar: UIProgressView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
bar.alpha = 0 | |
} |
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 Foundation | |
calculator() | |
func calculator() { | |
let a = Int(readLine()!)! //First input | |
let b = Int(readLine()!)! //Second input | |
do { | |
try add(n1: a, n2: b) | |
try subtract(n1: a, n2: b) |
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
javascript:!function(){const e=`button-${window.__meetsRandomNumber=window.__meetsRandomNumber||Math.floor(1e6*Math.random())}`;[...document.getElementsByClassName(e)].forEach((e=>e.remove())),[...document.getElementsByTagName("video")].forEach((function(n){const t=document.createElement("button");t.setAttribute("tabindex",1),t.setAttribute("class",e),t.setAttribute("style","\n z-index: 999999999;\n background: white;\n width: 28px;\n height: 28px;\n position: absolute;\n right: 50px;\n display: block;\n border-radius: 14px;\n margin: 8px;\n background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCI+DQogIDx0aXRsZT4NCiAgICBmdWxsc2NyZWVuDQogIDwvdGl0bGU+DQogIDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTEgMXY2aDJWM2g0VjFIMXptMiAxMkgxdjZoNnYtMkgzdi00em0xNCA0aC00djJoNnYtNmgtMnY0em0wLTE2aC00djJoNHY0aDJWMWgtMnoiLz4NCjwvc |
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
#SingleInstance Force | |
varSlowStep := 10 | |
varFastStep := 75 | |
pressingUp := False | |
pressingDown := False | |
pressingLeft := False | |
pressingRight := False | |
lastHorizontal := 0 | |
lastVertical := 0 |
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
function fetchAndLog(urls) { | |
const pending = new Map() | |
let lastProcessed = -1 | |
urls.map((x, i) => { | |
return fetch(x).then(x => { | |
if (lastProcessed === i - 1) { | |
console.log(x.json()) | |
checkPending(++lastProcessed) | |
} else { | |
pending.set(i, x.json()) |
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
let status = 'idle' | |
export const getStatus = () => status | |
let timerId | |
const clearTimer = () => clearTimeout(timerId) | |
const scheduleQueueCheck = ms => { | |
clearTimer() | |
timerId = setTimeout(checkQueue, ms) | |
} |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
<style> | |
body { | |
display: grid; |
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
// https://www.swyx.io/hooks/, https://www.youtube.com/watch?v=KJP1E-Y-xyo | |
const React = (function() { | |
let hooks = [] | |
let i = 0 | |
function useState(init) { | |
const state = hooks[i] || init | |
const currentIndex = i | |
const setState = newVal/*?*/ => hooks[currentIndex] = newVal | |
i++ | |
return [state, setState] |
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
// https://epicreact.dev/why-you-shouldnt-put-refs-in-a-dependency-array/ | |
import * as React from 'react' | |
import * as ReactDOM from 'react-dom' | |
function UsernameForm({ | |
initialUsername = '', | |
onSubmitUsername, | |
}) { | |
const [username, setUsername] = React.useState(initialUsername) | |
const [touched, setTouched] = React.useState(false) |
NewerOlder