Skip to content

Instantly share code, notes, and snippets.

View takuan-osho's full-sized avatar
🏠
Working from home

SHIMIZU Taku takuan-osho

🏠
Working from home
View GitHub Profile
@takuan-osho
takuan-osho / prettify.py
Created July 10, 2014 07:58
インデントされてないHTMLを相手にするのに疲れたので作った。例外考えてなかったりしていて作りは雑なので後で直したい。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import argparse
import os
from bs4 import BeautifulSoup as bs
def build_parser():
@takuan-osho
takuan-osho / csv2json.go
Last active August 29, 2015 14:04
まだ出来損ない
package main
import (
"encoding/csv"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@takuan-osho
takuan-osho / gulpfile.js
Created July 27, 2015 14:41
slimのビルドをするgulpfile
var gulp = require('gulp');
var shell = require('gulp-shell');
gulp.task('build-slim', function() {
gulp.src('./*.slim').pipe(shell([
'slimrb -p <%= file.path %> > ./output/<%= file.relative.replace(".slim", ".html") %>'
]));
});
gulp.task('watch', function() {
@takuan-osho
takuan-osho / gulpfile.js
Created July 27, 2015 14:51
slimのビルドをgulpのslim pluginでやった場合のgulpfile
var gulp = require("gulp");
var slim = require("gulp-slim");
gulp.task('slim', function(){
gulp.src("./*.slim")
.pipe(slim({
pretty: true
}))
.pipe(gulp.dest("./output/"));
});
@takuan-osho
takuan-osho / gulpfile.js
Created July 28, 2015 11:39
BrowserSyncを入れて動かしてみたgulpfile
var gulp = require("gulp");
var slim = require("gulp-slim");
var browserSync = require("browser-sync");
gulp.task('slim', function(){
gulp.src("./*.slim")
.pipe(slim({
pretty: true
}))
.pipe(gulp.dest("./output/"));
@takuan-osho
takuan-osho / gulpfile.js
Last active August 29, 2015 14:26
babel, react, browserify, browser-syncを活用したgulpfileのひな型
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var source = require('vinyl-source-stream');
var babelify = require('babelify');
var watchify = require('watchify');
var exorcist = require('exorcist');
var browserify = require('browserify');
var browserSync = require('browser-sync').create();
@takuan-osho
takuan-osho / CodePiece.swift
Last active October 3, 2015 05:33
Optional Bindingみたいなのをするこういう場合、if letとguardどっちを使えばメンテしやすくなるんだろ? #CodePiece
// Hacking with Swiftオリジナルのコード
// from https://www.hackingwithswift.com/read/4/3/choosing-a-website-uialertcontroller
func openPage(action: UIAlertAction!) {
let url = NSURL(string: "https://" + action.title!)!
webView.loadRequest(NSURLRequest(URL: url))
}
// if letを使って書きかえてみたコード
func openPage(action: UIAlertAction!){
if let title = action.title, let url = NSURL(string: "https://" + title) {
@takuan-osho
takuan-osho / main.rb
Last active January 25, 2018 07:35
住所表記ルールの表記ゆれ修正のためのスクリプト
#!/usr/bin/env ruby
require "./normalizer"
input_file = ARGV[0]
write_file = ARGV[1]
generate_normalized_file(input_file, write_file)
'use strict';
let nconf = require('nconf').file({file: getUserHome() + '/sound-machine-config.json'});
function saveSettings(settingKey, settingValue) {
nconf.set(settingKey, settingValue);
nconf.save();
}
function readSettings(settingKey) {