{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
# Check for an interactive session | |
[ -z "$PS1" ] && return | |
alias ls='ls --color=auto' | |
PS1='[\u@\h \W]\$ ' | |
bash_prompt() { | |
local NONE="\[\033[0m\]" # unsets color to term's fg color | |
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) | |
} |
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 | |
)) |
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
convert "$1" -bordercolor white -border 1x1 \ | |
-alpha set -channel RGBA -fuzz 20% \ | |
-fill none -floodfill +0+0 white \ | |
-shave 1x1 $2 |
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' |
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 Handlers | |
constructor: -> | |
@handlers = {} | |
register: (handler, registered_class) -> | |
@handlers[handler] = registered_class | |
instantiate: (handlers, element) -> | |
handlers = handlers.replace(/\s/g, '').split(',') | |
element.handlers = [] |
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
# Sends reminders to issue assignees | |
# Available options: | |
# * :days => how many days in the future to remind about (defaults to 7) | |
# * :tracker => id of tracker for filtering issues (defaults to all trackers) | |
# * :project => id or identifier of project to process (defaults to all projects) | |
# * :users => array of user ids who should be reminded | |
def self.reminders(options={}) | |
days = options[:days] || 7 | |
project = options[:project] ? Project.find(options[:project]) : nil | |
tracker = options[:tracker] ? Tracker.find(options[:tracker]) : nil |
NewerOlder