Skip to content

Instantly share code, notes, and snippets.

Avatar

Wil Thomason wbthomason

View GitHub Profile
@wbthomason
wbthomason / gen_vimdoc.py
Created Jul 6, 2020
Docs generation files for lsp-status.nvim (modified from core Neovim files)
View gen_vimdoc.py
#!/usr/bin/env python3
"""Generates Nvim :help docs from C/Lua docstrings, using Doxygen.
Flow:
main
extract_from_xml
fmt_node_as_vimhelp \
para_as_map } recursive
update_params_map /
render_node
@wbthomason
wbthomason / PKGBUILD
Last active Apr 30, 2020
Working lua-language-server-git PKGBUILD
View PKGBUILD
# Contributor: Mohammad AlSaleh <CE.Mohammad.AlSaleh at gmail dot com>
# Updated by: Wil Thomason <wbthomason@cs.cornell.edu>
_pkgname="lua-language-server"
pkgname="$_pkgname-git"
pkgver=r2372.ad3baf56
pkgrel=1
license=('MIT')
pkgdesc='Lua Language Server coded by Lua'
url='https://github.com/sumneko/lua-language-server'
@wbthomason
wbthomason / help.vim
Last active May 25, 2021
Neovim: Open help in a floating window
View help.vim
scriptencoding utf-8
" This function originates from https://www.reddit.com/r/neovim/comments/eq1xpt/how_open_help_in_floating_windows/; it isn't mine
function! CreateCenteredFloatingWindow() abort
let width = min([&columns - 4, max([80, &columns - 20])])
let height = min([&lines - 4, max([20, &lines - 10])])
let top = ((&lines - height) / 2) - 1
let left = (&columns - width) / 2
let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'}
@wbthomason
wbthomason / minrc.vim
Created Sep 20, 2018
Minimum vimrc for LCN issue
View minrc.vim
call plug#begin('~/.local/share/nvim/plugs')
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
call plug#end()
" Always draw sign column. Prevent buffer moving when adding/deleting sign.
View keybase.md

Keybase proof

I hereby claim:

  • I am wbthomason on github.
  • I am wbthomason (https://keybase.io/wbthomason) on keybase.
  • I have a public key ASBXIldLEwPq1L_TU1NDUJX695XwcHOjMI4viUgp8CYlAAo

To claim this, I am signing this object:

@wbthomason
wbthomason / UVa: CS Courses and Programming Languages.md
Last active May 31, 2020
UVa: CS Courses and Programming Languages
View UVa: CS Courses and Programming Languages.md

This is only my personal opinion, and other TAs probably will differ/should also post their opinions.

Java and C++ are really very similar. Java is more strictly object oriented than C++, and C++ lets the programmer have more low-level control (or rope with which to hang themselves, depending on how you look at it), but the paradigms they enforce are largely the same. So, when considering a new language to learn, we really have to consider what we'll get out of it - what about the language makes it worth learning. There are a few factors here. First, as the student answers have mentioned, the practicality of a language is important. If knowing a language might be necessary to get you a good job or to allow you to contribute meaningfully to a large open-source project, it might be a good idea to learn it. Second, you also need to look at how the language can help you in a larger sense. Does it use a unique paradigm, or one you haven't encountered before? Can it introduce you to new ways of thinking about and

@wbthomason
wbthomason / Fixed Signals
Created Feb 7, 2014
A fixed version of some example Rust code showing simple signal handling.
View Fixed Signals
use std::io::signal::{Listener, Interrupt};
fn main() {
let mut listener = Listener::new();
listener.register(Interrupt);
let listener = listener;
do spawn {
loop {
match listener.port.recv() {
@wbthomason
wbthomason / gist:6705396
Created Sep 25, 2013
A partial module for internal shell functions.
View gist:6705396
use std::{os, path, str};
mod internal {
pub fn changedir(pathstr: &str) {
let path = Path(pathstr);
if os::path_exists(path) && os::path_is_dir(path) && os::change_dir(path){
println(pathstr);
}
else {
println(fmt!("Error: %s is not a valid directory", pathstr));
println(fmt!("Current working directory is: %s", str::str(os::getcwd())));