Skip to content

Instantly share code, notes, and snippets.

@koduki
koduki / wikiparser.scala
Created November 3, 2010 09:00
ParserConbinatorを使って、Wikiエンジンを書いてみる
import scala.util.parsing.combinator.Parsers
import scala.util.parsing.input.CharSequenceReader
class Document
class Inline extends Document
case class Text(s:String) extends Inline
case class Strong(t:Text) extends Inline
case class Line(l:List[Inline]) extends Document
case class Headline(t:List[Inline]) extends Document
case class Paragraph(p:List[Document]) extends Document
@koduki
koduki / gist:660897
Created November 3, 2010 09:08
wikiエンジン用のBNF
# BNF
文章 := 文 | ブロック | 文章
文 := 行 | 文
行 := {テキスト|インライン}"\n"
テキスト := %s|%S
インライン := リンク | 強調 | テキスト
ブロック := 見出し | リスト | テーブル
リンク := "[["インライン"]]"
# -*- coding: utf-8 -*-
require 'mechanize'
require 'icalendar'
class RakutenPointCalender
def initialize
@agent = WWW::Mechanize.new
@agent.user_agent_alias = 'Windows IE 7'
@cal = Icalendar::Calendar.new
今年の新卒は情報系じゃないので、抑えておくべき基礎が足りないと感じてたり。
まあ、それは当たり前なので、何かほじょりんになるほんはないかと、適当に並べてみた。
Twitter情報と自分の趣味で書いてるので、偏りはあるかも。
ちなみに、まずはWeb系のプログラマとして育てるつもりです!
基礎
Clean Code アジャイルソフトウェア達人の技
ハッカーと画家
UNIXという考え方
# ファイルタイプの設定.
:set filetype=html
package problem1978;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
package problem1978;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Main {
private static final int HEAD = 1;
@koduki
koduki / magic_mirror.groovy
Created January 4, 2011 14:26
20問題です。某ランプの魔人みたいな想像しているキャラを当てるコード
class Charactor {
String name
List<Feature> features
@Override String toString() { this.dump() }
}
class Question {
boolean exclusive
boolean answerble = true
String msg
@koduki
koduki / poilite.scala
Created January 16, 2011 08:48
POI wrapper for scala
def getValue(cell:Cell):String = {
import Cell._
import org.apache.poi.ss.usermodel.DateUtil
if (cell == null) {
""
} else {
cell.getCellType match {
case CELL_TYPE_BLANK => ""
case CELL_TYPE_STRING => cell.getStringCellValue
case CELL_TYPE_NUMERIC => if (DateUtil.isCellDateFormatted(cell)) {
/*
https://books.step.rakuten.co.jp/rms/mall/book/bs/Cart
https://books.step.rakuten.co.jp/rms/mall/book/bs/Cart?shop_bid=213310
*/
var trs = jQuery("html body div form table tbody tr td table tbody tr:has(img[alt='削除'])")
var items = trs.toArray().map(function(tr){
var item = jQuery(tr)
var name = item.find("td a").eq(1)