- динамическая и статическая типизация
- строгая и нестрогая типизация
- компилируемые и интерпретируемые языки
- принципиальное различие скриптовых и “обычных” языков
- типизация в Ruby
- 3 принципа ООП
- реализация множественного наследования в ruby
- duck typing
Factory.define :item do |f| | |
include ActionDispatch::TestProcess | |
f.name "Macbook Pro 15" | |
f.price_in_dollars 1500 | |
f.photo { fixture_file_upload('/files/avatar.jpg', 'image/jpg') } | |
end |
sudo apt-get update | |
# ruby and rails | |
sudo apt-get install htop graphviz git curl build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libreadline-dev libsqlite3-dev libxslt1-dev libgdbm-dev libncurses5-dev automake libtool bison libffi-dev libsqlite3-0 libmysql-ruby libmysqlclient-dev libs$ --yes | |
curl -L https://get.rvm.io | bash -s stable --rails | |
echo "gem: --no-ri --no-rdoc" > ~/.gemrc | |
notify-send "Ruby on Rails" Installed | |
git clone https://gist.github.com/6722293.git ~/config_files | |
mv ~/config_files/.pryrc ~/.pryrc |
# ~/.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 | |
[ -z "$PS1" ] && return | |
# don't put duplicate lines in the history. See bash(1) for more options | |
# ... or force ignoredups and ignorespace | |
HISTCONTROL=ignoredups:ignorespace |
public void ExportToExcel(DataGridView grid) { | |
ApplicationClass Excel = new ApplicationClass(); | |
XlReferenceStyle RefStyle = Excel.ReferenceStyle; | |
Excel.Visible = true; | |
Workbook wb = null; | |
String TemplatePath = System.Windows.Forms.Application.StartupPath + @"\export.xlt"; | |
try { | |
wb = Excel.Workbooks.Add(TemplatePath); // !!! | |
} catch (System.Exception ex) { | |
throw new Exception("Template is unavailable " + TemplatePath + "\n" + ex.Message); |
parent_div_width = $('.youtube_embed').parents('div').first().width() | |
$youtube_embed = $('.youtube_embed iframe') | |
$youtube_embed.prop('width', "#{parent_div_width}px") | |
$youtube_embed.prop('height', "#{parent_div_width / 16 * 9}px") |
cvt 1440 900 60 | |
xrandr --newmode "1440x900_60.00" 106.50 1440 1528 1672 1904 900 903 909 934 -hsync +vsync | |
xrandr --addmode VGA1 1440x900_60.00 |
--- | |
- hosts: all | |
vars: | |
name: "Your name" | |
email: "your_email" | |
tasks: | |
- command: git config --global user.email "{{ email }}" | |
- command: git config --global user.name "{{ name }}" | |
- apt: name={{ item }} | |
sudo: True |
class SimpleMultipleExample | |
include AASM | |
aasm(:move, column: 'move_state') do | |
state :standing, initial: true | |
state :walking | |
state :running | |
event :walk do | |
transitions from: :standing, to: :walking | |
end |
file = File.open("errors.json").read | |
lines = [] | |
file.each_line do |line| | |
line.gsub!(/ObjectId\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ObjectId' | |
line.gsub!(/ISODate\({1}(.)/, '\1').sub!(/()*\)/, '\1') if line.include? 'ISODate' | |
lines.push line | |
end | |
puts lines |