Skip to content

Instantly share code, notes, and snippets.

View seanhagen's full-sized avatar
:shipit:
coding

Sean Hagen seanhagen

:shipit:
coding
  • Flight Center Travel Group
  • Vancouver, British Columbia
  • 15:39 (UTC -07:00)
View GitHub Profile
@lavalamp
lavalamp / The Three Go Landmines.markdown
Last active September 7, 2023 17:56
Golang landmines
View The Three Go Landmines.markdown

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
View gist:a6b2f75b1326fa8efd2f
select
start_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver'
from
appointments
where
date(start_at AT TIME ZONE 'UTC' AT TIME ZONE 'America/Vancouver') = '2014-07-24';
@arnested
arnested / README.md
Last active July 5, 2022 13:30
Using Font Awesome in the Emacs mode line
View README.md

Font Awesome icons in Emacs mode-line

I installed Font Awesome and uses it to make my Emacs mode line look cool:

  • Use the align-left icon for auto-fill-mode.
  • Use the thumbs-up and thumbs-down icons for flymake status (we need to reimplement flymake-report-status to make this happen).
  • Use the tags icon for gtags-mode.

Requirements: diminish.el - I installed it from MELPA.

@kyledrake
kyledrake / ferengi-plan.txt
Last active August 23, 2023 19:15
How to throttle the FCC to dial up modem speeds on your website using Nginx
View ferengi-plan.txt
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@chaitanyagupta
chaitanyagupta / _reader-macros.md
Last active October 3, 2023 05:29
Reader Macros in Common Lisp
View _reader-macros.md

Reader Macros in Common Lisp

This post also appears on lisper.in.

Reader macros are perhaps not as famous as ordinary macros. While macros are a great way to create your own DSL, reader macros provide even greater flexibility by allowing you to create entirely new syntax on top of Lisp.

Paul Graham explains them very well in [On Lisp][] (Chapter 17, Read-Macros):

The three big moments in a Lisp expression's life are read-time, compile-time, and runtime. Functions are in control at runtime. Macros give us a chance to perform transformations on programs at compile-time. ...read-macros... do their work at read-time.

View tmux-airline
#!/bin/sh
SEP=
SEPE=
CLOCK=⌚
CALENDAR=☼
MUSIC=♫
WIDTH=${1}
View 01ruby.el
(setq enh-ruby-program "/home/gnufied/.rbenv/versions/1.9.3-p448/bin/ruby")
(autoload 'enh-ruby-mode "enh-ruby-mode" "Major mode for ruby files" t)
(add-to-list 'auto-mode-alist '("\\.rb$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rake$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru$" . enh-ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . enh-ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . enh-ruby-mode))
View Sample: Clojure with JavaFX
Sample project for the "Getting started with JavaFX in Clojure" ( https://coderwall.com/p/4yjy1a ) ProTip.
@zachleat
zachleat / reading_time.rb
Last active October 21, 2020 23:00
Read this in X minutes Liquid Filter Plugin (for Jekyll)
View reading_time.rb
# Outputs the reading time
# Read this in “about 4 minutes”
# Put into your _plugins dir in your Jekyll site
# Usage: Read this in about {{ page.content | reading_time }}
module ReadingTimeFilter
def reading_time( input )
words_per_minute = 180