javascript
Nothing to display jet.
Nothing to display jet.
for(var i=0; i<googletag.debug_log.H.length; i++) {
console.debug(googletag.debug_log.H[i]);
}

Really cool jelly game #js implementation:
6 levels: http://martine.github.com/jelly/
20 levels: http://avorobey.github.com/jelly/
"There's no such thing as a zero-cost abstraction." -Rein Henrichs
I am sure there are lots of strong opinions floating about regarding what a good #buildautomation tool should look like.
There are many camps; however, I will talk about the two extremes: More...
Lots of suggestions out there for implementing an infinite scrolling that works for all the major browsers, but of all the code snippets that I found there wasn't a single one that would work for Chrome, Firefox and IE8. So I set out to do a little hands-on research and after some trial-and-error this is the code that works for me: Read on
Starting with version 1.7 of jQuery the live() function is deprecated.
As many of you already know, the live() function is used to associate event listeners to some DOM element. For example: Read on
Just wrap your inputs with <div data-max-values="3">...</div> and add the following #js
$('div[data-max-values]').on 'change :checkbox', ->
condition = $(':checked', @).length >= Number($(@).data('max-values'))
$(':not(:checked)', @).prop 'disabled', condition
$('div[data-max-values]').each (i, e) ->
$(':checkbox:first', e).trigger('change')
Easily find out how much money you've spent on #uber with this #javascript #hack More under the cut
What will we do until Xmas? Of course we will prepare for it!
Let's print Xmas tree by your favourite language!
All winners will get a present ;) More under the cut
var divs = document.querySelectorAll('div');
Array.from(divs).forEach(function (node) {
console.log(node);
});
var divs = document.querySelectorAll('div');
[].forEach.call(divs, function (node) {
console.log(node);
});
Manually parsing year, month, day and week day. More under the cut
Yet another javascript quiz task. Do not hurt your brain too much :-) More under the cut
If you wanna use your class not only in defined context but wherever your should just add @ to class name.
class @Foo
constructor: ->
# ...
It produces #js like: More under the cut
Javascript allows simple "hashmapping" like the one under the cut. I wonder if this is still an ordinary js object and what specifications define it - for instance, not all "properties" of such "object" can be accessed by the dot notation. examples
What is best way to compile javascripts, that included in runtime?
While scripts included like this way in may JS file:
$.include('<%= javascript_path 'some.js' %>')
$.include('<%= javascript_path 'some.other.minified.js' %>')
I has this error:
ActionView::Template::Error (some.js isn't precompiled)
Dirty way to avoid this is add ["*.js"] to config.assets.precompile .
Does exist any more clean way to do this?
Proof that javascript doesn't do block scoping. :)
http://nickpoorman.tumblr.com/post/34661256934/javascript-doesnt-do-block-scoping
fs = require("fs");
try {
var config = JSON.parse(""+fs.readFileSync("config.json"));
} catch (ex) {
console.log('got an error: %s', ex);
process.exit(1);
}
console.log(config);
just feel difference
for n in i.dateTimeFields
- k["#{n}DateTime"] = ko.computed
- read : -> k[n]()
- write: (val) -> if Date.parse(val) then k[n](val) else k[n]("")
+ do (n) ->
+ k["#{n}DateTime"] = ko.computed
+ read : -> k[n]()
+ write: (val) -> if Date.parse(val) then k[n](val) else k[n]("")
Finally found how to rebind best_in_place editor. (Unbind is pretty simple - $(elem).unbind('click')).
editor = $(elem).data().bestInPlaceEditor;
$(elem).bind("click", {editor: editor }, editor.clickHandler );
That's all - best_in_place works with this element again. Hope that helps.
When I saw that my select boxes began to contains 500 options I said :omg: and started looking the solution.
Solution is using autocomplete.
I use #select2 plugin for big select boxes. It has a lot of features and native autocomplete! More under the cut
Found an inspiring presentation about it at #speakerdeck with examples written in #js and #ruby, benchmarks for speeding up tests:
https://speakerdeck.com/u/bkeepers/p/why-our-code-smells
As you can see we have a new button "Preview" on the new post page.
I wonder to know how to do it right with #js frameworks.
Here is current code: More under the cut
This example showcases how to have an onload function fire off for HTML elements who are already loading More under the cut
Chosen produce a search field with autocomplete and helps to find option. Look at screen shotes
Working with #canvas requires having a reference to context in order to draw something:
<canvas id="canvas" width="100" height="100"/>
var context = document.getElementById("canvas").getContext("2d")