This file contains 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.exports = (sequelize, DataTypes) => | |
sequelize.define( | |
"hashtag", | |
{ | |
title: { | |
type: DataTypes.STRING(15), | |
allowNull: false, | |
unique: true, | |
}, | |
}, |
This file contains 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.exports = (sequelize, DataTypes) => | |
(sequelize.define( | |
"post", | |
{ | |
content: { | |
type: DataTypes.STRING(140), | |
allowNull: false, | |
}, | |
img: { | |
type: DataTypes.STRING(200), |
This file contains 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
const { Post, Hashtag } = require("../models"); | |
exports.textUpload = async (req, res, next) => { | |
try { | |
const post = await Post.create({ | |
content: req.body.content, | |
img: req.body.url, | |
userId: req.user.id, | |
}); | |
const hashtags = req.body.content.match(/#[^\s#]*/g); |
This file contains 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
extends layout | |
block content | |
if user | |
.twits | |
form#hashtag-form(action='/post/hashtag') | |
input(type='text' name='hashtag' placeholder='Tag Search') | |
button.btn Search | |
form#sns-form(action='/post' method='POST' enctype='multipart/form-data') | |
.sns-discription post content |
This file contains 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
const express = require("express"); | |
const router = express.Router(); | |
const postController = require("../controllers/post"); | |
router.post("/", postController.textUpload); | |
router.get("/hashtag", postController.hashtagSearch); |
This file contains 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
🌞 Morning 49 commits ██▎░░░░░░░░░░░░░░░░░░ 10.7% | |
🌆 Daytime 110 commits █████░░░░░░░░░░░░░░░░ 24.1% | |
🌃 Evening 180 commits ████████▎░░░░░░░░░░░░ 39.4% | |
🌙 Night 118 commits █████▍░░░░░░░░░░░░░░░ 25.8% |
This file contains 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
⭐ Total Stars: 13 | |
➕ Total Commits: 847 | |
🔀 Total PRs: 215 | |
🚩 Total Issues: 296 | |
📦 Contributed to: 3 |
This file contains 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
a = [1,2,3] | |
b = a | |
a.append(4) | |
print(b) # result : [1,2,3,4] |
This file contains 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
class Gizmo: | |
def __init__(self): | |
print("Gizmo id: %d" % id(self)) | |
x = Gizmo() | |
# Gizmo id : 4301489152 | |
y = Gizmo() * 10 | |
# Gizmo id : 4301489432 |
This file contains 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
class HauntedBus: | |
def __init__(self, passengers=[]): | |
self.passengers = passengers | |
def pick(self, name): | |
self.passengers.append(name) | |
def drop(self, name): | |
self.passengers.remove(name) |