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
| // ga登録 | |
| ga('create', 'UA-XXXX-Y'); | |
| // 現在のページへのアクセスを記録 | |
| ga('send', 'pageview'); | |
| // ページのURLをカスタムしてアクセスを記録 | |
| ga('send', 'pageview', '/toppage'); | |
| // clickがあったときにアクセスを記録 |
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
| npm -g install typescript |
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
| location / { | |
| proxy_pass http://hogehoge; | |
| allow all; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection "upgrade"; | |
| } |
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
| // テストしたいmoduleをrequire | |
| var hoge = require('../hoge'); | |
| // テスト用のライブラリをrequire (mochaの場合は、shouldがあればいいはず) | |
| var should = require('should'); | |
| // あとはテストを書くのみ | |
| describe('hoge', function () { | |
| it('足し算をする', function () { | |
| hoge.add(2, 3).should.equal(5); |
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 rgb = [128, 30, 200]; // R=128, G=30, B=200 | |
| // 0〜255の値が入っているので、255で割っておく | |
| var blightness = Math.max(rgb[0], rgb[1], rgb[2]) / 255; |
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 grant = require('grunt'); | |
| module.exports = function () { | |
| grunt.initConfig({ | |
| sample: { | |
| dev: { // 開発環境 | |
| hoge: 'hogehoge' | |
| }, | |
| prod: { // 本番環境 | |
| hoge: 'moge' |
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
| ## create emacs env file | |
| perl -wle \ | |
| 'do { print qq/(setenv "$_" "$ENV{$_}")/ if exists $ENV{$_} } for @ARGV' \ | |
| PATH > ~/.emacs.d/shellenv.el |
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
| gem 'rails', '3.2.11' | |
| gem "jquery-rails", "~> 2.0.2" | |
| gem "i18n", "~> 0.6.0" | |
| gem "coderay", "~> 1.0.6" | |
| gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] | |
| gem "builder", "3.0.0" | |
| gem "unicorn" # 追加 |
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 fs = require('fs'); | |
| var filepath = 'message.txt'; | |
| // filepathが存在しなくても、watchFileはエラーとか出してくれないので、 | |
| // 先にfs.existsで調べておく | |
| if (!fs.existsSync(filepath)) { | |
| console.error('%s doesn\'t exist.', filepath); | |
| process.exit(); | |
| } |
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
| use strict; | |
| # コマンドライン引数を、sourcecodeとする | |
| my $sourcecode = $ARGV[0]; | |
| my $char; | |
| my $stack = ""; | |
| my @tokens = []; | |
| # sourcecodeを一文字ずつ見る |