gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
ps2pdf input.pdf output.pdf
convert -delay 100 -loop 0 *.jpeg animatedGIF.gif
/* | |
JS ile input value değiştirildiğinde input için change eventini trigger et | |
JS trigger input change event when value modified programmatically | |
eg: input.value="bla bla" | |
*/ | |
const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(prevInput), 'value'); | |
Object.defineProperty(prevInput, 'value', { | |
set: function(t) { | |
//return descriptor.set.apply(this, arguments); |
var arr = [1,5,6,7,4,8,5]; | |
arr.reduce((previous, current, index, array)=>{ | |
return index%2==0 ? [...previous, array.slice(index,index+2)] : previous | |
},[]) | |
//>[[1,5],[6,7],[4,8],[5]] | |
const fetch = require("node-fetch"); | |
async function fetchAsync (url, type) { | |
const init = { | |
headers: { | |
"content-type": "text/html;charset=UTF-8", | |
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0" | |
} | |
} | |
/*bozuk türkçe karakter düzeltme*/ | |
function fixTrChars(str) { | |
var karakterler = [{'ı': 'ı'}, {'ç': 'ç'}, {'ÅŸ': 'ş'}, {'ö': 'ö'}, {'ü': 'ü'}, {'ÄŸ': 'ğ'}, { 'İ': 'İ'}, { 'Ç': 'Ç'}, { 'ÅŸ': 'Ş'},{'Ö':'Ö'}, {'Ü': 'Ü'}, {'ÄŸ': 'Ğ'}]; | |
return karakterler.reduce(function (accum, t) { | |
return accum.replace(new RegExp(Object.keys(t)[0], 'g'), t[Object.keys(t)[0]]); | |
}, str); | |
} | |
/* | |
Tiny time ago JS function localized into Turkish | |
SOURCE: | |
https://github.com/odyniec/tinyAgo-js | |
*/ | |
/*------------- USAGE --------------------*/ | |
ago(new Date("2021-09-26")) | |
/*3 gün önce*/ |
//source: https://www.merixstudio.com/blog/lazy-loading-pure-javascript/ | |
function lazyLoadInit(){ | |
let lazyImages = [].slice.call(document.querySelectorAll("img.lazy")); | |
let active = false; | |
var treshold = 100; | |
const lazyLoad = function() { | |
if (active === false) { | |
active = true; | |
setTimeout(function() { |
//source: https://ehikioya.com/working-with-javascript-onload-functions/ | |
//Add function to onload without overriding previously defined onloads | |
AddOnLoadEvent(yourFunction); | |
function AddOnLoadEvent(functionX) { | |
var oldonloadevent = window.onload; | |
if (typeof window.onload != 'function') { | |
window.onload = functionX; | |
} | |
else { |
//Source: https://aaronsmith.online/easily-load-an-external-script-using-javascript/ | |
//-------------------PROMISE METHOD -------------------------- | |
/** | |
* Loads a JavaScript file and returns a Promise for when it is loaded | |
*/ | |
const loadScript = src => { | |
return new Promise((resolve, reject) => { | |
const script = document.createElement('script') | |
script.type = 'text/javascript' |
const template = document.createElement("template"); | |
template.innerHTML = ` | |
<style> | |
:host{ | |
--light: #b0ade0; | |
--main: #36308aff; | |
--dark: #686778ff; | |
--gr1:linear-gradient(90deg, var(--darker), var(--main)); | |
font-family: 'Changa', sans-serif; | |
display:block; |