Skip to content

Instantly share code, notes, and snippets.

doctype html
html(lang="ru")
head
block meta
meta(charset="UTF-8")
block link
link(rel="stylesheet", href="css/styles.css")
block title
title Default title
body
@Maden-maxi
Maden-maxi / lazyRequireTask.js
Last active June 22, 2016 13:08
function for upload task
function lazyRequireTask(taskName, path, options) {
options = options || {};
options.taskName = taskName;
gulp.task(taskName, function(callback) {
var task = require(path).call(this, options);
return task(callback);
});
}
// usage
@Maden-maxi
Maden-maxi / menu.js
Created July 2, 2016 09:18
adaptive menu
//анимация иконки меню
function animateBars(bars) {
bars.classList.toggle("change");
}
$(document).ready(function(){
//адаптивное меню
$('.menu-trigger').click(function () {
$('nav ul').slideToggle(500);
});
if($(window).width() <= 1024 ){
<body oncopy="return false" onselectstart="return false" ondragstart="return false">
wget --page-requisites -r -l 10 http://site.com/
$('a[href^="#"]').on('click', function(){
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
var minusTop = 0;
switch(elementClick){
case "#services": minusTop = 90; break;
case "#portfolio": minusTop = 60; break;
case "#advantages": minusTop = 90; break;
case "#steps": minusTop = 60; break;
case "#price": minusTop = 60; break;
{
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"ignored_packages":
[
"Vintage"
],
"theme": "Material-Theme.sublime-theme",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"overlay_scroll_bars": "enabled",
"line_padding_top": 3,
@Maden-maxi
Maden-maxi / post_attachment.php
Created December 6, 2016 09:56
Getting post attachment image if thumbnail not defined
function sunset_get_attachment( $num = 1 ){
$output = '';
if( has_post_thumbnail() && $num == 1 ):
$output = wp_get_attachment_url( get_post_thumbnail_id( get_the_ID() ) );
else:
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => $num,
'post_parent' => get_the_ID()
function comments_all_func( $atts ){
extract( shortcode_atts( array(
'category' => ''
), $atts ) );
$categories = explode( ',', $atts['category'] );
$taxq = array(
#'posts_per_page' => 6,
'post_type' => 'wpm-testimonial',
/**
* @param string $str Text to find <img> src attribute value
* @param string(optional) $placeholder if <img> src attr is empty use $placeholder
* @param boolean(optional) $echo - if true display value else return value
* @return string
*/
function ecf_find_img_url($str, $echo = false, $placeholder = 'http://placehold.it/350x150' ) {
$start = stripos($str, '<img');