Skip to content

Instantly share code, notes, and snippets.

View kadko's full-sized avatar
🍀
On vacation

kadko

🍀
On vacation
View GitHub Profile
.vegas-content-scrollable,.vegas-overlay,.vegas-slide,.vegas-slide-inner,.vegas-timer{position:absolute;top:0;left:0;bottom:0;right:0;overflow:hidden;border:none;padding:0;margin:0}.vegas-content-scrollable{position:relative;height:100%;overflow:auto}.vegas-overlay{opacity:.5;background:url(overlays/02.png) center center}.vegas-timer{top:auto;bottom:0;height:2px}.vegas-timer-progress{width:0%;height:100%;background:#fff;transition:width ease-out}.vegas-timer-running .vegas-timer-progress{width:100%}.vegas-slide,.vegas-slide-inner{margin:0;padding:0;background:center center no-repeat;transform:translateZ(0);will-change:transform,opacity}body .vegas-container{overflow:hidden!important;position:relative}.vegas-video{min-width:100%;min-height:100%;width:auto;height:auto}body.vegas-container{overflow:auto;position:static;z-index:-2}body.vegas-container>.vegas-overlay,body.vegas-container>.vegas-slide,body.vegas-container>.vegas-timer{position:fixed;z-index:-1}.vegas-transition-blur,.vegas-transition-blur2{opacity:
/*!-----------------------------------------------------------------------------
* Vegas - Fullscreen Backgrounds and Slideshows.
* v2.5.1 - built 2020-04-24
* Licensed under the MIT License.
* http://vegas.jaysalvat.com/
* ----------------------------------------------------------------------------
* Copyright (C) 2010-2020 Jay Salvat
* http://jaysalvat.com/
* --------------------------------------------------------------------------*/
!function(b){"use strict";function t(t,s){this.elmt=t,this.settings=b.extend({},e,b.vegas.defaults,s),this.slide=this.settings.slide,this.total=this.settings.slides.length,this.noshow=this.total<2,this.paused=!this.settings.autoplay||this.noshow,this.ended=!1,this.$elmt=b(t),this.$timer=null,this.$overlay=null,this.$slide=null,this.timeout=null,this.first=!0,this.transitions=["fade","fade2","blur","blur2","flash","flash2","negative","negative2","burn","burn2","slideLeft","slideLeft2","slideRight","slideRight2","slideUp","slideUp2","slideDown","slideDown2","zoomIn","zoo
@kadko
kadko / observable-pattern-pizza.js
Created September 6, 2020 20:22 — forked from boxgames1/observable-pattern-pizza.js
Observable pattern - Pizza Maker
const EventEmitter = require("events").EventEmitter;
class Pizza extends EventEmitter {
constructor(size = 1) {
super();
this.ovenTime = this._ovenTime(size);
this.maxIngredients = this._maxIngredients(size);
this.ingredients = [];
this.timeToReleasePizza = 5;
}
@kadko
kadko / find-global-index-of-element
Last active August 28, 2020 19:31
This code finds global DOM tree index of provided element object based on getElementsByTagName tag indexing. It works even if element duplicates exists in DOM. Two different recursive function used so data structure is tree. You can access target element directly resulted index, like this: let element = document.getElementsByTagName("*")[17];
/*
why on Earth i wrote this?
Answer is: if elements has no class, id or other attributes only option is selecting element directly by its index.
*/
let childCount = 0;
let count = 0;
function countTargetChilds(target, firstTarget){
let children = target.children;
if(firstTarget===target){
@kadko
kadko / ComputeHmac256.go
Created March 3, 2020 04:40 — forked from byrnedo/ComputeHmac256.go
Compute a hmac for a message in golang
func ComputeHmac256(message string, secret string) string {
key := []byte(secret)
h := hmac.New(sha256.New, key)
h.Write([]byte(message))
return base64.StdEncoding.EncodeToString(h.Sum(nil))
}
@kadko
kadko / substr_Index.php
Last active April 18, 2019 21:52
//Finds nth occourance of string after position of given needle. //Pass $needle argument as empty string [''] if you want to find from start //Pass $needle argument as Int to search string from this position
//Finds nth occourance of string after position of given needle.
//Pass $needle argument as empty string [''] if you want to find from start
//Pass $needle argument as Int to search string from this position
function substr_Index( $string, $needle, $delimiter, $nth ){
$str2 = '';
$posf = strpos($string, $needle);
if($posf !== false){
$string = substr($string, $posf);
$posTotal = $posf;
@kadko
kadko / PHP File Splitter (Keeps original file format)
Last active February 14, 2020 17:36
Outputs file to small parts as keeping original file data format
<?php
class splitFile{
private $fileName;
private $filecontents;
private $fileLen;
private $PIN;
private $partSize;
<?php
/* Big File Splitter v0.1
Kadir Korkmaz
*/
$fileStr = file_get_contents('sitemap.xml');
$past = 0;
$PIN = '</url>';//ENTER sitemap repetitive item element closing tag
$PINlen = mb_strlen( $PIN );
<?php
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 30000);
$sampleSQL = file_get_contents('sampleSQL.txt');
$past = 0;
$PIN = ');';
$PINlen = mb_strlen( $PIN );
$partSize = 0.2*1024*1024;//BYTES, 20MB
$len = mb_strlen($sampleSQL) / $partSize;
@kadko
kadko / pubsub-simple.js
Created September 6, 2018 01:55 — forked from fatihacet/pubsub-simple.js
Simple PubSub implementation with JavaScript - taken from Addy Osmani's design patterns book -
var pubsub = {};
(function(q) {
var topics = {}, subUid = -1;
q.subscribe = function(topic, func) {
if (!topics[topic]) {
topics[topic] = [];
}
var token = (++subUid).toString();
topics[topic].push({
token: token,