Skip to content

Instantly share code, notes, and snippets.

View dasDaniel's full-sized avatar
💩
[object Object]

Ol' Shrimpeye dasDaniel

💩
[object Object]
View GitHub Profile
I am attesting that this GitHub handle dasDaniel is linked to the Tezos account tz1dXovduNQ9zTxJVivtZmaRFxS7QqAegpNg for tzprofiles
sig:edsigtycMG9n29mefM7YSJjdfD1NtVLwS8mcqQjXCsz7LQjjEyQww5tUvhuGVbuTVAQXgfJCWdCdzMJM7nRoi361Wkn1Eo5XBGG
@dasDaniel
dasDaniel / logAssert.spec.js
Created October 16, 2020 22:34
cypress - check if log message was recorded
const spyConsoleLog = () => {
let logs = [];
const findLog = fragment => logs.find(message => (message + "").indexOf(fragment) >= 0);
Cypress.on("window:before:load", win => {
let clog = win.console.log;
win.console.log = (...arg) => {
logs.push(arg.join(" "));
clog.apply(console, arg);
};
});
@dasDaniel
dasDaniel / _is_y.sh
Created August 19, 2019 16:50
prompt for yes
#!/bin/bash
echo -n "Continue (y/n)? "
read answer
if [ "$answer" != "${answer#[Yy]}" ] ;then
echo Yes
install_thing
else
echo No
@dasDaniel
dasDaniel / vue-test-utils-helpers.js
Last active March 26, 2019 17:01
helper functions for vue-test-utils
function withWrapperArray(wrapperArray) {
return {
childSelectorHasText: (selector, str) => wrapperArray.filter(i => i.find(selector).text().match(str)),
hasText: (str) => wrapperArray.filter(i => i.text().match(str)),
areVisible: () => wrapperArray.wrappers.filter(w => w.isVisible()).length,
areHidden: () => wrapperArray.wrappers.filter(w => !w.isVisible()).length,
areAllVisible: () => wrapperArray.wrappers.every(w => w.isVisible()),
areAllHidden: () => wrapperArray.wrappers.every(w => !w.isVisible()),
}
}
function onGLC(glc) {
glc.loop();
glc.size(400, 400);
glc.setDuration(1.5);
glc.setFPS(30);
glc.setMode('single');
glc.setEasing(false);
glc.styles.backgroundColor = "#000000";
var list = glc.renderList,
width = glc.w,
@dasDaniel
dasDaniel / BaseAlert.vue
Last active April 6, 2018 17:01
Functional Base Component with class and style inheritance
<template functional>
<div :class="['alert', data.class, data.staticClass].join(' ')" :style="data.style">
<slot name="icon">
</slot>
<slot name="body">
</slot>
</div>
</template>
@dasDaniel
dasDaniel / selector-example.js
Last active February 21, 2018 16:18
Testcafe does not trim values, and IE/Edge seems to keep the whitespace. This solution trims in-line
/*
<div class="el-with-whitespace>
No spaces at the end
</div>
*/
await t.expect(await Selector('.el-with-whitespace').innerText.then(v => v.trim())).eql('No spaces at the end')
// it requires the `await t` otherwise the element doesn't check the updated value
@dasDaniel
dasDaniel / index.html
Created December 6, 2016 18:41
LbmpMY
<div id="demo" class="demo">
<button v-on:click="add">Add</button>
<canvas id="assetcanvas" width="200" height="200"></canvas>
</div>
merge = _.merge;
@dasDaniel
dasDaniel / deparam
Created October 27, 2013 00:22
deparam javascript split serialized string with square bracket items. ref http://jsfiddle.net/drzaus/8EE8k/
deparam = (function(d,x,params,pair,i) {
return function (qs) {
params = {};
// remove preceding non-querystring, correct spaces, and split
qs = qs.substring(qs.indexOf('?')+1).replace(x,' ').split('&');
// march and parse
for (i = qs.length; i > 0;) {
pair = qs[--i].split('=');
//params[d(pair[0])] = d(pair[1]);