Skip to content

Instantly share code, notes, and snippets.

View JamesTheHacker's full-sized avatar

0xDEADBEEF JamesTheHacker

  • United Kingdom
View GitHub Profile
{
"version": "0.2.0",
"configurations": [
{
"name": "Chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceRoot}/src"
}
google-chrome — remote-debugging-port=9222
@JamesTheHacker
JamesTheHacker / gist:97e1784eaefa1b5bbc5fde8a9d65ccb4
Created October 21, 2017 10:20
Launching chrome with debugging windows
<path to chrome>/chrome.exe --remote-debugging-port=9222
@JamesTheHacker
JamesTheHacker / gist:36ab1f2683c4783ac13e05db314314e6
Created October 21, 2017 10:20
Launching chrome with remote debugging
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome — remote-debugging-port=9222
{
"name": "web",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:3001",
"dependencies": {
"enzyme-to-json": "^3.1.2",
"fetch-mock": "^5.13.1",
"prop-types": "^15.6.0",
"react": "^16.0.0",
@JamesTheHacker
JamesTheHacker / action.js
Last active October 18, 2017 16:00
Unit testing async action creators
/*
* Actions
*/
export const FETCHING_USER_FROM_API = 'FETCHING_USER_FROM_API';
export const FETCHED_USER_FROM_API = 'FETCHED_USER_FROM_API';
export const FETCHED_USER_ERROR = 'FETCHED_USER_ERROR';
/*
* Action creators
*/
export function fetchedUserFromApi(data) {
return {
type: FETCHED_USER_FROM_API,
data: {
isLoading: false,
isError: false,
...data
}
}
}
module.exports = async function misconfiguredCORS(url, test) {
let headers = null;
try {
const result = await request
.get(url)
.set('Access-Control-Allow-Origin', test)
.timeout(5000)
if('access-control-allow-origin' in result.headers) {
headers = {
const cheerio = require('cheerio');
const google = require('google');
const request = require('superagent');
const util = require('util');
const misconfiguredCORS = require('./plugins/misconfiguredCORS');
google.resultsPerPage = 100;
const g = util.promisify(google);
const store = createStore(
reducer,
initialState
);