##0. Mass Assignment
-
Mass assignment allows us to set a bunch of attributes at once:
attrs = { :first => "John", :last => "Doe", :email => "[email protected]"} user = User.new(attrs)
##0. Mass Assignment
Mass assignment allows us to set a bunch of attributes at once:
attrs = { :first => "John", :last => "Doe",
:email => "[email protected]"}
user = User.new(attrs)
#!/usr/bin/env ruby | |
require "optparse" | |
require "fileutils" | |
options = {} | |
current_work_dir = ::File.expand_path(::File.dirname(__FILE__)) | |
current_date_time = Time.now.strftime("%Y%m%d-%H%M") | |
OptionParser.new do |opts| |
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""Update SSH config file from AutoScaling groups | |
Author: NamNV609 | |
Copyright: 2022, NamNV609 | |
Homepage: https://github.com/namnv609 | |
""" |
When you have multiple branches need to rebase with same a branch. You need to switch to each branch and rebase it. This script help you to automate switch and rebase with each branch with main branch (auto get or you can passing it into first argument)
./git-bulk-rebase.sh <main branch>
error_page 500 /500.html; | |
location /500.html{ | |
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}'; | |
} | |
error_page 502 /502.html; | |
location /502.html{ | |
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}'; | |
} |
/** | |
* Name: CSP Report Log | |
* Description: Write Content-Security-Policy header log to Google Spreadsheet | |
* Author: NamNV609 <[email protected]> | |
* Homepage: https://github.com/namnv609 | |
* License: MIT | |
*/ | |
const SHEET_NAME = "<Sheet Name>"; | |
const SCRIPT_PROP = PropertiesService.getScriptProperties(); |
String.prototype.rJust = function(padLen, padStr) { | |
return (new Array(padLen).join(padStr) + this.valueOf()).slice(-padLen); | |
}; | |
String.prototype.lJust = function(padLen, padStr) { | |
return (this.valueOf() + new Array(padLen).join(padStr)).substring(0, padLen); | |
}; | |
/** | |
* > "6969".lJust(10, "0") |