Skip to content

Instantly share code, notes, and snippets.

" for Java: makes main signature
iabbrev jmain public static void main (String[] args)
" for Java: output shortcuts
iabbrev Sout System.out.println
iabbrev Serr System.err.println
" for Java: import shortcuts
iabbrev Iawt import java.awt.*;
iabbrev Iswing import javax.swing.*;
@idbrii
idbrii / gist:3069527
Created July 8, 2012 05:22 — forked from kien/gist:1610859
Custom statusline example
" File: after/plugin/ctrlp.vim
" Description: Custom statusline example
" Make sure ctrlp is installed and loaded
if !exists('g:loaded_ctrlp') || ( exists('g:loaded_ctrlp') && !g:loaded_ctrlp )
fini
en
" ctrlp only looks for this
@idbrii
idbrii / example.sh
Created March 1, 2011 18:43
example for How to 'git remote add' and track a branch in the same filesystem
#! /bin/sh
# Script to provide answer for question:
# http://stackoverflow.com/questions/5149872/how-to-git-remote-add-and-track-a-branch-in-the-same-filesystem
echo create origin
mkdir origin
cd origin/
git init --bare
cd ..
// test case for https://vi.stackexchange.com/questions/8718/vim-switch-statement-cindent-options/8722#8722
{
switch (status)
{
case Status.OK:
return ErrorCode.OK;
case Status.Bad:
{
@idbrii
idbrii / airline.vprof
Last active January 27, 2020 21:43
profiling airline branch head
https://github.com/vim-airline/vim-airline/issues/2029
To get profile:
> gvim.exe ~/.vim/bundle/airline/autoload/airline/extensions/branch.vim
:profile start ~/airline.vprof | profile func * | Gedit HEAD
" wait for five seconds after buffer shows commit info
:quit
FUNCTION FugitiveExtractGitDir()
@idbrii
idbrii / gvim.bat
Created February 28, 2020 01:09
Example gvim.bat generated by vim's install.exe
@echo off
rem Created by idbrii based on script from vim 8.2.314
rem See also https://github.com/vim/vim/blob/1fa8d2c33d7290eda7dc2a94d4ec6a599a2d61dd/src/dosinst.c#L842-L950
rem -- Run Vim --
rem # uninstall key: vim82 #
setlocal
set VIM_EXE_DIR=C:\Users\idbrii\scoop\apps\vim-nightly\current
if exist "%VIM%\vim82\gvim.exe" set VIM_EXE_DIR=%VIM%\vim82
if exist "%VIMRUNTIME%\gvim.exe" set VIM_EXE_DIR=%VIMRUNTIME%
@idbrii
idbrii / Easing.cs
Last active July 10, 2020 19:24 — forked from ThomasFOG/Easing.cs
C# implementation of Robert Penner's easing functions
// TERMS OF USE - EASING EQUATIONS
//
// Open source under the BSD License.
//
// Copyright © 2001 Robert Penner
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
@idbrii
idbrii / main.lua
Last active July 19, 2020 01:06
Test file for chained function calls for lua syntax (from demo for flux.lua)
-- Test file for chained function calls for lua syntax
-- Source: https://love2d.org/forums/viewtopic.php?t=77904
local flux = require "flux"
local colon_out = self.kitchen
:getContents()
:getCheese()
:enjoyCheese(self
:mouth()
" An extremely rough approximation of vscode's inliner:
" https://www.youtube.com/watch?v=EenznqbW5w8
" Uses vim's popupwin to show the definition of a tag. Hijacks the arrow keys
" to let you move a cursor inside that window and jump to another tag.
"
" Public domain, CC0.
let g:tagpopper_z = 0
" Turning this off hides some bugs but then preview window is even more
" superior. Not sure why sometimes popup contents is clobbered.
@idbrii
idbrii / pid.lua
Created June 9, 2022 17:45
A pid controller (proportional–integral–derivative controller) in lua
-- Public domain/CC0
-- A pid controller (proportional–integral–derivative controller).
-- Useful to track an entity without overshooting (like a docking spaceship).
-- Could be expanded to control orientation, speed, or other values.
-- Requires tuning values:
-- tuning = {
-- gain = {
-- -- all in [0,1]