Skip to content

Instantly share code, notes, and snippets.

@destan
destan / privicyInJavascriptClasses.js
Created May 27, 2013 12:40
Private prototype functions and provate memebers in native javascript.
// Closure is necessary to get rid of 'strict mode' as `args.callee.caller` cannot be used in 'strict mode'
(function (scope) {
// LeClass declaration
// ===================
scope.LeClass = function () {
// Private members declared in private namespace `prv`
var prv = {
trala: 'you touch my tralala...',
# creates a new chain, blacklistdrop, which will log, update ip in the BLACKLIST and drop packet
sudo iptables -N blacklistdrop
sudo iptables -A blacklistdrop -j LOG --log-prefix "Adding to BLACKLIST: "
sudo iptables -A blacklistdrop -m recent --name BLACKLIST --set -j DROP

# A packet is from a host that has been seen in BLACKLIST in the last 120 seconds, the this rule updates the BLACKLIST and the packet is dropped.
sudo iptables -A INPUT -m recent --name BLACKLIST --update --seconds 120 -j DROP

# If a packet is from a host that is already in ZAA_URL list and exceeding limits the this rule forwards packet to blacklistdrop list to be blacklisted and then to be dropped
@destan
destan / preloader.js
Created March 23, 2016 15:27
sequential image preloader
function preload(imageArray, imageCache, index) {
Array.isArray = typeof Array.isArray == 'function' ? Array.isArray : function(a){return typeof a != 'undefined' && a.constructor == Array}
index = index || 0;
if (imageArray && imageArray.length > index) {
var img = new Image ();
var preloadFn = preload.bind(this, imageArray, imageCache, index + 1);
img.onload = preloadFn;
img.onerror = preloadFn;
img.src = imageArray[index];
if(Array.isArray(imageCache)) {
@destan
destan / dumpVersions.js
Last active February 17, 2017 11:32
Dump available library versions in Jira using OSGi Browser https://developer.atlassian.com/docs/developer-tools/using-the-osgi-browser
// on /plugins/servlet/upm/osgi page execute following and wait for all requests to complete
jQuery('h4').each( (i, e) => e.click() )
// then dump versions
let results = {}
jQuery('.upm-plugin-row h4').each(function() {
let name = jQuery(this).text()
let version = jQuery(this)
.closest('.upm-plugin.expandable')
@destan
destan / index.html
Last active January 16, 2019 19:36 — forked from darwin/index.html
Kod Gemisi xkcd Staj karikatur http://cmx.io/#31113a1a8e6d3b021673
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Kod Gemisi stajindan önce</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-17,121|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-30,82|-30,62|10,86|15,66">
@destan
destan / cryptselection.py
Last active October 4, 2019 11:54
encrypt selection selected text cryptselection extension for zim
# -*- coding: utf-8 -*-
# cryptselection plugin for zim
#
# Copyright 2015 Klaus Holler <kho@gmx.at>
# License: same as zim (gpl)
#
# Installation/Usage:
# * Put the cryptselection/ directory to your ~/.local/share/zim/plugins subdirectory
# i.e. cd ~/.local/share/zim/plugins &&
# git clone https://github.com/k3ho/zim-plugin-cryptselection.git cryptselection
@destan
destan / index.html
Last active October 4, 2019 11:55
Spotivote player UI
<main>
<header>
<img src="https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_equalizer_48px-128.png" width=80 height=80>
<h1>
<span class="track-name">Anyone Who Knows What Love Is (Will Understand)</span>
<span class="artists-album">
<span class="artist">Irma Thomas</span>
<span class="artists-album-separator">•</span>
<span class="album">Straight From The Soul</span>
</span>
@destan
destan / BilisimTerimleri.md
Last active October 4, 2019 12:13
bilisim terimleri, bilişim terimleri sözlüğü
Yabancı Sözcük Öneri
Tutorial Eğitsel
Cross-cutting concern Kesişen kaygı
@destan
destan / JavaBeginnerQuertionTr.md
Last active October 4, 2019 12:20
temel java inheritance sorusu

Aşağıdaki kodu inceleyiniz:

public abstract class Animal {...}

public class Human extends Animal implements Omnivore {...}

public class Deer extends Animal implements Herbivore {...}