Skip to content

Instantly share code, notes, and snippets.

View chitoku-k's full-sized avatar
🐱
Becoming a cat

Chitoku chitoku-k

🐱
Becoming a cat
View GitHub Profile
@chitoku-k
chitoku-k / EnumerableExtensions.cs
Created March 3, 2015 10:07
LINQ 微妙に拡張シリーズ
using System;
using System.Collections.Generic;
using System.Linq;
public static class EnumerableExtensions
{
private static int IndexOfByForEach<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate)
{
int index = 0;
foreach (var item in source)
@chitoku-k
chitoku-k / Ochimpo.xaml
Last active August 29, 2015 14:16
おちんぽ
<Window x:Class="Ochimpo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Title="おちんぽ。" Height="350" Width="525">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">
おちんぽ。
</TextBlock>
</Window>
@chitoku-k
chitoku-k / tana3n.js
Created February 21, 2015 06:57
ニーソキモチイイイイイイイイイ
/* https://twitter.com/tana3n/status/497753779177926657 */
var STATUS_ID = "497753779177926657";
var Twitter = require("twitter")({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
});
@chitoku-k
chitoku-k / 悲報ダメです.js
Last active August 29, 2015 14:15
悲報ダメです
var Twitter = require("twitter");
var followers = [];
var client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_TOKEN,
access_token_secret: process.env.TWITTER_ACCESS_TOKEN_SECRET,
});
if (process.argv.some(function (x) { return x === "-h" })) {
console.log("cocoa 1.0.0");
console.log("使用法: cocoa [オプション]");
console.log("コマンド");
console.log("-a - はぁ…ココアちゃん…!");
console.log("-b - cocはぁ…ココアちゃん…!");
console.log("-c - はぁ…ココアちゃん…!");
console.log("-d - はぁ…ココアちゃん…!");
console.log("-e - はぁ…ココアちゃん…!");
console.log("-f - はぁ…ココアちゃん…!");
@chitoku-k
chitoku-k / ObservableKeyedCollection.cs
Created December 31, 2014 15:53
ObservableKeyedCollection
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
/// <summary>
/// キーが値に埋め込まれているコレクションを提供します。
/// </summary>
/// <typeparam name="TKey">コレクション内のキーの型。</typeparam>
/// <typeparam name="TItem">コレクション内の項目の型。</typeparam>
public class ObservableKeyedCollection<TKey, TItem> : KeyedCollection<TKey, TItem>, INotifyCollectionChanged
@chitoku-k
chitoku-k / 01 main.c
Last active August 29, 2015 14:12
JAN コードチェックプログラム
#define to_int(code, digit, length) do { \
for (int i = 0; i < length; i++) \
{ \
code[i] = digit[i] - 48; \
} \
} while (0)
#include <stdio.h>
#include <string.h>
@chitoku-k
chitoku-k / MainWindow.xaml
Created December 26, 2014 06:35
DataTemplate.Triggers
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding}" Value="0">
<!-- ここで適当にテンプレートを変更 -->
</DataTrigger>
</DataTemplate.Triggers>
@chitoku-k
chitoku-k / ObjectExtensions.cs
Created December 18, 2014 10:40
ObjectExtensions
using System;
public static class ObjectExtensions
{
public static void Validate(this object o, string paramName)
{
if (o == null)
{
throw new ArgumentNullException(paramName);
}
@chitoku-k
chitoku-k / Program.cs
Created November 21, 2014 09:09
XML で設定読み書きするやつ
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
namespace TestApp
{
public class Program
{