Nick Kugaevsky kugaevsky

View taxpayer_id.rb
1 2 3 4 5 6 7 8 9
class TaxpayerID
 
FACTORS = [ 3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0 ]
 
def initialize value
@digits = value.to_s.chars.map(&:to_i)
raise ArgumentError, 'unexpected argument length (must be 10 or 12 chars)' unless @digits.length == 10 || @digits.length == 12
@result = (@digits.length == 10 ? check_ten : check_twelve)
end
View play.js.coffee
1 2 3 4 5 6 7 8 9 10
# --------------------
# Define Audio Context
# --------------------
window.AudioContext = window.AudioContext||window.webkitAudioContext
window.MyAudioContext = new AudioContext()
window.MyAudioDecodeAndPlay = (arrayBuffer) ->
MyAudioContext.decodeAudioData arrayBuffer, (buffer) ->
source = MyAudioContext.createBufferSource()
View .zshrc
1 2 3 4 5 6 7 8 9 10
# 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="robbyrussell"
 
# Example aliases
View Preferences.sublime-settings
1 2 3 4 5 6 7 8 9 10
{
"auto_indent": true,
"auto_match_enabled": true,
"bold_folder_labels": false,
"caret_style": "smooth",
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"default_encoding": "UTF-8",
"default_line_ending": "unix",
"detect_indentation": true,
"drag_text": false,
View cleanup_all_gemsets.sh
1 2 3 4 5 6 7 8 9 10
#!/bin/sh
 
echo "NB! This process could be too destructive sometimes and you may need to run 'bundle' command from your project directory."
echo "Do you want to cleanup all gemsets?"
read -p "(anything other than 'yes' will cancel) > " ANSWER
 
if [[ $ANSWER != "yes" ]]
then
echo "Phew...\nMay be another day."
else
View layout.html.haml
1 2
= link_to 'Homepage', root_path, data: { keybinding: 'h' } # Press 'h' to navigate to homepage
= link_to 'About', about_path, data: { keybinding: '["a", "c"]' } # Press 'a' or 'c' to navigate to about
View config.ru
1 2 3 4 5 6 7 8 9 10
require 'rubygems'
require 'yard'
 
gems = %w(xendoola jackad)
libraries = {}
 
gems.each do |gem_name|
Gem.source_index.find_name(gem_name).each do |spec|
libraries[spec.name] ||= []
libraries[spec.name] << YARD::Server::LibraryVersion.new(spec.name, spec.version.to_s, nil, :gem)
View activerecord.ru.yml
1 2 3 4 5 6 7 8 9 10
ru:
activerecord:
errors:
messages:
taken: "%{model} с таким именем уже существует"
record_invalid: "Валидация не прошла: %{errors}"
restrict_dependent_destroy:
one: "Невозможно удалить запись, так как существуют зависимости: %{record}"
many: "Невозможно удалить записи, так как существуют зависимости: %{record} "
inclusion: "недопустимое значение"
View Preferences.sublime-settings
1 2 3 4 5 6 7 8 9
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
 
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
 
// Set to false to prevent line numbers being drawn in the gutter
"line_numbers": true,
View layout.html.haml
1 2 3 4 5 6 7 8 9 10
!!! 5
%html(lang="ru")
%head
%meta(charset="utf-8")
%title= t[:app_name]
%link{rel: "stylesheet", href: "css/styles.css", type: "text/css", media: 'all'}
%script{type: 'text/javascript', src: 'js/jquery-1.7.2.min.js'}
%script{type: 'text/javascript', src: 'js/join_inputs.jquery.min.js'}
%body
.auth-block
Something went wrong with that request. Please try again.