Skip to content

Instantly share code, notes, and snippets.

@glyons
glyons / FakeGETTestusingSinonJS.js
Created September 6, 2017 09:21
Javascript QUnit - Fake GET Test using SinonJS
QUnit.test("Javascript QUnit - Fake GET Test using SinonJS", function (assert) {
var url = "http://someurltofake";
var xhr = sinon.useFakeXMLHttpRequest();
var requests = sinon.requests = [];
xhr.onCreate = function (request) {
requests.push(request);
};
// Images into PSD Template (PSD must have a layer called 'artwork')
// The PSD and images should be all in the same directory
var fWidth = 1046;
var fHeight = 479;
var inFolder = Folder.selectDialog("Please select folder to process");
if (inFolder != null)
{
var fileList = inFolder.getFiles(/\.(jpg)$/i);
// : Generates random password, which complies with the strong password
// rules and does not contain ambiguous characters.
//
using System;
using System.IO;
using System.Text;
using System.Web;
// Display
#include <ESP_SSD1306.h> // Modification of Adafruit_SSD1306 for ESP8266 compatibility
#include <Adafruit_GFX.h> // Needs a little change in original Adafruit library (See README.txt file)
#include <SPI.h> // For SPI comm (needed for not getting compile error)
#include <Wire.h> // For I2C comm, but needed for not getting compile error
// Servo
#include <Servo.h>
Servo myservo; // create servo object to control a servo
@glyons
glyons / WaveshareExample154blackred.ino
Last active May 13, 2018 13:14
1.54" b/w/r 200x200 Waveshare SPI e-Paper connected to ESP8266/WeMoS
// mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
#include <GxEPD.h>
// select the display class to use, only one
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp> // 1.54" b/w/r 200x200
@glyons
glyons / epaper154YouTube.ino
Created May 13, 2018 12:22
Waveshare e-Paper Display 1.54" red/black YouTube Statistics
// mapping suggestion from Waveshare SPI e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
#include <GxEPD.h>
// select the display class to use, only one
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp> // 1.54" b/w/r 200x200
#include GxEPD_BitmapExamples
// FreeFonts from Adafruit_GFX
@glyons
glyons / encoder.ino
Created July 15, 2018 15:13
Rotary Encoder and SSD 1306
/* Rotary Encoder and SSD 1306
*/
#include <ESP_SSD1306.h> // Modification of Adafruit_SSD1306 for ESP8266 compatibility
#include <Adafruit_GFX.h> // Needs a little change in original Adafruit library (See README.txt file)
#include <SPI.h> // For SPI comm (needed for not getting compile error)
#include <Wire.h> // For I2C comm, but needed for not getting compile error
// Pin definitions
#define OLED_RESET 16 // Pin 15 -RESET digital signal
#include <Encoder.h>
@glyons
glyons / googlemock.cs
Last active July 27, 2018 06:59
Async HttpClient Request Mock for Google.com
using System;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Moq.Protected;
@glyons
glyons / dockercheat.txt
Last active October 10, 2018 15:08
Docker Command Cheat Sheet and OpenFaas
Python Docker Container
docker pull python
docker pull microsoft/windowsservercore
COMMANDS
=================
To show only running containers use the given command:
@glyons
glyons / css
Created August 19, 2018 05:34
Hamilton Theme - Add Widget Support (Add to the top of each PHP file)
<!-- Need to add CSS styling -->