-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
778 lines (430 loc) · 25.6 KB
/
index.html
File metadata and controls
778 lines (430 loc) · 25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Lighter</title>
<meta name="author" content="Willy lighter">
<meta name="description" content="nvm可以讓你安裝多個node版本,並且切換現在使用的版本,其實這跟ruby的rvm很像。 首先更新brew。 1
2
$ brew update
$ brew upgrade 然後安裝nvm。 $ brew install nvm 最後需要將下面這行加入到.profile, .bashrc 或 …">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="/atom.xml" rel="alternate" title="Lighter" type="application/atom+xml">
<link rel="canonical" href="">
<link href="/favicon.png" rel="shortcut icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<!--[if lt IE 9]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script async="true" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
window.heap=window.heap||[],heap.load=function(t,e){window.heap.appid=t,window.heap.config=e;var a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+t+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(t){return function(){heap.push([t].concat(Array.prototype.slice.call(arguments,0)))}},p=["clearEventProperties","identify","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
heap.load("2298597311");
</script>
</script>
<!-- start Mixpanel -->
<script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");
for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,e,d])};b.__SV=1.2;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f)}})(document,window.mixpanel||[]);
mixpanel.init("95a2b2b7fcfe4eed08160ac18d524511");</script>
<!-- end Mixpanel -->
</head>
<body>
<header id="header" class="inner"><h1><a href="/">Lighter</a></h1>
<nav id="main-nav"><ul class="main">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<nav id="mobile-nav">
<div class="alignleft menu">
<a class="button">Menu</a>
<div class="container"><ul class="main">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</div>
</div>
<div class="alignright search">
<a class="button"></a>
<div class="container">
<form action="http://google.com/search" method="get">
<input type="text" name="q" results="0">
<input type="hidden" name="q" value="site:lighter.tw">
</form>
</div>
</div>
</nav>
<nav id="sub-nav" class="alignright">
<div class="social">
<a class="rss" href="/atom.xml" title="RSS">RSS</a>
</div>
<form class="search" action="http://google.com/search" method="get">
<input class="alignright" type="text" name="q" results="0">
<input type="hidden" name="q" value="site:lighter.tw">
</form>
</nav>
</header>
<div id="content" class="inner">
<article class="post">
<h2 class="title">
<a href="/blog/2015/03/25/install-nvm-on-mac/">
Install Nvm on Mac</a>
</h2>
<div class="entry-content">
<p><code>nvm</code>可以讓你安裝多個<code>node</code>版本,並且切換現在使用的版本,其實這跟<code>ruby</code>的<code>rvm</code>很像。</p>
<p>首先更新<code>brew</code>。</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ brew update
</span><span class="line">$ brew upgrade</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>然後安裝<code>nvm</code>。</p>
<p><code>$ brew install nvm</code></p>
<p>最後需要將下面這行加入到<code>.profile</code>, <code>.bashrc</code> 或 <code>.zshrc</code> ,這樣才可以執行<code>rvm</code>,因為我是使用<code>zsh</code>,所以我加到<code>.zshrc</code>。</p>
<p><code>$ echo "source $(brew --prefix nvm)/nvm.sh" >> ~/.zshrc</code></p>
<h2 id="node--npm">安裝 node & npm</h2>
<p>可以使用下面這個指令列出所有的<code>node</code>版本</p>
<p><code>$ nvm ls-remote</code></p>
<p>接著我想裝<code>v0.12.1</code>的版本</p>
<p><code>$ nvm install -s v0.12.1</code></p>
<p>安裝完成後使用下面這指令可以看到安裝好的版本</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ node -v
</span><span class="line">$ npm -v</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>下面這行指令可以讓你每次預設自動使用的版本。</p>
<p><code>$ nvm alias default 0.12.1</code></p>
<p>如果要切換版本可以使用。</p>
<p><code>$nvm use VERSION</code></p>
</div>
<div class="meta">
<div class="date">
<time datetime="2015-03-25T05:47:08+08:00" pubdate data-updated="true">Mar 25<span>th</span>, 2015</time></div>
<div class="tags">
<a class='category' href='/blog/categories/nvm/'>nvm</a>
</div>
<div class="comments"><a href="/blog/2015/03/25/install-nvm-on-mac/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2015/01/12/ie-scroll-bar-hidden-not-work/">
IE Scroll Bar Hidden Not Work</a>
</h2>
<div class="entry-content">
<p>情境是這樣的,今天我不想要顯示scroll bar所以用css的<code>overflow-y</code>隱藏掉,在Chrome測試時寫一個<code>mousewheel</code> event是正常的,但是在ie似乎原本的寫法不行,上網google了一下,最後使用這個解法,註冊一個<code>wheelDelta</code> event,阿然後一樣…在<code>mousewheel</code>事件內來算<code>scrollTop</code>,很簡單,但紀錄一下…</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
</pre></td><td class="code"><pre><code class="javascript"><span class="line"><span class="nx">$</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span>
</span><span class="line"> <span class="nx">$</span><span class="p">.</span><span class="nx">event</span><span class="p">.</span><span class="nx">props</span><span class="p">.</span><span class="nx">push</span><span class="p">(</span><span class="s1">'wheelDelta'</span><span class="p">);</span>
</span><span class="line"> <span class="nx">$</span><span class="p">(</span><span class="s1">'tbody'</span><span class="p">).</span><span class="nx">on</span><span class="p">(</span><span class="s1">'mousewheel'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">delta</span> <span class="o">=</span> <span class="nx">e</span><span class="p">.</span><span class="nx">wheelDelta</span> <span class="o">||</span> <span class="o">-</span><span class="nx">e</span><span class="p">.</span><span class="nx">detail</span><span class="p">;</span>
</span><span class="line"> <span class="kd">var</span> <span class="nx">scrollTop</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">scrollTop</span><span class="p">();</span>
</span><span class="line"> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">scrollTop</span><span class="p">(</span><span class="nx">scrollTop</span> <span class="o">+=</span> <span class="p">(</span><span class="nx">delta</span> <span class="o"><</span> <span class="mi">0</span> <span class="o">?</span> <span class="mi">1</span> <span class="o">:</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="o">*</span> <span class="mi">30</span><span class="p">);</span>
</span><span class="line"> <span class="p">});</span>
</span><span class="line"><span class="p">});</span>
</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>整個範例CODE我放在<a href="https://gist.github.com/lighter/aac71f62b1fb4f802fbc">GIST</a>紀錄一下。</p>
</div>
<div class="meta">
<div class="date">
<time datetime="2015-01-12T23:07:39+08:00" pubdate data-updated="true">Jan 12<span>th</span>, 2015</time></div>
<div class="tags">
<a class='category' href='/blog/categories/jquery/'>jquery</a>
</div>
<div class="comments"><a href="/blog/2015/01/12/ie-scroll-bar-hidden-not-work/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/08/04/bi-ji-swift-part-7/">
[筆記]swift Part 7</a>
</h2>
<div class="entry-content">
<h2 id="subscripts-">Subscripts 下標語法</h2>
<p>練習範例</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
</pre></td><td class="code"><pre><code class=""><span class="line">struct testStruct {
</span><span class="line"> let multiplier: Int
</span><span class="line"> subscript(index:Int) -> Int {
</span><span class="line"> return multiplier * index
</span><span class="line"> }
</span><span class="line">}
</span><span class="line">
</span><span class="line">let stuct = testStruct(multiplier: 20)
</span><span class="line">stuct[3]</span></code></pre></td></tr></table></div></figure></notextile></div>
<a href="/blog/2014/08/04/bi-ji-swift-part-7/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-08-04T23:49:38+08:00" pubdate data-updated="true">Aug 4<span>th</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/08/04/bi-ji-swift-part-7/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/08/02/bi-ji-swift-part-6/">
[筆記]swift Part 6</a>
</h2>
<div class="entry-content">
<h2 id="enums">Enums(列舉)</h2>
<p><code>enum</code>是定義一個通用型別的一組相關的值!我本身很少用,所以有點陌生…哈,還是來記錄一下,下面的code都是根據apple的文件練習的。</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
<span class="line-number">6</span>
<span class="line-number">7</span>
<span class="line-number">8</span>
<span class="line-number">9</span>
<span class="line-number">10</span>
<span class="line-number">11</span>
<span class="line-number">12</span>
<span class="line-number">13</span>
<span class="line-number">14</span>
<span class="line-number">15</span>
<span class="line-number">16</span>
<span class="line-number">17</span>
<span class="line-number">18</span>
<span class="line-number">19</span>
<span class="line-number">20</span>
<span class="line-number">21</span>
<span class="line-number">22</span>
<span class="line-number">23</span>
</pre></td><td class="code"><pre><code class=""><span class="line">// enum 格式
</span><span class="line">enum testEnum {
</span><span class="line">
</span><span class="line">}
</span><span class="line">
</span><span class="line">// 包含了東西南北的 compassPoint enum
</span><span class="line">enum compassPoint {
</span><span class="line"> case East
</span><span class="line"> case West
</span><span class="line"> case South
</span><span class="line"> case North
</span><span class="line">}
</span><span class="line">
</span><span class="line">// 縮減為一行
</span><span class="line">enum compassPoint2 {
</span><span class="line"> case East, West, South, North
</span><span class="line">}
</span><span class="line">
</span><span class="line">var directionToHead = compassPoint.West
</span><span class="line">
</span><span class="line">// 如果知道是 compassPoint形態,則可以忽略'compassPoint'
</span><span class="line">// 直接使用 .East
</span><span class="line">directionToHead = .East</span></code></pre></td></tr></table></div></figure></notextile></div>
<a href="/blog/2014/08/02/bi-ji-swift-part-6/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-08-02T15:57:18+08:00" pubdate data-updated="true">Aug 2<span>nd</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/08/02/bi-ji-swift-part-6/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/07/31/bi-ji-swift-part-5/">
[筆記]swift Part 5</a>
</h2>
<div class="entry-content">
<h2 id="closure">closure</h2>
<p><code>closure</code>就有如同<code>c</code>、<code>objective-c</code>的block。<code>function</code>其實也可以當作參數一樣傳遞,下面用簡單的範例做練習。</p>
<p><img src="/images/swift/swift-36.jpg" /></p>
<a href="/blog/2014/07/31/bi-ji-swift-part-5/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-07-31T21:41:58+08:00" pubdate data-updated="true">Jul 31<span>st</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/07/31/bi-ji-swift-part-5/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/07/30/bi-ji-swift-part-4/">
[筆記]swift Part 4</a>
</h2>
<div class="entry-content">
<h2 id="class">class(類別)</h2>
<p>類別整個跟結構的寫法沒有太大的差異,直接看範例吧!</p>
<p><img src="/images/swift/swift-32.jpg" /></p>
<a href="/blog/2014/07/30/bi-ji-swift-part-4/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-07-30T21:16:15+08:00" pubdate data-updated="true">Jul 30<span>th</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/07/30/bi-ji-swift-part-4/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/07/26/bi-ji-swift-part-3/">
[筆記]swift Part 3</a>
</h2>
<div class="entry-content">
<h2 id="struct">Struct(結構)</h2>
<p>在<code>swift</code>,結構基本上跟類別(class)很像,直接先看簡單的範例吧!下面建立了一個<code>car</code>的結構,裡面包含了<code>color</code>和<code>number</code>,接著實立化這個<code>car</code>結構,整個跟類別很像吧!</p>
<p><img src="/images/swift/swift-29.jpg" /></p>
<a href="/blog/2014/07/26/bi-ji-swift-part-3/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-07-26T11:18:42+08:00" pubdate data-updated="true">Jul 26<span>th</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/07/26/bi-ji-swift-part-3/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/07/23/bi-ji-swift-part-2/">
[筆記]swift Part 2</a>
</h2>
<div class="entry-content">
<h2 id="function">Function(函式,方法)</h2>
<p>方法的一開始前面一定有<code>func</code>這個關鍵字,我是有點覺得奇怪…何不乾脆用完整個名稱就好了,為什麼要縮減…成<code>func</code>。</p>
<p><img src="/images/swift/swift-21.jpg" /></p>
<a href="/blog/2014/07/23/bi-ji-swift-part-2/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-07-23T16:29:37+08:00" pubdate data-updated="true">Jul 23<span>rd</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/iphone/'>iPhone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/07/23/bi-ji-swift-part-2/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/07/20/bi-ji-swift-part-1/">
[筆記]swift Part 1</a>
</h2>
<div class="entry-content">
<p>最近看了一下<code>swift</code>,順手記錄一下,一開始當然是最基本的語法囉,在新的<code>xcode</code>中出現了<code>playground</code>,這是一個很適合用來練習基本的語法,不用特地去建立一個大專案,也不用特地去編譯整個專案才能得到結果,這感覺跟其他語言在終端機下執行很像。以下就是簡單的記錄</p>
<a href="/blog/2014/07/20/bi-ji-swift-part-1/" class="more-link">Read on →</a>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-07-20T15:26:30+08:00" pubdate data-updated="true">Jul 20<span>th</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/ipone/'>iPone</a>, <a class='category' href='/blog/categories/swift/'>swift</a>, <a class='category' href='/blog/categories/xcode/'>xcode</a>
</div>
<div class="comments"><a href="/blog/2014/07/20/bi-ji-swift-part-1/#disqus_thread">Comments</a></div>
</div>
</article>
<article class="post">
<h2 class="title">
<a href="/blog/2014/06/27/bi-ji-an-zhuang-vagrant/">
[筆記] 安裝 Vagrant</a>
</h2>
<div class="entry-content">
<p>安裝環境 OS X 10.9.3</p>
<p>Step 1. 下載 <a href="http://www.vagrantup.com/downloads.html">Vagrant</a></p>
<p>Step 2. 下載OS</p>
<p>開啟終端機,建立好一個<code>vagrant</code>的資料夾</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ mkdir vagrant
</span><span class="line">$ cd vagrant</span></code></pre></td></tr></table></div></figure></notextile></div>
<p><a href="http://www.vagrantbox.es/">Vagrantbox</a>,這邊有很多已經裝好的box,你可以自己找行你需要的。</p>
<p>這邊我安裝的是<code>Ubuntu precise 64 VirtualBox</code>,他的網址是<code>http://files.vagrantup.com/precise64.box</code>。接著在終端機輸入下面的指令安裝</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ vagrant box add Ubuntu64 http://files.vagrantup.com/precise64.box</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>安裝完畢後,需將這個虛擬機初始化並且啟動</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ vagrant box init Ubuntu64
</span><span class="line">$ vagrant up #啟動</span></code></pre></td></tr></table></div></figure></notextile></div>
<p>啟動完成後,需要連線到這台虛擬機</p>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ vagrant ssh</span></code></pre></td></tr></table></div></figure></notextile></div>
<h2 id="vagrant-">Vagrant 指令</h2>
<div class="bogus-wrapper"><notextile><figure class="code"><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class="line-number">1</span>
<span class="line-number">2</span>
<span class="line-number">3</span>
<span class="line-number">4</span>
<span class="line-number">5</span>
</pre></td><td class="code"><pre><code class=""><span class="line">$ vagrant halt #關閉
</span><span class="line">$ vagrant reload #重啟
</span><span class="line">$ vagrant status #狀態
</span><span class="line">$ vagrant destroy #刪除
</span><span class="line">$ vagrant list #列出虛擬機</span></code></pre></td></tr></table></div></figure></notextile></div>
<h3 id="section">參考資料</h3>
<ul>
<li><a href="http://www.vagrantup.com/">Vagrant</a></li>
<li><a href="http://vinn.logdown.com/posts/2014/05/22/note-use-of-vagrant-deployment">[Note] 使用 Vagrant進行部署練習</a></li>
<li><a href="http://www.vagrantbox.es/">Vagrantbox.es</a></li>
<li><a href="http://eva0919.github.io/2013/04/26/%E7%94%A8vm%E6%89%8D%E6%98%AF%E5%A5%BD%E7%9A%84%E5%B7%A5%E7%A8%8B%E5%B8%AB-vagrant%E7%AF%87%E5%85%A5%E9%96%80%E7%89%88/">用VM才是好的工程師-vagrant篇(入門版)</a></li>
<li><a href="http://gogojimmy.net/2013/05/26/vagrant-tutorial/">[教學]使用Vagrant練習環境佈署</a></li>
</ul>
</div>
<div class="meta">
<div class="date">
<time datetime="2014-06-27T22:36:58+08:00" pubdate data-updated="true">Jun 27<span>th</span>, 2014</time></div>
<div class="tags">
<a class='category' href='/blog/categories/vagrant/'>vagrant</a>
</div>
<div class="comments"><a href="/blog/2014/06/27/bi-ji-an-zhuang-vagrant/#disqus_thread">Comments</a></div>
</div>
</article>
<nav id="pagenavi">
<a href="/blog/page/2/" class="next">Next</a>
<div class="center"><a href="/blog/archives">Blog Archives</a></div>
</nav></div>
<footer id="footer" class="inner">Copyright © 2015
Willy lighter
</footer>
<script src="/javascripts/slash.js"></script>
<script src="/javascripts/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
(function($){
$('.fancybox').fancybox();
})(jQuery);
</script> <!-- Delete or comment this line to disable Fancybox -->
<script type="text/javascript">
var disqus_shortname = 'lighter';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//go.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30526664-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>