Skip to content

Instantly share code, notes, and snippets.

View co3moz's full-sized avatar
🍗
increasing the entropy

Doğan Derya co3moz

🍗
increasing the entropy
View GitHub Profile
@co3moz
co3moz / chio.cpp
Last active August 29, 2015 14:10
Making a determinant with Chio Way..
#include <iostream>
#include <math.h>
using namespace std;
class Matris {
private:
double* objects;
int k;
int iterator = 0;
@co3moz
co3moz / check.js
Last active March 24, 2016 14:48
Small size object type checker for js
var check = function(o) {
return (o == null) ? null : o.constructor == Function ? o.name == "" ? "Callback" : "Class_" + o.name : o.constructor.name;
};
// how can be different check and typeof
// checkfor check result typeof result
check(null); //null "object"
check(undefined); //null "undefined"
check(1); //"Number" "number"
check([]); //"Array" "object"
@co3moz
co3moz / parameter.js
Last active March 29, 2016 15:34
Get function parameter names in javascript
Function.prototype.getParameters = function () {
return this._parameters || (this._parameters = /function *(?:.*?)\((.*?)\)/.exec(this + "")[1].split(/,/g).map(Function.prototype.call, String.prototype.trim));
}
// dependencies: md5 (for now :()
function a(unique,array){var tmp=[];return array.map(function(e){return d(unique,e);});}
function b(unique,array){var tmp=[];return array.map(function(e){return c(unique,e);});}
function c(x,y){var k=x^y;for(var i=0;i<x&0xF;i++)k=(k-x)^x;return k}
function d(x,y){var k=x^y;for(var i=0;i<x&0xF;i++)k=(k+x)^x; return k}
function en(x,y){return g(a(u(x),f(y)));}
function de(x,y){return g(b(u(x),f(y)));}
function f(a){return a.split("").map(function(x){return x.charCodeAt(0);})}
function g(a){return a.map(function(x){return String.fromCharCode(x);}).join("");}
function u(key){return md5(key).split("").map(function(e){var k=e.charCodeAt(0);if(k<97){return k-48;}else{return k-97+10;}}).reduce(function(a,b){return a+b;});}
function k(){return Math.random()*255|0};setInterval(function(){Array.from(document.querySelectorAll("*")).forEach(function(e){e=e.style;e.backgroundColor="rgb("+k()+","+k()+","+k()+")";e.color="rgb("+k()+","+k()+","+k()+")";e.borderRadius="5px"})},250);
// lol
@co3moz
co3moz / fuck-sabis.js
Created January 19, 2016 09:53
Ignore sabis's poll
Array.from(document.querySelectorAll("[type=radio]")).forEach(function(x){x.checked=true;});
document.querySelector("[type=submit]").click()
// press f12 type this :)
@co3moz
co3moz / cake.frag
Last active January 26, 2016 10:08
Cake Fragment
// HAPPY BIRTHDAY TO YOU :)
// co3moz (Dogan Derya)
// https://gist.github.com/co3moz/4abd3c0576100fff321f
#define CAKE_LENGTH 10.
#define CAKE_WIDTH 10.
#define CAKE_COLOR 0, i / CAKE_LENGTH, 1
#define CANDLE_LENGTH 9.
#define CANDLE_COUNT 9.
#define CANDLE_COLOR z / CANDLE_LENGTH * c(2., 2.), 0, 0
@co3moz
co3moz / Broadcast.java
Last active January 23, 2017 16:55
Socket.IO with spring and auto route
package com.co3moz.client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
/**
* BroadcastMessage (21 January 2016 14:27)
*/
@Repository
public class Broadcast {
@co3moz
co3moz / another.frag
Created February 2, 2016 12:33
Another Fragment :)
//co3moz
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
uniform vec2 resolution;
vec2 center = vec2(0.5, 0.5);
@co3moz
co3moz / turkishExtension.js
Created February 2, 2016 13:55
Sayıların sonuna 'ta ya da 'tan eklemek için geliştirilmiş işlemci dostu fonksiyon
/**
* Adds extension to number
* @param a Number
* @param [n] default is "n"
* @returns {string}
* @example turkishExtension(40); // "40'tan"
* @example turkishExtension(40, ""); // "40'ta"
*/
function turkishExtension(a, n) {
var lastDigit = 1 << Math.abs(a % 10);