Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Clopton Samsinite

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

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 Sep 26, 2018
Javascript API Annotation DSL
View instance-initializer-schema.js
// 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 Sep 26, 2018
Ruby API Annotation DSL
View baz_serializer.rb
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 Apr 16, 2018
Person Import Specification v1
View Import CSV Specification.md

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
...

View base_serializer.rb
module ApiMe
module Serializers
class Base
attr_reader :object
def self.serializer_meta
@serializer_meta ||= SerializerMeta.new
end
def self.has_many(name, options = {})
View t.sql
UNIQUEIDENTIFIER CONSTRAINT [id] DEFAULT (newsequentialid()) NOT NULL,
@Samsinite
Samsinite / array.js
Created Jan 26, 2015
Array transform for ember-data
View array.js
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);
View heroku
#!/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|