Skip to content

Instantly share code, notes, and snippets.

View lukemelia's full-sized avatar
💭
Making Yapp better all the time and likely working on some Ember.js OSS

Luke Melia lukemelia

💭
Making Yapp better all the time and likely working on some Ember.js OSS
View GitHub Profile
@lukemelia
lukemelia / index.js
Created April 4, 2015 04:49
ember-cli livereload, ssl and nginx (file from an in-repo addon)
'use strict';
/*
ember-cli's live-reload doesn't work out of the box for our configuration
because we run in local dev using www.yapp.dev over SSL. We use nginx to
terminate SSL and reverse proxy appropriate requests to ember-cli.
A configuration that gets live-reload working is implemented by this
addon plus nginx rules. This addon includes a script tag in index.html
as defined by the `contentFor` method below. Our standard nginx config
@lukemelia
lukemelia / ember-cli-build.js
Created February 19, 2016 18:44
Using an older ember-data with ember-cli-shims 0.1.0: ember-cli-shims 0.1.0 no longer shims ember-data because ember-data 2.3 is module-native. If you want to use an older version of ember-data though, you can shim it yourself
//...
app.import('vendor/ember-data-shims.js');
//...
@lukemelia
lukemelia / README.md
Last active April 21, 2023 17:13
keyboard-shortcut element modifer

An element modifier to attach a keyboard shortcut to an element that has a click method

Example usage:

  <button {{action 'doSomethingCool'}} {{keyboard-shortcut "D"}}>
    [D]o something cool
  </button>
@lukemelia
lukemelia / provision-waypoint.sh
Last active July 12, 2022 22:09
WIP deploying waypoint server to EC2 with terraform
set -e
# add docker's own apt repository
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# add hashicorp's apt repository
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
New York, New York, 2459115
Los Angeles, California, 2442047
Chicago, Illinois, 2379574
Houston, Texas, 2424766
Phoenix, Arizona, 2471390
Philadelphia, Pennsylvania, 2471217
San Antonio, Texas, 2487796
Dallas, Texas, 2388929
San Diego, California, 2487889
San Jose, California, 2488042
@lukemelia
lukemelia / join-yapp.md
Created April 5, 2022 02:03
Full Stack Engineer, Yapp

Ember, Rails & Mobile at Yapp (Remote)

Yapp is hiring a “full-stack” engineer, with key skills Ember.js & Rails. Join our small, talented team and do the best work of your career!

If you are passionate about your craft and want a chance to work remotely with a great team where you can influence the technology, process, product, and culture, read on!

About Yapp

We enable non-developers to create mobile apps for conference, trainings and employee communications. Yapp combines clean design, simple UX, and innovative mobile technology to empower people that may lack technical and design know-how, or just don't have time, to create and publish these apps in minutes.

@lukemelia
lukemelia / serialize_to_jsonapi.rb
Created January 21, 2022 18:52
Standalone model serialization with JSON::API Resources
class SerializeToJsonapi
DEFAULT_OPTIONS = {
serialization_options: { suppress_self_link: true }
}
def initialize(
model,
resource_class,
serialization_options = {},
require 'redis'
# SADD key, member
# Adds the specified <i>member</i> to the set stored at <i>key</i>.
redis = Redis.new
redis.sadd 'my_set', 'foo' # => true
redis.sadd 'my_set', 'bar' # => true
redis.sadd 'my_set', 'bar' # => false
redis.smembers 'my_set' # => ["foo", "bar"]
@lukemelia
lukemelia / 1-summary.md
Last active July 2, 2020 19:41
Simple component theming with broccoli.js

My team and I have been working on a new internal component library to share across a few Ember apps. The library is an Ember addon in a private github repo. So far, so good. The off-the-beaten-path part of our requirements is that the components need to be themeable. Specifically, we support a color and a "light" or "dark" aesthetic.

We want a great developer experience for creating and updating these components, so we used ember-freestyle as a devDependency of the library to create a living style guide. We added some UI to allow theme switching and even a checkbox to switch themes every second (thanks ember-concurrency!).

The thing that gave us the biggest challenge was figuring out how to author and apply the styles that were necessarily dynamic. Specifically, the css rules that used the dynamic color.

We decided to organize our styles like so:

app/styles/components/
@lukemelia
lukemelia / generate-reexport-in-app.js
Created June 18, 2020 06:09
vscode task for re-exporting an ember addon file that is open in the addon dir to the app dir
// bin/generate-reexport-in-app.js
const fs = require('fs');
const path = require('path');
let args = process.argv.slice(2);
let sourcePath = args[0];
let targetPath = sourcePath.replace(/^addon/,'app').replace(/^\.hbs/, '.js');
let pkg = require('../package.json');
let addonName = pkg.name;
let sourceModule = sourcePath.replace(/^addon/,addonName).replace(/\.(js|hbs)$/,'');