Skip to content

Instantly share code, notes, and snippets.

View mikehelmick's full-sized avatar

Mike Helmick mikehelmick

View GitHub Profile
@mikehelmick
mikehelmick / discovery.yaml
Created February 13, 2020 06:19
CloudDiscovery Example - 12 Feb 2020
openapi: 3.0.0
servers:
- description: CloudEvents Discovery API
url: https://virtserver.swaggerhub.com/mikehelmick/discovery/1.0.0
info:
description: CloudEvents Cloud Discovery API
version: "1.0.0"
title: Cloud Discovery API
paths:
/:
@mikehelmick
mikehelmick / source_results.yaml
Created January 16, 2020 17:40
% kubectl get CustomResourceDefinitions -l "duck.knative.dev/source" -oyaml
apiVersion: v1
items:
- apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"apiextensions.k8s.io/v1beta1","kind":"CustomResourceDefinition","metadata":{"annotations":{"registry.knative.dev/eventTypes":"[\n { \"type\": \"dev.knative.apiserver.resource.add\" },\n { \"type\": \"dev.knative.apiserver.resource.delete\" },\n { \"type\": \"dev.knative.apiserver.resource.update\" },\n { \"type\": \"dev.knative.apiserver.ref.add\" },\n { \"type\": \"dev.knative.apiserver.ref.delete\" },\n { \"type\": \"dev.knative.apiserver.ref.update\" }\n]\n"},"creationTimestamp":null,"labels":{"duck.knative.dev/source":"true","eventing.knative.dev/release":"devel","eventing.knative.dev/source":"true","knative.dev/crd-install":"true"},"name":"apiserversources.sources.eventing.knative.dev"},"spec":{"additionalPrinterColumns":[{"JSONPath":".status.conditions[?(@.type==\"Ready\")].status","name":"Rea
% Bowling scoring calculation in Erlang as a rescursive function
-module(bowling).
-export([score/1]).
% To run - start an erlang shell, erl
%
% c(bowling).
% bowling:score([x, 5, 4, 2, s, x, 0, s, 0, 5, x, 5, s, 6, 2, x, 0, 1]).
@mikehelmick
mikehelmick / LookAtMemberVariables.cpp
Last active August 29, 2015 13:57
In our series of how C++ doesn't actually offer you any protection in the language, we show how you can directly access private member variables. Don't try this at home. Ok - do try this at home, and then don't do it at work.
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class Point {
public:
void setX(int newX) {
@mikehelmick
mikehelmick / constarray.cpp
Created February 13, 2014 15:35
Modifying the contents of a const array
#include <iostream>
using namespace std;
void printArray(int a[], int size) {
for (int i = 0; i < size; i++) {
cout << a[i] << " ";
}
cout << endl;
}
@mikehelmick
mikehelmick / Bad.cpp
Created February 12, 2014 16:24
Another reason I dislike C++ for teaching introductory programming.... this works
#include <iostream>
#include <cstdlib>
class BadActor {
public:
BadActor() {
this->value = 5;
}
int getValue() const {