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
const message = "Hello, this is the message"; | |
const hash = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(message))); | |
const base64 = btoa(String.fromCharCode(...hash))); |
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 { useEffect, useRef, useMemo } from "react"; | |
type Args = readonly unknown[]; | |
function usePartialCall<A extends Args, M extends Args, R>( | |
f: (...args: [...A, ...M]) => R, | |
...moreArgs: M | |
) { | |
const ref = useRef(moreArgs); |
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 React from 'react'; | |
function twoWay(Comp) { | |
return props => { | |
const { value, children, ...others } = props; | |
return ( | |
<Comp {...others} |
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
namespace Cudo | |
{ | |
public class CudoEvent<TRecord> | |
{ | |
public CudoEvent(CudoEventType type, TRecord record) | |
{ | |
Type = type; | |
Record = record; | |
} |
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 { autorun } from "mobx"; | |
import { createStore, Action, Reducer } from "./remox" | |
interface Person { firstName: string; lastName: string; } | |
interface SetFirstName { type: "SET_FIRST_NAME", newFirstName: string; } | |
interface SetLastName { type: "SET_LAST_NAME", newLastName: string; } | |
function personReducer(state:Person, action: SetFirstName | SetLastName) { |
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
interface Person { | |
readonly name?: string; | |
readonly age?: number; | |
} | |
const x = record<Person>({ name: "Bart" }).set({ age: 10 }); | |
const y = x.set({ age: 11 }); |
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
using System; | |
using System.Collections.Specialized; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text.RegularExpressions; | |
namespace WikiBackup | |
{ | |
class Program |
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 listenTo(target, notify) { | |
var proxy = {}; | |
Object.keys(target).forEach(function(methodName) { | |
var targetMethod = target[methodName].bind(target); | |
proxy[methodName] = function() { | |
var args = Array.prototype.slice.call(arguments); |
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
Test.foo(v => v > 5); |
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
var fs = require('fs'); | |
var path = require('path'); | |
var Q = require('q'); | |
var interrupt = require('./interrupt.js'); | |
var readdir = interrupt.bind(Q.nfbind(fs.readdir)); | |
var stat = interrupt.bind(Q.nfbind(fs.stat)); | |
var consoleLog = interrupt.bind(console.log); | |
NewerOlder