Skip to content

Instantly share code, notes, and snippets.

View trek's full-sized avatar
🏳️‍🌈

Trek Glowacki trek

🏳️‍🌈
View GitHub Profile
@trek
trek / components.email-form.js
Last active April 17, 2017 20:02
New Twiddle
import Ember from 'ember';
import EmberValidations from 'ember-validations';
export default Ember.Component.extend(EmberValidations, {
validations: {
value: {
presence: { message: 'must not be blank' }
}
},
isDisabled: Ember.computed('isValid', function(){
@trek
trek / controllers.application.js
Last active January 3, 2017 14:39
Routing to A Collection
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@trek
trek / no.rb
Last active February 29, 2016 14:14
resources :users, only: [:show] do
# even if a client knows address id #55, it also neeeds to know which
# user that belongs to.
resources :addresses, only: [:index, :create, :show, :update]
end
+-----------------+---------------+----------------+--------------+---------------------+
| Name | Total Stories | Total Velocity | Weeks Active | Weekly Velocity |
+-----------------+---------------+----------------+--------------+---------------------+
| [REDACTED] | 117 | 127 | 47 | 2.702127659574468 |
| [REDACTED] | 41 | 63 | 49 | 1.2857142857142858 |
| [REDACTED] | 71 | 76 | 46 | 1.6521739130434783 |
| [REDACTED] | 75 | 72 | 45 | 1.6 |
| [REDACTED] | 62 | 78 | 48 | 1.625 |
| [REDACTED] | 6 | 6 | 17 | 0.35294117647058826 |
| [REDACTED] | 50 | 52 | 24 | 2.1666666666666665 |
@trek
trek / color.js
Last active August 29, 2015 14:16
var Color = {};
Color.fromRGB = function (color) {
var ary = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
return [ary[1]/255, ary[2]/255, ary[3]/255];
};
Color.fromHex = function (color) {
if (color.length == 7) {
return [parseInt('0x' + color.substring(1, 3)) / 255,
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
var apply = function(obj,method,args) {
switch(args.length) {
case 0: return obj[method]();
case 1: return obj[method](args[0]);
case 2: return obj[method](args[0],args[1]);
case 3: return obj[method](args[0],args[1],args[2]);
case 4: return obj[method](args[0],args[1],args[2],args[3]);
case 5: return obj[method](args[0],args[1],args[2],args[3],args[4]);
};
};
var apply = function(obj,method,args) {
switch(args.length) {
case 0: return obj[method]();
case 1: return obj[method](args[0]);
case 2: return obj[method](args[0],args[1]);
case 3: return obj[method](args[0],args[1],args[2]);
case 4: return obj[method](args[0],args[1],args[2],args[3]);
case 5: return obj[method](args[0],args[1],args[2],args[3],args[4]);
};
};
@trek
trek / gist:6426610
Last active December 22, 2015 05:49

Progressive Enhancement: It Depends

If you haven't visited [Sigh, JavaScript][sigh, javaScript] for a good laugh, you should. It's the latest volley from the [progressive enhancement][progressive enhancement] community in response to the [growing trend][enough javascript] of writing full client applications that run in the browser and rely on a server for assets and data but not for rendering or state management.

Effectively, web applications written in this pattern mirror how client applications are written in any environment where the server doesn't pre-render a serialization of the interface. So, as an example, an iOS app doesn't request a pre-rendered screen from a server and display it to a user. This would require a rather odd tight coupling between server and client. Instead, the code for an iOS application contains all the necessary instructions to render the UI and a server is optionally used to retrieve any data that is stored centrally.

Progressive enhancement adherents seem [incapable of se

@trek
trek / dabblet.css
Created September 1, 2013 21:26
Untitled
body {
font-family: "Droid Sans", san;
}
.pure-g {
letter-spacing: -0.31em; /* Webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
*word-spacing: -0.43em; /* IE < 8: collapse white-space between units */
text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */
}