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
<div class="field-unit__label"> | |
<%= f.label field.attribute %> | |
</div> | |
<div class="field-unit__field"> | |
<%= f.hidden_field field.attribute, id: field.attribute %> | |
<trix-editor input="<%= field.attribute %>"></trix-editor> | |
</div> | |
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
has_one_attached :image | |
validate :image_type | |
private | |
def image_type | |
if image.attached? == false | |
errors.add(:image, "is missing!") | |
end |
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
test: | |
service: Disk | |
root: <%= Rails.root.join("tmp/storage") %> | |
local: | |
service: Disk | |
root: <%= Rails.root.join("storage") %> | |
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) | |
# amazon: |
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
<div class="field"> | |
<%= form.label :image %> | |
<%= form.file_field :image %> | |
</div> |
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
# This migration comes from active_storage (originally 20170806125915) | |
class CreateActiveStorageTables < ActiveRecord::Migration[5.2] | |
def change | |
create_table :active_storage_blobs do |t| | |
t.string :key, null: false | |
t.string :filename, null: false | |
t.string :content_type | |
t.text :metadata | |
t.bigint :byte_size, null: false | |
t.string :checksum, null: false |
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
require 'iota' | |
# With remote PoW | |
client = IOTA::Client.new(provider: 'https://node.iota-tangle.io:14265') | |
# If you use `client.api.attachToTangle` api here, you'll get error saying that attachToTangle command is not allowed | |
# With local pow | |
client = IOTA::Client.new(provider: 'https://node.iota-tangle.io:14265', local_pow: true) | |
# Now you can use `client.api.attachToTangle` api, which will do the proof-of-work on transaction and return the trytes that needs to be broadcasted |
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
const converter = require('@iota/converter') | |
converter.trytesToAscii(transaction.signatureMessageFragment) |
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
async function verifyData(data) { | |
// return false if the object has no signature | |
if (!data.sig) { | |
return false; | |
} | |
else { | |
// save the signature and delite it from the object | |
const signature = data.sig; |
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
async function signData(data) { | |
// deletes old sig attribute, if existing | |
delete data.sig; | |
// convert obj to json | |
const json = JSON.stringify(data); | |
// load file with private key | |
const file = await util.promisify(fs.readFile)(path.join(privKeyFile)); |
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
import React, { Component } from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import SendButton from './components/SendButton' | |
import IOTA from 'iota.lib.js' | |
class App extends Component { | |
constructor(props) { |