Skip to content

Instantly share code, notes, and snippets.

@keranm
keranm / put_withCurl.php
Created January 29, 2013 04:26
PUT with PHP and CURL
<?php
// EXAMPLE OF PUT with PHP and CURL
//
// by Keran McKenzie
//
// NOTE this assumes you are posting JSON in a variable called $jsonString
// also assumes we have the username & password in variables
// setup Curl
$session = curl_init();
@keranm
keranm / class.myob_oauth.php
Created February 16, 2013 04:30
This is a basic class written to simplify the oauth token requests for myob AccountRight API
<?php
// *********************************************************************
//
// Class MYOB API OAUTH
//
// Sample Written by Keran McKenzie
// Date: Feb 2013
//
// Provided as sample oauth class for PHP & cURL OAUTH
//
@keranm
keranm / gist:5140409
Created March 12, 2013 04:38
There is a known issue in SqlCE 3.5 (http://connect.microsoft.com/VisualStudio/feedback/details/611059/sql-server-compact-provider-factory-not-added-to-machine-config) that occasionally causes the AccountRight API installer to not run correctly. Here is a quick change to MYOB.AccountRight.API.WindowsServiceHost.exe.config (located here C:\Progra…
<system.data>
<DbProviderFactories>
<remove invariant=”System.Data.SqlServerCe.3.5”/>
<add name=”Microsoft SQL Server Compact Data Provider” invariant=”System.Data.SqlServerCe.3.5” description=”.NET Framework Data Provider for Microsoft SQL Server Compact” type=”System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91”/>
</DbProviderFactories>
</system.data>
</configuration>
@keranm
keranm / getURL
Created January 8, 2014 03:01
This is a very quick CURL based function to GET a URL - specifically for the MYOB AccountRight Live API
/******************************************************************************
** GETURL
** The purpose of this function is to call any url we give it
** The function expects at least a URL
** It also can take (optionally) the username and password for the company file
**
********************************************************************************/
function getURL($url, $companyFileUsername = null, $companyFilePassword = null) {
@keranm
keranm / gist:8311095
Last active January 2, 2016 13:39
Rough example using the getURL to get from MYOB AccountRight Live API in local mode
$urlToCall = 'http://localhost:8080/accountright/'.$companyFileID.'/GeneralLedger/GeneralJournal';
// because we are now making a call to a company file we must ALSO include the username and password
// I'm using the hardcoded variables in the functions file
$generalJournal = getURL( $urlToCall, $companyFileUsername, $companyFilePassword );
// it returns as JSON so lets decode it into a PHP object
$generalJournal = json_decode( $generalJournal );
echo '<h1>General Journal - JSON</h1>';
@keranm
keranm / gist:8311160
Created January 8, 2014 03:13
Get the list of company files
// lets get a list of the company files - note we use the base API url from the functions file
$companyFileList = getURL( 'http://localhost:8080/accountright' );
// it returns as JSON so lets decode it into a PHP object
$companyFileList = json_decode( $companyFileList );
echo '<h1>Company File list - JSON</h1>';
echo '<pre>'; // simple html tag to roughly render the HTML
var_dump($companyFileList);
<?php
var_dump($results);
?>
@keranm
keranm / Readme.md
Last active November 9, 2015 01:43
Preparation for BuzzConf

BuzzConf NodeBost workshop

During this workshop we will be using mbots from Makeblock. These robots are quick to construct but can be used to do a variety of activites including:

  • Control remotely over bluetooth
  • Use distance sensors for obstacle detection
  • Play a tune via a speaker
  • Detect lines and follow them
@keranm
keranm / LICENSE
Created November 9, 2015 01:44 — forked from ajfisher/LICENSE
Preparation for BuzzConf
The MIT License (MIT)
Copyright (c) 2015 ajfisher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: