This file contains 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 "activerecord" | |
require "ostruct" | |
class Hoge < ActiveRecord::Base | |
end | |
class Factory | |
attr_accessor :klass | |
def initialize |
This file contains 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
module Hena | |
module Ord17Scheherazade | |
# 17301, 100 => [1, 73, 1] | |
def self.hoge(i, base) | |
fail if i < 0 | |
result = [] | |
while i > 0 |
This file contains 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
ANSWERS = [ | |
["YokoHamarb", "acdfp"], | |
["Ruby", "twx"], | |
["ruby", "nst"], | |
["PHP", "gkluv"], | |
["a", "bfg"], | |
["b", "acfgh"], | |
["m", "ghilnqrs"], | |
["mg", "bcdhilmq"], | |
["Mg", "fhiklmpq"], |
This file contains 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 "rmagick" | |
color_space_histgram = {} | |
files = Dir.glob(File.join(ARGV[0], "*.jpg")) | |
files.each do |file| | |
image = Magick::Image.read file | |
color_space_histgram[image.first.colorspace.to_s] ||= 0 | |
color_space_histgram[image.first.colorspace.to_s] += 1 | |
end |
This file contains 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
private Pair<String, String> testMethod() { | |
Pair<String, String> p = new Pair<String, String>("hoge", "fuga"); | |
return p; | |
} |
This file contains 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
use strict; | |
use warnings; | |
use utf8; | |
use Encode; | |
# 波ダッシュ | |
my $wavedash = chr(hex "301c"); | |
print encode_utf8($wavedash) . "\n"; | |
# => "〜" | |
This file contains 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 "pp" | |
require "ripper" | |
pp Ripper.sexp("arr << nil || 1") | |
# => | |
# [:program, | |
# [[:binary, | |
# [:binary, | |
# [:vcall, [:@ident, "arr", [1, 0]]], | |
# :<<, |
This file contains 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
# screen orientationは固定 | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); | |
DisplayMetrics metrics = new DisplayMetrics(); | |
activity.getWindowManager().getDefaultDisplay().getMetrics(metrics); | |
Log.d("metrics.widthPixels: " + metrics.widthPixels); | |
# SONY SO-02g Android 4.4.4 | |
# => デバイスが縦向きでも横向きでも metrics.widthPixels の値は同じ |
This file contains 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
use Digest::SHA2; | |
use Data::Dumper; | |
my $sha2obj = new Digest::SHA2 256; | |
$sha2obj->add('hoge' . 'salt'); | |
print Dumper $sha2obj->hexdigest(); | |
# => "2da48de22c3db5903832dc17521ec800d213a59855351bd69ff1f453f0555f01" |
This file contains 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
奮ーg一A | |
D繍Sc0uク7奮 F。。d5 | |
願 収 証 | |
` 〈杢ネ土お客様ィ系亡J TEL- 。ー2。・ーー83婁ー | |
)工円丿ーーゴヒ丿」丶岩店 囗3・5693~ー83d 丿 | |
ビ`ソグ ' エーtま、 安全と鮮度の | |
良さとイ面才各の安さて~お客様の健康 | |
生云舌と家言十を応援し丶たします。 |
OlderNewer