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 { random, floor } = Math; | |
function tryit() { | |
let count = 0; | |
while (true) { | |
++count; | |
if (random() < 1 / (2000 - count)) { | |
return count; | |
} | |
} | |
} |
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
/* eslint no-bitwise:off */ | |
/* Results: | |
Plain DataView / Native mapped Buffers | |
Node 0.4.12 / 5276ms (not quite the same test) | |
Node 0.6.21 8275ms / 1070ms (12%) (not quite the same test) | |
Node 0.8.28 6739ms / 986ms (14%) (not quite the same test) | |
Node v4.8.2: 4500ms / 1939ms (43%) | |
Node v6.9.1: 3900ms / 1090ms (28%) | |
Node v8.11.3: 2111ms / 2928ms (138%) | |
Node v10.16.0: 2200ms / 260ms (12%) |
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
<!DOCTYPE html> | |
<!-- Modified version of pointer lock code to lock on click from the main loop, works on Safari --> | |
<html lang="en"><head> | |
<title>Pointer Lock Test</title> | |
</head> | |
<body onload="startup()"> | |
<div id="status-element" style="background-color: #FEE; white-space: pre-wrap;">dragx=0, dragy=0 | |
double clicks: 0</div> | |
<script> |
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 strict'; | |
// Use path PATH=bin\;F:\Python27\;F:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;F:\bin | |
// Run with node stdio.js < A-small.in | |
const assert = require('assert'); | |
const fs = require('fs'); | |
function err() { | |
process.stderr.write(Array.prototype.join.call(arguments, ' ') + '\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
const { cos, PI, sin } = Math; | |
let time = 5; // 0-24 | |
const LAT = 45 * PI / 180; | |
const AXIAL_TILT = 23.5 * PI / 180; | |
const SOLAR_ORBIT = PI/2; // 0 - tilted towards the sun = summer solstice, PI = winter solstice | |
export function update() { | |
////////////////////////////////////////////////////////////////////////// |
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 fs = require('fs'); | |
const { GifCodec, BitmapImage } = require('./'); | |
const Jimp = require('jimp'); | |
let gif = fs.readFileSync('test/fixtures/rnaples-offsets-public.gif'); | |
const codec = new GifCodec(); | |
codec.decodeGif(gif).then((sourceGif) => { | |
const w = sourceGif.width; | |
const h = sourceGif.height; |
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
#define _CRT_SECURE_NO_WARNINGS 1 | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <assert.h> | |
#include "discord_game_sdk.h" | |
#ifdef _WIN32 | |
#include <Windows.h> | |
#else | |
#include <unistd.h> | |
#include <string.h> |
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
@echo off | |
@REM You Discord APP ID | |
SET APP_ID=451234567890123456 | |
@REM Path to `dispatch` executable - if it's in your global path, just "dispatch" is fine. | |
SET DISPATCH=bin\dispatch | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
pushd |
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
@echo off | |
@REM You Discord APP ID | |
SET APP_ID=451234567890123456 | |
@REM Path to `dispatch` executable - if it's in your global path, just "dispatch" is fine. | |
SET DISPATCH=bin\dispatch | |
SETLOCAL ENABLEDELAYEDEXPANSION | |
pushd |
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
#define dbgprint(...) async_mem_log.print(__VA_ARGS__) | |
#include "utilUtils.h" | |
#include "utilRand.h" | |
#include "utilTime.h" | |
void asyncThreadPoolTest() | |
{ | |
static auto one_ms = std::chrono::milliseconds(1); | |
int threads = 6; | |
std::vector< std::thread > workers; | |
int queued_tasks = 0; |