Skip to content

Instantly share code, notes, and snippets.

# coding: utf-8
import urllib
import json
def translate(text):
params = {
'appId': 'myAppId',
'text': text,
'from': 'en',
# coding: utf-8
import urllib
import json
def identify_lang(text):
params = {
'appId': 'myAppId',
'text': text,
}
@taogawa
taogawa / Program.cs
Created June 18, 2012 14:45
クラスのメソッド名一覧+アクセス修飾子をとる
using System;
using System.Linq;
using System.Diagnostics;
using System.Reflection;
namespace foo
{
class Program
{
static void Main(string[] args)
@taogawa
taogawa / Dapper1.cs
Last active December 10, 2015 11:29
Dapper&PetaPoco
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using Dapper;
namespace Foo
{
// Dapper.Rainbowでは主キーの列名はIdが前提になっている
public class User
@taogawa
taogawa / DapperInsert.cs
Last active December 10, 2015 15:19
DapperでInsert&Update
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using Dapper;
namespace Foo
{
// Dapper.rainbowでは主キーの列名はIdが前提になっている
public class User
@taogawa
taogawa / wave.py
Created January 21, 2013 15:54
正弦波、矩形波、三角波、のこぎり波
# coding: utf-8
"""
以下のURLを参考にさせていただきました
http://d.hatena.ne.jp/mohayonao/20110121/1295611356
http://aidiary.hatenablog.com/entry/20110607/1307449007
"""
import math
import array
@taogawa
taogawa / gist:4707771
Last active December 12, 2015 03:29
ListをDataTableへ変換する
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using FastMember;
namespace App
{
// ここを参考にしました
// http://stackoverflow.com/questions/564366/convert-generic-list-enumerable-to-datatable
using System;
using System.Collections.Generic;
using System.Linq;
using FastMember;
namespace Mapper
{
public class Mapper
{
public static IEnumerable<TDest> MapTo<TSrc, TDest>(IEnumerable<TSrc> src)
@taogawa
taogawa / Money.cs
Last active December 14, 2015 17:29
テスト駆動開発入門 (C#)
using System;
using System.Collections.Generic;
namespace Money
{
public class Money : IExpression
{
internal int amount;
public string Currency { get; internal set; }
@taogawa
taogawa / recommendations.rb
Last active December 15, 2015 00:49
集合知プログラミング ch.2
critics={'Lisa Rose'=> {'Lady in the Water'=> 2.5, 'Snakes on a Plane'=> 3.5,
'Just My Luck'=> 3.0, 'Superman Returns'=> 3.5, 'You, Me and Dupree'=> 2.5,
'The Night Listener'=> 3.0},
'Gene Seymour'=> {'Lady in the Water'=> 3.0, 'Snakes on a Plane'=> 3.5,
'Just My Luck'=> 1.5, 'Superman Returns'=> 5.0, 'The Night Listener'=> 3.0,
'You, Me and Dupree'=> 3.5},
'Michael Phillips'=> {'Lady in the Water'=> 2.5, 'Snakes on a Plane'=> 3.0,
'Superman Returns'=> 3.5, 'The Night Listener'=> 4.0},
'Claudia Puig'=> {'Snakes on a Plane'=> 3.5, 'Just My Luck'=> 3.0,
'The Night Listener'=> 4.5, 'Superman Returns'=> 4.0,