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 / link.txt
Last active December 27, 2023 08:10
npm、yarn link 信息
@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 / 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 / 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>
{
"python.pythonPath": "~/.virtualenvs/djangosite/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pep8Args": [
"--ignore=E501"
],
"python.linting.pylintPath": "~/.virtualenvs/djangosite/bin/pylint",
"python.linting.pylintArgs": [
"--load-plugins",
"pylint_django"
@ygweric
ygweric / gist:422cee5dbd7e79dd6fa94da561e8ae50
Last active January 29, 2018 02:24
JavaScript 'this' and '=>' arrow function
const Adder = new function() {
this.sum = 0;
this.add = function(numbers) {
numbers.forEach(function(n) {
this.sum +=n;
});
};
}
Adder.add([1, 2, 3]);
@ygweric
ygweric / launcher.json
Last active January 26, 2018 03:16
Config VSCode to debug with jest
{
"name": "Jest Tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"type": "node",
"request": "launch",
"args": [
"-i"
],
}
@ygweric
ygweric / Jenkins+fastlane troubleshooting
Last active October 1, 2017 23:47
Jenkins+fastlane troubleshooting on iOS
Jenkin + fastlane draft
brew services start jenkins-lts
brew services restart jenkins-lts
PATH=$PATH:/usr/local/bin/
# ENV["FASTLANE_PASSWORD"] = "123123123"
cert
@ygweric
ygweric / command.txt
Created September 23, 2017 00:30
Git commands list
GIT COMMAND
//edit the last commit
git commit --amend -m "New commit message"
#Remove information on branches that were deleted on origin
git fetch --prune
# to create a new branch and switch to it in one step
$ git checkout -b <branch-name>
import UIKit
func isExactClass<T>(obj: Any, _ _: T.Type) -> Bool{
return type(of: obj) == T.self
}
class Dog {