Skip to content

Instantly share code, notes, and snippets.

View evannagle's full-sized avatar

evan@mantle evannagle

View GitHub Profile
@DarwinAwardWinner
DarwinAwardWinner / wrapdoc.py
Created August 25, 2011 19:30
Fix the line breaks in a Python functions's doc string
import textwrap
def refill_docstring(func, *args, **kwargs):
"""Fix the text wrapping in a function's docstring.
This can be useful when creating doc strings dynamically.
Additional args are options to textwrap.TextWrapper."""
wrapper = textwrap.TextWrapper(*args, **kwargs)
# Remove trailing whitespace from all lines
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active October 31, 2025 20:47
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brianloveswords
brianloveswords / fancy-newline.el
Last active May 18, 2019 03:39
An enhanced newline function for use with smartparens-mode.
(defun my-fancy-newline ()
"Add two newlines and put the cursor at the right indentation
between them if a newline is attempted when the cursor is between
two curly braces, otherwise do a regular newline and indent"
(interactive)
(if (and (equal (char-before) 123) ; {
(equal (char-after) 125)) ; }
(progn (newline-and-indent)
(split-line)
(indent-for-tab-command))
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active October 7, 2025 16:12
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@technosophos
technosophos / firefox-open-tab.applescript
Last active May 22, 2023 08:06
Open a Tab in Firefox on macOS with AppleScript
# To run:
# osascript firefox-open-tab.applescript http://technosophos.com
#
# References:
# https://support.mozilla.org/en-US/questions/1130718
# https://stackoverflow.com/questions/3645763/how-do-i-instruct-applescript-to-open-a-new-firefox-window-with-a-link
on firefoxRunning()
tell application "System Events" to (name of processes) contains "firefox"
end firefoxRunning
@pvik
pvik / smartparens-cheatsheet.md
Last active December 16, 2024 17:54
A Cheatsheet for Emacs Smarparens example configuration

An animated cheatsheet for smartparens using the example configuration specified here by the smartparens author. Inspired by this tutorial for paredit.

Traversal

C-M-f sp-forward-sexp
C-M-b sp-backward-sexp
@mtimbs
mtimbs / tsconfig.json
Last active September 21, 2025 08:28
basic default tsconfig for use in TypeScript projects
{
"compilerOptions": {
// project options
"lib": [
"ESNext",
"dom"
], // specifies which default set of type definitions to use ("DOM", "ES6", etc)
"outDir": "lib", // .js (as well as .d.ts, .js.map, etc.) files will be emitted into this directory.,
"removeComments": true, // Strips all comments from TypeScript files when converting into JavaScript- you rarely read compiled code so this saves space
"target": "ES6", // Target environment. Most modern browsers support ES6, but you may want to set it to newer or older. (defaults to ES3)