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
library block; | |
import 'dart:async'; | |
import 'package:crypto/crypto.dart' show sha256; | |
class Block { | |
int nonce = 0; | |
String _hash; | |
final int index; | |
final int ts; |
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
package main | |
import ( | |
"crypto/sha256" | |
"encoding/json" | |
"fmt" | |
"strings" | |
) | |
// Data ... |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
/* | |
* RC5REF.C -- Reference implementation of RC5-32/12/16 in C. | |
* Copyright (C) 1995 RSA Data Security, Inc. | |
* reWritten By Shady Khalifa @shekohex 2018 | |
* see this pdf for more info about RC5: https://goo.gl/U5G44K | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef unsigned int WORD; // Should be 32-bit = 4 bytes |
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
//@ts-check | |
console.time('Elapsed time'); | |
const playlistVideos = document.querySelector( | |
"#contents > ytd-playlist-video-list-renderer > #contents" | |
); | |
const spanTime = document.querySelectorAll( | |
"#overlays > ytd-thumbnail-overlay-time-status-renderer > span" | |
); | |
let playlistTime = 0; | |
for (let i = 0; i < playlistVideos.childElementCount; i++) { |
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
interface MyConfig { | |
dbName: string; | |
port: number; | |
env: 'prod' | 'dev' | 'test'; | |
} | |
class TypedConfigManager<T = any> { | |
getConfig<K extends keyof T>(key: K, fallback: T[K]) { | |
// do magic stuf here. | |
} |
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
const users = [ | |
{ | |
Name: 'Ramy', | |
City: { | |
1: { | |
city: 'Zagazig' | |
}, | |
2: { | |
city: 'Banha' | |
} |
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
export class AsyncResult<T, E extends Error = any> { | |
private constructor(private readonly value?: T, private readonly error?: E) {} | |
public static Ok<T, E extends Error>(value: T) { | |
return new AsyncResult<T, E>(value); | |
} | |
public static Err<T, E extends Error>(error: E) { | |
return new AsyncResult<T, E>(undefined, error); | |
} |
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
AND = { "." } | |
NOT = { "`" } | |
OR = { "+" } | |
SEP = _{ (NEWLINE | WHITE_SPACE) } | |
VAR_NAME = { (ASCII_ALPHA ~ ASCII_DIGIT*) } | |
VAR = { VAR_NAME ~ SEP* ~ NOT? ~ SEP* } | |
EXP = { VAR ~ SEP* ~ ((OR | AND) ~ SEP* ~ VAR ~ SEP*)* } | |
FUNC = { VAR ~ SEP* ~ "=" ~ SEP* ~ EXP+ } | |
ROOT = _{ SOI ~ NEWLINE* ~ (FUNC | ANY) ~ NEWLINE* ~ EOI } |
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
/// https://leetcode.com/problems/parsing-a-boolean-expression | |
/** | |
* @param {string} expression | |
* @return {boolean} | |
*/ | |
var parseBoolExpr = function(expression) { | |
const stack = []; | |
for (let i = 0; i <= expression.length; ++i) { | |
const c = expression[i]; |
OlderNewer