Skip to content

Instantly share code, notes, and snippets.

View fogrew's full-sized avatar
🚀
Open for new opportunities

Andrew Gurylev fogrew

🚀
Open for new opportunities
View GitHub Profile
@fogrew
fogrew / seeFonts.sh
Created August 14, 2017 21:57
Visualizing ImageMagick fonts
#!/bin/bash
FONTS=`convert -list FONT | grep "Font:" | sed "s/Font: //g"`
SIZEX=300
SIZEY=30
convert -size "${SIZEX}x${SIZEY}" canvas:white canvas.png
for FONT in $FONTS;
do
convert -background none -size ${SIZEX}x${SIZEY} \
-gravity center -font $FONT caption:"$FONT" font.png
composite font.png canvas.png "$FONT".png
@fogrew
fogrew / getNonTitledSVGs.js
Last active July 27, 2017 19:11
Highlight each SVG on page without title
function getSVGs() {
return $$('svg use').reduce((links, svg) => {
const image = svg.href.baseVal
const includes = links.some(obj => Object.values(obj).image)
if (!includes) {
links.push({
element: svg,
image: image
})
}
@fogrew
fogrew / youtube-playlist-total-calc.js
Created July 15, 2017 14:23
Small script for calculate total time of playlist on youtube
var total = {
hours: 0,
minutes: 0,
seconds: 0
};
document.querySelectorAll('.timestamp').forEach(time => {
let arTime = time.textContent.split(':');
let seconds = parseFloat(arTime[1]);
let minutes = parseFloat(arTime[0]);
@fogrew
fogrew / cookie.js
Last active July 2, 2017 11:13
Methods for cookie
@fogrew
fogrew / count.js
Created May 25, 2017 15:25
Подсчёт траффика из детализации Мегафона
var $ = q => document.querySelectorAll(q)
var columns = $('table td:nth-child(4)')
var filterNum = n => !isNaN(parseFloat(n)) ? parseFloat(n) : 0
var kb2mb = n => Math.round(n.toFixed(2)/1024)+' MB'
var arr = nl => Array.from(nl)
var summary = arr(columns).reduce((sum, val) => {
return sum += filterNum(val.innerText)
}, 0)
@fogrew
fogrew / !readme.md
Created March 31, 2017 16:46
ST3 sync settings

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

@fogrew
fogrew / fuck-replacer.js
Created March 6, 2017 10:57
Base of fuck-block of anime-chat.ru
function fuck(msg) {
var fuckfExcl = '0';
var ohoho = msg;
for (var n = 0; n < fuckfEx.length; n++) {
if (msg.toLowerCase().search(fuckfEx[n]) != -1 && (msg.toLowerCase().search(fuckf[0]) == -1 && msg.toLowerCase().search(fuckf[1]) == -1)) {
fuckfExcl = '1';
}
}
if (fuckfExcl == '0') {
for (var k = 0; k < fuckf.length; k++) {
@fogrew
fogrew / countAuthors.js
Last active January 25, 2017 17:32
Authors of comments in issue: sort and remove duplicates
// get all elements with authors
var $authors = document.querySelectorAll('.comment .author');
var authors = [];
$authors.forEach(item => authors.push(item.innerText));
// sorting
authors.sort();
// remove duplicates
[...new Set(authors)];
// bookmarklet
@fogrew
fogrew / gulp-sprites.js
Created November 20, 2016 13:00
Gulp task for svg symbols sprite
'use strict';
const paths = require('../config/paths');
const fs = require('fs');
const path = require('path');
const svgSprite = require('gulp-svg-sprite');
module.exports = function(gulp, bs) {
return gulp.task('svg-symbols', function() {
@fogrew
fogrew / data.js
Last active November 7, 2020 09:08
get github issues with label
let eventsList = [];
require('./getGithub').then((data) => {
for (event in data) {
eventsList.push({
title: event.title,
url: event.html_url
});
}