Skip to content

Instantly share code, notes, and snippets.

View crazytonyi's full-sized avatar

Anthony crazytonyi

  • SugarCRM
  • Austin
View GitHub Profile
class CheckerboardPainter {
paint(ctx, geom, properties) {
// Use `ctx` as if it was a normal canvas
const colors = ['red', 'green', 'blue'];
const size = 32;
for(let y = 0; y < geom.height/size; y++) {
for(let x = 0; x < geom.width/size; x++) {
const color = colors[(x + y) % colors.length];
ctx.beginPath();
ctx.fillStyle = color;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
$client = new \GuzzleHttp\Client();
$headers = ['x-api-key' => 'MY API KEY'];
$options = [
'headers' => ['x-api-key' => 'MY API KEY'],
'debug' => true,
];
<?php
$client = new \GuzzleHttp\Client();
$request = $client->createRequest('GET', 'https://beta.check-mot.service.gov.uk');
$request->addHeader('x-api-key', 'MY API KEY');
try {
$resp = $client->send($request);
} catch (GuzzleHttp\Exception\ClientException $e) {
$resp = $e->getResponse();
@crazytonyi
crazytonyi / mass_update_leads.php
Last active April 21, 2017 22:16
Basic Example of API for MassUpdate
<?php
function getAccessToken($instance_url, $username, $password)
{
echo "Authenticating..." . PHP_EOL;
$auth_url = $instance_url . "/oauth2/token";
$oauth2_token_arguments = array(
"grant_type" => "password",
@crazytonyi
crazytonyi / saveFilev2.html
Last active April 6, 2019 11:14
HTML Self-Replicating Script with Live textarea content
<!doctype html>
<html>
<!-- saveFile.html 1.0.0 2015 guest271314 edit, save `html` document -->
<head>
</head>
<body>
<textarea></textarea>
<button>save file</button>
<script type="text/javascript">
var saveFile = document.getElementsByTagName("button")[0];

Test 1 — \'Twas the night before Christmas and my glasses' arm was broken. 'Til I get them fixed, I can’t see.

Test 2 — 'Til I get them fixed, I can’t see.

Test 3 — 'Til I get the 'other' pair, I can’t see.

Test 4 — `x’Til I get the 'other' pair, I can’t see.