This file contains hidden or 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
// https://stackoverflow.com/questions/56716311/how-to-show-complete-list-when-keyboard-is-showing-up-in-swiftui?noredirect=1&lq=1 | |
import SwiftUI | |
import Combine | |
struct AdaptToKeyboard: ViewModifier { | |
@State var currentHeight: CGFloat = 0 | |
func body(content: Content) -> some View { |
This file contains hidden or 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
import UIKit | |
import SwiftUI | |
import PlaygroundSupport | |
// CustomParentView is a custom UIKit view. Its Coordinator can be used | |
// to manage delegates if needed (e.g. UIContextMenuInteractionDelegate). | |
struct CustomParentView<Content: View>: UIViewRepresentable { | |
let content: UIView | |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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" | |
) |