Skip to content

Instantly share code, notes, and snippets.

View spidgorny's full-sized avatar
💭
Building Flutter apps

Slawa Pidgorny spidgorny

💭
Building Flutter apps
View GitHub Profile
function analyze(i, callback) {
setTimeout(() => {
callback('result 123');
}, Math.random()*10000);
// long thinking time....
// callback('result 123');
}
async function analyzeAsync(i) {
return new Promise((resolve, reject) => {
@spidgorny
spidgorny / ebay-f12-console.js
Created February 7, 2018 11:47
Find the average price of all ebay offers on the page. Press F12 and run this in the console.
$('.POSITIVE').map((i, el) => {
let k = $(el).text().replace('EUR ', '');
return parseInt(k);
}).get().reduce((a, b) => a + b, 0)
/$('.POSITIVE').length
@spidgorny
spidgorny / manage.sh
Created January 4, 2018 20:36
move android DCIM photos to the folders corresponding to the month like 2018-01/
#!/bin/bash
year=2018
for i in `seq -f "%02g" 1 12`;
do
mask="???_$year$i*";
folder="$year-$i/";
mkdir -p $folder;
echo ""
echo -e "mv \t $mask \t $folder";
mv $mask $folder;
@spidgorny
spidgorny / MyRandomFactory.php
Created February 23, 2017 21:53
RandomLib fix for PHP 7.1 which does not have mcrypt anymore
<?php
use RandomLib\Factory;
class MyRandomFactory extends Factory {
public function __construct() {
parent::__construct();
$this->mixers = [];
$this->registerMixer('OpenSSLMixer', OpenSSLMixer::class);
@spidgorny
spidgorny / AutoForwardSAP.js
Created November 29, 2016 09:38
SAP Learning Hub Hacks
(function () {
function setVideoEndHandler() {
let iframeDocument = window
.frames['contentContainer']
.contentDocument;
let video = iframeDocument.querySelector('video');
if (!video) {
video = iframeDocument.querySelector('audio');
}