(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
<?php | |
/** | |
* Turn all URLs in clickable links. | |
* | |
* @param string $value | |
* @param array $protocols http/https, ftp, mail, twitter | |
* @param array $attributes | |
* @return string | |
*/ | |
public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array()) |
<?php | |
/** | |
* 1. create project at https://console.developers.google.com/project | |
* 2. enable 'Analytics API' under 'APIs & auth' / APIs | |
* 3. create 'NEW CLIENT ID' (OAuth client) under 'APIs & auth' / Credentials | |
* i. select 'Service account' | |
* ii. save generated key file to 'key.p12' | |
* iii. remember CLIENT ID | |
* 4. under GA account add 'Read & Analyze' access to newly generated email (access to GA Account not Property nor View) |
<?php defined('BASEPATH') OR exit('No direct script access allowed'); | |
class GoogleGeocoder | |
{ | |
public function __construct() | |
{ | |
$this->baseURL = "https://maps.google.com/maps/api/geocode/json?sensor=false"; | |
} | |
public function geocode($address) |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// Add / Update a key-value pair in the URL query parameters | |
function updateUrlParameter(uri, key, value) { | |
// remove the hash part before operating on the uri | |
var i = uri.indexOf('#'); | |
var hash = i === -1 ? '' : uri.substr(i); | |
uri = i === -1 ? uri : uri.substr(0, i); | |
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { |
import {Injectable} from '@angular/core'; | |
// Declare TabsService as a provider in app.module.ts | |
// Inject TabsService in your class: constructor(public tabs: TabsService){} | |
// Use the this.tabs.hide() or this.tabs.show() methods wherever you want | |
@Injectable() | |
export class TabsService { | |
constructor() {} | |
public hide() { |
BLACK => "\033[30m", | |
RED => "\033[31m", | |
GREEN => "\033[32m", | |
YELLOW => "\033[33m", | |
BLUE => "\033[34m", | |
PURPLE => "\033[35m", | |
CYAN => "\033[36m", | |
WHITE => "\033[37m", | |
# background color |
// From http://stackoverflow.com/questions/3583989/jquery-autocomplete-pass-targeted-element-attribute-as-an-extra-parameter | |
$("#autocomplete input").each(function() { | |
var that = this; | |
$(that).autocomplete({ | |
source: function(request, response) { | |
$.ajax({ | |
url: "search.php", | |
dataType: "json", | |
data: { |
rstakeout_model_spec() | |
{ | |
rstakeout "script/spec spec/models/$1_spec.rb $2" "app/models/*.rb" "spec/models/$1_spec.rb" | |
} |
<?xml version="1.0" encoding="UTF-8"?> | |
<gpx version="1.1" | |
creator="GMapToGPX 6.4b - http://www.elsewhere.org/GMapToGPX/" | |
xmlns="http://www.topografix.com/GPX/1/1" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> | |
<rte> | |
<name>Gmaps Pedometer Route</name> | |
<cmt>Permalink: <![CDATA[ | |
Permalink unavailable. |