Skip to content

Instantly share code, notes, and snippets.

View griiettner's full-sized avatar

Paulo Griiettner griiettner

View GitHub Profile
ul.breadcrumbs li {
display:inline;
margin-right:20px;
}
ul.breadcrumbs li:after {
content:" ";
display:block;
width:1.45em;
height:1.45em;
@griiettner
griiettner / gist:3981956
Created October 30, 2012 18:10
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@griiettner
griiettner / .htaccess to redirect no www to www
Created July 12, 2013 01:02
.htaccess to redirect no www to www
# Redirect non-www urls to www
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]
@griiettner
griiettner / Redirect www urls to non-www
Created July 12, 2013 01:03
Redirect www urls to non-www
# Redirect www urls to non-www
RewriteCond %{HTTP_HOST} ^www\.yoursite\.com [NC]
RewriteRule (.*) http://yoursite.com/$1 [R=301,L]
<?php
function clean($string) {
$string = str_replace(" ", "-", $string); // Replaces all spaces with hyphens.
$string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
return preg_replace('/-+/', '_', $string); // Replaces multiple hyphens with single one.
}
<?php
//Example : http://localhost/index.php?option=com_hello&view=item&task=add_tag&tags=1400,1783,1770,9
$data =JRequest::get( 'request' );
print_r($data);
?>
//Output :
//Array ( [option] => com_hello [view] => item [task] => add_tags [tags] => 1400,1783,1770,9)
@griiettner
griiettner / Bootstrap Smooth Scroll to Anchor
Last active November 1, 2017 14:23
Bootstrap Smooth Scroll to Anchor
!function ($) {
$(function(){
$('#home, #me, #footer').carousel({});
var $root = $('html, body');
$('a').click(function() {
var href = $.attr(this, 'href');
$root.animate({
scrollTop: $(href).offset().top
/* To target IE 6 and 7 */
@media screen\9 {
body { background: red; }
}
/* To target IE 6, 7 and 8 */
@media \0screen\,screen\9 {
body { background: green; }
}
@griiettner
griiettner / Clear Fix hack
Last active November 1, 2017 14:25
Hack to clear fix container
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}