Skip to content

Instantly share code, notes, and snippets.

@Emerson
Emerson / machine.js
Last active July 6, 2021 16:46
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@Emerson
Emerson / controllers.application.js
Last active October 29, 2019 19:24
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
selectedIds: Ember.computed('signingPackages.@each.ids', function() {
var ids = [];
this.get('signingPackages').forEach(function(signingPackage) {
ids = ids.concat(signingPackage.get('ids'));
});
import Ember from 'ember';
export default Ember.Component.extend({
init() {
this._super();
},
filteredSignatories: Ember.computed('signatories.[]', function() {
return this.get('signatories').map((signatory) => {
var signatory = Ember.ObjectProxy.create({content: signatory});
import Ember from 'ember';
const Object = Ember.Object;
const computed = Ember.computed;
var counter = 1;
const genres = [
Object.create({id: 1, label: 'learning'}),
Object.create({id: 2, label: 'fiction'}),
Object.create({id: 3, label: 'non-fiction'})
import Ember from 'ember';
const Object = Ember.Object;
const computed = Ember.computed;
var counter = 1;
const genres = [
Object.create({id: 1, label: 'learning'}),
Object.create({id: 2, label: 'fiction'}),
Object.create({id: 3, label: 'non-fiction'})
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
filteredItems: Ember.computed('model.@each.legs.length', function() {
return this.get('model').filter(function(item) {
if(item.get('legs') >= 2) {
return item;
}
})

Keybase proof

I hereby claim:

  • I am emerson on github.
  • I am emerson (https://keybase.io/emerson) on keybase.
  • I have a public key ASAZOcyWjU61HeiLF04Ox2ffn7uFqXPh2nG6oP0esJ_xZAo

To claim this, I am signing this object:

import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'input',
type: 'text',
attributeBindings: ['value'],
input(e) {
let val = this.readDOMAttr('value');
/*
* this.attrs.update(val)
@Emerson
Emerson / domain_assert
Last active December 8, 2015 20:43
Basic Response and Redirect Assertions in Bash
#!/bin/bash
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
function assert_success() {
request=`curl -s --head $1`
success=`grep "HTTP/1.1 200 OK" <<< "${request}"`
if [ -z "${success}" ]