Skip to content

Instantly share code, notes, and snippets.

View nagaki's full-sized avatar
🍊

Atsushi Nagaki nagaki

🍊
View GitHub Profile
@nagaki
nagaki / Vagrantfile
Created May 11, 2017 04:30
vagrant-ubuntu-oracle-xeの共有フォルダ、タイムゾーン設定変更
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
@nagaki
nagaki / gmaps.js
Created August 24, 2015 02:00
Google Maps JavaScript APIのスタイルカスタム
var map;
window.initMap = function() {
var myLatLng = {
lat: <%= data.corp.latitude.value %>,
lng: <%= data.corp.longitude.value %>
};
var mapOptions = {
@nagaki
nagaki / markdown.rb
Last active January 28, 2016 07:59
MarkdownをHTMLにするスクリプト
# coding: utf-8
require 'rubygems'
require 'bundler/setup'
require 'redcarpet'
require 'pygments'
# マークダウンのファイル名をkey
# タイトルをvalueとしてセット
@names = {
index: "ホーム",
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::HTML(open('http://www.heartrails.com'))
doc.search('//td[@class="services_table"]').each do |s|
p '------------------------------'
p s.search('p').text
p s.search('a')[0].attributes["href"].value
end
@nagaki
nagaki / com.brew.update.plist
Created August 4, 2014 01:24
Automatic brew update by Launchd Agent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.brew.update</string>
<key>RunAtLoad</key>
<true/>
<key>ProgramArguments</key>
<array>
@nagaki
nagaki / best_before_date.js
Created July 16, 2014 08:55
Adobe PDFのフォームに賞味期限を自動で入力する
var f = this.getField("BestBeforeDate");
var d = new Date();
d.setYear(d.getFullYear() + 2);
f.value = util.printd("yyyy.m.d", d);
@nagaki
nagaki / console.js
Last active August 29, 2015 13:57
気象庁の天気データ「日ごとの値」から、JavaScriptでデータを取得する
// 気温
var a = []; jQuery.each($('#tablefix1')[0].rows, function(i, val){ if(i > 3){a.push(parseFloat(val.cells[7].innerHTML));}}); console.log(a);
// 天気
var a = []; jQuery.each($('#tablefix1')[0].rows, function(i, val){ if(i > 3){var s = val.cells[20].innerHTML[0]; var p; switch(s){ case "晴": case "快": p = 1; break; case "曇": p = 2; break; case "雨": case "雪": case "大": p = 3; break; default: p = 2;} a.push(p);}}); console.log(a);
@nagaki
nagaki / python-simplehttpserver
Last active August 29, 2015 13:57
ワンライナーでサーバーを起動する
python -m SimpleHTTPServer 8888 &
@nagaki
nagaki / create-db-and-user.md
Last active December 24, 2015 23:49
MySQLでDatabaseを追加して、Databaseユーザーを追加するやり方

Create database

CREATE DATABASE SAMPLEDB;

Add Database User

GRANT ALL ON SAMPLEDB.* TO 'admin'@'localhost' IDENTIFIED BY 'password';
@nagaki
nagaki / example.html
Created October 1, 2013 08:37
SVG FontのXML書式とスタイルシートからの呼び出し方
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Example</title>
<style>
@font-face {
font-family: 'Example Sans Serif';
src: url(g.svg) format('svg');
font-weight: normal;