Skip to content

Instantly share code, notes, and snippets.

View hokuma's full-sized avatar
🎯
Focusing

hokuma hokuma

🎯
Focusing
View GitHub Profile
@hokuma
hokuma / file0.txt
Last active August 29, 2015 14:07
d3.jsで東京メトロの地下鉄路線図を作成する ref: http://qiita.com/halhide/items/0d4116a11d05c21e6edc
"N03_003" LIKE "%区%"
@hokuma
hokuma / file0.txt
Created October 25, 2014 08:26
東京メトロAPI+vue.js = トイレ検索 ref: http://qiita.com/halhide/items/840645c498ef68142048
%div.container-fluid
%div.row
%div.form-group
%div.col-sm-10
%select.form-control.stations{"v-model" => "selected", "v-on" => "change: onChange(this)"}
%option{"v-repeat" => "stations", "value" => "{{name}}"} {{title}}
%div.row.facilities
%div.inside-gate
%h3 改札内:{{insideCount}}
%div.list-group
FROM centos:7
MAINTAINER hokuma
RUN yum install -y http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm
RUN yum install -y http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
RUN yum makecache
RUN yum install -y mysql-community-server
RUN yum install -y mysql-community-mroonga
RUN mysql_install_db --datadir=/var/lib/mysql --user=mysql
@hokuma
hokuma / Dockerfile
Created April 28, 2015 02:48
Basic認証対応apache(第3回勉強会課題)
FROM centos:6
MAINTAINER hokuma
RUN yum -y update && yum install -y httpd
ENV USERNAME admin
ENV PASSWORD qwerty
COPY server.conf auth.conf /etc/httpd/conf.d/
@hokuma
hokuma / measure.js
Last active August 29, 2015 14:27
温度を取得してdynamodbに保存する
var fs = require('fs');
var Aws = require('aws-sdk');
var deviceId = 'YOUR_DEVICE_ID';
var sensorPath = '/sys/bus/w1/devices/' + deviceId + '/w1_slave';
var data = fs.readFileSync(sensorPath, {'encoding': 'ascii'});
var temp_line = data.split("\n")[1];
var matches = temp_line.match(/t=(\d+)/);
var temp;
@hokuma
hokuma / tab2space.sh
Created October 2, 2015 08:16
tab2space
#!/bin/sh
scss_files=`find app/assets/stylesheets -name "*.scss"`
for filepath in ${scss_files}
do
sed -i .orig s/$'\t'/' '/g ${filepath}
rm ${filepath}.orig
done
@hokuma
hokuma / file0.txt
Created October 6, 2012 02:52
Gebでページ操作を定義する ref: http://qiita.com/items/a8164a5f2eb7249a8e97
class ExamplePage extends Page {
static content = {
userId { $("form").find("input", name: "userId") }
userIdErr { $("span#userIdErr").text() }
}
}
@hokuma
hokuma / browser.js
Last active October 18, 2015 12:35
node環境でsinon.jsのfakeServerを使う ref: http://qiita.com/halhide/items/498f094ac670884e55c9
// ブラウザ環境っぽいものを作る
import jsdom from 'jsdom';
import jQuery from 'jquery';
import { XMLHttpRequest } from 'w3c-xmlhttprequest';
global.XMLHttpRequest = XMLHttpRequest;
global.document = jsdom.jsdom('<!doctype html><html><body></body></html>');
global.window = document.parentWindow;
global.$ = jQuery(window);
@hokuma
hokuma / file0.txt
Created February 25, 2013 12:58
テストコードと依存するライブラリをjarにまとめてCLIで実行する ref: http://qiita.com/items/e489d02f9622ce73b235
<build>
...
<plugins>
...
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>make-assembly</id>
@hokuma
hokuma / file0.php
Created August 24, 2013 04:43
メディア選択時に自分の投稿写真だけ表示する ref: http://qiita.com/halhide/items/35cb62ba3107ac19f4db
add_action( "pre_get_posts", "set_ajax_media_query" );
function set_ajax_media_query( $wp_query ) {
global $current_user;
if( $wp_query ->query_vars['post_type'] != "attachment" ) {
return;
}
get_currentuserinfo();