This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### ------- Module dependencies. --------- ### | |
# webアプリの起動に必要なモジュール | |
express = require 'express' | |
cluster = require 'cluster' | |
sessionstore = require('session-mongoose')(express) | |
app = express() | |
### ------- Class ------------------------ ### | |
class AppConfig | |
setViewEngine : (app, express) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### ------- Module dependencies. ------ ### | |
# Webアプリの立ち上げに必要なモジュール | |
express = require 'express' | |
cluster = require 'cluster' | |
app = express() | |
### ------- Class. -------------------- ### | |
class AppConfig | |
setViewEngine : (app, express) -> | |
app.engine(@template_name, @template) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install | |
sudo touch /etc/yum.repos.d/nginx.repo | |
sudo sh -c "cat << 'EOF' > /etc/yum.repos.d/nginx.repo | |
[nginx] | |
name=nginx repo | |
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/ | |
gpgcheck=0 | |
enabled=1 | |
EOF" | |
sudo yum update -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# クライアントからは以下のようにして接続 | |
# nats://user:password@localhost:4242 | |
port: 4242 | |
authorization { | |
user: user | |
password: password | |
} | |
# クラスタの設定 | |
cluster { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https = require 'https' | |
async = require 'async' | |
global = { | |
url: 'https://api.amebaowndme.com/v2/public/blogPosts?limit=200&page=&siteId=11014&sortType=recent' | |
} | |
requestURL = (callback) => | |
req = https.get global.url, (res) -> | |
@res = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require("mongoose"); | |
var DBName = ""; | |
M.prototype.connection = mongoose.createConnection("mongodb://127.0.0.1/" + DBName, callback); | |
var database = M.connection.db | |
var collection = database.collection("datas"); | |
// keys (object), condition (object), initial (object), reduce (function), finalize (function), [options] (object), callback | |
collection.group({"id":true}, null, {}, function (curr, result) { | |
result._id = curr._id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main(void) | |
{ | |
int num; | |
char c; | |
printf("乱数の範囲を指定して下さい:"); | |
scanf("%d", &num); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = (SessionConfig, app, express) -> | |
sio = require "socket.io" | |
# Session Class | |
Session = express.session.Session | |
# sessionStore | |
# new RedisStore() | |
sessionStore = SessionConfig.getSessionStore().store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#define NUM_LEN (100) | |
int main(void) | |
{ | |
int i; | |
int count; | |
char num[NUM_LEN]; |