Skip to content

Instantly share code, notes, and snippets.

View malipetek's full-sized avatar
🏠
Working from home

muhammet ali petek malipetek

🏠
Working from home
View GitHub Profile
@malipetek
malipetek / new-york-state-zip-codes-regex.js
Created January 25, 2020 11:05
new york state zip codes regex
/* source of zip codes is this: https://www.zipcodestogo.com/New%20York/
and automatically generated with regexgen npm module: https://npm.runkit.com/regexgen */
const nyreg = '/1(?:4(?:8(?:9[1-578]|3[016-9])|7(?:8[1-8]|7[02457-9]|6[0679]|0[126-9])|6(?:9[24]|3[89])|5(?:8[05689]|7[12]|6[013489]|0[24-8])|4(?:[78][0-25-9]|5[02-46]|4[1359]|3[02357]|1[013-68])|86[013-579]|2(?:7[0236]|6[013-579])|1(?:4[013-5]|2[05-79]|0[1-357-9])|0(?:9[12458]|8[0-356]|7[025]|0[14-689])|71[0-24-9]|46[1-46-9]|74[0-578]|60[2-9])|3(?:8(?:5[0169]|2[05-7])|7(?:9[04-7]|7[4-8])|6(?:[56][0-24-9]|0[1-35-8])|80[1-46-9]|4(?:8[02-689]|6[014589]|5[024-79]|4[0-29]|3[135-9]|2[014-68]|1[0135-8]|0[1-46-9])|3(?:6[0-578]|5[02-57]|4[0-3568]|3[1-57-9]|0[1-589])|2(?:2[0145]|1[0-2457-9])|1(?:5[2-9]|2[0-46]|0[1-478])|0(?:9[023]|5[1-467]))|423[13]|455[015-9]|307[1-46-8]|(?:488|3(?:69|03))[0-79]|308[0-47-9]|4(?:24|15)[01]|316[02-7]|402[014-9]|(?:4(?:87|72)|373)[0-46-9]|464[2-79]|484[0-35-7]|(?:442|383)[02-57-9]|2(?:9(?:9[235-8]|8[0135-79]|5[0235-9]|3[02-79]
@malipetek
malipetek / dark-slack.css
Last active November 24, 2019 04:59
Slack Dark CSS
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
@malipetek
malipetek / cloudSettings
Last active July 15, 2019 15:13
Visual Studio Code Settings Sync Gist
{"lastUpload":"2019-04-21T04:51:48.462Z","extensionVersion":"v3.2.9"}
@malipetek
malipetek / svg_transform_fix.js
Last active March 26, 2019 12:43
Fix By Ikaros
function transformSVGPath(pathStr) {
const DIGIT_0 = 48, DIGIT_9 = 57, COMMA = 44, SPACE = 32, PERIOD = 46,
MINUS = 45;
const DEGS_TO_RADS = Math.PI/180.0;
var path = new THREE.Shape();
var idx = 1, len = pathStr.length, activeCmd,
x = 0, y = 0, nx = 0, ny = 0, firstX = null, firstY = null,
@malipetek
malipetek / beeline_replica.js
Created January 9, 2019 19:55
Beeline replicator. *this may be working only in chrome.
var d = document.createElement('div')
d.innerHTML += `
<style>
.grdnt {
-webkit-text-fill-color: transparent;
background: -webkit-gradient(linear, left top, right bottom, from(#26BDA6), to(#FF5722));
-webkit-background-clip: text;
background-size: 100% 1.5em;
}
</style>`
@malipetek
malipetek / toDataURLwithLimit.js
Last active January 2, 2019 04:01
export canvas after shrinking to a size
/**
* @param {!HTMLCanvasElement} canvas
* @param {!Number|('b'|'kb'|'mb'|'gb')} targetSize
* @param {?{type: ('image/png'|'image/jpeg'), jpegQuality: Number, shrinkPercentOfOriginal: Number}} options
*/
function toDataURLwithLimit(canvas, targetSize, options){
options = options || {};
options.type = options.type || 'image/jpeg';
options.jpegQuality = options.jpegQuality || .75;
options.shrinkPercentOfOriginal = options.shrinkPercentOfOriginal || 10;
@malipetek
malipetek / oneByOne.js
Created December 22, 2018 22:13
sequentially do something and wait if there is a promise to wait
Array.prototype.oneByOne = function(action){
var arr = this;
return new Promise(function(resolve, reject){
var results = [];
var act = function (i) {
// action expexted to return a promise but otherwise should still work
var actionResult = action.call(arr[i], arr[i], i);
if(!actionResult || actionResult.constructor != Promise){
actionResult = new Promise(function (res, rej){
res(actionResult);
// just give me a array
function arrayify(htmlcollection){
var arr = [];
for(var i=0; i<htmlcollection.length; i++){
arr.push(htmlcollection[i]);
}
return arr;
}
@malipetek
malipetek / osym_anahtar_indir.js
Created July 30, 2018 13:55
ÖSYM KPSS cevap anahtarı indirme
// OSYM aday girişi yaptıktan sonra başvurularım-> temel kitapçık görüntüle sayfasında yürütmeniz gerek.
// Bunu konsola kopyalayıp yapıştırabilirsiniz ya da snippet olarak kaydedip yürütebilirsiniz
/*!
* html2canvas 1.0.0-alpha.12 <https://html2canvas.hertzen.com>
* Copyright (c) 2018 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License
*/
!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.html2canvas=e():A.html2canvas=e()}(this,function(){return function(A){var e={};function t(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return A[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=A,t.c=e,t.d=function(A,e,r){t.o(A,e)||Object.defineProperty(A,e,{configurable:!1,enumerable:!0,get:r})},t.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return t.d(e,"a",e),e},t.o=function(A,e){return Object.prototype.hasOwnProp
@malipetek
malipetek / plswait.js
Created July 21, 2018 08:39
jQuery pls wait
$.fn.plswait = function(command, arg1){
this.each(function(){
function loadingBtnOverlay(el) {
this.element = $(el);
this.overlay = null;
return this;
}
loadingBtnOverlay.prototype.start = function (btn){
if(!$('body > #sclupndown-anim').is('*')){