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
:root {
--var1: 0;
}
.root {
/* .root-ZxY */
}
.module .btn {
/* .module-xYz .btn-Yzx */
}
.module :global .btn {
@iegik
iegik / FONTS.md
Last active January 27, 2021 08:28
Font loading technics

Loading fonts

font-display: optional;

DEPRICATED

if (getCookie('fonts') === 1) {
 printf('')
@iegik
iegik / FAST_REQUEST.md
Last active November 9, 2017 10:11
Fast Promise

Here is example of fast implimentation with requests:

import fast, request from './';
const {log} = console;

class API {}
API.json = (...args) => 
  // @fast request
 fast(request)(...args).then(data => data.json());
@iegik
iegik / Marionette 2 v.s. 3 diff
Last active January 27, 2021 07:35
Marionette and Backbone best practices
`childEvents` -> `childViewEvents`
`LayoutView` -> `View`
`ItemView` -> `View`
`onBeforeShow` -> `onRender`
`templateHelpers` -> `templateContext`
`(this|self)\.(\w+).show\(` -> `$1\.showChildView('$2', `
@iegik
iegik / Form.js
Last active December 5, 2017 09:53
Form validation
import React, { Component } from 'react';
import { reduce } from 'lodash';
export default View => class extends Component {
state = {
values: {},
errors: {},
isSubmitted: false,
isFresh: true,
onChangeField: (field, value, validation) => {
@iegik
iegik / ddata-api.js
Last active June 11, 2018 21:47
Place Predictions Interface
const DDATA_API_KEY = 'YOUR_API_KEY';
const ddataAPI = body => {
return new Promise((response, reject) => {
let xhr = new XMLHttpRequest();
xhr.open("POST", "https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address?5");
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Authorization", `Token ${DDATA_API_KEY}`);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = () => {

Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

answer
@iegik
iegik / schema.js
Last active January 27, 2021 07:41
Generates schema of GraphQL for http://example.com/graphql
import fetch from 'node-fetch';
import jsonfile from 'jsonfile';
const GQL = (query, variables) => ({query, variables})
const request = (...args) => {
try {
return fetch(...args)
} catch (e) {
return Promise.reject({errors:[e]});
@iegik
iegik / VECTOR_GRAPHICS.md
Last active January 30, 2022 17:45
SVG sprites, tools and more
@iegik
iegik / ADB.md
Last active February 19, 2025 23:46
Android

ADB

connect via TCP/IP

adb -s <device_name> tcpip 5555

shell