Skip to content

Instantly share code, notes, and snippets.

@orbanbotond
orbanbotond / gist:46ded4d84a6de0a2401b8be22d9bfb29
Last active March 9, 2024 18:44
Data Driven vs Event Driven
# Data Driven Code
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
=> 0
irb(main):002> boti_pontszama +1
=> 1
irb(main):003> gergo_pontszama = 0
=> 0
irb(main):004> gergo_pontszama += 1
=> 1
irb(main):005> boti_pontszama += 1
@orbanbotond
orbanbotond / ruby event store read write.rb
Created October 15, 2022 08:41
Ruby Event Store Read Write Example
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)
`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
# 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
# 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
@orbanbotond
orbanbotond / .gitconfig
Created April 19, 2017 10:15
.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
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
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
p = Project.find 1
p.shared_at = nil
p.create_mode!
p.end_sharing = false
p.save