start new:
tmux
start new with session name:
tmux new -s myname
| require 'date' | |
| class ThreePaycheckCalculator | |
| attr_reader :first_payday, :pay_interval, :number_of_paydays, :pay_days | |
| def initialize(first_payday, pay_interval: 14, number_of_paydays: 100) | |
| @first_payday = first_payday | |
| @pay_interval = pay_interval | |
| @number_of_paydays = number_of_paydays |
| module Prank | |
| @@jokes = [] | |
| class Joke | |
| def initialize(name, options, block) | |
| @name = name | |
| @options = options | |
| @block = block |
| desc "Truncate all tables in the database" | |
| task :truncate_all_tables! => :environment do | |
| unless Rails.env.production? | |
| puts "TRUNCATING ALL TABLES in 3 seconds!!!!" | |
| sleep 3 | |
| ActiveRecord::Base.connection.tables.each do |table| | |
| unless table == "schema_migrations" | |
| puts "Truncating #{table}." | |
| ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table} RESTART IDENTITY CASCADE;") | |
| else |
| start c =node(14417) create unique (c)-[:year]->(y { year: 2014 })-[:month]->(m { month: 1})-[:day]->(d { day: 30 }) return c,y,m,d; |
| require 'csv' | |
| CSV.open("test.csv", "w", :col_sep => "\t") do |csv| | |
| csv << ["one", "two", "three"] | |
| csv << [1, 2, 3] | |
| csv << [1, 2, 3] | |
| csv << [1, 2, 3] | |
| end | |
| class Franklin | |
| def self.speak | |
| puts "Hello" | |
| end | |
| end | |
| orig_speak_proc = Franklin.method(:speak) |
| def same_name_diff_extensions(search_val,arr) | |
| arr.map{ |i| i unless i.match(%r{^#{search_val}\..*}).nil? }.compact | |
| end |
| a = ["one","two","three"] | |
| b = ["un", "du", "trois"] | |
| c = Hash[a.zip(b)] | |
| puts c | |
| # => {"one"=>"un", "three"=>"trois", "two"=>"du"} | |
| class A | |
| SUB_TYPES = %w(bass trout salmon) | |
| def valid_sub_type?(sub_type) | |
| self.class::SUB_TYPES.include? sub_type | |
| end | |
| end | |
| class B < A | |
| SUB_TYPES = %w(whale beaver dog) |