Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
| ActiveAdmin.register NutritionData do | |
| menu false | |
| form do |f| | |
| f.inputs "Details" do | |
| f.input :item_id, :as => :hidden | |
| f.input :header, :input_html => {:rows => 5} | |
| f.input :serving, :input_html => {:rows => 5} | |
| f.input :calories | |
| f.input :calories_from_fat |
| class CreateProjects < ActiveRecord::Migration[5.0] | |
| def change | |
| create_table :projects do |t| | |
| t.string :name | |
| t.timestamps | |
| end | |
| end | |
| end |
Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
| # Fill in multiple form fields using a table. Use it as follows: | |
| # | |
| # When I fill in the fields | |
| # | Field 1 | Value 1 | | |
| # | Field 2 | Value 2 | | |
| When /^I fill in the fields$/ do |table| | |
| table.rows_hash.each {|field, value| fill_in field, :with => value } | |
| end |
| #!/usr/bin/env ruby | |
| require 'open-uri' | |
| require 'JSON' | |
| require 'digest/sha2' | |
| require 'pry' | |
| require 'bigdecimal' | |
| require 'bitcoin' # Because I need to cheat every now and then | |
| # Usage: | |
| # gem install pry json ffi ruby-bitcoin |
| extension Route { | |
| init<IN: Codable, OUT: Codable>(uri: String, _ handler: @escaping (IN) throws -> OUT) { | |
| self.init(method: .post, uri: uri) { | |
| req, resp in | |
| do { | |
| guard let body = req.postBodyBytes else { | |
| throw DecodingError.dataCorrupted(.init(codingPath: [], debugDescription: "This request requires JSON input.")) | |
| } | |
| let input = try JSONDecoder().decode(IN.self, from: Data(bytes: body)) | |
| resp.setBody(bytes: try JSONEncoder().encode(try handler(input)).map{$0}) |
| // | |
| // SimpleClient.swift | |
| // | |
| // Created by Sarp Solakoglu on 18/09/2017. | |
| // Copyright © 2017 Sarp Solakoglu. All rights reserved. | |
| // | |
| import Foundation | |
| enum RestMethod: String { |
| Development Phase: | |
| Step 1: Create Certificate .pem from Certificate .p12 | |
| Command: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12 | |
| Step 2: Create Key .pem from Key .p12 | |
| Command : openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12 | |
| Step 3: Optional (If you want to remove pass phrase asked in second step) | |
| Command : openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem |