Skip to content

Instantly share code, notes, and snippets.

function ap_register_podcast_post_type() {
$labels = array(
'name' => __( 'Podcast Configs', 'newsuk' ),
'singular_name' => __( 'Podcast Config', 'newsuk' ),
'add_new' => __( 'New Podcast Config', 'newsuk' ),
'add_new_item' => __( 'Add New Podcast Config', 'newsuk' ),
'edit_item' => __( 'Edit Podcast Config', 'newsuk' ),
'new_item' => __( 'New Podcast Config', 'newsuk' ),
'view_item' => __( 'View Podcast Config','newsuk' ),
@ck1125
ck1125 / listing5
Created November 26, 2020 20:51
Example skill-stack.yaml
AlexaSkillFunction:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
!Join
- '-'
- - 'my-bucket-name'
- !Ref 'AWS::Region'
- 'dev'
@ck1125
ck1125 / listing4
Created November 26, 2020 20:47
Sample ask-resources.json
{
"askcliResourcesVersion": "2020–03–31",
"profiles": {
"my-profile": {
"skillMetadata": {
"src": "./skill-package/pre-prod"
},
# Specify code to be deployed to each region
@ck1125
ck1125 / listing3
Last active November 26, 2020 20:45
Deploying RSK skill and its radio station catalogue
# Each time a deploy is triggered, the state is saved in a hidden file ask-states.json
# We use S3 Buckets to keep that in sync since the circle-ci container is stateless
# Get the latest deployment state from our S3 bucket ask-states.json
aws s3 cp s3://code-bucket/alexa-deployment/ask-states.json .ask/ask-states.json
# Deploy the Skill code with the ask cli (v2)
ask deploy -profile my-profile
# Save this new deployment state back to our S3 bucket
@ck1125
ck1125 / listing1
Last active November 26, 2020 14:35
Creating a Skill
ask smapi create-skill-for-vendor - manifest file:../manifest.json - profile my-profile
{
"skillId": "amzn1.ask.skill.blah-skill-id"
}
#!/bin/bash
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
@ck1125
ck1125 / toContain.matcher.js
Created June 28, 2013 16:55
matcher for toContainUnordered
angular.scenario.matcher("toContainUnordered", function(expected) {
var actual = this.future.value;
expected.forEach(function(element) {
if (actual.indexOf(element) < 0) {
throw new Error('Expected ['+actual+'] to contain "'+element+'"');
}
});
@ck1125
ck1125 / select.options.dsl.js
Created June 27, 2013 14:25
Select box get options Angular Scenario DSL
angular.scenario.dsl('selectBox', function() {
var chain = {};
chain.options = function() {
return this.addFutureAction("select options'" + this.name, function($window, $document, done) {
var select = $document.elements(this.name);
var option = select.find('option'), items = [];
for(var i = 0; i < option.length; i++) {
items.push(option[i].text);
@ck1125
ck1125 / myfirewall.sh
Last active December 15, 2015 10:58
accept on 80, 443 and 22 as valid ports
#!/bin/bash
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
rsconf = {
_id: "rs0",
members: [
{
_id: 0,
host: "127.0.0.1:27017"
},
{
_id: 1,
host: "127.0.0.1:37017"