Skip to content

Instantly share code, notes, and snippets.

View movii's full-sized avatar

movii movii

  • Shanghai, China
  • 10:18 (UTC +08:00)
View GitHub Profile
@movii
movii / App.vue
Last active June 19, 2018 02:19
配合 Vue.js 配置 Webpack。原文:https://moxo.io/blog/2016/09/10/npm-vue-webpack/
<template>
<h1>Hello World with webpack-dev-server</h1>
</template>
<script>
export default {
data () {
return {}
}
}
@movii
movii / command.sh
Last active June 19, 2018 02:18
配合 Vue.js 配置 Webpack。原文:https://moxo.io/blog/2016/09/10/npm-vue-webpack/
npm install vue-loader css-loader vue-template-compiler -=save-dev
# 或者
yarn add vue-loader css-loader vue-template-compiler --dev
# 在终端中输入以监听 localhost:1333 的结果
while :; do clear; nc -l localhost 1333; sleep 2; done
const sayHelloToWithReply = (name) => {
alert(`Hello, ${name}! (sayHelloToWithReply() invoked from javascript)`);
return `Hello ${name}! (sayHelloToWithReply() invoked from javascript)`
}
const sayHelloTo = (name) => {
alert(`Hello, ${name}! (sayHelloTo(name) invoked from javascript)`);
}
const sayHello = () => {
alert('Hello (sayHello() invoked from javascript)');
}
extension NativeInvokeJavaScriptBrowserViewController: WKNavigationDelegate {
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
switch requestJavaScriptMethod!
{
case "SayHelloTo":
wkWebView.evaluateJavaScript("sayHelloTo('Lien')")
case "SayHelloToWithReply":
wkWebView.evaluateJavaScript("sayHelloToWithReply('Lien')") { (any,error) -> Void in
print("\(any as! String)")
@movii
movii / ViewController.swift
Created June 9, 2018 09:25
笔记:iOS 与 JavaScript 的交互(三)
progressView = UIProgressView(
frame: CGRect(
origin: CGPoint(x: 0, y: 64),
size: CGSize(width: self.view.frame.width, height: 1)
)
)
let width = self.view.bounds.size.width
let height = self.view.bounds.size.height
@movii
movii / gulp.js
Created June 2, 2018 06:39
笔记:最近需求中的 Gulp Task 1
var gulp = require('gulp');
var path = require('path');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
gulp.task('minify-js', function() {
// 首先去除我们之后想要合并的 base*.js 和 package 文件的监听
// 然后对剩下文件进行 watch
return gulp.watch([
'**/*.js',
const loop = () => {
ctx.clearRect(0, 0, $canvas.width, $canvas.height);
let x = 125 + Math.cos(angle) * 100
let y = 125 + Math.sin(angle) * 100
ctx.fillStyle = "hotpink";
ctx.beginPath();
ctx.arc(x, y, 10, 0, getRads(360));
ctx.closePath();