Skip to content

Instantly share code, notes, and snippets.

View neocreo's full-sized avatar

Daniel Hansson neocreo

View GitHub Profile
@neocreo
neocreo / gist:02aed67fdce84339a4a5
Last active August 29, 2015 14:19
Center anything vertically AND horisontally in CSS
.parent-element {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
}
.element {
position: relative;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
@neocreo
neocreo / SEO Rewrite
Created January 16, 2015 10:45
SEO Rewrite for IIS webconfig
<rewrite>
<rules>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
@neocreo
neocreo / jQuery: Find taxanomy
Created June 4, 2013 07:24
jQuery: Find taxanomy
/*works only for separate submenu*/
/*var subnavID = $('.nav_sub ul').attr('id');
switch ( subnavID ){
case 'activity-cats':
$('nav li a[href$="/activity"]').parent('li').addClass('current-page-ancestor');
break;
case 'place-cats':
$('nav li a[href$="/place"]').parent('li').addClass('current-page-ancestor');
break;
@neocreo
neocreo / custom-post-type-sorting.php
Created March 14, 2013 16:15
WP: Custom Post Type Sorting
//Let's add sortability and special kolumns
// Change the columns for the edit CPT screen
function change_columns( $cols ) {
$cols = array(
'cb' => '<input type="checkbox" />',
'order' => __( 'Order', 'bonestheme' ),
'title' => __( 'Title', 'bonestheme' ),
'date' => __( 'Date', 'bonestheme' ),
'author' => __( 'Author', 'bonestheme' ),
// 'url' => __( 'URL', 'trans' ),
@neocreo
neocreo / part-list-latest.php
Created March 6, 2013 10:00
WP: list latest from custom post types
<?php //list 3 latest of all content ?>
<aside id="list_latest">
<?php //Activities ?>
<h2><?php _e( 'Latest Activities', 'bonestheme' ); ?></h2>
<?php $posts = new WP_Query(array(
'post_type' => 'neo_activities',
// 'category_name' => 'arbetsprover',
'posts_per_page' => 3
)); ?>
<ul class="image-list vertical">
@neocreo
neocreo / gist:5054548
Created February 28, 2013 05:54
HTML: favicon-link
<link rel="shortcut icon" type="image/x-icon" href="//static.getmyo.com/img/favicon.ico" />
<link rel="apple-touch-icon" href="//static.getmyo.com/img/apple-touch-icon.png" />
<link rel="apple-touch-icon-precomposed" href="//static.getmyo.com/img/apple-touch-icon.png" />
<link rel="apple-touch-icon-precomposed" href="//static.getmyo.com/img/apple-touch-icon-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="//static.getmyo.com/img/apple-touch-icon-57x57-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="//static.getmyo.com/img/apple-touch-icon-72x72-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="//static.getmyo.com/img/apple-touch-icon-114x114-precomposed.png" />
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="//static.getmyo.com/img/apple-touch-icon-144x144-precomposed.png" />
@neocreo
neocreo / box-shadow
Created February 27, 2013 11:54
CSS: box-shadow
-moz-box-shadow: ${1:inset} ${2:horisontal} ${3:vertical} ${4:blur} ${5:spread} ${6:color};
-webkit-box-shadow: ${1} ${2} ${3} ${4} ${5} ${6};
box-shadow: ${1} ${2} ${3} ${4} ${5} ${6};
/*Inner elements should not cover inner shadows*/
/*Chrome renders inset shadows incorrectly with border-radius*/
@neocreo
neocreo / gradient vertical
Created February 27, 2013 11:53
CSS: gradient vertical
background-image: -moz-linear-gradient(top, ${1:#ffffff}, ${2:#000000});
background-image: -ms-linear-gradient(top, ${1}, ${2});
background-image: -o-linear-gradient(top, ${1}, ${2});
background-image: -webkit-gradient(linear, center top, center bottom, from(${1}), to(${2}));
background-image: -webkit-linear-gradient(top, ${1}, ${2});
background-image: linear-gradient(top, ${1}, ${2});
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
/*Use "background-clip: padding-box" when using rounded corners to avoid the gradient bleeding through the corners*/
@neocreo
neocreo / opacity
Created February 27, 2013 11:53
CSS: opacity cross browser
/*--IE9 WILL PLACE THE FILTER ON TOP OF THE ROUNDED CORNERS--*/
opacity: ${1:0.5};
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity = ${2:80});
/*-ms-filter must come before filter*/
filter: alpha(opacity = ${2:80});
@neocreo
neocreo / text-shadow
Created February 27, 2013 11:52
CSS: text-shadow
<snippet>
<content><![CDATA[
text-shadow: ${1:2px} ${2:2px} ${3:5px} ${4:#000000} ;
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>text</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.css</scope>