This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
// source: https://www.apphp.com/index.php?snippet=css-collapsible-sliding-side-panel | |
// You may define side panel, that will slide whether on button click on on window size changing. | |
#sidepane{ | |
display: block; | |
position: absolute; | |
transform: translateX(-100%); | |
transition: transform ease-out 0.2s; | |
} | |
#sidepane.fadeIn{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://www.apphp.com/index.php?snippet=htaccess-prevent-access-to-single-file-or-multiple-files | |
# Prevent viewing of a specific file | |
<files file.jpg> | |
Order allow,deny | |
Deny from all | |
</files> | |
# Prevent access to multiple file types | |
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd)$"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: http://apphp.com/index.php?snippet=htaccess-www-or-no-www | |
# Force the www. | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^your-site.com [NC] | |
RewriteRule ^(.*)$ http://www.your-site.com/$1 [L,R=301] | |
# Remove the www. | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^your-site.com$ [NC] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- http://www.apphp.com/index.php?snippet=mysql-get-random-record-based-on-weight | |
-- Must have as field named 'weight' | |
SELECT * FROM `table` ORDER BY RAND() * (1 / `weight`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- source: http://www.apphp.com/index.php?snippet=mysql-insert-or-update-if-unique-key-already-exists | |
-- Unique key for table must be pre-defined | |
INSERT INTO `tableName` | |
VALUES (field1,field2,field3,'-1',...,fieldN,'0') | |
ON DUPLICATE KEY | |
UPDATE `field1` = 'abc', `field2` = '123' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: http://www.apphp.com/index.php?snippet=html-5-article-structure | |
<article class="entry"> | |
<header> | |
<h1 class="entry-title">What you think about all this?</h1> | |
<time class="updated" datetime="2013-12-01 01:12:02-0300" pubdate>01-12-2013</time> | |
<p class="byline author vcard"> | |
By <span class="fn">John Smith</span> | |
</p> | |
</header> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// source: www.apphp.com/index.php?snippet=html-post-data-into-iframe | |
<form action="iframe.php" target="my_iframe" method="post"> | |
<label for="text">Name:</label> | |
<input type="text" name="full_name"> | |
<label for="text">Email:</label> | |
<input type="text" name="email"> | |
<input type="submit" value="post"> | |
</form> | |
<iframe name="my_iframe" src="iframe.php"></iframe> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
/* source: http://www.apphp.com/index.php?snippet=css-non-transparent-inside-transparent-elements */ | |
.bar { | |
height: 4em; | |
padding-top: 2em; | |
opacity: 0.5; | |
background: black; | |
border-top: 3px solid #ccc; | |
border-bottom: 3px solid #ccc; | |
margin-top: 5.0em; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type="text/css"> | |
/* source:apphp.com/index.php?snippet=css-align-backgroud-image-with-offset */ | |
#sidebar ul li li a { | |
background-image:url(../images/side-li-rtl.png); background-position:right 15px top 9px; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
// source: www.apphp.com/index.php?snippet=javascript-display-random-quotes | |
writeRandomQuote = function () { | |
var quotes = new Array(); | |
quotes[0] = "Action is the real measure of your intelligence."; | |
quotes[1] = "The baseball has a great advantage over cricket of being sooner ended."; | |
quotes[2] = "Every goal, every action, every thought, every feeling one experiences, whether it be consciously or unconsciously known, is an attempt to increase one’s level of peace of mind."; | |
quotes[3] = "A good head and a good heart are always a formidable combination."; | |
var rand = Math.floor(Math.random()*quotes.length); | |
document.write(quotes[rand]); |
NewerOlder