Skip to content

Instantly share code, notes, and snippets.

// Store the meta element
var viewport_meta = document.getElementById('viewport-meta');
// Define our viewport meta values
var viewports = {
default: viewport_meta.getAttribute('content'),
landscape: 'width=640'
};
// Change the viewport value based on screen.width
ymaps.ready(init); // когда апи готово, инициализируемя карту
var customMap; // объявим переменную для карты
function init () { // функция инициализации
customMap = new ymaps.Map("contactsMap", { // создадим карту выведем ее в див с id="customMap"
center: [56.8585970678523,35.919971999999994], // центра карты
behaviors: ['default', 'scrollZoom'], // скроллинг колесом
zoom: 18, // масштаб карты
controls: ["zoomControl", "fullscreenControl"] // элементы управления
});
@trixter5
trixter5 / script
Last active November 30, 2017 08:40
simple tabs jade+jquery
$('.tabber-menu a').on('click', function(e) {
e.preventDefault();
var tab = $($(this).attr('href'));
$(this).addClass('active');
$(this).siblings().removeClass('active');
$('.tabber-item').removeClass('active');
tab.addClass('active')();
});
<!-- From this Fiddle: http://jsfiddle.net/HDakN/ -->
<input type="text" id="phone" />
<p> 1) Use the jQuery Browser Plugin v0.0.6
</p>
<p> 2) Use the Masked Input plugin for jQuery
</p>
<p> 3) Write this jQuery:
@trixter5
trixter5 / !readme.md
Last active May 19, 2018 18:55
ST3 sync settings

Синхронизация настроек Sublime Text 3

@trixter5
trixter5 / !readme.md
Last active June 19, 2018 10:23
ST3 sync settings

Синхронизация настроек Sublime Text 3

@trixter5
trixter5 / thumbnail-preview-demo.html
Created June 29, 2018 14:03 — forked from kellishaver/thumbnail-preview-demo.html
Demo of how to display cropped thumbnail previews for file input boxes.
<!DOCTYPE html>
<html>
<head>
<title>Image Preview</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<style type="text/css">
* {
box-sizing: border-box;
position: relative;
-moz-box-sizing: border-box;
@trixter5
trixter5 / express-server-side-rendering.md
Created July 27, 2019 09:00 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
<?php
/**
* Get Google Page Speed Screenshot
*
* Uses Google's Page Speed API to generate a screenshot of a website.
* Returns the image as a base64 jpeg image tag
*
* Usage Example:
* echo getGooglePageSpeedScreenshot("http://ghost.org", 'class="thumbnail"');
*