Skip to content

Instantly share code, notes, and snippets.

var requireAsync = require('./require-async.js');
// デカいモジュールを先読みしておく
var modulePromise = requireAsync('name');
// モジュールの読み込みを待たずに実行される。
console.log('foo');
modulePromise.then(function(largeModule){
// 読み込み完了次第実行される
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@philopon
philopon / get-latest-newrelic-agent.sh
Last active August 30, 2015 08:26
get-latest-newrelic-agent.sh
#!/bin/bash
BASE=http://download.newrelic.com/agent_sdk
FILE=`curl -L $BASE | sed -e '/<\/a>/ !d; s/.*<a *href="\(.*\)">.*/\1/g; /tar\.gz/ !d' | sort | tail -n 1`
curl -LO $BASE/$FILE
echo $FILE
@philopon
philopon / gist:fcb1729b48927f433103
Last active August 29, 2015 14:23
ちょっと証明
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
-- 参考:
-- https://hackage.haskell.org/package/type-natural-0.2.3.2
-- http://yosh.hateblo.jp/entry/20091023/p2
@philopon
philopon / foo.js
Last active August 29, 2015 14:17
// data Maybe a = Just a | Nothing
var Maybe = function(){}
// type: reserved keyword in haskell
Maybe.type = {
Just: function(_0){this._0 = _0;},
Nothing: function(){}
}
@philopon
philopon / Measuring.hs
Created March 4, 2015 18:38
measure-text.hs
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
module Measuring
( Engine
, FTError(..)
, createEngine
, measureText
) where
@philopon
philopon / download-latest-purescript.sh
Last active August 29, 2015 14:15
download-latest-purescript.sh
#!/usr/bin/env bash
LATEST='https://github.com/purescript/purescript/releases/latest'
VERSION=`curl -is $LATEST | grep ^Location | sed 's/^.*\///' | tr -d "\r"`
echo purescript $VERSION
DOWNLOAD="https://github.com/purescript/purescript/releases/download/$VERSION"
SHA_FILE="$DOWNLOAD/linux64.sha"
@philopon
philopon / tree.hs
Last active August 29, 2015 14:14
tree
data Dir = L | R
data Tree
= Branch !Dir !Any !Tree !Tree
| Tip
cons :: Any -> Tree -> Tree
cons v Tip = Branch L v Tip Tip
cons v (Branch _ a Tip Tip) = Branch R v (Branch L a Tip Tip) Tip
cons v (Branch _ a l Tip) = Branch L v l (Branch L a Tip Tip)
module Test where
foreign import data A :: *
foreign import data C :: *
foreign import data B :: *
newtype Test (a :: #*) = Test String
a :: Test (a :: A)
a = Test "neko"
@philopon
philopon / 2014.md
Last active August 29, 2015 14:12
title date tags
2014年のふりかえり
2014-12-31 23:59:59 UTC
Haskell, PureScript, Elm

成果物

Haskell