A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
A clean workaround for running capybara tests on Rails with assets pipeline enabled.
Original: teamcapybara/capybara#500 (comment)
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
table { | |
font-family: "Helvetica", "Lucida Sans", "Lucida Sans Unicode", "Luxi Sans", Tahoma, sans-serif; | |
box-shadow: 1px 1px 10px rgba(0,0,0,0.5); | |
border-collapse: collapse; | |
border-spacing: 0; | |
} | |
table { |
Clients.addMessage(message); | |
Others.addMessage(message); // Does not exist yet | |
Clients[group].addMessage(message); | |
Clients[Context.ConnectionId].addMessage(message); | |
IClientProxy proxy = Clients; | |
proxy.Invoke("addMessage", message); | |
IClientProxy proxy1 = Clients[group]; | |
proxy1.Invoke("addMessage", message); |
Too much for teh twitterz :)
JVM + invokedynamic is in a completely different class than CLR + DLR, for the same reasons that JVM is in a different class than CLR to begin with.
CLR can only do its optimization up-front, before executing code. This is a large part of the reason why C# is designed the way it is: methods are non-virtual by default so they can be statically inlined, types can be specified as value-based so their allocation can be elided, and so on. But even with those language features CLR simply cannot optimize code to the level of a good, warmed-up JVM.
The JVM, on the other hand, optimizes and reoptimizes code while it runs. Regardless of whether methods are virtual/interface-dispatched, whether objects are transient, whether exception-handling is used heavily...the JVM sees through the surface and optimizes code appropriate for how it actually runs. This gives it optimization opportunities that CLR will never have without adding a comparable profiling JIT.
So how does this affect dynamic
public class AutofacApiDependencyResolver : AutofacDependencyScope, IDependencyResolver | |
{ | |
private readonly ILifetimeScope _container; | |
public AutofacApiDependencyResolver(ILifetimeScope container) : base(container) | |
{ | |
_container = container; | |
} | |
public IDependencyScope BeginScope() |
The MIT License
Copyright (c) 2012 Aaron Powell
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWA
// register a command | |
Commands.register("login", { | |
url: "/login", | |
type: "POST" | |
}); | |
// later in the application, get the command |
<Types> | |
<Type> | |
<Name>System.String</Name> | |
<Members> | |
<ScriptProperty> | |
<Name>ToBase64</Name> | |
<GetScriptBlock> | |
[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($this)) | |
</GetScriptBlock> | |
</ScriptProperty> |
<Target Name="AfterBuild"> | |
<CallTarget Targets="MinifyJs" /> | |
</Target> | |
<PropertyGroup> | |
<AjaxMin>"C:\Program Files (x86)\Microsoft\Microsoft Ajax Minifier\AjaxMin.exe"</AjaxMin> | |
</PropertyGroup> | |
<Target Name="MinifyJs"> | |
<ItemGroup> |