This file contains 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
require 'benchmark' | |
require 'yaml' | |
require 'rubygems' | |
require 'bundler' | |
Bundler.require(:default) | |
require 'active_support' | |
def token | |
[Array.new(24) { rand(256).chr }.join].pack('m*').chop | |
end |
This file contains 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
require 'test_helper' | |
class ItemTest < ActiveSupport::TestCase | |
context 'with boundary value attributes' do | |
test 'an item with boundary value attributes is valid' do | |
assert build(:item_with_boundary_value_attributes).valid? | |
end | |
test 'db allows saving an item with boundary value attributes' do | |
assert build(:item_with_boundary_value_attributes).save |
This file contains 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
class CreateFoos < ActiveRecord::Migration | |
def change | |
create_table :foos do |t| | |
t.string :bar, null: false | |
t.timestamps | |
end | |
add_index :foos, :bar, unique: true | |
end | |
end |
This file contains 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
require 'tmpdir' | |
class MovieImporter | |
def initialize(src) | |
@src = src | |
end | |
def self.import(src) | |
MovieImporter.new(src).run | |
end |
This file contains 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
#include <stdio.h> | |
#include <stdlib.h> | |
#define GB 1073741824 | |
int main() | |
{ | |
char *p; | |
int i = 0; |
This file contains 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 Passingloop where | |
import Char | |
wrapJoin :: Int -> (String, Int) -> (String, Int) -> (String, Int) | |
wrapJoin n (str, lineLength) (word, length) | |
| lineLength + length < n = (str ++ " " ++ word, lineLength + length) | |
| otherwise = (str ++ "\n" ++ word, length) | |
wrap :: Int -> String -> String | |
wrap n str = fst $ foldl1 (wrapJoin n) [ (w, length w) | w <- words str] |
This file contains 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
% -*- mode: prolog; -*- | |
valid([]). | |
valid([Head|Tail]) :- | |
fd_all_different(Head), | |
valid(Tail). | |
sudoku(Puzzle, Solution) :- | |
length(Puzzle, 16), | |
sudoku4(Puzzle, Solution). |
This file contains 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
(ns passingloop.sleepy_barber) | |
(def rnd (new java.util.Random)) | |
(defn rush [_ chairs] | |
(do | |
(Thread/sleep (+ 10 (. rnd nextInt 20))) | |
(. chairs offer :customer) | |
(recur :dummy chairs))) | |
(defn haircut [_ chairs counter] | |
(do |
This file contains 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
--- SKK-CFG.orig 2010-09-05 11:26:01.000000000 +0900 | |
+++ SKK-CFG 2010-10-08 21:34:35.000000000 +0900 | |
@@ -155,3 +155,11 @@ | |
;; http://homepage.mac.com/zenitani/emacs-j.html | |
+(setq APEL_DIR "~/.emacs.d/elisp/apel") | |
+(setq EMU_DIR "~/.emacs.d/elisp/emu") | |
+(setq SKK_DATADIR "~/.emacs.d/etc/skk") | |
+(setq SKK_INFODIR "~/.emacs.d/info") | |
+(setq SKK_LISPDIR "~/.emacs.d/elisp/skk") |
This file contains 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
[{sasl, [ | |
{sasl_error_logger, {file, "/var/tmp/elog"}} | |
]}]. |
NewerOlder