Skip to content

Instantly share code, notes, and snippets.

View phenomnomnominal's full-sized avatar
🥑
Hangry

Craig Spence phenomnomnominal

🥑
Hangry
View GitHub Profile
<youtube-player
videoId="dQw4w9WgXcQ"
suggestedQuality="highres"
[height]="600"
[width]="1080"
[startSeconds]="43"
[endSeconds]="60">
</youtube-player>
import { Component, OnInit } from '@angular/core';
@Component({
template: '<youtube-player videoId="dQw4w9WgXcQ"></youtube-player>',
selector: 'app-video'
})
export class VideoComponent implements OnInit {
ngOnInit() {
const tag = document.createElement('script');
tag.src = 'https://www.youtube.com/iframe_api';
import { NgModule } from '@angular/core';
import { YouTubePlayerModule } from '@angular/youtube-player';
import { VideoComponent } from './video.component';
@NgModule({
imports: [YouTubePlayerModule],
declarations: [VideoComponent],
exports: [VideoComponent]
})
import { Component, Directive, Pipe } from '@angular/core';
import { DatePipe as date, NgIf as ngIf } from '@angular/common';
import { SomethingComponent as something } from './something.component';
const template = function (templates: TemplateStringsArray, ...declarations: Array<Component | Directive | Pipe>) {
return function () {
// ivyMagicHere?!
};
}
const request = require('request').defaults({ jar: true});
const nodemailer = require('nodemailer');
const LOCATIONS = {
STOCKHOLM: 'Z209',
GÖTEBORG: 'Z102',
MALMÖ: 'KCMA',
TILLSTÅNDSPRÖVNING: 'BBBO',
BORLÄNGE: 'NHL',
JÖNKÖPING: 'Z085',
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.SENDER_EMAIL,
pass: process.env.SENDER_PASSWORD
}
});
const LOCATIONS = { /* ... */ };
const LOCATION_NAMES = Object.keys(LOCATIONS);
const ALL_APPOINTMENTS = {};
console.log('🇸🇪💉 Info: Starting loop!');
let index = 0;
setInterval(() => {
getAppointmentsForLocation(LOCATION_NAMES[index]);
if (index === LOCATION_NAMES.length - 1) {
const request = require('request').defaults({ jar: true});
const LOCATIONS = { /* ... */ };
const PAGE_REGEXP = /(\d+-\d+)\.IBehaviorListener/;
const URL_ROOT = 'https://www.migrationsverket.se/ansokanbokning/';
function getAppointmentsForLocation (location) {
const bookingPageUrl = `valjtyp?sprak=en&bokningstyp=2&enhet=${LOCATIONS[location]}&sokande=1`;
request(`${URL_ROOT}${bookingPageUrl}`, (_, _, body) => {
const LOCATIONS = {
STOCKHOLM: 'Z209',
GÖTEBORG: 'Z102',
MALMÖ: 'KCMA',
TILLSTÅNDSPRÖVNING: 'BBBO',
BORLÄNGE: 'NHL',
JÖNKÖPING: 'Z085',
NORRKÖPING: 'Z083',
SUNDSVALL: 'BBSU',
UMEÅ: 'BBUM',
const request = require('request');
const URL = 'https://www.migrationsverket.se/ansokanbokning/valjtyp?sprak=sv&bokningstyp=2&enhet=Z209&sokande=2';
request(URL, function (err, _, body) {
console.log(body);
});