Skip to content

Instantly share code, notes, and snippets.

View kepek's full-sized avatar
💭
I may be slow to respond.

Michal Kechner kepek

💭
I may be slow to respond.
View GitHub Profile
@kepek
kepek / gist:1932751
Created February 28, 2012 14:11
Get .htpasswd path
AuthName "Komunikat okienka logowania"<br />
AuthType Basica<br />
AuthUserFile <?php echo dirname(__FILE__) . "/.htpasswd" ?><br />
Require valid-user<br />
@kepek
kepek / counter.php
Created March 12, 2012 14:45
promotion time counter (jQ)
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>promoTime</title>
</head>
<body>
<?php $dateFormat = '%e days, %H hours, %M minutes, %S seconds'; ?>
try{
FB.login(function(response) {
if(response.status=='connected') {
setLocation('<?php echo $this->getConnectUrl() ?>');
}
}, {
scope: '<?php echo $this->getRequiredPermissions() ?>'
});
}
catch(error) {
@kepek
kepek / web.config
Created April 4, 2012 08:07
IIS Files Listing (Indexes) #1
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" />
<handlers>
<remove name="StaticFile" />
<remove name="ASPClassic" />
<add name="ASPClassic *.html" path="*.html" verb="*" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="Unspecified" requireAccess="Script" />
<add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%windir%\system32\inetsrv\asp.dll" resourceType="File" requireAccess="Script" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" scriptProcessor="" resourceType="Either" requireAccess="Read" />
@kepek
kepek / web.config
Created April 4, 2012 08:36
IIS Files Listing (Indexes) #2
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path=".">
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</location>
</configuration>
@kepek
kepek / dirty_select_fix.js
Created April 30, 2012 12:17
Dirty Fix for Select Width when Options are bigger than Select Element
var __DirtySelectFix = function(elementId, selectSize) {
// if(navigator.appName == 'Microsoft Internet Explorer') {
// Defaults
element = typeof(elementId) != 'undefined' ? document.getElementById(elementId) : document.getElementsByTagName('select'),
selectSize = typeof(selectSize) != 'undefined' ? selectSize : 230;
// Init
var i=0; for(i=0; i < element.length; i++) {
var
wrapper = document.createElement('div');
wrapper.style.width = selectSize+'px';
.wf-loading {
height: 100%;
overflow: hidden;
background: #fff url(../images/ajax-loader.gif) 50% 50% no-repeat fixed;
}
.wf-loading * {
opacity: 0;
}
var
setCookie = function (c_name, value, exdays) {
var exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString() + "; path=/");
document.cookie = c_name + "=" + c_value;
};
setCookie("BsiLanguage", "pl_PL", 90, "/");
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tytul</title>
</head>
<body>
<div id='mojElement' data-prefix-options='{"href":"#targetElement", "inline":true, "iframe":false, "width":"300", "height":"130", "opacity":"0.25"}'>
Tekst...
</div>
@kepek
kepek / rglob.php
Last active April 30, 2021 03:36
[PHP] recursive glob() with (array) $ignore param.
<?php
define( 'DEBUG', ( isset( $_GET['debug'] ) ? true : false ) );
function array_flatten( $arr ) {
$arr = array_values( $arr );
while ( list( $k, $v )=each( $arr ) ) {
if ( is_array( $v ) ) {
array_splice( $arr, $k, 1, $v );
next( $arr );