반응형
반응형

if(window.console!=undefined) console.log.bind()


<script type="text/javascript">
if(window.console!=undefined){
    setTimeout(console.log.bind(console,"%cTISTORY","font:8em Arial;color:#EC6521;font-weight:bold"),0);
    setTimeout(console.log.bind(console,"%c  나를 표현하는 블로그","font:2em sans-serif;color:#333;"),0);
}
</script>








.

반응형
반응형

Node.js, Express, MongoDB를 이용하여 REST API 만들기  http://mobicon.tistory.com/197


원문 : http://coenraets.org/blog/2012/10/creating-a-rest-api-using-node-js-express-and-mongodb/



Installing Node.js

  1. Go to http://nodejs.org, and click the Install button.
  2. Run the installer that you just downloaded. When the installer completes, a message indicates that Node was installed at /usr/local/bin/node and npm was installed at /usr/local/bin/npm.

Installing Express

Express is a lightweight node.js web application framework. It provides the basic HTTP infrastructure that makes it easy to create REST APIs.

Installing MongoDB

To install MongoDB on your specific platform, refer to the MongoDB QuickStart. Here are some quick steps to install MongoDB on a Mac:

  1. Open a terminal window and type the following command to download the latest release:

    curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.2.0.tgz > ~/Downloads/mongo.tgz

    Note: You may need to adjust the version number. 2.2.0 is the latest production version at the time of this writing.

  2. Extract the files from the mongo.tgz archive:

    cd ~/Downloads
    tar -zxvf mongo.tgz

  3. Move the mongo folder to /usr/local (or another folder according to your personal preferences):

    sudo mv -n mongodb-osx-x86_64-2.2.0/ /usr/local/

  4. (Optional) Create a symbolic link to make it easier to access:

    sudo ln -s /usr/local/mongodb-osx-x86_64-2.2.0 /usr/local/mongodb

  5. Create a folder for MongoDB’s data and set the appropriate permissions:

    sudo mkdir -p /data/db
    sudo chown `id -u` /data/db

  6. Start mongodb

    cd /usr/local/mongodb
    ./bin/mongod

  7. You can also open the MongoDB Interactive Shell in another terminal window to interact with your database using a command line interface.

    cd /usr/local/mongodb
    ./bin/mongo

    Refer to the MongoDB Interactive Shell documentation for more information.

Installing the MongoDB Driver for Node.js

There are different solutions offering different levels of abstraction to access MongoDB from Node.js (For example, Mongoose and Mongolia). A comparaison of these solutions is beyond the scope of this article. In this, guide we use the native Node.js driver.

To install the the native Node.js driver, open a terminal window, cd to your nodecellar folder, and execute the following command:

npm install mongodb







.




반응형
반응형

[jQuery] jQuery로 모바일에서 가로보기인지 세로보기인지 알아내기

jQuery orientationchange Event

 

 

 

 

 

$(window).on("orientationchange", function(event){
    if(window.matchMedia("(orientation: portrait)").matches){
        // 세로 모드 (평소 사용하는 각도)
    }else if(window.matchMedia("(orientation: landscape)").matches){
        // 가로 모드 (동영상 볼때 사용하는 각도)
    }
});

.

 

반응형
반응형

[javascript] 현재 경로를 찾아서 어느 위치인지 인식한다.

 

 

   //-- 현재 url 호출
    var now_path_nm = location.pathname;

 

  //-- 현재 url에 찾고 있는 문자가 있으면 -1 보다 큰 숫자 리턴
    var result = now_path_nm.indexOf("s");

반응형
반응형

[javascript] URL get path info , Query String



window.location.pathname + window.location.search



location.pathname+location.search








반응형
반응형

OFFLINE & STORAGE

 

[스토리지] web-storage-demo-gh-pages

 

로컬 스토리지를 이용한 예제

 

web-storage-demo

A simple demo to show usage of the Web Storage API. For more detail on how it works, read Using the Web Storage API.

View the demo online: http://mdn.github.io/web-storage-demo/

 

 

A simple demo to show usage of the Web Storage API. For more detail on how it works, read https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API

 

 

반응형

+ Recent posts