⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains 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
# encoding: UTF-8 | |
require 'singleton' | |
class Cats | |
include Singleton | |
def initialize | |
@cat = { name: 'Alice', sex: 'F' } | |
end | |
This file contains 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
require 'awesome_print' | |
require 'active_record' | |
require 'pg' | |
require 'pp' | |
require 'roo' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'postgresql', | |
:host => 'localhost', | |
:username => 'kevin', |
This file contains 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
> db.hostInfo() | |
{ | |
"system" : { | |
"currentTime" : ISODate("2013-03-31T18:46:43.023Z"), | |
"hostname" : "MacBook-Air-Andrej.local", | |
"cpuAddrSize" : 64, | |
"memSizeMB" : 4096, | |
"numCores" : 4, | |
"cpuArch" : "x86_64", | |
"numaEnabled" : false |
This file contains 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
require "net/smtp" | |
require "time" # for rfc2822 | |
# sender | |
from_addr = "insert_from_address_here" | |
# receiver | |
to_addr = "insert_receiver_address_here" | |
mail_content = <<END_OF_CONTENT | |
From: #{from_addr} |
This file contains 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
## Prepare ################################################################### | |
# Remove RVM | |
rvm implode | |
# Ensure your homebrew is working properly and up to date | |
brew doctor | |
brew update | |
## Install ################################################################### |
This file contains 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
class Car | |
attr_accessor :name, :year, :price | |
def initialize(name, year, price) | |
@name = name | |
@year = year | |
@price = price | |
end |
Во-первых, это моё мнение, и я его никому не навязываю. Во-вторых, список не обязательно исчерпывающий. В-третьих, он ориентирован на определённую "философию", которая тоже не является исчерпывающей или абсолютно правильной. Поэтому, если Вам эти рекомендации не подходят -- не следуйте им.
Философия такова. Для того чтобы осмысленно программировать на начальном этапе не нужно знать Computer Science, теорию алгоритмов и сложности вычислений или детально разбираться в устройстве и работе компьютера. Достаточно хорошо делать две вещи:
- алгоритмизировать решение задачи (разбивать его на простые последовательные шаги: сначала это, а потом вот это),
- знать, понимать смысл и назначение, использовать и подгонять друг к другу стандартные элементы решений (условия, циклы, структуры данных, алгоритмы и прочие "паттерны")
This file contains 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
irb(main):012:0> i = 5 | |
=> 5 | |
irb(main):013:0> i.next + i.next | |
=> 12 | |
irb(main):014:0> i = 5 | |
=> 5 | |
irb(main):015:0> (i += 1) + (i += 1) | |
=> 13 |
This file contains 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
files = Dir["./**/*"] | |
files.each do |file| | |
next if File.directory?(file) | |
words = [] | |
begin | |
File.read(file).scan /[\u0400-\u04FF\-]+/ do |match| | |
words << match | |
end |
OlderNewer