Skip to content

Instantly share code, notes, and snippets.

GOTO Hayato gh640

Block or report user

Report or block gh640

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
gh640 /
Created Jul 2, 2019
Allow Django Debug Toolbar to be displayed when the app is running in a Docker container
"""Allow Django Debug Toolbar to be displayed when the app runs in a Docker container
import socket
INTERNAL_IPS = ['', '']
gh640 / form-reset-button.js
Created Apr 18, 2019
View form-reset-button.js
(function (){
'use strict';
* ページ読み込み時処理
function init() {
gh640 /
Created Mar 18, 2019
Minimal Django project for django 2.1.x
"""Minimal Django project for django 2.1.x.
This code is mostly borrowed from .
import sys
from django.conf import settings
from django.http import HttpResponse
from django.urls import path
gh640 /
Created Dec 8, 2018
Python Pandas: Stack a column in a DataFrame
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)
.reset_index(1, drop=True)
gh640 / sample-chart_js-lined_scatter_chart.html
Created Dec 1, 2018
Chart.js sample: Scatter chart with straight lines
View sample-chart_js-lined_scatter_chart.html
<canvas id="canvas"></canvas>
<script src=""></script>
// see:
// see:
const ctx = document.querySelector('#canvas');
const scatterChart = new Chart(ctx, {
gh640 / sample-chart_js-click_event_handling_with_stacked_bar_chart.html
Last active Nov 16, 2018
Chart.js sample: Click event handling with stacked bars
View sample-chart_js-click_event_handling_with_stacked_bar_chart.html
.canvas-wrapper {
width: 600px;
margin: auto;
height: 600px;
gh640 / ceil_floor_with_precision.php
Created Oct 30, 2018
PHP: ceil() and floor() with precision
View ceil_floor_with_precision.php
function ceil_plus($value, $precision = 1) {
return round($value + 0.5 * pow(0.1, $precision), $precision, PHP_ROUND_HALF_DOWN);
function floor_plus($value, $precision = 1) {
return round($value - 0.5 * pow(0.1, $precision), $precision, PHP_ROUND_HALF_UP);
gh640 /
Last active Jul 13, 2018
All the constants defined in Drupal 7 core


define('DRUPAL_ROOT', getcwd());
define('VERSION', '7.60-dev');

The value of VERSION (7.60-dev) above varies for each version.

gh640 /
Created Jul 6, 2018
Fabric コマンドサンプル
'''デプロイ関連タスクのための Fabric コマンド'''
# .env ファイルの中身は次のとおり
# hosts=ホスト名A|ホスト名B
# shell='/usr/local/bin/bash -l -c'
# project_path='/var/www/プロジェクト名'
from functools import wraps
from pathlib import Path
gh640 /
Last active Jul 6, 2018
Python でモックを使ったテストのサンプル
import unittest
from unittest import mock
import requests
import PypiPackageInfo
URL_JSON = ...
You can’t perform that action at this time.