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 / 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 / css3.styl
Created March 31, 2011 01:40
A collection of mixins for Stylus to make using css3 a breeze
// MIXINS
vendor(prop, args)
-webkit-{prop} args
-moz-{prop} args
-o-{prop} args
{prop} args
animation()
vendor('animation', arguments)
@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 / 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
@mattmcmanus
mattmcmanus / imap-backup folders
Created December 10, 2013 15:36
imap-backup errors
$ imap-backup folders
***email***
/home/matt/.rvm/gems/ruby-1.9.3-p484/gems/imap-backup-1.0.3/bin/imap-backup:68:in `block in <top (required)>': undefined method `each' for nil:NilClass (NoMethodError)
from /home/matt/.rvm/gems/ruby-1.9.3-p484/gems/imap-backup-1.0.3/lib/imap/backup/configuration/list.rb:25:in `block in each_connection'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/gems/imap-backup-1.0.3/lib/imap/backup/configuration/list.rb:23:in `each'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/gems/imap-backup-1.0.3/lib/imap/backup/configuration/list.rb:23:in `each_connection'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/gems/imap-backup-1.0.3/bin/imap-backup:66:in `<top (required)>'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/bin/imap-backup:23:in `load'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/bin/imap-backup:23:in `<main>'
from /home/matt/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'