Skip to content

Instantly share code, notes, and snippets.

volkanozcan2

Block or report user

Report or block volkanozcan2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View utils.js
Point=PIXI.ObservablePoint;
Object.assign(Number.prototype, {
map(in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
},
constrain(low, high) {
return Math.max(Math.min(this, high), low);
}
});
View app.js
// Copyright (c) 2011 Alexei Kourbatov, www.JavaScripter.net
// function leastFactor(n) returns:
// * the smallest prime that divides n
// * NaN if n is NaN or Infinity
// * 0 if n is 0
// * 1 if n=1, n=-1, or n is not an integer
leastFactor = function(n) {
if (isNaN(n) || !isFinite(n)) return NaN;
@volkanozcan2
volkanozcan2 / app.js
Created Sep 6, 2017
createBinaryHuman
View app.js
let fs = require("fs");
let wr = fs.createWriteStream("./humans");
let stream = require("stream");
Number.prototype.toHex = function(digits = 2) {
let l = this.valueOf().toString(16);
if (digits - l.length <= 0) {
return l
} else {
return Array((digits - l.length) + 1).join("0") + l
}
View app.js
//from https://stackoverflow.com/a/18650828/1342927
Object.defineProperty(Number.prototype, "Size", {
get: function(b = 3) {
if (0 == this.valueOf()) return "0 Bytes";
var c = 1024,
d = b || 2,
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
f = Math.floor(Math.log(this.valueOf()) / Math.log(c));
return parseFloat((this.valueOf() / Math.pow(c, f)).toFixed(d)) + " " + e[f]
}
View template.js
function Vec(x = app.rw, y = app.rh, cb = null, scope = null) {
this.x = x;
this.y = y;
this.cb = cb;
this.scope = scope;
return new PIXI.ObservablePoint(this.cb, this.scope, this.x, this.y);
}
Object.defineProperty(PIXI.Application.prototype, 'rw', {
get: function() { return Math.random() * this.renderer.width; }
});
View template.js
class Vector extends PIXI.Point {
constructor(x = 0, y = 0) {
super();
this.x = x;
this.y = y;
return this;
}
static create(_angle = Math.random() * 2 * Math.PI, length = 1) {
let angle = _angle;
this.x = Math.cos(angle) * length;
View app.js
var app = new PIXI.Application(innerWidth, innerHeight, { backgroundColor: 0x1099bb, antialias: true });
document.getElementById("myContainer").appendChild(app.view);
var container = new PIXI.Container();
var graphics = new PIXI.Container();
app.stage.addChild(graphics);
/*
View app_test.js
let filledArr = (len) => {
let arr = new Uint8Array(len);
while (--len >= 0) {
arr[len] = Math.random() * 255;
}
return arr;
}
console.time("this");
let arr = filledArr(1e5);
View isimler.js
function isimler() {
this.isimler = ['Abdülcabbar', 'Abdülcebbar', 'Abdülcelil', 'Abdülcemal', 'Abdülcevat', 'Abdülezel', 'Abdülferit', 'Abdülfettah', 'Abdülgaffar', 'Abdülgaffur', 'Abdülgafur', 'Abdülgani', 'Abdülhadi', 'Abdülhak', 'Abdülhakim', 'Abdülhalik', 'Abdülhalim', 'Abdülhamit', 'Abdülkadir', 'Abdülkahhar', 'Abdülkerim', 'Abdüllâtif', 'Abdülmecit', 'Abdülmelik', 'Abdülmennan', 'Abdülmetin', 'Abdülnasır', 'Abdülvahap', 'Abdülvahit', 'Abdürrahim', 'Abdürrahman', 'Abdürrauf', 'Abdürreşit', 'Abdürrezzak', 'Abdüssamet', 'Abdüssami', 'Abdüsselâm', 'Abdüssemi', 'Abdüssettar', 'Abdüzzeki', 'Abgül', 'Abher', 'Abıhayat', 'Abır', 'Abıru', 'Abid', 'Abide', 'Abidin', 'Abil', 'Abir', 'Abit', 'Abiye', 'Ablak', 'Abraş', 'Abruy', 'Abuşka', 'Abuzer', 'Abuzettin', 'Acabay', 'Acabey', 'Ağabay', 'Ağcabey', 'Akabay', 'Akabey', 'Akçabay', 'Alabaş', 'Alabay', 'Alabegim', 'Alabegüm', 'Alabezek', 'Almabanu', 'Anabacı', 'Anabörü', 'Atabay', 'Atabek', 'Atabey'];
this.len = this.isimler.length;
}
isimler.prototype = {
View sıfatlar.js
let sıfatlar = ["aba",
"abacı",
"abajurlu",
"abajursuz",
"abalı",
"abandone",
"abani",
"abanoz",
"abartılı",
"abartısız",
You can’t perform that action at this time.