{panel:title=НазваниеМодели|titleBGColor=#4A90E2|bgColor=#FAFAFA|titleColor=#FFFFFF}
Тут информация
{panel}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DrinkHabit < Habit | |
# DB structure | |
# id:integer | |
# title:text | |
# food_amount:integer | |
# drink_time:datetime | |
# type: string | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def humanize_minutes(minutes_number) | |
case minutes_number | |
when 0 then "" | |
when 30 then "тридцати минут" | |
else | |
"неверное количество минут" | |
end | |
end | |
def humanize_hour(hour_number) |
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:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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' |
NewerOlder