Skip to content

Instantly share code, notes, and snippets.

View vitqst's full-sized avatar
🎯
Focusing

vitqst

🎯
Focusing
View GitHub Profile
set mypath=%~dp0
if not exist "%mypath%AI" mkdir "%mypath%AI"
if not exist "%mypath%IMAGES" mkdir "%mypath%IMAGES"
if not exist "%mypath%ICON" mkdir "%mypath%ICON"
if not exist "%mypath%PSD" mkdir "%mypath%PSD"
if not exist "%mypath%DOC" mkdir "%mypath%DOC"
if not exist "%mypath%VIDEO" mkdir "%mypath%VIDEO"
if not exist "%mypath%RAR" mkdir "%mypath%RAR"
#connect to postgres
import psycopg2
try:
conn = psycopg2.connect("dbname='databasename' user='user_name' host='localhost' password='pass'")
except:
print ("I am unable to connect to the database")
cur = conn.cursor()
cur.execute("SELECT * FROM table") #query
from random import randint
board = []
for x in range(5):
board.append(["O"] * 5)
def print_board(board):
for row in board:
print " ".join(row)
@vitqst
vitqst / student.py
Last active December 7, 2015 14:46
lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, 98.0, 100.0],
"quizzes": [82.0, 83.0, 91.0],
// CI_Controller.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$this->home() ;
}
public function home(){
<?php
class Model{
public $string;
public function __construct(){
$this->string = "Hello world" ;
}
}
class View{
private $model ;
private $controller ;
@vitqst
vitqst / MCV PHP
Last active November 24, 2015 14:29
+ ADMIN
- controller
- model
- view
+ public
- css
- js
- template
- admin
- site
/* CSS Document */
@charset "utf-8";
#container, .row {
width: 100%;
float: left;
color: #fff;
font-size: 30px;
}
.wrap {
max-width: 960px;
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!--thẻ meta bắt buộc phải có trong project responsive-->
<title>Sichiblog - Tạo 1 trang web responsive đơn giản</title>
<link rel="stylesheet" type="text/css" href="default.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<?php
include_once 'dbconfig.php';
if($_POST['type_top'])
{
$type_top=$_POST['type_top'];
$query = "SELECT * FROM type_child WHERE type_top='$type_top'" ;
$result = mysqli_query($connection,$query) ;
?>
<option selected="selected">Select State :</option>
<?php