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
<?php
function GetVersion($command, $pattern = '/([\d.]*[\d])/') {
if (preg_match($pattern, shell_exec($command), $matches)) {
return $matches[1];
}
return false;
}
$versions = [
'php' => phpversion(),
@chitoku-k
chitoku-k / HappyBirthday.cs
Created March 25, 2014 06:45
お誕生日おめでとう!
using System;
using System.Linq;
public class HappyBirthday
{
public static void ShowHappyBirthday()
{
Console.WriteLine(string.Concat("Happy Birthday!".Select(x => new String(x, 3))));
}
}
@chitoku-k
chitoku-k / 20140515001854.html
Created May 14, 2014 15:22
Twitter Activity API Response (Maintenance)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-us">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Twitter / Maintenance</title>
<link href="//abs.twimg.com/favicons/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="//abs.twimg.com/errors/fullscreen_errors.css">
</head>
@chitoku-k
chitoku-k / Program.cs
Last active August 29, 2015 14:01
Base class test
class Program
{
static void Main(string[] args)
{
new A();
new B();
}
}
class A
@chitoku-k
chitoku-k / LazyBitmapImage.cs
Last active August 29, 2015 14:02
LazyImageBehavior
using System;
using System.IO;
using System.Net;
using System.Net.Cache;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
public static class LazyBitmapImage
{
public static Task<BitmapImage> GetImage(Uri uri)
@chitoku-k
chitoku-k / 進捗.php
Last active August 29, 2015 14:09
進捗どうですか
<?php
header('Content-Type: text/html; charset=UTF-8');
$progress = rand(0, 1) ? '進捗しました!' : '進捗ダメです(^_^;)';
?>
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0">
<title>進捗どうですか</title>
</head>
@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
{
@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 / MainWindow.xaml
Created December 26, 2014 06:35
DataTemplate.Triggers
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding}" Value="0">
<!-- ここで適当にテンプレートを変更 -->
</DataTrigger>
</DataTemplate.Triggers>
@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>