This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
# If you have a Gemfile, require the gems listed there, including any gems | |
# you've limited to :test, :development, or :production. | |
Bundler.require(:default, Rails.env) if defined?(Bundler) | |
module AppLibTest | |
class Application < Rails::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby -r uri -ne 'puts URI.unescape $_.chomp' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let PLUGIN_INFO = xml` | |
<VimperatorPlugin> | |
<name>fms_switcher</name> | |
<description>This script allows you to switch FireMobileSimulator status with Vimp CLI.</description> | |
<version>1.0.1</version> | |
<author>zentooo</author> | |
<license>Creative Commons</license> | |
<detail><![CDATA[ | |
== Subject == | |
This script allows you to switch FireMobileSimulator status from Vimperator CLI. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: set ft=ruby | |
module Autotest::Growl | |
def self.growl title, msg, pri=0, sticky="" | |
msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}" | |
system "growlnotify -n autotest -p #{pri} -m #{msg.inspect} #{title} #{sticky}" | |
end | |
Autotest.add_hook :ran_command do |at| | |
output = at.results.last | |
output = output.gsub!(/\e\[\d+m/,'').gsub!(/\n/,'') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <pthread.h> | |
#include <iostream> | |
class LedMatrix { | |
private: | |
pthread_t thread; // スレッドハンドラ | |
pthread_mutex_t mutex; // ミューテックス(排他処理で優先権を決めるやつ) | |
int data; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringListerViewer | |
attr_reader :items, :type | |
def initialize(items, type) | |
@items = items | |
@type = type | |
end | |
def string_lister(items) | |
Object.const_get("#{type.to_s.capitalize}StringLister").new(items) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
引数 klass で指定したクラスだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
アルゴリズムを実行時に選択することができるデザインパターンである。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ファイルを生成して、upload するという流れ | |
class FileUploader # Client | |
def initialize(factory) | |
@file_maker = factory.file_maker | |
@uploader = factory.uploader | |
end | |
def make_flie(items) | |
@file = file_maker.make(item) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "open-uri" | |
class Titles | |
include Enumerable | |
def initialize | |
@urls = [] | |
end | |
def <<(url) | |
@urls << url |
OlderNewer