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 / awesome.frag
Created February 15, 2016 07:01
Simple math function drawer in glsl shader fragment
#define drawFunctionRGB(function, r, g, b) if(distance(position.y, (1. + function(position.x*10.))/2.) < 0.01) color = vec3(r, g, b)
#define drawFunctionRGB_shifted(function, shift, r, g, b) if(distance(position.y, (1. + function(position.x*10. + shift))/2.) < 0.01) color = vec3(r, g, b)
// use wisely
@co3moz
co3moz / zinus.frag
Created February 5, 2016 12:47
Zinus fragment just why not?
// zinus
// co3moz (Doğan Derya)
precision mediump float;
uniform float time;
uniform sampler2D backbuffer;
uniform vec2 resolution;
#define g(x1, y1) (texture2D(backbuffer, vec2(p.x + x1, p.y + y1)))
void main() {
@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);
@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 / 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 / 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 / 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 :)
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
// 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;});}
@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));
}