Skip to content

Instantly share code, notes, and snippets.

😀
Busy
Focusing

Jungwon Seo thejungwon

View GitHub Profile
View test2.js
//1. Get a value by id
var value = $('#test_id').val();
//2. Get a value by class
var value = $('.test_class').val();
//3. Get a value by name
var value = $('input[name=test_name]').val();
View test.html
<input type="hidden" id="test_id" class="test_class" name="test_name" value="test">
View test.js
//1. id 로 접근해서 가져오기
var value = $('#test_id').val();
//2. class 로 접근해서 가져오기
var value = $('.test_class').val();
//3. name으로 접근해서 가져오기
var value = $('input[name=test_name]').val();
View test.html
<!--sample div -->
<div class="test_class" id="test_id" name="test_name"></div>
View javascript-version.js
//1. By id
var name_by_id = document.getElementById("test_id").getAttribute('name');
var class_by_id = document.getElementById('test_id').ClassName;
//2. By class
var name_by_class = document.getElementsByClassName('test_class')[0].getAttribute('name');
var class_by_class = document.getElementsByClassName('test_class')[0].id;
//3. By name
var id_by_name = document.getElementsByName('test_name')[0].id;
var class_by_name = document.getElementsByName('test_name')[0].className;
View jquery-version.js
//1. By id
var name_by_id = $('#test_id').attr('name');
var class_by_id = $('#test_id').attr('class');
//2. By class
var name_by_class = $('.test_class').attr('name');
var id_by_class = $('.test_class').attr('id');
//3. By name
var id_by_name = $('[name="test_name"]').attr('id');
var class_by_name = $('[name="test_name"]').attr('class');
View Dockerfile
# build environment
FROM node:9.6.1 as builder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY package.json /usr/src/app/package.json
RUN npm install --silent
RUN npm install react-scripts@1.1.1 -g --silent
COPY . /usr/src/app
RUN npm run build
View entry_point.sh
#!/bin/bash
cd src
python manage.py makemigrations
until python manage.py migrate; do
sleep 2
echo "Retry!";
done
python manage.py shell < init_admin.py
python manage.py makemigrations app
View Dockerfile
FROM python:3
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
RUN chmod +x entry_point.sh
CMD [ "./entry_point.sh" ]
View views.py
from django.shortcuts import render
from django.http import HttpResponse
from django.shortcuts import render
from .models import *
import datetime
import base64
import requests
def index(request):
p = Post(date=datetime.datetime.now(), photo=random_picture())
p.save(force_insert=True)
You can’t perform that action at this time.