Sometimes you need to edit files on a remote server via Secure Shell (SSH). In OSX you can easily mount a remote server to a virtual drive. First you need an empty local directory - in this case I created /Volumes/sshfs-mount/. This directory will be the mount point for sshfs...

There are a couple of ways, to extract a single URL-parameter from a given string. A simple and easy way is to do it with a regular expression. // The URL to check var url = "http://www.frontcoded.com?myvalue=123&anothervalue=456"; // Here we search for the param 'myvalue' var matchResult = url.match(/(\?|&)myvalue=([^&#]*).*$/); var...

Following function returns a google.maps.LatLngBounds object for an array of google.maps.Marker /** * Returns a bounds object for a given list of markers * @param {array} markers The markers * @return {LatLngBounds} The bounds object */ getBoundsForMarkers = function(markers) { var bounds, marker, _i, _len; bounds = new google.maps.LatLngBounds(); for...

YouTube has no real API method where you can retrieve your URL. Instead you have to follow YouTube´s simple convention, to put together the correct URLs for your video thumbnails. Let´s say, you want the thumbnail for following video: http://www.youtube.com/watch?v=u1zgFlCw8Aw Just copy the video id - in this case u1zgFlCw8Aw....

Create a new initializer config/initializers/load_config.rb with that content: APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env] Then, create a configuration file under config/config.yml and put in your config properties: development: my_propery: true test: my_propery: true production: my_propery: false Now you can use the configuration via the APP_CONFIG constant everywhere in your ruby code: if APP_CONFIG['my_propery']...