Skip to content

Instantly share code, notes, and snippets.

View ChrisPenner's full-sized avatar
:bowtie:
Happily Hacking

Chris Penner ChrisPenner

:bowtie:
Happily Hacking
View GitHub Profile
@sjl
sjl / next_motion_mapping.vim
Created August 25, 2011 19:43 — forked from AndrewRadev/LICENSE
Execute a vim motion on the "next" text object
" Motion for "next/last object". For example, "din(" would go to the next "()" pair
" and delete its contents.
onoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr>
xnoremap an :<c-u>call <SID>NextTextObject('a', 'f')<cr>
onoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr>
xnoremap in :<c-u>call <SID>NextTextObject('i', 'f')<cr>
onoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr>
xnoremap al :<c-u>call <SID>NextTextObject('a', 'F')<cr>
@hrldcpr
hrldcpr / tree.md
Last active May 1, 2024 00:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@sjl
sjl / nextlast.vim
Created September 21, 2012 15:36
next/last text objects
" Next and Last {{{
" Motion for "next/last object". "Last" here means "previous", not "final".
" Unfortunately the "p" motion was already taken for paragraphs.
"
" Next acts on the next object of the given type in the current line, last acts
" on the previous object of the given type in the current line.
"
" Currently only works for (, [, {, b, r, B, ', and ".
"
@sjoerdvisscher
sjoerdvisscher / updatemonad.hs
Created May 8, 2013 09:21
The update monad which generalizes the reader, writer and state monad from http://homepages.inf.ed.ac.uk/s1225336/talks/types13.pdf
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses #-}
import Data.Monoid
import Data.Monoid.Action
import Data.Monoid.MList (SM(..))
import Control.Monad.Trans.Class
newtype UpdateT p s m a = UpdateT { runUpdateT :: s -> m (p, a) }
@sjl
sjl / zl.vim
Created January 17, 2014 17:46
Zip Right Vim mapping
" Zip Right
"
" Moves the character under the cursor to the end of the line. Handy when you
" have something like:
"
" foo
"
" And you want to wrap it in a method call, so you type:
"
" println()foo
@magicznyleszek
magicznyleszek / css-selectors.md
Last active March 29, 2024 01:12
CSS Selectors Cheatsheet

CSS Selectors Cheatsheet

Hi! If you see an error or something is missing (like :focus-within for few years :P) please let me know ❤️

Element selectors

Element -- selects all h2 elements on the page

h2 {
@qiemem
qiemem / gist:59721c86668f233a73ab
Created March 29, 2015 00:21
Send text to buffer in vim
function! GetTextObject(type)
let saved_register = @@
if a:type == 'v'
normal! `<v`>y
elseif a:type ==# 'char' || a:type ==# 'line'
normal! `[v`]y
endif
let text = @@
let @@ = saved_register
return text
@jamiees2
jamiees2 / sheet.tex
Last active July 8, 2021 16:59
A template for LaTeX cheat sheets
% \documentclass[9pt,a4paper,twocolumn,landscape,oneside]{amsart}
\documentclass[9pt,a4paper,landscape,oneside]{amsart}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{fancyhdr}
\usepackage{float}
\usepackage{fullpage}
%\usepackage{geometry}
@alexander-yakushev
alexander-yakushev / latex-cheatsheet-template.tex
Last active March 8, 2024 20:50
Beautiful cheatsheet template for key bindings, compiled with XeLaTeX
%% Copyright 2020 Alexander Yakushev
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
@scottstensland
scottstensland / output of kubectl get pods -o json
Last active December 16, 2019 23:13
google cloud command sample output of command : kubectl get pods -o json
{
"kind": "List",
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Pod",
"apiVersion": "v1",
"metadata": {
"name": "mongo-controller-h714w",