Skip to content

Instantly share code, notes, and snippets.

View Samsinite's full-sized avatar

Sam Clopton Samsinite

View GitHub Profile

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:

@Samsinite
Samsinite / application serializer
Created November 7, 2014 10:05
Ember Data array extraction customization example
DS.RESTSerializer.extend({
extractArray: function(store, type, payload) {
var inflector = Ember.Inflector.inflector,
data = payload || [],
modifiedPayload = {};
modifiedPayload[inflector.pluralize(type.typeKey)] = data;
return this._super(store, type, modifiedPayload);
}
class FooController
include ApiMe
model FooService
end
class FooService
def initialize(*args)
@foo = Foo.new(*args)
end
@Samsinite
Samsinite / array.js
Created January 26, 2015 04:47
Array transform for ember-data
import Ember from 'ember';
import DS from 'ember-data';
export default DS.Transform.extend({
serialize: function(deserialized) {
return !!deserialized ? deserialized.toArray() : null;
},
deserialize: function(serialized) {
return Ember.A(serialized);
@Samsinite
Samsinite / application.hbs
Created May 16, 2015 21:30
Basic Application Layout
<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>
<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 / stop-watch.js
Last active August 29, 2015 14:21
Some Stop Watch Code
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 / pad-number.js
Created May 17, 2015 19:21
Pad Number Helper
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 / index.hbs
Created May 17, 2015 19:55
Workout Index List Markup
<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 / application.js
Created May 17, 2015 21:37
LF Serializer
import LFSerializer from 'ember-localforage-adapter/serializers/localforage';
export default LFSerializer;