This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.
Create a single Java main class in src/main/java/HelloWorld.java
:
import static spark.Spark.*;
import spark.*;
ids = [1,2,3] | |
def targs(*ids) | |
puts ids.length | |
puts ids.flatten.length | |
end | |
targs ids | |
#=> 1 | |
#=> 3 |
def destructure(method_name) | |
# Intercept the original class | |
meta_klass = class << self; self end | |
# Save the original method as a proc | |
method_proc = method(method_name) | |
# We only want to do this for keyword argument type | |
# methods | |
unless method_proc.parameters.all? { |t, _| t == :key } |
<div itemprop="image" data-picture="lazy" data-alt="Don't forget to change the alt text!"> | |
<div data-src="assets/images/example-s"></div> | |
<div data-src="assets/images/example-m" data-media="(min-width: 700px)"></div> | |
<div data-src="assets/images/example-l" data-media="(min-width: 1200px)"></div> | |
<noscript> | |
<img src="assets/images/example-s.jpg" alt="Don't forget to change the alt text!"> | |
</noscript> | |
</div> |
hash = { 'foo' => 'bar' } | |
# Version 1 | |
hash = Hash[hash.map { |k, v| [k.to_sym, v] }] | |
# Version 2 | |
hash = hash.reduce({}) do |memo, (k, v)| | |
memo.tap { |m| m[k.to_sym] = v } | |
end |
var animating = false; | |
// Define an animator consisting of optional incoming and outgoing animations. | |
// alwaysAnimate is false unless specified as true: false means an incoming animation will only trigger if an outgoing animation is also in progress. | |
// forcing dontClone to true means the outward animation will use the original element rather than a clone. This could improve performance by recycling elements, but can lead to trouble: clones have the advantage of being stripped of all event listeners. | |
function animator( incoming, outgoing, alwaysAnimate, dontClone ){ | |
// The resulting animator can be applied to any number of components | |
return function animate( x, y, z ){ | |
var config; | |
var parent; |
Calculating ------------------------------------- | |
type-safe users 273.000 i/100ms | |
ar user models 257.000 i/100ms | |
------------------------------------------------- | |
type-safe users 2.813k (± 1.7%) i/s - 14.196k | |
ar user models 2.574k (±10.7%) i/s - 12.850k | |
Comparison: | |
type-safe users: 2812.7 i/s | |
ar user models: 2574.2 i/s - 1.09x slower |
Dear Rubyists,
I just lost a contract because of my code in a Rails project.
The specific code in question is related to a "posting a comment" feature. Here are the details:
In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.
The "senior developer", whom is the stake holder's right hand man, said this:
sed -E -f solver.sed input
where input
is a file containing the maze.
For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p
.
The solver assumes the following:
# \nSE
S
) and end (E
)