Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Kinney stevekinney

View GitHub Profile
View _.md
@stevekinney
stevekinney / README.md
Last active Aug 29, 2015
Take a set of values and get the raw materials for making a Lorenz Curve.
View keybase.md

Keybase proof

I hereby claim:

  • I am stevekinney on github.
  • I am stevekinney (https://keybase.io/stevekinney) on keybase.
  • I have a public key whose fingerprint is 2BCA E390 D177 2ECF 8547 C7F8 A89B 7E5C 333C D92B

To claim this, I am signing this object:

View finnish-gdp.js
define([], [
{ "year": 2013, "gdp": 256912 },
{ "year": 2012, "gdp": 247280 },
{ "year": 2011, "gdp": 262620 },
{ "year": 2010, "gdp": 237148 },
{ "year": 2009, "gdp": 240004 },
{ "year": 2008, "gdp": 273253 },
{ "year": 2007, "gdp": 246481 },
{ "year": 2006, "gdp": 208143 },
{ "year": 2005, "gdp": 196118 },
View ember-charts.md

The cool thing about Ember is you can create Web Components that encapsulate reusable functionality. A component has two parts, a template (usually in Handlebars) and some JavaScript.

One of the nice things about Ember is that most of the names are just assumed. So if you pop a new component called {{my-chart}} into your application, Ember automatically looks for a template for that component in #{wherever_you_keep_your_templates}/components/my-chart.hbs and tries to create an instance of App.MyChartComponent. You can use App.MyChartComponent.extend({}) anywhere in your application to defite it's functionality.

The first step is pretty straight forward. With an Ember Component, you can grab onto the didInsertElement hook and initialize the graph. [Here is a code sample][insert] that basically shows how I did that.

  didInsertElement: function () {
    
    var width = this.$().parent().get(0).offsetWidth;
@stevekinney
stevekinney / colors.scss
Created May 16, 2014
CEE Color Pallette
View colors.scss
$forestGreen: rgb(48, 97, 88);
$green: rgb(116, 169, 73);
$leafGreen: rgb(153, 201, 135);
$darkBlue: rgb(16, 80, 143);
$cobalt: rgb(94, 138, 185);
$lightBlue: rgb(182, 221, 211);
$ocean: rgb(86, 185, 197);
$orange: rgb(227, 117, 54);
$yellow: rgb(248, 212, 58);
$pale: rgb(255, 245, 213);
View server.js
module.exports = {
drawRoutes: function(app) {
app.use(function(req, res) {
es.render('404');
});
}
};
View planets.swift
enum Planet: Int {
case Mercury = 1, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune
}
Planet.Mercury.toRaw()
let possiblePlanet = Planet.fromRaw(7)
@stevekinney
stevekinney / z-index.js
Created Jun 5, 2014
Set to Top-Most Element Based on Time
View z-index.js
$(this).css('z-index', parseInt((+new Date()).toString().slice(6), 10));
/*
Uses the system time to set the current element's z-index above other elements
on the page. This terrible hack allows me to not have to store the most recent
z-index anywhere. I can't wait to see how it bites me.
Context: I use it with draggables in jQuery UI.