Skip to content

Instantly share code, notes, and snippets.

View zoxon's full-sized avatar

Zoxon zoxon

View GitHub Profile
/**
* Преобразует RGB-представление цвета в HEX.
* @param {Array} rgb
* @return {String}
*/
var rgb2Hex = function(rgb) {
var s = '0123456789abcdef';
return '#' + s.charAt(parseInt(rgb[0] / 16)) + s.charAt(rgb[0] % 16) + s.charAt(parseInt(rgb[1] / 16)) +
s.charAt(rgb[1] % 16) + s.charAt(parseInt(rgb[2] / 16)) + s.charAt(rgb[2] % 16);
@zoxon
zoxon / data-options.js
Created February 2, 2015 04:48
Convert data-options attribute into an object of key/value pairs
/**
* Convert data-options attribute into an object of key/value pairs
* @private
* @param {String} options Item-specific options as a data attribute string
* @returns {Object}
*/
var getDataOptions = function ( options ) {
var settings = {};
// Trim whitespace from a string
@zoxon
zoxon / email-template.html
Last active August 29, 2015 14:14
Simple email template
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ru">
<head>
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
<meta charset="utf-8">
<style type="text/css">
/*<![CDATA[*/
@media only screen and (max-width:600px) {
#wrapper {
width:100% !important;
@zoxon
zoxon / parseYoutubeUrl.php
Created March 5, 2015 04:23
Check and get youtube video id from url
/**
* Check if input string is a valid YouTube URL
* and try to extract the YouTube Video ID from it.
* @author Stephan Schmitz <eyecatchup@gmail.com>
* @param $url string The string that shall be checked.
* @return mixed Returns YouTube Video ID, or (boolean) false.
*/
function parse_yturl($url)
{
$pattern = '#^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=|/watch\?.+&v=))([\w-]{11})(?:.+)?$#x';
@zoxon
zoxon / Email safe fonts
Last active August 29, 2015 14:16
Email Safe Fonts Stocks
font-family: Arial, Helvetica, sans-serif;
font-family: "Arial Black", Gadget, sans-serif;
font-family: Georgia, serif;
font-family: "MS Sans Serif", Geneva, sans-serif;
font-family: "MS Serif", "New York", sans-serif;
font-family: Tahoma, Geneva, sans-serif;
font-family: "Times New Roman", Times, serif;
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-family: Verdana, Geneva, sans-serif;
@zoxon
zoxon / Preferences.sublime-settings
Last active December 25, 2023 06:33
Sublime Text User Preferences
{
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/User/Monokai Light (SL).tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "windows",
"dictionary": "Packages/Language - Russian/ru_RU.dic",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
body {
font-size: 16px;
line-height: 29px;
max-width: 718px;
margin: 0 auto;
}
h1 {
font-size: 68px;
line-height: 87px;
body {
font-size: 1em;
line-height: 1.8125em;
max-width: 718px;
margin: 0 auto;
}
h1 {
font-size: 4.25em;
line-height: 1.279411764em;
base-font-size: 16px;
base-line-height: 29px;
measure: 718px;
h1-font-size: 68px;
h1-line: 29px;
h1-lines: 3;
h1-line-height: h1-line * h1-lines;
h1-margin-top: 2 * h1-line;
h1-margin-bottom: 1 * h1-line;
base-font-size: 1em;
base-line-height: 1.8125em;
measure: 718px;
h1-font-size: 4.25em;
h1-line: 0.426470588em;
h1-lines: 3;
h1-line-height: h1-line * h1-lines;
h1-margin-top: 2 * h1-line;
h1-margin-bottom: 1 * h1-line;