Skip to content

Instantly share code, notes, and snippets.

View ezy's full-sized avatar

Ezy ezy

  • Earth
View GitHub Profile
@ezy
ezy / test.md
Last active September 14, 2023 00:09
Debugging Qunit tests

Run the tests using ember test -f 'acceptance' --serve. This will persist the browser, and will run the tests on source code change. You will be presented with the testem interface.

The way I step through the tests is in the test source code, guess where you think the tests are failing, and insert a pauseTest();. When the tests run in the browser, tick the development tickbox, and the testem interface will disppear, but you will notice the test run. It should stop at the point where you put the pauseTest in. Open up the devtools and use the console like an interactive debugger, except if you want to step forward, just copy and paste the code from the test into the console.

@ezy
ezy / date-sequence.js
Last active December 16, 2016 01:05
Generate a sequential date object with values
let date = new Date();
let output=[];
for (let n=0; n<100; n++) {
let d = date.setDate(date.getDate() + n),
price = Math.random() * 100;
price = parseFloat(price).toFixed( 2 );
output.push({d, price});
}
@ezy
ezy / index.html
Last active December 15, 2016 21:17
D3 Bar chart with tooltip hover
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
</head>
<body>
<h1>D3 Bar</h1>
<div class="container">
<div class="row">
@ezy
ezy / ember-single.sh
Last active December 6, 2016 00:28
Run a single ember test
ember test --filter "some string to match in test title"
ember test --server --filter "something to match"
@ezy
ezy / Kill.bash
Last active January 24, 2017 21:08
Find and kill process running on port <PID> on OSX
// See which processes are running
lsof -i tcp:<Port>
// Kill process ID
kill -9 <PID>
@ezy
ezy / ajax.js
Created November 12, 2016 00:28
Simple ember spotify artist ajax request
// app/artist/route.js (pods structure)
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
return Ember.$.ajax({
url: `https://api.spotify.com/v1/artists?ids=0oSGxfWSnnOXhD2fKuz2Gy,3dBVyJ7JuOMt4GE9607Qin`
}).then(function(response) {
return response.artists.map((data) => {
return data;
@ezy
ezy / format-date.js
Last active May 10, 2022 20:25
A date format helper for Ember JS
// helpers/format-date.js
import Ember from 'ember';
export function formatDate(params, hash) {
let date = hash.date;
if (!date) {
date = new Date();
} else {
date = date;
@ezy
ezy / emberjs-cheat-sheet.md
Created September 6, 2016 08:10 — forked from dreikanter/emberjs-cheat-sheet.md
Ember.js Cheat Sheet

Core concepts

Model

  • An object that stores data (data persistance layer abstraction).
  • Templates transforms models into HTML.
  • Same thing as Rails model.

Template

@ezy
ezy / comparison.md
Created September 2, 2016 00:31 — forked from makmanalp/comparison.md
Angular vs Backbone vs React vs Ember notes

Note: these are pretty rough notes I made for my team on the fly as I was reading through some pages. Some could be mildly inaccurate but hopefully not terribly so. I might resort to convenient fiction & simplification sometimes.

My top contenders, mostly based on popularity / community etc:

  • Angular
  • Backbone
  • React
  • Ember

Mostly about MVC (or derivatives, MVP / MVVM).

This will tell git you want to start ignoring the changes to the file
git update-index --assume-unchanged path/to/file
When you want to start keeping track again
git update-index --no-assume-unchanged path/to/file