Skip to content

Instantly share code, notes, and snippets.

View certainlyakey's full-sized avatar

Aleksandr Beliaev certainlyakey

  • Nortal AS
  • Tallinn
View GitHub Profile
@certainlyakey
certainlyakey / functions.php
Created March 10, 2014 08:57
Wordpress - register menu placeholder
// Create menu locations
register_nav_menus(
array(
'mainmenu' => 'Место для главного меню'
,'footermenu' => 'Место для меню в подвале'
)
);
@certainlyakey
certainlyakey / functions.php
Created March 10, 2014 08:58
Wordpress - register thumbnail size
// Main thumbnail size
set_post_thumbnail_size( 80, 80, true );
//Custom post thumbnail sizes
add_image_size( 'miniposter', 96, 130, true ); //(cropped)
@certainlyakey
certainlyakey / functions.php
Created March 10, 2014 11:38
Wopdpress - remove comments from admin
function remove_menus(){
remove_menu_page( 'edit-comments.php' );//Comments
}
add_action( 'admin_menu', 'remove_menus' );
@certainlyakey
certainlyakey / library.scss
Created March 10, 2014 13:01
Hexagon-cropped image SASS mixin
//http://codepen.io/brenna/pen/hbDqL
@mixin hexagon($size: 300px, $background: url(http://placekitten.com/g/650), $shadow: 0 0 20px rgba(0,0,0,0.8), $borderWidth: 3px){
$scaleFactor: tan(30deg); /*this smushes a square into a 60deg/120deg rhombus*/
$inverseScale: 1/$scaleFactor;
$sideLength: $size/sqrt(3);
$totalHeight: $sideLength + $size;
$boxShadow: $shadow;
$scaledBorderWidth: $borderWidth/$scaleFactor;
$border: solid #{$borderWidth} #fff;
$scaledBorder: solid #{$scaledBorderWidth} #fff;
@certainlyakey
certainlyakey / library.scss
Created March 10, 2014 13:02
Triangles SASS mixin
/* ============================================================================
Triangles SASS mixin
v1.1
============================================================================ */
//Creates one triangle or two triangles (arrows) pointed to the opposite sides.
//Apply to a parent selector (for example, article, not .tags itself).
//Takes width, height, direction (top/left...)/orientation (horizontal, vertical), color, and from none up to two selectors arguments. Do not forget to put selector args in quotes if they contain dots, combinators etc.
@certainlyakey
certainlyakey / library.scss
Created March 10, 2014 13:02
Grayscale&sepia filter SASS mixin (SVG filters supported)
//This mixin is based on this code https://coderwall.com/p/mqk9ea
//It allows for a crossbrowser partial applying of both effects
//$toggle powers on and off the effect, $mode can be 'grayscale' or 'sepia'
@mixin grayscale( $toggle: "on", $mode:"grayscale", $amount: 1 ) {
$svg-type: "matrix";
$svg-value-grayscale: "0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0";
$svg-value-sepia: (0.393 + 0.607 * (1 - $amount)) + " " + (0.769 - 0.769 * (1 - $amount)) + " " + (0.189 - 0.189 * (1 - $amount)) + " 0 0 " + (0.349 - 0.349 * (1 - $amount)) + " " + (0.686 + 0.314 * (1 - $amount)) + " " + (0.168 - 0.168 * (1 - $amount)) + " 0 0 " + (0.272 - 0.272 * (1 - $amount)) + " " + (0.534 - 0.534 * (1 - $amount)) + " " + (0.131 + 0.869 * (1 - $amount)) + " 0 0 0 0 0 1 0";
$ie-alpha: alpha(#{"opacity="}round( $amount * 100 ) );
@certainlyakey
certainlyakey / library.scss
Created March 10, 2014 13:03
Slanted text highlight (marker-like) effect SASS mixin
//Adapted for non-italic 13px Arial text
@mixin slanted-highlight($bgcolor, $element: span) {
#{$element} {background:$bgcolor;}
#{$element}:before {border-bottom:15px solid $bgcolor; border-left:4px solid transparent; content:""; display:inline-block; height:0; left:-4px; top:3px; width:0; position:relative;}
#{$element}:after {border-top:15px solid $bgcolor; border-right:4px solid transparent; content:""; display:inline-block; height:0; left:4px; top:3px; width:0; position:relative;}
}
@certainlyakey
certainlyakey / custom-links.php
Last active August 29, 2015 13:57
Wordpress - show links with notes from a category
@certainlyakey
certainlyakey / aside-right.php
Created March 10, 2014 15:42
Wordpress - insert widget area
<ul class="widget-area">
<?php if ( dynamic_sidebar('aside_smaller') ) : else : endif; ?>
</ul>
@certainlyakey
certainlyakey / style.css
Created March 16, 2014 23:18
Font stacks
/* Шрифты с засечками 1 (шрифты, похожие на Times New Roman) */
font-family: "Times New Roman", Times, serif;
/* Шрифты с засечками 2 (шрифты, похожие на Georgia - aka New York Times.com) */
font-family: Cambria, Georgia, serif;
/* Шрифты с засечками 3 (шрифты, похожие на Palatino) */
font-family: Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;
/* Шрифты без засечек 1 (шрифты, похожие на Helvetica - aka Афиша) */