Skip to content

Instantly share code, notes, and snippets.

View ivanblagdan's full-sized avatar

Ivan Blagdan ivanblagdan

View GitHub Profile
@ivanblagdan
ivanblagdan / getComponents.ts
Last active November 28, 2024 09:32
Async loading of all Figma pages
export async function getComponents(): Promise<IHandoffComponentNode[]> {
const cache = ComponentsCache.getInstance();
if (!cache.hasInitialized) {
const components: IHandoffComponentNode[] = [];
const totalSteps = figma.root.children.length;
let currentStep = 0;
for (const page of figma.root.children) {
currentStep++;
@ivanblagdan
ivanblagdan / bus.ts
Created November 27, 2024 08:35
Utilities for Figma cross process communication with type safety.
import config from '../config';
import { setDebug } from '../utilities';
const debug = setDebug('bus');
export type FigmaMessage<T extends object = any> = {
type: string,
payload: T
}
export type Handler<M extends FigmaMessage = FigmaMessage> = ((payload: M["payload"]) => void);
@ivanblagdan
ivanblagdan / website.gatling.ts
Last active July 12, 2024 07:52
Starting point for testing caching infra with gatling.
import {
simulation,
scenario,
exec,
csv,
pause,
css,
feed,
repeat,
tryMax,
@ivanblagdan
ivanblagdan / import-huge-sql-dumps
Created March 26, 2015 16:18
A way to manually import huge SQL dumps via the command line.
mysql -u root -p
set global net_buffer_length=1000000; --Set network buffer length to a large byte number
set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number
SET foreign_key_checks = 0; --Disable foreign key checking to avoid delays,errors and unwanted behaviour
source file.sql --Import your sql dump file
@ivanblagdan
ivanblagdan / gist:eb029da851c973a59afd
Created February 10, 2015 12:13
SQL to get a sorted list of MySQL table sizes.
SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
ORDER BY (data_length + index_length) DESC;
@ivanblagdan
ivanblagdan / alias.sh
Created November 14, 2014 17:00
Git command to show a brief overview of changes for the last 7 days
git log --pretty=format:"[%cr] %ce: %s - %h" --name-status --since=1.weeks
@ivanblagdan
ivanblagdan / digup.sh
Created October 16, 2014 11:18
digup.sh
#!/bin/bash
# Lookup multiple zones with dig. Ex cat zones.txt | ./digup.sh
while read zone;
do
echo $zone;
dig $zone +short;
printf "\n";
done
@ivanblagdan
ivanblagdan / Preferences.sublime-settings
Created October 15, 2014 08:31
Preferences.sublime-settings
{
// Display file encoding in the status bar
"show_encoding": true,
"show_line_endings": true,
"auto_complete_commit_on_tab": true,
"caret_style": "smooth",
"color_scheme": "Packages/Monokai Extended/Monokai Extended.tmTheme",
"enable_telemetry": false,
"font_face": "Inconsolatazi4",
"font_size": 23,
@ivanblagdan
ivanblagdan / gist:910b4d62cfe217fde6e1
Last active August 29, 2015 14:07
Remove WordPress limit login attempts via sql.
UPDATE `wp_options` SET `option_value` = 'a:0:{}' WHERE `wp_options`.`option_name` LIKE 'limit_login_lockouts';
@ivanblagdan
ivanblagdan / httpd-vhosts.conf
Created September 28, 2014 20:12
server alias httpd config
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName local.dev
ServerAlias *.dev
DocumentRoot /Users/ivan/Sites