Skip to content

Instantly share code, notes, and snippets.

View fahu's full-sized avatar

Fabian Hurnaus fahu

View GitHub Profile
fahu / gist:4517103b7da93aec9dcc1c5baf935364
Created October 31, 2017 23:02
gitignore for web projects with IntelliJ IDEA Ultimate 2017
# IntelliJ IDEA Ultimate 2017
## User-specific stuff:
fahu / CreateShipment.php
Last active April 2, 2021 17:14
How to create a shipment programmatically in Magento 2
class CreateShipment extends \Magento\Backend\App\Action
* The OrderRepository is used to load, save and delete orders.
* @var \Magento\Sales\Model\OrderRepository
protected $orderRepository;
fahu / Uint8ArrayUtils.ts
Last active May 30, 2017 17:21
Collection of often used @UInt8Array operations in Typescript
* Collection of often used {Uint8Array} operations.
class Uint8ArrayUtils {
* Converts a 32 bit integer to an {Uint8Array}.
* @param int32 A 32 bit integer.
* @returns {Uint8Array} A {Uint8Array} containing the specified 32 bit integer.
public static convertToByteArray(int32: number): Uint8Array {
fahu / Crc16ItuCalculator.ts
Last active May 30, 2017 17:23
CRC16 ITU Typescript implementation
* CRC16 ITU implementation for calculating a checksum of an {Uint8Array}.
class Crc16ItuCalculator {
readonly CRC_16_TABLE = [
0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,
0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,
0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,
0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,
0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,
fahu /
Created May 9, 2017 15:50
First time creating an Alexa Skill - Test Intent Snippet
* Basic implementation of a JUnit test to test an intent. The response of the intent is specified in a JSON file.
public void testGetPetLocationIntent() throws Exception {
SpeechletResponse speechletResponse = SpeechletResponseTestUtils.getSpeechletResponse("where_is_my_dog.json");
PlainTextOutputSpeech outputSpeech = (PlainTextOutputSpeech)speechletResponse.getOutputSpeech();
assertEquals("Your dog Bello is ...", outputSpeech.getText());
assertEquals("Your pets location", speechletResponse.getCard().getTitle());
fahu /
Created May 9, 2017 15:48
First time creating an Alexa Skill - SpeechletResponse from JSON Snippet
* This is a helper method which allows you to create a SpeechletResponse from the specified JSON file.
* @param requestFileName The name of the JSON file placed in your projects ressource/requests folder.
* @return The parsed SpeechletResponse from the specified JSON file.
public static SpeechletResponse getSpeechletResponse(String requestFileName) throws Exception {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("requests/" + requestFileName);
SpeechletRequestEnvelope requestEnvelope = SpeechletRequestEnvelope.fromJson(inputStream);
IntentRequest intentRequest = (IntentRequest) requestEnvelope.getRequest();
fahu /
Created May 9, 2017 15:46
First time creating an Alexa Skill - Upload skill to S3 Snippet
# Upload your archived alexa skill to S3.
aws lambda update-function-code --function-name arn:aws:lambda:eu-west-1:1234567890123:function:your-alexa-app --zip-file fileb://target/your-alexa-app-0.1-jar-with-dependencies.jar
fahu /
Last active May 9, 2017 15:46
First time creating an Alexa Skill - Create JAR archive snippet
# Create a jar archive of your project
mvn assembly:assembly -DdescriptorId=jar-with-dependencies package
fahu /
Last active May 9, 2017 15:52

First time creating an Alexa Skill - Snippets

About it

This repository contains all the code snippet used in our blog post 'First time creating an Alexa skill — learn from our mistakes' which is published on Medium and



You like or dislike our blog post or would like to contribute to our post? Feel free to contact us (information in the Authors section)!