Skip to content

Instantly share code, notes, and snippets.

View skatkov's full-sized avatar
🏠
Working from home

Stanislav (Stas) Katkov skatkov

🏠
Working from home
View GitHub Profile
@skatkov
skatkov / youtube.rb
Created July 11, 2012 02:28 — forked from jamieowen/youtube.rb
Octopress Youtube plugin...
module Jekyll
class Youtube < Liquid::Tag
@width = 640
@height = 390
def initialize(name, id, tokens)
super
@id = id
end
@skatkov
skatkov / bahtsold.rb
Created August 14, 2012 00:49
Parsing ads from bahtsold.com
#coding: utf-8
require 'wombat'
class BahtsoldCrawler
include Wombat::Crawler
base_url "http://www.bahtsold.com"
path "/en/results?category=7&ad_type=NULL&ar1=1006&c1=377&c2=NULL&6=NULL&price=2&co=Thailand-1"
document_format :html
@skatkov
skatkov / heroku_deploy.rake
Created October 17, 2012 21:31 — forked from michaeldwan/heroku_deploy.rake
Simple Rake task for customizing deployment to Heroku
# List of environments and their heroku git remotes
ENVIRONMENTS = {
:staging => 'myapp-staging',
:production => 'myapp-production'
}
namespace :deploy do
ENVIRONMENTS.keys.each do |env|
desc "Deploy to #{env}"
task env do
@skatkov
skatkov / spec_helper.rb
Created December 8, 2015 14:51
profiling rspec's with stackproof
# read here: http://blog.iempire.ru/2015/10/13/profiling-specs/
RSpec.configure do |config|
config.around(:each) do |example|
path = Rails.root.join("tmp/stackprof-cpu-test-#{example.full_description.parameterize}.dump")
StackProf.run(mode: :cpu, out: path.to_s) do
example.run
end
end
end
@skatkov
skatkov / untitled_.idea_ant.xml
Created February 5, 2013 17:25
Http parsing example for Ivan
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
</project>
<?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
<head>
<title>My feedly feeds</title>
</head>
<body>
<outline text="android">
<outline text="Android-er" htmlUrl="http://android-er.blogspot.com/" type="rss" xmlUrl="http://feeds.feedburner.com/Android-er?format=xml"/>
</outline>
@skatkov
skatkov / SmsService.java
Created July 22, 2013 15:26
SmsService...
package ee.era.geek.sms_spammer.service;
import android.app.Service;
import android.content.Intent;
import android.os.*;
import android.telephony.SmsManager;
import android.text.format.DateFormat;
import android.util.Log;
import ee.era.geek.sms_spammer.ConfigUtil;
class QuestionType
## This is a class to avoid database lookup for survey_question_types table
## replicate actual table :
# id => :name
DATA = {
3 => 'Rank order',
4 => 'Constant sum',
5 => 'Drop-down menu',
6 => 'Numeric Freeform Input',
7 => 'Comment Box',
@skatkov
skatkov / benchmark.rb
Created February 9, 2017 10:49
Testing immutable data structure called 'Values' -> https://github.com/tcrayford/values/
require 'ostruct'
require 'benchmark'
require 'values'
COUNT = 10_000_000
NAME = "Test Name"
EMAIL = "test@example.org"
class Person
attr_accessor :name, :email
@skatkov
skatkov / Gemfile
Created June 10, 2017 10:14
map bencmark
source 'https://rubygems.org'
ruby '2.4'
gem 'benchmark-ips'