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
export { load } from 'sveltekit-flash-message/server'; |
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
""" | |
This is my understanding of the Anki scheduling algorithm, which I mostly | |
got from watching https://www.youtube.com/watch?v=lz60qTP2Gx0 | |
and https://www.youtube.com/watch?v=1XaJjbCSXT0 | |
and from reading | |
https://faqs.ankiweb.net/what-spaced-repetition-algorithm.html | |
There is also https://github.com/dae/anki/blob/master/anki/sched.py but I find | |
it really hard to understand. | |
Things I don't bother to implement here: the random fudge factor (that Anki |
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
import android.content.Context | |
import android.content.res.Resources | |
import android.util.DisplayMetrics | |
/** | |
* Provides utilities for metrics. | |
* | |
* Original at: | |
* @see <a href="https://stackoverflow.com/a/9563438/8877070">stack overflow answer</a> | |
* |
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
DROP TABLE IF EXISTS users; | |
DROP VIEW IF EXISTS bp; | |
CREATE TABLE users (name, cn, title, manager); | |
CREATE VIEW bp AS | |
-- create a CTE (common table expression) | |
-- think of this as creating a temporary table that only exists during this query | |
-- works somewhat like CREATE TEMPORARY TABLE bosspath(cn, path) | |
WITH RECURSIVE bosspath(cn,path) AS | |
( |
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
request.onupgradeneeded = function(event) { | |
var db = event.target.result; | |
var upgradeTransaction = event.target.transaction; | |
var objectStore; | |
if (!db.objectStoreNames.contains("my-store")) { | |
objectStore = db.createObjectStore("my-store"); | |
} else { | |
objectStore = upgradeTransaction.objectStore('my-store'); | |
} |
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
import 'package:flutter/services.dart'; | |
import 'package:intl/intl.dart'; | |
class CurrencyPtBrInputFormatter extends TextInputFormatter { | |
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { | |
if(newValue.selection.baseOffset == 0){ | |
return newValue; | |
} |
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
(defn component [] | |
(js/Reflect.construct js/HTMLElement #js [] component)) | |
(set! (.-prototype component) | |
(js/Object.create (.-prototype js/HTMLElement) | |
#js {:connectedCallback | |
#js {:configurable true | |
:value | |
(fn [] | |
(this-as this |
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
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
import 'package:bloc/bloc.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { |
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
(ns api-server.file-io | |
(:use [clojure.tools.logging :only (info warn error)]) | |
(:import (java.nio.channels CompletionHandler AsynchronousFileChannel) | |
(java.nio ByteBuffer) | |
(java.nio.file.attribute FileAttribute) | |
(java.nio.file StandardOpenOption) | |
(java.util.concurrent Executors)) | |
(:require [clojure.core.async :as async :refer [chan go put! close!]] | |
[clojure.java.io :as io])) |