Skip to content

Instantly share code, notes, and snippets.

@levymetal
levymetal / directions.js
Last active November 1, 2022 02:38
Tutorial on how to calculate driving distance using Google maps API, full post available @ http://christianvarga.com/how-to-calculate-driving-distance-between-2-locations-with-google-maps-api/
var directionsService = new google.maps.DirectionsService();
var request = {
origin : 'Melbourne VIC', // a city, full address, landmark etc
destination : 'Sydney NSW',
travelMode : google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if ( status == google.maps.DirectionsStatus.OK ) {
@zekizeki
zekizeki / mqttpublish.php
Last active December 9, 2020 23:33
Simple pure MQTT publish client written in PHP
<?php
/**
*
* The MQTTClient class allows you to connect to an MQTT message broker and publish messages
* @author rob.s.smart@gmail.com
*
* Example use
* $client = new MQTTClient("robphptest","realtime.ngi.ibm.com",1883);
* $client->connect();
@leekelleher
leekelleher / backup-dev.bat
Created April 13, 2012 17:33
Personal batch script to quickly back-up my MSSQL database and wwwroot files, (typically for use with Umbraco).
:: ###### BACK-UP JOB ######
@ECHO OFF
:: Set the constants
SET BACKUP_DIR=C:\path\to\_backup
SET TEMP_DIR=%BACKUP_DIR%\TEMP
SET TODAY=%DATE:~6,4%%DATE:~3,2%%DATE:~0,2%
SET ARCHIVE_DIR=%BACKUP_DIR%\%TODAY%
SET WWWROOT_NAME="ProjectName"
SET WWWROOT_SOURCE=C:\path\to\wwwroot
@omsai
omsai / gist:2363047
Created April 11, 2012 22:01
Arduino UNO pulse counter
/*
Arduino UNO reads rising edge trigger pulses on pin 2 and displays counter on
Sparkfun SerLCD LCD-10097
Photo of setup: http://ompldr.org/vZGNlbA/photo.JPG
Pariksheet <p.nanda@andor.com> Mar 2012
*/
@scottsweb
scottsweb / gravity-forms-validation.php
Last active March 11, 2024 10:22
Using a Gravity Forms filter to create a custom validation and check for existing UID in already saved entries.
<?php
/***************************************************************
* Function media_custom_validation
* Check the media form for duplicate inputs on the same day
***************************************************************/
add_filter('gform_validation', 'media_custom_validation');
function media_custom_validation($validation_result) {