Skip to content

Instantly share code, notes, and snippets.

@danielrsmith
danielrsmith / gist:a0ae3c0bd2ad143f935f5a2421ec0f9f
Last active Aug 18, 2017 — forked from giannisp/gist:b53a76047b07751ed3ade3c1db1d2c51
Upgrade PostgreSQL 9.5.5 to 9.6.4 using Homebrew (macOS)
View gist:a0ae3c0bd2ad143f935f5a2421ec0f9f
After automatically updating Postgres to 9.6.1 via Homebrew, the pg_ctl start command didn't work.
The error was something like "database files are incompatible with server".
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 9.5.x installed, and keep 9.6.4 as default
brew services stop postgresql
brew unlink postgresql
brew install postgresql95
brew unlink postgresql95
View snake_case.rb
# There will be 2n moves (or 20 in this case). However we only care about one directional unit (down or right).
# So if you think about 2n moves numbered 1 though 2n (or 1 - 20)
# The number of possible paths can be represented by the number of combinations of
# n of those numbers. So for 20 numbers, how many combinations of 10 of those numbers can you make.
def snake_case(n)
(1..2*n).to_a.combination(n).count
end
snake_case 10
@danielrsmith
danielrsmith / 0_reuse_code.js
Created Jan 31, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@danielrsmith
danielrsmith / gist:2788918
Created May 25, 2012
netSuite Issue Alfred Search
View gist:2788918
alfredapp://customsearch/Search%20netSuite%20Issues/issue/ascii/url=https://system.netsuite.com/app/common/search/quicksearchresults.nl?Issue_NUMBERtype=KEYWORDS&Issue_NUMBER={query}&Transaction_MAINLINE=T&rectype=&searchtype=Issue&Issue_ISINACTIVE=F&frame=be&inpt_quicksearch=Issue+%23&quicksearch=Issue_Issue_NUMBER