Skip to content

Instantly share code, notes, and snippets.

FUNCTION repeat#wrap()
Called 1 time
Total time: 0.000364
Self time: 0.000364
count total (s) self (s)
1 0.000020 let preserve = (g:repeat_tick == b:changedtick)
1 0.000319 exe 'norm! '.(a:count ? a:count : '').a:command . (&foldopen =~# 'undo\|all' ? 'zv' : '')
1 0.000008 if preserve
let g:repeat_tick = b:changedtick
@qstrahl
qstrahl / .zshrc
Last active October 4, 2016 19:38
# git commands which will be masked for brevity inside git repos
git_cmds=(amend branch checkout commit diff grep log ls-files reflog remote reset stat status)
# create functions for each git command that fall back to the nongit command outside of repos
function $git_cmds () {
if git rev-parse --git-dir &>/dev/null; then
git $0 "$@"
else
command $0 "$@"
fi
import Relay from 'react-relay';
import ChangePassword from './containers/ChangePassword';
import Dashboard from './containers/Dashboard';
import NotFoundPage from './containers/NotFoundPage';
import PlanIncome from './containers/PlanIncome';
import PlanPage from './containers/PlanPage';
import PlanPayments from './containers/PlanPayments';
import PlanSummary from './containers/PlanSummary';
const ViewerQueries = {
@qstrahl
qstrahl / index.js
Last active September 24, 2016 16:01
const RightHandSide = this.props.children || <div />;
return (
<div styleName={`wrapper-${color}`}>
<PlanSummary {...props} styleName="summary" />
<div styleName="breakdown">{RightHandSide}</div>
</div>
);
const PlanSummary = ({ user, ...props }, { formatCurrency }) => {
const { name, spouse, child, monthlyPayments, incomeSources } = user;
const monthlyPayment = values(monthlyPayments).map(n => (isNumber(n) ? n : 0)).reduce((a, b) => a + b);
const income = values(incomeSources).map(n => (isNumber(n) ? n : 0)).reduce((a, b) => a + b);
static childContextTypes = {
formatCurrency: React.PropTypes.func,
};
getChildContext() {
const { context } = this;
const { intl } = context;
return !intl ? context : { ...context,
formatCurrency: (n) => intl.formatNumber(n, {
style: 'currency',
function! gotobuffer#prompt ()
let bufstring = ''
redir => bufstring
ls
redir END
let buflist = map(split(bufstring, "\n"), 'gotobuffer#parse(v:val)')
let listlen = len(buflist)
let idx = 0
let prompt = ''
for item in buflist
function! MyFoldtext ()
let s = substitute(repeat('┄', indent(v:foldstart)), '\v.$', ' ', '')
let s .= substitute(getline(v:foldstart), '\v(^\s*|\s*$)', '', 'g')
let s .= ' '
let s .= substitute(v:foldend - v:foldstart, '\v(\d)((\d{3})+\d@!)@=', '\1,', 'g') . ' lines'
let s .= ' '
let s .= substitute(getline(v:foldend), '\v(^\s*|\s*$)', '', 'g')
let s .= ' '
return s
endfunction!
@qstrahl
qstrahl / safesearch.vim
Last active September 2, 2015 18:55
safesearch.vim: start a search safely, without the risk of clobbering the last pattern
"" safesearch: start a search in vim without overwriting the last pattern
"" trivial? Yup. Useful? Ehhh maybe.
function! s:SafeSearch ()
augroup SafeSearch
autocmd CursorMoved,CursorMovedI,InsertEnter,CursorHold,CursorHoldI,CmdWinEnter,CmdWinLeave,WinEnter,WinLeave * call <SID>Teardown()
augroup END
let s:pattern = @/
return '/'
endfunction
@qstrahl
qstrahl / format-javascript-with-js-beautify.vim
Created August 27, 2015 16:25
Make gq format your javascript with js-beautify
"" This file goes in after/indent/javascript.vim
function! MyJavascriptFormatter (lnum, count)
if mode() == 'i'
return 1
elseif synIDattr(synIDtrans(synID(line('.'), col('.'), 0)), 'name') == 'Comment'
return 1
endif
let l:options = []