Skip to content

Instantly share code, notes, and snippets.

View victorpavlov's full-sized avatar

Victor Pavlov victorpavlov

View GitHub Profile
@victorpavlov
victorpavlov / font-smoothing.css
Last active October 2, 2019 12:21
Font Smoothing in Webkit and Firefox https://davidwalsh.name/font-smoothing
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@mixin for-size($range) {
$phone-upper-boundary: 600px;
$tablet-portrait-upper-boundary: 900px;
$tablet-landscape-upper-boundary: 1200px;
$desktop-upper-boundary: 1800px;
@if $range == phone-only {
@media (max-width: #{$phone-upper-boundary - 1}) { @content; }
} @else if $range == tablet-portrait-up {
@media (min-width: $phone-upper-boundary) { @content; }
@victorpavlov
victorpavlov / menu-main.html.twig
Created September 30, 2016 13:02 — forked from mortendk/menu-main.html.twig
svg inside a link in drupal menus
{% import _self as menus %}
{#
We call a macro which calls itself to render the full tree.
@see http://twig.sensiolabs.org/doc/tags/macro.html
#}
{{ menus.menu_links(items, attributes, 0) }}
{% macro menu_links(items, attributes, menu_level) %}
{% import _self as menus %}
@victorpavlov
victorpavlov / template.php
Created September 30, 2016 13:00 — forked from pixelwhip/template.php
Adding icons to menu links in Drupal
<?php
/**
* Custom implementation of theme_menu_link() for including icons.
*/
function cic_menu_link__icon(array $variables) {
$element = $variables['element'];
$sub_menu = '';
/* Prevent the <span> tag from being escaped */
@victorpavlov
victorpavlov / php56-inst.txt
Created August 1, 2016 10:52
PHP 5.6 for Ubuntu 16.04
add-apt-repository ppa:ondrej/php
apt update
apt install php5.6 libapache2-mod-php5.6 php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-xmlrpc
a2dismod php7.0
a2enmod php5.6
systemctl restart apache2
$(document).ready(function () {
window.displayBoxIndex = -1;
$('#cityresults').on('click', 'a', function () {
$('#city').val($(this).text());
$('#cityresults').hide('');
$('#citygeonameid').val($(this).parent().attr('data-id'));
return false;
});
var Navigate = function (diff) {
displayBoxIndex += diff;
var lastScrollTop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){
// downscroll code
} else {
// upscroll code
}
lastScrollTop = st;
});
app.filter('filterName', function () {
return function (items, argument) {
var filtered = [];
for (var i = 0; i < items.length; i++) {
var item = items[i];
// Condition to filter an array.
// Can have any code.
if (item.argument) {
filtered.push(item);
}
<?php
/**
* Implements hook_page_alter().
*/
function mytheme_page_alter(&$page) {
// Remove all the region wrappers.
foreach (element_children($page) as $key => $region) {
if (!empty($page[$region]['#theme_wrappers'])) {
$page[$region]['#theme_wrappers'] = array_diff($page[$region]['#theme_wrappers'], array('region'));