Skip to main content
CSS is fun and cool and I like it.

Default Arguments for Functions

// Combiner of passed arguments and defaults (usable with any function)
Object.prototype.combine = function(_args){
  for(var i in this) {
    if(typeof _args[i] == "undefined") {
      _args[i] = this[i];

// Specific example function with defaults
function feedTheCat(args){
  var defaults = {
      'morning' : "nothing",
      'noon'    : "pork",
      'nite'    : "mouse"

// USAGE: only passing 2 of 3 arguments
  'morning': "milk", 
  'nite': "kitekat"

// Values would be: milk | pork | kitekat
Read article

Generate Expiring Amazon S3 Link

You don't have to make files on Amazon S3 public (they aren't by default). But you can generate special keys to allow access to private files. These keys are passed through the URL and can be made to expire.


    * Calculate the HMAC SHA1 hash of a string.
    * @param string $key The key to hash against
    * @param string $data The data to hash
    * @param int $blocksize Optional blocksize
    * @return string HMAC SHA1
Read article
icon-link icon-logo-star icon-search icon-star