Skip to content

Instantly share code, notes, and snippets.

View fourcolors's full-sized avatar
🎉
Perkisizing

fourcolors fourcolors

🎉
Perkisizing
View GitHub Profile
@fourcolors
fourcolors / buySell.js
Created May 19, 2017 02:35
Traditional Stock Buy Sell Problem
/*
* Problem: Transaction in k
* List the days to buy and days to sell
* Complexity
* p = prices
* k = transactions
*
* O(p + k)
*/
const daysToSell = (prices, k) => {
@fourcolors
fourcolors / .babelrc
Created June 15, 2017 20:08
Example for create react native app with alias
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins":
["transform-react-jsx-source",
["module-resolver",{
"root": ["./src"],
"alias": {
"screens": "./screens"
@fourcolors
fourcolors / sort.js
Created June 21, 2017 00:51
sort problem
const sortedReference = [
'ITEM-1',
'ITEM-2',
'ITEM-3',
'ITEM-4',
'ITEM-5',
'ITEM-6',
'ITEM-7',
'ITEM-8',
'ITEM-9',
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
tab-width 2
@fourcolors
fourcolors / .spacemacs
Created November 30, 2017 08:51
latest
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
{
"name": "nectarine",
"version": "0.1.0",
"private": true,
"devDependencies": {
"babel-eslint": "^8.0.1",
"jest-expo": "^21.0.2",
"react-native-scripts": "1.5.0",
"react-test-renderer": "16.0.0-alpha.12"
},
@fourcolors
fourcolors / sync
Created December 3, 2019 08:02
VS Code Sync
sdf
@fourcolors
fourcolors / keybindings.json
Created December 4, 2019 22:06
VSCode Keyboard Shortcuts
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+h",
"command": "workbench.action.navigateLeft"
},
{
"key": "ctrl+l",
"command": "workbench.action.navigateRight"
},
@fourcolors
fourcolors / fish.config
Created December 4, 2019 23:34
My fish config
function bx
bundle exec $argv
end
alias fv "nvim (fzf)"
alias v "nvim"
alias vim "nvim"
alias gs "git status"
alias gtl "git log --graph --pretty=oneline --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"
alias g "git"
@fourcolors
fourcolors / PhoneField.svelte
Last active January 20, 2020 07:30
Svelte 9 Phone Field
<script>
const digits = Array(10).fill(null);
const focusNext = i => {
const next = digits[i + 1];
if (Boolean(next)) next.focus();
};
const focusPrevious = i => {
const next = digits[i - 1];
if (Boolean(next)) next.focus();