Skip to content

Instantly share code, notes, and snippets.

@antlis
antlis / SassMeister-input.sass
Created August 17, 2014 21:08
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
@function calc-em($target-px, $context)
@return ($target-px / $context) * 1em
.box
padding-left: calc-em(10px, 16px)
gem_group :test, :development do
gem 'irbtools', require: 'binding.repl'
gem 'looksee'
end
@antlis
antlis / social_meta.pug
Last active November 25, 2017 13:05
meta social pug mixin
mixin social
meta(name='keywords', content='')
meta(name='image', content='https://website.com/images/website_logo.png')
meta(name='original-source', content='https://website.com')
link(rel='canonical', href='https://website.com')
meta(property='og:locale', content='en_EN')
meta(property='og:type', content='website')
meta(property='og:title', content='Website title')
meta(property='og:description', content='Website description')
meta(property='og:url', content='https://website.com')
@antlis
antlis / ga.pug
Last active November 26, 2019 18:44
Google analytics pug mixin
mixin ga(id)
//- Pass your ga id, as an attribute, eg. +ga('yourid12345')
script.
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='https://www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create', !{id});ga('send','pageview');
@antlis
antlis / c9_gulpfile_webapp.js
Created November 25, 2017 13:04
Generator webapp pug + compass c9
// generated on 2017-11-14 using generator-webapp 3.0.1
const gulp = require('gulp');
const gulpLoadPlugins = require('gulp-load-plugins');
const browserSync = require('browser-sync').create();
const del = require('del');
const wiredep = require('wiredep').stream;
const runSequence = require('run-sequence');
const compass = require('compass-importer');
const $ = gulpLoadPlugins();
@antlis
antlis / browserHappyRU.pug
Created November 26, 2017 04:11
Russian browser upgrade mixin for pug
mixin browserHappy
//if lt IE 9
p.browserupgrade
Вы используете <strong>устаревший</strong> браузер.
Пожалуйста <a href="http://browsehappy.com/">обновите ваш браузер</a>
для полноценного взаимодействия с сайтом.
@antlis
antlis / tel_to_callto.js
Created November 28, 2017 15:43
tel links callto fallback
$('a[href^=\'tel:\']').each(function() {
var target = 'call-' + this.href.replace(/[^a-z0-9]*/gi, '');
var link = this;
// load in iframe to supress potential errors when protocol is not available
$('body').append('<iframe name="' + target + '" style="display: none"></iframe>');
link.target = target;
// replace tel with callto on desktop browsers for skype fallback
if (!navigator.userAgent.match(/(mobile)/gi)) {
@antlis
antlis / nativeMeta.js
Last active December 28, 2017 14:01
Bookmarklet that will show get native article properties
javascript: (function () {
var h = document.head;
length = h.querySelector("[property='native:length']").content,
bill = h.querySelector("[property='native:billable']").content,
priority = h.querySelector("[property='native:priority']").content,
lang = document.querySelector("select.content-heading__value option[value='ru']"),
alert('Length: ' + length + '\n\nBillable: ' + bill + '\n\nPriority: ' + priority + '\n\nYour Lang: ' + lang);
}());
@antlis
antlis / ffmpeg_twitch.sh
Created January 8, 2018 21:57
Twitch streaming via ffmpeg
# https://wiki.archlinux.org/index.php/Streaming_to_twitch.tv
streaming() {
INRES="1920x1080" # input resolution
OUTRES="1920x1080" # output resolution
FPS="15" # target FPS
GOP="30" # i-frame interval, should be double of FPS,
GOPMIN="15" # min i-frame interval, should be equal to fps,
THREADS="2" # max 6
CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
// https://developers.google.com/recaptcha/docs/invisible
// https://developers.google.com/recaptcha/docs/invisible#render_param
// https://github.com/thiamsantos/invisible-grecaptcha
import {
execute,
destroy
} from 'invisible-grecaptcha'
export default class GoogleInvisibleRecaptcha {