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
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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
| // getComponent is a function that returns a promise for a component | |
| // It will not be called until the first mount | |
| function asyncComponent(getComponent) { | |
| return class AsyncComponent extends React.Component { | |
| static Component = null; | |
| state = { Component: AsyncComponent.Component }; | |
| componentWillMount() { | |
| if (!this.state.Component) { | |
| getComponent().then(Component => { |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>AWS Cognito + Facebook Login JavaScript Example</title> | |
| <meta charset="UTF-8"> | |
| </head> | |
| <body> | |
| <script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.41.min.js"></script> | |
| <script> | |
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
| proxy_cache_path /var/cache/nginx/cache levels=1:2 keys_zone=cache:8m max_size=3000m inactive=600m; | |
| proxy_temp_path /var/tmp; | |
| # the IP(s) on which your node server is running. I chose port 3000. | |
| upstream app_the_scratch { | |
| server 127.0.0.1:3000 weight=1 fail_timeout=60s; | |
| } | |
| # the nginx server instance | |
| server { |
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
| /* | |
| This example shows how you can use your data structure as a basis for | |
| your Firebase security rules to implement role-based security. We store | |
| each user by their Twitter uid, and use the following simplistic approach | |
| for user roles: | |
| 0 - GUEST | |
| 10 - USER | |
| 20 - MODERATOR |
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
| export class SyncPath { | |
| constructor(rootRef, path) { | |
| this._rootRef = rootRef; | |
| this.user = this._rootRef.getAuth(); | |
| this._userDataRef = this._rootRef.child(path).child(this.user.uid); | |
| this.data = {}; | |
| this._userDataRef.on('value', (snap) => this.data = snap.val() || {}); | |
| } | |
| keys() { | |
| return Object.keys(this.data); |
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
| { | |
| "rules": { | |
| "users": { | |
| "$uid": { | |
| ".validate": "newData.hasChildren(['uid', 'name', 'username'])", | |
| "uid": { | |
| ".validate": "newData.isString()" | |
| }, | |
| "name": { | |
| ".validate": "newData.isString()" |
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
| '.source.go': | |
| 'Options': | |
| 'prefix': 'options' | |
| 'body': ''' | |
| // Option function. | |
| type Option func(*$1) | |
| // New with the given options. | |
| func New(options ...Option) *$1 { |
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
| <?php | |
| // curl -sS https://getcomposer.org/installer | php | |
| // php composer.phar require aws/aws-sdk-php | |
| // export AWS_ACCESS_KEY_ID=... | |
| // export AWS_SECRET_ACCESS_KEY=... | |
| $streamName = '<INSERT_YOUR_STREAMNAME_HERE>'; | |
| $numberOfRecordsPerBatch = 10000; |
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
| 'use strict'; | |
| var elasticsearch = require('elasticsearch'); | |
| var Promise = require('bluebird'); | |
| var log = console.log.bind(console); | |
| var client = new elasticsearch.Client({ | |
| host: 'localhost:9200', | |
| log: 'trace' |