Home
Wade Ruby
Cancel

Rails Rails8第一次使用

refer to:  gem install rails rails new test_xx 于是得到下面 igbanana@DESKTOP-4OEP3L0:/workspace/vulnhub.com/earth$ rails new test_earth create create README.md create Rakefile ...

Javascript Generatorfunction:yield,next

refer to: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function* 这个yield跟ruby中的完全不一样。 直接看例子: function *hi(i){ yield i; yield i + 30; yield i + 20; } 运行: l...

Reactjs 2.快速自动重启以及jsx

refer to: https://legacy.reactjs.org/docs/introducing-jsx.html 如何让reactjs项目在开发阶段自动识别代码改动? 1. 在项目根目录下增加 .env 文件 2. 该文件内容为: FAST_REFRESH=false 然后重启 ( yarn start) , 就会发现你做的任何改动(jsx, 修改 component等), ...

搞了一台搬瓦工vps注意优先购买香港jp的。

refer to: https://bandwagonhost.com/cn2gia-vps.php 被折磨了几天,没法访问外网就没法工作,github, python, ruby, 啥都需要外网。 所以参考了这个文章:https://www.vpsgo.com/bandwagonhost-jp-speedtest.html 感觉谁有CN2谁就是王道啊。果断选之~~~ 1. 注册 2. ...

Go Go中的interface,跟ruby的绝不一样。interface,struct,type

refer to: https://sanyuesha.com/2017/07/22/how-to-understand-go-interface/ 概念 跟java的很相似 更类似于ruby 中的struct type: go 中的所有类型,(int ,string, 复杂类型)都是type interface: type的一种,用来描述行为(包含多个方法),它的类型在编译时不确定,可...

在线转换curl命令为:wget,ruby,c,go

refer to: https://curlconverter.com/wget/ 太好玩了。 不但告诉你如何转换,还告诉你如何获得curl命令。。。很好啊

Rails 让对应的进程使用代理usehttpproxyinrailsapp

refer to: https://stackoverflow.com/questions/15792999/how-to-set-a-proxy-in-rubys-net-http 在terminal中,直接设置 http_proxy 变量就可以。(export HTTP_PROXY=...) 在rails中也一样。 1. export http_proxy=xx 2. rails s ...

Rails 一些地方(例如.order('xx')中),需要使用arel.sql('xx')语句

refer to: https://stackoverflow.com/questions/49887593/deprecation-warning-dangerous-query-method-method-whose-arguments-are-used-as Dangerous query method (method whose arguments are used as raw ...

Rails 让对应的进程使用代理usehttpproxyinrailsapp

refer to: https://stackoverflow.com/questions/15792999/how-to-set-a-proxy-in-rubys-net-http 在terminal中,直接设置 http_proxy 变量就可以。(export HTTP_PROXY=...) 在rails中也一样。 1. export http_proxy=xx 2. rails s ...

Vim 使用vim9+commandt,以及vimplugin

refer to: vim: https://github.com/vim/vim command-t: https://github.com/wincent/command-t#readme fuzzyfinder: https://github.com/junegunn/fzf.vim/ vim-plug: https://github.com/junegunn/vim-plug ...

Rails 一些地方(例如.order('xx')中),需要使用arel.sql('xx')语句

refer to: https://stackoverflow.com/questions/49887593/deprecation-warning-dangerous-query-method-method-whose-arguments-are-used-as Dangerous query method (method whose arguments are used as raw ...

Postman有的时候无法发送post表单的数据?普通表单,json内容

refer to: 例如,这个: 无论如何都是不行。 这么简单的问题,卡了我很久,我果断换成 ruby httparty . 就搞定了。 问题很诡异。 我也问在了:https://stackoverflow.com/questions/76145383/how-to-send-post-data-with-postman-regular-form-with-keys-value-...

Ruby Pagy与fast_page共同使用

refer to: https://github.com/planetscale/fast_page 在controller中: class controller.... def show pagy, collections = pagy( Student.all ) render json: { ... } end # 原封不动的复...

Mysql Toomanyconnections

refer to: https://www.thegeekdiary.com/mysql-error-too-many-connections-and-how-to-resolve-it/ This error is caused by mysql, but not rails config. check variable: max_connections: SHOW VARIAB...

Rails Mysql Utf8,utf8mb4:mysql2::error:incorrectstringvalueerror

refer to: https://stackoverflow.com/questions/22464011/mysql2error-incorrect-string-value 1. change your  database.yml: development: adapter: mysql2 database: db username: password:...

Blockchain 批量查询usdt余额的脚本

。。。。记录一下吧,好多年的事儿了。 # -*- encoding : utf-8 -*- require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rails' require 'rubygems' addresses = %w{ 1Nnsjg2t6HU7DGWtepFRDyr...

Rails Mysql Utf8,utf8mb4:mysql2::error:incorrectstringvalueerror

refer to: https://stackoverflow.com/questions/22464011/mysql2error-incorrect-string-value 1. change your  database.yml: development: adapter: mysql2 database: db username: password:...

Rails Rspec Factorygirl:createwithforeignrelation,useblock,notblock_id

例子,如果某个model对应的factory定义为: factory  :tx do   blockend block为一个独立的model,  tx belongs_to block 那么,在创建的该tx的时候,我们应该: create :tx, block: Block.new 不应该这样调用:   create :tx, bl...

Rails Rspec Factorygirl:createwithforeignrelation,useblock,notblock_id

例子,如果某个model对应的factory定义为: factory  :tx do   blockend block为一个独立的model,  tx belongs_to block 那么,在创建的该tx的时候,我们应该: create :tx, block: Block.new 不应该这样调用:   create :tx, bl...

Rails Datatoolongfortextfield,mysql

refer to: https://github.com/vinsol-spree-contrib/spree_themes/issues/26 issue description Mysql2::Error: Data too long for column 'nmap_result' at row 1 (ActiveRecord::ValueTooLong) from /home/s...