Skip to content

Instantly share code, notes, and snippets.

View eloytoro's full-sized avatar

Eloy Toro eloytoro

  • Datadog
  • Barcelona
View GitHub Profile
import _ from 'lodash';
import { connect } from 'react-redux';
import { runSaga } from 'redux-saga';
import { call, put } from 'redux-saga/effects';
import { defer } from './async';
import { Result, Enum } from './enums';
/**
* latestAction(saga)
* Creates an action creator that will fire the saga every time its dispatched, the action creator
def higher(text):
text = text.replace(" ", "")
count = 0
for char in text:
current_count = text.count(char)
if current_count > count:
count = current_count
last = char
return text.replace(last, "")
const builder = require('../');
const { expect } = require('chai');
describe('ice cream', () => {
it('builds an ice cream cone', () => {
const serving = builder
.steps({
scoop: ({ scoops }, flavor) => ({ scoops: scoops.concat(flavor) }),
})
.endings({
function! NERDTreeFindUpdate()
if exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1 && expand("%:p") =~ getcwd() && !exists("b:fugitive_type")
:NERDTreeFind
exec "normal! \<c-w>p"
endif
endfunction
augroup nerd
autocmd!
autocmd BufReadPost * call NERDTreeFindUpdate()
" ----------------------------------------------------------------------------
" NERDTree
" ----------------------------------------------------------------------------
function! NERDTreeFindOrToggle()
let s:empty = @% == "" || filereadable(@%) == 0 || line('$') == 1 && col('$') == 1
if s:empty || exists("b:fugitive_type") || exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) != -1
:NERDTreeToggle
else
:NERDTreeFind
endif
" ----------------------------------------------------------------------------
" DiffRev
" ----------------------------------------------------------------------------
let s:git_status_dictionary = {
\ "A": "Added",
\ "B": "Broken",
\ "C": "Copied",
\ "D": "Deleted",
\ "M": "Modified",
\ "R": "Renamed",
" ----------------------------------------------------------------------------
" HTML/JSX autoclose tag
" ----------------------------------------------------------------------------
let s:closed_tag_regexp = '<\/\(\w\|\.\)\+>'
let s:tag_name_regexp = '<\(\w\|\.\|:\)\+'
let s:tag_properties = '\s*\(\s\+[^>]\+\s*\)*'
let s:tag_regexp = s:tag_name_regexp.s:tag_properties.'[^\/]'
let s:tag_blacklist = ['TMPL_*', 'input', 'br']
let s:hl_whitelist = ['xmlTag', 'htmlTag']
function! CarriageReturn()
" ----------------------------------------------------------------------------
" HL | Find out syntax group
" ----------------------------------------------------------------------------
function! s:hl()
return map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunction
" ----------------------------------------------------------------------------
" ¯\_(ツ)_/¯
" ----------------------------------------------------------------------------
" ----------------------------------------------------------------------------
" Yank Position
" ----------------------------------------------------------------------------
function! s:YankPosition()
let @+=@%.'#L'.line('.')
let @r=@%
echo 'copied "'.@+.'"'
endfunction
nnoremap <silent> yp :call <sid>YankPosition()<CR>
const val = {}
function setProp(obj, value) {
obj.prop = value
return obj
}
console.log(val, mutate(val, 'one'))
const obj1 = { val }
const obj2 = { val }