Skip to content

Instantly share code, notes, and snippets.

@weivall
weivall / gist:1941425
Created February 29, 2012 15:11
simulateClick
function simulateClick() {
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
var cb = document.getElementById("checkbox");
var canceled = !cb.dispatchEvent(evt);
if(canceled) {
// A handler called preventDefault
alert("canceled");
} else {
@weivall
weivall / gist:2366413
Created April 12, 2012 10:40
<!--[if lt IE 7 ]><html lang=en class="ie6"><![endif]-->
<!--[if lt IE 7 ]><html lang=en class="ie6"><![endif]-->
<!--[if IE 7 ]><html lang=en class="ie7"><![endif]-->
<!--[if IE 8 ]><html lang=en class="ie8"><![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html lang=en> <!--<![endif]-->
@weivall
weivall / gist:2367959
Created April 12, 2012 15:03
viewport
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
@weivall
weivall / gist:2411402
Created April 18, 2012 06:09
apple meta tags
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
@weivall
weivall / gist:2431975
Created April 20, 2012 21:21
genpasswd()
genpasswd() {
local l=$1
[ "$l" == "" ] && l=20
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
@weivall
weivall / gist:2432078
Created April 20, 2012 21:43
ЗАПРЕТ ЛИСТИНГА ВСЕХ ПАПОК И ПОД-ПАПОК
# ЗАПРЕТ ЛИСТИНГА ВСЕХ ПАПОК И ПОД-ПАПОК
Options -Indexes
# ЗАПРЕТ НА ЗАПУСК ФАЙЛА
RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
@weivall
weivall / gist:2477716
Created April 24, 2012 08:02
box-shadow
box-shadow: x y blur spread color;
@weivall
weivall / gist:2480062
Created April 24, 2012 14:20
css gradient
background: -o-linear-gradient(top, #b4d807 0%, #8ca800 100%);
background: -moz-linear-gradient(top, #b4d807 0%, #8ca800 100%);
background: -webkit-linear-gradient(top, #b4d807 0%, #8ca800 100%);
background: -ms-linear-gradient(top, #b4d807 0%, #8ca800 100%);
background: linear-gradient(top, #b4d807 0%, #8ca800 100%);
@weivall
weivall / gist:2489923
Created April 25, 2012 14:00
Microsoft.Shadow
-ms-filter:"progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=0,Color=#221919)";
filter: progid:DXImageTransform.Microsoft.Shadow(color=#221919,direction=0);}
@weivall
weivall / gist:2489943
Created April 25, 2012 14:04
window.console fix
<script type="text/javascript">if (!window.console) { window.console = {log: function(){}} };</script>