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
source 'https://rubygems.org' | |
gem 'rails' | |
# some gems | |
group :development, :test do | |
gem 'rspec' | |
gem 'rspec-rails' | |
gem 'pry' |
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
#!/usr/bin/env rake | |
require "bundler/gem_tasks" | |
task :default => [:spec] | |
begin | |
require 'rspec/core/rake_task' | |
RSpec::Core::RakeTask.new(:spec) do |spec| | |
spec.pattern = 'spec/**/*_spec.rb' | |
spec.rspec_opts = ['-cfs'] # ← ココ!! | |
end |
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
(function($, window) { | |
var LocalList = function() { | |
this.localListKey = ""; | |
}; | |
$.extend(LocalList.prototype, { | |
add: function(obj) { | |
var data = JSON.parse(localStorage.getItem(this.localListKey)); | |
data.push(obj); | |
localStorage.setItem(this.localListKey, JSON.stringify(data)); |
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
private void addCommentToCell(Cell cell, String content) { | |
Sheet sheet = cell.getSheet(); | |
Workbook book = sheet.getWorkbook(); | |
Drawing drawing = sheet.createDrawingPatriarch(); | |
// サイズは適当 | |
ClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 1, 1, 4, 4); | |
Comment comment = drawing.createCellComment(anchor); | |
comment.setString(book.getCreationHelper().createRichTextString(content)); | |
cell.setCellComment(comment); | |
} |
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
# Wiki | |
## テスト | |
### リスト | |
* foo | |
* bar | |
* baz | |
* bazbaz |
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
import org.apache.commons.io.IOUtils; | |
BufferedInputStream bis = null; | |
BufferedOutputStream bos = null; | |
try { | |
bis = new BufferedInputStream(new FileInputStream(file)); | |
File newFile = new File("/path/to/dest_dir/" + file.getName()); | |
newFile.createNewFile(); | |
bos = new BufferedOutputStream(new FileOutputStream(newFile)); | |
IOUtils.copyLarge(bis, bos); |
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
function uploadFiles(files) { | |
var fileListHtml = '<ul>'; | |
// for (var i = 0; i < files.length; i++) では、error, success 時の liId が束縛されず最後の値となる | |
// files は FileList を想定しており、FileList#forEach は存在しないのでこのような書き方となる | |
[].forEach.call(files, function(file, idx, list) { | |
var liId = 'file_' + idx; | |
fileListHtml += '<li id="' + liId + '">' + file.name + '</li>'; | |
var formData = new FormData(); | |
formData.append('file', file); | |
j$.ajax('<@f.path uri="upload" />', { |
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
if (window.File) { | |
$("#fileDrop").on('dragenter', function (e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
j$(this).addClass('fileOver'); | |
}).on('dragover', function (e) { | |
e.stopPropagation(); | |
e.preventDefault(); | |
}).on('drop', function (e) { | |
$(this).removeClass('fileOver'); |
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
# 重複を取り除いてソートする | |
:sort u | |
# ページ送り | |
C-f | |
C-b |
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
# 先頭行取得 | |
cat large_file.txt | head -1 | tail -1 | |
# ランダム取得(0から32767) | |
cat large_file.txt | head -$RANDOM | | tail -1 | |
# 複数行取得(1000行目までの10行) | |
cat large_file.txt | head -1000 | tail -10 | |
# 最終行取得 |