Skip to content

Instantly share code, notes, and snippets.

🍢

Matt, Murahashi Kenichi sanemat

🍢
Block or report user

Report or block sanemat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View multi_byte_string
$ php -v
PHP 5.2.10 (cli) (built: Jun 21 2009 11:10:43)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
$ php -a
php > $string = "webデザイン97";
php > echo $string[0];
w
php > echo $string[1];
e
View gist:259994
#
require 'rubygems'
require 'spec'
require 'lru_cache'
describe LruCache, 'when Lru called' do
before(:all) do
puts 'Test Kaisi'
end
View access_test.rb
#!/usr/bin/env ruby
# coding: utf-8
require 'net/http'
require 'time'
def show(path, res)
puts "---- #{path} ----"
puts "Response: #{res.code} #{res.message}"
puts "Content-Length: #{res['Content-Length']}"
View gist:271088
(サンプル問題 問題No:201
■Q1.桁数の不明な整数xの各位の値を合計したものを返す関数を作りなさい。(例:x=123 の場合、1 + 2 + 3 = 6 となる)
われながらひどいこたえ
irb(main):012:0> def plus_each_integer(int)
irb(main):013:1> answer = 0
irb(main):014:1> int.to_s.split(//).each{|byte| answer += byte.to_i}
irb(main):015:1> answer
irb(main):016:1> end
View sample config.ru
# To use with thin
# thin start -p PORT -R config.ru
require File.join(File.dirname(__FILE__), 'config', 'preinitializer')
require File.join(File.dirname(__FILE__), 'lib', 'htrsk')
run Htrsk.new :disable=> :run, :environment => :production
View gist:490765
ruby-1.9.2-rc1 > (1..100).map{|i| (i % 15 == 0) ? "FizzBazz" : i }.map{|i| (i % 3 == 0) ? "Fizz" : i }.map{ |i| (i % 5 == 0) ? "Bazz" : i }
=> [1, 2, "Fizz", 4, "Bazz", "Fizz", 7, 8, "Fizz", "Bazz", 11, "Fizz", 13, 14, "FizzBazz", 16, 17, "Fizz", 19, "Bazz", "Fizz", 22, 23, "Fizz", "Bazz", 26, "Fizz", 28, 29, "FizzBazz", 31, 32, "Fizz", 34, "Bazz", "Fizz", 37, 38, "Fizz", "Bazz", 41, "Fizz", 43, 44, "FizzBazz", 46, 47, "Fizz", 49, "Bazz", "Fizz", 52, 53, "Fizz", "Bazz", 56, "Fizz", 58, 59, "FizzBazz", 61, 62, "Fizz", 64, "Bazz", "Fizz", 67, 68, "Fizz", "Bazz", 71, "Fizz", 73, 74, "FizzBazz", 76, 77, "Fizz", 79, "Bazz", "Fizz", 82, 83, "Fizz", "Bazz", 86, "Fizz", 88, 89, "FizzBazz", 91, 92, "Fizz", 94, "Bazz", "Fizz", 97, 98, "Fizz", "Bazz"]
View google chrome error
/opt/google/chrome/google-chrome: /lib64/libz.so.1: no version information available (required by /opt/google/chrome/google-chrome)
/opt/google/chrome/google-chrome: /lib64/libz.so.1: no version information available (required by /opt/google/chrome/google-chrome)
/opt/google/chrome/chrome: /lib64/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
/opt/google/chrome/chrome: /lib64/libz.so.1: no version information available (required by /opt/google/chrome/chrome)
[1:1:84933507:ERROR:base/native_library_linux.cc(28)] dlopen failed when trying to open /opt/google/chrome/libpdf.so: /opt/google/chrome/libpdf.so: file too short
[12434:12434:84960857:ERROR:base/file_util_posix.cc(724)] Couldn't mmap 34, errno 22
[12434:12434:84960940:FATAL:app/resource_bundle.cc(221)] Check failed: success. Failed to load /opt/google/chrome/resources.pak
You can’t perform that action at this time.