Skip to content

Instantly share code, notes, and snippets.

View Vbitz's full-sized avatar

Joshua Scarsbrook Vbitz

View GitHub Profile
var http = require("http");
var gitioURL = "git.io";
function shortenURL(url, cb) {
var req = http.request({
hostname: gitioURL,
port: 80,
path: "/",
method: "post",
@Vbitz
Vbitz / primes.cs
Last active August 29, 2015 14:00
Performance test of Node.js vs C# : Code is based off code from http://v8-io12.appspot.com/. The C# version is a copy of the C++ version with slight syntatic changes
using System;
using System.Diagnostics;
namespace PrimeTest {
class Primes {
public int getPrimeCount() { return prime_count; }
public int getPrime(int i) { return primes[i]; }
public void addPrime(int i) { primes[prime_count++] = i; }
| 0.435185 : [Log] CoreEventTest | C++ Event::On Performance Test x 2: 5.00679e-06s
| 0.435209 : [Log] Script | [1] adder = 0
| 0.459035 : [Log] CoreEventTest | C++ Event::Emit Performance Test x 2: 2.14577e-06s
| 0.475561 : [Log] Script | [1] adder = 50000
| 0.487468 : [Log] Script | [1] adder = 100000
| 0.507901 : [Log] Script | [1] adder = 150000
| 0.524543 : [Log] Script | [1] adder = 200000
| 0.524581 : [Log] CoreEventTest | C++ Event::Emit Performance Test x 200000: 0.0655129s
| 0.548431 : [Log] CoreEventTest | C++ Event::Emit No Target Performance Test x 200000: 0.023807s
| 0.54858 : [User] Script | [1] testNum = 0
#include <Engine2D.hpp>
#include <someRandomCoolLibary.h>
ENGINE_JS_METHOD(Testing) {
ENGINE_JS_SCOPE_OPEN;
ENGINE_CHECK_ARG_COUNT(1);
ENGINE_CHECK_ARG_INT32(0, "Arg0 is the number to get somethingIfyed");
fs.configDir("minesweeper");
var levelWidth = 30,
levelHeight = 20,
bombs = Math.floor((levelWidth * levelHeight) / 8),
tileSize = 16,
xOff = 20,
yOff = 40,
levelDrawWidth = levelWidth * (tileSize + 1) + xOff,
levelDrawHeight = levelHeight * (tileSize + 1) + yOff,
@Vbitz
Vbitz / src_Profiler.cpp
Last active December 23, 2015 07:49
Crash inside of unordered_map
uname -a
=========
Darwin Vbitz-MBP 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64
clang -v
==========
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.4.0
Thread model: posix
@Vbitz
Vbitz / gist:6043742
Created July 20, 2013 03:31
JSDoc'ed Method
/**
* combine <tt>a</tt> and <tt>b</tt> into 1 return value
* @param {value} a
* @param {value} b
* @param {boolean} deep
* @param {number} deepLevels
* @return {value}
*/
function combine(a, b, deep, deepLevels) {
// don't let it get into a loop with a circluar reference
@Vbitz
Vbitz / gist:5827697
Created June 20, 2013 23:31
Engine Profiler is now quite a bit more useful.
41.077 : [Verbose] Profiler | ProfileEvent : Root::Frame::Draw : 0.00152802s
41.077 : [Verbose] Profiler | ProfileEvent : Root::Frame::Draw::EngineUI : 0.000198126s
41.077 : [Verbose] Profiler | ProfileEvent : Root::Frame : 0.0170228s
41.0771 : [Verbose] Profiler | ProfileEvent : Root::Frame::Draw::GLClear : 2.19345e-05s
41.0771 : [Verbose] Profiler | ProfileEvent : Root::InitOpenGL : 0.239579s
41.0771 : [Verbose] Profiler | ProfileEvent : Root::InitScripting : 0.00807309s
41.0772 : [Verbose] Profiler | ProfileEvent : Root::Frame::Draw::JSDraw : 0.00128007s
41.0772 : [Verbose] Profiler | ProfileEvent : Root::InitOpenGL::LoadFonts : 0.0104051s
41.0772 : [Verbose] Profiler | ProfileEvent : Root::InitOpenGL::LoadFonts::OpenFont_basic12px : 0.00324011s
41.0773 : [Verbose] Profiler | ProfileEvent : Root::InitOpenGL::LoadFonts::OpenFont_basic16px : 0.00373411s
var Libary = require("./ffi").Libary;
process.stdin.resume();
try {
var lib = new Libary("kernel32.dll");
console.log(lib.getExports());
lib.free();
[start] dbg_log(realm, "Entering astFile at: " + currentPos); : Entering astFile at: 0
[start] dbg_log(realm, "CurrentPos Before Type: " + tokens[currentPos].type); : CurrentPos Before Type: KEYWORD
[start] dbg_log(realm, "Statment Type: " + tokens[currentPos].data); : Statment Type: function
[start] dbg_log(realm, "function first item: " + tokens[currentPos].type); : function first item: KEYWORD
[function_body] dbg_log(realm, "Entering astFile at: " + currentPos); : Entering astFile at: 5
[function_body] dbg_log(realm, "CurrentPos Before Type: " + tokens[currentPos].type); : CurrentPos Before Type: KEYWORD
[function_body] dbg_log(realm, "Statment Type: " + tokens[currentPos].data); : Statment Type: return
[return_statement] dbg_log(realm, "Entering astFile at: " + currentPos); : Entering astFile at: 6
[return_statement] dbg_log(realm, "CurrentPos Before Type: " + tokens[c