Skip to content

Instantly share code, notes, and snippets.

View kugaevsky's full-sized avatar
🏠
Working from home

Nick Kugaevsky kugaevsky

🏠
Working from home
View GitHub Profile
@kugaevsky
kugaevsky / play.js.coffee
Last active December 24, 2015 15:59
Play sound proof-of-concept
# --------------------
# Define Audio Context
# --------------------
window.AudioContext = window.AudioContext||window.webkitAudioContext
window.MyAudioContext = new AudioContext()
window.MyAudioDecodeAndPlay = (arrayBuffer) ->
MyAudioContext.decodeAudioData arrayBuffer, (buffer) ->
source = MyAudioContext.createBufferSource()
@kugaevsky
kugaevsky / .zshrc
Last active December 23, 2015 05:29
oh-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="robbyrussell"
# Example aliases
@kugaevsky
kugaevsky / Preferences.sublime-settings
Last active December 21, 2015 05:28
My Sublime Text 3 Settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"drag_text": false,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fallback_encoding": "Cyrillic (Windows 1251)",
"font_size": 12,
"highlight_line": true,
"ignored_packages":
[
@kugaevsky
kugaevsky / cleanup_all_gemsets.sh
Last active November 15, 2017 16:49
Cleanup outdated gems from all your rvm gemsets
#!/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
@kugaevsky
kugaevsky / layout.html.haml
Created June 2, 2013 21:28
Mousetrap-rails binding example
= 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
@kugaevsky
kugaevsky / config.ru
Last active December 11, 2015 17:48
Yard server rack config.ru file
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)
@kugaevsky
kugaevsky / activerecord.ru.yml
Created September 16, 2012 21:45
ActiveRecord errors localiztion
ru:
activerecord:
errors:
messages:
taken: "%{model} с таким именем уже существует"
record_invalid: "Валидация не прошла: %{errors}"
restrict_dependent_destroy:
one: "Невозможно удалить запись, так как существуют зависимости: %{record}"
many: "Невозможно удалить записи, так как существуют зависимости: %{record} "
inclusion: "недопустимое значение"
@kugaevsky
kugaevsky / Preferences.sublime-settings
Created July 18, 2012 10:31
Sublime Text 2 preferences
// 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,
!!! 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
@kugaevsky
kugaevsky / gentoo.zsh-theme
Created July 6, 2012 10:31
oh-my-zsh gentoo theme with dollar sign
function prompt_char {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[green]%}%n@)%m %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_$(prompt_char)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=") "