You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
// Released under MIT license: http://www.opensource.org/licenses/mit-license.php | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.val() == input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';
This is quite common and very helpful. Another option is to do:
name || (name = 'joe');
/* | |
Espresso Libre by Mike Reinhardt 2011 | |
based on Espresso Libre - by zolli - | |
http://www.eclipsecolorthemes.org/?view=theme&id=45 | |
Inspired by Ben Truyman's IR_Black translation | |
and Darcy Clarke's blog post: | |
http://darcyclarke.me/design/skin-your-chrome-inspector/ | |
*/ |
* { | |
-webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */ | |
-webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */ | |
-webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */ | |
-webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */ | |
} | |
// or to use on specific template add a class on body | |
// <body class="mobile-higlight-off"> | |
// <!-- html stuff --> |
// set-up a connection between the client and the server | |
var socket = io.connect(); | |
// let's assume that the client page, once rendered, knows what room it wants to join | |
var room = "abc123"; | |
socket.on('connect', function() { | |
// Connected, let's sign-up for to receive messages for this room | |
socket.emit('room', room); | |
}); |
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box | |
# http://wildfish.com | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
HTTP status code symbols for Rails | |
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
Status Code Symbol | |
1xx Informational | |
100 :continue | |
101 :switching_protocols | |
102 :processing |
defmodule MailService.SendAdapters.SendGrid do | |
@mailer_url "https://api.sendgrid.com/v3/mail/send" | |
@doc """ | |
Send a mail to a list of persons (recipients) | |
* from from address | |
* recipients array of email addresses | |
* subject subject text |