Skip to content

Instantly share code, notes, and snippets.

🦍
hu!

Maciej Jankowski maciejjankowski

🦍
hu!
View GitHub Profile
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
@maciejjankowski
maciejjankowski / bookmarklet.js
Last active May 12, 2020
github bookmark bookmarklet
View bookmarklet.js
const month = new Date().toDateString().split(' ')[1];
const year = new Date().toDateString().split(' ')[3];
if (location.href.indexOf(`github.com/maciejjankowski/${year}/wiki`) > -1) {
const searchToken = '# Worth checking:\n';
const textarea = document.querySelector('#gollum-editor-body');
const textIndex = textarea.value.indexOf(searchToken);
const textLength = searchToken.length;
textarea.value =
textarea.value.slice(0, textIndex + textLength) +
prompt() +
@maciejjankowski
maciejjankowski / bookmarklet.js
Created Sep 27, 2019
github bookmarking bookmarklet
View bookmarklet.js
const month = new Date().toDateString().split(' ')[1];
const year = new Date().toDateString().split(' ')[3];
if (location.href.indexOf(`github.com/maciejjankowski/${year}/wiki`) > -1) {
const searchToken = '# Worth checking:\n';
const textarea = document.querySelector('#gollum-editor-body');
const textIndex = textarea.value.indexOf(searchToken);
const textLength = searchToken.length;
textarea.value =
textarea.value.slice(0, textIndex + textLength) +
@maciejjankowski
maciejjankowski / microgranny sox convert sample rate.sh
Last active May 15, 2019
convert sample rate command line sox
View microgranny sox convert sample rate.sh
for file in *
do
if [ ! -d "$file" ] && [ ! "$file" == 'convert.sh' ] ; then
sox $file -b 16 -c 1 -r 48k "converted/$file"
fi
done
@maciejjankowski
maciejjankowski / refactorings.py
Last active Jan 9, 2019
Refactoring exercises
View refactorings.py
# https://github.com/RefactoringGuru/refactoring-examples/tree/master/simple/python
# 1
def disabilityAmount():
if seniority < 2:
return 0
if monthsDisabled > 12:
return 0
if isPartTime:
return 0
View python-touchviz-osc.pl
import argparse
import random
import time
from itertools import chain
from pythonosc import osc_message_builder
from pythonosc import udp_client
# add easing iterators https://gist.github.com/th0ma5w/9883420
@maciejjankowski
maciejjankowski / qlizing-sequelize
Created Nov 28, 2017
GraphQL-izing sequelization
View qlizing-sequelize
var sequelize={literal:()=>'',INTEGER:'INTEGER', STRING:'STRING', 'DATE':'DATE', 'DATEONLY': 'DATEONLY'};
var t={'STRING':'graphql.GraphQLString', 'INTEGER':'graphql.GraphQLInt', 'DATE':'graphqlDate.GraphQLDateTime', 'DATEONLY':'graphqlDate.GraphQLDateTime'};
var ql=(x)=>'{'+Object.keys(x).map(k=>(`${k} : { type : ${t[x[k].type]}, resolve(o){return o.${k}}}`)).join(',')+'}'
View dump skype conversation to csv.js
(function(){
var msgs = document.querySelectorAll('swx-message');
var mLen = msgs.length;
var out = []
for (let i=0; i<mLen; i++){
let r = [];
let m = msgs[i];
let user = (m.querySelector('.tileName') && m.querySelector('.tileName').innerText.trim()) || '-';
let timestamp = (m.querySelector('[data-bind^="text: setBottom"]') && m.querySelector('[data-bind^="text: setBottom"]').innerText.trim()) || '';
let content = m.querySelector('.content').innerText.trim().replace(/\n/g,'\\n') || '';
@maciejjankowski
maciejjankowski / download table to excel csv.js
Last active Jan 10, 2020
download table to excel csv.js. Charset MUST be UTF-16LE - this is the only solution that worked with Excel on Mac
View download table to excel csv.js
function exportTableToCSV($table, filename) {
var $rows = $table.find('tr:has(td,th)'),
// Temporary delimiter characters unlikely to be typed by keyboard
// This is to avoid accidentally splitting the actual contents
tmpColDelim = String.fromCharCode(11), // vertical tab character
tmpRowDelim = String.fromCharCode(0), // null character
// actual delimiter characters for CSV format
You can’t perform that action at this time.