JavaScript version of var_dump

[et_pb_section admin_label=”section”][et_pb_row admin_label=”row”][et_pb_column type=”4_4″][et_pb_text admin_label=”Text” background_layout=”light” text_orientation=”left” use_border_color=”off” border_color=”#ffffff” border_style=”solid”]

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
  alert(out);
}
</script>

// or, if you wanted to avoid alerts and var_dump() on the page…

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
var pre = document.createElement('pre');
  pre.innerHTML = out;
  document.body.appendChild(pre)
}
</script>

// or var_dump() to the console…

<script>
function dump(obj) {
  var out = '';
  for (var i in obj) {
    out += i + ": " + obj[i] + "\n";
  }
  console.log(out);
}
</script>

 

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]

Let’s make the web faster – Google Code

Let’s make the web faster – Google Code.

Some choice excerpts:

CSS: Using every declaration just once

Using every CSS declaration only once is an effective way to reduce file size of style sheets. It’s not a trivial optimization technique though: Watch over the cascade and adjust your editing workflow.

HTTP caching

Web pages can load much faster on repeated visits if the resources come from the cache. Learn about two groups of HTTP headers that make all the difference.

Optimizing web graphics

Optimizing your web illustrations, icons, and graphics is one of the simplest yet most effective ways to decrease your page load time. In this tutorial, we discuss image file formats and optimize some real Google graphics for faster download on the web.

Farbtastic: jQuery color picker plug-in | Steven Wittens – Acko.net

Farbtastic Color Picker widgetFarbtastic is a jQuery plug-in that can add one or more color picker widgets into a page through JavaScript. Each widget is then linked to an existing element (e.g. a text field) and will update the element’s value when a color is selected.

Download Farbtastic 1.2 – 8 January 2007 (License: GPL).

Farbtastic: jQuery color picker plug-in | Steven Wittens – Acko.net