Skip to content

Instantly share code, notes, and snippets.

View wwayne's full-sized avatar
🙈
I can't see you

Wang Zixiao wwayne

🙈
I can't see you
View GitHub Profile
'use strict'
module.exports = class WebpackPugManifestPlugin {
apply (compiler) {
compiler.plugin('emit', function (compilation, cb) {
const JSAssets = Object.keys(compilation.assets).filter(asset => /\.js$/.test(asset))
JSAssets.sort((a, b) => {
if (/^manifest/.test(b)) return 1
if (/^vendor/.test(b) && !/^manifest/.test(a)) return 1
return 0
import React, {Animated, Component} from 'react-native'
class Player extends Component {
constructor () {
super()
const width = {pts: 30, ast:...}
this.state = {
pts: new Animated.Value(width.pts)
ast: new Animated.Value(width.ast),
reb: new Animated.Value(width.reb)
import cssStyle from './style'
componentWillUnmount () {
// delete the style when the component unmount
let tag = document.querySelector('style[id="react-tooltip"]')
document.getElementsByTagName('head')[0].removeChild(tag)
}
render() {
// to check if the style has been existed
@wwayne
wwayne / 1.transform-sass.js
Last active September 13, 2015 02:24
Insert sass into react component which will be shared from npm
var sass = require('node-sass')
var fs = require('fs')
var path = require('path')
function transferSass () {
sass.render({
file: path.resolve(__dirname, '../src/index.scss'), //source scss file
outputStyle: 'compressed'
}, function (err, result) {
if (err) {