Skip to content

Instantly share code, notes, and snippets.

Avatar
🥑
Hangry

Craig Spence phenomnomnominal

🥑
Hangry
View GitHub Profile
View is-this-possible-in-ivy.ts
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?!
};
}
View biometrics-appointment-finder.js
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',
View attempt-5.js
const nodemailer = require('nodemailer');
const transporter = nodemailer.createTransport({
service: 'gmail',
auth: {
user: process.env.SENDER_EMAIL,
pass: process.env.SENDER_PASSWORD
}
});
View attempt-4.js
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) {
View attempt-3.js
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) => {
View locations.js
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',
View attempt-2.js
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);
});
View bokaSubmit.js
$svjq('#bokaSubmit').click(function(e){
var paramStr = "";
var myHistoryArr = inlotsning.history.split(',');
for(var i = 1; i < myHistoryArr.length; i++) {
var arr = myHistoryArr[i].split(':');
paramStr = paramStr + "&"+ arr[0] +"="+ arr[1] +"";
}
window.location = "/ansokanbokning/valjtyp?sprak=sv"+ paramStr +"";
});
View request-url
HOST: https://www.migrationsverket.se
PAGE: /ansokanbokning/wicket/page
QUERY PARAMS:
?4-1.IBehaviorListener.1-form-kalender-kalender
&start=2019-07-08T00%3A00%3A00%2B00%3A00
&end=2019-07-15T00%3A00%3A00%2B00%3A00
&_=1561072933552
View attempt-1.js
const request = require('request');
const HOST = 'https://www.migrationsverket.se/ansokanbokning/wicket/';
const API = 'page?6-1.IBehaviorListener.1-form-kalender-kalender&start=2019-08-19&end=2019-08-26&_=1561069474473';
request(`${HOST}${API}`, function (err, _, body) {
console.log(body);
});