Skip to content

Instantly share code, notes, and snippets.

@annatomka
annatomka / twitterscript.js
Last active September 13, 2019 17:35
Twitter unfollow people script
/*
* ATTENTION: This script will unfollow all accounts, you load on your profile page
* To do that:
* 1. Open your twitter profile following tab: https://twitter.com/YOURUSERNAME/following
* 2. Run this script on the console
* This script is really simple, it will unfollow only the actual loaded accounts,
* so you have to scroll down and rerun the script if you want to unfollow more accounts
*/
function delay(timeInMs = 100) {
return new Promise(resolve => {
var bufferingSimulator = (function () {
var facade = require('logic/event/facade');
var bufferingIntervalId,
lastBufferingTimeoutId,
bufferingFrequencyInMs = 5000,
bufferingDurationInMs = 2000;
function startBuffering () {
clear();
var counter = 0;
@annatomka
annatomka / simple_rxjs.js
Created October 31, 2015 01:03
Simple RxJS code
var helloWorldObservable = null;
var buttonClickObservable = Rx.Observable.create(function(observer) {
var clickerListener = function() {
observer.onNext(true);
console.log("clicker was clicked")
};
var clickerBtn = $("#clicker");
@annatomka
annatomka / PolygonConvexityTest.js
Last active December 17, 2020 07:19
Determine in Javascript wheather a polygon is convex or not? (using Openlayers polygon and algorithm describe here: http://stackoverflow.com/questions/471962/how-do-determine-if-a-polygon-is-complex-convex-nonconvex)
function calculateAllCrossProduct(points) {
var lastSign = null;
for (var i = 2; i < points.length; i++) {
//calculate crossproduct from 3 consecutive points
var crossproduct = calculateCrossProduct(points[i - 2], points[i - 1], points[i]);
console.log(i + ". crossproduct from ("+ points[i - 2].x +" "+points[i - 1].x +" "+points[i].x +"): " + crossproduct);
var currentSign = Math.sign(crossproduct);
if (lastSign == null) {
//last sign init