Skip to content

Instantly share code, notes, and snippets.

@FromAtom
FromAtom / init-tex.el
Last active February 6, 2019 05:14
YaTeXでTeXを書いている状態で保存時に動作する。 "、"と"。"を","と"." に変換し、全角英数字を半角英数字に変換する。
;;バッファ全体の句読点と読点をコンマとピリオドに変換
(defun replace-commaperiod-buffer ()
(interactive "r")
(save-excursion
(replace-string "、" "," nil (point-min) (point-max))
(replace-string "。" "." nil (point-min) (point-max))))
;;選択範囲内の全角英数字を半角英数字に変換
(defun hankaku-eisuu-region (start end)
(interactive "r")
@FromAtom
FromAtom / saykanakanji.rb
Last active December 16, 2015 15:09
コマンドライン引数で取得した文章をruby-mecabを使って発音を解析、最後にSayKanaコマンドに読ませる。
# -*- encoding: utf-8 -*-
#!/usr/bin/env ruby
require 'rubygems'
require 'MeCab'
mecab = MeCab::Tagger.new("")
ARGV.each{ |arg|
kana = ''
parse_node = mecab.parseToNode(arg)
@FromAtom
FromAtom / gist:5909260
Created July 2, 2013 13:22
open webpage sourced by URL
try {
throwURL(requestToken.getAuthorizationURL());
} catch (URISyntaxException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
@FromAtom
FromAtom / useCostomPhotoAlbum.js
Last active December 20, 2015 11:09
TitaniumでiOSのフォトライブラリにアルバムを作って画像を保存する方法 ref: http://qiita.com/FromAtom@github/items/ebb6247e621375e409ba
var image = "test.png";
var costomPhotoAlbum = require('ti.customphotoalbum');
costomPhotoAlbum.addCustomAlbumAndSaveImage(image, "ALBUM_NAME");
@FromAtom
FromAtom / hatena-blog-api.rb
Last active April 23, 2016 00:04
はてなブログのAPIを使って、記事を投稿するRubyサンプル
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
require 'atomutil'
USERNAME = ARGV[0]
BLOG_DOMAIN = ARGV[1]
PASSWORD = ARGV[2]
POST_URI = "http://blog.hatena.ne.jp/#{USERNAME}/#{BLOG_DOMAIN}/atom/entry"
@FromAtom
FromAtom / assign-car.rb
Created September 10, 2013 16:30
ゼミ旅行の車割り当てをするコード
def assignCar(members, first_car_capacity)
members.shuffle!
puts "---First car members---"
puts members.first(first_car_capacity)
puts "---Second car members---"
puts members.last(members.length-first_car_capacity)
end
# snorkel member's car assign
snorkel_buf = File.read("snorkel_members.txt", :encoding => Encoding::UTF_8)
# -*- coding: utf-8 -*-
require 'rubygems'
require 'google/api_client'
require 'yaml'
require 'time'
require 'date'
require 'idobata'
class GoogleCalendarManager
@FromAtom
FromAtom / pukiwiki-idobata.rb
Created August 24, 2014 13:08
Pukiwikiの更新情報をidobata.ioに送信する奴
require 'rubygems'
require 'uri'
require 'rss'
require 'redis'
require 'json'
require 'idobata'
class PukiWikiRssReader
def initialize (rss_url)
charset = nil
  • hoge
@FromAtom
FromAtom / docomo-dialog-api.coffee
Last active July 17, 2023 02:26
DOCOMOの雑談対話APIを使ってHubotと雑談する。
# Description:
# DOCOMOの雑談APIを利用した雑談
#
# Author:
# FromAtom
getTimeDiffAsMinutes = (old_msec) ->
now = new Date()
old = new Date(old_msec)
diff_msec = now.getTime() - old.getTime()