Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
This project is dead. It was something I made years ago with friends when we were still not great programmers. It was never a good idea, but it was fun to write none the less. This is still up because I see no reason to take it down, and I occasionally use this repo as a test repo on other projects.
Tablinate is a ruby gem that takes arrays of hashes, ActiveRecord::Relation objects, or a JSON array of hashes, and converts them into html tables. It is intended for use in small projects or applications whose schemas are closely related to standard table formats.
gem install tablinate
require 'sinatra'
require 'tablinate'
get '/' do
@employees = [
{ :id => '1', :first_name => "Matt", :last_name => "Smith", :title => "Time Lord" },
{ :id => '2', :first_name => "Jack", :last_name => "Harkness", :title => "Time Agent" },
{ :id => '3', :first_name => "Tom", :last_name => "Baker", :title => "Time Lord" },
{ :id => '4', :first_name => "David", :last_name => "Tennant", :title => "Time Lord" },
{ :id => '5', :first_name => "Christopher", :last_name => "Eccleston", :title => "Time Lord" }
]
haml :index
end
%body
= @employees.tablinate()
<body>
<table>
<thead>
<tr>
<th>id</th>
<th>first_name</th>
<th>last_name</th>
<th>title</th>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Matt</td>
<td>Smith</td>
<td>Time Lord</td>
</tr>
<tr>
<td>2</td>
<td>Jack</td>
<td>Harkness</td>
<td>Time Agent</td>
</tr>
<tr>
<td>3</td>
<td>Tom</td>
<td>Baker</td>
<td>Time Lord</td>
</tr>
<tr>
<td>4</td>
<td>David</td>
<td>Tennant</td>
<td>Time Lord</td>
</tr>
<tr>
<td>5</td>
<td>Christopher</td>
<td>Eccleston</td>
<td>Time Lord</td>
</tr>
</tbody>
</table>
</body>
Because it uses normal html markup, tablinated tables are easily styled using CSS, Sass, etc. That being said, tablinate is configurable via an options hash. The hash can style the table or add classes to it. For example:
%body
=@employees.tablinate( { :table => { :border => 1, :class => 'fluid' }, :tbody => { :class => 'foo' } } )
<body>
<table border='1' class='fluid'>
<thead>
<tr>
<th>id</th>
<th>first_name</th>
<th>last_name</th>
<th>title</th>
</thead>
<tbody class='foo'>
<tr>
<td>1</td>
<td>Matt</td>
...
...
Options are highly expandable, and support many useful notations. For example:
@table_params = {
:table => { :class => "table" },
:tbody => {
:tr => { :class => [ 'class1', 'class2', 'class3' ], :id => 'meow' },
:td => { :class => 'row', :id => [1,2,3] }
}
}
@table = [
{ :column1 => 'value1', :column2 => 'value2', :column3 => 'value3' },
{ :column1 => 'value1', :column2 => 'value2', :column3 => 'value3' },
{ :column1 => 'value1', :column2 => 'value2', :column3 => 'value3' },
{ :column1 => 'value1', :column2 => 'value2', :column3 => 'value3' }
]
@table.tablinate(@table_params)
<table class='table'>
<thead>
<tr>
<th>column1</th>
<th>column2</th>
<th>column3</th>
</tr>
</thead>
<tbody>
<tr class='class1' id='meow'>
<td class='row' id='1'>value1</td>
<td class='row' id='2'>value2</td>
<td class='row' id='3'>value3</td>
</tr>
<tr class='class2' id='meow'>
<td class='row' id='1'>value1</td>
<td class='row' id='2'>value2</td>
<td class='row' id='3'>value3</td>
</tr>
<tr class='class3' id='meow'>
<td class='row' id='1'>value1</td>
<td class='row' id='2'>value2</td>
<td class='row' id='3'>value3</td>
</tr>
<tr class='class1' id='meow'>
<td class='row' id='1'>value1</td>
<td class='row' id='2'>value2</td>
<td class='row' id='3'>value3</td>
</tr>
</tbody>
</table>
When using haml, you may need to unescape html tags by:
%body
!= [ { ... }, ... ].tablinate(...)
FAQs
Unknown package
We found that tablinate 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.