Skip to content

Instantly share code, notes, and snippets.

View ElasticSearch
# curl 'localhost:9200/global_search/_search?q=M1&pretty'
# curl -XPOST 'localhost:9200/global_search/_search?pretty' -d '
# {
# "query": {
# "match": {
# "_all": "M1"
# }
# }
# }'
View hsopify-script-tag-gallery
View .gitconfig
[user]
name = Orban Botond
email = orbanbotond@gmail.com
[core]
editor = subl -n -w
excludesfile = /Users/orbanbotond/.gitignore_global
[github]
user = orbanbotond
token = xxx
[push]
View .gitignore_global
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
View gist:5d429b8792a27086c816
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
time_ago_in_words: function(from) {
View junk traff
p = Project.find 1
p.shared_at = nil
p.create_mode!
p.end_sharing = false
p.save
View chewy usage
[["Cseva", ["csevapcsicse"]], ["Cseva", ["masik", "cseva"]], ["Masik", ["harmadik"]], ["Egyik", ["masik"]]]
SearchIndex.delete!
SearchIndex.reset!
SearchIndex.purge!
res = SearchIndex.filter(term: {account_id: 1}).query( multi_match: { query: 'masik', fields: ['name', 'descriptions']})
res.to_a
a = Subscribem::Account.find 1
r = Recipe.scoped_to(a).first
t = r.tasks.first
View erb2slim
gem install haml
gem install hpricot
gem install ruby_parser
gem install haml2slim
gem install html2slim
erb2slim -h
View Rspec noun-phrase
be_odd
be_an
be_done
be_an_ufo calls ufo?
an_object_eq_to
an_object_having_attributes
a_string_starting_with
a_string_ending_with
a_string_matching
a_value
View double_spy_mocks.rb
#---
# Excerpted from "Rails 4 Test Prescriptions",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material,
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose.
# Visit http://www.pragmaticprogrammer.com/titles/nrtest2 for more book information.
#---
require 'rails_helper'