This file contains hidden or 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
| model : | |
| const type_one = 1; | |
| const type_two = 2; | |
| const type_three = 3; | |
| public function getType(){ | |
| return array( | |
| self::type_one => "one", | |
| self::type_two => "two", |
This file contains hidden or 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
| mode () : | |
| protected function beforeSave() | |
| { | |
| if(parent::beforeSave()) | |
| { | |
| if($this->isNewRecord) | |
| { | |
| $this->create_time=$this->update_time=time(); | |
| $this->author_id=Yii::app()->user->id; |
This file contains hidden or 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. | |
| */ | |
| var express = require('express'); | |
| var routes = require('./routes'); | |
| var fs = require("fs"); | |
| var mongoose = require('mongoose'); | |
This file contains hidden or 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
| public function validatePassword($password) | |
| { | |
| return $this->hashPassword($password)===$this->password; | |
| } | |
| public function hashPassword($password) | |
| { | |
| return md5($password); | |
| } |
This file contains hidden or 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
| show dbs | |
| // LIst Data Base | |
| show collections | |
| // List Collections | |
| use test | |
| // Select Db | |
| db |
This file contains hidden or 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 path = require('path'); | |
| path.normalize('/a/.///b/d/../c/') | |
| '/a/b/c/' | |
| // '.' for 'this directory' and '..' for 'one level up' | |
| var path = require('path'); | |
| var url = '/index.html'; | |
| path.join(process.cwd(), 'static', url); | |
| '/home/nico/static/index.html' |
This file contains hidden or 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
| fs.rename(oldPath, newPath, callback)# | |
| Asynchronous rename(2). No arguments other than a possible exception are given to the completion callback. | |
| fs.renameSync(oldPath, newPath)# | |
| Synchronous rename(2). | |
| fs.ftruncate(fd, len, callback)# | |
| Asynchronous ftruncate(2). No arguments other than a possible exception are given to the completion callback. | |
| fs.ftruncateSync(fd, len)# |
This file contains hidden or 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 fs = require("fs"); | |
| console.log("Read File ...."); | |
| var conf = JSON.parse(fs.readFileSync("config.json")); | |
| console.log("One : ", conf); | |
| fs.watchFile("config.json", function(current,previous){ | |
| console.log("File Changed ..."); | |
| var conf = JSON.parse(fs.readFileSync("config.json")); | |
| console.log("Two : " , conf); | |
| }); |
This file contains hidden or 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 http = require('http'); | |
| http.createServer(function (request, response) { | |
| response.writeHead(200, {'Content-Type': 'text/plain'}); | |
| response.end('Hello World\n'); | |
| }).listen(8124); | |
| console.log('Server running at http://127.0.0.1:8124/'); |
This file contains hidden or 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
| from kivy.app import App | |
| from kivy.uix.image import Image | |
| from kivy.uix.widget import Widget | |
| class showimage(Image): | |
| pass | |
| class MyApp(App): | |
| def build(self): |
OlderNewer