most of these require logout/restart to take effect
# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false
# Set a shorter Delay until key repeat
SELECT a.attname AS pkey, c.relname as pkey_index_name, c2.relname AS table_name | |
FROM pg_index i | |
JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey) | |
JOIN pg_catalog.pg_class c ON i.indexrelid = c.oid | |
JOIN pg_catalog.pg_class c2 ON i.indrelid = c2.oid | |
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace | |
WHERE i.indisprimary | |
AND n.nspname = 'public'; |
#!/bin/env ruby | |
# lazy hack from Robert Klemme | |
module Memory | |
# sizes are guessed, I was too lazy to look | |
# them up and then they are also platform | |
# dependent | |
REF_SIZE = 4 # ? | |
OBJ_OVERHEAD = 4 # ? |
One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.
Most workflows make the following compromises:
Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure
flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.
Use production SSL certificates locally. This is annoying
I hereby claim:
To claim this, I am signing this object:
-- Source: https://wiki.postgresql.org/wiki/Aggregate_Median | |
CREATE FUNCTION _final_median(anyarray) RETURNS float8 AS $$ | |
WITH q AS | |
( | |
SELECT val | |
FROM unnest($1) val | |
WHERE VAL IS NOT NULL | |
ORDER BY 1 | |
), |
#!/usr/bin/env ruby | |
# | |
# Usage: git-up | |
# git-reup | |
# | |
# Like git-pull but show a short and sexy log of changes | |
# immediately after merging (git-up) or rebasing (git-reup). | |
# | |
# Inspired by Kyle Neath's `git up' alias: | |
# http://gist.github.com/249223 |
› ruby rails3_works.rb | |
Finished in 0.001542s, 648.5084 runs/s, 1297.0169 assertions/s. | |
1 runs, 2 assertions, 0 failures, 0 errors, 0 skips | |
› ruby rails4_fails.rb | |
Finished tests in 0.013107s, 76.2951 tests/s, 0.0000 assertions/s. |