Skip to content

Instantly share code, notes, and snippets.

View yoshinari-nomura's full-sized avatar

Yoshinari Nomura yoshinari-nomura

View GitHub Profile
#!/usr/bin/env ruby
require "./event.rb"
def filter(events, &block)
filtered = EventCollection.new
events.each do |ev|
filtered << ev if yield(ev)
end
return filtered
@yoshinari-nomura
yoshinari-nomura / upcoming_events.rb
Created June 27, 2018 08:22
Upcoming events filter
#!/usr/bin/env ruby
require "./event.rb"
def filter(events, &block)
filtered = EventCollection.new
events.each do |ev|
filtered << ev if yield(ev)
end
return filtered
@yoshinari-nomura
yoshinari-nomura / today.rb
Last active June 27, 2018 08:15
dummy event emitter
#!/usr/bin/env ruby
require "./event.rb"
TODAYS_EVENTS_SAMPLE = [
"allday だれかさん誕生日 おめでとう",
"10:00-12:00 GN検討打合せ",
"11:30-12:30 昼食会",
"13:00-16:00 New開発",
"17:15-18:00 テスト",
@yoshinari-nomura
yoshinari-nomura / event_sample.rb
Last active June 27, 2018 08:18
Sample Event class
#!/usr/bin/env ruby
require "json"
require "date"
class Event
attr_reader :start_time, :end_time, :summary, :description
def initialize(start_time, end_time, summary, description)
@start_time, @end_time, @summary, @description =
@yoshinari-nomura
yoshinari-nomura / gtd_table.rb
Last active September 29, 2017 04:45
Convert org-mode todo list to TeX table
#!/usr/bin/env ruby
$DEBUG = false
module OrgTodo
# * Document
# Document consists of a PREAMBLE part and SECTIONS.
# + PREAMBLE is the first part of Org document such as:
# : #+TITLE: Blah
# : #+AUTHOR: Yoshinari Nomura
@yoshinari-nomura
yoshinari-nomura / make-icon-badge.sh
Created June 12, 2017 06:53
Create circle icon with green frame
#!/bin/sh
# usage: make-icon-badge.sh [diameter_in_cm] src_file dst_file
# make-icon-badge.sh 3.6 nom-with-cray.jpg nom-with-cray.png
# Crop or mask an image into a circle - Stack Overflow
# https://stackoverflow.com/questions/999251/crop-or-mask-an-image-into-a-circle
#
# I want to change DPI with ImageMagick without changing the actual byte-size of the image data
# https://superuser.com/questions/479197/i-want-to-change-dpi-with-imagemagick-without-changing-the-actual-byte-size-of-t
@yoshinari-nomura
yoshinari-nomura / glima.el
Created May 7, 2017 03:26
Org-link-store for Mew with Gmail/IMAP
(with-eval-after-load 'org
(if (fboundp 'org-link-set-parameters)
;; org version 9
(org-link-set-parameters "gmail"
:follow #'glima-org-gmail-message-open
:store #'mewx-org-store-link)
;; org version 8
(org-add-link-type "gmail" 'glima-org-gmail-message-open)
(setq org-store-link-functions
(cons 'mewx-org-store-link org-store-link-functions))))
@yoshinari-nomura
yoshinari-nomura / ame
Created April 19, 2017 00:41
Set your status in Slack with CLI
#!/bin/bash
################################################################
## Usage
usage() {
echo "ame [-c CONFIG_FILE] [-t TEAM] ICON TEXT"
echo " -c Set config file name."
echo " -t Set Slack team name."
echo "examples:"
;;; otama.el --- Org-table as database.
;; Description: Org-table as database.
;; Author: Yoshinari Nomura <nom@quickhack.net>
;; Created: 2016-02-03
;; Version: 1.0.0
;; Keywords: database, org-mode
;; URL:
;; Package-Requires:
@yoshinari-nomura
yoshinari-nomura / rails-new
Created January 14, 2016 15:22
Create new rails project with Bundler
#!/bin/sh
APP_NAME="$1"
IGN_MORE="https://raw.github.com/github/gitignore/master/Rails.gitignore"
mkdir "$APP_NAME" && cd "$APP_NAME" || exit 1
bundle init || exit 1
echo 'gem "rails"' >> Gemfile