Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
orbanbotond / ruby event store read write.rb
Created October 15, 2022 08:41
Ruby Event Store Read Write Example
View ruby event store read write.rb
require 'bundler/setup'
Bundler.require
class EventStore < SimpleDelegator
def self.in_memory
new(
RubyEventStore::Client.new(
repository: RubyEventStore::InMemoryRepository.new
)
)
@orbanbotond
orbanbotond / gist:d5b2ff96e12f9ce7d3bbb7fee8289c30
Last active January 9, 2022 09:37
Matematika exercise queez (HU)
View gist:d5b2ff96e12f9ce7d3bbb7fee8289c30
`say -v Mariska "Szia, Az Én nevem Maja, téged, hogy hívnak?"`
nev = gets
`say -v Mariska "Szia #{nev}, örülök, hogy bemutatkoztunk egymásnak. Most egy kevés matematikát fogunk gyakorolni játékosan"`
`say -v Mariska "A matematika ugyanis megnyitja a lehetőségeket minden irányba."`
`say -v Mariska "Hány darab feladatot szeretnél megoldani?"`
number_of_exercises = gets.to_i
number_of_exercises.times do |index|
str = "Az #{index + 1} feladat"
@orbanbotond
orbanbotond / kids_programming_ruby
Last active December 24, 2021 13:54
kids programming ruby
View kids_programming_ruby
# szamolos programkod:
(1..101).each do |i|
`say -v Mariska #{i}`
end
`say -v Mariska Itt a vége, fuss el véle!`
# a vegtelen tortenet inditomondata:
`say -v Mariska Már éjfélre járt az idő a feneketlen nagy erdőben amikor írtó nagy zaj verte fel az erdő csendjét`
# szorakozas kulonbozo helyzetekkel:
@orbanbotond
orbanbotond / ElasticSearch
Created July 19, 2017 09:46
ElasticSearch
View ElasticSearch
# curl 'localhost:9200/global_search/_search?q=M1&pretty'
# curl -XPOST 'localhost:9200/global_search/_search?pretty' -d '
# {
# "query": {
# "match": {
# "_all": "M1"
# }
# }
# }'
@orbanbotond
orbanbotond / hsopify-script-tag-gallery
Created June 25, 2017 11:05
Shopify Remote Script Tag
View hsopify-script-tag-gallery
@orbanbotond
orbanbotond / .gitconfig
Created April 19, 2017 10:15
.gitconfig
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]
@orbanbotond
orbanbotond / .gitignore_global
Created February 10, 2017 22:19
gitignore_global
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) {
@orbanbotond
orbanbotond / junk traff
Created August 10, 2015 10:23
junk traff
View junk traff
p = Project.find 1
p.shared_at = nil
p.create_mode!
p.end_sharing = false
p.save
@orbanbotond
orbanbotond / chewy usage
Last active August 29, 2015 14:16
chewy usage
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