Skip to content

Instantly share code, notes, and snippets.

View mir4a's full-sized avatar
🤞

Myroslav mir4a

🤞
View GitHub Profile
#search for bg images at stylesheets
url\(\/assets\/([a-z \/ \. _]+)\)
#replace it with image-url rails function
image-url('$1')
@mir4a
mir4a / export_groups_to_png.js
Last active February 1, 2016 17:48
Action for exporting every group items under first level of parent layer named icons. Tested on Adobe Illustrator CS5
// reference http://graphicdesign.stackexchange.com/a/26044/18833
function exportFileToPNG(dest, artBoardIndex)
{
var exportOptions = new ExportOptionsPNG24(); // or ExportOptionsPNG24
var type = ExportType.PNG24; // or ExportType.PNG24
var file = new File(dest + ".png");
exportOptions.artBoardClipping = true;
exportOptions.antiAliasing = true;
@mir4a
mir4a / vk.js
Last active December 7, 2019 14:40
Quickly remove all friend from VK
// Run from console on developers tools (chrome dev tools)
// Go to friends page from your profile and open console F12 or alt+cmd+I
// Get all links from action section, this will fetch links for remove from friends and other too.
// FIXME: add filter to show only remove from friends links
var l = document.querySelectorAll('.friends_act');
// Function link takes list of links (dom elements) as argument and iterate through each of them and set them style properties
// in my case position: fixed; top: 20px; right: 40px;
@mir4a
mir4a / cl.js
Last active August 29, 2015 14:11 — forked from azproduction/cl.js
console.log($LINE$);
// LINE = lineNumber()
@mir4a
mir4a / gist:06380fca2e839a01ad6c
Created February 19, 2015 12:37
Real hell SCSS
div#home-store-info {
@extend .hidden-xs;
@extend .col-sm-12;
@extend .col-md-12;
margin-bottom: 20px;
div.store-info-block {
background-color: rgba(255, 255, 255, 0.4);
color: #1b6a8e;
@extend .row;
@mir4a
mir4a / fs.js
Last active August 29, 2015 14:27
Skip annoying ads on fs.to
javascript:
(function (){
var iframe_wrap = document.getElementsByClassName('b-iframe-aplayer')[0],
_i = iframe_wrap.getElementsByTagName('iframe')[0],
player = _i.contentDocument.getElementById('player'),
teasers = _i.contentDocument.getElementsByClassName('b-aplayer-teasers')[0],
duration = player.duration;
teasers.style.visibility = 'hidden';
player.currentTime = duration;
@mir4a
mir4a / click_on_day_at_datepicker.rb
Created September 11, 2015 16:09
Datepicker helper for Capybara with RSpec tests
def click_on_day_at_datepicker(date)
d = Date.parse(date)
month = d.strftime('%b')
day = d.day
# XPath select Month switcher
xpath_month_switcher_selector = '//div[contains(@class, "datepicker-days") and not(contains(@style,"display:none"))]//th[contains(@class, "datepicker-switch")]'
find(:xpath, xpath_month_switcher_selector).click
# XPath select particular Month
xpath_particular_month_selector = "//div[contains(@class, \"datepicker-months\") and not(contains(@style,\"display:none\"))]//*[text() = \"#{month}\"]"
find(:xpath, xpath_particular_month_selector).click
@mir4a
mir4a / ajax_requests.rb
Created September 11, 2015 16:14
Setter/getter for some particular global var and increment on each Ajax request for Capybara tests
def set_ajax_counter(global_var)
page.execute_script <<-SCRIPT
window["#{global_var}"] = 0;
$(document).on("ajaxSend", function(){
window["#{global_var}"]++;
console.log('increment ajax counter window["#{global_var}"] = ' + window["#{global_var}"]);
});
SCRIPT
end
@mir4a
mir4a / FRSHBKS.js
Created February 4, 2016 17:15
Simple bookmarklet which is prints to console list of tasks was done from Freshbooks report (Time Sheets Detailed).
javascript:
var fr_pat = /#gh-(\S+): /g;
var fr_str = '';
$('.report tr').each(function(i,el) {
$td = $(el).find('.text_wrap').eq(3);fr_str += $td.text().replace(fr_pat, '- ') + '\n';
});
console.log(fr_str);