Skip to content

Instantly share code, notes, and snippets.

@hjr3
hjr3 / e-commerce.md
Created April 3, 2012 05:35
Examples of RESTful API calls for E-commerce platforms

Examples of RESTful API calls for E-commerce platforms

These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.

Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.

Relevant links

@benaubin
benaubin / Readme.md
Last active May 6, 2024 01:45
Click To Call Bookmarklet

Click to Call Bookmarklet

This bookmarklet calls the phone number in the next element clicked. If a phone number does not exist or is not valid, the user is then prompted to enter a valid phone number. This continues until the user enters a valid phone number, or cancels a prompt.

To install the bookmarklet, type this into your browser's address bar (note the javascript: part):

javascript:var%20script=document.createElement('script');script.src="https://cdn.rawgit.com/penne12/246dc4ca0d4db595fcfb07fd441ab513/raw/e2d6e480556d54f305c1619b177568dc488fc376/install-bookmarklet.js";script.type="text/javascript";document.body.appendChild(script);
(function() {
var lighthouse_token = '';
var base_url = "https://harmonypark.lighthouseapp.com";
var ticket_url = prompt("Ticket url?");
if (ticket_url === null) {
return;
}
@arijusg
arijusg / download-video.md
Last active May 6, 2024 01:45
Download stream video
@jasny
jasny / linkify.php
Last active May 6, 2024 01:44
PHP function to turn all URLs in clickable links
<?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)
@maesa
maesa / Googlegeocoder.php
Created May 4, 2014 11:44
Simple geocoding CodeIgniter library using Google Maps API v3
<?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)
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@niyazpk
niyazpk / pQuery.js
Created October 25, 2014 14:03
Add or update query string parameter
// 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)) {
@adamkearsley
adamkearsley / tabs.service.ts
Created February 9, 2017 13:09 — forked from 0x1ad2/tabs.service.ts
A service to hide and show tabs in Ionic 2
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() {