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
#encoding: utf-8 | |
class String | |
def make_ngram(n) | |
ary = self.split(//) | |
ngram_ary = [] | |
p = ary.length | |
for i in 0..(p - n) do | |
ngram_ary << ary[i...(i + n)] | |
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
class Foo | |
def self.foo(method) | |
define_method(method) do | |
puts "Foo##{method} called." | |
end | |
end | |
foo :bar | |
foo :baz | |
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
class Bar | |
class << self | |
def self.bar(method) | |
define_method(method) do | |
puts "Bar.#{method} called." | |
end | |
end | |
bar :foo | |
bar :baz |
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
#tweetから記事リンクがあるものだけを取得する。 | |
#coding utf-8 | |
require 'twitter' | |
require 'net/http' | |
require 'uri' | |
class LinkGrabber | |
def initialize(user) |
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
#coding: UTF-8 | |
require 'rss' | |
class RSSChecker | |
def initialize | |
@blogs = | |
[ | |
"http://lifehack2ch.livedoor.biz/index.rdf", | |
"http://www.scienceplus2ch.com/index.rdf", | |
"http://blog.livedoor.jp/domesaka/index.rdf", |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string-array name="sample"> | |
<item>FOO</item> | |
<item>BAR</item> | |
<item>BAZ</item> | |
</string-array> | |
</resources> |
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
package com.sugaishun.sample; | |
import java.io.InputStream; | |
import java.net.URL; | |
import java.util.List; | |
import java.util.Locale; | |
import org.joda.time.DateTime; | |
import android.content.Context; |
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
package com.sugaishun.sample; | |
import java.util.HashMap; | |
import android.graphics.drawable.Drawable; | |
public class ImageCache { | |
private static HashMap<String, Drawable> cache = new HashMap<String, Drawable>(); | |
public static Drawable get(String key) { |
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
var classes = [ | |
'plugin-free_area plugin-box', | |
'maist' | |
]; | |
var ids = [ | |
'ad' | |
]; | |
var removeAdByClass = function(className) { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | |
<!-- ベースのグラデーション --> | |
<item android:state_pressed="true"> | |
<shape android:shape="rectangle"> | |
<gradinent | |
android:angle="270" | |
android:endColor="#009FD9" | |
android:startColor="#55CBF6" /> | |
</shape> |
OlderNewer