Skip to content

Instantly share code, notes, and snippets.

View embarq's full-sized avatar
🕶️
Working hard

Li Ihor embarq

🕶️
Working hard
View GitHub Profile
function rand(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
function placeRandom(field) {
field[rand(0, 16)] = rand(0, 100) > 50 ? 2 : 4;
}
@embarq
embarq / dd.sh
Created December 26, 2017 22:10
> diskutil list
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 251.0 GB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_CoreStorage Macintosh HD 250.0 GB disk0s2
3: Apple_Boot Recovery HD 650.0 MB disk0s3
/dev/disk1 (internal, virtual):
#: TYPE NAME SIZE IDENTIFIER
@embarq
embarq / data.json
Last active December 24, 2017 18:18
[{"category":"category","counter":0,"name":"Product name 1","cost":1999,"sku":[{"id":"string","name":"string","size":2,"cost":2,"description":"string","createdAt":"2017-12-24T18:18:17.271Z"}]},{"category":"category","counter":0,"name":"Product name 1","cost":2400,"sku":[{"id":"string","name":"string","size":2,"cost":2,"description":"string","createdAt":"2017-12-24T18:18:17.271Z"}]}]
function setNameAsync(setName) {
// how do you set a name after 2sec. pause ?
setTimeout(setName, 2000);
}
const user = {
name: 'Bill',
setName: function(name) {
this.name = name;
/*
1. find pages with 'voj-page-outlet' mension -> get html files
2. take it's controllers -> get ts files
3. find class names -> get class name
4. find navigation nodes with class names -> get files related to navigation nodes
5. append hasFullHeightContent to navigation nodes
*/
const path = require('path');
const fs = require('fs');
@embarq
embarq / calc.gs
Created November 20, 2017 11:04
This snippet evaluates different Google Spreadsheets value formats
function calc(_sheet) {
const ROW_OFFSET = 2;
const COL_OFFSET = 2;
const VALUE_COLS_COUNT = 6;
/**
* @type {Sheet}
*/
const sheet = _sheet || SpreadsheetApp.getActiveSheet();
/**
@embarq
embarq / index.html
Created November 17, 2017 00:47
LOONgJ
<div id="exercise">
<!-- 1) Start the Effect with the Button. The Effect should alternate the "highlight" or "shrink" class on each new setInterval tick (attach respective class to the div with id "effect" below) -->
<div>
<button @click="startEffect">Start Effect</button>
<div id="effect" :class="effect"></div>
</div>
<!-- 2) Create a couple of CSS classes and attach them via the array syntax -->
<div :class="classes">I got no class :(</div>
<!-- 3) Let the user enter a class (create some example classes) and attach it -->
<div>
@embarq
embarq / data.json
Created September 8, 2017 13:39
Mocked data sample
[{
"id": "ec546d97-f12e-425d-8e95-908cdf693c4b",
"first_name": "Davie",
"last_name": "Castleton",
"email": "dcastleton0@google.es",
"ip_address": "17.202.182.11"
}, {
"id": "4547b224-1d97-4bf1-b62a-74500b01d6f7",
"first_name": "Miguel",
"last_name": "Cornall",
@embarq
embarq / keybindings.json
Last active September 20, 2017 11:26
VS Code settings
[
{
"key": "ctrl+alt+down",
"command": "editor.action.moveLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+alt+up",
"command": "editor.action.moveLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
*,blockquote,body,dd,div,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,html,input,label,li,ol,p,pre,td,th,ul {
margin: 0;
padding: 0
}
table {
border-collapse: collapse;
border-spacing: 0
}