Skip to content

Instantly share code, notes, and snippets.

// @flow
import React from 'react';
import hoistStatics from 'hoist-non-react-statics';
import { withNavigation } from 'react-navigation';
import type { Subscription } from '../../types';
export default function createNavigationAwareScrollable(Component: any) {
class ComponentWithStatusBar extends React.PureComponent<any> {
@nickcernis
nickcernis / readme.md
Last active March 7, 2024 01:43
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@swyxio
swyxio / react-router-state-manager.jsx
Last active July 26, 2022 10:43
Sync your state to your query params for copy-pastable state-in-URLs. React Router, Gatsby, and Svelte versions
// note - this was my rough working prototype, but still left some artifacts in the query params.
// todo: also need to debounce the history pushes
// see comments for production Gatsby and Svelte versions which delete nondefault keys in the query params
import React from 'react'
import queryString from "query-string"
export const connectRouterState = defaultURLState => Component => props => {
const { history, location } = props
// note: do not nest objects in URL state

Styled component use case

Styled component as standard react component

avoid creating middleware react component

before

const StyledIcon = styled(Icon)``;
export const HomeIcon = () => <StyledIcon uri="icn-home.svg" />;
@morganrallen
morganrallen / _README.md
Last active January 15, 2023 19:41
Janky Browser

JankyBrowser

The only cross-platform browser that fits in a Gist!

One line install. Works on Linux, MacOSX and Windows.

Local Install

$&gt; npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
@insin
insin / BootstrapModalMixin.js
Last active February 5, 2021 07:47
A Bootstrap (3) modal mixin for React / MIT License
/** @jsx React.DOM */
var BootstrapModalMixin = function() {
var handlerProps =
['handleShow', 'handleShown', 'handleHide', 'handleHidden']
var bsModalEvents = {
handleShow: 'show.bs.modal'
, handleShown: 'shown.bs.modal'
, handleHide: 'hide.bs.modal'
@syllog1sm
syllog1sm / bootreact
Created January 13, 2014 15:09
Draft proposals for wrapping Bootstrap components with React.js
/** @jsx React.DOM */
'use strict';
// Components wrapping Twitter Bootstrap stuff
//
var BSNames = {
// This isn't exhaustive. Need to think through what should go here. Should
// be exclusive.
bsClass: {'column': 'col', 'button': 'btn', 'btn-group': 'btn-group', 'label': 'label',
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),