Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Dumitru Uzun duzun

🎯
Focusing
View GitHub Profile
@duzun
duzun / jq.fn.maxZIndex.js
Created Nov 12, 2014
Finds maximum zIndex of an element
View jq.fn.maxZIndex.js
/**
* Finds maximum zIndex of an element
*/
;(function (global) {
var $ = global.jQuery || global.Zepto;
var maxZIndex = function maxZIndex(el,min) {
var el = this
, zIdx = el.css('zIndex')
View apiexamples.js
//*******************************************
// Level 1, basic API, minimum support
//*******************************************
/*
Modules IDs are strings that follow CommonJS
module names.
*/
//To load code at the top level JS file,
//or inside a module to dynamically fetch
@duzun
duzun / enableSelect-bookmarklet.html
Last active Jul 5, 2021
Enable Right Click and Text Selection Bookmarklet
View enableSelect-bookmarklet.html
<a class="btn btn-default btn-info bookmarklet" href="javascript:(function(d){var a=d.document,h=function(){},c=a.body||a.getElementsByTagName("body")[0],f=a.documentElement||a.getElementsByTagName("html")[0],k=[c,f,a],l=["webkit","khtml","moz","ms",""],g=["contextmenu","selectstart","select","mousedown","mouseup"],b=d.Selection,e=b&&b.prototype;e&&(e.removeAllRanges=h,b=a.selection)&&(b.clear=h);for(e=k.length;e--;)if(f=k[e]){for(b=g.length;b--;)f["on"+g[b]]=null;if(a=f.style)for(a.cursor="",a.webkitTouchCallout="initial",b=l.length;b--;)a[((c=l[b])?"-"+c+"-":c)+"user-select"]="initial"}(c=d.jQuery||d.Zepto)&&c(d).off(g)})(this);">
Enable Select
</a>
@duzun
duzun / header_cache.php
Last active Aug 29, 2015
Set cache control headers and manage http cache logic
View header_cache.php
/**
* Set cache control headers and manage http cache logic.
*
* @param (int|bool) $expires: true - use cache, false - no cache, int - expires timeout
* @param (time) [$modified]: Last modification time stamp
* @param (string) [$etag]: ETag content identifier
* @param (int) [$die]: 0 - no die, 1 - die on 304, -1 - no 304 headers
*
* @return (mixed) status code if cache, false if headers sent, true otherwise
*
@duzun
duzun / backup.sh
Last active Aug 29, 2015
MySQL auto-backup script
View backup.sh
#! /bin/sh
#
# Author: Dumitru Uzun (DUzun)
#
# Ussage:
# backup [-k <days>] [-s <subdir>] [-d <database>] [-e <exclude_tables_list>]
#
pass='<best-password-ever>'
user=backup
View https_transit.js
/**
* A script for transitioning to HTTPS for clients that support it.
*
* This script will make a request to https:yourdomain.com/ping?_clb_=?
* from the loaded http: document.
* If the request is successful, it will convert all the internal links
* to https:
*/
jQuery(function ($) {
if(location.protocol === 'http:') {
View 10-commandments-modern-web-application.md

The 10 Commandments of Modern Web Application

1. Instant Access

  • No Flash, Java or other plugins

2. Responsive Design

  • Responsive Layout
  • Mobile First