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
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define DIM 8 | |
struct vec { | |
int32_t x[DIM]; | |
}; |
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
#include <string.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
struct team { | |
const char *captain; | |
int32_t cap_mmr; | |
int32_t cash; | |
}; |
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
#include <zmq.h> | |
int main(void) { | |
void *context = zmq_ctx_new(); | |
void *sock = zmq_socket(context, ZMQ_REQ); | |
zmq_connect(sock, "tcp://localhost:5999"); |
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 steam = require('steam'); | |
const steamClient = new steam.SteamClient(); | |
const steamUser = new steam.SteamUser(steamClient); | |
const dota2 = require('dota2'); | |
const dotaClient = new dota2.Dota2Client(steamClient, true); | |
if (fs.existsSync('steam-servers.json')) { | |
steam.servers = JSON.parse(fs.readFileSync('steam-servers.json')); | |
} |
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
<?php | |
/** | |
* Convert a series of TIFF files given on the command line to pages in | |
* a single PDF | |
*/ | |
if ($argc < 3) { | |
echo ('Convert a series of TIFF images as individual pages in a PDF'); | |
echo ("\n".'Usage: php -f pdf_convert.php <output name> <input 1> <input 2> ...'); | |
exit(0); |
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
(defvar friends (evar friends '())) | |
(defvar enemies (evar enemies '())) | |
(defun start | |
(say "Halt, who goes there?") | |
(add-response "A friend." add-friend) | |
(add-response "An enemy." add-enemy)) | |
(defun add-friend | |
(set-var! friends (cons (get-name character) friends)) |
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
command! -complete=shellcmd -nargs=+ Shell call s:RunShellCommand(<q-args>) | |
function! s:RunShellCommand(cmdline) | |
echo a:cmdline | |
let expanded_cmdline = a:cmdline | |
for part in split(a:cmdline, ' ') | |
if part[0] =~ '\v[%#<]' | |
let expanded_part = fnameescape(expand(part)) | |
let expanded_cmdline = substitute(expanded_cmdline, part, expanded_part, '') | |
endif | |
endfor |
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
WELL = require('well-rng'); | |
_ = require('underscore'); | |
loop_count = 1000; | |
burn_count = 0; | |
s = []; | |
for (i = 0; i < 32; ++i) { | |
s[i] = 0; | |
} |
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
// Test 1: Do simple functions get inlined? | |
var iter = 10000; | |
var start, stop; | |
function inc(a) { return a+1; } | |
// Wrap test in a function to allow warmup of optimizer | |
function test1_fn(iter) { | |
var x; | |
for (var i = 0; i < iter; ++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
Results: | |
Promise overhead (calling one after another) x1000: | |
1: 65ms Base (plain Node.js lstat call) | |
2: 75ms When: Dedicated wrapper | |
3: 86ms flux-link | |
4: 97ms Deferred: Dedicated wrapper | |
5: 102ms Deferred: Promisify (generic wrapper) | |
6: 135ms jQuery.Deferred: Dedicated wrapper | |
7: 1055ms Q: Dedicated wrapper |