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 'pp' | |
data = [ | |
{:code => 001, :item => {:name => 'jan'}}, | |
{:code => 001, :item => {:name => 'jan'}}, | |
{:code => 001, :item => {:name => 'aaa'}}, | |
{:code => 002, :item => {:name => 'feb'}}, | |
{:code => 002, :item => {:name => 'aab'}}, | |
{:code => 003, :item => {:name => 'mar'}}, | |
{:code => 003, :item => {:name => 'abb'}}, |
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 Bar | |
def initialize(options={}) | |
@options = options | |
end | |
def method_missing(name, *args) | |
if name =~ /=$/ | |
@options[name.to_s.chop.to_sym] = args.first | |
else |
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
// Call from Activity | |
String url; | |
public void loadUrl(String url) { | |
if (mWebView == null) return; | |
if (this.url == null) { | |
mWebView.loadUrl(url); | |
this.url = url; | |
} | |
} |
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
<?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> |
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
var classes = [ | |
'plugin-free_area plugin-box', | |
'maist' | |
]; | |
var ids = [ | |
'ad' | |
]; | |
var removeAdByClass = function(className) { |
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
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 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
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 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
<?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 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
#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 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
#tweetから記事リンクがあるものだけを取得する。 | |
#coding utf-8 | |
require 'twitter' | |
require 'net/http' | |
require 'uri' | |
class LinkGrabber | |
def initialize(user) |