Skip to content

Instantly share code, notes, and snippets.

View crmaxx's full-sized avatar

Maxim Zhukov crmaxx

  • Russia, Vladimir
View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Stripe Getting Started Form</title>
<!-- The required Stripe lib -->
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
<!-- jQuery is used only for this example; it isn't required to use Stripe -->
@crmaxx
crmaxx / .zshrc
Created August 5, 2013 07:37
my zsh config
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="pygmalion"
# Example aliases
@crmaxx
crmaxx / crop_api.js.coffee
Last active December 22, 2015 00:09
Rewrite to CoffeeScript
class CropApi
constructor: (@node) ->
$node = $(node)
$body = $("body")
$cropXField = $node.find('.crop_x')
$cropYField = $node.find('.crop_y')
$cropWField = $node.find('.crop_w')
$cropHField = $node.find('.crop_h')
returnKeyHandler: (event) ->
@crmaxx
crmaxx / restore_brew.rb
Last active December 29, 2015 18:59
restore brew installed package
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go/install)"
brew update
brew doctor
brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webp-quicklook suspicious-package xquartz && qlmanage -r
# Full list of installed package
ack
@crmaxx
crmaxx / backup_brew.rb
Created November 30, 2013 01:40
backup installed brew packages
brew list > brew_list_tmp.txt
for each brew_list_tmp.txt do |pkg|
brew info pkg
get install string from "Built from source with:"
add "brew install #{pkg} #{params}" to brew_list.txt
end
Используя фреймворк Ruby on Rails необходимо создать веб-приложение, которое содержит:
Модели:
Экскурсия
Категории экскурсии (n-n). Например, историческая, городская, природная, музейная и т.д.
Город экскурсии (1-n).
Для экскурсии существует флаг public, который определяет: выводится ли экскурсия на фронтенде или нет.
Фронтенд:
#app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < SimpleForm::Inputs::CollectionCheckBoxesInput
def item_wrapper_class
"checkbox-inline"
end
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@crmaxx
crmaxx / sort.md
Last active August 29, 2015 14:00
Кривая сортировка в pg на маке

Сортировка на стороне рельс:

[11] pry(main)> Branch.by_company(1).to_a.sort_by(&:branch_name).map(&:branch_name)
  Branch Load (0.6ms)  SELECT "branches".* FROM "branches" WHERE "branches"."company_id" = 1
=> ["Департамент автомобили с пробегом",
 "Лексус Каширский",
 "Лексус Левобережный",
 "Лексус Лосиный Остров",
 "Лексус Рублевский",
 "Тойота Центр Битца",
@crmaxx
crmaxx / Install_nokogiri.sh
Last active November 8, 2016 08:49
Install nokogiri
brew install libxml2 libxslt homebrew/dupes/libiconv
gem install nokogiri -- \
--with-xml2-lib=/usr/local/Cellar/libxml2/2.9.4/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.29 \
--with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib \
--with-iconv-include=/usr/local/Cellar/libiconv/1.14/include