Skip to content

Instantly share code, notes, and snippets.

@mattmcmanus
mattmcmanus / README.md
Created February 8, 2023 15:29
An alternative class to print the full route tree in the console

Router Printer

  1. Add router-printer.ts to you app
  2. Update your router.js to import it:
-import EmberRouter from '@ember/routing/router';
+import Router from './router-printer'

-export default class Router extends EmberRouter {
@mattmcmanus
mattmcmanus / helpers::debounce.js
Created June 8, 2022 16:29
Debounce helper spike
import { helper } from '@ember/component/helper';
import { isDestroyed } from '@ember/destroyable';
import { buildWaiter } from '@ember/test-waiters';
const testWaiter = buildWaiter('debounce-helper');
// WeakMap<Function, { timeoutId, asyncToken }>();
const TIMERS = new WeakMap();
function debounceHelper([context, action], { timeout }) {
return function(...args) {
@mattmcmanus
mattmcmanus / api.md
Created June 10, 2020 16:06
Proposed Freestyle API Changes

Freestyle API Spike

Freestyle's job

Provide a tight feedback loop when developing the visual aspects of components, including their many states, edgecases and others

It is NOT freestyle's job to be a primary source of documentation on how to use a component.

Goals

# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
@mattmcmanus
mattmcmanus / component.js
Last active April 8, 2016 18:24
Using ember-derred-content with ember-in-viewport
import Ember from 'ember';
const {
get,
computed
} = Ember;
import InViewportMixin from 'ember-in-viewport';
export default Ember.Component.extend(
InViewportMixin,
@mattmcmanus
mattmcmanus / Learning.markdown
Last active February 8, 2019 19:03
React Best Practices - Lessons learned after a couple months of using React

React Best Practices - Lessons learned after a couple months of using React

These are some things I've found helpful after doing React for a couple months. It's possible these practices are short sighted and will cause other problems, I just haven't hit those bumps in the road yet.

This list started after reading this phenomincal article on React Tips and Best Practicies.

1. Always define your propTypes. Always.

Think of propTypes as a love letter to whatever developer will work on a component after you. Your components should be as declarative as possible. React's error messaging is so clear and helpful and this will make things so much easier.

@mattmcmanus
mattmcmanus / gist:10131637
Created April 8, 2014 14:19
Testing vagrant download
$ curl -vvL 'https://d29vzk4ow07wi7.cloudfront.net/02b7cd7d01d9134dadebb3ce50ce3906ee572f4b?response-content-disposition=attachment%3Bfilename%3D%22vagrant_1.5.2.dmg%22&Policy=eyJTdGF0ZW1lbnQiOiBbeyJSZXNvdXJjZSI6Imh0dHA6Ly9kMjl2ems0b3cwN3dpNy5jbG91ZGZyb250Lm5ldC8wMmI3Y2Q3ZDAxZDkxMzRkYWRlYmIzY2U1MGNlMzkwNmVlNTcyZjRiP3Jlc3BvbnNlLWNvbnRlbnQtZGlzcG9zaXRpb249YXR0YWNobWVudCUzQmZpbGVuYW1lJTNEJTIydmFncmFudF8xLjUuMi5kbWclMjIiLCJDb25kaXRpb24iOnsiRGF0ZUxlc3NUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjEzOTY5NjY2OTZ9LCJJcEFkZHJlc3MiOnsiQVdTOlNvdXJjZUlwIjoiMC4wLjAuMC8wIn19fV19&Signature=STRkslDAMudEMPwSgaQom9ziOMy1hoUprd9yzRyunktqSpZd8rTBRTbdyswGFprZs8~gUibAB~kX-30HPGATTeuXmvRP5ShG0j8xmpg1seVnAd07lo8VEcQSljrgTa1lEXsmqyAXv4WuDHtsLmMBol6CQ47w5cT8SsHPncY2u8vTHQcZK~XMkiW0hdGxLMjZkv1zb5ipx4REO8Sh5N8TJjjjzynqO-bPPNq5zE6wC9dmbzR0chBxqZ4JWREEMhoS4O5lokDt~VIUbo0Iz1tx54zu9vPcekDvx5AnMQxvDmF-UhprgFIxO5Z9WAQdrxq4U4Qxk5s6UkICHUd-K1DxCw__&Key-Pair-Id=APKAIQIOJCQ5764M5VTQ'
* Adding handle: conn: 0x7fdbe8801c00
* Adding handle: send: 0
* Adding handle
@mattmcmanus
mattmcmanus / keybase.md
Created February 28, 2014 02:31
keybase.md

Keybase proof

I hereby claim:

  • I am mattmcmanus on github.
  • I am mattmcmanus (https://keybase.io/mattmcmanus) on keybase.
  • I have a public key whose fingerprint is 2707 C363 EB45 5469 CA10 E39C E9AF B3F4 EDB8 F457

To claim this, I am signing this object:

@mattmcmanus
mattmcmanus / style-guide.md
Last active January 4, 2016 00:29
The Beginning of a style guide for ce_bacchus

Baccus Style Guide

There are several things to keep in mind when writing the stylesheet for the app:

Markup & Styling Priorities

  1. Bootstrap: Does it fit into an existing component inside of bootstrap? Bootstrap's visual language is clearly defined and consistent. Most of our interface should be able to use the patterns already established.
  2. Custom Components: Does it fit into a custom component we've developed for the app or can a number of things be abstracted into a component?
  3. Page specific stylesheets: These should be the exception, not the norm. Whenever part of an interface cannot fall into any existing patterns then the styles should be put into a page or section specific stylesheet.
@mattmcmanus
mattmcmanus / bootstrap.sh
Created December 18, 2013 15:56
Quickly setting up Graylog2 on Ubuntu
#!/bin/bash
# Install Mongo
[[ ! `which mongod` ]] &&
(
echo " --- Installing MongoDB"
sudo apt-key add /vagrant/10gen-gpg-key.asc
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update -qq
sudo apt-get install mongodb-10gen -y -qq