Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am ideadapt on github.
* I am bubblez (https://keybase.io/bubblez) on keybase.
* I have a public key whose fingerprint is 9218 4F55 B4EF 94CA 82AA 68DD DC3D 83C8 ED74 DCB6
To claim this, I am signing this object:
@ideadapt
ideadapt / ProgressBar-App.js
Last active August 29, 2015 14:24
angular2 property to attribute binding
// parent & app
import {ComponentAnnotation as Component, ViewAnnotation as View, bootstrap, formDirectives} from 'angular2/angular2';
import {ProgressBar} from 'progress-bar';
@Component({
selector: 'demo-app'
})
@View({
directives: [ProgressBar, formDirectives],
template: `
@ideadapt
ideadapt / visualdiff.sh
Last active December 14, 2015 20:49
Visual diff between two name matching sets of images. Supports image magick openmp and parallel execution.
# requirements:
# - imagemagick (optionally with openmp)
# - I used this script to diff screen shots taken with selenium.
# Todo so I recommend you to use https://github.com/swissmanu/protractor-screenshot-reporter and overwrite pathBuilder option.
# e.g. `pathBuilder: () => {return path.join(capabilities.caps_.browserName, descriptions.reverse().join('-').replace(/\s/g, "-").replace(/['":,\/]/g, ""));}`
# usage:
# run tests with setup 1
# rm -rf test/run1 && cp -r test/reports/e2e/screenshots/current/chrome/ test/run1
# run tests with setup 2
@ideadapt
ideadapt / advent-of-code-19-solution-es6.js
Last active April 13, 2016 15:23
ES6 based solution for Advent Of Code, Day 19
'use strict'
var fs = require('fs')
var inFile = '19.txt'
var content = fs.readFileSync(inFile, {encoding: 'UTF-8'})
var lines = content.split('\n')
var text = lines[lines.length -1]
var termLines = lines.slice(0,-1).filter(String)
var permutations = []
@ideadapt
ideadapt / jasmine-done-callback-behaviour.js
Last active May 22, 2016 21:44
jasmine done callback behaviour
describe('experiments with done', ()=>{
describe('- correct usage -', ()=>{
it('should fail because of async expect failure, and failure is assigned to correct spec', (done)=>{
new Promise(function(res, rej){
setTimeout(res, 1000)
}).then(()=>{
expect(1).toEqual(11)
}).catch().then(done)
@ideadapt
ideadapt / await-all-subscriber-completion.js
Created June 20, 2016 20:10
Wait for all event subscribers to complete their event processing
"use strict"
var events = require("events")
var ev = new events.EventEmitter()
var log = console.log.bind(console)
process.on('unhandledRejection', function(reason, p) {
log(`Possibly Unhandled Rejection at: Promise ${p} reason: ${reason}`)
})
process.on('uncaughtException', function(err) {
log(`Caught exception: ${err}`)
@ideadapt
ideadapt / tampermonkey-bamboo-scripfile-link.js
Last active November 2, 2018 09:02
Bamboo Script File Repo Link - Tampermonkey
@ideadapt
ideadapt / confluence-comment-navigator.js
Created May 14, 2018 14:01
Confluence Inline Comment Navigator via prev & next Links
// ==UserScript==
// @name Confluence Inline Comment Navigator
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Navigate through all open inline comments on a confluence page
// @author [email protected]
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @include *://*/*confluence/display/*
// @include *://*/*confluence/display/*
@ideadapt
ideadapt / watermark-images.sh
Created August 19, 2018 20:41
Watermarks all images selected in MacOS Finder application with a transparent logo overlay
#!/bin/bash
exec 2>&1
export PATH=/usr/local/bin:$PATH
for image in "$@"
do
if [ -s "$image" ]; then
filename=$(basename "$image")
dirname=$(dirname "$image")
mkdir -p "$dirname"/watermarked
@ideadapt
ideadapt / web-servers.md
Created January 25, 2020 09:09 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000