Reduce boilerplate in Redux
- Create actions similar to Flummox.
- Generate action ids.
- Supports actions with decorators, promises, and therefore ES7 async.
|Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)|
|(if you aren't using version 9.1.5, change line 6 with the correct version)|
|1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist|
|2. mv /usr/local/var/postgres /usr/local/var/postgres91|
|3. brew update|
|4. brew upgrade postgresql|
|5. initdb /usr/local/var/postgres -E utf8|
|6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres|
|7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/|
In addition to Kevin Conner's answer: block arguments do not support the same semantics as method arguments. You cannot define default arguments or block arguments.
This is only fixed in Ruby 1.9 with the new alternative "stabby lambda" syntax which supports full method argument semantics.
|# Remove the X to enable the parameters for tuning.|
|# These are the default values as of Ruby 2.2.0.|
|@child = spawn(<<-EOC.split.join(" "))|
|-- A frequent question in IRC is how to delete rows that are duplicates over a set of columns, keeping only the one with the lowest ID.|
|-- This query does that for all rows of tablename having the same column1, column2, and column3.|
|DELETE FROM tablename|
|WHERE id IN (SELECT id|
|FROM (SELECT id,|
|row_number() over (partition BY column1, column2, column3 ORDER BY id) AS rnum|
|FROM tablename) t|
|WHERE t.rnum > 1);|