Skip to content

Instantly share code, notes, and snippets.

View 59naga's full-sized avatar
🏠
Working from home

Hiroyuki Usui 59naga

🏠
Working from home
  • Japan/Tokyo(JST)
View GitHub Profile
@tily
tily / scaling_isomorphic_javascript_code.ja.markdown
Last active May 1, 2023 09:03
サバクラ両方で動く JavaScript の大規模開発を行うために

サバクラ両方で動く JavaScript の大規模開発を行うために

原文:Scaling Isomorphic Javascript Code (This is just for study, please contact me at tily05 atmark gmail.com if any problem.)

考えてみれば Model-View-Controller とか MVC ってよく聞くよね。実際どんなものか知ってる? 抽象的に言うなら「オブジェクト情報の保持されるグラフィック・システム (つまり、ラスターではないグラフィック。ゲームとか) 上に構築された、表示系を中心としたアプリケーションにおいて、主要な機能どうしの関わりをうまく分離すること」とでも言おうか。もう少し深く考えを押し進めてみれば、これは当然、他のさまざまなアプリケーションにもあてはまる言葉 (bucket term ?) だ。

過去に多くの開発コミュニティが MVC による解決案を提供し、それによってよくあるユースケースにうまく対処し、地位を築くことができた。例をあげるなら、Ruby や Python コミュニティは Rails や Django を作り、MVC アーキテクチャを実現した。

var io = require('socket.io').listen(3000);
var RedisStore = require('socket.io/lib/stores/redis');
opts = {host:'xxx.xxx.xxx.xxx', port:6379};
io.set('store', new RedisStore({redisPub:opts, redisSub:opts, redisClient:opts}));
io.sockets.on('connection', function (socket) {
socket.emit('info', { msg: 'welcome' });
socket.on('msg', function (msg) {
io.sockets.emit('msg', {msg: msg});
@mohayonao
mohayonao / 00.md
Last active July 23, 2018 13:49
CoffeeCollider勉強会用の資料 http://goo.gl/Z2JmZ2

IDE

http://mohayonao.github.io/CoffeeCollider/

  • "Run" でコードを実行
  • "Stop" で停止
  • "Link" でコードをリンク化 (保存)
  • "Compile" コンパイル後のコード(JavaScript)を表示

IDEの機能

  • サンプルコード読み込み
@mohayonao
mohayonao / README.md
Created December 20, 2013 21:48
CoffeeCollider勉強会(2013.12.20)用のスライド
@demouth
demouth / boom.sh
Created February 11, 2014 17:30
爆発しろ!という気持ちを鎮める為のシェル。 このシェルを叩くとランダムで生成された爆発のアニメーションが描画されます。
#!/bin/bash
#2つの引数の間の数値をランダムで返す
#第一引数の方がより小さな値を渡すこと
function rand() {
range=$(($1 - $2))
ret=$((RANDOM % range + $1))
echo $ret
}
FROM centos
MAINTAINER hatena@iti.co.jp
ENV http_proxy http://proxy.example.com
ENV https_proxy http://proxy.example.com
RUN yum update -y
RUN yum install -y openssh-server httpd php php-mbstring mysql-server php-mysql python-setuptools
RUN yum clean all
RUN easy_install supervisor
<?php
var_dump(get_defined_constants());
var_dump(get_declared_classes());
var_dump(get_declared_interfaces());
var_dump(get_declared_traits());
var_dump(get_defined_functions());
var_dump(get_defined_vars());
var_dump(get_included_files());
var_dump(get_required_files());
var_dump(get_loaded_extensions());
@mlynch
mlynch / autofocus.js
Last active August 24, 2022 15:03
AngularJS Autofocus directive
/**
* the HTML5 autofocus property can be finicky when it comes to dynamically loaded
* templates and such with AngularJS. Use this simple directive to
* tame this beast once and for all.
*
* Usage:
* <input type="text" autofocus>
*
* License: MIT
*/
@niwaringo
niwaringo / karma.conf.js
Last active August 29, 2015 14:15
Karmaを使ってSauceLabsの同時接続上限にかからないようにテストを実行する。
module.exports = function(config) {
var customLaunchers = require('./saucebrowsers.js');
config.set({
basePath: '',
frameworks: ['mocha', 'browserify'],
files: [./**/*.js],
exclude: [],
preprocessors: {},
port: 9876,
colors: true,
@jcollado
jcollado / email.js
Last active April 3, 2024 15:21
Send email with nodemailer and AWS SES (API or STMP)
var nodemailer = require('nodemailer');
var sesTransport = require('nodemailer-ses-transport');
var smtpPassword = require('aws-smtp-credentials');
var mailOptions = {
from: 'from@example.com',
to: 'to@example.com',
text: 'This is some text',
html: '<b>This is some HTML</b>',
};