Skip to content

Instantly share code, notes, and snippets.

define: function(name, data, superClass) {
if(superClass) data.inherit = superClass;
var Class = $.ui[name] = _createClass(function(el, options) {
var obj = _createObject(Class.prototype, {
_id: $.parseTpl(tpl, {
name: name,
id: _guid()
<?php
/**
* 利用上传文件时间生成唯一ID,用于解决用户一次选择多个文件时,文件名相同的问题
* @return int Unix时间戳小数点右移四位取整
*/
function upload_time() {
list($msec, $sec) = explode(" ", microtime());
return ((int)$sec . (int)($msec * 10000));
}
@charset "UTF-8";
$a: #23d4a4;
/*!
* hi there 中文注释 #{$a}
*/
body {
background-color: $a;
void setup(){
Serial.begin(9600);
}
void loop(){
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(1);
}
int led = 9; // the pin that the LED is attached to
int switch1 = 8; // the pin that switch 1 is attached to
int switch2 = 7; // the pin that switch 2 is attached to
boolean state1 = false;
boolean state2 = false;
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
void setup() {
pinMode(led, OUTPUT);
var serialport = require("serialport");
serialport.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
});
});
var serialport = require('serialport'),
SerialPort = serialport.SerialPort, // make a local instance
portName = "/dev/cu.usbmodem1451", // replace the string with your own
latestData = 0;
var myPort = new SerialPort(portName, {
baudRate: 9600,
// look for return and newline at the end of each data packet
parser: serialport.parsers.readline("\r\n")
});
var servi = require('servi');
var app = new servi(false); // servi instance
function sendData(request) {
// print out the fact that a client HTTP request came in to the server:
console.log("Got a client request, sending them the data.");
// respond to the client request with the latest serial string:
request.respond(latestData);
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href='http://fonts.googleapis.com/css?family=Flamenco:300,400' rel='stylesheet' type='text/css'>
<style>
body {
font-family: 'Flamenco', cursive;
font-size: 80px;
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Connect a stepper motor with 200 steps per revolution (1.8 degree)