Skip to content

Instantly share code, notes, and snippets.

@timaschew
timaschew / alternative.js
Last active November 28, 2018 21:20
instagram contest analyzer and rollling the dice script
// roll the dice for instagram and wordpress comments
// you need to open web developer toolbar and open the console for these commands
//step 1: go to instagram post and ensure to load all comments
MIN_MENTION = 2;function unique(value, index, self) { return self.indexOf(value) === index;};copy(Array.prototype.slice.call($$(".k59kT li")).filter(e => e.querySelectorAll('.notranslate').length >= MIN_MENTION+1).map(e => e.querySelector('h3')).filter(e => e != null).map(e => e.textContent).filter(unique))
// step 2: go to wordpress backend and use edit mode for the page
r1 = <PASTE YOUR CLIPBOARD CONTENT>
// step 3: ensure to scroll to the bottom and load all comments
FROM alpine
# ---------------- #
# Installation #
# ---------------- #
# Install all prerequisites
RUN apk add --update --no-cache nginx nodejs nodejs-npm git curl wget gcc ca-certificates \
python-dev py-pip musl-dev libffi-dev cairo supervisor bash \
py-pyldap py-rrd &&\
@timaschew
timaschew / sample.json
Created July 25, 2017 15:19
for geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@timaschew
timaschew / gist:a7e478d24701bc88b564940859ca54c7
Created July 24, 2017 14:22
how to add new marker icons to geojson
https://github.com/mapbox/mapbox.js/blob/a74922bbd9577dfaaee46a3b961fc8dce434048f/src/marker.js#L22-L30
https://github.com/mapbox/geojson.io/blob/f172c30ffe631b7153a42adc78161a8686448eaf/leaflet/leaflet-src.js#L3270-L3272
const fs = require('fs')
function async1(callback) {
console.log('1')
setTimeout(function() {
console.log('2')
if (Math.random() > 0.5) {
return callback(new Error('boom'))
}
return callback(null, 'config.txt')
@timaschew
timaschew / fibonacci-1.scala
Created May 11, 2017 07:20
fibonacci in scala
def fibonacci (n: Int): Int = {
@tailrec
def fib (start: Int, prev: Int, prevPrev: Int = 0): Int = {
start match {
case start if (start == n) => prev
case _ => fib(start + 1, prev + prevPrev, prev)
}
}
n match {
case _ => fib(1, 1)
[warn] [FAILED ] com.artima.supersafe#supersafe_2.12.2;1.1.2!supersafe_2.12.2.jar(src): (0ms)
[warn] ==== local: tried
[warn] /Users/wilhelm/.ivy2/local/com.artima.supersafe/supersafe_2.12.2/1.1.2/srcs/supersafe_2.12.2-sources.jar
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/artima/supersafe/supersafe_2.12.2/1.1.2/supersafe_2.12.2-1.1.2-sources.jar
[warn] ==== Artima Maven Repository: tried
[warn] http://repo.artima.com/releases/com/artima/supersafe/supersafe_2.12.2/1.1.2/supersafe_2.12.2-1.1.2-sources.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
amdefine@>=0.0.4:
version "1.0.1"
resolved "https://artifactory.in.here.com/artifactory/api/npm/here-node/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
ansi-regex@^2.0.0:
version "2.1.1"
@timaschew
timaschew / source.js
Last active March 20, 2017 21:39
Calculates the story points on a trello board and replaces the list title (origin list title MUST NOT have whitespaces)
(function() {
function parsePoints(e) {
const text = $(e).find(".badge-text").text();
const tmp = text.split(' ');
if (tmp[0].trim().toLowerCase() === 'points:') {
return parseInt(tmp[1]);
}
return 0;
}
$(".js-list-content").each((i, board) => {