start new:
tmux
start new with session name:
tmux new -s myname
class Array | |
def move(element, distance) | |
current_pos = index(element) | |
return self if current_pos.nil? | |
new_pos = (current_pos+distance) - ((current_pos+distance)/length)*length | |
delete(element) | |
insert(new_pos, element) | |
end | |
end |
IO.readlines("/usr/share/dict/words").map{|w| w.chomp}.select{|w| w.downcase.chars.sort.join == word.chars.sort.join}.reject{|w| w == word} |
# invoices_controller.rb | |
helper_method :available_filters | |
def index | |
@invoices = Invoice.send(filter_scope) | |
end | |
private | |
def available_filters |
[~/Projects/exercism]$ ruby ruby/rna-transcription/rna-transcription_test.rb | |
Run options: --seed 51147 | |
# Running tests: | |
EEEEE | |
Finished tests in 0.001201s, 4163.1973 tests/s, 0.0000 assertions/s. | |
1) Error: |
class Payment | |
def process(gateway) | |
gateway.verify(self) # duck typed. | |
end | |
end | |
class PaymentTest | |
def test_process | |
payment = Payment.new | |
payment.process(MockGatway.new) |
-- Determine size of databases | |
-- Source: http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database | |
SELECT table_schema "DB Name", Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" | |
FROM information_schema.tables | |
GROUP BY table_schema; | |
-- Size in MB of the innodb_buffer_pool_size. Default is 128 MB. | |
-- More here: http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_buffer_pool_size | |
SELECT @@innodb_buffer_pool_size / 1024 / 1024 |
# This allows stylesheets, scripts and images from the same origin host, but nothing else. | |
Content-Security-Policy: default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' |
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac |
# Linux Primer | |
## Where am I? | |
It can be intimidating when you are first confronted with prompt because you do not no where you are and what to do. This first section aims to help you orient yourself on any Linux system. | |
### The `pwd` command | |
`pwd` |