til's People
til's Issues
Use 16 384 instead of 16 000
Why?
-
16384 is a Power of Two
-
Currently, Power of Two are the only known Almost perfect numbers.
-
In Computer Science, Powers of two are beautiful numbers
Said by someone famous
-
Using Power of Two is make color, make you feel more pro
Selected powers of two(Hằng đẳng thức đáng nhớ)
- = 256:
The number of values represented by the 8 bits in a byte. - = 1 024:
The binary approximation of the kilo-, or 1,000 multiplier, which causes a change of prefix. For example: 1024 bytes = 1 kilobyte.
This number has no special significance to computers, but is important to humans because we make use of powers of ten. - = 4 096:
The hardware page size of an Intel x86-compatible processor. - = 32 768:
The number of non-negative values for a signed 16-bit integer. - ......
So?
- You need to partition your hard drive:
200Mb? No. Use 256Mb - You need define your password:
123123123? No. Use 18446744073709551616
Ref:
?
A service that inherit from BaseService should implement method call
Why?
- Adding Syntactic Sugar to Make Rails Service Objects Suck Less
-
If only there were precedence in Ruby for calling something and having it execute itself immediately with the given parameters… oh wait, there is! It’s
Proc#call
What's Proc#call
?
- Invokes the block, setting the block's parameters to the values in params using something close to method calling semantics. Returns the value of the last expression evaluated in the block.
- Note that
proc.()
invokesproc.call()
with the parameters given. It's syntactic sugar to hide “call”. - For procs created using
lambda
or ->()
an error is generated if the wrong number of parameters are passed to the proc. For procs created usingProc.new
orKernel.proc
, extra parameters are silently discarded and missing parameters are set tonil
.
Ref:
Ruby's Eigenclass
Rails Service Objects: A Comprehensive Guide
Proc#call
Gitlab Postgres Schema Design
Debian "stretch" was removed then image ruby 2.5.3 apt get error 404 while updating
- Issue while building docker image with
ruby:2.5.3
:
W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages 404 Not Found
E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages 404 Not Found
E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages 404 Not Found
- Root cause:
stretch
was removed from http://security.debian.org/debian-security/dists/ - Workaround:
Touchetc/apt/archive_sources.list
deb http://archive.debian.org/debian stretch main
deb http://archive.debian.org/debian-archive/debian-security stretch/updates main
Then:
FROM ruby:2.5.3 AS builder
COPY etc/apt/archive_sources.list /etc/apt/sources.list
Quintillion
1 quintillion is equal to 1000000000 billions
LGTM
Loods good to me
ActiveRecord caches attributes which causes problems when removing columns
Be sure to ignore the column
Add to models/model.rb
def self.columns super.reject { |c| ["<column_name>"].include?(c.name) } end
Ref: https://github.com/ankane/strong_migrations#removing-a-column
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.