Skip to content

Instantly share code, notes, and snippets.

@makoto
makoto / index.html
Created December 8, 2012 19:48
Real Time Update using setInterval
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo by makoto</title>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<link rel="stylesheet" type="text/css" href="/css/normalize.css">
# How to echobot with XMPP, BOSH, and Strophe
1. Setup ejabberd(http://www.ejabberd.im/) server and setup account admin@localhost.local
NOTE: localhost should be enough. If you setup something else, make sure you add it at /etc/hosts like this
#/etc/hosts
127.0.0.1 localhost.local
NOTE: Also download Psi(http://psi-im.org/), and make sure you can connect to your ejabberd server.
2. Download strophe(http://code.stanziq.com/strophe/) and place it (eg: /Users/makoto/work/sample/strophejs-1.0)
@makoto
makoto / real_world_druby.md
Created November 19, 2011 15:13 — forked from seki/real_world_druby.md
実世界でのdRubyの使用例

実世界でのdRubyの使用例

dRubyはこれまでに多くの大規模システムの基盤として利用されてきました。dRubyはいつものRubyプログラミングに非常に近い感覚で分散オブジェクトを実現します。これにより、複雑な分散システムであってもアイデアをすぐに実現することができます。 dRubyが提供するのは汎用のRMIです。スケッチの段階でdRubyを用い、有用性を確認したのちに用途に特化したミドルウェアに置き換えるといったように成長していったシステムも多いようです。 以下に実世界でのdRubyの使用例を示します。

Hatena Screen Shot (http://www.hatena.ne.jp/)

Hatena は日本を代表するインターネットカンパニーで、ブログ、ソーシャルブックマークサービスなどを提供しています。2006年当時(現在はサービス終了) Hatena Screen Shotという、登録されたURLのスクリーンショットをサムネイルとして表示するサービスがありました。このサービスのアーキテクチャーのユニークな点にWebフロントエンドはLinux上に構築されているが、スクリーンショットの撮影はWindowsのIEコンポーネントを用いて実現されていることにある。これはWindows環境の方がスクリーンショットを撮影できる環境が整っていたためであるが、クロスプラットフォーム間のシステムを協調させるdRubyを使った良い例といえよう。またスクリーンショットマシーンは並列処理が行われていたため、スケーラビリティも確保されていた。

@makoto
makoto / contracts...4_TestCustomError .sol
Created May 4, 2022 22:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
error ErrorWithNoParams();
error ErrorWithParams(int x, string errorMessage);
contract TestCustomError {
address payable owner = payable(msg.sender);
function CustomErrorWithParamsView(int _x) external pure {
@makoto
makoto / contracts...4_TestCustomError .sol
Created May 4, 2022 22:13
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.4;
error ErrorWithNoParams();
error ErrorWithParams(int x, string errorMessage);
contract TestCustomError {
address payable owner = payable(msg.sender);
function CustomErrorNoParams() public {
revert ErrorWithNoParams();
@makoto
makoto / gist:4018340
Created November 5, 2012 17:05 — forked from seki/gist:4010665
dRubyConf draft

dRubyConf 2012 参戦日記

こんにちは。「RubyConf参加支援企画プログラム」に採択していただき、デンバーまで行ってきた井上といいます。

今回は私がアメリカのカンファレンスで発表するまでの道のりと、dRubyの作者である関将俊さん(以下「咳」さん)と一緒に聞いてきた他のトークの概要を紹介していきたいと思います。

ちなみに私たちはdRubyに関連するような並列、並行プログラミングやデータベースのトークを中心に参加したので、このカンファレンスは「dRubyConference」という視点で見ていきます。

応募するまでの道のり

@makoto
makoto / index.js
Last active December 23, 2020 17:40
const Web3 = require('web3')
const Web3Legacy = require('web3legacy')
console.log('web3 version', (new Web3()).version)
console.log('web3 legacy version', (new Web3Legacy()).version)
// Do "export INFURA_PROJECT_ID=YOURPROJECTID" on your terminal
const projectid = process.env.INFURA_PROJECT_ID
const endpoint = 'https://mainnet.infura.io/v3/' + projectid
const provider = new Web3.providers.HttpProvider(endpoint)
const legacyProvider = new Web3Legacy.providers.HttpProvider(endpoint)
const web3 = new Web3(provider)
var packet = require('dns-packet')
var axios = require('axios')
let buf = packet.encode({
type: 'query',
id: 1,
flags: packet.RECURSION_DESIRED,
questions: [{
type: 'TXT',
class: 'IN',
@makoto
makoto / index.js
Last active March 27, 2019 22:16
contenthash
const namehash = require('eth-ens-namehash').hash
document.querySelector('input').value = 'matoken.eth'
window.namehash = namehash
var sayHello = function(){
var name = document.querySelector('input').value
console.log(namehash(name))
}