- YAGNI: Don't build it until you need it.
- DRY: Extract patterns after second duplication, not before.
- Fail Fast: Explicit errors beat silent failures.
- Simple First: Write the obvious solution, optimize only if needed.
- Delete Aggressively: Less code = fewer bugs.
- Semantic Naming: Always name variables, parameters, and API endpoints with verbose, self-documenting names that optimize for comprehension by both humans and LLMs, not brevity (e.g.,
wait_until_object_is_saved = truevswait = true).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
| # Inspired from https://gist.github.com/faleev/3435377 | |
| # Remove any existing packages: | |
| sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
| # Get the dependencies (Ubuntu Server or headless users): | |
| sudo apt-get update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Script to help understanding of S3 object-oriented programming | |
| # in R using classes and methods | |
| # Constructor functions for various classes of animal | |
| pig <- function() structure(list(), class=c("pig", "animal")) | |
| dog <- function() structure(list(), class=c("dog", "animal")) | |
| cat <- function() structure(list(), class=c("cat", "animal")) | |
| makeSound <- function(x) UseMethod("makeSound") |
https://gist.github.com/kirstenfrank/218c36a1938055d0f4e4sample codebook.
It's very similar to a Statistical Analysis Plan, actually.
Setup, there is a dogwalking business. It wants to analyze its work.
Raw data is: name of dog, address of owner, time walked, date walked, size of dog (small, medium, or large), health of dog (well or sick) on that date and time, comments, and pay.
The business wants to assign ID# to the dogs, and codewords to the address to make this data anonymous. There isn't anything to do to the comments--since free text is all over the place.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import tweepy #https://github.com/tweepy/tweepy | |
| import csv | |
| #Twitter API credentials | |
| consumer_key = "" | |
| consumer_secret = "" | |
| access_key = "" |