김지훈

First Commit

Client / Server / Chrome-App
1 +node_modules
1 +function get_source(document_body){
2 + return document_body.innerText;
3 +}
4 +
5 +chrome.extension.sendMessage({
6 + action: "getSource",
7 + source: get_source(document.body)
8 +});
1 +{
2 + "manifest_version": 2,
3 +
4 + "name": "get_source",
5 + "description": "print html code.",
6 + "version": "1.0",
7 +
8 + "browser_action": {
9 + "default_icon": "icon.png",
10 + "default_popup": "popup.html"
11 + },
12 + "permissions": [
13 + "tabs",
14 + "<all_urls>"
15 + ]
16 +}
1 +<!DOCTYPE html>
2 +<html>
3 + <head>
4 + <style>
5 + BODY {width : 400px; min-height:250px;}
6 + </style>
7 + <script src="popup.js"></script>
8 + </head>
9 + <body>
10 + </body>
11 +</html>
1 +chrome.extension.onMessage.addListener(function(request, sender) {
2 + if (request.action == "getSource") {
3 + document.body.innerText = request.source;
4 + }
5 +});
6 +
7 +function onWindowLoad() {
8 + chrome.tabs.executeScript(null, {
9 + file: "getSource.js"
10 + }, function() {
11 + if (chrome.extension.lastError) {
12 + document.body.innerText = 'There was an error injecting script : \n' + chrome.extension.lastError.message;
13 + }
14 + });
15 +}
16 +window.onload = onWindowLoad;
1 +# See http://help.github.com/ignore-files/ for more about ignoring files.
2 +
3 +# dependencies
4 +node_modules
5 +
6 +# testing
7 +coverage
8 +
9 +# production
10 +build
11 +
12 +# misc
13 +.DS_Store
14 +.env
15 +npm-debug.log
This diff is collapsed. Click to expand it.
1 +{
2 + "name": "3line",
3 + "version": "0.1.0",
4 + "private": true,
5 + "devDependencies": {
6 + "react-scripts": "0.6.1"
7 + },
8 + "dependencies": {
9 + "react": "^15.3.2",
10 + "react-dom": "^15.3.2"
11 + },
12 + "scripts": {
13 + "start": "react-scripts start",
14 + "build": "react-scripts build",
15 + "test": "react-scripts test --env=jsdom",
16 + "eject": "react-scripts eject"
17 + }
18 +}
No preview for this file type
1 +<!doctype html>
2 +<html lang="en">
3 + <head>
4 + <meta charset="utf-8">
5 + <meta name="viewport" content="width=device-width, initial-scale=1">
6 + <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
7 + <!--
8 + Notice the use of %PUBLIC_URL% in the tag above.
9 + It will be replaced with the URL of the `public` folder during the build.
10 + Only files inside the `public` folder can be referenced from the HTML.
11 +
12 + Unlike "/favicon.ico" or "favico.ico", "%PUBLIC_URL%/favicon.ico" will
13 + work correctly both with client-side routing and a non-root public URL.
14 + Learn how to configure a non-root public URL by running `npm run build`.
15 + -->
16 + <title>React App</title>
17 + </head>
18 + <body>
19 + <div id="root"></div>
20 + <!--
21 + This HTML file is a template.
22 + If you open it directly in the browser, you will see an empty page.
23 +
24 + You can add webfonts, meta tags, or analytics to this file.
25 + The build step will place the bundled scripts into the <body> tag.
26 +
27 + To begin the development, run `npm start`.
28 + To create a production bundle, use `npm run build`.
29 + -->
30 + </body>
31 +</html>
1 +.App {
2 + text-align: center;
3 +}
4 +
5 +.App-logo {
6 + animation: App-logo-spin infinite 20s linear;
7 + height: 80px;
8 +}
9 +
10 +.App-header {
11 + background-color: #222;
12 + height: 150px;
13 + padding: 20px;
14 + color: white;
15 +}
16 +
17 +.App-intro {
18 + font-size: large;
19 +}
20 +
21 +@keyframes App-logo-spin {
22 + from { transform: rotate(0deg); }
23 + to { transform: rotate(360deg); }
24 +}
1 +import React, { Component } from 'react';
2 +import logo from './logo.svg';
3 +import './App.css';
4 +
5 +class App extends Component {
6 + render() {
7 + return (
8 + <div className="App">
9 + <div className="App-header">
10 + <img src={logo} className="App-logo" alt="logo" />
11 + <h2>Welcome to React</h2>
12 + </div>
13 + <p className="App-intro">
14 + To get started, edit <code>src/App.js</code> and save to reload.
15 + </p>
16 + </div>
17 + );
18 + }
19 +}
20 +
21 +export default App;
1 +import React from 'react';
2 +import ReactDOM from 'react-dom';
3 +import App from './App';
4 +
5 +it('renders without crashing', () => {
6 + const div = document.createElement('div');
7 + ReactDOM.render(<App />, div);
8 +});
1 +body {
2 + margin: 0;
3 + padding: 0;
4 + font-family: sans-serif;
5 +}
1 +import React from 'react';
2 +import ReactDOM from 'react-dom';
3 +import App from './App';
4 +import './index.css';
5 +
6 +ReactDOM.render(
7 + <App />,
8 + document.getElementById('root')
9 +);
1 +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
2 + <g fill="#61DAFB">
3 + <path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
4 + <circle cx="420.9" cy="296.5" r="45.7"/>
5 + <path d="M520.5 78.1z"/>
6 + </g>
7 +</svg>
1 +var express = require('express');
2 +var path = require('path');
3 +var favicon = require('serve-favicon');
4 +var logger = require('morgan');
5 +var cookieParser = require('cookie-parser');
6 +var bodyParser = require('body-parser');
7 +
8 +var routes = require('./routes/index');
9 +var users = require('./routes/users');
10 +
11 +var app = express();
12 +
13 +// view engine setup
14 +app.set('views', path.join(__dirname, 'views'));
15 +app.set('view engine', 'jade');
16 +
17 +// uncomment after placing your favicon in /public
18 +//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
19 +app.use(logger('dev'));
20 +app.use(bodyParser.json());
21 +app.use(bodyParser.urlencoded({ extended: false }));
22 +app.use(cookieParser());
23 +app.use(express.static(path.join(__dirname, 'public')));
24 +
25 +app.use('/', routes);
26 +app.use('/users', users);
27 +
28 +// catch 404 and forward to error handler
29 +app.use(function(req, res, next) {
30 + var err = new Error('Not Found');
31 + err.status = 404;
32 + next(err);
33 +});
34 +
35 +// error handlers
36 +
37 +// development error handler
38 +// will print stacktrace
39 +if (app.get('env') === 'development') {
40 + app.use(function(err, req, res, next) {
41 + res.status(err.status || 500);
42 + res.render('error', {
43 + message: err.message,
44 + error: err
45 + });
46 + });
47 +}
48 +
49 +// production error handler
50 +// no stacktraces leaked to user
51 +app.use(function(err, req, res, next) {
52 + res.status(err.status || 500);
53 + res.render('error', {
54 + message: err.message,
55 + error: {}
56 + });
57 +});
58 +
59 +
60 +module.exports = app;
1 +#!/usr/bin/env node
2 +
3 +/**
4 + * Module dependencies.
5 + */
6 +
7 +var app = require('../app');
8 +var debug = require('debug')('server:server');
9 +var http = require('http');
10 +
11 +/**
12 + * Get port from environment and store in Express.
13 + */
14 +
15 +var port = normalizePort(process.env.PORT || '3000');
16 +app.set('port', port);
17 +
18 +/**
19 + * Create HTTP server.
20 + */
21 +
22 +var server = http.createServer(app);
23 +
24 +/**
25 + * Listen on provided port, on all network interfaces.
26 + */
27 +
28 +server.listen(port);
29 +server.on('error', onError);
30 +server.on('listening', onListening);
31 +
32 +/**
33 + * Normalize a port into a number, string, or false.
34 + */
35 +
36 +function normalizePort(val) {
37 + var port = parseInt(val, 10);
38 +
39 + if (isNaN(port)) {
40 + // named pipe
41 + return val;
42 + }
43 +
44 + if (port >= 0) {
45 + // port number
46 + return port;
47 + }
48 +
49 + return false;
50 +}
51 +
52 +/**
53 + * Event listener for HTTP server "error" event.
54 + */
55 +
56 +function onError(error) {
57 + if (error.syscall !== 'listen') {
58 + throw error;
59 + }
60 +
61 + var bind = typeof port === 'string'
62 + ? 'Pipe ' + port
63 + : 'Port ' + port;
64 +
65 + // handle specific listen errors with friendly messages
66 + switch (error.code) {
67 + case 'EACCES':
68 + console.error(bind + ' requires elevated privileges');
69 + process.exit(1);
70 + break;
71 + case 'EADDRINUSE':
72 + console.error(bind + ' is already in use');
73 + process.exit(1);
74 + break;
75 + default:
76 + throw error;
77 + }
78 +}
79 +
80 +/**
81 + * Event listener for HTTP server "listening" event.
82 + */
83 +
84 +function onListening() {
85 + var addr = server.address();
86 + var bind = typeof addr === 'string'
87 + ? 'pipe ' + addr
88 + : 'port ' + addr.port;
89 + debug('Listening on ' + bind);
90 +}
1 +{
2 + "name": "server",
3 + "version": "0.0.0",
4 + "private": true,
5 + "scripts": {
6 + "start": "node ./bin/www"
7 + },
8 + "dependencies": {
9 + "body-parser": "~1.15.1",
10 + "cookie-parser": "~1.4.3",
11 + "debug": "~2.2.0",
12 + "express": "~4.13.4",
13 + "jade": "~1.11.0",
14 + "morgan": "~1.7.0",
15 + "serve-favicon": "~2.3.0"
16 + }
17 +}
1 +body {
2 + padding: 50px;
3 + font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 +}
5 +
6 +a {
7 + color: #00B7FF;
8 +}
1 +var express = require('express');
2 +var router = express.Router();
3 +
4 +/* GET home page. */
5 +router.get('/', function(req, res, next) {
6 + res.render('index', { title: 'Express' });
7 +});
8 +
9 +module.exports = router;
1 +var express = require('express');
2 +var router = express.Router();
3 +
4 +/* GET users listing. */
5 +router.get('/', function(req, res, next) {
6 + res.send('respond with a resource');
7 +});
8 +
9 +module.exports = router;
1 +extends layout
2 +
3 +block content
4 + h1= message
5 + h2= error.status
6 + pre #{error.stack}
1 +extends layout
2 +
3 +block content
4 + h1= title
5 + p Welcome to #{title}
1 +doctype html
2 +html
3 + head
4 + title= title
5 + link(rel='stylesheet', href='/stylesheets/style.css')
6 + body
7 + block content