Skip to main content

Home/ javascript/ Group items tagged loop

Rss Feed Group items tagged

anonymous

janl/mustache.js - GitHub - 0 views

  •  
    Mustache is a logic-less template syntax. It can be used for HTML, config files, source code - anything. It works by expanding tags in a template using values provided in a hash or object. We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values.
Javier Neira

Google Closure: How not to write JavaScript - 3 views

  • “It’s a JavaScript library written by Java developers who clearly don’t get JavaScript.”
  • Unfortunately, unlike the built-in properties supplied by Object.prototype, custom properties added to Object.prototype will show up as an object property in any for-in loop in the page.
  • custom properties added to
  • ...3 more annotations...
  • will show up as an object property in any
  • loop in the page.
  • var a = "I am a string!";   2 alert(typeof a); // Will output "string"   3 var b = new String("I am also a string!");   4 alert(typeof b); // Will output "object" 
Ivan Pavlov

Monads on the Cheap I: The Maybe Monad at Oliver Steele - 0 views

  • What about the case where most products don’t have offerings, or the offerings don’t have merchants, vel cetera? If this were a frequent case, and this were inner-loop code, I might introduce a global empty object in order to reduce the object instantiation overhead (which happens right away) and the GC load (which shows up over time). E.g. define var $N={}, and use: var product = ..., merchantName = (((product||$N).offering||$N).merchant||$N).name; if (merchantName) displayMerchantName(merchantName);
Mike Chelen

Data scraping with YQL and jQuery | kelvinluck.com - 0 views

  • need a list of all the US National Parks in XML format
  • grab the data from this list on Wikipedia
  • navigating a HTML DOM
  • ...9 more annotations...
  • jQuery to parse the data
  • XPath to your YQL
  • relevant table from the Wikipedia document
  • SELECT * FROM html WHERE url="http://en.wikipedia.org/wiki/List_of_United_States_National_Parks_by_state" AND xpath="//table[@class='wikitable sortable']"
  • XML or JSON
  • creating an XML document
  • AJAX call from jQuery and then loop over the JSON
  • documentation could maybe be clearer
  • CSS style selection engine as well as the XPath one
1 - 5 of 5
Showing 20 items per page