https://www.whatsmydns.net/#TXT/corlaez.com
https://serverfault.com/questions/748981/what-does-error-token-mismatch-mean
import React from "react"; | |
var MyMixin = { | |
componentDidUpdate() { | |
this.componentMethod() | |
}, | |
mixinMethod() {} | |
}; | |
const MyComponent = React.createClass({ |
function merge(l1, l2) { | |
const se = new Set(l1); | |
l2.forEach(e => se.add(e)) | |
return [...se] | |
} | |
const x = Object.keys(old).reduce((acc, cur) => { | |
acc[cur] = merge(old[cur], neww[cur]); | |
return acc | |
}, {}) |
netstat -ano | findstr :PORT | |
taskkill /PID_NUMBER /F | |
netstat -ano | findstr 3000 | |
taskkill /9052 /F |
import { useState, useEffect } from 'react' | |
export const useMousePosition = () => { | |
const [position, setPosition] = useState({ x: 0, y: 0 }); | |
useEffect(() => { | |
const setFromEvent = (e: any) => setPosition({ | |
x: e.clientX, | |
y: e.clientY | |
}); | |
window.addEventListener("mousemove", setFromEvent); |
/* state.ts | |
* Here we define the initial state of the application. | |
* I have ommited the types for Newspapers, Table and State for brevity. | |
*/ | |
export const state: State = { | |
table: { | |
selected: null, | |
newspapers: [], | |
}, | |
} |
const mysql = require('mysql2') | |
const createConnection = (connectedCB) => { | |
const envParams = { | |
host: process.env.host, | |
user: process.env.user, | |
password: process.env.password, | |
database: process.env.database, | |
} | |
if (Object.keys(envParams).some(k => envParams[k] == null)) { |
const mysql = require('mysql2') | |
const createConnection = (connectedCB) => { | |
const envParams = { | |
host: process.env.host, | |
user: process.env.user, | |
password: process.env.password, | |
database: process.env.database, | |
} | |
if (Object.keys(envParams).some(k => envParams[k] == null)) { |
echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_watches && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_queued_events && echo 999999 | sudo tee -a /proc/sys/fs/inotify/max_user_instances |
While working with zeit now serverless functions I needed to execute my apis locally (they connected to a db and processed the data) and see if they work correctly
This code allows you to execute any api and just logs or ignores the result of the api. Useful for manual checks but could be expanded to run automated tests as well.
What I like is that you can test any api just importing the api and instanciating a client. The requests are JavaScript objects and that makes it very natural and simple to read and write api tests.
The heart of the client creator is the createExecutor higher order function, that's the real MVP.