Skip to content

Instantly share code, notes, and snippets.

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@kkemple
kkemple / .eslintrc.js
Last active July 18, 2023 21:51
Extract Schema from Gatsby
module.exports = {
extends: ["react-app"],
env: {
browser: true,
node: true,
jest: true
},
rules: {
"graphql/template-strings": [
"error",
@ipbastola
ipbastola / jq to filter by value.md
Last active June 21, 2024 14:29
JQ to filter JSON by value

JQ to filter JSON by value

Syntax: cat <filename> | jq -c '.[] | select( .<key> | contains("<value>"))'

Example: To get json record having _id equal 611

cat my.json | jq -c '.[] | select( ._id | contains(611))'

Remember: if JSON value has no double quotes (eg. for numeric) to do not supply in filter i.e. in contains(611)

@scmx
scmx / react-proptype-warnings-as-errors-with-sinon.markdown
Last active March 1, 2019 08:42
Make React PropType warnings throw errors with mocha.js, enzyme.js and sinon.js

Make React PropType warnings throw errors with enzyme.js + sinon.js + mocha.js

A simple stateless functional component that we want to test that it renders without propType warnings.

import React, { PropTypes } from 'react'

let VersionListItem = function ({ active, version }) {
  return (
@ericqweinstein
ericqweinstein / wwfp.md
Last active May 4, 2016 15:17
Wednesday Workshops: Functional Programming Patterns in JavaScript

Wednesday Workshops: Functional Programming Patterns in JavaScript

About

Each workshop is ~45 minutes over lunch on Wednesdays. There will be a repo with sample code and additional resources so you can continue learning outside the workshop if you want to.

Curriculum

We'll be using Michael Fogus' Functional Programming in JavaScript as a loose guide. I'll provide you with an electronic copy (EPUB, MOBI, or PDF).

@ahliang85
ahliang85 / modify-dom.txt
Last active May 1, 2023 21:51
Chrome Extension - Modify DOM
Background page is kind of like you own mini server - it is a completely isolated page that has nothing to do with pages a user visits. It is used for controlling the rest of extension components as it is always running in background.
Content scripts are pieces of javascript code that are getting injected into actual pages a user visits and can access and modify parent page's DOM.
So to get your extension working you need to remove
<script src="jquery.min.js"></script>
<script src="content.js"></script>
from background page, and inject jquery as a content script either through manifest:
@adjavaherian
adjavaherian / Analytics.jsx
Last active December 13, 2017 15:33 — forked from fredrick/App-example-test.js
Here's how we have been pre-processing Jest tests for React.js components which require React-Router or Fluxxor.
//./app/modules/Analytics.jsx
var React = require('react');
var Fluxxor = require('fluxxor');
var FluxMixin = Fluxxor.FluxMixin(React);
var paths = require('../helpers/paths');
var Analytics = React.createClass({
displayName: 'Analytics',
mixins: [FluxMixin],
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@andrewluetgers
andrewluetgers / gist:927fb8a8651d7a713365
Created February 5, 2015 16:38
Webpack + React + Stylus, Dev: Hotloat, Build: File Output
var webpack = require('webpack'),
path = require('path'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
isDev = process.env.NODE_ENV;
var config = {
cache: true,
resolve: {
extensions: ["", ".js", ".css", ".styl"]
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.