Skip to content

Instantly share code, notes, and snippets.

View drakmail's full-sized avatar
🇦🇷
Working

Alex Maslov drakmail

🇦🇷
Working
View GitHub Profile
@drakmail
drakmail / example.jsx
Last active April 10, 2019 11:24
Modal Manager
import React, { Component } from 'react'
import { Alert } from '@blueprintjs/core'
import ModalManager from './modalManager'
class Example extends Component {
handle = (modal) => async () => {
const result = await modal.result()
alert(result)
}
@drakmail
drakmail / jira.md
Last active November 22, 2023 18:34
Красивое оформление задач в JIRA

Панель для модели

panel-model

{panel:title=НазваниеМодели|titleBGColor=#4A90E2|bgColor=#FAFAFA|titleColor=#FFFFFF}
Тут информация
{panel}
@drakmail
drakmail / Rails cheatsheet.textile
Created March 29, 2018 14:09 — forked from ingmarsk/Rails cheatsheet
Rails cheatsheet

rails s (start server)
rails console
rake about (app desc)
rake db:schema:dump (connecto db & export schema)
rake db:migrate:status
rake db:migrate (apply migrations to db)
rake db:migrate VERSION=0 (rollback)
rake db:migrate:(up/down/redo) VERSION=
rake db:seed (populate db with test data from seeds.rb)
rake db:rollback (rollback the migration)

@drakmail
drakmail / drink_habit.rb
Created February 20, 2016 18:34
STI example
class DrinkHabit < Habit
# DB structure
# id:integer
# title:text
# food_amount:integer
# drink_time:datetime
# type: string
end
@drakmail
drakmail / example.rb
Created December 11, 2015 07:37
Bulk update example in ActiveRecord Rails
new_values = { 10 => "test1", 20 => "test2" }
value = new_values.map { |product_id, value| "(#{product_id}, #{value})" }.join(",")
ActiveRecord::Base.connection.execute(%(
UPDATE products AS p SET value = v.value
FROM (values #{values}) AS v(id, value)
WHERE p.id = v.id
))
@drakmail
drakmail / наброски.md
Created May 1, 2015 09:46
Наброски ТЗ

Список основных блоков и их назначение

1. Верхнее меню

Статическое меню с захардкоженными ссылками, будет размещено от 3 до 6 ссылок.

2. Кнопка перехода в корзину

Также, должна содержать количество товаров в корзине на текущий момент

@drakmail
drakmail / humanize.rb
Created April 24, 2015 12:23
humanize.rb
def humanize_minutes(minutes_number)
case minutes_number
when 0 then ""
when 30 then "тридцати минут"
else
"неверное количество минут"
end
end
def humanize_hour(hour_number)

Keybase proof

I hereby claim:

  • I am drakmail on github.
  • I am drakmail (https://keybase.io/drakmail) on keybase.
  • I have a public key whose fingerprint is EE35 9967 F65A 4C60 5CD1 8783 F680 A320 2E71 2256

To claim this, I am signing this object:

import os, sys
#Fix for passenger
INTERP = "/var/www/neroslavsky/data/python/bin/python" # путь к интерпретатору питона, удобно использовать virtualenv
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)
sys.path.append(os.getcwd())
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YOUAPP.settings_production") # заменить на название приложения
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'parallel_assets_compiler'
s.version = '0.3'
s.platform = Gem::Platform::RUBY
s.author = 'Jørgen Orehøj Erichsen, Alexander Maslov'
s.email = 'joe@erichsen.net, drakmail@gmail.com'
s.summary = 'Compile assets in parallel'
s.description = 'Compile assets in parallel to speed up deployment'