Skip to content

Instantly share code, notes, and snippets.

Avatar

Akshay Hegde ajh17

View GitHub Profile
View itermWrite.js
iterm = Application("iTerm")
iterm.activate()
session = iterm.currentWindow.currentSession
iterm.write(session, {text: "ls -l"})
View xterm_colors.py
#!/usr/bin/env python3
# Display the colors available in a terminal.
for color in range(0, 256):
for i in range(0, 1):
print("\033[38;5;%sm%03s\033[m" % (str(color), str(color)), end=' ')
if color % 10 == 0:
print()
View .vimrc
function ResizeToLine()
let nr = line("$")
execute "normal! z" . nr . "\<CR>"
endfunction
autocmd BufWinEnter * if &previewwindow | setlocal wrap | call ResizeToLine() | endif
View .vimrc
syntax on
filetype plugin indent on
colorscheme desert
highlight Comment ctermfg=white
View FunctionKeySwitch.scpt
SystemPreferences = Application("System Preferences");
SystemPreferences.activate();
app = Application.currentApplication();
app.includeStandardAdditions = true;
keyboard = SystemPreferences.panes.byId("com.apple.preference.keyboard");
keyboard.reveal();
SystemEvents = Application("System Events");
View error_handling.swift
enum VendingMachineError: ErrorType {
case OutOfStock
case InvalidSelection
case InsufficientFunds(required: Double)
}
struct Item {
var price: Double
var count: Int
}
View python.vim
" Compiler
setlocal makeprg=python\ %
setlocal errorformat=%A\ \ File\ \"%f\"\\\,\ line\ %l\\\,%m,
\%C\ \ \ \ %.%#,
\%+Z%.%#Error\:\ %.%#,
\%A\ \ File\ \"%f\"\\\,\ line\ %l,
\%+C\ \ %.%#,
\%-C%p^,
\%Z%m,
\%-G%.%#
View ThePowerOfVimEp1.md

The Power of Vim

Today's episode: Compile/build/error check workflow. The Vim Way™

Introduction

The number one plugin that everyone and their relatives installs, without a second thought, if they want to check for errors in their script/language of choice, is syntastic. In my opinion, syntastic is a completely useless plugin. "HUH WTF?! How dare you insult my favorite plugin?!" Yes, that's right. I said

@ajh17
ajh17 / buffer.vim
Last active Aug 29, 2015
buffer.vim
View buffer.vim
" Opens the buffer with the specified arrangement. For buffer#alternate()
function! s:buffer_open(filename, edit_command)
if filereadable(a:filename) || bufexists(a:filename)
execute bufwinnr(a:filename) == -1 ? a:edit_command ." ". a:filename : "sbuffer " . a:filename
return 1
endif
return 0
endfunction
" A dead simple header/source alternator.
View .vimrc
autocmd InsertEnter * set norelativenumber
autocmd InsertLeave * set relativenumber
You can’t perform that action at this time.