Skip to content

Instantly share code, notes, and snippets.

@x35a
x35a / glob.css
Last active September 29, 2020 17:01
some global styles, npm i gist:414885bba237f5227be9ee34ddf49337
/* reset styles for some elements */
.inputrst {
display: inline-block;
position: relative;
margin: 0;
padding: 0;
border: none;
background-color: transparent;
font: inherit;
}
total=0, document.querySelectorAll('.ellipsis.hours_played').forEach( node => node.innerHTML.match(/\d+[.,]?\d+/) ? total += parseFloat( node.innerHTML.match(/\d+[.,]?\d+/)[0] ) : ''), console.log(total)
@x35a
x35a / addMap.js
Created June 24, 2017 15:24
Project map
// npm run add map
// gulp addmap
function addMap(cb){
var files = fs.readdirSync('./build');
var links = 'ul.project__map\n';
var path = './dev/components/map/_map.jade'
for(var i in files) {
if( files[i].split('.').pop() == 'html'){
@x35a
x35a / listenyoutube.js
Last active October 28, 2017 21:35
Get Youtube Audio Links
formats_str = ytplayer.config.args.adaptive_fmts || console.warn('No formats string');
links_arr = formats_str.match(/http?s[^&|,]+/g);
links_arr.forEach(function(item, i, arr) {
item = decodeURIComponent(item);
// extract webm
if (/audio.+webm/.test(item) && /signature/.test(item)) console.info('webm', item);
// extract mp4
if (/audio.+mp4/.test(item) && /signature/.test(item)) console.info('mp4', item);
if (/audio.+mp4/.test(item) && /signature/.test(item) && /ratebypass=yes/.test(item)) console.info('mp4', 'ratebypass=yes', item);
else if (/audio.+mp4/.test(item) && /signature/.test(item)) {
@x35a
x35a / scaleFontSize.js
Last active April 26, 2019 21:17
jq plugin decrease font size on text ovrfl
/*
works with JQ
usage
<p class="targetElement">Text to scale</p>
$('.targetElement').scaleFontSize({minFontsize: 12});
minFontsize минимальное размер шрифта для уменьшения, default 16px.
Определяется переполнение по ширине и высоте.
Определение переполнения по высоте работает если элементу задан height.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at