Skip to content

Instantly share code, notes, and snippets.

View iegik's full-sized avatar
🏠
Working from home

Arturs Jansons iegik

🏠
Working from home
View GitHub Profile
// Works out the width of elements based
// on total number of columns and width
// number of columns being displayed.
// Values for @grid would be 12, 16 or 24
.grid-inline-block(@grid: 12, @margin: 0, @width: 100%) {
@actions: column, prefix, suffix, pull, push;
.grid-action(block){
display: inline-block;
vertical-align: top;
@iegik
iegik / USDEUR.php
Created November 22, 2016 05:52
USD and EUR from Central Bank of Russia
<?php
$url = 'http://www.cbr.ru/scripts/XML_daily.asp';
$ch = curl_init( $url );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec( $ch );
curl_close($ch);
$xml = new SimpleXMLElement($result);
@iegik
iegik / README.md
Last active January 27, 2021 07:31 — forked from edwardbeckett/idea64.exe.vmoptions
Java 8 Intellij 64 JVM Options

Optimization settings for PHPStorm

~/Library/Preferences/PhpStorm*/phpstorm.vmoptions

@iegik
iegik / popup.js
Created November 4, 2016 13:08
Expose objects to popup window
t=this.open();
t.addEventListener('DOMContentloaded',(e)=>{
console.log(this, e);
e.target.close();
});
t.dispatchEvent(new CustomEvent('DOMContentloaded'));
@iegik
iegik / SpaceInviders.html
Last active November 3, 2016 11:27
Space Inviders
<body><script>eval('!function(t,i,s,h,n,o,e,a,r){function f(){var t=this.contro\
ls,i=this.id=this.id||(1e17*Math.random()).toString(32);this.I=function(s){for(\
var h in t)s.which===t[h]&&dispatchEvent(new Event(h+i))},this.A()}function p(t\
){return function(){var i,s=this.controls,h=this.id;for(i in s)t(i+h,this[i].bi\
nd(this));t(\"keydown\",this.I)}}function l(i){this.h=this.g=0,s(this,i),this.x\
=this.g,this.y=this.h,this.path=new t(this.d),f.apply(this,arguments),this.move\
To()}function u(){l.apply(this,arguments)}function d(){clearInterval(this.m),th\
is.i()}function y(){l.apply(this,arguments)}function v(){l.apply(this,arguments\
),this.o()}function b(t){var c=i.body.appendChild(i.createElement(\"canvas\"));\
s(this,t),c.height=1.5*(c.width=170),this.a=[],this.b=c.getContext(\"2d\"),f.ap\
@iegik
iegik / example.js
Last active November 29, 2017 13:11
Quick Sort
var a = [5,3,7,1,10,-1];
quicksort.call(a);
console.log(a); // -1, 1, 3, 5, 7, 10
@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\