Skip to content

Instantly share code, notes, and snippets.

View mir4a's full-sized avatar
🤞

Myroslav mir4a

🤞
View GitHub Profile
@mir4a
mir4a / cl.js
Last active August 29, 2015 14:11 — forked from azproduction/cl.js
console.log($LINE$);
// LINE = lineNumber()
@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 / 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;
#search for bg images at stylesheets
url\(\/assets\/([a-z \/ \. _]+)\)
#replace it with image-url rails function
image-url('$1')
@mir4a
mir4a / airplane colours
Created December 24, 2013 16:43
What if airplanes got their own hex-colours by their models? Here is sample colour vars for sass lang
$boeing_787: #787;
$boeing_777: #777;
$boeing_767: #767;
$boeing_747: #747;
$boeing_737: #737;
$airbus_320: #320;
$airbus_330: #330;
$airbus_340: #340;
$airbus_350: #350;
@mir4a
mir4a / gist:6970611
Created October 14, 2013 04:08
Publish all draft courses
UPDATE `wp_posts`
SET `wp_posts`.`post_status` = 'publish'
WHERE `wp_posts`.`post_type` = 'course'
@mir4a
mir4a / gist:6970581
Created October 14, 2013 04:05
Insert new relation for lessons to join them with courses
INSERT INTO `wp_postmeta` (`post_id`,`meta_key`,`meta_value`)
SELECT ID,'_lesson_course',`mmm_term_id`
FROM `wp_posts` WHERE `post_type` = 'lesson'
@mir4a
mir4a / gist:6970485
Created October 14, 2013 03:55
Update custom field mmm_term_id for lesson posts type that has category taxonomy
UPDATE `wp_posts`, `wp_term_relationships`
SET `wp_posts`.`mmm_term_id` = `wp_term_relationships`.`term_taxonomy_id`
WHERE `wp_posts`.`ID` = `wp_term_relationships`.`object_id` AND `wp_posts`.`post_type` = 'lesson'
@mir4a
mir4a / gist:6970102
Created October 14, 2013 03:10
Create new posts using terms as reference
INSERT INTO wp_posts (post_author,post_date,post_date_gmt,post_modified,post_modified_gmt,post_content,post_title,post_status,post_name,post_type,mmm_term_id)
SELECT '1',now(),now(),now(),now(),'db_flow',name,'draft',slug,'course',term_id
FROM wp_terms