Skip to content

Instantly share code, notes, and snippets.

View martindrapeau's full-sized avatar

Martin Drapeau martindrapeau

View GitHub Profile
@martindrapeau
martindrapeau / VerifyCanvaRequest.php
Created November 23, 2020 17:00
Laravel Middleware to verify POST and GET requests from Canva
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
/**
* Class VerifyCanvaRequest.
*/
@martindrapeau
martindrapeau / amilia-app-store-todo.md
Created November 27, 2018 19:51
TO DO list for the Amilia App Store POC

Apps POC TODO

  • Filter for categories
  • Filter for paid vs free
  • Filter by Amilia vs by Partner
  • Filter by Vertical
  • On tile, transform price into button (CTA): Get or Price or Installed
  • Remove SSOs? (because they are always on)
  • Examples of installed
@martindrapeau
martindrapeau / amilia-app-store-list.json
Last active November 27, 2018 19:45
Amilia App Store POC - Apps List
[
{
"Categories": [
"scheduling"
],
"Id": 100,
"Name": "Speedy Grid",
"HeroTitle": "Rotation schedule for gymnastics and cheerleading.",
"HeroIconImage": "img/speedygrid-logo.png",
"HeroDescription": "The world's first scheduling solution for Gymnastics facilities. Made by a gym owner, for gym owners!",
@martindrapeau
martindrapeau / sm-activities.js
Last active February 22, 2019 19:20
Sports Montreal new activities table for a sub-category on their website
Namespace("axis.sm.activities");
axis.sm.activities.display = function (evt, ajaxArgs) {
var english = $("body").hasClass("l_en");
var strings = {
lang: english ? 'en' : 'fr',
months: english
? ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"],
@martindrapeau
martindrapeau / diffdom-input-change-bug.html
Created October 19, 2018 13:06
diffDOM INPUT change bug
<!doctype html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://fiduswriter.github.io/diffDOM/diffDOM.js"></script>
<script>
$(document).ready(function() {
var value = 'hello';
var template = `
<div>
@martindrapeau
martindrapeau / api-examples.md
Last active August 29, 2018 16:15
MySkillChart API instructions for Amilia

Amilia API for MySkillChart integration

The Amilia API is located here: http://amiliaapp.github.io/amilia-demo-organization/api-documentation.html. It lists calls that are public. In addition, there is another document which lists calls with authentication required. Those are not yet public and will be sent in a separate PDF.

First off, most calls take as argument the language (en for English in your case) and a "rewrite url" - the id of the organization or customer. For your demo org, it is myskillchart. You'll notice those parts in the signature of the API calls below. I built the examples using your demo account.

The API is always a URL and returns JSON. Authenticated calls require an extra HTTP header. I've gone ahead and used jQuery to code up the calls. You can run those in your browser from your website domain or on the amilia.com domain (we respect CORS).

@martindrapeau
martindrapeau / sportsmontreal-dropins-today.html
Last active August 28, 2018 19:12
Code HTML pour afficher les cours à la carte aujourd'hui
<script>
jQuery(document).ready(function() {
$.get('https://www.amilia.com/PublicApi/sports-montreal/fr/Events')
.done(function(data) {
var $tbody = $('#amilia-events-calendar table tbody');
$tbody.empty();
if (typeof data != 'object') return;
if (data.length == 0) {
@martindrapeau
martindrapeau / horaire.js
Last active May 8, 2018 12:47
Centre Père Marquette - Horaire de la journée
var $amilia = $('<div>');
$('#widget-a72b3d5a-907a-a206-965d-7121034ab07e>.widget-content').append($amilia);
$.get('https://www.amilia.com/PublicApi/centre-pere-marquette/fr/Events').done(function(events) {
var $ul = $('<ul>');
$amilia.append($ul);
for (var i = 0; i < events.length; i++) {
var event = events[i];
$ul.append('<li><a href="' + event.url + '">' + event.title + '</a></li>');
}
});
@martindrapeau
martindrapeau / carbon-ads.css
Last active October 8, 2017 11:21
Carbon ads CSS - Responsive bottom-right fixed position
@media (min-width: 992px) {
#carbonads {
position: fixed;
right: 0;
bottom: 0;
box-sizing: border-box;
float: right;
background-color: rgba(0,0,0, 0.1);
padding: 1.5rem;
width: 32rem;
var screenWidth = Math.max(window.screen.width * window.devicePixelRatio, window.innerWidth);
var factor = screenHeight >= 960 ? 2 : 1;
if (screenHeight >= 960*2) factor = 3;
if (screenHeight >= 960*2.5) factor = 4;
// Image urls are then modified to load the proper size:
imgUrl.replace(".png", factor + ".png");