Skip to content

Instantly share code, notes, and snippets.

@oguzhanaslan
oguzhanaslan / stop-image-to-copy.js
Created October 25, 2014 07:50
Stop Visitors Dragging Images To Copy
function stopImageDrag(){
$("img").bind("dragstart",function(e){
return false;
});
}
@oguzhanaslan
oguzhanaslan / Disable-Scrolling.js
Created October 25, 2014 07:51
Disable Scrolling
function disableScrolling(){
$(document).bind("scroll",function(e){
$('html, body').animate({scrollTop : 0},200);
});
}
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@oguzhanaslan
oguzhanaslan / scroll.js
Created December 5, 2014 14:13
Sticky Header: Change Navigation Active Class on Page Scroll with jQuery
$(document).ready(function () {
$(document).on("scroll", onScroll);
$('a[href^="#"]').on('click', function (e) {
e.preventDefault();
$(document).off("scroll");
$('a').each(function () {
$(this).removeClass('active');
})
@oguzhanaslan
oguzhanaslan / scroll_opacity_decrease
Created January 15, 2015 07:51
Scroll Event Opacity Decrease
$(window).on('scroll', function() {
$('#on-load-button').css('opacity', function() {
return 1 - ($(window).scrollTop() / $(this).outerHeight());
});
});
@oguzhanaslan
oguzhanaslan / lazyload.js
Created March 5, 2015 14:50
lazyload src change to data-original
$("img").each(function() {
$(this).attr("data-original",$(this).attr("src"));
$(this).removeAttr("src");
});
@oguzhanaslan
oguzhanaslan / beyaz-golge
Created April 27, 2015 10:46
yazının üstündeki beyaz gölgeli güzel şey
/* example: http://mnmly.com/ */
.seks {
top: 0;
left: 0;
width: 100%;
height: 100px;
position: fixed;
display: block;
content: "";
background: -webkit-gradient(linear,left top,left bottom,color-stop(0,#fff),color-stop(.6,rgba(255,255,255,0)));
@oguzhanaslan
oguzhanaslan / uri.js
Last active August 29, 2015 14:20 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
(function(global) {
function Dither(container, width, height) {
this.container = container;
this.width = width;
this.height = height;
this.canvas = null;
this.image = null;
this.draw = this.draw.bind(this);
@oguzhanaslan
oguzhanaslan / fit.js
Last active August 29, 2015 14:20 — forked from KrofDrakula/fit.js
// shorter vars for brevity
var a = image.naturalWidth,
b = image.naturalHeight,
c = maxImageWidth,
d = maxImageHeight,
r1 = a / b, // image aspect ratio
r2 = c / d; // container aspect ratio
// determine which dimension is the limiting factor
// according to the aspect ratio comparison and