Skip to content

Instantly share code, notes, and snippets.

View fteem's full-sized avatar

Ilija Eftimov fteem

View GitHub Profile
Date of entry What I did
2023-12-15 Led the incident remediation of incident Lorem Ipsum, effectively identifying the root cause and mitigating the incident with a forward fix. Handed over the ownership to the Payments team for completion.
2023-12-04 Shipped a new email notification for potentially dormant users.
2023-11-20 I am in the company's top 5% of all interviewers by the number of interviews conducted in Q3 of 2023!
SENTENCES = [
'The raspberry is the edible fruit of a multitude of plant species in the genus Rubus of the rose family, most of which are in the subgenus Idaeobatus',
'The name also applies to these plants themselves',
'Raspberries are perennial with woody stems',
'World production of raspberries in 2020 was 895,771 tonnes, led by Russia with 20% of the total',
'A raspberry is an aggregate fruit, developing from the numerous distinct carpels of a single flower',
'What distinguishes the raspberry from its blackberry relatives is whether or not the torus (receptacle or stem) "picks with" (ie, stays with) the fruit',
'When picking a blackberry fruit, the torus stays with the fruit',
'With a raspberry, the torus remains on the plant, leaving a hollow core in the raspberry fruit',
'Raspberries are grown for the fresh fruit market and for commercial processing into individually quick frozen (IQF) fruit, purée, juice, or as dried fruit used in a variety of grocery products such as raspberry pie',
Randomizer.configure do |config|
config.from = 100
config.to = 200
end
@fteem
fteem / lfu.go
Created February 26, 2019 22:26
Code example for the article "When to use Least Frequenty Used cache and how to implement it in Golang" https://ieftimov.com/golang-least-frequently-used-cache
package main
import (
"container/list"
"fmt"
)
type CacheItem struct {
key string // Key of item
value interface{} // Value of item
describe ".send_surveys" do
it "sends those users an email with survey" do
SurveySender.should_receive(:unsurveyed_users).and_return [user, user2]
SurveyMailer.should_receive(:send_survey).with(user).and_return mailer = double(:mailer)
mailer.should_receive(:deliver)
user.should_receive(:email)
Rails.logger.should_receive(:info)
12.1.32. RENAME DATABASE Syntax
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23. It was intended to enable upgrading pre-5.1 databases to use the encoding implemented in 5.1 for mapping database names to database directory names (see Section 8.2.3, “Mapping of Identifiers to File Names”). However, use of this statement could result in loss of database contents, which is why it was removed. Do not use RENAME DATABASE in earlier versions in which it is present.
12.1.32. RENAME DATABASE Syntax
RENAME {DATABASE | SCHEMA} db_name TO new_db_name;
This statement was added in MySQL 5.1.7 but was found to be dangerous and was removed in MySQL 5.1.23. It was intended to enable upgrading pre-5.1 databases to use the encoding implemented in 5.1 for mapping database names to database directory names (see Section 8.2.3, “Mapping of Identifiers to File Names”). However, use of this statement could result in loss of database contents, which is why it was removed. Do not use RENAME DATABASE in earlier versions in which it is present.
To perform the task of upgrading database names with the new encoding, use ALTER DATABASE db_name UPGRADE DATA DIRECTORY NAME instead (see Section 12.1.1, “ALTER DATABASE Syntax”).
mysqldump -u username -p -v olddatabase > olddbdump.sql
mysqladmin -u username -p create newdatabase
mysql -u username -p newdatabase < olddbdump.sql
@fteem
fteem / sequel_example.rb
Created December 3, 2011 02:18
a gist of sequel
require "rubygems"
require "sequel"
# connect to an in-memory database
DB = Sequel.sqlite
# create an items table
DB.create_table :items do
primary_key :id
String :name
@fteem
fteem / ar-dm
Created December 1, 2011 17:19
activerecord vs datamapper
ActiveRecord Terminology DataMapper Terminology
has_many has n
has_one has 1
belongs_to belongs_to
has_and_belongs_to_many has n, :things, :through => Resource
has_many :association, :through => Model has n, :things, :through => :model