Skip to content

Instantly share code, notes, and snippets.

View tokenvolt's full-sized avatar

Alex Khrustalev tokenvolt

View GitHub Profile
@tokenvolt
tokenvolt / createHierarchy.js
Created April 9, 2020 19:43
Create Hierarchy challange
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),
{
"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 October 22, 2017 00:34
Example of resetted promise
function asyncMessage(msg) {
let deferred
const onMessage = function (msg) {
if (deferred) {
deferred.resolve(msg)
deferred = null
}
}
// 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 August 23, 2016 09:14
Redux action types generator
import R from 'ramda'
/*
Example
createAsyncActionType('LOGIN')
will return an object
{
@tokenvolt
tokenvolt / gist:0df491c4c144c48bae46
Created March 2, 2016 11:54
Patial build for ramda.js for endpoint
./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 January 31, 2016 15:29
REST endpoint generators
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'
/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
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 October 28, 2015 09:36
Sublime mousemap settings for Linux
[
{
"button": "button1",
"modifiers": ["alt"],
"press_command": "drag_select",
"command": "elixir_goto_definition"
},
{
"button": "button1",
"modifiers": ["shift"],