Skip to content

Instantly share code, notes, and snippets.

@hiroykam
hiroykam / Dockerfile
Last active August 2, 2018 12:39
DockerでPython+uWSGI+Nginxの環境を作成 ref: https://qiita.com/hiroykam/items/748c3fab31c616994db9
FROM centos:6.8
ADD ./conf/nginx.repo /etc/yum.repos.d/
# nginx & python
RUN yum localinstall -y http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
RUN yum install -y https://centos6.iuscommunity.org/ius-release.rpm
RUN yum install -y nginx-1.10.1
RUN yum install -y make gcc
RUN yum install -y libxml2-devel
@hiroykam
hiroykam / MyLoader.js
Last active June 20, 2017 23:48
Golang(Go)のレスポンスデータをjsのfetch APIで取得する ref: http://qiita.com/hiroykam/items/a4423212977ef45d8d99
"use strict"
const modal = document.createElement("div");
modal.className = "modal";
export default class MyLoader {
constructor() {
this.loading = document.createElement("div");
this.loading.className = "loader";
@hiroykam
hiroykam / UglifyJSを利用する場合
Last active October 12, 2017 05:30
ECMAScript2015(es6)の基本的な開発環境 ref: http://qiita.com/hiroykam/items/135c51310087182b03cb
$ npm install -g uglify-js
@hiroykam
hiroykam / MyLoader.js
Last active August 16, 2017 08:30
XMLHttpRequestを利用したPOSTによるデータ受信をPromiseで実現 ref: http://qiita.com/hiroykam/items/5bcde5037bbf3398b584
"use strict"
const modal = document.createElement("div");
modal.className = "modal";
export default class MyLoader {
constructor() {
this.loading = document.createElement("div");
this.loading.className = "loader";
@hiroykam
hiroykam / file1.php
Last active June 7, 2017 15:01
PHPとPythonでネストループを回避する ref: http://qiita.com/hiroykam/items/1680f9b5ced45ec16b3a
<?php
$nest = json_decode(file_get_contents("nest.json"), true);
/*
$nest = [
"a" => ["A" => ["A0" => [1,2], "A1" => [3,4]], "B" => ["A0" => [5,6], "A1" => [7,8]]],
"b" => ["A" => ["A0" => [10,20], "A1" => [30,40]], "B" => ["A0" => [50,60], "A1" => [70,80]]]
];
*/
@hiroykam
hiroykam / file2.php
Last active August 31, 2017 12:25
PHP/PythonのジェネレータをGolang/Rubyで実現 ref: http://qiita.com/hiroykam/items/298c926f2f6b06dfd1db
<?php
function my_generator($name)
{
$file = fopen($name, "r");
if ($file) {
while ($line = fgets($file)) {
yield $line;
}
@hiroykam
hiroykam / file0.py
Last active September 18, 2017 14:41
Pythonのクラス定義とインスタンスの扱い ref: http://qiita.com/hiroykam/items/51a97b648b4f5eadf3b8
class Test(object):
c_var = "Hello"
def __init__(self):
self.i_var = "World"
def __str__(self):
return Test.c_var + " " + self.i_var
print(Test())