Skip to content

Instantly share code, notes, and snippets.

View Ricardo-Diaz's full-sized avatar

Ricardo Diaz Ricardo-Diaz

View GitHub Profile
@Ricardo-Diaz
Ricardo-Diaz / gist:3827180
Created October 3, 2012 14:23
CSS: Text Indent
.ir{
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@Ricardo-Diaz
Ricardo-Diaz / gist:3830636
Created October 3, 2012 23:52
JS: Jquery direct link and local backup
<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script>
@Ricardo-Diaz
Ricardo-Diaz / gist:3830639
Created October 3, 2012 23:53
JS: Google Analytics Snippet
<!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.
mathiasbynens.be/notes/async-analytics-snippet -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
@Ricardo-Diaz
Ricardo-Diaz / .htaccess
Created October 3, 2012 23:55
Server Files: .htaccess File
# Apache configuration file
# httpd.apache.org/docs/2.2/mod/quickreference.html
# Note .htaccess files are an overhead, this logic should be in your Apache config if possible
# httpd.apache.org/docs/2.2/howto/htaccess.html
# Techniques in here adapted from all over, including:
# Kroc Camen: camendesign.com/.htaccess
# perishablepress.com/press/2006/01/10/stupid-htaccess-tricks/
# Sample .htaccess file of CMS MODx: modxcms.com
@Ricardo-Diaz
Ricardo-Diaz / post_in_feed.html
Created October 5, 2012 02:56
Perch CMS: Blog Feed Template
<perch:before>
<ul class="hfeed"></perch:before>
<li class="hentry">
<h4><a href="post.php?s=<perch:blog id="postSlug" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a></h4>
</li>
<perch:after>
</ul>
@Ricardo-Diaz
Ricardo-Diaz / gist:3837805
Created October 5, 2012 02:56
Perch CMS: Php Code for Blog Feed
<?php
$opts = array(
'filter'=>'postDateTime',
'count'=>'5',
'match'=>'eqbetween',
'template'=>'blog/post_in_feed.html'
);
perch_blog_custom($opts);
?>
@Ricardo-Diaz
Ricardo-Diaz / gist:3863108
Created October 10, 2012 04:14
CSS: icon before tags
Getting Started
Step One
Get some icons and upload a few to your images folder. Between 22px and 32px square should work best, depending on your application.
Step Two
Create your html:
@Ricardo-Diaz
Ricardo-Diaz / process.php
Created October 10, 2012 04:34
PHP: Form Process
<?php
if( isset($_POST) ){
//form validation vars
$formok = true;
$errors = array();
//sumbission data
$ipaddress = $_SERVER['REMOTE_ADDR'];
$date = date('d/m/Y');
@Ricardo-Diaz
Ricardo-Diaz / gist:3890817
Created October 15, 2012 04:25
CSS: Media Queries
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@Ricardo-Diaz
Ricardo-Diaz / gist:3940706
Created October 23, 2012 18:44
CSS: Box Shadow Effects
/* Box Shadow Effects */
Directional Box Shadows
.drop-shadow.top {
box-shadow: 0 -4px 2px -2px rgba(0,0,0,0.4);
}
.drop-shadow.right {
box-shadow: 4px 0 2px -2px rgba(0,0,0,0.4);