The Ember router is getting number of enhancements that will greatly enhance its power, reliability, predictability, and ability to handle asynchronous loading logic (so many abilities), particularly when used in conjunction with promises, though the API is friendly enough that a deep understanding of promises is not required for the simpler use cases.
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
# Simple bijective function | |
# Basically encodes any integer into a base(n) string, | |
# where n is ALPHABET.length. | |
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047 | |
ALPHABET = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//) | |
# make your own alphabet using: | |
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join |
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
def output name=((default=true); "caius") | |
puts "name: #{name.inspect}" | |
puts "default: #{default.inspect}" | |
end | |
output | |
# >> name: "caius" | |
# >> default: true | |
output "avdi" |
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
//------------------------------------------------------------- | |
// | |
// Hypothesis: | |
// | |
// Promises/A is a Monad | |
// | |
// To be a Monad, it must provide at least: | |
// - A unit (aka return or mreturn) operation that creates a corresponding | |
// monadic value from a non-monadic value. | |
// - A bind operation that applies a function to a monadic value |
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 ApplicationAdapter from './application'; | |
import BulkOperations from 'ted-ed-lesson-creator/mixins/bulk-operations'; | |
export default ApplicationAdapter.extend(BulkOperations, { | |
bulkCollectionName: 'item', // used to build the endpoint, in this case becomes /items | |
bulkOperations: ['PUT', 'POST'] | |
}); |
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
/* | |
notifying the store that a record has been remotely deleted and should be fully removed. | |
*/ | |
function pushDeletion(store, type, id) { | |
let record = store.peekRecord(type, id); | |
if (record !== null) { | |
let relationships = {}; | |
let hasRelationships = false; | |
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 * as React from "react"; | |
// @ts-ignore | |
import * as ReactDOM from "#react-dom-server-implementation"; | |
// @ts-ignore | |
import * as ReactDOMClient from "#react-server-dom-client-implementation"; | |
export async function fetch( | |
request: Request, | |
{ | |
browserEntry, |