Skip to content

Instantly share code, notes, and snippets.

View poteto's full-sized avatar
🥔
ポテト

lauren poteto

🥔
ポテト
View GitHub Profile
# web/router.ex
defmodule MyApp.Router do
use Terraform, terraformer: MyApp.Terraformers.LegacyApi
# ...
end
# Route handled by Terraform
$ siege -c 255 -r 40 -b http://localhost:4000/v1/hello-world
Transactions: 10200 hits
Availability: 100.00 %
Elapsed time: 13.59 secs
Data transferred: 0.11 MB
Response time: 0.32 secs
Transaction rate: 750.55 trans/sec
Throughput: 0.01 MB/sec
@poteto
poteto / controllers.application.js
Created July 9, 2016 21:32
helpers should be pure
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
items: [2, 5, 3, 1, 4]
});
import Ember from 'ember';
export default Ember.Controller.extend({
actions: {
validate() { return true; }
}
});
'You look nice today.'
'Did you get a haircut?'
'Be cool. But also be warm.'
'Please consider the environment before printing this Doceo.'
"We're all in this together."
'Remember to get up and stretch once in a while.'
"You're here! The day just got better."
'Alpacas are cute. Give an alpaca a hug if you see one!'
'We like you.'
'Alright world, time to take you on!'
@poteto
poteto / twiddle.json
Last active July 5, 2016 09:52
Importing CSS into your Ember Twiddle is pretty simple – just import it as a dependency and give it a unique key. That's it!
{
"version": "0.10.1",
"EmberENV": {
"FEATURES": {}
},
"options": {
"use_pods": false,
"enable-testing": false
},
"dependencies": {
@poteto
poteto / controllers.application.js
Last active March 12, 2025 04:27
ember-changeset-validations demo
import Ember from 'ember';
import AdultValidations from '../validations/adult';
import ChildValidations from '../validations/child';
import { reservedEmails } from '../validators/uniqueness';
import { schema } from '../models/user';
const { get } = Ember;
const { keys } = Object;
export default Ember.Controller.extend({
// tests/integration/edit-location-test.js
test('it updates location via the form', function(assert) {
registerDummyComponent(this);
this.set('location', {});
this.render(hbs`
{{edit-location
location=location
ui=(hash
location-map=(component "dummy-component")
// tests/integration/edit-location-test.js
test('it ...', function(assert) {
registerDummyComponent(this);
this.set('location', {});
this.render(hbs`
{{edit-location
location=location
ui=(hash
location-map=(component "dummy-component")
// tests/helpers/dummy-component.js
import Ember from 'ember';
const {
Component,
assign,
getOwner
} = Ember;