Skip to content

Instantly share code, notes, and snippets.

View tommcdo's full-sized avatar

Tom McDonald tommcdo

  • Windsor, ON, Canada
View GitHub Profile
@paquettg
paquettg / simple.php
Last active January 4, 2016 19:49
Sample phpunit test
<?php
// set up the mock
class testUser extends PHPUnit_Test_Case {
public function testUserCreate()
{
$user = Mockery::mock('models_user');
$user->shouldReceive('select')
->once()
->with($id)
@qstrahl
qstrahl / minimal-autocomplete.vim
Last active February 24, 2024 06:43
Super lightweight autocomplete using vim's built-in <C-n> completion
set cot=menu,menuone
ino <BS> <BS><C-r>=getline('.')[col('.')-3:col('.')-2]=~#'\k\k'?!pumvisible()?"\<lt>C-n>\<lt>C-p>":'':pumvisible()?"\<lt>C-y>":''<CR>
ino <CR> <C-r>=pumvisible()?"\<lt>C-y>":""<CR><CR>
ino <Tab> <C-r>=pumvisible()?"\<lt>C-n>":"\<lt>Tab>"<CR>
ino <S-Tab> <C-r>=pumvisible()?"\<lt>C-p>":"\<lt>S-Tab>"<CR>
augroup MyAutoComplete
au!
au InsertCharPre * if
@qstrahl
qstrahl / minimal-status-and-tab-lines.vim
Last active December 30, 2015 03:49
Cool statusline and tabline settings with fugitive support
function! MyTabLine()
let s = ''
let s .= '%#TabLine#'
let s .= '%<'
let s .= '%(%{fnamemodify(getcwd(), ":~")} %)'
if (exists('*fugitive#buffer'))
let s .= '%(⌥ %{exists("b:git_dir")?fugitive#head(7):""} %)'
endif
let s .= '%='
@qstrahl
qstrahl / custom-wincmd-equals.vim
Last active December 17, 2015 10:28
Overload of Vim's default `<C-W>=` normal command that sets the preview window's height to `&previewheight`
function! s:CustomWincmdEquals(visual)
try
let w = winnr()
wincmd P
exe &previewheight.'wincmd _'
exe w.'wincmd w'
catch /^E441:/
continue
finally
return "\<C-W>=" . (a:visual ? 'gv' : '')