Skip to content

Instantly share code, notes, and snippets.

@weivall
weivall / gist:2519022
Created April 28, 2012 13:17
navigator.userAgent
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
@weivall
weivall / gist:2489960
Created April 25, 2012 14:07
Prevent click-jacking
$(document).ready(function() {
// Prevent click-jacking
if (top != self) {
$('body').html('<h1>Unauthorized</h1>')
}
});
//// ============
try {
@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>
@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: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:2477716
Created April 24, 2012 08:02
box-shadow
box-shadow: x y blur spread color;
@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: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: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: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">