View paginated-search-input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"> |
View purlo_questions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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'} |
View facebook_login_rails_system_test_capybara_koala_minitest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
View facebook_login_capybara_koala_minitest.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
View remove_ifs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = []; | |
if ($scope.attendeesToggle) { ids = ids.concat($scope.eventAttendees); } | |
if ($scope.waitingListToggle) { ids = ids.concat($scope.eventWaitingList); } | |
//-------- | |
[ | |
{ condition: () => $scope.attendeesToggle, array: $scope.eventAttendees }, | |
{ condition: () => $scope.waitingListToggle, array: $scope.eventWaitingList } |
View dom_check.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Verify fitness hut class availability | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.myhut.pt/myhut/aulas/* | |
// @grant none | |
// @require https://cdnjs.cloudflare.com/ajax/libs/rxjs/5.4.3/Rx.js | |
// ==/UserScript== |
View editable.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AfterViewInit, Directive, ElementRef, HostListener, Input } from '@angular/core'; | |
import { UserService } from '../shared/services/user.service'; | |
@Directive({ | |
selector: '[flEditable]' | |
}) | |
export class EditableDirective implements AfterViewInit { | |
@Input('endpoint') endpoint; |
View scroll_bulletin_int_view.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AfterViewInit, Directive, ElementRef, Input, OnDestroy } from '@angular/core'; | |
import { ActivatedRoute, Router } from '@angular/router'; | |
import { Subscription } from 'rxjs/Subscription'; | |
@Directive({ | |
selector: '[flScrollBulletinIntoView]' | |
}) | |
export class ScrollBulletinIntoViewDirective implements AfterViewInit, OnDestroy { | |
@Input() bulletinId: number; | |
private scrollIntoView$: Subscription; |
View fitness_hut.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Verify fitness hut class availability | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://www.myhut.pt/myhut/aulas/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== |
View gist:70f0ee3e796e902cd7d2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr_request = function (post_url, xsrf_token, ids, start_interval, end_interval, callback){ | |
var request = { page_ids: ids, start: start_interval, end: end_interval}; | |
var oReq = new XMLHttpRequest(); | |
oReq.addEventListener("load", callback); | |
oReq.open("POST", post_url); | |
oReq.setRequestHeader("Content-Type", "application/json"); | |
oReq.setRequestHeader("X-CSRF-Token", xsrf_token); | |
oReq.send(JSON.stringify(request)); | |
}; |
NewerOlder