Skip to content

Instantly share code, notes, and snippets.

View amirkheirabadi73's full-sized avatar
๐Ÿ™ƒ
confused about future

Amir amirkheirabadi73

๐Ÿ™ƒ
confused about future
View GitHub Profile
@amirkheirabadi73
amirkheirabadi73 / Camre Record
Created July 11, 2013 05:40
Screenshot From Cammera
import kivy
kivy.require('1.4.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.camera import Camera
from kivy.uix.button import Button
from kivy.core.window import Window
class MyApp(App):
@amirkheirabadi73
amirkheirabadi73 / Login Screen
Created July 11, 2013 05:33
Simple Login Screen
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
class LoginScreen(GridLayout):
def __init__(self , **kwarge):
super(LoginScreen,self).__init__(**kwarge)
self.cols = 2
@amirkheirabadi73
amirkheirabadi73 / Show Image
Created July 11, 2013 05:32
Show Image In Screen
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):
@amirkheirabadi73
amirkheirabadi73 / Simple Sever http
Created July 2, 2013 06:30
Simple Sever http For Print Hello World In Screen
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/');
@amirkheirabadi73
amirkheirabadi73 / Watch File
Created July 2, 2013 06:28
Watch A File For Changes RealTime
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);
});
@amirkheirabadi73
amirkheirabadi73 / All Api FS
Created July 2, 2013 05:59
All Api For File System
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)#
@amirkheirabadi73
amirkheirabadi73 / How to use the path module?
Created July 2, 2013 05:26
FS System ... Read And Write In txt ANd Json File
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'
@amirkheirabadi73
amirkheirabadi73 / MongoDB
Created June 25, 2013 15:58
List All Command In MongoDb
show dbs
// LIst Data Base
show collections
// List Collections
use test
// Select Db
db
@amirkheirabadi73
amirkheirabadi73 / Model ...
Created June 23, 2013 12:31
User Authentication ....
public function validatePassword($password)
{
return $this->hashPassword($password)===$this->password;
}
public function hashPassword($password)
{
return md5($password);
}
@amirkheirabadi73
amirkheirabadi73 / Mongodb Cloud Data Base ( Insert ) With Mongoose
Created June 18, 2013 12:37
Monfo DB Connected With Cloud Data Base Mongo And Insert Collection To Data Base ....
/**
* Module dependencies.
*/
var express = require('express');
var routes = require('./routes');
var fs = require("fs");
var mongoose = require('mongoose');