Skip to content

Instantly share code, notes, and snippets.

alert("It's work");
var doc = fl.getDocumentDOM();
fl.outputPanel.clear();
fl.trace(doc.name);
fl.trace("saving...");
doc.save();
fl.trace("publishing...");
@andriyha
andriyha / show_size_of_mysql_tables.sql
Last active February 18, 2017 20:56
show size of mysql tables
SELECT table_schema "database_name", sum( data_length + index_length )/1024/1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema;
@andriyha
andriyha / Main.as
Created June 9, 2016 11:28
test garbage collecting
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.system.System;
import flash.utils.Dictionary;
public class Main extends Sprite {
private var _dictionary:Dictionary = new Dictionary(true);
public function Main() {
task :up do
update_items = [
[ "src", "fl", "engine/src/fl" ],
[ "tools", "FlashExporter*.air", "exporter/distrib/*.air" ],
[ "html/js", "pixi", "engine/html/js/pixi" ],
[ "typings", "pixi.js", "engine/typings/pixi.js" ],
]
src_list = [
"../flashtml",

Polymorphic Associations reversed

It's pretty easy to do polymorphic associations in Rails: A Picture can belong to either a BlogPost or an Article. But what if you need the relationship the other way around? A Picture, a Text and a Video can belong to an Article, and that article can find all media by calling @article.media

This example shows how to create an ArticleElement join model that handles the polymorphic relationship. To add fields that are common to all polymorphic models, add fields to the join model.

uk:
errors:
messages:
expired: "прострочено, створіть новий"
not_found: "не знайдено"
already_confirmed: "вже було підтверджено, спробуйте увійти"
not_locked: "не було заблоковано"
not_saved:
one: "Виникла помилка, через яку неможливо зберегти зміни:"
other: "Виникли помилки (загалом - %{count}), через які неможливо зберегти зміни:"
uk:
formtastic:
yes: Так
no: Ні
create: Створити %{model}
update: Оновити %{model}
submit: Відправити %{model}
cancel: Скасувати %{model}
reset: Reset %{model}
required: вимагається