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
# Title: Mitmproxy's addon for handling CORS preflight requests (tested with version 8.1.1) | |
# Usage: $ mitmproxy -s ./mitmproxy_CORSPreflight.py -p 8080 --ssl-insecure --mode reverse:https://www.google.com/ | |
from mitmproxy import http | |
class CORSPreflight: | |
def response(self, flow: http.HTTPFlow): | |
origin = flow.request.headers.get('origin', '*') | |
flow.response.headers['Access-Control-Allow-Origin'] = origin | |
flow.response.headers['Access-Control-Allow-Credentials'] = 'true' |
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
var repl = require('repl'); | |
function myEval(cmd, context, filename, callback) { | |
callback(null, String(cmd)); | |
} | |
const replServer = repl.start({ | |
prompt: '~> ', | |
//eval: myEval | |
}); |
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 autobind from 'autobind-decorator'; | |
import React from 'react'; | |
import { inject, observer } from 'mobx-react'; | |
import CreateUserModalStore from './CreateUserModalStore'; | |
export default class CreateUserModal extends React.Component { | |
constructor(props) { | |
super(props); | |
this.modalStore = new CreateUserModalStore(); |
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 autobind from 'autobind-decorator'; | |
import React from 'react'; | |
import { inject, observer } from 'mobx-react'; | |
import CreateUserModalStore from './CreateUserModalStore'; | |
export default class CreateUserModal extends React.Component { | |
constructor(props) { | |
super(props); | |
this.modalStore = new CreateUserModalStore(); |
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 React from 'react'; | |
export default class CreateUserModal extends React.Component { | |
render() { | |
const { isOpen, isLoading, errorMessage, onClose } = this.props; | |
if (isLoading) { | |
return <Spinner />; | |
} |
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 { observable } from 'mobx'; | |
import { withStateTransition, stateTransition } from './StateTransition'; | |
@withStateTransition | |
export class SessionStore { | |
constructor() {} | |
@observable accessToken = null; | |
@observable user = null; |
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 React from 'react'; | |
import { inject, observer } from 'mobx-react'; | |
@inject('session') | |
@observer | |
export class MyComponent extends React.Component { | |
render() { | |
const { session } = this.props; | |
if (session.state === 'loading') { |
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 { action, observable } from 'mobx'; | |
export class SessionStore { | |
constructor() {} | |
@observable accessToken = null; | |
@observable user = null; | |
@observable isLoading = false; | |
async logInByAccessToken(accessToken) { |
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 { action, observable } from 'mobx'; | |
export function withStateTransition(target) { | |
return class StateTransitionInjector extends target { | |
@observable state = 'idle'; | |
@action | |
setState(state) { | |
this.state = state; | |
} |
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
/* | |
Title --- electronic_lock.cpp [example] | |
Copyright (C) 2013 Giacomo Trudu - wicker25[at]gmail[dot]com | |
This file is part of Rpi-hw. | |
Rpi-hw is free software: you can redistribute it and/or modify | |
it under the terms of the GNU Lesser General Public License as published by | |
the Free Software Foundation version 3 of the License. |
NewerOlder