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
| Model = { | |
| create: function (collection, methods) { | |
| var model = function (doc) { | |
| _.extend(this, doc); | |
| }; | |
| _.extend(model.prototype, methods); | |
| collection._transform = function (doc) { | |
| return new model(doc); | |
| }; |
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
| rcy@laird:~/tmp$ meteor --version | |
| Meteor 0.9.0 | |
| rcy@laird:~/tmp$ meteor create myapp | |
| myapp: created. | |
| To run your new app: | |
| cd myapp | |
| meteor | |
| rcy@laird:~/tmp$ cd myapp |
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
| // some random collection | |
| Things = new Meteor.Collection('things'); | |
| // collection used to track users who are blocked from inserting | |
| Blocked = new Meteor.Collection('blocked'); | |
| if (Meteor.isServer) { | |
| Meteor.startup(function () { | |
| // remove all documents on startup for testing purposes | |
| Blocked.remove({}); |
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 { createMeteorNetworkInterface, meteorClientConfig } from 'meteor/apollo'; | |
| import { ApolloClient } from 'react-apollo'; | |
| import { SubscriptionClient, addGraphQLSubscriptions } from 'subscriptions-transport-ws'; | |
| const wsClient = new SubscriptionClient('ws://localhost:5000/', { | |
| reconnect: true, | |
| }); | |
| // Create a normal network interface: |
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 React, { Component } from 'react'; | |
| import { gql, graphql, withApollo, compose } from 'react-apollo'; | |
| class Box extends Component { | |
| state = { | |
| mutateCount: 0, // the number of times we have called mutate() | |
| subCount: 0, // the number of times we have received subscription event | |
| }; | |
| componentWillMount() { |
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
| (progn | |
| (condition-case nil | |
| (scroll-down 1) | |
| (error nil)) | |
| (message "got here")) | |
| ;; simpler version of above | |
| (progn | |
| (ignore-errors (scroll-down 1)) | |
| (message "got here")) |
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
| (defun rcirc-reposition-to-bottom (orig-fun &rest args) | |
| "Reposition the window to put point at bottom line." | |
| (when (and (eq major-mode 'rcirc-mode) | |
| (eq (point) (point-max)) | |
| (recenter -1)))) | |
| (advice-add 'text-scale-adjust :after #'rcirc-reposition-to-bottom) |
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
| #!/bin/bash | |
| # | |
| # usage: rehash.sh committed/*.sql | |
| # | |
| # This will update each file's Previous and Hash values | |
| # | |
| function sum { | |
| sha1sum | cut -d' ' -f1 | |
| } |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions | |
| // - XState (all XState exports) |
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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |