Open N windows split horizontally / vertically
-o[N] Open N windows (default: one for each file)
-O[N] Like -o but split vertically
you can also specify files:
vim -o3 file1.txt file2.txt file3.txt
| # simulation to calculate an answer to the question: | |
| # | |
| # "If you break a straight line randomly in two places, what is the probability that you can | |
| # form a triangle from the resulting three pieces?" | |
| # | |
| # usage: ruby ./triangles-sim.rb [trials] | |
| # sample output: | |
| # | |
| # $> ruby ./triangles-sim.rb 1000000 | |
| # |
| require 'spec_helper' | |
| describe Track do | |
| describe "commenters" do | |
| let(:sleepy) { build(:user, fullname: 'Mr. Sleepy', email: '[email protected]', username: 'sleepy') } | |
| let(:dopey) { build(:user, fullname: 'Mr. Dopey', email: '[email protected]', username: 'dopey') } | |
| let(:doc) { build(:user, fullname: 'Mr. Doc', email: '[email protected]', username: 'doc') } | |
| let(:sleepy_comment) { build(:comment, commenter: sleepy, content: "sleepy's comment") } | |
| let(:dopey_comment) { build(:comment, commenter: dopey, content: "dopey's comment") } | |
| let(:track) { build(:track) } |
| require 'fileutils' | |
| require 'ostruct' | |
| require 'pony' | |
| require 'active_support' | |
| module MakeEmailable | |
| extend ActiveSupport::Concern | |
| included do | |
| attr_reader :sender, :receiver |
| require 'spec_helper' | |
| describe Question do | |
| it { should belong_to(:page) } | |
| it { should belong_to(:survey) } | |
| it { should have_many(:answers) } | |
| describe "default scope" do | |
| let(:first_question) { Question.create(seq: 1) } | |
| let(:second_question) { Question.create(seq: 2) } |
| /** | |
| * normalizeEvent | |
| * | |
| * Firefox does not implement offsetX, OffsetY, so we have to detect for this an | |
| * manually calculate it ourselves using the pageX, pageY less the event | |
| * target's left offset and right offset | |
| * | |
| * If using a browser that supports offsetX, OffsetY, just return the event, | |
| * don't need to do anything | |
| */ |
| class Question < ActiveRecord::Base | |
| default_scope order("seq ASC") | |
| # decrement seq / page # depending on position and page count | |
| def move_up! | |
| if self.first_on_page? | |
| move_to_previous_page! | |
| else | |
| decrement_seq! && self.survey.renumber_questions! | |
| end |
| CREATE TABLE `ladder` ( | |
| `i` int(1) unsigned NOT NULL, | |
| PRIMARY KEY (`i`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=latin1; | |
| INSERT INTO ladder (i) VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); | |
| SELECT l1.i + l2.i * 10 + l3.i * 100 AS sequence | |
| FROM ladder l1 | |
| JOIN ladder l2 ON TRUE |
| $ cat sample | sort | uniq -c | |
| 2 bat | |
| 4 cat | |
| 2 dog | |
| 1 gator | |
| $ cat sample | sort | uniq -c | sed "s/^[ \t]*//" | |
| 2 bat | |
| 4 cat | |
| 2 dog |
| -- DATETIME to DATE comparison | |
| SELECT CAST('2012-09-09 23:59:59' AS DATETIME) <= DATE('2012-09-10 00:00:00'); -- TRUE :) | |
| SELECT CAST('2012-09-10 00:00:00' AS DATETIME) <= DATE('2012-09-10 00:00:00'); -- TRUE :) | |
| SELECT CAST('2012-09-10 00:00:00' AS DATETIME) <= DATE('2012-09-10 23:59:59'); -- TRUE :) | |
| SELECT CAST('2012-09-10 00:00:01' AS DATETIME) <= DATE('2012-09-10 23:59:59'); -- FALSE :( | |
| -- and a little more proof: | |
| SELECT CAST('2012-09-10 00:00:00' AS DATETIME) = DATE('2012-09-10 00:00:00'); -- TRUE | |
| SELECT CAST('2012-09-10 00:00:00' AS DATETIME) = DATE('2012-09-10 00:00:01'); -- TRUE | |
| SELECT CAST('2012-09-10 23:59:59' AS DATETIME) = DATE('2012-09-10 23:59:59'); -- FALSE |