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
"scripts": { | |
"preinstall": "node tools/nodeVersionCheck.js", | |
"setup": "node tools/setup/setupMessage.js && npm install && node tools/setup/setup.js", | |
"remove-demo": "babel-node tools/removeDemo.js", | |
"start-message": "babel-node tools/startMessage.js", | |
"prestart": "npm run start-message", | |
"start": "concurrently -k -r -s first \"npm run test:watch\" \"npm run open:src\" \"npm run lint:watch\"", | |
"open:src": "babel-node tools/srcServer.js", | |
"open:dist": "babel-node tools/distServer.js", | |
"lint": "esw webpack.config.* src tools --color", |
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 uri = 'https://api.graph.cool/simple/v1/cj7yuh1df1tnt0147ihz25bgi' | |
const wsClient = { | |
uri: 'wss://subscriptions.graph.cool/v1/cj7yuh1df1tnt0147ihz25bgi', | |
options: { | |
reconnect: true, | |
connectionParams: { | |
authToken: localStorage.getItem(GC_AUTH_TOKEN), | |
} | |
} | |
} |
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
<i class="fa fa-wordpress" aria-hidden="true"></i> | |
<i class="fa fa-medium" aria-hidden="true"></i> | |
<i class="fa fa-drupal" aria-hidden="true"></i> | |
<i class="fa fa-grav" aria-hidden="true"></i> |
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
// Usage: | |
// p(instance)('privateMethod)(arg1, arg2, arg3) | |
class PrivateMethodCaller(x: AnyRef, methodName: String) { | |
def apply(_args: Any*): Any = { | |
val args = _args.map(_.asInstanceOf[AnyRef]) | |
def _parents: Stream[Class[_]] = Stream(x.getClass) #::: _parents.map(_.getSuperclass) | |
val parents = _parents.takeWhile(_ != null).toList | |
val methods = parents.flatMap(_.getDeclaredMethods) | |
val method = methods.find(_.getName == methodName).getOrElse(throw new IllegalArgumentException("Method " + methodName + " not found")) |
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
more_set_headers "Access-Control-Allow-Origin: $http_origin"; | |
more_set_headers "Access-Control-Allow-Credentials: true"; | |
# OPTIONS indicates a CORS pre-flight request | |
if ($request_method = 'OPTIONS') { | |
more_set_headers "Access-Control-Max-Age: 1728000"; | |
more_set_headers "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS"; | |
more_set_headers "Access-Control-Allow-Headers: Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,Keep-Alive,X-Requested-With,If-Modified-Since"; | |
more_set_headers "Content-Length: 0"; |
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 { withFilter } from 'graphql-subscriptions'; | |
... | |
Subscription: { | |
watchDevice: { | |
resolve: (payload) => payload, | |
subscribe: withFilter( | |
() => pubsub.asyncIterator(deviceConstants.UPDATE_DEVICE), | |
(payload, args) => payload._id.toString() === args.id, |
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 { withFilter } from 'graphql-subscriptions'; | |
... | |
Subscription: { | |
watchDevice: { | |
resolve: (payload) => payload, | |
subscribe: withFilter( | |
() => pubsub.asyncIterator(deviceConstants.UPDATE_DEVICE), | |
(payload, args) => payload._id.toString() === args.id, |
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 withDataAndSubscription = graphql(GETIMS_QUERY, { | |
options({toID}) { | |
console.log(GETIMS_QUERY); | |
const fromID = Meteor.userId(); | |
return { | |
fetchPolicy: 'cache-and-network', | |
variables: {fromID: `${fromID}`, toID: `${toID}`} | |
}; | |
} | |
, |
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
# Stop an actor | |
## PoisonPill Messages | |
A PoisonPill message has special handling for all actors, including for routers. When any actor receives a PoisonPill message, that actor will be stopped. See the PoisonPill documentation for details. | |
```scala | |
import akka.actor.PoisonPill | |
router ! PoisonPill | |
``` |
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 akka.actor._ | |
case class Book(title: String, authors: List[String]) | |
class BookPublisher extends Actor { | |
def receive = { | |
case book: Book => { | |
println(s"Yeah! Publishing a new book: $book") | |
context.system.eventStream.publish(book) |
NewerOlder