This file contains hidden or 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
| <?php | |
| namespace yii\db; | |
| class Migration extends \yii\db\MigrationBase | |
| { | |
| const DIRECTION_UP = 'up'; | |
| const DIRECTION_DOWN = 'down'; |
This file contains hidden or 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
| <?php | |
| public function loadFixture($tableName) | |
| { | |
| $fileName=$this->basePath.DIRECTORY_SEPARATOR.$tableName.'.php'; | |
| if(!is_file($fileName)) | |
| return false; | |
| $rows=array(); | |
| $schema=$this->getDbConnection()->getSchema(); | |
| $builder=$schema->getCommandBuilder(); |
This file contains hidden or 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
| public function init() | |
| { | |
| parent::init(); | |
| $this->basePath = Yii::getAlias($this->basePath); | |
| if (!is_dir($this->basePath)) { | |
| throw new InvalidConfigException("The directory does not exist: {$this->basePath}"); | |
| } elseif (!is_writable($this->basePath)) { | |
| throw new InvalidConfigException("The directory is not writable by the Web process: {$this->basePath}"); | |
| } else { | |
| $this->basePath = realpath($this->basePath); |
This file contains hidden or 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
| namespace('App.data') | |
| ### | |
| Meteor pagination class | |
| Usage | |
| UsersController = RouteController.extend | |
| waitOn: -> | |
| @page = @params.query.page || 1 | |
| @pagination = new App.data.Pagination(Users, selector, {page: @page}) |
This file contains hidden or 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
| defmodule App.UploadManager.Behavior do | |
| @doc """ | |
| Check if file exists | |
| """ | |
| @callback exists?(String.t) :: :ok | {:error, String.t} | |
| @doc """ | |
| Save file to storage | |
| """ |
This file contains hidden or 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
| defmodule App.UploadManager.Local do | |
| @behaviour App.UploadManager.Behavior | |
| @config Application.get_env(:app, :file_manager)[:local] | |
| @doc """ | |
| Check if file exists | |
| """ | |
| def exists?(destination) do | |
| destination = build_path(destination) |
This file contains hidden or 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
| defmodule App.UploadManager.S3 do | |
| @behaviour App.UploadManager.Behavior | |
| @config Application.get_env(:App, :file_manager)[:s3] | |
| alias ExAws.S3 | |
| @doc """ | |
| Check if file exists on S3 bucket |
This file contains hidden or 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
| defmodule App.Repo.Migrations.CreateImage do | |
| use Ecto.Migration | |
| def change do | |
| create table(:images) do | |
| add :type, :string, null: false | |
| add :path, :string, null: false | |
| add :mime, :string | |
| add :size, :integer | |
| add :width, :integer |
This file contains hidden or 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
| defmodule App.Image do | |
| use App.Web, :model | |
| alias App.Image | |
| alias App.Repo | |
| schema "images" do | |
| field :type, :string | |
| field :path, :string | |
| field :mime, :string |
This file contains hidden or 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
| defmodule App.Pact do | |
| @moduledoc """ | |
| Application registry container | |
| """ | |
| use Pact | |
| case Mix.env do | |
| :dev -> | |
| register "upload_manager", App.UploadManager.S3 |
OlderNewer