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 {useEffect, useRef, useState} from 'react'; | |
export type AsyncEffectFuncContext = { | |
wrap: <T>(p: Promise<T>) => Promise<T>; | |
}; | |
export type AsyncEffectFunc = (p: AsyncEffectFuncContext) => Promise<void>; | |
export function useAsyncEffect( | |
createGenerator: AsyncEffectFunc, |
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 { spawn, fork } = require("child_process"); | |
const readline = require("readline"); | |
async function* c(x) { | |
for await (const line of x) { | |
yield line; | |
} | |
} | |
async function readLine(g) { |
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
public class S : IDisposable | |
{ | |
private static void Log(string s) | |
{ | |
Console.WriteLine(DateTime.Now + ": " + s); | |
} | |
private readonly string _caller; | |
private readonly System.Diagnostics.Stopwatch _s; |
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
pragma solidity ^0.4.0; | |
contract Vaults { | |
struct Deposit { | |
bool isCreated; | |
uint amount; | |
uint takenInterest; | |
uint depositBlock; | |
uint releaseRequestBlock; | |
address releaseTo; |
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
<link rel="import" href="../core-icon-button/core-icon-button.html"> | |
<link rel="import" href="../core-toolbar/core-toolbar.html"> | |
<link rel="import" href="../core-header-panel/core-header-panel.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
:host { | |
position: absolute; |
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
public class Parallel2 | |
{ | |
public delegate void ParallelForBodyDelegate(int i, int progress); | |
public static void For(int fromInclusive, int toExclusive, ParallelForBodyDelegate body) | |
{ | |
int counter = 0; | |
Parallel.For( | |
fromInclusive, | |
toExclusive, |
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
fs = require('fs'); | |
path = require('path'); | |
glob = require('/home/ironic/.nvm/v0.11.14/lib/node_modules/glob'); | |
util = require('util'); | |
path.deepdir = function (_path, count) { | |
var result = _path; | |
for (var i = 0; i < count; i++) | |
result = path.dirname(result); | |
return result; |
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
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Data.Common; | |
using System.Data.Entity; | |
using System.Linq; | |
using Npgsql; | |
namespace ConsoleApplication1 | |
{ | |
[Table("books", Schema = "public")] |