Skip to content

Instantly share code, notes, and snippets.

View markevich's full-sized avatar

Slava Markevich markevich

  • Georgia, Tbilisi
  • 13:03 (UTC +04:00)
View GitHub Profile
@markevich
markevich / steam_deck_russian_locale_enabler.sh
Last active March 9, 2023 15:39 — forked from XargonWan/japanese_locale_enabler.sh
Enable Russian locale on Steam Deck
#!/bin/bash
# This script is enabling (uncommenting) the Russian locale and regenerates them
sudo steamos-readonly disable
sudo pacman-key --init
sudo pacman-key --populate archlinux
sudo pacman -S glibc
sudo sed -i "s%#ru_RU.UTF-8 UTF-8%ru_RU.UTF-8 UTF-8%" /etc/locale.gen
sudo locale-gen

Keybase proof

I hereby claim:

  • I am markevich on github.
  • I am markevich (https://keybase.io/markevich) on keybase.
  • I have a public key ASASoVOdpZwWiojXuSpm7fV94WxFcgQ67v_w2q9GMhybHQo

To claim this, I am signing this object:

@markevich
markevich / swagger.json
Last active April 13, 2017 12:08
swagger
{"info":{"title":"API title","version":"0.0.1"},"swagger":"2.0","produces":["application/xml","application/json"],"securityDefinitions":{"api_key":{"type":"apiKey","name":"api_key","in":"query"}},"security":[{"api_key":[]}],"host":"localhost:3000","tags":[{"name":"api","description":"Operations about apis"}],"paths":{"/api/client/v1/users/{id}":{"get":{"summary":"Get user info by ID","description":"Get user info by ID","produces":["application/json"],"parameters":[{"in":"path","name":"id","description":"User ID","type":"integer","format":"int32","required":true}],"responses":{"200":{"description":"Get user info by ID","schema":{"$ref":"#/definitions/User"}}},"tags":["api"],"operationId":"getApiClientV1UsersId"}},"/api/vendor/v1/users/{id}":{"get":{"summary":"Get user info by ID","description":"Get user info by ID","produces":["application/json"],"parameters":[{"in":"path","name":"id","description":"User ID","type":"integer","format":"int32","required":true}],"responses":{"200":{"description":"Get user info by
@markevich
markevich / data.yml
Last active July 13, 2016 09:00
Weedlist storefront data
- id: 71274
title: ALL MOONROCKS BOGO GRAM @ $25!!!
body: BOGO GRAM @ $25 ON ALL MOONROCKS ALL DAY!!!
coupon_type: daily
discount_type: bogo
discount_amount:
distance:
value: 7.330996145791065
units: mi
url: "/deals#/709926"
@markevich
markevich / elixir_sips.exs
Last active August 29, 2015 14:25 — forked from sheharyarn/elixir_sips.exs
Download videos from ElixirSips.com
defmodule Episode do
defstruct id: nil, name: nil, video: nil, markdown: nil, post: nil
def get_all do
[
%Episode{id: "001", post: "271", name: "Introduction and Installing Elixir", video: "1366", markdown: "1382"},
%Episode{id: "002", post: "275", name: "Basic Elixir", video: "1367", markdown: "1357"},
%Episode{id: "003", post: "280", name: "Pattern Matching", video: "14879", markdown: "1413"},
%Episode{id: "004", post: "284", name: "Functions", video: "5086", markdown: "1559"},
%Episode{id: "005", post: "298", name: "Mix and Modules", video: "5087", markdown: "1654"},

3D CSS Sphere

3D ball made with just some CSS 3D transforms, border-radius and border-style. Not really useful, it just looks nice...

A Pen on CodePen.

License.

require 'yaml'
desc "Generates database.yml, optional arguments are allowed: [username, password, adapter, project_path]"
task :dbconfig => 'database.yml'
file 'database.yml', [:username, :password, :adapter, :project_path] do |t, args|
Dir.chdir('config')
args.with_defaults(:project_path => Dir.pwd)
DBConfigGenerator.new(t, args).generate
end
$ rails g model switchable_plan origin:references replacement:references 'switch_plan_fee:decimal{15,2}'
# app/models/switchable_plan.rb
class SwitchablePlan < ActiveRecord::Base
belongs_to :origin
belongs_to :replacement
end
# db/migrate/20131128082637_create_switchable_plans.rb
class CreateSwitchablePlans < ActiveRecord::Migration
@markevich
markevich / gist:7228804
Created October 30, 2013 08:10
Show activerecord validation errors in log
# model
after_validation :log_errors, :if => Proc.new {|m| m.errors}
def log_errors
Rails.logger.debug self.errors.full_messages.join("\n")
end
# This custom matcher can be used to test state machine
#
# Examples
#
# transition = OpenStruct.new(:name => :operation1, :state_field => :status, :from => :state1, :to => :state2)
# it { should have_transition(transition) }
#
# transition = {:name => :operation2, :state_field => :status, :from => :state2, :to => :state3}
# it { should have_transition(transition) }
RSpec::Matchers.define :have_transition do |transition|