heroku pg:backups capture -a app-namecurl -o tmp/latest.dump `heroku pg:backups public-url -a app-name`pg_restore --verbose --clean --no-acl --no-owner -h localhost -d app-name tmp/latest.dump| event = { | |
| "level" => 99, | |
| "msgid" => "97bf040b.ba1078", | |
| "pid" => 21, | |
| "source" => "f7d04af7b740/node-red", | |
| "message" => { | |
| "res" => { | |
| "_res" => "[Circular]" | |
| }, | |
| "payload" => "[Circular]" |
| docker cp <containerId>:/file/path/within/container /host/path/target | |
| docker exec -u root -it <containerId> chown other:user -R /host/path/target |
| User.where(created_at: Time.current.beginning_of_day..Time.current.end_of_day).count |
| # starts a node project | |
| npm init | |
| # ecma6 transpiler | |
| npm install babel babel-cli babel-preset-es2015 --save | |
| # web server | |
| npm install express --save | |
| # test environment |
heroku pg:backups capture -a app-namecurl -o tmp/latest.dump `heroku pg:backups public-url -a app-name`pg_restore --verbose --clean --no-acl --no-owner -h localhost -d app-name tmp/latest.dump| # spec/support/active_model_serializers.rb | |
| # inspired by: https://sonjapeterson.github.io/2016/03/19/testing-serializers.html | |
| module SerializerSpecHelper | |
| def serialize(obj, opts = {}) | |
| serializer_class = opts.delete(:serializer_class) || "#{obj.class.name}Serializer".constantize | |
| serializer = serializer_class.send(:new, obj) | |
| serializer.serializable_hash.with_indifferent_access | |
| end | |
| end |
| # spec/support/elasticsearch.rb | |
| RSpec.configure do |config| | |
| config.before :each do | |
| stub_request(:any, /localhost:9200/).to_return(body: "<html>a webpage!</html>", status: 200) | |
| end | |
| end |
| # generate public/private keys using ssh-keygen | |
| ssh-keygen -t rsa | |
| # change the permissions of the .pem file so only the root user can read it | |
| chmod 400 amazon-generated-key.pem | |
| # copy the machine to the remote repository | |
| ssh-copy-id -i ~/.ssh/id_rsa.pub amazon-generated-key.pem ec2-user@amazon-instance-public-dns | |
| # or |
| str = ''' | |
| <input maxlength=\"1\" size=\"1\" onfocus=\"inputFieldFocus(this)\" onkeyup=\"autotab(this,1,event)\" class=\"screen_color_UNA screen_field \" value=\"\" name=\"IF_642\" type=\"text\"> 213.897.176 | |
| <input maxlength=\"1\" size=\"1\" onfocus=\"inputFieldFocus(this)\" onkeyup=\"autotab(this,1,event)\" class=\"screen_color_UNA screen_field \" value=\"\" name=\"IF_722\" type=\"text\"> 213.897.077 | |
| ''' | |
| str.gsub(/<input(.*?)"> /, '') | |
| # => "\n213.897.176\n213.897.077\n" |
| for i in `seq 50` ; do rspec spec -e User; [[ ! $? = 0 ]] && break ; done |