Gistを使い始めて気がついた点をメモした。 Gistはこのようなメモや短いコードをバージョン管理しながら公開するのに便利。
特にこのメモでは、画像を同一ディレクトリに置いて、 それGFMファイル内に挿入する方法を解説。
このメモにはgitコマンドの使い方の解説はない。 このメモは随時更新される予定。
| var helloWorld :String = "Hello World swift!" | |
| print(helloWorld) |
手もとでGFM (GitHub Flavored Markdown) ファイルをHTMLファイルに変換する簡単なRubyスクリプトgfm2html.rbを下に置きました。 github-markdownを用いています。 google-code-prettifyを使えばsyntax highlightができることが特徴です。 簡単なCSSファイルを用意して使います。例としてstyle.cssが下に置いてあります。
この文章は Gist https://gist.github.com/t-nissie/c415b7da3a694e82d6b5 に置いてあります。
git clone [email protected]:c415b7da3a694e82d6b5.git gfm2htmlでクローンできます。
| function Observer(){ | |
| this.listeners = {}; | |
| } | |
| Observer.prototype.on = function(event, func) { | |
| if(!this.listeners[event]){ | |
| this.listeners[event] = []; | |
| } | |
| this.listeners[event].push(func); | |
| }; | |
| Observer.prototype.off = function(event, func) { |
| require 'aws-sdk-core' | |
| config = { | |
| :region => "ap-northeast-1" | |
| } | |
| client = Aws::EC2::Client.new( | |
| region: config[:region], | |
| ) | |
| resp = client.describe_instances({ |
| - hosts: all | |
| sudo: yes | |
| vars: | |
| username: webmaster | |
| tasks: | |
| - name: add a new user | |
| user: name={{username}} state=absent | |
| - name: upgrade all packages | |
| yum: name=* state=latest | |
| - name: install apache |
| <!DOCTYPE html> | |
| <html lang="ja"> | |
| <head> | |
| <title>index.html</title> | |
| <script type="text/javascript" src="./js/index.js"></script> | |
| </head> | |
| <body> | |
| <header> | |
| <div id="nav"> | |
| <ul class="global_nav"> |
| $(function(){ | |
| var $window = $(window), | |
| $document = $(document); | |
| $(window).on('resize', function(){ | |
| var wwidth = $window.width(), | |
| dwidth = $document.width(); | |
| (wwidth < dwidth) && $document.scrollLeft( (dwidth - wwidth)/2 ) | |
| }); | |
| $(window).trigger('resize'); | |
| }); |
| <!DOCTYPE html> | |
| <html lang="ja" ng-app="myApp"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Document</title> | |
| <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> | |
| <script> | |
| angular.module("myApp", []) | |
| .controller("MyController", function($scope){ | |
| $scope.mes = "こんにちわ、AngularJS!" |