Skip to content

Instantly share code, notes, and snippets.

<interactive>:72:1:
No instance for (RealFrac a0) arising from a use of `split'
The type variable `a0' is ambiguous
Possible fix: add a type signature that fixes these type variable(s)
Note: there are several potential instances:
instance RealFrac Double -- Defined in `GHC.Float'
instance RealFrac Float -- Defined in `GHC.Float'
instance Integral a => RealFrac (GHC.Real.Ratio a)
-- Defined in `GHC.Real'
In the expression: split 10 10
@mtsmfm
mtsmfm / hoge.hs
Created January 8, 2014 17:10
基数変換
valList :: Int -> Int -> [Int]
valList x n = map (n^) [numDigits, (numDigits-1)..0]
where numDigits = floor $ logBase (fromIntegral n) (fromIntegral x)
convert :: Int -> Int -> [Int]
convert x n
| x < n = [x]
| otherwise = map (snd) $ tail $ scanl (\acc y -> let z = floor $ fromIntegral(fst acc) / fromIntegral(y) in ((fst acc) `mod` y, z)) (x, 0) xs
where xs = valList x n
@mtsmfm
mtsmfm / debug log
Created April 20, 2014 14:49
poltergeist with ckeditor debug log
{"name"=>"set_debug", "args"=>[true]}
{"response"=>true}
{"name"=>"visit", "args"=>["http://127.0.0.1:37796/users/new"]}
poltergeist [1398005093288] state default -> loading
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
poltergeist [1398005093702] state loading -> default
{"response"=>{"status"=>"success"}}
{"name"=>"find", "args"=>[:css, "body"]}
{"response"=>{"page_id"=>1, "ids"=>[0]}}
{"name"=>"visible", "args"=>[1, 0]}
@mtsmfm
mtsmfm / Gemfile
Last active August 29, 2015 14:07
Capybara minimal sample
source 'https://rubygems.org'
gem 'capybara'
gem 'poltergeist', require: 'capybara/poltergeist'
@mtsmfm
mtsmfm / projections.json
Created February 12, 2015 23:21
projections.json (Rails + flux)
{
"app/assets/javascripts/components/*.js.cjsx": {
"command": "jcomponent",
"template": "@{camelcase|capitalize|colons} = React.createClass\n render: ->"
},
"app/assets/javascripts/actions/*.js.coffee": {
"command": "jaction",
"template": "class @{camelcase|capitalize|colons}"
},
"app/assets/javascripts/constants/*.js.coffee": {
require 'active_support'
require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/string/strip'
params = {
title: '問題を一言で',
labels: %w(bug),
body: <<-EOS.strip_heredoc
## 出す前に確認しよう
CSON = require 'season'
ObjectAssign = require 'object-assign'
linuxCson = CSON.readFileSync('linux.cson')
darwinCson = CSON.readFileSync('darwin.cson')
obj = {}
for k1, v1 of linuxCson
obj[k1] = {}
@mtsmfm
mtsmfm / README.md
Last active October 26, 2015 07:33
ESM オフラインどう書く

行列のできるラーメン屋 ESM オフラインどう書く (2015/10/22)

オフラインリアルタイムどう書く という、 @Nabetani さん主催のイベントを模したものを ESM の社内向けに行ったものです。

出題者: @mtsmfm スペシャルサンクス: @mattsan

問題

@mtsmfm
mtsmfm / Gemfile
Last active October 23, 2015 16:36
esm_doukaku_20151022
source 'https://rubygems.org'
gem 'activesupport', require: 'active_support/all'
gem 'pry-byebug'
@mtsmfm
mtsmfm / Gemfile
Last active December 13, 2015 14:18
esm_doukaku #02 (素振り)
source "https://rubygems.org"
gem 'pry'
gem 'activesupport', require: 'active_support/all'