Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Clopton Samsinite

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am Samsinite on github.
  • I am samsinite (https://keybase.io/samsinite) on keybase.
  • I have a public key whose fingerprint is C8E5 D10B 6AD3 9382 39AE B3D8 43FB 2937 B6CD F09E

To claim this, I am signing this object:

View builder object wrapper
class FooController
include ApiMe
model FooService
end
class FooService
def initialize(*args)
@foo = Foo.new(*args)
end
@Samsinite
Samsinite / stop-watch.js
Last active Aug 29, 2015
Some Stop Watch Code
View stop-watch.js
import Ember from 'ember';
import moment from 'moment';
const { setProperties } = Ember;
export default Ember.Controller.extend({
isRunning: false,
startDisabled: Ember.computed.alias('isRunning'),
stopDisabled: Ember.computed.not('startDisabled'),
cachedDuration: null,
@Samsinite
Samsinite / application.hbs
Created May 16, 2015
Basic Application Layout
View application.hbs
<nav id="top-nav">
<h1>Ember Fit</h1>
</nav>
<nav id="side-nav">
<ul>
<li><a id="ember418" class="ember-view" href="/"><i class="fa fa-calendar icon"></i>Scheduler</a></li>
<li><a id="ember419" class="ember-view" href="/stop-watch"><i class="fa fa-clock-o icon"></i>Stop Watch</a></li>
<li><a id="ember420" class="ember-view active" href="/workout-builder/index"><i class="fa fa-plus-square icon"></i>Workout Builder</a></li>
</ul>
</nav>
View stop-watch.hbs
<div id="stop-watch">
<div class="timer-wrapper">
00:00:00:000
</div>
<div class="button-wrapper">
<button class="btn btn-primary" data-ember-action="1006">Start</button>
<button class="btn btn-primary" data-ember-action="1007" disabled="">Stop</button>
<button class="btn btn-danger" data-ember-action="1008">Reset</button>
</div>
</div>
@Samsinite
Samsinite / index.hbs
Created May 17, 2015
Workout Index List Markup
View index.hbs
<div id="workout-builder">
<div id="workout-builder-index">
<a id="ember986" class="btn btn-primary">New</a>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th></th>
</tr>
@Samsinite
Samsinite / pad-number.js
Created May 17, 2015
Pad Number Helper
View pad-number.js
import Ember from 'ember';
export function padNumber(params/*, hash*/) {
var str = params[0] + "";
var size = params[1];
while (str.length < size) {
str = "0" + str;
}
@Samsinite
Samsinite / bootstrap-input.hbs
Last active Aug 29, 2015
bootstrap select compoent
View bootstrap-input.hbs
<!-- app/templates/components/bootstrap-input.hbs -->
<label for="{{inputId}}">{{label}}</label>
{{input value=value placeholder=placeholder elementId=inputId classNames="form-control"}}
View application.js
import LFSerializer from 'ember-localforage-adapter/serializers/localforage';
export default LFSerializer;
@Samsinite
Samsinite / computed-many-through-async.js
Created Jul 6, 2015
Ember Data nested join relation computed function
View computed-many-through-async.js
import { createSortableArray } from './sortable-array-proxy';
const { get, set } = Ember;
/****
* TODO: If need sorting, add sort logic
*****/
export default function computedManyThroughAsync(joinRelationAttr, nestedRelationAttr, sortProperties, sortAscending = true) {
return Ember.computed(joinRelationAttr, function() {
var joinRelationPromise = get(this, joinRelationAttr);