Skip to content

Instantly share code, notes, and snippets.

// www.codewars.com/kata/525f3eda17c7cd9f9e000b39
const curry = (operand, operator) => (!operator) ? operand : operator(operand);
const [zero, one, two, three, four, five, six, seven, eight, nine] =
[0,1,2,3,4,5,6,7,8,9].map(operand => ((operator) => curry(operand, operator)));
const plus = (first) => (second) => second + first;
const minus = (first) => (second) => second - first;
const times = (first) => (second) => second * first;
@nickciolpan
nickciolpan / main.yml
Created February 26, 2020 11:35
Cypress config for graffino.ninja
name: E2E on Chrome
on: [pull_request]
jobs:
cypress-run:
runs-on: ubuntu-16.04
# let's make sure our tests pass on Chrome browser
name: E2E on Chrome
steps:
- uses: actions/checkout@v1
- uses: cypress-io/github-action@v1
/// <reference types="cypress" />
context('Actions', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
})
// https://on.cypress.io/interacting-with-elements
it('.type() - type into a DOM element', () => {
/// <reference types="cypress" />
context('Actions', () => {
beforeEach(() => {
cy.visit('https://example.cypress.io/commands/actions')
})
// https://on.cypress.io/interacting-with-elements
it('.type() - type into a DOM element', () => {

Keybase proof

I hereby claim:

  • I am nickciolpan on github.
  • I am nickciolpan (https://keybase.io/nickciolpan) on keybase.
  • I have a public key ASCy7LB3fRV0XDoDgI2hG7mrWTlX1eJF6Z-3SBCOm0cIuAo

To claim this, I am signing this object:

$('.multiSelectOne').multiselect({
buttonClass: 'btn btn-default',
buttonWidth: '100%',
...
});
$('.multiSelectTwo').multiselect({
buttonClass: 'btn btn-default',
buttonWidth: '100%',
nonSelectedText: '---',
...
// I'm keeping .class and $selector separated for edge cases in which dom-content is dynamic and can't be cached.
const $multiSelect = $('.js-multiselect'),
defaults = {
buttonClass: 'btn btn-default',
buttonWidth: '100%',
nonSelectedText: '---',
nSelectedText: ' selected',
allSelectedText: 'All',
includeSelectAllOption: false,
// The source of truth should be the element that initializes it.
// Have a default fallback
if ($multiSelect.length > 0) {
$multiSelect.each(function () {
let $this = $(this),
dataset = $this.data(),
options = defaults;
// Since the number of options can vary,
<!-- Initializes with default settings -->
<select class="js-multiselect">
<option />
</select>
<!-- With options (Unspecified options will fallback to default) -->
<select class="js-multiselect"
data-include-select-all-option="true"
data-all-selected-text="All">
<option />
// 1. Namespace js functionality classes with 'js-',
// never ever attach events to regular class or id. Separation of concers
// 'round-box' can't have some bonus unexpected hover effect. That should be 'js-flips-on-hover'.
// 2. Jquery selectors are expensive browser operations. All should be cached ( saved to variable )
// I'm keeping .class and $selector separated for edge cases in which dom-content is dynamic and can't be cached.
var multiSelectClass = '.js-multiselect'),
$multiSelect = $(multiSelectClass),
defaults = {