Skip to content

Instantly share code, notes, and snippets.

View scottming's full-sized avatar
🎯
Focusing

Scott Ming scottming

🎯
Focusing
View GitHub Profile

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@Integralist
Integralist / rules for good testing.md
Last active March 5, 2025 21:19
Sandi Metz advice for writing tests

Rules for good testing

Look at the following image...

...it shows an object being tested.

You can't see inside the object. All you can do is send it messages. This is an important point to make because we should be "testing the interface, and NOT the implementation" - doing so will allow us to change the implementation without causing our tests to break.

package main
import (
"fmt"
)
func decorator(f func(s string)) func(s string) {
return func(s string) {
fmt.Println("Started")
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 8, 2025 09:19
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Task Time required Assigned to Current Status Finished
Calendar Cache > 5 hours - in progress - [x] ok?
Object Cache > 5 hours - in progress [x] item1
[ ] item2
Object Cache > 5 hours - in progress
  • item1
  • item2
Object Cache > 5 hours - in progress
  • item1
  • item2
  • works
  • works too

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

@zxhfighter
zxhfighter / emmet-snippet.md
Last active January 8, 2019 07:27
自定义emmet模板

自定义emmet模板

问题复现

ST(Sublime Text)安装emmet插件后,输入!,按tab键就可以快速得到一个简易的html5模板,甚是便捷:

<!DOCTYPE html>
<html lang="en">
<head>
@jaceklaskowski
jaceklaskowski / Rough Notes about CQRS and ES.md
Last active February 19, 2025 12:29
Rough Notes about CQRS and ES

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.