
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
vim_utility
Advanced tools
npm install --save-dev vim_utility
import {s_random} from "vim_utility"
s_random(7);
click to see code
// import px2rem.js in your bootstrap js
import {px2rem} from "vim_utility/utility"
// Dynamically change the html font-size when window's size changed
px2rem();
@import '~vim_utility/src/scss/px2rem.scss';
$designWidth : 750px; /*Design draft width*/
.example{
height: px2rem(200px);
border: solid 1px black;
font-size: 12px ;
[data-dpr="2"] &{
font-size: 24px;
}
[data-dpr="3"] &{
font-size: 36px;
}
}
// assuming there is (yourKey => yourValue) in the cookie
getCookie(yourKey); // return yourValue
removeCookie(yourKey);
setCookie(key, value, days);
addClass(ele, cls); /*ele instance of Node, cls is string*/
closestNode(el, selector); /*Similar to the jquery closestNode method*/
css(ele, prop); /*get css attribute value*/
elementFromPoint(e); // e is mouse event
// return Node
getCaretPosition (el); // return number;
getMaxZIndex(ele = undefined); // if ele === undefined , return max z-index value in the document
getScrollLeft();
getScrollTop();
hasClass(ele, cls);
nextNode(el, selector);
offset(ele); // get distance away from window
/* @return
* {
left: x,
top: y
}
* */
parentNode(el, selector, root=undefined);
prevNode(el, selector);
removeClass(ele, cls);
scrollTo(to, duration); // scroll to given place during given time
setScrollTop(value); // it exec window.scrollTo();
toggleClass(ele, cls);
toDataUri(url, (d) => {console.log(d);}); // transfer image png/jpg to base64
throttle(delay, callback, debounceMode = false, immediate = false);
let wrap = debounce(/*callback*/ (e) => {console.log(e);}, /*delay*/ 500); // return wrapper function;
window.addEventListener('resize', (e) => {wrap(e)});
keyCode(name); // return keyCode Number;
deepClone(obj); // return any;
n_random(min, max, n = 1);
s_random(7); // return string it's length is 7
getExplore(); // get explore type and version
getOS();
getUrlParam(url); // return Map;
isChinaIDCard(str); // return boolean
isEmail(str); // return boolean
isPhone(str); // return boolean, validator chinese phone number
isUrl(url); // return boolean
getTimeStamp({ cal = new Date(), d = 0, h = 0, m = 0 , s = 0 } = {}); // return number(seconds)
FAQs
helper export functionfor javascript
We found that vim_utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.