Skip to content

Instantly share code, notes, and snippets.

@timothee-alby
timothee-alby / heroku-pg-extra.md
Created August 2, 2022 09:52
Postgres Emergency Commands

With Heroku's pg-extra

On Heroku, the pg-extras CLI Plugin is available.

$ heroku pg:long-running-queries

List currently running queries that have been running for longer than 5 minutes. Heroku dynos have a 30-seconds disconnect so queries still running after 5 mins are usually problematic and can slow down the entire DB.

$ heroku pg:blocking

@timothee-alby
timothee-alby / overview.md
Last active August 2, 2022 09:38
Heroku Logs Parsing with `angle-grinder`
@timothee-alby
timothee-alby / programming_task_short.md
Created October 20, 2015 13:59
Programming Challenge - Overleaf - 2015-10-20

Programming challenge

A natural language time parser

You are a developer on a task manager app. Your users can create tasks and those tasks, in particular, have a time and date.

To provide a enhanced experience to your users upon task creation, you want the task date to be a free text field. A user would input strings such as in 2 days, 3 hours ago, tomorrow, on december 5th at noon, and you would save that information as a date object in the system.

Challenge

@timothee-alby
timothee-alby / .quit_front_app.scpt
Created June 3, 2015 19:16
Warn before quitting the current application in OSX
#
# AppleScript to quit the current front app after a warning. Useful to remap CMD+Q and stop quitting app by mistake
#
# 1. Open AppleScript
# 2. Past this file
# 3. Save as `~/.quit_front_app.scpt`
# 4. Run `osascript ~/.quit_front_app.scpt`
# 5. There is no 5
#
tell application "System Events"
@timothee-alby
timothee-alby / to_bool.rb
Last active August 29, 2015 14:08 — forked from equivalent/README.md
Easily any type to boolean in Ruby
module StringToBoolean
def to_bool
return true if self == true || self.strip =~ (/\A(true|t|yes|y|1)\Z/i)
false
end
end
class String; include StringToBoolean; end
module BooleanToBoolean
def to_bool;return self; end