Skip to content

Instantly share code, notes, and snippets.

View rcmlee99's full-sized avatar

Roger Lee rcmlee99

  • Sydney, Australia
View GitHub Profile
@rcmlee99
rcmlee99 / waf.ts
Created March 28, 2023 03:22 — forked from statik/waf.ts
WAF with CDK examples
import * as cdk from "@aws-cdk/core";
import * as wafv2 from "@aws-cdk/aws-wafv2";
// This extends the base cdk stack properties to include a tag name input.
export interface StackProps extends cdk.StackProps {
tag: string;
applicationName?: string;
}
export class WAFStack extends cdk.Stack {
struct Anything<Wrapper : UIView>: UIViewRepresentable {
typealias Updater = (Wrapper, Context) -> Void
var makeView: () -> Wrapper
var update: (Wrapper, Context) -> Void
init(_ makeView: @escaping @autoclosure () -> Wrapper,
updater update: @escaping (Wrapper) -> Void) {
self.makeView = makeView
self.update = { view, _ in update(view) }
@rcmlee99
rcmlee99 / async-foreach.js
Created April 10, 2018 03:51 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)
@rcmlee99
rcmlee99 / API.md
Created October 16, 2015 00:57 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@rcmlee99
rcmlee99 / eddystone.txt
Last active April 11, 2016 02:45
Eddystone Push Notification
Share web-URL via Eddystone - Share your LinkedIn profile link wirelessly
https://www.youtube.com/watch?v=xD8Y9P1rHHw&feature=em-share_video_user
http://kontakt.io/meet-eddystone-an-open-beacon-format-from-google/
How To Push Beacon Messages Without an App
http://developer.radiusnetworks.com/2015/07/22/how-to-push-messages-without-an-app.html
Physical Web (eddystone) scan app
// Photoshop Script to Create iPhone Watch Icons
//
// Original Copyright (c) 2010 Matt Di Pasquale
// Modified by Roger Lee 10 August 2015
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@rcmlee99
rcmlee99 / datepicker_date_validation
Last active August 29, 2015 14:22
Bootstrap Datepicker Date Validation
Contributed by Ben Till.
I have a display condition for a div based on whether a date is in the past.
The date is chosen via a bootstrap datetimepicker, as is the fashion.
You need to handle events for both keyup in the field, and the “dp.change” event fired from the datetimepicker widget.
The Moment.js library is excellent for date parsing / querying / validating in javascript. Luckily we already have it included in the OLS theme.
If you wanted to fire off a jsf ajax call, you could use the capture of the “dp.change” event to trigger an event for whatever ajax condition is
// Photoshop Script to Create iPhone Icons from iTunesArtwork
//
// WARNING!!! In the rare case that there are name collisions, this script will
// overwrite (delete perminently) files in the same folder in which the selected
// iTunesArtwork file is located. Therefore, to be safe, before running the
// script, it's best to make sure the selected iTuensArtwork file is the only
// file in its containing folder.
//
// Copyright (c) 2010 Matt Di Pasquale
// Added tweaks Copyright (c) 2012 by Josh Jones http://www.appsbynight.com
@rcmlee99
rcmlee99 / README.md
Last active August 29, 2015 14:18 — forked from denji/README.md

Quick uninstall JetBrains settings:

curl -sL https://gist.github.com/denji/9731967/raw/jetbrains-uninstall.sh | bash -s
@rcmlee99
rcmlee99 / Google-Maps-Example:-Nightly.markdown
Created March 25, 2015 05:39
Google Maps Example: Nightly