Skip to content

Instantly share code, notes, and snippets.

View wegorich's full-sized avatar
💩
Crappy codding

Egor Malkevich wegorich

💩
Crappy codding
View GitHub Profile
@wegorich
wegorich / get file name using jquery for simple file picker
Last active December 21, 2015 12:49
Override default file picker with jquery - show file name after styling
filepicker.on 'change', 'input[type=file]', ()->
$picker=$(this)
$picker.closest('.filename').html($picker.val().replace(/C:\\fakepath\\/i, ''))
@wegorich
wegorich / fancybox.js.coffe
Created May 13, 2013 14:33
fancybox load html contet
$ ->
$(document).on('click', '.fancybox', (e)->
$.fancybox.showLoading()
$.ajax
url: $(this).attr('href') + type,
success: (data)->
$.fancybox.hideLoading()
$.fancybox(data, {
overlay :
locked : true
@wegorich
wegorich / ransack.ru.yml
Last active December 17, 2015 05:58
ransack locales ru / ransack.ru.yml
ru:
ransack:
search: "Поиск"
predicate: "основное"
and: "и"
or: "или"
any: "любое"
all: "все"
combinator: "комбинатор"
attribute: "аттрибут"
@wegorich
wegorich / erb2haml
Created April 27, 2013 11:35
erb2haml.rake (put to lib/task/ forder) gems required gem 'haml-rails' gem 'html2haml' gem 'hpricot' gem 'ruby_parser'
namespace :erb do
namespace :to do
desc 'Converts all .html.erb files to .html.haml'
task :haml do
print "looking for erb views..\n"
files = `find ./app/views -name *.html.erb`
files.each_line do |file|
file.strip!
print "parsing file: #{file}\n"
`bundle exec html2haml #{file} | cat > #{file.gsub(/\.erb$/, ".haml")}`
@wegorich
wegorich / Binding WPF command
Last active December 11, 2015 01:29
Binding WPF command using WPFToolkit.Extended
//xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
//xmlns:toolkit="clr-namespace:Xceed.Wpf.Toolkit;assembly=WPFToolkit.Extended"
<toolkit:WatermarkTextBox Padding="6,4"
TextOptions.TextRenderingMode="Aliased" Watermark="Введите что нибудь для поиска" >
<toolkit:WatermarkTextBox.BorderBrush>
<SolidColorBrush Color="#DDD"/>
</toolkit:WatermarkTextBox.BorderBrush>
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="TextChanged">