Skip to content

Instantly share code, notes, and snippets.

View feymartynov's full-sized avatar

Timofey Martynov feymartynov

  • Wildberries
  • Moscow
View GitHub Profile
@feymartynov
feymartynov / git cherry-pick to other repository
Created February 22, 2013 09:04
git cherry-pick to other repository
destination/directory$ GIT_ALTERNATE_OBJECT_DIRECTORIES=../source/directory/.git/objects git cherry-pick $(git --git-dir=../source/directory/.git rev-parse --verify commit_hash)
@feymartynov
feymartynov / cyr_find.sh
Created February 27, 2013 11:23
Find cyryllic words
grep -r '[а-я]' * | grep -v '//' | grep -v '#' | grep -v ' \* ' | grep -v 'jscalendar' | egrep -o '^[^:]+' | grep -v '^\s' | grep -v 'Binary' | uniq -c | sort -nr | less
@feymartynov
feymartynov / find_images.sh
Last active December 28, 2015 12:29
find missing retina images
for img in `find -type f -name '*_*' ! -name '*@2x*'`; do test $(echo `basename $img | sed 's/\.[^\.]*$//'`@2x.`basename $img | sed 's/^.*\.//'` | xargs find `dirname $img` -type f -name | wc -l) -eq 0 && echo $img; done;
@feymartynov
feymartynov / debug_sphinxql.rb
Last active December 30, 2015 00:49
Debug SphinxQL query generaed by ThinkingSphinx
s = Product.search(query, options)
s.populate # => ThinkingSphinx::SyntaxError: sphinxql: syntax error, blah, blah...
# Let's see the SphinxQL query to find out what's wrong
s.context[:sphinxql].to_sql # => SELECT * FROM `product_core` WHERE ...
@feymartynov
feymartynov / console.rb
Last active January 4, 2016 19:19
how to render a template in the rails console
controller = MyController.new
controller.request = OpenStruct.new(:session => [])
controller.view_renderer.render(controller.view_context, :file => 'path/to/template', :locals => {})
@feymartynov
feymartynov / migration.md
Last active August 29, 2015 13:57
Migration of a git repository from bitbucket to github
  1. Add temporary github remote
git remote add github git@github.com:github_account_name/repository_name.git
  1. Push to github
git push github -u
@feymartynov
feymartynov / holywars.md
Created July 21, 2014 11:49
Holywars list
  • css-классы vs css_классы
  • sass vs scss
  • window.App vs хз как
  • css-свойства по алфавиту vs хз как
@feymartynov
feymartynov / listing.md
Last active August 29, 2015 14:04
elasticsearch trouble

Search country using russian query by all fields with prefix "name". Everything's ok.

➜ curl -XGET 'http://localhost:9200/geo/country/_search?pretty' -d '{ query: { multi_match: { fields: ["name*"], query: "Австрия" } } }'
{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
@feymartynov
feymartynov / example.rb
Created December 5, 2014 07:34
java constructor in jruby
class MyClass
java_signature 'MyClass MyClass(java.lang.String someParameter)'
def initialize(some_paramter)
# …
end
become_java!(false)
end
@feymartynov
feymartynov / gist:cee2b0f201779a3bb49f
Last active August 29, 2015 14:21
jruby-head issue
LoadError: load error: readline -- java.lang.NoClassDefFoundError: jline/console/completer/Completer
require at org/jruby/RubyKernel.java:941
block in require at /Users/fey/.rvm/gems/jruby-head@ep_core/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229
load_dependency at /Users/fey/.rvm/gems/jruby-head@ep_core/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:214
require at /Users/fey/.rvm/gems/jruby-head@ep_core/gems/activesupport-4.0.13/lib/active_support/dependencies.rb:229