Skip to content

Instantly share code, notes, and snippets.

@ssddi456
ssddi456 / sinplelogger
Created September 16, 2021 06:54
for add some easy to see log
function logRemote() {
const img = new Image();
window.log_img = window.log_img || [];
window.log_img.push(img);
const content = [];
for (let index = 0; index < arguments.length; index++) {
const element = arguments[index];
content.push('n[]=' + JSON.stringify(element));
}
img.src = 'https://127.0.0.1:8888/log?' + content.join('&');
#!/bin/bash
TEST_FOLDER=$1 || "./e2e"
PATH_01=("${TEST_FOLDER}/cypress.json" "{ \"video\": false }\n")
PATH_02=("${TEST_FOLDER}/cypress/integration")
PATH_03=("${TEST_FOLDER}/cypress/integration/example.test.js" "context('Example', () => {\n beforeEach(() => { cy.visit('/'); });\n\n it('should have loaded', () => {\n cy.get('title').contains(/.*/);\n });\n});\n")
scaffold=(PATH_01[@] PATH_02[@] PATH_03[@])
if [ ! -f "${!scaffold[0]:0:1}" ]; then
echo "[SCAFFOLD] Cypress test directory"
@ssddi456
ssddi456 / README.md
Created November 19, 2019 06:19
adbpaste

script to send your clipbroad content to android input on windows,

based on great tiny tool ADBKeyBoard

you can get the app from F-Droid.

var path = require('path');
var esprima = require('esprima');
var esrefactor = require('esrefactor');
var escodegen = require('escodegen');
var estraverse = require('estraverse');
var prettier = require('prettier');
function expressionStatement ( expression) {
@ssddi456
ssddi456 / test_amf.js
Created October 17, 2018 17:31
try decode amf according wikipedia's doc
var data = new Buffer([0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1d, 0x42, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, // 16
0x69, 0x63, 0x65, 0x2e, 0x64, 0x6f, 0x44, 0x69, 0x73, 0x70, 0x61, 0x74, 0x63, 0x68, 0x54, 0x6f, // 32
0x42, 0x61, 0x74, 0x63, 0x68, 0x00, 0x02, 0x2f, 0x31, 0x00, 0x00, 0x00, 0xdc, 0x0a, 0x00, 0x00, // 47
0x00, 0x00
]);
var offset = 0;
var version = data.readUInt16BE(offset);
offset += 2;
var headerLen = data.readUInt16BE(offset);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.css" rel="stylesheet">
</head>
<body>
<style>
.log {
@ssddi456
ssddi456 / testCaculate.html
Last active May 9, 2018 12:23
a simple caculate
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.css" rel="stylesheet">
</head>
@ssddi456
ssddi456 / thunk_wrapper.js
Last active January 17, 2018 05:54
wrap a thunk to generator
function wrapper ( process ) {
var res= [];
var resolvers = [];
var add_next = function() {
res.push(new Promise(function( resolve, reject ) {
resolvers.push({
resolve,
reject
})
@ssddi456
ssddi456 / makeRange.js
Created September 14, 2017 06:14
make number sequence to range sequence 1, 2, 3, 5, 6, 8 => 1-3, 5-6, 8
function last(nums) {
return nums[nums.length - 1];
}
function makeRange(nums) {
return nums.slice().sort(function (a, b) { return a - b; })
.reduce(function (segs, current) {
var lastSeg = last(segs);
var currentSeg = lastSeg || [];
if (!lastSeg) {
var clawer_aggregate = require('./..');
var commander = require('commander');
var fs = require('fs');
var path = require('path');
program = commander
.usage('')
.option('--chapture <url>', 'page url')
.option('--noval <url>', 'noval url')
.parse(process.argv);