Skip to content

Instantly share code, notes, and snippets.

🕹️
Focusing

Милош Живковић zivce

🕹️
Focusing
View GitHub Profile
@zivce
zivce / scrape-police.js
Created Jun 7, 2020
Scraping for police info on local FB page
View scrape-police.js
const puppeteer = require('puppeteer');
const dotenv = require('dotenv');
dotenv.config();
const WAIT_FOR_PAGE = 5000;
const DELAY_USER_INPUT = 2000;
const DELAY_PW_INPUT = 1000;
(async () => {
@zivce
zivce / test.js
Created May 26, 2020
Simple test for resolving csv
View test.js
let assert = require('assert')
let CSVImageDownloader = require("./index");
const fs = require('fs');
const path = require('path')
describe("CSV Image Downloader", function () {
const VALID_FILE = 'data.csv'
const INVALID_FILE = 'data2.csv'
const VALID_COLUMN = 'IMAGE'
let columnValues = []
View remove-wishlist-products-strategy.js
export class Strategy {
constructor(name, handler) {
this._name = name;
this._handler = handler;
}
execute() {
this._handler();
}
}
@zivce
zivce / remove-wishlist-products-refactored.js
Last active Apr 19, 2020
Extracted logic to strategies. Possible re-use. Easier to follow paths.
View remove-wishlist-products-refactored.js
static $wishlistList = $(".wishlist-list__body");
static $myFavouritesRollover = $(".mini-favourites");
static $myFavouritesSendList = $(".wishlist-send-list");
static emptyWishlistHTML = $("#emptyWishlistPopupTemplate").html();
static $wishlistCount = $("[data-wishlist-item-count]");
static $myFavouritesRolloverContainer = $(
".my-favourites-rollover__content",
$myFavouritesRollover
);
@zivce
zivce / remove-wishlist-products.js
Created Apr 17, 2020
Removing products from wishlist. A lot of if blocks, hard to follow paths.
View remove-wishlist-products.js
static removeProductFromWishListHandler(e) {
e.stopPropagation();
const target = $(e.currentTarget);
const $wishlistList = $(".wishlist-list__body");
const productCode = target.data("product-code");
const $myFavouritesRollover = $(".mini-favourites");
const $myFavouritesSendList = $(".wishlist-send-list");
const emptyWishlistHTML = $("#emptyWishlistPopupTemplate").html();
const $myFavouritesRolloverContainer = $(
You can’t perform that action at this time.