Skip to content

Instantly share code, notes, and snippets.

@gfixler
gfixler / PyDocstrTxtObj
Last active Jun 7, 2020
Python docstring textobjects
View PyDocstrTxtObj
function! PyDocstrTxtObj (inner)
" TEXT OBJECT FOR IN/AROUND PYTHON DOCSTRING
"
" For docstrings in this format:
" ,------------------------------.
" | ''' |
" | Module-level docstring. |
" | Text object works on these. |
" | ''' |
" | |
@gfixler
gfixler / craplens.py
Last active Mar 27, 2020
Crappy Lens (optics/functional references) in about 15 lines of Python
View craplens.py
# HELPER FUNCTIONS
comp2 = lambda f: lambda g: lambda x: f(g(x)) # 2 should be enough for anyone
cmap = lambda f: lambda xs: map(f, xs) # curried map
reverse = lambda xs: xs[::-1]
upper = lambda x: x.upper()
inc = lambda x: x + 1
add = lambda n: lambda x: x + n
View bf.vim
+++++ + ++++ + +++++++ ++
*+++++ + + ++++++++++++* + +++ +++++
++ + + + +++++*+++ + ++ + +++
+ + + + + + ++ + *++
+ + ++ + ++ +++ + ++
++ ++ * +++ ++ +++ + .+
++ ++ ++ ++ *++ .-- - --
---- -- -- -- -*- --- - --
- --- -- -- -- --* --- - --
-- -- -- -- -- --- *--------
@gfixler
gfixler / installvim.sh
Created Nov 10, 2017
Vim install script
View installvim.sh
#!/bin/bash
# based on:
# https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source
sudo apt-get remove vim vim-runtime gvim vim-tiny vim-common vim-gui-common vim-nox gvim
@gfixler
gfixler / maya2017install.sh
Last active Dec 26, 2017 — forked from borgfriend/maya2017install.sh
Maya 2017 Installation on Ubuntu 16.04
View maya2017install.sh
#!/bin/bash
# Make sure the tgz file is in the home directory
# Original script downloaded educational version,
# whereas I need to use the full, paid-for version
# https://forums.autodesk.com/t5/installation-licensing/maya-2018-ubuntu-16-04-lts-start-up-errors/m-p/7446146
FILE=Autodesk_Maya_2017_EN_JP_ZH_Linux_64bit.tgz
if [ ! -f ~/$FILE ]; then
echo Cannot find ~/$FILE
exit
View Haskell Reverse Dependencies List, sorted by Total Dependency Count (2017-10-20)
1 11684 base
2 4409 bytestring
3 3980 containers
4 3379 text
5 3099 mtl
6 2565 transformers
7 2019 directory
8 1791 filepath
9 1717 QuickCheck
10 1702 time
@gfixler
gfixler / gist:ac7fc3808dc82cf519c9ea94c71d8803
Last active May 17, 2017
An ordered list of all 7293 selfs from the 367 .py files in my Python code repository.
View gist:ac7fc3808dc82cf519c9ea94c71d8803
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
self self self self self self self self self self self self self self self self
@gfixler
gfixler / lofp_rank
Last active Mar 24, 2018
Current placement on the Standardized Ladder of Functional Programming
View lofp_rank
Standardized Ladder of Functional Programming
http://lambdaconf.us/downloads/documents/lambdaconf_slfp.pdf
Level Key
0: I've never heard of this
1: I've heard of this
2: I've looked into this, but don't get it yet
3. I have a basic understanding/am using this
4. I've used this for a while/feel pretty solid on
5. I could comfortably teach this to others
@gfixler
gfixler / github.py
Last active Oct 13, 2017
Maya Github Python project bootstrapping script
View github.py
'''
Maya Python Github project bootstrapping script
Makes particular Maya Python Github project releases available in Maya via the
user script dir. Pass user, project, and release strings to getGithubRelease,
which will download the zip file to the user script dir, and unzip it in there
(if it doesn't yet exist). Returns the full path to the unzipped project
folder, which can be used to modify sys.path[1], circumventing installation.
Note: you still need to ensure all tools deal with one version of the project,
@gfixler
gfixler / tripod.hs
Last active Dec 12, 2016
101 Tripod Hits song lookup
View tripod.hs
#!/usr/bin/env stack
{- stack --resolver lts-7.13 --install-ghc runghc -}
import Data.Maybe (mapMaybe)
import System.Environment (getArgs)
song :: Int -> Maybe String
song 1 = Just "A Shandy Too Far"
song 2 = Just "Adult Contemporary"
song 3 = Just "Air Guitar"