Skip to content

Instantly share code, notes, and snippets.

krissanawat101 krissnawat

Block or report user

Report or block krissnawat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@krissnawat
krissnawat / upgradephp7.sh
Last active Sep 15, 2018
upgrade php 7 for c9.io
View upgradephp7.sh
sudo add-apt-repository ppa:ondrej/php -y ; sudo apt-get update -y ; sudo apt-get install php7.2-curl php7.2-cli
php7.2-dev php7.2-gd php7.2-mbstring php7.2-dom php7.2-intl php7.2-mcrypt php7.2-json php7.2-mysql php7.2-opcache php7.2-bcmath php7.2-mbstring
php7.2-dom php7.2-curl php7.2-mysqli php7.2- php7.2-soap php7.2-xml php7.2-zip -y ;
sudo mv /etc/apache2/envvars /etc/apache2/envvars.bak ; sudo apt-get remove libapache2-mod-php5 -y ;
sudo apt-get install libapache2-mod-php7.2 -y ; sudo cp /etc/apache2/envvars.bak /etc/apache2/envvars; composer install ;
php artisan key:generate ; php artisan migrate --seed
View gist:6524d58b65087f13aca93e82d27a1dd0
cd .. ; gem install rails ; sudo apt-get update ; sudo apt-get install imagemagick ; rails new rails5 ; mv workspace workspace.bck ; mkdir workspace ; cd rails5 ; cp -r * ../workspace ; cd.. ; cd workspace ; bundle install ;
View aws cloud9 upgrade php7.2 for laravel
yum add-apt-repository ppa:ondrej/php -y ; yum apt-get update -y ; yum apt-get install php7.2-curl php7.2-cli php7.2-dev php7.2-gd php7.2-mbstring php7.2-dom php7.2-intl php7.2-mcrypt php7.2-json php7.2-mysql php7.2-opcache php7.2-bcmath php7.2-mbstring php7.2-dom php7.2-curl php7.2-mysqli php7.2- php7.2-soap php7.2-xml php7.2-zip -y ; yum mv /etc/apache2/envvars /etc/apache2/envvars.bak ; yum apt-get remove libapache2-mod-php5 -y ;yum apt-get install libapache2-mod-php7.2 -y ; yum cp /etc/apache2/envvars.bak /etc/apache2/envvars; composer create-project laravel/laravel ; php artisan key:generate
@krissnawat
krissnawat / Article.js
Created Feb 3, 2019
medium-clone-on-node/server/models/Article.js
View Article.js
const mongoose = require('mongoose')
let ArticleSchema = new mongoose.Schema(
{
text: String,
title: String,
description: String,
feature_img: String,
claps: Number,
author: {
View User.js
const mongoose = require('mongoose')
let UserSchema = new mongoose.Schema(
{
name: String,
email: String,
provider: String,
provider_id: String,
token: String,
provider_pic: String,
View User.js
const mongoose = require('mongoose')
let UserSchema = new mongoose.Schema(
{
name: String,
email: String,
provider: String,
provider_id: String,
token: String,
provider_pic: String,
View Article.ctrl.js
/** */
const Article = require('./../models/Article')
const User = require('./../models/User')
const fs = require('fs')
const cloudinary = require('cloudinary')
module.exports = {
addArticle: (req, res, next) => {
let { text, title, claps, description } = req.body
//let obj = { text, title, claps, description, feature_img: _feature_img != null ? `/uploads/${_filename}` : '' }
View article-route.js
const articlecontroller = require('./../controllers/article.ctrl')
const multipart = require('connect-multiparty')
const multipartWare = multipart()
module.exports = (router) => {
/**
* get all articles
*/
router
View route-index.js
const user = require('./user')
const article = require('./article')
module.exports = (router) => {
user(router)
article(router)
}
View server.js
/** require dependencies */
const express = require("express")
const routes = require('./routes/')
const mongoose = require('mongoose')
const cors = require('cors')
const bodyParser = require('body-parser')
const helmet = require('helmet')
const cloudinary = require('cloudinary')
const app = express()
You can’t perform that action at this time.