Skip to content

Instantly share code, notes, and snippets.

View ckarnell's full-sized avatar

Cohen Karnell ckarnell

  • https://trialspark.com/
  • New York City
View GitHub Profile
@ckarnell
ckarnell / .vimrc
Created June 27, 2017 13:58
Replacing syntastic with neomake for linting
" Step 1: Install this: https://github.com/neomake/neomake
" Step 2: Put these in your .vimrc:
" Neomake settings
autocmd! BufWritePost,BufEnter * Neomake
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_scss_enabled_makers = ['scss_lint']
let g:neomake_python_enabled_makers = ['pylint', 'python']
" Step 3: Delete syntastic stuff after you've verified neovim works
@ckarnell
ckarnell / gist:1b5d329b0fbeaed0f85abc226949c5b0
Created June 30, 2017 17:56
Git shortcuts with completion support
# These go in .bashrc:
alias gpsu='git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)'
alias gco='git checkout'
alias gr='git rebase'
# These go in .git-completion.bash, at the bottom, I guess:
__git_complete gco _git_checkout
__git_complete gr _git_rebase
{
"forms": [
{
"title": "DEMOGRAPHICS",
"label": "DEMOGRAPHICS",
"name": "DEMOGRAPHICS",
"formSections": [
{
"formFields": [
{
# Fancy git log. 'gl' shows the whole log, 'gl 5' shows the last 5 commits, etc.
function gl {
if [ -z "$1" ]
then
git log --graph --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d'
else
git log --graph --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' -$1
fi
}
" Add this to your .vimrc and you will be able to use ':Ag <pattern>' to silver search from wherever you opened vim.
" You can also use 'ack' or whatever you want to use as a search tool as long as you have it installed.
if executable('ag')
set grepprg=ag\ --nogroup\ --nocolor
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
endif
" When you use ':Ag <pattern>' you can quickly look through / search each file containing the pattern and pick one to edit.
" YOU CAN ALSO DO ':cfdo <command>' TO RUN A COMMMAND ON EACH FILE IN THE SEARCH RESULT!!!
# Add these to your .bashrc for fancy git logging:
# This optionally accepts a number as an argument (e.g. `gl 10`) to show that many commits.
# `gl` by itself will show all commits like a normal `git log`.
function gl {
if [ -z "$1" ]
then
git log --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d'
else
git log --pretty=format:'%C(bold blue)%h %C(bold green)(%ar) %C(magenta)%an %Creset%s%C(bold yellow)%d' -$1
Commands are written in quotes below. u=up, r=right, d=down, and l=left.
Quick start:
Switch characters (defaults to P1): "p1" or "p2"
Move in a direction: "u" / "r" / "d" / "l"
Weak attack (A button): "a"
Medium attacks (directional): "tu", "tr", "td", "tl"
Strong attacks (C-stick directions): "cu" / "cr" / "cd" / "cl"
Jump: "j"
Special moves (directional): "bu" / "br" / "bd" / "bl"
class CustomPlugin(Plugin):
def get_class_decorator_hook(self, fullname: str) -> Optional[Callable[[ClassDefContext], None]]:
def add_attributes_to_class_def_context(cls_def_context: ClassDefContext) -> None:
# Add types for values injected by container.inject
info = cls_def_context.cls.info
if fullname == 'nook.container' and 'primary_model' in info.names:
# import pdb
# pdb.set_trace()
# # TODO: Delete
for idx in range(len(cls_def_context.reason.arg_names)):
from typing import Any, Callable, Optional, Type, TypeVar
from mypy.plugin import Plugin, FunctionContext # pylint: disable=no-name-in-module
from mypy.types import TypedDictType # pylint: disable=no-name-in-module
A = TypeVar('A')
def safe_typeddict_cast(_: Type[A], data: Any) -> A:
# This function does nothing on its own, but the types are checked in mypy_plugin.py.
# The goal is to safely convert the data argument to the type of the first argument.
# The type will only be converted if it passes type checks. If it doesn't pass,
#include "modes/PikaPalBattlefield.hpp"
#define ANALOG_STICK_MIN 48
#define ANALOG_STICK_NEUTRAL 128
#define ANALOG_STICK_MAX 208
#define ANALOG_STICK_NEUTRAL_TO_EDGE 80
PikaPalBattlefield::PikaPalBattlefield(socd::SocdType socd_type) : ControllerMode(socd_type) {
_socd_pair_count = 4;
_socd_pairs = new socd::SocdPair[_socd_pair_count]{