refer to: https://stackoverflow.com/questions/58065428/rails-vanilla-rails-6-0-error-command-webpack-not-found bundle exec rails webpacker:install
Ruby 终于给我的个人博客增加了粘贴图片的功能pasteimagefromclipboardtoblog
这个想法有了好几天了。 过去苦于增加图片的不方便,所以写博客的时候往往只能用纯文字,很不尽兴。 最近这个需求越发的旺盛,所以就想办法弄了一下。 核心的是使用了     http://siwei.me/blog/posts/javascript-html  也就是 clipboardData 这个变量。 不过由于我的个人博客基于 refine...
Rails Postgres中不能出现from,to,hash这样的特殊列
似乎原因是postgres不像mysql 这样可以在查询的时候把列明转义(加上  `column_name` 这样的) 所以 from,  to 是SQL 的关键字 hash是 ruby object的关键字。。(还是rails的。。不清楚了) 否则会出现莫名其妙的错误,例如 TypeError , 或者SQLError啥的,一通好猜。。。
Go 从ruby到go:使用golang Migrate来代替gorm的migrate
golang-migrate 跟rails 几乎一样。 安装 go get -u -d github.com/golang-migrate/migrate/cmd/migrate go get -u -d github.com/golang-migrate/migrate 上面2个二选一 cd ~/go/pkg/mod/github.com/golang-migrate/ cd ~/go/...
Go Fromrailstogo,gorm
gorm : gorm.io 特别超级非常简单 安装 2044 go get -u gorm.io/gorm 2045 go get -u gorm.io/driver/mysql 一段代码: package main import ( "gorm.io/gorm" "gorm.io/driver/mysql" "fmt" "time" ) type Book st...
Rails Sendemails,content,body,attachment附件
refer to: https://api.rubyonrails.org/classes/ActionMailer/Base.html class NotifierMailer < ApplicationMailer def welcome(recipient) attachments["free_book.pdf"] = File.read("path/to...
Ruby Faceplusplus识别身份证,ocr,idcard,faceid,
供以后参考。 值得一提的是,就使用curl 来提交文件即可。不要使用 restclient 等ruby第三方包。因为发现这些都对post 请求支持的不好。对添加附件支持的不好。 代码如下: def check_id_card options id_card_approval = options[:id_card_approval] type = options[:type] i...
Vuejs 使用.sync间接实现对于props的父子组件通讯的双向绑定
参考:https://cn.vuejs.org/v2/guide/components-custom-events.html#sync-%E4%BF%AE%E9%A5%B0%E7%AC%A6 与:http://siwei.me/blog/posts/vuejs-props-vuejs-parent-child-communicate .sync 不能直接实现 props的双向绑定, vu...
Rails Activerecord的模型中,不能用hash作为列名字
如题。否则会报错 Type error,  can not convert String to Integer 
Vuejs 使用分页element Uipagination
参考:https://stackoverflow.com/questions/64604714/vue-pagination-how-to-use-it/67154639#67154639 element-ui  : https://element.eleme.cn/#/zh-CN/component/pagination vuejs 是一个前端,所以这决定了它的分页跟R...
Rails Rails中的默认嵌套transactionnestedtransaction 结论:begin界限从最外层开始。只有一层
最精准的答案见:https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html 结论:只有一层,就是最外层,里面出错了,外面跟着一起回滚。(我最喜欢) 如果希望外面的transaction不要跟着里面回滚,就参考这个:https://stackoverflow.com/questions/3394...
Ruby 关于ethereum的相关资源(主要是abi哈哈)
最近这里了解的比较多,说一下几个gem: ruby-eth: 挺好的。 就是作者有些保守,不太愿意merge ethereum.rb  不咋地,给它这个评价的主要原因是他基本不支持RPC的 payable/nonpayable调用,只支持有限的 view/pure方法调用。 宝藏资源;(早点用它好了) ruby-ethereum   https://github...
Metasploit 使用自定义的module
metasploit 是用ruby写的。 所以本质上就是如何把自定义的module放进去。 kali下的默认位置; /usr/share/metasploit-framework/ 进来,可以发现有module文件夹,里面都是 各个cve 等漏洞的 exploit  可以放在 ~/.msf4/modules目录下, 也可以放在默认安装路径下。  我们以 cve-...
Blockchain Ruby Stringtohextoascii,pack(h*),unpack(h*)
梦回大学 计算机组成原理: bit  最小单位, 0 , 1 组成 , 比特。 byte = 8 bit , 字节。       a , b, c  等是一个字节,  汉字是两个字节 例如,字母a , 在ascii 表中,对应十进制的 97, 16进制的61, 那么 0x61 转换成 二进制,就是&#...
Mysql 继续处理大数据量的精简hugedata
从下面可以看到各种结果集的数量 mysql> select count(*) from orders where state = 200; +-----------+ | count(*) | +-----------+ | 194544642 | +-----------+ 1 row in set (1 min 12.58 sec) mysql> select cou...
Node 使用electronvue来创建桌面应用
参考: https://github.com/SimulatedGREG/electron-vue 个人感觉 electron跟 rubymotion, titanium, react等跨平台编程很像, 用js代码来实现跨平台的功能. 代码特别好懂.  但是不同平台的特性和实现有差异(例如 底部通知窗口 等等) electron 用的是 chromium来渲染HTML页面 ele...
Ruby 与nodejs中的buffer等同的ruby语句
我把答案放在了 https://stackoverflow.com/questions/70660339/what-is-the-equivalent-of-nodejs-buffer-in-ruby Buffer.from("abc") 这个会返回一个数组, 例如  [22,23,24] , 分别对应字母  a,b,c Buffer.from("0x01a2", "he...
Bitcoin 查询usdt余额的脚本
如下: ENV['RAILS_ENV'] = ARGV.first || ENV['RAILS_ENV'] || 'production' require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rails' require 'rubygems' require 'rufus/s...
Ruby 使用puma5,以及配置文件详解
前些日子被内存泄露困扰,使用了一些办法。突然发现puma的版本用的还是3.x,  果断切换到最新的5.1.1 配置具体参考: https://github.com/puma/puma/blob/master/lib/puma/dsl.rb 看的时候,直接看方法定义即可。 例如 worker 1 的意思是啥,直接看上面 dsl.rb 的 def worker 方法即可。...
Ruby Rspec显示完整出错信息showfullerrorbacktrace
1. 配置 spec_helper: RSpec.configure do |config| # 增加这一行 config.full_backtrace = true ... 2. 需要在命令后面加上 --backtrace