Skip to content

Instantly share code, notes, and snippets.

View cameronbourke's full-sized avatar

Cameron Bourke cameronbourke

View GitHub Profile
const handleRouterUpdate = function () {
// import bowser from 'bowser';
if (bowser.msedge) {
// wrapping in a setTimeout ensures that it runs
// after the route has finished transitioning
setTimeout(() => {
const favicons = document.querySelectorAll('link[rel="icon"]');
Array.prototype.forEach.call(favicons, (fav) => { fav.href = fav.href; });
}, 0);
}
<Helmet
titleTemplate={"%s | " + config.siteName}
meta={[{
name: 'apple-mobile-web-app-title',
content: config.appName,
}, {
...
}]}
/>
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square70x70logo src="/mstile-70x70.png"/>
<square144x144logo src="/mstile-144x144.png"/>
<square150x150logo src="/mstile-150x150.png"/>
<square310x310logo src="/mstile-310x310.png"/>
<wide310x150logo src="/mstile-310x150.png"/>
<TileColor>#132935</TileColor>
import React from 'react';
import ReactDOM from 'react-dom';
import Perf from 'react-addons-perf';
import { range } from 'ramda';
window.Perf = Perf;
Perf.start();
class Foo extends React.Component {
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "AppDelegate.h"
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import "RCTRootView.h"
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <UIKit/UIKit.h>
@cameronbourke
cameronbourke / cwnd-sim.js
Created May 1, 2019 13:42
Simulating a simple network with two nodes A and B, with a buffer on the outbound link from A to B.
// Constants
// -----------------------------------------------
const DATA_PACKET_SIZE = 500 + 20 + 20;
const ACK_PACKET_SIZE = 0;
const BITS_TO_BYTE = 8;
const TOCK_MS = 1;
const LINK_RATE_BPS = 2 * Math.pow(10, 6);
const LINK_DELAY_MS = 50;
@cameronbourke
cameronbourke / .block
Created May 16, 2019 01:43
fresh block
license: mit
@cameronbourke
cameronbourke / .block
Created May 16, 2019 01:43
fresh block
license: mit