Skip to content

Instantly share code, notes, and snippets.

View gerasimua's full-sized avatar
💭
Reactive waiting

Alexander gerasimua

💭
Reactive waiting
View GitHub Profile
@gerasimua
gerasimua / index.js
Last active August 29, 2015 14:01
Confirm tab reload
window.onbeforeunload = function(e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Sure?';
}
// For Safari
return 'Sure?';
}
@gerasimua
gerasimua / httpd.conf
Created May 21, 2014 15:24
Add directory for apache if it is not root
<Directory "D:/Projects/PHP/silex-test/web">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
@gerasimua
gerasimua / httpd-vhosts.conf
Created May 21, 2014 15:26
Virtual host configurations
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "D:/Projects/PHP/silex-test/web"
ServerName silex-test.loc
ServerAlias www.silex-test.loc
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>
@gerasimua
gerasimua / gist:8972fffb8e0305d28d7a
Last active August 29, 2015 14:01
Beauty Color Generator
var r = function(){ return (Math.floor(Math.random()*100)+60).toString(16)}
var c = '#' + r() + r() + r();
var s = document.body.style;
s.height = "100%";
s.color = '#ffffff';
s.fontSize = '64px';
s.textAlign = 'center';
s.paddingTop = '15%';
s.backgroundImage = 'none';
s.backgroundColor = c;
var f = function(c){
var g = function(){return Math.floor(Math.random()*3);}
var colors = ['red', 'green', 'blue'];
var r = g();
if(typeof c == 'undefined'){ c = 'red'}
while(colors.indexOf(c) === r){r = g();}
document.body.style.backgroundColor = c;
document.body.innerHTML = colors[r];
setTimeout(function(){f(colors[r])}, 1000);
}
@gerasimua
gerasimua / gist:fddffafaf5cba3e3d3c1
Created July 24, 2014 15:47
IE version detection
var IE = (function () {
"use strict";
var ret, isTheBrowser,
actualVersion,
jscriptMap, jscriptVersion;
isTheBrowser = false;
jscriptMap = {
"5.5": 5.5,
@gerasimua
gerasimua / gist:3bb149928ed4bdb38656
Created August 6, 2014 15:01
IE check from css-tricks.com
var isMSIE = /*@cc_on!@*/0;
if (isMSIE) {
// do IE-specific things
} else {
// do non IE-specific things
}
@gerasimua
gerasimua / gist:16a7004407e5220eccda
Created August 8, 2014 09:19
Z-index of YouTube video in IE
//Fix z-index youtube video embedding
$('iframe').each(function(){
var url = $(this).attr("src");
if(url){
var separator = (url.indexOf('?') > 0) ? '&' : '?';
$(this).attr('src', url + separator + 'wmode=transparent');
$(this).attr("wmode", 'Opaque');
}
});
@gerasimua
gerasimua / gist:3ac8da5fc9f8348d4763
Last active August 29, 2015 14:05
Maintenance with exceptions by IP
SetEnv APPLICATION_ENV development
Options +FollowSymlinks
Options -Indexes
<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On
function getInternetExplorerVersion()
{
var rv = -1;
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}