Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🧾
Looking for work

Arturs Jansons iegik

🧾
Looking for work
View GitHub Profile
@iegik
iegik / example.js
Last active October 30, 2016 19:12
SVG path data to array of objects
var d = 'M100,35c0-13-11-25-25-25s-25,12-25,18c0-5-11-18-25-18s-25,11-25,25c0,20,36,49,50,62,14-14,50-43,50-62z';
var pd = new PathData();
pd.fromString(d);
pd.scale(2)
pd.toString()
@iegik
iegik / eva.js
Last active March 28, 2018 08:16
e=eval(
s="((t,c,d,...x)=>([\
...x.map(x=>new x[c])\
,t,c,d,s\
],'No code no bugs'))(\
this,\
'constructor',\
'document',\
!1,\
0,\
@iegik
iegik / APIService
Created October 20, 2016 13:33
Cart API
;window.APIService = (function(_){
function ajax(headers, url, method, data, onsuccess, onerror) {
var request = new XMLHttpRequest();
request.open(method, url, true);
_.forEach(headers, function(v, k){
request.setRequestHeader(k, v);
});
request.onsuccess = onsuccess || function(){};
request.onerror = onerror || function(){};
request.onload = function() {
@iegik
iegik / Makefile
Created October 20, 2016 07:09
Deployment with make
DIR_STATIC = app_static
DIR_TDP = tdp.ru/v02
DIR_CART = cart-module
# Help
# https://gist.github.com/prwhite/8168133
help: ## Show this help.
@echo "\
Release workflow\n\
1. Build in local branch or milestone\n\
@iegik
iegik / fix-permissions.sh
Last active January 26, 2021 21:41
Bash scripts
#!/bin/bash
# Fix permissions
sudo chown $USER:$GROUP -R ~/.npm/$1 ~/.bower_components/$1 ~/.node_modules/$1 bower_components/$1 node_modules/$1 build vendor
@iegik
iegik / README.md
Last active December 8, 2023 09:02

Date/Time

const date = new Date(Date.UTC(2020, 11, 20, 3, 23, 16, 738));
// Results below assume UTC timezone - your results may vary

// Specify default date formatting for language (locale)
console.log(new Intl.DateTimeFormat('en-US').format(date));
// expected output: "12/20/2020"
 
@iegik
iegik / dict.json
Last active October 26, 2021 17:02
Plural forms
{
"ru": {
"day": "день",
"%s days": ["%s день", "%s дня", "%s дней"]
}
}
@iegik
iegik / PROXY.md
Last active October 28, 2023 16:18
- Toggle proxy switch on/off on Gnome

Logging proxy

brew install mitmproxy
mitmdump -p 9000 -P https://my.server.net -w traffic.log
@iegik
iegik / correct-screen-resolution-pantheon-greeter
Created July 14, 2016 10:43
Pantheon-greeter login screen has incorrect resolution on external monitor
#!/bin/bash
# /usr/local/bin/correct-screen-resolution-pantheon-greeter
# http://elementaryos.stackexchange.com/questions/2181/pantheon-greeter-login-screen-has-incorrect-resolution-on-external-monitor
primary=eDP1
secondary=HDMI1
secondary_resolution=1920x1080
LG="$(xrandr -q | grep $secondary' connected' | awk '{ print $1 }')"
if [ "$LG" = $secondary ]; then
xrandr --output $primary --off