Skip to content

Instantly share code, notes, and snippets.

View mokemokechicken's full-sized avatar

Ken Morishita mokemokechicken

View GitHub Profile
@mokemokechicken
mokemokechicken / gist:3008940
Created June 28, 2012 03:59
Draw with CGContext
UIGraphicsBeginImageContext(imgSize);
//
CGContextRef context = UIGraphicsGetCurrentContext();
//
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.drawView.layer.contents = image;
class DownloadModelBase(object):
DOWNLOAD_NEW = 1 << 0
DOWNLOAD_MORE = 1 << 1
FINISH_DOWNLOAD = 1 << 2
@classmethod
def start(cls):
return DownloadModelIdle() # initial state
def process(self, action):
if self.mask & action:
@mokemokechicken
mokemokechicken / gist:3088696
Created July 11, 2012 07:23
OpenCVの物体検出作業メモ
= 命名
*.dat: ファイルのリストが改行区切り
*.idx: ファイルのリストが改行区切りであるのに加えて、正解画像の位置が後ろにくっついている形式
= compile in linux
TBB on
http://opencv.willowgarage.com/wiki/InstallGuide
typedef void (^YMMKEditRegionBlock)(YMMKRegionNotificationInfo *regionInfo);
public interface ILLEntityRepository<TEntity> where TEntity : class
{
IEnumerable<TEntity> FetchAll();
void Add(TEntity entity);
void Edit(TEntity entity);
void Delete(TEntity entity);
void Commit();
}
public interface ILLEntityRepositoryContext
@mokemokechicken
mokemokechicken / gist:3444624
Created August 24, 2012 01:49
アクセスログからユーザの滞在時間分布を計算する By C#
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using MokemokeDataSource;
namespace UserBehavior
{
@mokemokechicken
mokemokechicken / gist:3445257
Created August 24, 2012 03:56
MockRepository
class MockRepositoryContext : ILLEntityRepositoryContext
{
Dictionary<Type, object> _hash = new Dictionary<Type, object>();
public ILLEntityRepository<TEntity> GetRepository<TEntity>() where TEntity : class
{
var type = typeof(TEntity);
if (!_hash.ContainsKey(type))
{
_hash[type] = new MockRepository<TEntity>();
}
@mokemokechicken
mokemokechicken / gist:3487554
Created August 27, 2012 11:14
FetchPagedContent From Azure Table Storage
private IEnumerable<TEntity> FetchPagedContent(DataServiceQuery<TEntity> query)
{
// http://msdn.microsoft.com/en-us/library/ee358709.aspx
// http://teruc.dnsalias.net/blog/2012/04/19/171
// With a paged response from the service, use a do...while loop
// to enumerate the results before getting the next link.
string nextPartitionKey = null;
string nextRowKey = null;
QueryOperationResponse<TEntity> response;
do
@mokemokechicken
mokemokechicken / gist:3608205
Created September 3, 2012 09:57
MVC4 Current Location
$(function () {
var watchID;
$("#watch").click(function () {
if (Modernizr.geolocation) {
var nav = window.navigator;
if (nav != null) {
var geoloc = nav.geolocation;
watchID = geoloc.watchPosition(showMap, handle_errors);
}
}
set tabstop=4
set expandtab
set autoindent
set shiftwidth=4
filetype off
set rtp+=~/.vim/vundle/
call vundle#rc()