Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Kucherenko AlexTiTanium

View GitHub Profile
View books.md
View debug_draw_devkit.js
this.render = function(ctx) {
ctx.save();
var line = this.layer.collisionLine;
var l = this.layer.l;
var c = this.layer.c;
var px = this.layer.pointX;
var py = this.layer.pointY;
@AlexTiTanium
AlexTiTanium / index.html
Last active Oct 6, 2016
new object allocation #jsbench #jsperf (https://jsbench.github.io/#bf0abb976a944eae6bc2cb2967c0c561) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>new object allocation #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View bench.js
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.getSum = function() {
return this.x + this.y;
};
@AlexTiTanium
AlexTiTanium / code.js
Last active Mar 12, 2016
Simple shader test
View code.js
var vertices = [
-1, -1, 0,
1, -1, 0,
1, 1, 0,
-1, -1, 0,
1, 1, 0,
-1, 1, 0
];
View gist:042f47be7973391c54c9
programStars = loadProgram(gl, fs.readFileSync(__dirname + "/stars.glsl", "utf8"));
programNebula = loadProgram(gl, fs.readFileSync(__dirname + "/nebula.glsl", "utf8"));
programSun = loadProgram(gl, fs.readFileSync(__dirname + "/sun.glsl", "utf8"));
var position = [
-1, -1, 0,
1, -1, 0,
1, 1, 0,
-1, -1, 0,
1, 1, 0,
View Player.js
var GameObject = require('GameObject');
// Shortcuts
var game;
/**
* Player represent player objects
*
* @parent {GameObject}
*
View Mongo fix THP
#!/bin/sh
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Required-Start: $local_fs
# Required-Stop:
# X-Start-Before: mongod mongodb-mms-automation-agent
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
@AlexTiTanium
AlexTiTanium / server.conf
Last active Nov 12, 2015
Nginx cache server
View server.conf
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=local_cache:5m max_size=1g inactive=10m;
upstream api_buongiorno24 {
server 127.0.0.1:5000;
}
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
@AlexTiTanium
AlexTiTanium / AsyncException
Last active Nov 5, 2015
Tasks for review Write Promises
View AsyncException
var domain = require('domain');
// Do not change this function
function veryBadFunction(){
setTimeout(function(){
throw new Error('oops!!!');
}, 0)
}
You can’t perform that action at this time.