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 ... |
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
//@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
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]; |
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 { HttpStatus } from '@nestjs/common'; | |
export const enum ErrorCode { | |
BAD_TOKEN = 1000, | |
TOKEN_ERROR, | |
UNAUTHORIZED, | |
} | |
export interface ErrorMessage { | |
errorCode: ErrorCode; |
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
max_width = 80 | |
tab_spaces = 4 | |
fn_single_line = true | |
match_block_trailing_comma = true | |
normalize_comments = true | |
wrap_comments = true | |
merge_imports = true | |
reorder_impl_items = true | |
use_field_init_shorthand = true | |
use_try_shorthand = true |
OlderNewer