Skip to content

Instantly share code, notes, and snippets.

View ixti's full-sized avatar
😂
forever blowing bubbles

Alexey Zapparov ixti

😂
forever blowing bubbles
View GitHub Profile
@ixti
ixti / 1-csv_import_job.rb
Created December 22, 2016 19:01
[SensorTower] [Tech Interview] CSV Import Job
class CsvImportJob
def perform!(options)
# ...
rescue
Logger.log "Well, there was en error"
LoggerMail.trigger(options.client, "Bad news")
end
end

Time after time, I guess that love is blind...

Although result of Fixnum#day, Fixnum#days, Fixnum#week, etc looks like a new Fixnum with seconds in given period it's actually not a Fixnum. Let's take a quick look that might lead us toward pretty wrong direction:

1.week.is_a? Fixnum         # => true
1.week.instance_of? Fixnum  # => true
1.week.class                # => Fixnum
@ixti
ixti / time_span.rb
Created February 18, 2016 18:48
TimeSpan formatter
class TimeSpan
MINUTE = 60
HOUR = 60 * MINUTE
DAY = 24 * HOUR
def initialize(time)
@span = time.to_i
end
def days

Keybase proof

I hereby claim:

  • I am ixti on github.
  • I am ixti (https://keybase.io/ixti) on keybase.
  • I have a public key whose fingerprint is 3C7B E119 8A22 1B2F DADE B46B AFBF 6FD0 DC38 0A8D

To claim this, I am signing this object:

diff --git a/config/default.yml b/config/default.yml
index d47f235..6440416 100644
--- a/config/default.yml
+++ b/config/default.yml
@@ -18,6 +18,8 @@ gatekeeper:
host: 127.0.0.1
starting_port: 4000
target: "127.0.0.1:6081"
+ api_key_header_name: "x-api-key"
+ api_key_param_name: "api_key"
#!/bin/sh
case "$1" in
3)
PATH="/home/ixti/.local/opt/mongodb-linux-x86_64-3.0.1/bin:$PATH"
MONGO_DB_PATH="/home/ixti/.local/var/mongodb-3"
echo "Starting MongoDB 3.0.1"
;;
require "benchmark/ips"
require "parslet"
module HTTP
class ContentType
class ParsletParser < ::Parslet::Parser
class CharList # :nodoc:
def initialize(list = nil)
@list = list || yield
end
@ixti
ixti / logs_parser.pl
Last active August 29, 2015 14:10
Simple apache logs parser and counter of calls
#!/usr/bin/perl
while (<>) {
if (/^[^"]+"([A-Z]+)\s([^"? ]+)[^"]*"\s(\d+)/) {
my $m = $1;
my $p = $2;
my $s = $3;
$p =~ s/^[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}$/{uuid}/;
require "benchmark/ips"
require "factory_girl"
require "fabrication"
require "mongo_mapper"
class Foo
include MongoMapper::Document
key :name
key :email
@ixti
ixti / sample.rb
Last active August 29, 2015 14:03
class GitHubPages
VERSION = 10
DEPENDENCIES = Dependency::Hell.new({
"jekyll" => "1.5.1",
"kramdown" => "1.3.1",
"liquid" => "2.5.5",
"maruku" => "0.7.0",
"rdiscount" => "2.1.7",
"redcarpet" => "2.3.0",