Skip to content

Instantly share code, notes, and snippets.

View esbanarango's full-sized avatar
👨‍🚀
Desayunando

Esteban esbanarango

👨‍🚀
Desayunando
View GitHub Profile
import Component from '@glimmer/component';
export default class extends Component {
get aValueInfo() {
return `The value value is ${this.args.aValue}`;
}
get anObjectInfo() {
return this.args.anEngineer.handle;
Assertion Failed: You accessed `this.field` from a function passed to the `fn` helper, but the function itself was not bound to a valid `this` context. Consider updating to usage of `@action`.
@esbanarango
esbanarango / controllers.application.js
Last active February 12, 2020 04:20 — forked from sduquej/controllers.application.js
Editing array of strings
import Ember from 'ember';
import { set } from '@ember/object';
export default Ember.Controller.extend({
primitiveFruits: ['banana' ,'apple'],
wrappedFruits: [{name: 'banana'}, {name: 'apple'}],
printPrimitiveFruits() {
console.log(this.get('primitiveFruits'));
},

Keybase proof

I hereby claim:

  • I am esbanarango on github.
  • I am esbanarango (https://keybase.io/esbanarango) on keybase.
  • I have a public key whose fingerprint is 8087 A142 D24B 5A06 76B9 9F32 239F 5139 6604 FC41

To claim this, I am signing this object:

@esbanarango
esbanarango / gist:6629748
Last active May 8, 2018 18:12
HTML <input> required attribute and Rails form with remote true.

<input> with attribute required

This attribute specifies that the user must fill in a value before submitting a form. It cannot be used when the type attribute is hidden, image, or a button type (submit, reset, or button). The :optional and :required CSS pseudo-classes will be applied to the field as appropriate.

How to show a spinner only when the required validations pass? (Without using any validation plugin, only the required attribute).

Form with a required input

= form_for @person, remote: true do |f|
 = f.text_field, :first_name, required: true
@esbanarango
esbanarango / tested-jekyll.md
Created October 22, 2017 00:08 — forked from deanmarano/tested-jekyll.md
Tested Jekyll

Testing Your Jekyll Site, The Ruby Way

Here at eSpark Learning, we use Jekyll to host our marketing site, https://www.esparklearning.com. Within eSpark Engineering, we love automated testing - most of our codebases require a passing test suite for all changes. As we add more javascript to our Jekyll site, we wanted to add a test framework that would give us real world tests - testing that the HTML was valid was no longer enough.

Acceptance Testing with RSpec, Capybara, and Selenium

To create real world acceptance tests for our site, we used a few technologies we were familiar with:

  • RSpec - Behaviour Driven Development for Ruby
  • Capybara - Test web applications by simulating how a real user would interact with your app
  • Selenium - Selenium automates browsers
@esbanarango
esbanarango / controllers.application.js
Last active July 2, 2017 14:51
Power Select issue #929
import Ember from 'ember';
export default Ember.Controller.extend({
cities: ['Barcelona', 'London', 'New York', 'Porto'],
destination: 'London',
actions: {
chooseDestination(city) {
this.set('destination', city);
// this.calculateRoute();
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
var promise = new Promise(function(resolve) {
Ember.run.later((() => {
resolve();
}), 5000);
});
return promise.then(() => {
return 'I was sleeping';
});
@esbanarango
esbanarango / AR_calculations_plus_sql.md
Created December 29, 2013 18:01
ActiveRecord::Calculations can receive SQL functions.

ActiveRecord::Calculations can receive SQL functions.

sum("CAST(total AS float)")
average("CAST(total AS float)")

total dataType is String.