This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To get an overview about how much space is taken by what database, call: | |
| SELECT | |
| pg_database.datname, | |
| pg_size_pretty(pg_database_size(pg_database.datname)) AS size | |
| FROM pg_database; | |
| To get more details, call: | |
| SELECT | |
| relname as "Table", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #macro | |
| Start recording by pressing q, followed by a lower case character to name the macro | |
| Perform any typical editing, actions inside Vim editor, which will be recorded | |
| Stop recording by pressing q | |
| Play the recorded macro by pressing @ followed by the macro name | |
| To repeat macros multiple times, press : NN @ macro name. NN is a number |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Let ConditionA Mean DateRange A Completely After DateRange B (True if StartA > EndB) | |
| Let ConditionB Mean DateRange A Completely Before DateRange B (True if EndA < StartB) | |
| Then Overlap exists if Neither A Nor B is true ( If one range is neither completely after the other, nor completely before the other, then they must overlap) | |
| Now deMorgan's law says that: | |
| Not (A Or B) <=> Not A And Not B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #in Vagrant, bind to 0.0.0.0 automatically | |
| vim /home/vagrant/.rvm/gems/jruby-1.7.4/gems/torquebox-server-2.3.1-java/jboss/standalone/configuration/standalone.xml | |
| #change all bind.address to 0.0.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #open port | |
| ufw | |
| #forward | |
| ssh -R 2223:localhost:4567 [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
| VAGRANTFILE_API_VERSION = "2" | |
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
| # All Vagrant configuration is done here. The most common configuration | |
| # options are documented and commented below. For a complete reference, | |
| # please see the online documentation at vagrantup.com. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #check support | |
| Object.keys(obj).length === 0 | |
| #or | |
| if (Object.getOwnPropertyNames(obj).length > 0) return false; | |
| // Speed up calls to hasOwnProperty | |
| var hasOwnProperty = Object.prototype.hasOwnProperty; | |
| function is_empty(obj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add this file capybara_wait_until.rb to your /test directory | |
| module Capybara | |
| class Session | |
| ## | |
| # | |
| # Retry executing the block until a truthy result is returned or the timeout time is exceeded | |
| # | |
| # @param [Integer] timeout The amount of seconds to retry executing the given block | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| GET /items #=> index | |
| GET /items/1 #=> show | |
| GET /items/new #=> new | |
| GET /items/1/edit #=> edit | |
| PUT /items/1 #=> update | |
| POST /items #=> create | |
| DELETE /items/1 #=> destroy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Asuitestay::Application.configure do | |
| # Settings specified here will take precedence over those in config/application.rb. | |
| # The test environment is used exclusively to run your application's | |
| # test suite. You never need to work with it otherwise. Remember that | |
| # your test database is "scratch space" for the test suite and is wiped | |
| # and recreated between test runs. Don't rely on the data there! | |
| config.cache_classes = true | |
| # Do not eager load code on boot. This avoids loading your whole application |