Skip to content

Instantly share code, notes, and snippets.

🌫
can't see the future

Maciej Jankowski maciejjankowski

🌫
can't see the future
Block or report user

Report or block maciejjankowski

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 Feb 22, 2017
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
@maciejjankowski
maciejjankowski / tabelajzin.js
Last active Nov 2, 2015
this is how you converts array of arrays into tables
View tabelajzin.js
function tabelajzing(a){
return ["<tr>\n<th>",
a.map(function (e, i) {
return e.join("</th>\n<td>")
}).join("</td></tr>\n<tr>\n<th>"),
"</td>\n</tr>\n"
].join("")
}
var yourHtml = function () {
@maciejjankowski
maciejjankowski / gist:ffded8e03a1f3459ce2f
Last active Aug 29, 2015
using casperView to see what is going on with your script
View gist:ffded8e03a1f3459ce2f
var casper = require('casper').create({
viewPortSize : {
width: 1024,
height: 768
},
onStepComplete : function(arg){
show(); // THIS IS FOR CAPTURING SCREENSHOTS AFTER A STEP IS COMPLETE
},
pageSettings : {
// loadImages: false // speeds up
You can’t perform that action at this time.