This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on the SuperMemo 2 Algorithm: | |
// https://www.supermemo.com/english/ol/sm2.htm | |
import UIKit | |
struct Item { | |
let id: UUID | |
let prompt: String | |
let explaination: String | |
var score: Score |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let task = URLSession.shared.dataTask(with: req) { (data, response, error) in | |
... | |
} | |
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(4)) { | |
task.resume() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*** Cluster Setup for Google Container Engine *** | |
0/ Install and configure local gcloud and kubectl: https://cloud.google.com/sdk/docs/ | |
> gcloud components install kubectl | |
1/ Configure Google Cloud account: | |
> gcloud config set account YOUR_EMAIL_ADDRESS | |
> gcloud config set project YOUR_PROJECT_ID | |
> gcloud config set compute/zone us-west1-a | |
> gcloud config set container/cluster example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jwt = require("jsonwebtoken") | |
var http2 = require("http2") | |
const ALGORITHM = "ES256" | |
const APNS_KEY_ID = "YOUR_APNS_KEY_ID" | |
const TEAM_ID = "YOUR_TEAM_ID" | |
const BUNDLE_ID = "YOUR_BUNDLE_ID" | |
const REGISTRATION_ID = "YOUR_DEVICE_PUSH_TOKEN" | |
const CERT = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const IncomingWebhook = require("@slack/client").IncomingWebhook | |
const SLACK_WEBHOOK_URL = "SLACK_WEBHOOK_URL" | |
const webhook = new IncomingWebhook(SLACK_WEBHOOK_URL) | |
// subscribe is the main function called by Cloud Functions. | |
module.exports.slackSubscribe = (event, callback) => { | |
const build = eventToBuild(event.data.data) | |
// Skip if the current status is not in the status list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ledger | |
import ( | |
"encoding/json" | |
"time" | |
"github.com/jmoiron/sqlx" | |
"github.com/jmoiron/sqlx/types" | |
uuid "github.com/satori/go.uuid" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Package entity implements functions to store and manipulate entity records | |
in a schema-less database. The current implementation supports Postgres only. | |
Inspired by: https://backchannel.org/blog/friendfeed-schemaless-mysql | |
Example implementation: | |
type Account struct { | |
ID string | |
Name string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//go:generate esc -o static.go -prefix "/" static | |
import ( | |
"flag" | |
"fmt" | |
"os" | |
"text/template" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TextViewCell: UITableViewCell { | |
var onTap: ((URL) -> Void)? | |
lazy var textView: UITextView = { | |
let view = UITextView() | |
view.translatesAutoresizingMaskIntoConstraints = false | |
view.backgroundColor = UIColor(red: 1.0, green: 0, blue: 0, alpha: 0.1) | |
view.textContainer.lineFragmentPadding = 0 | |
view.textContainerInset = .zero |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Generate RSA certificate and key | |
# | |
# The 'host' is the host on which the server is listening and 'prefix' is just | |
# used to prefix the output files. | |
# | |
# $ gen.sh <host> <prefix> | |
# |