Skip to content

Instantly share code, notes, and snippets.

View nakajijapan's full-sized avatar

Daichi Nakajima nakajijapan

View GitHub Profile
@nakajijapan
nakajijapan / gist:07479581c35172f922b4b8baf1a32194
Created October 15, 2020 03:01
LangファイルをCSVにする
require 'bundler'
require 'pathname'
require 'colorize'
project_root = Pathname.new(File.dirname(__FILE__) + '/../')
LANG_FILE = "#{project_root}/Project/Base.lproj/Localizable.strings"
puts LANG_FILE.colorize(:blue)
puts "Input".colorize(:green)
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@nakajijapan
nakajijapan / drive.py
Last active August 29, 2015 14:12 — forked from basuke/drive.py
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser
@nakajijapan
nakajijapan / itunes.sh
Last active February 1, 2017 22:18 — forked from rkumar/itunes.sh
#!/bin/bash
#
####################################
# iTunes Command Line Control v1.0
# written by David Schlosnagle
# created 2001.11.08
# edit 2010.06.01 rahul kumar
####################################
showHelp () {
#!/bin/bash
# Created by Håvard Fossli <[email protected]> in 2013
# This is free and unencumbered software released into the public domain.
# For more information, please refer to <http://unlicense.org/>
#
# Description
# A bash script for reversing videos using ffmpeg and sox.
#
# Keywords
@nakajijapan
nakajijapan / gist:5371410
Last active December 16, 2015 03:39
ruby-buildでバージョン指定してコンパイルしてtarで固める。(puppetで撒く用の処理)
#!/usr/bin/env ruby
require 'colorize'
def exec_cmd(str)
puts "[CMD] #{str}".colorize(:green)
result = ''
result = system(str)
puts "[OUTPUT] #{result}".colorize(:blue)
end
@nakajijapan
nakajijapan / gist:5139720
Last active December 14, 2015 19:49
モーダル画面 pintarest風 修正版 ・overlayはjs側で追加 ・モーダルで表示する際は指定されたDIVタグ内に追加して表示を消すときは当該DIVタグの中身も削除する
#----------------------------------------------
# モーダル画面の表示
#----------------------------------------------
(($)->
$.SimpleModal = (element, options) ->
defaults =
target: ''
continue_overlay: false
close_callback: ->
css_overlay:

ヒューマンエラーを許容する

  • 「きをつけよう」は意味ない
  • 実装、プラクティス、プロセスに落とし込む

バグ、ミスオペの混入を防ぐ

  • コードレビュー
  • 二人で作業
  • テストケース
@nakajijapan
nakajijapan / gist:4982564
Created February 19, 2013 02:21
./logs/ディレクトリの中にあるaccess_logのデータをDBに入れるだけの処理
# ./logs/ディレクトリの中にあるaccess_logのデータをDBに入れるだけの処理
require 'mysql2'
require 'active_record'
#
# query
#
def query(sql)
my = Mysql2::Client.new(:host => "localhost", :username => "root", :password => '', :database => 'web_analyze')
my.query("set character set utf8")
@nakajijapan
nakajijapan / gist:3799322
Created September 28, 2012 11:40
backbone-rails backbone_rails_sync.js
(function() {
var methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read' : 'GET'
};
var getUrl = function(object) {
if (!(object && object.url)) return null;