Skip to content

Instantly share code, notes, and snippets.

View jiikko's full-sized avatar
🦑

jiikko jiikko

🦑
View GitHub Profile
#!/bin/sh
find ./ -type f -name "*.html" | while read i
do
nkf -w $i > $i._backup
done
find ./ -type f -name "*._backup" | while read i
do
// coffeeだったら文字列展開できるもん
$(function(){
// 追加
// $(document)をあとでかえる
$(document).on('ajax:complete', 'a.ajax_link_add', function(data, ajax, xhr){
response = $.parseJSON(ajax.responseText);
$("#book_" + response.id).fadeOut("fast", function(){
$("#book_" + response.id).remove();
if yes?('Use Template?')
add_source('https://rails-assets.org')
gem 'rails-assets-bootstrap'
remove_file './test'
gem_group :development, :test do
gem 'pry-rails'
gem 'pry-doc'
"新しい行のインデントを現在行と同じにする
set autoindent
"バックアップファイルを作るディレクトリ
set backupdir=$HOME/vimbackup
"ファイル保存ダイアログの初期ディレクトリをバッファファイル位置に設定
set browsedir=buffer
"クリップボードをWindowsと連携
set clipboard=unnamed
"Vi互換をオフ
set nocompatible
@jiikko
jiikko / gist:11159832
Last active August 29, 2015 14:00
rspec, http mock, unko
# https://mojolingo.com/blog/2013/tests-mocks-rspec/
mock_http = double('http')
mock_response = double('response')
Net::HTTP.should_receive(:start).with(uri.host, uri.port).and_yield(mock_http)
mock_http.should_receive(:get).with("/").and_return(mock_response)
mock_response.should_receive(:code).and_return('302')
uri = URI.parse("http://google.com")
@jiikko
jiikko / gist:11166541
Last active August 29, 2015 14:00
htmlファイルサイトの書き換えを行う時に使うやつ
# coding: Shift_JIS
require "pry"
class String
def remove!(string)
gsub!(string, "")
end
end
@jiikko
jiikko / gist:11198148
Created April 22, 2014 23:42
sedがんばったやつ
#!/usr/local/bin/zsh
for file in `ls /home/dep/www/**/*.html`
do
echo $file
# hokkaido
source='<a [^>]*>北海道|宮城県|福島県</a>'
yakusus = {}
RANGE = 1000
TARGER_YAKUSU_COUNT = 5
RANGE.times do |outer_i|
yakusu_count = 0
outer_i.times do |i|
if(outer_i % (i + 1) == 0)
yakusu_count += 1
# return : [{"count"=>"7", "kana"=>"え"}, {"count"=>"7", "kana"=>"も"} .....] あ〜(濁点文字含む51要素の配列)
# 辞典の読み方カラムの頭文字で集計した結果を返す
sql = <<-EOF
select
count(kana),
substr(kana, 1, 1) as kana
from
words
where
@jiikko
jiikko / gist:78de5ac05fee28ae7e01
Last active August 29, 2015 14:03
メカクシティアクターズ
OP daze
3話 挿入歌 メカクシコード
http://www.youtube.com/watch?v=o4owr0pxdV8
4話 挿入歌 カゲロウデイズ
http://www.youtube.com/watch?v=IDMGbCOXO4U
6話
ヘッドフォンアクター