Skip to content

Instantly share code, notes, and snippets.

View Samsinite's full-sized avatar

Sam Clopton Samsinite

View GitHub Profile
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
});
@Samsinite
Samsinite / components.x-list-item.js
Last active April 8, 2019 18:47
each yield test
import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'li',
});
@Samsinite
Samsinite / Worksheet.md
Last active February 7, 2019 17:18
Higher Order Components

Higher Order Components

Higher Order Components (commonly refered to as HOC) is a function that takes a component as an argument and returns a new component, using the component passed to it to decorate or transform. See https://reactjs.org/docs/higher-order-components.html for Reacts documentation on higher order components for more details.

Exercise One

Using the function below that returns a mocked dataset, build a component inside of Cherish (and render using Cosmos for ease of development) that accepts this information as a parameter posts and renders the

@Samsinite
Samsinite / instance-initializer-schema.js
Last active September 26, 2018 08:10
Javascript API Annotation DSL
// app/instance-initializers/schema.js
import fetch from 'fetch'
import { loadSchema } from 'wildland-schema/ember-data';
import ENV from '../config/environment';
// load schema and store to report usage violations
export function initialize(applicationInstance) {
if (ENV.environment === 'development') {
const store = applicationInstance.lookup('service:store');
@Samsinite
Samsinite / baz_serializer.rb
Created September 26, 2018 06:52
Ruby API Annotation DSL
class BazSerializer < BaseSerializer
attribtes :id, :thing, :bar
deprecated_attribute :old_thing
deprecation_flag: ::FeatureFlags::DEPRECATED_FEATURE_FOO,
upgrade_instructions: <<-INSTRUCTIONS
Replace `baz.old_thing` with `baz.thing`
INSTRUCTIONS
deprecated_belongs_to :foo
@Samsinite
Samsinite / Import CSV Specification.md
Last active April 16, 2018 06:23
Person Import Specification v1

CSV Format:

[Person] - See format specification
[Notes to attach to above person] - See format specification
[Person] - See format specification
[Notes to attach to above person] - See format specification
...

@Samsinite
Samsinite / base_serializer.rb
Last active September 22, 2017 20:49
Serializers
module ApiMe
module Serializers
class Base
attr_reader :object
def self.serializer_meta
@serializer_meta ||= SerializerMeta.new
end
def self.has_many(name, options = {})
UNIQUEIDENTIFIER CONSTRAINT [id] DEFAULT (newsequentialid()) NOT NULL,
#!/usr/local/heroku/ruby/bin/ruby
# encoding: UTF-8
# resolve bin path, ignoring symlinks
require "pathname"
bin_file = Pathname.new(__FILE__).realpath
# add locally vendored gems to libpath
gem_dir = File.expand_path("../../vendor/gems", bin_file)
Dir["#{gem_dir}/**/lib"].each do |libdir|
@Samsinite
Samsinite / controllers.application.js
Last active September 26, 2016 17:31
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});