Ask for Help
*”Is there such a thing as an ActiveResourceModel, containing all the niceness of ActiveModel with an ActiveResource backend?”
Problems with ActiveResource include not being able to parse the output provided by the standard Rails to_json method on the other end. It is possible to change to_json‘s [] wrapping behavior globally via a Rails setting.
Or you can use HTTParty or the remote-object wrapper of your choice and roll your own happy path.
*”Has anyone installed
anton a CentOS box?”
Igor Kozachenko has.
*”Any good fixes for long-running DDOS attacks? Other than rejecting all requests from Moldova?”
Cloudflare may help, but it takes some time to get set up. You can also throw more caching proxies at it, such as Varnish
*”What happens with document.write calls from within external javascripts?”
Say I have a page that loads some script tags:
<head> <script src:"a.js"></script> <script src:"b.js"></script> <script src:"c.js"></script> </head>
a.js and b.js want to add additional script tags. I’d expect head to look like this after the page has loaded.
<head> <script src:"a.js"></script> <script src:"b.js"></script> <script src:"c.js"></script> <script src:"foo.js"></script> <script src:"bar.js"></script> </head> </code>
a.js:
(function() {
document.write('<script src="foo.js"></script>")
})();
b.js:
(function(){
var scriptTag = document.createElement('script');
scriptTag.setAttribute('src', "bar.js");
document.head.appendChild(scriptTag);
})();
Would it surprise anyone that foo.js never makes it into the DOM? But that bar.js is there every time? Where does document.write go?
Interesting things
- When setting a data-x attribute that contains a JSON-formatted string ( such as
'{a:1, b:2}'), retrieving that attribute value viajQuery.dataautomatically returns the evaluated JS object, not the JSON-formatted string. Surprise!