Skip to content

Instantly share code, notes, and snippets.

@Yang03
Yang03 / redux.js
Created January 5, 2018 09:52
redux.js
const log = (store) => (next) => (action) {
console.log('start')
next(action)
console.log('end')
}
function applayMiddleware (...middlewares) {
return (createStore) {
return (reducer, preloadedState,enhancer){
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
#marquee {
height:120px;
overflow:hidden;
$pi: 3.14159265359;
$_precision: 10;
@function pow($base, $exp) {
$value: $base;
@if $exp > 1 {
@for $i from 2 through $exp {
$value: $value * $base;
}
}
@Yang03
Yang03 / 1.scss
Last active January 19, 2018 09:53
<div class="ellips">
<div class="dot"></div>
</div>
$pi: 3.14159265359;
$_precision: 10;
@function pow($base, $exp) {
{"type":"FeatureCollection","features":[{"id":"710000","type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[120.005817,23.469568],[120.060116,23.545228],[120.005817,23.469568]]],[[[120.443536,22.441261],[120.274291,22.560197],[120.200415,22.721097],[120.132976,23.000352],[120.022152,23.06007],[120.107847,23.341264],[120.121753,23.504658],[120.096239,23.570106],[120.102762,23.70097],[120.175354,23.807398],[120.255474,23.851801],[120.278257,23.927783],[120.451468,24.182705],[120.546295,24.370432],[120.642772,24.49016],[120.688678,24.600694],[120.881267,24.745821],[120.908484,24.851995],[121.024684,25.040488],[121.209299,25.127094],[121.371868,25.159867],[121.413467,25.238928],[121.485729,25.292878],[121.602414,25.304355],[121.745253,25.161944],[121.928777,25.130097],[121.941769,25.038471],[122.012201,25.001451],[121.845043,24.836255],[121.84152,24.734083],[121.892504,24.617927],[121.885457,24.529684],[121.826735,24.423573],[121.809157,24.339072],[121.638554,24.08434],[121.65937,24.006899],[121.4
import Vue from 'vue'
import App from './app'
new Vue({
el: '#app',
render: h => h(App, {
props: {
message: '小程序2'
}
@Yang03
Yang03 / gist:763b81fd6a8da38e20d0587c18127715
Created February 11, 2018 10:36
mapGetters vs mapState
...mapGetters({
x1: 'widgets/x1'
}),
...mapState('widgets', ['xx'])
state = {
xx: 0
}
<template>
<section class="bx-muti-img-bar">
<div class="slide-items" :style="style">
<div class="slide-item" v-for="(slide, index) in value.slides"
:key="index"
:style="[slideStyle[index], getStyle(index)]"
>
<img :src="slide['image']">
</div>
</div>
@Yang03
Yang03 / sha1.js
Created May 4, 2018 06:36
nodejs
function passwordDigest(str, password) {
// digest = base64 ( sha1 ( nonce + created + password ) )
var pwHash = crypto.createHash('sha1');
// var rawNonce = new Buffer(nonce || '', 'base64').toString('binary');
var s = str.concat(shaPwd(password));
pwHash.update(s);
var str = new Buffer(pwHash.digest()).toString('base64');
console.log(str);
return str;
};
!function(){
var IS_IOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
var IS_ANDROID = /android/i.test(navigator.userAgent);
var IS_TOUCH = createjs.Touch.isSupported();
var SCREEN_SHOW_ALL = true;
var width = 640;
var height = 1000;
var stage, queue;
var isMove = 0; //qp_o
var score = 0;