Skip to content

Instantly share code, notes, and snippets.

<?php
$input = new SplFileObject('php://stdin');
$line = $input->fgets();
list($curKey, $sum) = explode(',', $line);
while (!$input->eof())
{
$line = $input->fgets();
<?php
class Filter
{
const REGEX_TRIM = "[\\x0-\x20\x7f]";
const REGEX_FTRIM = "[\\x0-\x20\x7f\xc2\xa0\xe3\x80\x80]";
public static function presetUtf8($default = '')
{
return function($tainted) use ($default)
--- a/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs
+++ b/OpenTween/Thumbnail/Services/ImgAzyobuziNet.cs
@@ -152,6 +152,7 @@ namespace OpenTween.Thumbnail.Services
{
ImageUrl = url,
ThumbnailUrl = this.ApiBase + "redirect?size=large&uri=" + Uri.EscapeDataString(url),
+ FullSizeImageUrl = this.ApiBase + "redirect?size=full&uri=" + Uri.EscapeDataString(url),
TooltipText = null,
};
}
@upsilon
upsilon / gist:11322044
Created April 26, 2014 14:49
WinForms のデータバインディングに関する妄想
this.LabelScreenName.DataBindings.Add("Text", this.bindingSource, "ScreenName");
var binding = new Binding("Text", this.bindingSource, "Name");
binding.Format += (o, e) => e.Value = WebUtility.HtmlDecode(e.Value);
this.LabelName.DataBindings.Add(binding);
// ↑これを
// ↓ こんな感じに書きたい
BindToText(this.LabelScreenName, this.bindingSource,
@upsilon
upsilon / gist:6e65858d4ae7d693a24c
Created July 22, 2014 10:09
Tweenで自分のツイートに対する公式RTをDynamicQueryで振り分け
it.ScreenName = "自分のスクリーンネーム" && it.RetweetedId != 0
@upsilon
upsilon / gist:7d69889abdfd4b6b0c2b
Last active August 29, 2015 14:04
stable-3.8.x 関連のバックポートのミスなど
stable-3.8.x の分岐点以降に続く master ブランチのコミットで、2012/02/08 (stable-3.8.x ブランチが分岐した最初の 543738d5 のコミット日時) までにコミットされた履歴を抽出する
git log stable-3.8.x...master --until="Wed Feb 8 08:58:52 2012 +0900"
--
Bug (バグ) #2408: サイドバナーのRSSリーダーでURLに特殊文字が含まれる場合に正しいRSSフィードが得られない
https://redmine.openpne.jp/issues/2408
* cherry-pick: 済み (543738d5) コミットメッセージ修正ミス
@upsilon
upsilon / gist:7b7980fb225ee64ef280
Created October 12, 2014 08:40
UserStreamsの user_update イベントで source.listed_count が null になる
{
"created_at": "Sun Oct 12 08:29:05 +0000 2014",
"event": "user_update",
"source": {
"contributors_enabled": false,
"created_at": "Thu Aug 19 19:01:26 +0000 2010",
"default_profile": false,
"default_profile_image": true,
"description": "https://t.co/SLFC3SuxO7 <>\"",
"favourites_count": -1,
@upsilon
upsilon / gist:b36992d52044fa56800b
Last active August 29, 2015 14:16
opOpenSocialPluginでアルバム画像をアップロードする
<?php
// http://oauth.googlecode.com/svn/code/php/OAuth.php を使用
require_once 'OAuth.php';
// api.php の URL
$baseUri = 'http://sns.example.com/api.php';
// http://sns.example.com/pc_backend.php/connection/new で発行
// 使用するAPIに「OpenSocial API: メンバー/フレンド情報の取得」を選択
@upsilon
upsilon / gist:3c8c3b2513501602c278
Created May 23, 2015 09:40
Equalsメソッドのテストを補助するやつ
namespace Program
{
internal static class TestUtils
{
public static void CheckEqualsMethod<T>(params Expression<Func<T, string>>[] fieldAccessLambda)
where T : new()
{
foreach (var lambda in fieldAccessLambda)
{
var assign = ConvertFieldAccessToAssign(lambda);
" シフト移動幅
set shiftwidth=2
" タブ幅
set tabstop=2
" タブをスペースにして入力
set expandtab
" 行番号を表示