Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

basecss basecss

🎯
Focusing
  • 00700.HK
  • Shenzhen, China
Block or report user

Report or block basecss

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
@basecss
basecss / setup.md
Last active Nov 29, 2018
React + Redux + Webpack + Babel + HMR(JS + CSS) + CSS Extract
View setup.md

dependencies

npm install webpack webpack-cli webpack-dev-server @babel/core @babel/preset-env
@babel/preset-react babel-loader css-loader mini-css-extract-plugin css-hot-loader --save-dev --verbose

npm install react react-dom redux react-redux --save --verbose

.babelrc

View 一段1-100求和代码分析.md

群主分享了这么一段代码,应邀分析一下,以下是正文。

代码

new Array(101).join(' ').replace(/ /g,function(t,i){
    return i+1+' '
}).split(' ').reduce(function(n1,n2) {
    return (n1-0)+(n2-0)
});
@basecss
basecss / install.md
Created Mar 6, 2015
Install different version of Node.js
View install.md
// Install n from npm
$ sudo npm install -g n

// Install different version for Node.js
$ sudo n 0.12.0
$ sudo n 0.10.36

// Quickly switch between the Node.js version with the command n
$ n
@basecss
basecss / vhost-config.md
Created Jan 4, 2015
Windows下配置vhost(WAMP)
View vhost-config.md
  • /Apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "F:/xxx/xxx" <- code
    ServerName myhost.example.com
    ErrorLog "logs/myhost.example.comm-error.log"
    CustomLog "logs/myhost.example.com-access.log" common
</VirtualHost>
@basecss
basecss / promise.md
Created Jul 10, 2014
JavaScript Promise
View promise.md
function fetchJSON(url) {
	return new Promise(function(resolve, reject) {
		var xhr = new XMLHttpRequest();
		xhr.open('GET', url);
		xhr.responseType = 'json';
		xhr.send();
		xhr.onload = function() {
			if(xhr.response) {
				resolve(xhr.response);
View responsive-image.html
<style>
@media (min-device-width:600px) {
img[data-src-600px] {
content: attr(data-src-600px, url);
}
}
@media (min-device-width:800px) {
img[data-src-800px] {
content: attr(data-src-800px, url);
@basecss
basecss / deepClone.js
Created Feb 13, 2014
deep clone object
View deepClone.js
function deepClone(target) {
if(typeof target !== 'object') {
return target;
}
if(target.constructor === RegExp) {
return target;
}
var result = new target.constructor();
@basecss
basecss / sidebar.md
Created Feb 10, 2014
FireFox 浏览器 - 添加到书签栏
View sidebar.md
<a href="http://www.basecss.net/" rel="sidebar">收藏本站</a>

目前只有 FireFox 支持,新版 Opera 启用 Webkit 内核之后已经不再支持。

View createTouchEvent.js
(function() {
var ua = /iPhone|iP[oa]d/.test(navigator.userAgent) ? 'iOS' : /Android/.test(navigator.userAgent) ? 'Android' : 'PC';
document.addEventListener('DOMContentLoaded', function(event) {
if(ua === 'PC') {
return;
}
You can’t perform that action at this time.