Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Martin Beeby thebeebs

🏠
Working from home
Block or report user

Report or block thebeebs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thebeebs
thebeebs / lambda.cs
Created Aug 12, 2019
Simple Lambda Example
View lambda.cs
using Amazon.Lambda.Core;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
namespace demoLambda
{
public class Function
{
@thebeebs
thebeebs / cdk-bucket.cs
Created Aug 12, 2019
Creating a bucket using the CDK
View cdk-bucket.cs
new Bucket(this, "MyFirstBucket", new BucketProps
{
Versioned = true
});
@thebeebs
thebeebs / s3.cs
Created Aug 12, 2019
The following C# code example creates two objects with two PutObjectRequest requests: The first PutObjectRequest request saves a text string as sample object data. It also specifies the bucket and object key names. The second PutObjectRequest request uploads a file by specifing the file name. This request also specifies the ContentType header an…
View s3.cs
using Amazon.S3;
using Amazon.S3.Model;
using System;
using System.Threading.Tasks;
namespace Amazon.DocSamples.S3
{
class UploadObjectTest
{
private const string bucketName = "*** bucket name ***";
View index.html
<div id="app">
<button @click="disconnect" v-if="status === 'connected'">Disconnects </button>
<button @click="connect" v-if="status === 'disconnected'">Connect</button> {{ status }}
<br /><br />
<div v-if="status === 'connected'">
<form @submit.prevent="sendMessage" action="#">
<input v-model="message"><button type="submit">Send Message</button>
</form>
<ul id="logs">
<li v-for="log in logs" class="log">
@thebeebs
thebeebs / webAudio.js
Created Dec 20, 2016
Web Audio Example
View webAudio.js
var context= new (window.AudioContext || window.webkitAudioContext)();
var oscillator = context.createOscillator();
oscillator.frequency.value = 5000;
oscillator.start();
oscillator.connect(context.destination);
// Only be heard by those under 40
// oscillator.frequency.value = 15000;
// Only be heard by those under 18
@thebeebs
thebeebs / AsyncExample.js
Last active Jan 3, 2017
An example of using Async Await to create some text in a guaranteed order.
View AsyncExample.js
// Calling the function using promises.
addElement("first promise sexy syntax")
.then(x => addElement("second promise syntax"))
.then(x => addElement("third promise syntax"))
.then(x => addElement("fourth promise syntax"))
// Calling the function using Async/Await
async function myFunction(){
await addElement("first async");
await addElement("second async");
View designer.html
<link href="../core-icon-button/core-icon-button.html" rel="import">
<link href="../core-toolbar/core-toolbar.html" rel="import">
<link href="../core-header-panel/core-header-panel.html" rel="import">
<link href="../topeka-elements/category-images.html" rel="import">
<link href="../core-icon/core-icon.html" rel="import">
<link href="../core-icons/core-icons.html" rel="import">
<link href="../core-icons/av-icons.html" rel="import">
<link href="../paper-fab/paper-fab.html" rel="import">
<polymer-element name="my-element">
@thebeebs
thebeebs / definitionFiles.ts
Last active Aug 29, 2015
TypeScript can infer meaning about the (e) parameter because of the lib.t.ds file that provides an 8000 line interface for the entire javascript runtime.
View definitionFiles.ts
window.onmousemove = function(e) {e.clientX};
@thebeebs
thebeebs / objectInterface.ts
Created Feb 12, 2014
You can add an interface to an object so the miss spelling of clear() is picked up and the app will not compile.
View objectInterface.ts
interface Rapper {
say(x: string): void;
clear(): void;
speak(): string;
}
function makeRapper(): Rapper{
var words;
return {
say: function (x: string){
@thebeebs
thebeebs / constructorsAndIndexes.ts
Last active Aug 29, 2015
You can model constructors, You can model what happen when someone indexes the (thing) telling TypeScript to return a date.
View constructorsAndIndexes.ts
interface Thing {
a: number;
b: string;
foo: {
(x: string): string;
(x: number): number;
data: any;
};
new (s: string): Element;
[index: number]: Date;
You can’t perform that action at this time.