
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
rqrcode-with-patches
Advanced tools
I have republished this gem as rqrcode-with-patches as Duncan seams to have abandoned the project. You can find the original project here: http://github.com/whomwah/rqrcode
0.6.0 (Jun 2, 2015)
0.5.5 (Apr 25, 2015)
rQRCode is a library for encoding QR Codes in Ruby. It has a simple interface with all the standard qrcode options. It was adapted from the Javascript library by Kazuhiko Arase.
Let's clear up some rQRCode stuff.
You may get the latest stable version from Rubygems.
gem install rqrcode-with-patches
You can also get the latest source from https://github.com/bjornblomqvist/rqrcode
git clone git://github.com/bjornblomqvist/rqrcode.git
To run the tests:
$ rake
You have installed the gem already, yeah?
require 'rubygems'
require 'rqrcode'
qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
puts qr.to_s
#
# Prints:
# xxxxxxx x x x x x xx xxxxxxx
# x x xxx xxxxxx xxx x x
# x xxx x xxxxx x xx x xxx x
# ... etc
@qr = RQRCode::QRCode.new( 'my string to generate', :size => 4, :level => :h )
<style type="text/css">
table {
border-width: 0;
border-style: none;
border-color: #0000ff;
border-collapse: collapse;
}
td {
border-width: 0;
border-style: none;
border-color: #0000ff;
border-collapse: collapse;
padding: 0;
margin: 0;
width: 10px;
height: 10px;
}
td.black { background-color: #000; }
td.white { background-color: #fff; }
</style>
<%= raw @qr.as_html %>
If you want to generate the HTML manually for customization, you can start with the following:
<table>
<% @qr.modules.each_index do |x| %>
<tr>
<% @qr.modules.each_index do |y| %>
<% if @qr.dark?(x,y) %>
<td class="black"/>
<% else %>
<td class="white"/>
<% end %>
<% end %>
</tr>
<% end %>
</table>
You can also require optional export features:
Example to render png:
require 'rqrcode/export/png'
image = RQRCode::QRCode.new("nice qr").as_png
Notice the 'as_png'. Same goes for 'as_svg', 'as_xxx'.
Exporters support these options:
SVG Export supports the parameter module_size
to generate smaller or larger QR Codes
require 'rqrcode/export/svg'
svg = RQRCode::QRCode.new("nice qr").as_svg(:module_size => 6)
Original author: Duncan Robertson
Special thanks to the following people for submitting patches:
MIT License (http://www.opensource.org/licenses/mit-license.html)
FAQs
Unknown package
We found that rqrcode-with-patches demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.