Skip to content

Instantly share code, notes, and snippets.

View CSS3 Media Queries Template
/*
* Author: http://stuffandnonsense.co.uk/blog/about/hardboiled_css3_media_queries/
*/
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
@chupzzz
chupzzz / media.styl
Created Aug 30, 2017 — forked from aalexeev239/media.styl
stylus media breakpoints and visibility classes
View media.styl
$breakpoint = {
tablet : 640px,
laptop : 1000px,
desk : 1260px,
large : 1600px
}
$media = {
mobile : "(max-width: "+unit(($breakpoint.tablet - 1), 'px')+")",
tablet : "(min-width: "+unit($breakpoint.tablet, 'px')+") and (max-width: "+unit(($breakpoint.laptop - 1), 'px')+")",
@chupzzz
chupzzz / variables.styl
Created Aug 30, 2017 — forked from shengt/variables.styl
Media queries variables for stylus
View variables.styl
// Media queries breakpoints
// --------------------------------------------------
// Extra small screen / phone
$screen-xs ?= 480px
$screen-phone ?= $screen-xs
// Small screen / tablet
$screen-sm ?= 768px
$screen-tablet ?= $screen-sm
@chupzzz
chupzzz / taxonomy_find_term_by_parent.php
Created Aug 6, 2017
Find taxonomy term child (by name) limited by parent term (Drupal 7).
View taxonomy_find_term_by_parent.php
<?php
/**
* Find taxonomy term (by name) limited by parent term.
*
* In many cases you may need to find children in exact term (parent).
* Here we do this in efficent way with precise query (not like taxonomy_get_tree()
* where all the terms loading.
*
* @param $name
* @param $parent
@chupzzz
chupzzz / taxonomy_node_count.php
Last active Jul 7, 2017
Drupal 7: Get Taxonomy node count
View taxonomy_node_count.php
<?php
/**
* @param tid
* Term ID
* @param child_count
* TRUE - Also count all nodes in child terms (if they exists) - Default
* FALSE - Count only nodes related to Term ID
* @param node_type
* Count only nodes of one type (string).
*/
@chupzzz
chupzzz / rotate_bg.css
Created Jun 28, 2017
Simple CSS rotation of background-image. Can be used on element state changes (open, clicked, hover etc.)
View rotate_bg.css
.title {
position: relative;
padding-right: 20px;
}
.title:before {
content: "";
position: absolute;
width: 30px;
height: 30px;
top: 0;
@chupzzz
chupzzz / match_path.php
Created Jun 23, 2017
Match (check) given path for pattern/mask (like in Drupal blocks system).
View match_path.php
<?php
$path = current_path();
$path_alias = drupal_lookup_path('alias', $path);
$patterns = '' . PHP_EOL . 'node/n' . PHP_EOL . 'blog/*';
if (drupal_match_path($path, $patterns) || drupal_match_path($path_alias, $patterns)) {
// Do things.
}
@chupzzz
chupzzz / array2csv.php
Created Apr 26, 2017
Convert array to CSV and return it
View array2csv.php
function array2csv($array) {
$csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+');
fputcsv($csv, $array, ';');
rewind($csv);
return stream_get_contents($csv);
}
@chupzzz
chupzzz / 0_reuse_code.js
Created Dec 5, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.