Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Khrustalev tokenvolt

View GitHub Profile
@tokenvolt
tokenvolt / createHierarchy.js
Created Apr 9, 2020
Create Hierarchy challange
View createHierarchy.js
const TOPIC = "topic"
const CATEGORY = "category"
const typeName = levels => (levels >= 3 ? TOPIC : CATEGORY)
const createNode = ({ perLevel, levels, remainingLevels }) => {
if (remainingLevels === 0) return { type: TOPIC, children: [] }
return {
type: typeName(levels - remainingLevels),
View vscode-settings.json
{
"window.zoomLevel": -1,
"window.title": "${activeEditorLong}${separator}${rootName}",
"workbench.iconTheme": "vscode-great-icons",
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
"emmet.syntaxProfiles": {
"javascript": "jsx"
},
"files.associations": {
@tokenvolt
tokenvolt / asyncMessage.js
Created Oct 22, 2017
Example of resetted promise
View asyncMessage.js
function asyncMessage(msg) {
let deferred
const onMessage = function (msg) {
if (deferred) {
deferred.resolve(msg)
deferred = null
}
}
View webpack.dev.config.js
// Run like this:
// cd client && webpack-dev-server --config webpack.development.config.js --hot --colors --progress --inline
var config = require("./webpack.base.config");
var webpack = require("webpack");
var path = require("path");
var autoprefixer = require('autoprefixer');
var precss = require('precss')
var autoprefixer = require('autoprefixer');
@tokenvolt
tokenvolt / redux-utils.js
Created Aug 23, 2016
Redux action types generator
View redux-utils.js
import R from 'ramda'
/*
Example
createAsyncActionType('LOGIN')
will return an object
{
@tokenvolt
tokenvolt / gist:0df491c4c144c48bae46
Created Mar 2, 2016
Patial build for ramda.js for endpoint
View gist:0df491c4c144c48bae46
./scripts/build -- src/pick.js src/equals.js src/isEmpty.js src/curry.js src/omit.js src/merge.js src/append.js > dist/ramda.custom.js
@tokenvolt
tokenvolt / endpoint.js
Created Jan 31, 2016
REST endpoint generators
View endpoint.js
import fetch from 'isomorphic-fetch'
import { camelizeKeys } from 'humps'
import R from 'ramda'
import { normalize, arrayOf } from 'normalizr'
import Path from 'path-parser'
import { encode } from 'querystring'
import pluralize from 'pluralize'
import { playlistSchema } from 'schemas'
import { assocUid, mapValues } from 'utils/helpers'
import cuid from 'cuid'
View gist:76149b7b8fffec695fb7
/home/tokenvolt/Android/Sdk/tools/emulator -avd Nexus_5_API_21_x86
/home/tokenvolt/Android/Sdk/tools/adb logcat
/home/tokenvolt/Android/Sdk/tools/adb shell
/home/tokenvolt/Android/Sdk/tools/adb devices
View subqueries.sql
SELECT * FROM
(SELECT * FROM
(SELECT id FROM users) AS users_only_ids
WHERE id > 2) AS users_only_ids_filtered
ORDER BY id;
@tokenvolt
tokenvolt / Default (Linux).sublime-mousemap
Created Oct 28, 2015
Sublime mousemap settings for Linux
View Default (Linux).sublime-mousemap
[
{
"button": "button1",
"modifiers": ["alt"],
"press_command": "drag_select",
"command": "elixir_goto_definition"
},
{
"button": "button1",
"modifiers": ["shift"],