Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
// WARNING:此脚本仅做学习和演示用途,在不了解其用途前不建议使用 | |
// 本脚本的用途是将输入内容分页,每次提取一页内容,编辑第二条消息,发送,然后收集结果 | |
// 使用前,需要有两条消息,参考模板 https://chat.openai.com/share/17195108-30c2-4c62-8d59-980ca645f111 | |
// 演示视频: https://www.bilibili.com/video/BV1tp4y1c7ME/?vd_source=e71f65cbc40a72fce570b20ffcb28b22 | |
// | |
(function (fullText) { | |
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
const groupSentences = (fullText, maxCharecters = 2800) => { | |
const sentences = fullText.split("\n").filter((line) => line.trim().length > 0); |
class MarchingSquares | |
STATE = { "0000" => :r, "1100" => :r, "0011" => :l, "1110" => :r, | |
"0100" => :r, "1000" => :u, "1011" => :u, "1001" => :u, | |
"0101" => :d, "1010" => :u, "0111" => :l, "0110" => :l, | |
"0001" => :d, "0010" => :l, "1101" => :d, "1111" => :r } | |
def self.find_shape(grid, w, h) | |
edge_pos = grid.index('1') | |
return nil if edge_pos.nil? |
#include "marching-squares.hh" | |
#include "point.hh" | |
#include "polygon.hh" | |
#include "douglas-peucker.hh" | |
#include <ps/canvas/canvas.hh> | |
#include <cstring> | |
#include <vector> |
#No such file to load -- devise/confirmations_controller | |
#resque worker devise not eager loading | |
require File.expand_path('../config/application', __FILE__) | |
require 'rake/dsl_definition' | |
require 'resque/tasks' | |
Askjane::Application.load_tasks | |
task "resque:setup" => :environment do |
Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST
requests with voice file encoded in FLAC format, and query parameters for control.
client
The client's name you're connecting from. For spoofing purposes, let's use chromium
lang
Speech language, for example, ar-QA
for Qatari Arabic, or en-US
for U.S. English