This file contains 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
/* | |
請完成以下 API 設計,讓你的程式可以執行以下程式碼,並且得到預期的結果。串接 add 的次數沒有上限,最後一個 API 是 result() 才會回傳結果。 | |
$(1).add(2).add(3).add(99).result() === 105 | |
$(1).add(2).add(3).result() === 6 | |
etc... | |
...etc... | |
*/ | |
function $(start) { | |
var sum = start; |
This file contains 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
/* | |
請依據以下範本撰寫一個 MyFunc 函式: | |
function MyFunc() { | |
// YOUR CODE HERE | |
} | |
撰寫完成後,必須可以正常執行以下程式碼: | |
var o = MyFunc(); | |
o.get_a() // 回傳 undefined |
This file contains 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
(function(){ | |
var a; | |
a = b = 3; | |
})(); | |
/* | |
a => 為 function 的區域變數,IIFE 執行完回收,ReferenceError: a is not define | |
b => 未用 var 宣告,所以會在 window 添加 b 屬性,其值為 3,IIFE 執行完依然存在 | |
*/ |
This file contains 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
.main { | |
width: 100%; | |
height: 200px; | |
border: 1px solid gray; | |
margin-bottom: 20px; | |
} |
This file contains 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
<div class="color" | |
[ngStyle]="{'background-color': myStyle}" | |
(click)="picked.emit(myStyle)"></div> | |
<div *ngIf="show; else edit" class="tweak"> | |
<input type="range" min="0" max="255" [(ngModel)]="r"> | |
<span style="color: red">{{ r }}</span><br /> | |
<input type="range" min="0" max="255" [(ngModel)]="g"> | |
<span style="color: green">{{ g }}</span><br /> | |
<input type="range" min="0" max="255" [(ngModel)]="b"> |
This file contains 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
<app-counter-button [step]="-2" (changed)="change($event)"></app-counter-button> | |
{{ counter }} | |
<app-counter-button [step]="5" (changed)="change($event)"></app-counter-button> |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use Symfony\Component\DomCrawler\Crawler; | |
class PjaxMiddleware |
This file contains 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
<?php | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Category extends Model | |
{ | |
// 定義 self relation,用來處理子分類 |
This file contains 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
<?php | |
use Illuminate\Database\Seeder; | |
class CategoriesTableSeeder extends Seeder | |
{ | |
/** | |
* Run the database seeds. | |
* | |
* @return void |
NewerOlder