Skip to content

Instantly share code, notes, and snippets.

View sonha's full-sized avatar

Simon sonha

  • Ha Noi
View GitHub Profile
@sonha
sonha / react_onclick.js
Last active December 29, 2016 03:51
React Training Unit 2
import React from 'react';
import ReactDOM from 'react-dom';
// import App from './App';
import './index.css';
function myFunc () {
alert('Make myFunc the pFunc... omg that was horrible i am so sorry');
}
function makeDoggy (e) {
// Call this extremely useful function on an <img>.
@sonha
sonha / react_img.js
Last active December 29, 2016 03:26
React Training Unit 1
import React from 'react';
import ReactDOM from 'react-dom';
var link = 'https://s3.amazonaws.com/heykorean.image.public/common/SNS/2015/12/24/2OrHTw1ST8A.png';
var url = (<img src={link} />);
//root la Dom goc
ReactDOM.render(url, document.getElementById('root'));
@sonha
sonha / Product.php
Created December 19, 2016 10:26 — forked from amacgregor/Product.php
Example Product class for using setter injection.
<?php
class Product {
private $stockItem;
private $sku;
public function __construct($sku){
$this->sku = $sku;
}
@sonha
sonha / di_example_ver1.php
Created December 9, 2016 02:22
Dependency Injection Example
<?php
/**
* TODO : Codeto Training PHP
* @author : SonHA (hason61vn@gmail.com)
*/
class Person {
private $skills;
public function __construct($skill) {
$this->skills = $skill;
}
@sonha
sonha / di_example.php
Last active December 9, 2016 02:20
Dependency Injection Example
<?php
/**
* TODO : Codeto Training PHP
* @author : SonHA (hason61vn@gmail.com)
*/
class Person {
private $skills;
public function __construct() {
$this->skills = array("PHP", "HTML", "CSS", "JavaScript", "Marketing", "SEO");
}
@sonha
sonha / User.php
Created August 16, 2016 14:46
User.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller {
public function index()
{
if($_SESSION['username'] == 'cuong' && $_SESSION['password'] == '123456') {
$this->load->view('user/list_user');
} else {
@sonha
sonha / login.php
Created August 16, 2016 14:46
Login.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login Form</title>
</head>
<body>
<h1>Login Form</h1>
<?php echo validation_errors(); ?>
<?php echo form_open('user/login'); ?>
@sonha
sonha / demosql.sql
Created August 9, 2016 07:38
demosql
/*
Navicat MySQL Data Transfer
Source Server : SonHA
Source Server Version : 50539
Source Host : localhost:3306
Source Database : php_mvc
Target Server Type : MYSQL
Target Server Version : 50539
File Encoding : 65001
Date: 2015-12-30 16:48:19
@sonha
sonha / show.php
Created August 9, 2016 07:37
Post show
<p>This is the requested post:</p>
<p><?php echo $post->author; ?></p>
<p><?php echo $post->content; ?></p>
@sonha
sonha / index.php
Created August 9, 2016 07:36
Post index
<p>Here is a list of all posts:</p>
<?php foreach($posts as $post) { ?>
<p>
<?php echo $post->author; ?>
<a href='?controller=posts&action=show&id=<?php echo $post->id; ?>'>See content</a>
</p>
<?php } ?>