Skip to content

Instantly share code, notes, and snippets.

View ezy's full-sized avatar

Ezy ezy

  • Earth
View GitHub Profile
@ezy
ezy / bar_chart.js
Last active August 2, 2016 02:43
D3 bar chart with data-attribute values and tooltips on hover
'use strict';
function barChart(i, elem, data) {
var width = 300,
height = 150;
var formatPercent = d3.format('.0%');
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.1);
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
@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).

@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 / 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 / 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 / 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 / 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 / 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 / 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});
}