Skip to content

Instantly share code, notes, and snippets.

@bernardo-cs
bernardo-cs / facebook_login_capybara_koala_minitest.rb
Created September 11, 2018 08:47
Rails system test that:Creates new facebook test user with koala gem. Signs in user on facebook.com. Accepts facebook "continue as #{username}" iframe.
# frozen_string_literal: true
require 'application_system_test_case'
class FacebookLoginTest < ApplicationSystemTestCase
# create new test user with Koala Gem
def setup
@test_users = Koala::Facebook::TestUsers.new
@user = @test_users.create(false)
@bernardo-cs
bernardo-cs / facebook_login_rails_system_test_capybara_koala_minitest.rb
Created September 11, 2018 08:48
Creates new facebook test user with koala gem. Signs in user on facebook.com. Accepts facebook "continue as #{username}" iframe.
# frozen_string_literal: true
require 'application_system_test_case'
class FacebookLoginTest < ApplicationSystemTestCase
# create new test user with Koala Gem
def setup
@test_users = Koala::Facebook::TestUsers.new
@user = @test_users.create(false)
/*
* QUESTION 1:
* Write a code snippet that would transform "animalCollective" into "expected"
*/
const animalCollective = [
{type: 'dog', name: 'bobi'},
{type: 'fish', name: 'glup'},
{type: 'fish', name: 'glup the second'},
{type: 'cat', name: 'Aaron'}
@bernardo-cs
bernardo-cs / paginated-search-input.ts
Last active July 9, 2019 09:14
Angular component that fully consumes a paginated API recursivly with RxJS expand operator. Example live on: https://stackblitz.com/edit/angular-yja4k7
import { Component } from '@angular/core';
import { combineLatest, Subject, of, empty, Observable } from 'rxjs';
import { map, tap, expand } from 'rxjs/operators';
@Component({
  selector: 'my-app',
  template: `
    <input type="text" (input)="term$.next($event.target.value)" />
    <div *ngIf="users$ | async as users">