Skip to content

Instantly share code, notes, and snippets.


Tyler McGinnis tylermcginnis

Block or report user

Report or block tylermcginnis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
iammerrick / LazilyLoad.js
Last active Aug 7, 2019
Lazily Load Code Declaratively in React + Webpack
View LazilyLoad.js
import React from 'react';
const toPromise = (load) => (new Promise((resolve) => (
class LazilyLoad extends React.Component {
constructor() {

Turning Off Github Issues

My friend Michael Jackson turned off github issues on one of his smaller projects. It got me thinking...

Maintainers getting burned out is a problem. Not just for the users of a project but the mental health of the maintainer. It's a big deal for both parties. Consumers want great tools, maintainers want to create them, but maintainers don't want to be L1 tech support, that's why they

iammerrick / Component
Last active Dec 11, 2015
Component Extensibility & Toggling Children
View Component

A lot of times I'll see developers author a component like this:

const Component = ({shouldShowSomething}) => {
  return (
      <div>Some Elements</div>
      { shouldShowSomething ? <div>Something</div> : null }
mzabriskie / random-attendee.js
Last active May 8, 2019
Select random Meetup attendee
View random-attendee.js
// Run this from your browser console on your meetup event page (
(function () {
// Query document for attendees and select a random one
const list = document.querySelector('ul.attendees-list').children,
item = list[Math.floor(Math.random() * list.length)],
name = item ? item.querySelector('h4.text--bold').innerText : 'N/A';
// Remove item so they can only be selected once
item && item.parentNode.removeChild(item);
woonketwong / selectionRank
Last active Dec 31, 2015
Selection Rank is a well known algorithm in computer science to find the ith smallest (or largest) element in an array in linear time. If the elements are unique, you can find the ith smallest or largest element in expected O(n) time. The code below implements finding the ith smallest element in javascript.
View selectionRank
var selectionRank = function(array, rank){
// randomly select a pivot
var pivotIndex = Math.floor( (Math.random() * array.length) );
var pivot = array[pivotIndex];
// left array stores the smallest <rank> elements in the array
var leftArr = [];
var rightArr = [];
// partition into left and right arrays
for (var i = 0; i < array.length; i++){
woonketwong / jugglingDBWithPostgres
Last active Dec 29, 2015
JugglingDB with Postgres
View jugglingDBWithPostgres
var q = require('q');
var Schema = require('jugglingdb').Schema;
var schema = new Schema('postgres', {
database: 'woonketwong',
username: 'woonketwong'
// The first argument to schema.define is the table
// and schema name. Do not use any capital letter
// in the table name because the database create table
twosixcode / gist:1988097
Created Mar 6, 2012
Make "Paste and Indent" the default paste in Sublime Text 2
View gist:1988097
// swap the keybindings for paste and paste_and_indent
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" }
You can’t perform that action at this time.