Skip to content

Instantly share code, notes, and snippets.

View justvitalius's full-sized avatar

Vitaly Mineev justvitalius

  • Sberbank-Technology
  • Saint-Petersburg
View GitHub Profile
Rake task for finding unused images in rails app.
It requires 'ack' http://betterthangrep.com/
MacOS: brew install ack
Linux: apt-get install ack-grep
Before lunch a task put .ackrc to home directory like ~/.ackrc
@justvitalius
justvitalius / readme.rb
Last active August 29, 2015 13:55
simple_form config for bootstrap 3.0
# INLINE BOOTSTRAP FORMS
#
# all inputs will render in inline format (by default)
# label class='col-sm-4 label-control'
# div class='col.sm-4'
# input class='form-control'
#
simple_form_for resource,
html: {class: 'form-horizontal'},
defaults: { input_wrapper_html: { class: 'col-sm-8' },
require 'xpath'
module Features
module SelectDatesAndTimes
# select_date DateTime.now, from: 'label_name'
def select_date (date, options = {})
date = Date.parse(date.to_s)
# lookup id prefix by label
@justvitalius
justvitalius / nonbounce.js
Last active December 26, 2015 11:19
turn off mobile webkit bounce effect on iPad & iphone
(function($){
"use strict";
var startY;
var defaults = {
"$these": [],
"touchstartInit": false,
"touchmoveInit": false
};
@justvitalius
justvitalius / .gitignore
Created August 17, 2013 22:51
.gitignore file for Rails apps and RubyMine IDE
# Ignore bundler config
/.bundle
# Ignore the default SQLite database.
/db/*.sqlite3
# Ignore all logfiles and tempfiles.
/log/*.log
/tmp
/public/assets
@justvitalius
justvitalius / sass-rails-bem.rb
Last active December 21, 2015 05:39
SCSS code like this: foo{ __bar{} } in results CSS will be like this: foo_bar{} =|= Create filename.rb in config/initializers folder with gist contents.
require 'sprockets/railtie'
Rails.application.assets.register_postprocessor 'text/css', :sass_bem_class_builder do |context, data|
data.gsub(/([a-zA-Z0-9\-]+)[ ]([_]+)/i){ $1 + $2 }
end