Skip to content

Instantly share code, notes, and snippets.

@sax1johno
sax1johno / machine.js
Last active June 21, 2022 15:03
Generated by XState Viz: https://xstate.js.org/viz
const betMachine = Machine(
{
"id": "StandardBet",
"initial": "waitingForPlayerAction",
"bettingOrder": [
"c",
"d",
"e",
"f",
"g",
.applyPage.row(ng-controller="applyController as apply")
.col-lg-offset-1.col-lg-10.animated.fadeInDown(ng-show="apply.applied")
.row.text-center
h1 Thanks for applying!
p Your application is being processed. You'll receive a response shortly from one of our program coordinators with more information.
// p You can check on the status of your application by logging into the applicant portal
// a(href="/login") here.
// p Your username is your email address and your password is the one sent to you in your email.
// p Can't find your password?  
// a(href="/forgotpassword") You can reset it here.
angular.module('us.propl.app')
.controller('applyController', function($http, localStorageService) {
// var AppResource = $resource('/api/apply');
// this.applied = localStorageService.get('applied');
this.applied = false;
var that = this;
this.submit = function() {
this.application.username = this.application.email;
$http.post("/api/apply", this.application)
.then(function(applicationResponse) {
Contract:
{ parameter (or (or nat nat) (pair nat address)) ;
storage (pair (pair (map nat (pair mutez nat)) (map nat (pair address nat))) nat) ;
code { {} ;
{ { {} ;
{ {} ;
PUSH (lambda
(pair (pair nat address)
(pair (pair (map nat (pair mutez nat)) (map nat (pair address nat))) nat))
(pair (list operation)
@sax1johno
sax1johno / KubernetesNamespaceForceFinalize.txt
Last active August 30, 2018 16:56
Fix for Kubernetes Namespace being stuck in the "Terminating" state
# Sometimes, when you attempt to delete a namespace in kubernetes, it can get stuck in the "terminating" state.
# This generally happens when there are resources still assigned to that namespace when it is deleted.
# The finalizers are unable to confirm that all resources are cleared out, so they fail and stay locked in the "terminating" state.
# You can fix it by doing the following:
# First, proxy the kubernetes api cluster to your local system
$ kubectl serve
# find each namespace impacted
$ kubect get namespace <ns> -o json > temp.json
@sax1johno
sax1johno / README.md
Created August 29, 2016 05:26
Cached Astronomy Picture of the Day

This flow will download the latest Astronomy Picture of the Day (APOD) from Nasa.gov and caches in memory.

It hits the API once every 24 hours, so you don't have to worry about reaching your quota.

This flow demonstrates a technique in caching data that can be used for other sites as well - for example, you can create your own "xxx of the day" from any site that offers a random API by simply calling that random API once every 24 hours (you can change this interval) and caching the result. Calls to the API will read from the cached version.

NOTE: to use this flow you must obtain a free API key from data.nasa.gov.

docker run -d --restart=unless-stopped -p 8080:8080 -p 9345:9345 rancher/server \
--db-host <hostName> --db-port 3306 --db-user <username> --db-pass <password> --db-name rancher_cattle \
--advertise-address awslocal
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*
@sax1johno
sax1johno / Nativescript-WebViewWithLinks.js
Created August 12, 2016 18:04
Code in NativeScript to overload URL's in a rendered web page and display them in a content-appropriate way.
<html>
<head>
</head>
<body>
<div ng-controller="PageController">
<button value="Click to open modal" ng-click="openModal" />
</div>
<script type="text/template" id="myModalTemplate.html">
<h1>This is my modal popup template</h1>
<input type="text" ng-model="user.username" />