instead of
desc 'some endpoint', {
headers: { Authorization: {
description: 'Bearer JWT',
required: true
}
}}
get do| require 'nokogiri' | |
| require 'open-uri' | |
| 50.times do | |
| page = Nokogiri::HTML(open("http://www.matrix67.com/ideagen/")) | |
| word = page.css('body .main p').children[0].to_s.gsub("\r",'').gsub("\n",'').gsub("\t",'').split('的')[1] | |
| File.open('words','a'){ |file| file.write(word+"\n") } | |
| end |
| #!/bin/bash | |
| # https://stackoverflow.com/questions/28900078/upload-multi-file-from-linux-folder-to-azure-blob-storage | |
| export AZURE_STORAGE_ACCOUNT='your_account' | |
| export AZURE_STORAGE_ACCESS_KEY='your_access_key' | |
| export container_name='name_of_the_container_to_create' | |
| export source_folder=~/path_to_local_file_to_upload/* |
| azure storage cors set -a [-beep-] -k [-beep-] --blob --cors "[{\"AllowedOrigins\":\"http://foo.bar.com, http://127.0.0.1:1234\",\"AllowedMethods\":\"GET\",\"MaxAgeInSeconds\":\"86400\",\"AllowedHeaders\":\"*\",\"ExposedHeaders\":\"*\"}]" |
| class PatchSimulatingMiddleware | |
| def initialize app | |
| @app = app | |
| end | |
| def call env | |
| request = Rack::Request.new(env) | |
| if request.post? && ( request.params['_name'] == 'patch' ) | |
| request.set_header 'REQUEST_METHOD', 'PATCH' |
| class PatchSimulatingMiddleware | |
| def initialize app | |
| @app = app | |
| end | |
| def call env | |
| request = Rack::Request.new(env) | |
| if request.post? && ( request.params['_name'] == 'patch' ) | |
| request.set_header 'REQUEST_METHOD', 'PATCH' |
| ``` | |
| yarn add select2 | |
| ``` | |
| # /javascript/stylesheets/active_admin.scss | |
| ``` | |
| @import 'select2/dist/css/select2'; | |
| ``` | |
| # /javascript/active_admin.js |
| # ruby | |
| sudo apt install ruby ruby-dev | |
| # env and path | |
| export GEM_HOME=$HOME/.gem/ | |
| PATH="/home/ubuntu/.gem/bin:$PATH" |
instead of
desc 'some endpoint', {
headers: { Authorization: {
description: 'Bearer JWT',
required: true
}
}}
get do