Skip to content

Instantly share code, notes, and snippets.

View furu's full-sized avatar

furu furu

View GitHub Profile

ブラウザウィンドウのスクロール位置の取得

  • Window オブジェクト
    • pageXOffset プロパティ
    • pageYOffset プロパティ
    • scrollLeft プロパティ
    • scrollTop プロパティ

ドキュメントのルート要素 document.documentElement

#!/bin/sh
set -euv
ablogcms_version=1.6.0
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y apache2
apt-get install -y mysql-client mysql-server

Ruby でファイルの拡張子ではなく、中身からそのファイルが何なのかを判別したい

  • ruby-mime-types
    • ファイルの拡張子から判別するのでだめだ
  • minad-mimemagic
    • 拡張子と中身から判別するっぽい
    • GitHub にリポジトリがなく、最終リリース日が2009年
  • mime-typer
    • file と awk を使う
  • file のラッパーみたいなもの
@furu
furu / mymaybe.hs
Last active August 29, 2015 14:27 — forked from eiel/mymaybe.hs
Haskellの夏休みの宿題。
{-# LANGUAGE MonadComprehensions #-}
import Prelude hiding (maybe)
import Control.Applicative
data MyMaybe a = MyJust a | MyNothing deriving (Show)
-- 夏休みの宿題 MyMaybeの作成。Maybeを自分で実装しよう (モナドは関係ない)
-- このファイルに書かれたテストを実行するにはdoctestを利用します。
-- * stackをつかっている場合は stack install doctest
export EDITOR="${HOME}/bin/EDITOR"
autoload -Uz edit-command-line
zle -N edit-command-line
bindkey '^xe' edit-command-line
@furu
furu / foo.hs
Created November 20, 2015 07:01
-- 継続モナドによるリソース管理
-- http://qiita.com/tanakh/items/81fc1a0d9ae0af3865cb
-- 写経していて、継続渡しスタイルのところで脱落したやつ
module Main where
import System.IO
import Control.Exception
import Control.Monad
import Foreign.Marshal.Utils
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Web.Twitter.Conduit
import Web.Authenticate.OAuth
import System.Environment
import qualified Data.ByteString.Char8 as BS
import Network.HTTP.Conduit
import Control.Monad.IO.Class
@furu
furu / Vagrantfile
Created November 25, 2015 08:52
Revive Adserver
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at