Skip to content

Instantly share code, notes, and snippets.

Nick Gavrilov ilearnio

  • Fanmio.com, Box.es
Block or report user

Report or block ilearnio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybindings.json
// Place your key bindings in this file to override the defaults
[
{
"key": "cmd+l",
"command": "console.log.wrap.down.prefix",
"when": "editorTextFocus"
},
{
"key": "ctrl+alt+w ctrl+alt+down",
"command": "-console.log.wrap.down.prefix",
View js.code-snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"console.log": {
"scope": "javascript,typescript",
View js-mocha.code-snippets
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"context": {
"scope": "javascript,typescript",
View updateObjectValuesRecursively.js
const typeOf = require('just-typeof')
/**
* Update object values recursively
* @param {Object} obj
* @param {Function} handler
* @returns {Object} - new object
*/
const updateObjectValuesRecursively = (obj, handler) => {
const newObj = {}
@ilearnio
ilearnio / schema-validation.js
Last active Jul 16, 2018
Simple schema validation
View schema-validation.js
/**
* Simple object validation
*/
const typeOf = require('just-typeof')
const validateEmail = require('./utils/helpers/strings/validateEmail')
const RULES = {
/**
* Type of the value
* @param {mixed} value
View gengrid.js
var mc = 12 // maximum columns
var m = 2 // margin in %
var scw = (100 - (m * (mc - 1))) / mc
var str = `
.row,
.column {
box-sizing: border-box;
}
@ilearnio
ilearnio / yieldable.js
Created Jun 14, 2016
Converst function into yieldable (JavaScript)
View yieldable.js
/**
* Converst function into yieldable
* @param {Function}
* @return {Function} yieldable callback
*/
function yieldable (func) {
return function () {
let args = [].slice.call(arguments);
let ctx = this;
return function (done) {
@ilearnio
ilearnio / sortObjectByKeys.js
Last active Jun 14, 2016
Sort object by keys (JavaScript)
View sortObjectByKeys.js
function sortObjectByKeys(obj, recursive = false) {
const keys = Object.keys(obj).sort();
let sorted_obj = {};
keys.forEach(key => {
sorted_obj[key] = obj[key];
if (recursive && isObject(sorted_obj[key])) {
sorted_obj[key] = sortObjectByKeys(sorted_obj[key]);
}
@ilearnio
ilearnio / binary-search.c
Last active May 13, 2016
Binary search realization in C (simplest and probably fastest)
View binary-search.c
#include <math.h>
#include <stdbool.h>
bool binarySearch(int value, int values[], int n)
{
// Memorize the offset of a half rather then create an array on each iteration
int offset = 0;
int divider = n;
while (divider > 0) {
divider = round((divider + 1) / 2); // round up
View Package Control.sublime-settings
{
"bootstrapped": true,
"in_process_packages":
[
],
"installed_packages":
[
"AutoBackups",
"AutoFileName",
"Babel",
You can’t perform that action at this time.