Skip to content

Instantly share code, notes, and snippets.

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

Esteban esbanarango

👨‍🚀
Desayunando
View GitHub Profile
@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'));
},
@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
# based on Haversine formula
# http://en.wikipedia.org/wiki/Haversine_formula
distance = (lat1, lon1, lat2, lon2) ->
R = 6371
a = 0.5 - Math.cos((lat2 - lat1) * Math.PI / 180) / 2 + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * (1 - Math.cos((lon2 - lon1) * Math.PI / 180)) / 2
R * 2 * Math.asin(Math.sqrt(a))
select.form-control + .chosen-container{
display: block;
width: 100% !important;
}
select.form-control + .chosen-container.chosen-container-single .chosen-single {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;