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
//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; |
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
//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'); |
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
# 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 |
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
#!/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 |
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
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" ] |
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
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) |
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
version: '3.3' | |
services: | |
app: | |
build: | |
context: . | |
dockerfile: Dockerfile | |
expose: | |
- "8000" | |
ports: |
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
master |
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
slave1 | |
slave2 |
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
<configuration> | |
<property> | |
<name>mapreduce.framework.name</name> | |
<value>yarn</value> | |
</property> | |
<property> | |
<name>yarn.app.mapreduce.am.env</name> | |
<value>HADOOP_MAPRED_HOME=${HADOOP_HOME}</value> | |
</property> | |
<property> |