Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
opal
Advanced tools
Readme
Use Ruby on Node.js for REAL-WORLD rofl-SCALING
Run with opal-node app.rb
or run the repl: opal-node-irb
Install with NPM: npm install -g opal
or via RVM: rvm install opal
# app.rb
require 'http/server'
HTTP::Server.start 3000 do
[200, {'Content-Type' => 'text/plain'}, ["Hello World!\n"]]
end
This is the original Node.js example:
// the original nodejs example
http = require('http')
var port = process.env.port || 1337;
http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(port);
Here's the (naïve) rack-like implementation of http/server.rb
# http/server.rb
module HTTP
`_http = require('http')`
class Server < `_http.Server`
alias_native :listen, :listen
def self.start port, &block
server = new `function(request, response) {
request.on('end', function(chunk) {
var rackResponse = #{ block.call(`request`, `response`) };
response.writeHead(rackResponse[0], #{ `rackResponse[1]`.to_native });
response.end( rackResponse[2].join(' ') );
})
}`
server.listen(port)
server
end
end
end
A simple Express.js wrapper example can be found in examples/express-wrapper.rb
Express.new do
get '/' do |req, res|
res.send 200, 'hulla!'
end
end.listen 3000
Start a coffee watcher to keep opal.js in sync with opal.coffee
coffee -cwo lib/ lib/*.coffee
NODE_PATH="$NODE_PATH:../lib/" node ./bin/opal-node
NODE_PATH="$NODE_PATH:../lib/" node ./bin/opal-node-irb
To keep the specs running while developing just install and use spectator
that will compile opal.coffee
to opal.js
before every run of the spec.
$ gem install spectator
$ gem install notify # to get notification
$ spectator
--- Waiting for changes...
This project rocks and uses MIT-LICENSE.
FAQs
CoffeeScript was so cool
The npm package opal receives a total of 55 weekly downloads. As such, opal popularity was classified as not popular.
We found that opal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.