Skip to content

Instantly share code, notes, and snippets.

View AlexTiTanium's full-sized avatar

Alex Kucherenko AlexTiTanium

View GitHub Profile
@AlexTiTanium
AlexTiTanium / debug_draw_devkit.js
Last active October 13, 2016 17:18
debug draw devkit
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 October 6, 2016 18:55
new object allocation #jsbench #jsperf (https://jsbench.github.io/#bf0abb976a944eae6bc2cb2967c0c561) #jsbench #jsperf
<!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>
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 March 12, 2016 21:39
Simple shader test
var vertices = [
-1, -1, 0,
1, -1, 0,
1, 1, 0,
-1, -1, 0,
1, 1, 0,
-1, 1, 0
];
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,
var GameObject = require('GameObject');
// Shortcuts
var game;
/**
* Player represent player objects
*
* @parent {GameObject}
*
#!/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 November 12, 2015 14:26
Nginx cache server
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 November 5, 2015 07:44
Tasks for review Write Promises
var domain = require('domain');
// Do not change this function
function veryBadFunction(){
setTimeout(function(){
throw new Error('oops!!!');
}, 0)
}