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
Array.range = (from, to, step) => | |
[...Array(Math.floor((to - from) / step) + 1)].map((_, i) => from + i * step); | |
function useVirtualized({rows, rowSize, rowRender, spacerRender, overscan = 1}) { | |
const [scrollTop, setScrollTop] = useState(0); | |
const scrollHandler = useCallback(() => { | |
setScrollTop(document.documentElement.scrollTop); | |
}, []); |
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 math | |
def f(x): | |
return math.pow(3, x) | |
a = 1 | |
h = 1 | |
riadkov = 5 |
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
use crate::assets::{asset_from_bytes_dynamic, Asset, AssetLoadError}; | |
use bf::uuid::Uuid; | |
use log::error; | |
use std::any::Any; | |
use std::collections::HashMap; | |
use std::ops::Deref; | |
use std::path::PathBuf; | |
use std::sync::{Arc, RwLock, Weak}; | |
use std::thread::spawn; |
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
use crate::assets::{asset_from_bytes_dynamic, Asset, AssetLoadError}; | |
use bf::uuid::Uuid; | |
use log::error; | |
use std::any::Any; | |
use std::collections::HashMap; | |
use std::ops::Deref; | |
use std::path::PathBuf; | |
use std::sync::{Arc, RwLock, Weak}; | |
use std::thread::spawn; |
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
class EmptyError(Exception): pass | |
class Item: | |
def __init__(self, value): | |
self.value = value | |
self.next = None | |
def __repr__(self): return f'{self.value} -> {self.next}' | |
class Node: | |
def __init__(self, key, value): |
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 turtle | |
t = turtle.Turtle() | |
# vypneme okamzite prekreslovanie aby sme nemuseli cakat na pomale korytnacky, ktorym to aj | |
# na najvyssej rychlosti trva relativne dlho pri zlozitych obrazkoch ako je slovo(10) a pod. | |
# neskor to zase zapneme aby sme predsalen nieco videli. sice to bude trhane, ale rychle. | |
turtle.tracer(0) | |
# prepisuje znak na vela znakov podla pravidiel gramatiky |
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
# Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 | |
def slova(n, abcd): # elegantne riesenie prvej ulohy ale uz ako generator | |
if n == 0: | |
return [""] | |
else: | |
return (ch + slovo for slovo in slova(n - 1, abcd) for ch in abcd) | |
def prvychk(k, z): # tiez z prvej ulohy ale uz ako generator | |
for i in range(0, k): |
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
# zdravim, niektore riesenia su odkomentovane. v mojom pocitaci nie je dost pamate ram aby som mohol vytvorit a | |
# v liste uchovat vsetky 20 znakove slova 6 prvkovej abecedy. na pocitaci s dostatocnou pamatou, by to ale malo ist. | |
# Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32 | |
def slova(n, abcd): | |
# funkcia generuje cisla z ciselnej sustavy podla abecedy (ak je abeceda "ABCD", tak je to 4kova sustava). | |
# v cykle pripocitava k takemuto cislu 1 a aplikuje prenesenie do vyssieho radu. z vygenerovanych cisel | |
# potom vyrobi stringy prelozenim do pismen abecedy (0 = A, 1 = B, ...) | |
l = [] | |
m = [0] * n |
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
async function removePost(userId, postId) { | |
const permissionsPromise = fetchPermissions(userId); | |
const postPromise = fetchPost(postId); | |
// Permissions and post object is fetched in parallel | |
if((await permissionsPromise).can('remove post') === false) { | |
throw new Error('Not enough permissions!'); | |
} | |
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
async function processData() { | |
const promise1 = downloadFromService1(); | |
const promise2 = downloadFromService2(); | |
const promise3 = downloadFromService3(); | |
const allResults = await Promise.all([promise1, promise2, promise3]); | |
... | |
} |
NewerOlder