Skip to content

Instantly share code, notes, and snippets.

@seka
seka / app.coffee
Created Jun 25, 2013
configure class pattern 1
View app.coffee
### ------- Module dependencies. ------ ###
# Webアプリの立ち上げに必要なモジュール
express = require 'express'
cluster = require 'cluster'
app = express()
### ------- Class. -------------------- ###
class AppConfig
setViewEngine : (app, express) ->
app.engine(@template_name, @template)
@seka
seka / app.coffee
Created Jun 25, 2013
configure class pattern 2
View app.coffee
### ------- Module dependencies. --------- ###
# webアプリの起動に必要なモジュール
express = require 'express'
cluster = require 'cluster'
sessionstore = require('session-mongoose')(express)
app = express()
### ------- Class ------------------------ ###
class AppConfig
setViewEngine : (app, express) ->
View 10000: HelloWorld.c
#include <stdio.h>
int main(void)
{
printf("Hello World\n");
return (0);
}
@seka
seka / SocketServerMongoMemoryStore.coffee
Created Nov 30, 2013
Node.jsのメモリーストアをmongoDBに設定した後に、Socket.io側からアクセスしたくて 色々調べてもよく分からなかったので、自分で実装してみた.(mongooseを使ったのは甘え)
View SocketServerMongoMemoryStore.coffee
exports.SocketServerClass = class SocketServerClass
_sioListenPort = 8080
constructor : (@app, @node_modules, @appOption) ->
@sio = @node_modules.sio
@http = @node_modules.http
@appServer = @http.createServer(@app)
setup : () ->
# socketioの起動
@seka
seka / SocketServerMongoMemoryStore2.coffee
Created Dec 1, 2013
SocketServerMongoMemoryStore.coffee を書きなおして一つのクラスにしてみた.
View SocketServerMongoMemoryStore2.coffee
exports.SocketServerClass = class SocketServerClass
_sioListenPort = 8080
constructor : (@app, @node_modules, @appOption) ->
@sio = @node_modules.sio
@http = @node_modules.http
@appServer = @http.createServer(@app)
# session --------------------
@mongoose = require 'mongoose'
View RomaNumber
#include <stdio.h>
#include <string.h>
#define NUM_LEN (100)
int main(void)
{
int i;
int count;
char num[NUM_LEN];
@seka
seka / SocketServerRedis.coffee
Created May 1, 2014
Node.jsのメモリーストアをredisにする場合のsocket.ioとのセッションの共有
View SocketServerRedis.coffee
module.exports = (SessionConfig, app, express) ->
sio = require "socket.io"
# Session Class
Session = express.session.Session
# sessionStore
# new RedisStore()
sessionStore = SessionConfig.getSessionStore().store
@seka
seka / ScrollViewController.swift
Last active Aug 16, 2016
views infinite scrolling - 擬似的な無限スクロールを実装
View ScrollViewController.swift
//
// ScrollViewController.swift
// ScrollView
//
// Created by PxP_ss on 2014/10/08.
// Copyright (c) 2014年 pxp_ss. All rights reserved.
//
import UIKit
@seka
seka / setupAssetMovieContents.swift
Created Oct 31, 2014
AssetLibraryから動画を再生する際の設定 - Setup when playing a video from AssetLibrary (サンプル - Sample)
View setupAssetMovieContents.swift
func setupAssetMovieContents() {
let file = NSURL(string: "assets-library:// ~ hogehuga ~ ")
let assetLibrary = ALAssetsLibrary()
assetLibrary.assetForURL(
file
, resultBlock: {
(asset: ALAsset!) in
if asset != nil {
let rep: ALAssetRepresentation = asset.defaultRepresentation()
@seka
seka / ThemeColorPicker.swift
Last active May 23, 2017
カラーピッカー的なものを作ってみた
View ThemeColorPicker.swift
//
// ThemeColorPicker.swift
//
// Created by PxP_ss on 2014/11/05.
// Copyright (c) 2014年 pxp_ss. All rights reserved.
//
import UIKit
protocol ThemeColorPickerDelegate {