Skip to content

Instantly share code, notes, and snippets.

Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
@cola-sk
cola-sk / dabblet.css
Created November 7, 2018 06:34
How to make 3-corner-rounded triangle in CSS (SO)
/**
* How to make 3-corner-rounded triangle in CSS (SO)
* http://stackoverflow.com/q/14446677/1397351
*/
.triangle, .triangle:before, .triangle:after { width: 4em; height: 4em; }
.triangle {
overflow: hidden;
position: relative;
margin: 7em auto 0;
border-radius: 20%;
@cola-sk
cola-sk / asyncRoute.js
Created September 3, 2018 13:54 — forked from velopert/asyncRoute.js
Server Side Rendering & Async Route (Code Splitting) for React-Router v4
import React from 'react';
export default function asyncComponent(getComponent) {
class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
git config --global http.proxy http://127.0.0.1:1080
git config --global http.proxy username:password@http://127.0.0.1:1080
curl -x
proxychains4
@cola-sk
cola-sk / copyToClipboard.js
Last active May 31, 2018 10:44 — forked from Chalarangelo/copyToClipboard.js
复制文本到剪切板
export const copyToClipboard = text => {
let textArea;
let copy;
let isError = false;
function isOS() {
return navigator.userAgent.match(/ipad|iphone/i);
}
function createTextArea(text) {
@cola-sk
cola-sk / check-in-visible
Created May 25, 2018 02:47
检查当前元素是否在可视区域内
var checkNormalVisible = function checkNormalVisible(component) {
var node = ReactDOM.findDOMNode(component);
// If this element is hidden by css rules somehow, it's definitely invisible
if (!(node.offsetWidth || node.offsetHeight || node.getClientRects().length)) return false;
var top = void 0;
var elementHeight = void 0;
try {
@cola-sk
cola-sk / .bashrc
Created March 26, 2018 06:35 — forked from mathiasverraes/.bashrc
Git shortcuts
#! /bin/sh
alias gs="git status"
alias gc="git commit"
alias gr="git checkout"
alias ga="git add"
alias gl="git lola"
@cola-sk
cola-sk / webpack-code-split.config.js
Last active December 14, 2017 09:12
webpack code split config
var config = {
plugins: [],
entry: {
normalize: [
inProjectSrc('normalize'),
],
main: [
inProjectSrc(project.main),
]
},
@cola-sk
cola-sk / high-dpi-media.css
Last active October 25, 2017 09:13 — forked from marcedwards/high-dpi-media.css
A CSS media query that captures almost all high DPI aware devices.
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@cola-sk
cola-sk / connect.js
Created October 11, 2017 09:58 — forked from gaearon/connect.js
simple connect
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (