Skip to content

Instantly share code, notes, and snippets.

@machty
machty / borf.md
Last active June 16, 2016 17:14
Distinguishing between redirect/afterModel

Background

Right now, afterModel and redirect are almost aliases; specifically, the default implementation of Route#afterModel calls redirect. The only difference is that the return value of redirect() is not used in any way, so you can't, say, return a promise from redirect and expect the transition to pause, which you'd be able to do with afterModel.

Scumbag machty tried to deprecate redirect, was met with pushback, and removed the soft deprecation. Now he's wondering if they are semantically separate enough to keep both around.

afterModel is the last of promise-aware route-entry-validation hooks, which is to say that beforeModel, model, and afterModel allow you to return promises that pause the transition until they resolve, and if they reject (or transitionTo elsewhere), the transition gets aborted. I call them route-entry-validation hooks because one of their main jobs is to validate that the route in question can actually be entered at this time. Part of this validation

@zulaica
zulaica / handy_ember_nombom.bash
Last active June 24, 2016 09:59
Handy Ember NomBom
###
# Handy Ember NomBom
# N.B. Meant to be used with Super Spinner
# https://gist.github.com/zulaica/9e971cc5b6dbd156abcd13745beff262
#
# Usage:
# $ nombom
#
# WTF:
# 1. Delete node_modules, bower_components, dist, and tmp directories
@BrianSipple
BrianSipple / ember-addon-essentials.md
Last active April 17, 2017 18:27
Ember Addon Essentials -- A checklist of some of the finer details to keep in mind when developing Ember addons

Ember Addon Essentials

This document is meant to be a brief "checklist" of things to setup for your Ember addon when beginning development in order to have the best possible architecture and workflow out of the gate. For more comprehensive material, the following are bookshelf-caliber:

Filling out package.json

#C# Coding Standards

###Refactoring

Embrace refactoring! Make code refactorable by adding tests using TDD. Really TDD exists to allow refactoring.

The term code smell comes from Martin Fowler's book Refactoring. If you haven't already, read this book. The examples are in Java but they easily translate to C#. Don't write new code that has smells by refactoring them out. Here is a list of the most egregious smells:

  • Duplicated code.
  • Long Method.
@seiyria
seiyria / README.md
Last active January 8, 2018 04:29
Code Quality and You

update: this post has been moved to my blog

Welcome! Today I'd like to talk about another subject which can't be emphasized enough: Code Quality. This entails a lot of tools and patterns that ultimately come together to make your game more solid and programmer friendly. Even if you're working alone on a project, these tools can save you some precious debugging time by pointing out simple errors, if not more complex ones. I'll be using my current project, c as an example where possible.

A few notes before we get started:

  • Some of the following tools are specific to the JavaScript ecosystem.
  • Some of the following tools are only free for open source projects, so bear in mind that you might be missing out on the awesome!

Style Checking

Some of the easiest tools you can set up for your project are JSHint and JSCS. These tools provide basic st

@rezoner
rezoner / easings.js
Created March 2, 2015 17:27
One argument easing equations
/*
A full list of simple easing equations inspired by GIST from greweb - https://gist.github.com/gre/1650294
Equations source - http://gsgd.co.uk/sandbox/jquery/easing/
*/
{
linear: function(t) {
return t
},
inQuad: function(t) {
port module Spelling exposing (..)
import Html exposing (..)
import Html.App as App
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import String
main =
@henrik
henrik / poolboy_demo.ex
Last active December 16, 2020 13:56 — forked from sasa1977/poolboy_demo.ex
Example of using Poolboy in Elixir to limit concurrency (e.g. of HTTP requests).
defmodule HttpRequester do
use GenServer
def start_link(_) do
GenServer.start_link(__MODULE__, nil, [])
end
def fetch(server, url) do
# Don't use cast: http://blog.elixirsips.com/2014/07/16/errata-dont-use-cast-in-a-poolboy-transaction/
timeout_ms = 10_000
@KdotJPG
KdotJPG / OpenSimplexNoiseTileable3D.java
Created December 25, 2014 13:18
Tileable 3D OpenSimplex Noise
/*
* OpenSimplex Noise in Java.
* by Kurt Spencer
*
* Tileable 3D version, preliminary release.
* Could probably use further optimization.
*
* w6, h6, and d6 are each 1/6 of the repeating period.
* for x, y, z respectively. If w6 = 2, h6 = 2, d6 = 2,
* then the noise repeats in blocks of (0,0,0)->(12,12,12)