Skip to content

Instantly share code, notes, and snippets.

@pi-chan
pi-chan / response.xml
Created March 31, 2014 02:26
XML response from Hatena API
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:app="http://www.w3.org/2007/app">
<link rel="first" href="https://blog.hatena.ne.jp/hatena_id/blog_id.hatenablog.com/atom/entry" />
<link rel="next" href="https://blog.hatena.ne.jp/hatena_id/blog_id.hatenablog.com/atom/entry?page=2" />
<title>ブログタイトル</title>
<link rel="alternate" href="http://blog_id.hatenablog.com/"/>
<updated>2013-08-27T15:17:06+09:00</updated>
<author>
<name>hatena_id</name>
@pi-chan
pi-chan / before.rb
Created April 1, 2014 13:45
Using Ruby command line options by Arjan van der Gaag http://arjanvandergaag.nl/blog/using-ruby-command-line-options.html
#!/usr/bin/env ruby -w
# This tranforms input files that look like CSV and strips comments and
# filters out every line not about "Suriname".
# Define some basic variables that control how records and fields
# are defined.
input_record_separator = "\n"
field_separator = ','
output_record_separator = "\n"
output_field_separator = ';'
@pi-chan
pi-chan / after.rb
Created April 1, 2014 13:45
Using Ruby command line options by Arjan van der Gaag http://arjanvandergaag.nl/blog/using-ruby-command-line-options.html
#!/usr/bin/env ruby -w -n -i -F, -l -a
BEGIN { $, = ';' }
print $., *$F unless $F[5] != 'Suriname' || /^# /
@pi-chan
pi-chan / sort_repos.rb
Created April 7, 2014 05:31
sort github repos by stargazers count
require "github_api"
# スター数を知りたいリポジトリ user/name
repos = %W{
allaboutapps/A3GridTableView
AlanQuatermain/AQGridView
norsez/BDDynamicGridViewController
hirohisa/BrickView
phranck/CNGridView
gmoledina/GMGridView
public class MainActivity extends ActionBarActivity {
public Tasks service;
private static final int REQUEST_ACCOUNT_PICKER = 2;
GoogleAccountCredential mCredential;
private static String PREF_ACCOUNT_NAME = "accountName";
static final String TAG = "TasksSample";
final HttpTransport mHttpTransport = AndroidHttp.newCompatibleTransport();
final JsonFactory mJsonFactory = GsonFactory.getDefaultInstance();
@pi-chan
pi-chan / rails-composer
Created May 24, 2014 12:04
rails-composer output
% rails new myapp -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
@pi-chan
pi-chan / Parse.podspec
Last active August 29, 2015 14:02
Parse.podspec
Pod::Spec.new do |s|
s.name = 'Parse'
s.version = '1.2.19'
s.license = { :type => 'Commercial', :text => 'See https://parse.com/about/terms' }
s.platform = :ios, '5.0'
s.summary = 'Parse iOS SDK for developing apps using the Parse cloud app platform.'
s.description = 'The Parse iOS SDK enables access to the parse.com cloud app platform. Requires an account with parse.com. To integrate after adding this pod, continue with step 9 in the QuickStart: (https://parse.com/apps/quickstart).'
s.homepage = 'http://parse.com'
s.author = 'Parse'
s.source = { :http => "http://parse-ios.s3.amazonaws.com/66888d7d226541c93c33aa76e5f8e086/parse-library-#{s.version}.zip" }
@pi-chan
pi-chan / await.cs
Last active August 29, 2015 14:12
awaitで処理が返ってこない
private async Task<Message> GetItemIdFromQueue()
{
AmazonSQSClient client = new AmazonSQSClient( ACCESS_KEY, SECRET_KEY, Amazon.RegionEndpoint.APNortheast1 );
ReceiveMessageRequest req = new ReceiveMessageRequest();
req.MaxNumberOfMessages = 1;
req.QueueUrl = QUEUE_URL;
ReceiveMessageResponse res = await client.ReceiveMessageAsync( req ); // この行
if ( res.HttpStatusCode != System.Net.HttpStatusCode.OK ) {
LogError( res.ToString() );
@pi-chan
pi-chan / wripe.css
Created February 12, 2015 01:04
wri.peでペインを左右半分ずつ + プレビューを少し大きく
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("wri.pe") {
#edit-page-main-pane {
right: 50% !important;
}
#edit-page-main-pane #edit-page-pane-handle {
display: none;
}
#edit-page-container #edit-page-sidebar-pane {
@pi-chan
pi-chan / DownloadAssetBundle.cs
Created April 29, 2015 02:12
BestHttpDownloadAssetBundle
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BestHTTP;