Skip to content

Instantly share code, notes, and snippets.

View nomnel's full-sized avatar

nomnel nomnel

View GitHub Profile
@nomnel
nomnel / zenra.rb
Created March 14, 2012 04:05
全裸で学ぶMVC(ruby+Sinatra)
# coding: utf-8
require 'rubygems'
require 'sinatra'
require 'open-uri'
require 'rexml/document'
helpers do
include Rack::Utils; alias_method :h, :escape_html
end
@nomnel
nomnel / pe-downloader.scm
Created June 21, 2012 17:14
Project Eulerの問題をDLして1つのhtmlファイルにまとめるやつ。マルチスレッドじゃないので遅いです
#!/usr/local/bin/gosh
(add-load-path "." :relative)
(use gauche.parseopt)
(use file.util)
(use rfc.http)
(use sxml.sxpath)
(load "htmlprag.scm")
(define SERVER "projecteuler.net")
@nomnel
nomnel / Nqueen.scm
Created July 5, 2012 12:28
一般のNに対してN-queen問題を解くやつ
; (N-queen 7 '((2 3) (4 6))) => ((7 7) (6 2) (5 4) (3 1) (1 5) (2 3) (4 6))
(define (N-queen N ini-points)
(define (delete-l lst target)
(if (null? lst) target
(delete-l (cdr lst) (delete (car lst) target))))
(define (ok? x y his)
(let loop ((his his))
(cond ((null? his) #t)
((= (abs (- x (caar his)))
(abs (- y (cadar his))))
@nomnel
nomnel / recipe.html
Last active December 14, 2015 07:59 — forked from machida/html_practice.html
フィヨルドインターンシップ、HTML課題(プログラマー・デザイナー共通チュートリアル)
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="description" content="誰でもできる、美味しいカレーの作り方です。">
<title>カレーのレシピ</title>
</head>
<body>
<h1>カレーのレシピ</h1>
@nomnel
nomnel / style.css
Last active December 14, 2015 09:09
途中経過のメモ
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@nomnel
nomnel / 1.rb
Last active December 15, 2015 02:08
[プログラミング入門 - Rubyを使って -](http://www.ie.u-ryukyu.ac.jp/~kono/software/s04/tutorial/)の練習問題
puts "1年は#{365 * 24}時間です"
puts "10年間は#{60 * 24 * 365 * 10}分です"
puts "生まれてから#{Time.new - Time.mktime(1986, 1, 1)}秒経っている"
puts "80年生きるとして、#{(80 * 365) / 7}枚ぐらいかな"
puts "10億3400万秒生きてるとしたら#{1034000000 / 60 / 60 / 24 / 365}歳"
#header
.app_nav
ul
li
a
&.pressed
color: $red
&.disable
opacity: .3
try_go = (obj, func) ->
moved = false
console.log 'start'
$(window).on 'unload', ->
moved = true
console.log 'unload'
func()
@nomnel
nomnel / html2md.scm
Created March 27, 2013 16:34
カレントディレクトリ内のhtmlファイルからmarkdownファイルを作成するシェルスクリプトファイルを作る。 pandoc 1.11.1 Gauche 0.9.3.3
(use file.util)
(let1 html-files (filter (^f (string=? "html" (cadr (string-split f "."))))
(directory-list (current-directory)))
(call-with-output-file "script.sh"
(^p (dolist (f html-files)
(display (string-append "pandoc -f html -t markdown_github "
f " -o "
(string-append (car (string-split f ".")) ".md"))
p)
module ApplicationHelper
def title(page_title)
content_for(:title) {page_title}
page_title
end
end