Gistを使い始めて気がついた点をメモした。 Gistはこのようなメモや短いコードをバージョン管理しながら公開するのに便利。
特にこのメモでは、画像を同一ディレクトリに置いて、 それGFMファイル内に挿入する方法を解説。
このメモにはgitコマンドの使い方の解説はない。 このメモは随時更新される予定。
| var SCREEN_SIZE = 500; // キャンバスの幅 | |
| var SIDE_CELLS = 200; // 一辺のセルの数 | |
| var CELL_SIZE = SCREEN_SIZE / SIDE_CELLS; // セルの幅 | |
| var FPS = 10; // フレームレート | |
| var canvas; //= document.getElementById('world'); | |
| var context; //= canvas.getContext('2d'); | |
| window.onload = function() { | |
| var field = new Array(SIDE_CELLS*SIDE_CELLS); // フィールド情報 | |
| var tempField = new Array(SIDE_CELLS*SIDE_CELLS); // フィールド情報の一時記憶用 |
| // 定数 | |
| var FPS = 30; // フレームレート | |
| var SCREEN_SIZE = 500; // 画面サイズ | |
| var NUM_BOIDS = 100; // ボイドの数 | |
| var BOID_SIZE = 5; // ボイドの大きさ | |
| var MAX_SPEED = 7; // ボイドの最大速度 | |
| var canvas = document.getElementById('world'); | |
| var ctx = canvas.getContext('2d'); | |
| var boids = []; // ボイド |
| (* parameters *) | |
| (* 最大次数 *) | |
| maxOrderNum = 200; | |
| (* 画像URL, もしくはローカルパス *) | |
| imageURL = "http://nex.fm/wp-content/uploads/2012/08/vim-editor_logo.png"; | |
| pointListToLines[pointList_, neighbothoodSize_: 6] := | |
| Module[{L = DeleteDuplicates[pointList], NF, lambda, | |
| lineBag, counter, seenQ, sLB, nearest, | |
| nearest1, nextPoint, couldReverseQ, d, n, s}, |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
To use this hook:
prepare-commit-msg file at .git/hooks/prepare-commit-msg and edit as neededchmod +x .git/hooks/prepare-commit-msggit config branch.master.mergeoptions "--no-ff"NOTE: after a failed merge from a forbidden branch, the working tree will still be in a MERGING state. To discard the local working copy state, run:
git reset --merge
| /** | |
| * Retrieves all the rows in the active spreadsheet that contain data and logs the | |
| * values for each row. | |
| * For more information on using the Spreadsheet API, see | |
| * https://developers.google.com/apps-script/service_spreadsheet | |
| */ | |
| function readRows() { | |
| var sheet = SpreadsheetApp.getActiveSheet(); | |
| var rows = sheet.getDataRange(); | |
| var numRows = rows.getNumRows(); |