Skip to content

Instantly share code, notes, and snippets.

Avatar
Focusing

liuyanghejerry liuyanghejerry

Focusing
View GitHub Profile
@liuyanghejerry
liuyanghejerry / index.html
Last active May 27, 2019
Modern index file in 2017
View index.html
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns#">
<head>
<!-- content-type, which overrides http equivalent header. Because of charset, this meta should be set at first. -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Overrides http equivalent header. This tells IE to use the most updated engine. -->
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<!-- Tells crawlers how to crawl this page, and the role of this page. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta -->
<meta name="robots" content="index, follow">
@liuyanghejerry
liuyanghejerry / index.html
Last active Jan 21, 2016 — forked from anonymous/index.html
Short sample to illustrate :lang() // source https://jsbin.com/yowaro
View index.html
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
.target:lang(zh) {
color: green;
}
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.14.3.js"></script>
<script src="http://fb.me/react-dom-0.14.3.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.rating-table {
border: 0;
@liuyanghejerry
liuyanghejerry / install-py27.sh
Created Dec 4, 2015
Safely install Python 2.7 on CentOS 6.5+
View install-py27.sh
yum install centos-release-SCL
yum install python27 python27-scldevel
# then add those line to your .bash_rc or .bash_profile
# note that space between dot and slash
# . /opt/rh/python27/enable
# Or if you want a better solution: http://developerblog.redhat.com/2014/03/19/permanently-enable-a-software-collection/
@liuyanghejerry
liuyanghejerry / RouteTransition.jsx
Created Nov 6, 2015 — forked from maisano/RouteTransition.jsx
Using react-motion with react-router
View RouteTransition.jsx
import React, { PropTypes } from 'react';
import { TransitionMotion, spring } from 'react-motion';
/**
* One example of using react-motion (0.3.0) within react-router (v1.0.0-rc3).
*
* Usage is simple, and really only requires two things–both of which are
* injected into your app via react-router–pathname and children:
*
* <RouteTransition pathname={this.props.pathname}>
View firendly_hsl_color.js
`hsl(${(Math.floor(3600*Math.random()/10) + 1)}, ${(Math.floor((60)*Math.random()) + 1)}%, ${(Math.floor((25)*Math.random()) + 30)}%)`
@liuyanghejerry
liuyanghejerry / index.html
Last active Sep 15, 2015 — forked from anonymous/index.html
css that only select `ul` has and only has 5 children.
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0,minimal-ui">
<title>JS Bin</title>
<style id="jsbin-css">
li:nth-child(1):nth-last-child(5),
li:nth-child(1):nth-last-child(5) ~ li {
background-color: pink;
@liuyanghejerry
liuyanghejerry / index.html
Last active Aug 29, 2015 — forked from anonymous/index.html
Component switch animation with React
View index.html
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
.parent {
position: relative;
}
@liuyanghejerry
liuyanghejerry / index.html
Last active Aug 29, 2015 — forked from anonymous/index.html
文字等宽对齐demo
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
ul {
width: 180px;
}
li {
@liuyanghejerry
liuyanghejerry / myLocaleSort,js
Created Apr 24, 2015
Locale aware sort, without serious test.
View myLocaleSort,js
function sort(a, b) {
for (var i = 0; i < a.length; i++) {
if (a[i] === b[i]) {
continue;
}
return isABeforeB(a[i], b[i]) ? 1 : -1;
}
}
You can’t perform that action at this time.