select f.id, f.file_name, p->'trade_name' as trade_name, m->'cin_add' as cin_add
from frac_reports f, jsonb_array_elements((f.data->>'products')::jsonb) p,
jsonb_array_elements(p->'materials') m
where f.id = 65933
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
| class Option < ActiveRecord::Base | |
| validates :key , :presence => {:message => '<span style= "color: red">Es necesario este Campo</span>'} | |
| validates :key, :uniqueness => { :message => '<span style= "color: red">Ya se establecio el valor de este parametro.</span>'} | |
| enum prime: [:no,:yes] | |
| enum quote: [:quote_1] | |
| VALUES_BY_DEFAULT = %w(shopping_cart_default_value | |
| shopping_cart_max_value | |
| minimun_weight_product | |
| limit_quantity_product | |
| maximun_number_product_cart |
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
| # web/services/messaging_service.ex | |
| defmodule Publit.MessagingService do | |
| @moduledoc """ | |
| Service to send notifications to the user | |
| """ | |
| @message_api Application.get_env(:publit, :message_api) | |
| def status_code(resp) do | |
| {_s, msg} = resp | |
| {:error, msg} |
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 Registration do | |
| defstruct [:email, :password, :name, :category, :address] | |
| @type t :: %RegistrationService{ | |
| email: String.t, | |
| password: String.t, | |
| name: String.t, | |
| category: String.t, | |
| address: String.t | |
| } |
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
| var casper = require('casper').create(); | |
| var url = 'http://apps.ohiodnr.gov/oilgas/rbdmsreports/Downloads_PermitAndPlug.aspx'; | |
| casper.userAgent("Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"); | |
| casper.start(url); | |
| casper.then(function(arg) { | |
| //this.capture('a.png', {top: 100, left: 100, width: 700, height: 500}); | |
| this.fillSelectors('#aspnetForm', { | |
| '#ctl00_ContentPlaceholder1_rdp_ApplicationIssuedStart_dateInput': '12/1/2014', |
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 Brote.Ledger do | |
| @moduledoc """ | |
| This is the module where most of the transactions happen | |
| """ | |
| use Brote.Web, :model | |
| import Ecto.Query | |
| alias Brote.{Category, Contact, Payment, Organization, Ledger, Repo} | |
| @derive {Poison.Encoder, only: [:id, :amount, :balance, :date, :contact_id, :category_id, :description, :currency, |
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
| alias Cart.{Repo, Item, Invoice, InvoiceItem} | |
| Repo.insert(%Item{name: "Chocolates", price: Decimal.new("5")}) | |
| Repo.insert(%Item{name: "Gum", price: Decimal.new("2.5")}) | |
| Repo.insert(%Item{name: "Milk", price: Decimal.new("1.5")}) | |
| Repo.insert(%Item{name: "Rice", price: Decimal.new("2")}) | |
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 Bonsai.Payment do | |
| use Bonsai.Web, :model | |
| alias Bonsai.{User, Ledger, Repo} | |
| @zero Decimal.new(0) | |
| @primary_key {:id, :binary_id, autogenerate: true} | |
| embedded_schema do | |
| field :amount, :decimal | |
| field :date, Ecto.Date |
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
| class UserSession | |
| class << self | |
| attr_reader :user | |
| delegate :id, :email, to: :user | |
| # Stores using de application_controller the current_user for devise | |
| def user=(usr) | |
| raise 'You must pass a User class' unless usr.is_a?(User) | |
| @user = usr | |
| end |
mix new ecto_tut --module EctoTut
* creating README.md
* creating .gitignore
* creating mix.exs
* creating config
* creating config/config.exs
* creating lib
* creating lib/ecto_tut.ex