Tuesday, December 3, 2013

Get a style's value in Dojo.

If you make "dojo/dom-style" match up to domStyle at the AMD define signature, you could do the following with domStyle:

var tallness = domStyle.get(this.whatever, "height");

!include "sections\end.nsi"

...may be used in an .nsi file in NSIS to include the guts of another .nsi file.

I'm guessing $SMPROGRAMS is a global variable in NSIS.

One typically defines variables like so:

!define PLACEINSTARTMENU "$SMPROGRAMS\${MYOTHERVARIABLE}"

 
 

This suggests that $SMPROGRAMS will just be available however. I guess there is a difference between a dollar sign followed by letters and a dollar sign followed by letters in curly brackets. Oh, boy... Installer! :P

 
 

Addendum: "environmental variable" is probably a better way to describe $SMPROGRAMS in lieu of: "global variable"

Monday, December 2, 2013

Sunday, December 1, 2013

Cast a string to an array of characters in JavaScript by splitting on nothing.

function updateScore(increment) {
   game.score = game.score + increment;
   var numberArray = (game.score + "").split("");
   var htmlForScore = "";
   numberArray.forEach(function (number) {
      htmlForScore = htmlForScore + "<li style=\"background-image: url('score_" +
            number + ".png');\"></li>";
   });
   $('#whatever ul').html(htmlForScore);
}

Saturday, November 30, 2013

You have to go out of your way to get keydown logic to work in JavaScript within Firefox.

$(function() {
   document.onkeydown = function() {
      switch (window.event.keyCode) {
         case 37:
            if (whatever) {

 
 

Per this the blob above had to be refactored into the blob below. What is above accomodated IE 10, Chrome, and Safari. What is below accomodates IE 10, Chrome, Safari, and now Firefox too.

$(function() {
   document.onkeydown = function(event) {
      var key;
      if (window.event) {
         key = window.event.keyCode;
      } else {
         key = event.which;
      }
      switch (key) {
         case 37:
            if (whatever) {