Skip to content

Instantly share code, notes, and snippets.

Avatar
😈
Up to no good, probably.

Victoria French victoriafrench

😈
Up to no good, probably.
View GitHub Profile
@sebmarkbage
sebmarkbage / asyncToReact.js
Last active Oct 6, 2019
Convert Async Function to React Component
View asyncToReact.js
function asyncToReact(fn) {
class PromiseComponent extends React.Component {
state = { waiting: true, result: null };
componentDidMount() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
componentDidUpdate() {
fn(...this.props.args).then(result => this.setState({ waiting: false, result }));
}
shouldComponentUpdate(newProps) {
@andrewchilds
andrewchilds / gist:11831dc82093e53d41af
Last active Oct 30, 2020
Rollbar RQL Cheat Sheet
View gist:11831dc82093e53d41af
# List users by average and maximum session length.
SELECT person, max(client.runtime_ms), avg(client.runtime_ms)
FROM item_occurrence
GROUP BY 1
ORDER BY 2 DESC
# List active date ranges for each deploy.
SELECT client.javascript.code_version, min(timestamp), max(timestamp)
FROM item_occurrence
GROUP BY 1
@pbakondy
pbakondy / play.js
Last active Dec 27, 2020
Play with Object.prototype.toString.call()
View play.js
// under Google Chrome 36
Object.prototype.toString.call([])
// "[object Array]"
Object.prototype.toString.call(function(){})
// "[object Function]"
Object.prototype.toString.call({})
// "[object Object]"
Object.prototype.toString.call(null)
// "[object Null]"
@gerasimua
gerasimua / httpd-vhosts.conf
Created May 21, 2014
Virtual host configurations
View httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "D:/Projects/PHP/silex-test/web"
ServerName silex-test.loc
ServerAlias www.silex-test.loc
ErrorLog "logs/dummy-host.example.com-error.log"
CustomLog "logs/dummy-host.example.com-access.log" common
</VirtualHost>