Skip to content

Instantly share code, notes, and snippets.

View kikuchy's full-sized avatar

Hiroshi Kikuchi kikuchy

View GitHub Profile
@kikuchy
kikuchy / indefOf.js
Created February 1, 2013 12:27
「文字列aの中に文字列bが何回出現するか数えなさい。ただしString.indexOf()を使うならindexOf()を定義しなさい」という課題で書いたもの。もっとちゃんと最適化したい。
var a = "kdindsuqncxkem,dsf";
var b = "ds";
String.prototype.indexOf = function(compStr, offset){
offset = offset || 0;
while((this.length - compStr.length) >= offset){
var isCharEq = true;
for(var i = 0; i < compStr.length; i++){
if(!(isCharEq &= this[i + offset] === compStr[i])) break;
}
@kikuchy
kikuchy / Portfile-leiningen-2.1.3.diff
Created May 1, 2013 01:20
Macportsに入ってたleiningenが古かったからPortfile色々いじってみた。インストールは上手く行ったけど、これで正しいPortfileの書き方になってるのかわからないし、メンテナーさんに送るのも面倒なのでとりあえずうp
--- Portfile-leiningen-1.6.1.1 2013-05-01 09:01:03.000000000 +0900
+++ /opt/local/var/macports/sources/rsync.macports.org/release/ports/devel/leiningen/Portfile 2013-05-01 10:10:36.000000000 +0900
@@ -3,7 +3,7 @@
PortSystem 1.0
name leiningen
-version 1.6.1.1
+version 2.1.3
categories devel java
maintainers ieure
@kikuchy
kikuchy / Stage.cpp
Last active December 18, 2015 07:38
後でオセロに使うやつ(未検証)
#include <stdlib.h>
#include <string.h>
struct Point {
int x;
int y;
Point(int x, int y);
};
Point::Point(int x, int y)
@kikuchy
kikuchy / app.js
Last active December 19, 2015 06:29
Passportを使ったテスト
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http')
, path = require('path');
// ハッシュ値を求めるために必要なもの
@kikuchy
kikuchy / gist:6374338
Last active December 21, 2015 22:19
見つけた面白いライブラリとか

マルチプラットフォーム・多言語対応のリンカブルなgitのAPI

上のlibgit2のphp向けバインディング。 CentOS 6.3 64bit環境にインストール。 cmakeが入ってなかったので入れた。 phpizeのインストールには、sudo yum install php-devel.x86_64が必要だった。 pcre-develも必要。 全部入れてから./configureしないとコンパイル通らない。

@kikuchy
kikuchy / fuel-crash-course.jp.md
Last active December 22, 2015 00:39
Fuel Crash Course (http://ucf.github.io/fuelphp-crash-course/) を日本語にしてみてる。

#Fuel 特急講座

始める前に

このチュートリアルは、簡単なメッセージングアプリを作りながら Fuel PHP フレームワークについて、あなたに手を動かして学んでもらうためのものです。

必要なもの

あなたの Linux に以下のものを入れておいてください。

@kikuchy
kikuchy / deploy.sh
Last active December 22, 2015 23:59
deploy script to run FuelPHP migration on Windows Azure Web site
#!/bin/bash
# ----------------------
# KUDU Deployment Script
# ----------------------
# Helpers
# -------
exitWithMessageOnError () {
@kikuchy
kikuchy / Web.config
Created September 13, 2013 14:01
rewrite config for FuelPHP running on Windows Azure
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
[url=http://go.microsoft.com/fwlink/?LinkId=169433]http://go.microsoft.com/fwlink/?LinkId=169433[/url]
-->
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
@kikuchy
kikuchy / Web.config
Created September 13, 2013 17:17
for FuelPHP public folder running on Windows Azure Web site
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
@kikuchy
kikuchy / README.txt
Last active December 25, 2015 11:59 — forked from nijitaro/README.txt
カーニング対象の要素の中にHTMLタグが混じっていると正常に動作しない問題を解消したバージョン
http://fladdict.net/blog/2011/02/auto-kerning.html
グローバル汚染を無くしたのと、jQueryらしくかけるようにしました。
// 引数なしの場合デフォルトのカーニングが摘要される。
$(selector).FLAutoKerning();
// 引数を入れた場合、そのカーニングが摘要される。
$(selector).FLAutoKerning(myKerningInfo);
ライセンスは元のFLAutoKerning.jsを継承します。