Skip to content

Instantly share code, notes, and snippets.

View stackdumper's full-sized avatar

Elijah A. stackdumper

View GitHub Profile
module.exports = ({ map, position, chunkSize }) => {
const [x, y, z] = position.map((n) => Number(n))
let blockHidden = true
for (let k = -1; k <= 1; k++) {
const yPos = y + k
if (yPos > 0) {
if (!(map[x] && map[x][z] && map[x][z][yPos])) {
@stackdumper
stackdumper / script.js
Created April 13, 2018 06:51
interesting task solution
const genSolution = (number) => {
const string = number.toString();
let result = '';
for (let i = string.length; i > 0; i -= 3) {
result = ((i - 3 > 0) ? ',' : '') + string.slice(i - 3 >= 0 ? i - 3 : 0, i) + result;
}
return result;
}
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
@stackdumper
stackdumper / eslintrc.yaml
Created April 15, 2018 07:01
Eslint react sort comp
react/sort-comp:
- warn
-
order:
- static-methods
- constructor
- lifecycle
- /^on.+$/
- /^handle.+$/
- getters
@stackdumper
stackdumper / index.js
Created April 29, 2018 17:31
react-coolkeys
import React, { Component } from 'react'
import Mousetrap from 'mousetrap'
const KeymapContext = React.createContext()
export const CoolKeysProvider = ({ keymap, children }) => (
<KeymapContext.Provider value={keymap}>{children}</KeymapContext.Provider>
)
import React, { Component } from 'react';
import { NavigationActions } from 'react-navigation';
import { reaction } from 'mobx';
import { inject, observer } from 'mobx-react';
const navigateWithReset = (navigation, targetRoute) => {
const resetAction = NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate({ routeName: targetRoute })],
});
{
"workbench.startupEditor": "newUntitledFile",
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"workbench.colorTheme": "City Lights",
"editor.fontSize": 18,
"editor.folding": false,
"editor.hideCursorInOverviewRuler": true,
"editor.lineHeight": 26,
@stackdumper
stackdumper / dec2hex.js
Last active May 21, 2018 07:29
dec2hex
let dec = process.argv[2];
let result = '';
const getChar = char =>
({
'10': 'A',
'11': 'B',
'12': 'C',
'13': 'D',
'14': 'E',
const hex = process.argv[2];
const getInt = char =>
({
A: '10',
B: '11',
C: '12',
D: '13',
E: '14',
F: '15'
@stackdumper
stackdumper / vscode-custom-styles.css
Last active December 21, 2019 22:41
vscode custom styles
.editor-actions, .title-actions {
display: none !important;
}