This file contains hidden or 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
| # Shortcut to download and install a Drupal project on Drupal 7 | |
| function den { | |
| local module_name | |
| if [[ "${1}" == *"https://www.drupal.org/project"* ]]; then | |
| module_name=$(echo "${1}" | grep -Eo "[^\/]+$") | |
| echo "$module_name is being installed..." | |
| else | |
| module_name="${1}" | |
| fi |
This file contains hidden or 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
| """数独を解く | |
| - 無駄な探索の枝を事前に減らすために入る値の候補が少ないセルを先に埋める | |
| - 動作検証環境: | |
| - Python 3.7 | |
| - 参考: | |
| - https://www.youtube.com/watch?v=G_UYXzGuqvM | |
| """ | |
| from __future__ import annotations |
This file contains hidden or 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.8 | |
| ENV POETRY_VERSION=1.0.0 \ | |
| PATH="/root/.poetry/bin:$PATH" | |
| WORKDIR /app | |
| RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/${POETRY_VERSION}/get-poetry.py | python && \ | |
| poetry config virtualenvs.create false |
This file contains hidden or 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
| <?php | |
| add_filter('upload_mimes', 'myplugin_mime_types'); | |
| /** | |
| * メディアでアップロード可能なメディアのタイプに svg を追加する | |
| * | |
| * @see https://developer.wordpress.org/reference/hooks/upload_mimes/ | |
| */ | |
| function myplugin_mime_types( $mimes ) { |
This file contains hidden or 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
| document.body.addEventListener("click", e => { | |
| var target = e.target | |
| if (target.tagName === "A" && target.host !== window.location.host) { | |
| Object.assign(document.createElement("a"), { | |
| target: "_blank", | |
| href: target.href, | |
| rel: "noopener noreferrer", | |
| }).click() | |
| e.preventDefault() | |
| } |
This file contains hidden or 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
| """Allow Django Debug Toolbar to be displayed when the app runs in a Docker container | |
| See: https://gist.github.com/douglasmiranda/9de51aaba14543851ca3 | |
| """ | |
| import socket | |
| INTERNAL_IPS = ['127.0.0.1', '10.0.2.2'] |
This file contains hidden or 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
| """Minimal Django project for django 2.1.x. | |
| This code is mostly borrowed from http://shop.oreilly.com/product/0636920032502.do . | |
| """ | |
| import sys | |
| from django.conf import settings | |
| from django.http import HttpResponse | |
| from django.urls import path |
This file contains hidden or 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
| import pandas as pd | |
| def stack_with_column(df, column, sep=','): | |
| """Stack a column splitting with `sep` in a DataFrame. | |
| """ | |
| stacked_column = ( | |
| df[column].str.split(sep, expand=True) | |
| .stack() | |
| .reset_index(1, drop=True) |
This file contains hidden or 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
| <!DOCTYPE> | |
| <html> | |
| <body> | |
| <canvas id="canvas"></canvas> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.min.js"></script> | |
| <script> | |
| // see: https://www.chartjs.org/docs/latest/charts/scatter.html | |
| // see: https://stackoverflow.com/questions/46232699/display-line-chart-with-connected-dots-using-chartjs | |
| const ctx = document.querySelector('#canvas'); | |
| const scatterChart = new Chart(ctx, { |