Skip to content

Instantly share code, notes, and snippets.

View ygweric's full-sized avatar
💭
I may be slow to respond.

Eric ygweric

💭
I may be slow to respond.
  • Auckland, New Zealand
View GitHub Profile
@ygweric
ygweric / second-percentage.html
Created April 13, 2018 23:39
Current second and percentage
<!DOCTYPE html>
<html>
<style type="text/css">
.time {}
.percentage {
color: red;
font-size: 5em;
}
</style>
@ygweric
ygweric / gist:5023b90bb0a60ab4c28c549dd87809c2
Last active December 17, 2021 02:06
清除chrome所有的cookie,localStorage,sessionStorge, clear all cookie, localStorage, sessioinStorage
const clearCookieAndStorage = () => {
// clear cookies
(function () {
setTimeout(() => {
var cookies = document.cookie.split("; ");
for (var c = 0; c < cookies.length; c++) {
var d = window.location.hostname.split(".");
while (d.length > 0) {
var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path=';
@ygweric
ygweric / loadJs.js
Created December 25, 2023 05:52
动态加载js、css
export const addStyle = (src: string) => {
let styles = document.createElement('link');
styles.rel = 'stylesheet';
styles.type = 'text/css';
styles.media = 'screen';
styles.href = src;
document.getElementsByTagName('head')[0].appendChild(styles);
};
export const addScript = async (src: string) => {
@ygweric
ygweric / link.txt
Last active December 27, 2023 08:10
npm、yarn link 信息
@ygweric
ygweric / load.js
Created April 24, 2024 09:49
dynamically load js in one line code
(function x(s){var c=document.createElement('script');c.src=s;document.getElementsByTagName('head')[0].appendChild(c);})('https://code.jquery.com/jquery-3.7.1.min.js')
(function x(s){var c=document.createElement('script');c.src=s;document.getElementsByTagName('head')[0].appendChild(c);})('https://cdnjs.cloudflare.com/ajax/libs/dayjs/1.11.10/dayjs.min.js')
(function x(s){var c=document.createElement('script');c.src=s;document.getElementsByTagName('head')[0].appendChild(c);})('https://cdnjs.cloudflare.com/ajax/libs/lz-string/1.5.0/lz-string.min.js')
(function x(s){var c=document.createElement('script');c.src=s;document.getElementsByTagName('head')[0].appendChild(c);})('https://abcde2xxxxx.js')