This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let person = {name: 'John Smith'}; | |
| let tpl = `My name is ${person.name}.`; | |
| console.log(tpl); | |
| let x = 5; | |
| let y =3; | |
| let tpl2 = `${x} + ${y} = ${x+y}`; | |
| console.log(tpl2); | |
| // template literal本身不具重用性,除非自己包成函式 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Right One | |
| item.attr("data-title", error); | |
| item.attr("data-placement","bottom"); | |
| item.attr("data-toggle","toggle"); | |
| item.closest("div").addClass("has-error"); | |
| item.closest("div").addClass("has-feedback"); | |
| item.closest("div").find(".glyphicon-ok").remove(); | |
| item.after('<span class="glyphicon glyphicon-remove form-control-feedback"></span>'); | |
| item.tooltip('show'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| form#formArticle(role="form") | |
| div.form-group | |
| label(for="createArticleTitle") Article Title | |
| textarea.form-control(row="1" name="title") | |
| label(for="createArticleBody") Article Body | |
| textarea.form-control(row="6" name="description") | |
| button(type="submit") | |
| //使用jquery的serialize()-直接將form各個欄位值轉為POST/GET傳遞的格式 | |
| //Use Jquery serialize() function - turn the values of cloumns in form into POST/GET format | |
| //*項目必須要有 name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var router = express.Router(); | |
| /* GET home page. */ | |
| router.get('/', function(req, res, next) { | |
| var chartData = []; | |
| for (var i = 0; i < 7; i++) | |
| chartData.push(Math.random() * 50); | |
| res.render('index', { title: 'Express', chartData: JSON.stringify(chartData) }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Doctype | |
| html | |
| head | |
| meta(charset='utf-8') | |
| title #{title} | |
| script(src='/javascripts/Chart.min.js') | |
| body | |
| canvas#myChart | |
| script(type="text/javascript"). | |
| var data = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //NCTU_Embedded system_Arduino_Lab02 | |
| //Read and compare sensor | |
| //then display on 5*7 LED matrix | |
| //show the "HelloWorld" and shift left or right by the comparison | |
| //display like this project:http://musicdiver.com/wordpress/2013/01/arduino-scrolling-text-on-5x7-led/ | |
| int scan=0; | |
| int matrix[7][50]; | |
| //transform letter to 5*7 LED matrixs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Lab01 | |
| // LM35 + 4*7 segment Display | |
| // 七段顯示器 reference: Cooper Maa | |
| // define the LED digit patterns, from 0 - 9 | |
| // 1 = LED on, 0 = LED off, in this order: | |
| // Arduino pin: 2,3,4,5,6,7,8 (Mapping a,b,c,d,e,f,g of Seven-Segment LED) | |
| byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 }, // = 0 | |
| { 0,1,1,0,0,0,0 }, // = 1 | |
| { 1,1,0,1,1,0,1 }, // = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //set up pin | |
| const int buttonPin = 2; | |
| const int hornPin = 3; | |
| const int ohm=5; | |
| //data | |
| int music[5]={0,0,0,0,0}; | |
| int point=0; | |
| int sensor=0; | |
| boolean buttonState=LOW; | |
| long lastDebounceTime = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Servo.h> | |
| #include <IRremote.h> | |
| //IR | |
| int RECV_PIN = 11; | |
| IRrecv irrecv(RECV_PIN); | |
| decode_results results; | |
| const unsigned long IRmove1 = 0XFF30CF; | |
| const unsigned long IRmove2 = 0XFF18E7; | |
| const unsigned long IRmove3 = 0XFF7A85; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Wire.h> | |
| #include <LiquidCrystal_I2C.h> | |
| #include <virtuabotixRTC.h> | |
| //use interrupt 0 -> pin 2 (button0) | |
| #define lock 0 | |
| //button1 | |
| #define add_sec 4 | |
| //button2 | |
| #define add_min 3 |