Skip to content

Instantly share code, notes, and snippets.

Shu Miyao BeFiveINFO

Block or report user

Report or block BeFiveINFO

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
@BeFiveINFO
BeFiveINFO / appendChild-test.js
Created Nov 16, 2019
JSDOM appendChild sample
View appendChild-test.js
const $Fs = require('fs');
const { JSDOM } = require('jsdom'); // uninstall when done
const htmlText = `
<div id="target">
<p>test</p>
</div>
`;
const _htmlTextDom = new JSDOM(htmlText);
@BeFiveINFO
BeFiveINFO / getDocs.js
Last active Nov 16, 2019
Transpose Json data (example)
View getDocs.js
#!/usr/bin/node
'use strict';
const $Fs = require('fs');
const $Path = require('path');
const $Glob = require('glob');
const { JSDOM } = require('jsdom'); // uninstall when done
const $Beautify = require('js-beautify');
@BeFiveINFO
BeFiveINFO / argv.json
Last active Oct 30, 2019
VS Code gpu flickering problem workaround - place this file under ~/.vscode/ (see https://github.com/microsoft/vscode/issues/15211#issuecomment-540048507)
View argv.json
{
"disable-color-correct-rendering": true,
"disable-hardware-acceleration": true
}
@BeFiveINFO
BeFiveINFO / components-Adsense.vue
Last active Sep 14, 2019
Adsense for Gridsome
View components-Adsense.vue
<template>
<ins class="adsbygoogle"
:data-ad-client="adClient"
:data-ad-slot="adSlot"
:data-ad-format="adFormat"
:style="adStyle"></ins>
</template>
<script>
export default {
@BeFiveINFO
BeFiveINFO / file_list_downloader.py
Created Jan 4, 2019
[Python3] Batch Download Files by URLs Listed in a Text File
View file_list_downloader.py
#!/usr/local/bin/python3
#-*- coding:utf-8 -*-
import re
import requests
import os
# Function to parse url in a file one by one into a list
def loadTextFile(filePath):
lines = [line.rstrip('\n') for line in open(filePath)]
return lines
@BeFiveINFO
BeFiveINFO / list.js
Created Oct 25, 2018
[Node.JS] Open a JSON file and list each one of values of a key
View list.js
#!/usr/local/bin/node
// require
var fs = require("fs");
var sourceData = fs.readFileSync("ttl.json","utf8");
sourceData = JSON.parse(sourceData);
for(const categoryName in sourceData){
@BeFiveINFO
BeFiveINFO / ST3-with-iCloud-Drive.sh
Created Oct 12, 2018 — forked from joeshub/ST3-with-iCloud-Drive.sh
Sync your Sublime Text 3 Settings using iCloud Drive on multiple Macs
View ST3-with-iCloud-Drive.sh
#!/bin/bash
# Notes
# Using iCloud Drive, you can sync your Sublime Text 3
# plugins and prefs so you can always have the same setup
# Prerequisites
# Make sure both machines have the latest version of OSX 10.10.x with
# Yosemite or higher and iCloud Drive turned on
@BeFiveINFO
BeFiveINFO / gist:258b62f4eadc0e9eee26ed77b881fdfb
Created Oct 3, 2018
Scrape page url and title of a tags by using jQuery
View gist:258b62f4eadc0e9eee26ed77b881fdfb
var a = jQuery('.main-menu-item.menu-item-even.menu-item-depth-0.contains-mega-sub-menu.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-has-children .mega-sub-menu.row a.menu-link');
var aa = [];
a.each(function(i,e){
var b = $(e).text();
var c = $(e).attr('href');
aa.push({title:b,url:c});
});
JSON.stringify(aa);
@BeFiveINFO
BeFiveINFO / gist:c27f64e92babcc46b5ba24d67abc7e48
Created Oct 2, 2018
[WordPress] Get all the page url in WP multisite
View gist:c27f64e92babcc46b5ba24d67abc7e48
<?php
// throw the following into functions.php of a theme etc.
$site_ids = array(1,2,3); // site ids
foreach($site_ids as $bid){
switch_to_blog( $bid );
$pages = get_pages(array('post_type' => 'page'));
$current_site_home = get_site_url().'/';
@BeFiveINFO
BeFiveINFO / bulk_validation.sh
Created Feb 8, 2018
Bulk validate for Nu Html Checker
View bulk_validation.sh
#!/bin/sh
# Requirements:
# - Nu Html Checker Validation server, preferably the one running on your own.
# - curl
# Usage:
# bulk_validation -l http://validation.server.address urllist.txt resultsouput.json
# -l option is to specify a validation server http address.
# The urllist.txt has a list of url with one url each line.
You can’t perform that action at this time.