Skip to content

Instantly share code, notes, and snippets.

@NickGard
NickGard / safari-focus-polyfill.js
Last active January 29, 2024 10:24
Safari Focus Polyfill
(function() {
var capturedEvents = [];
var capturing = false;
function getEventTarget(event) {
return event.composedPath()[0] || event.target;
}
function captureEvent(e) {
if (capturing) {
@sorenlouv
sorenlouv / determine-changed-props.js
Last active April 18, 2024 16:21
Determine which props causes React components to re-render
import React, { Component } from 'react';
export default function withPropsChecker(WrappedComponent) {
return class PropsChecker extends Component {
componentWillReceiveProps(nextProps) {
Object.keys(nextProps)
.filter(key => {
return nextProps[key] !== this.props[key];
})
.map(key => {
// 1) what is console output for every line below
typeof 5;
typeof new Number();
typeof 0;
typeof -0;
typeof null;
typeof undefined;
typeof NaN;
typeof !0+1;
typeof Object;
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v