##The Singleton Pattern
class SantaClaus {
private static uniqueInstance : SantaClaus;
##The Singleton Pattern
class SantaClaus {
private static uniqueInstance : SantaClaus;
public enum Cacheability | |
{ | |
NoCache, | |
Private, | |
Public, | |
} |
This is an example of how to scaffold API endpoints to list / get / create / update / delete Posts in a Keystone website.
It's a modification of the default project created with the yo keystone
generator (see https://github.com/JedWatson/generator-keystone)
Gists don't let you specify full paths, so in the project structure the files would be:
routes-index.js --> /routes/index.js // modified to add the api endpoints
routes-api-posts.js --> /routes/api/posts.js // new file containing the Post API route controllers
To implement API authentication in KeystoneJS, you need the following:
For key based authentication
For session based authentication
I'm not suggesting drastic action. I don't want to break backwards compatibility. I simply want to make the class
feature more usable to a broader cross section of the community. I believe there is some low-hanging fruit that can be harvested to that end.
Imagine AutoMaker contained class Car
, but the author wants to take advantage of prototypes to enable factory polymorphism in order to dynamically swap out implementation.
Stampit does something similar to this in order to supply information needed to inherit from composable factory functions, known as stamps.
This isn't the only way to achieve this, but it is a convenient way which is compatible with .call()
, .apply()
, and .bind()
.
// ==Taberareloo== | |
// { | |
// "name" : "Fix Twitter.update 2020.02" | |
// , "description" : "Fix Twitter.update 2020.02" | |
// , "include" : ["background"] | |
// , "version" : "0.5.0" | |
// , "downloadURL" : "https://gist.githubusercontent.com/ailispaw/9406c2ffacf68c6ad238/raw/patch.fix.twitter.update.tbrl.js" | |
// } | |
// ==/Taberareloo== |
using System.Collections.Generic; | |
namespace System.Threading.Tasks | |
{ | |
public static class AsyncUtilities | |
{ | |
/// <summary> | |
/// Execute's an async Task{T} method which has a void return value synchronously | |
/// </summary> | |
/// <param name="task">Task{T} method to execute</param> |