This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
class RingBuffer < Array | |
attr_reader :max_size | |
def initialize(max_size, enum = nil) | |
@max_size = max_size | |
enum.each { |e| self << e } if enum | |
end | |
def <<(el) | |
if self.size < @max_size || @max_size.nil? |
package com.paddypower.financials.market.management.rest.logging; | |
import java.io.BufferedReader; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import javax.servlet.Filter; | |
import javax.servlet.FilterChain; |
//- templated by jade | |
svg(width=640 height=480 style="background-color:grey;") | |
circle( | |
cx=30 cy=30 | |
r=25 | |
stroke="grey" stroke-width=1 | |
fill="wheat") | |
rect( | |
width=50 height=50 | |
x=60 y=10 |
# curl -Lk https://gist.githubusercontent.com/prabirshrestha/279d8b179d9353fe8694/raw/.bash_profile -o ~/.bash_profile | |
[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh # This loads NVM | |
export PATH="$HOME/.cargo/bin:$HOME/go/bin:$HOME/Library/Python/3.7/bin:$PATH" | |
export PATH="$HOME/.config/nvim/plugins/vim-themis/bin:$PATH" | |
stty -ixon | |
alias pbcopy='xsel --clipboard --input' | |
alias pbpaste='xsel --clipboard --output' |
# Example of using Ruby as the command interpreter for GNU Make | |
# Set shell to ruby... | |
SHELL:=ruby | |
# ...and implicitly pass `-e` (Ruby's "eval" option) prior to the | |
# command string. | |
.SHELLFLAGS:=-e | |
# Tell GNU Make to use a single shell process for all lines in a given recipe. |
package demo; | |
import static java.lang.reflect.Modifier.*; | |
import java.util.Arrays; | |
import java.util.Set; | |
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.beans.factory.config.BeanExpressionResolver; |
# Other syntax without patch | |
STUDENT_LEVELS = { | |
freshman: Student::Underclassman, | |
sophomore: Student::Underclassman, | |
junior: Student::Upperclassman, | |
senior: Student::Upperclassman, | |
graduate: Student::Graduate | |
}.tap { |h| h.default = Student::Unregistered } | |
Hello software developers,
Please check your code to ensure you're not making one of the following mistakes related to cryptography.