Skip to content

Instantly share code, notes, and snippets.

View 2no's full-sized avatar
🥳

Kazunori Ninomiya 2no

🥳
View GitHub Profile
@2no
2no / gist:3293183
Created August 8, 2012 07:34
FizzBuzz test
for(var i=1;i<=100;i++)console.log((i%3?"":"Fizz")+(i%5?"":"Buzz")||i)
i=0;while(++i<=100)console.log((i%3?"":"Fizz")+(i%5?"":"Buzz")||i)
@2no
2no / app.js
Created April 1, 2012 06:40
BVH データ読み込み JS
var aachan = new Bvh();
var nocchi = new Bvh();
var kashiyuka = new Bvh();
aachan.load({
src: "./bvh/aachan.bvh",
complete: function(xhr) {
console.log("あーちゃんの BVH データ読み込み完了");
nocchi.load({
src: "./bvh/nocchi.bvh",
@2no
2no / app.js
Created March 19, 2012 14:37
LINE Unofficial API test
var LINE = require('./line.js');
var line = new LINE();
var email = 'your email';
var password = 'your password';
line.login(email, password, function(error, result) {
if (error) {
return;
}
@2no
2no / nginx.conf
Created February 26, 2012 16:01
dotCloud に WordPress を wordpress ディレクトリにインストールした場合の nginx.conf サンプル
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ /\. {
@2no
2no / nginx.conf
Created February 26, 2012 15:49
dotCloud & PHP で、PATH_INFO を考慮した nginx.conf
try_files $uri $uri/ /index.php$uri;
location ~ ".+\.php($|/.*)" {
if ( -f /home/dotcloud/current/maintenance) {
return 503;
}
fastcgi_pass unix:/var/dotcloud/php5-fpm.sock;
include fastcgi_params;
include /home/dotcloud/current/*fastcgi.conf;
@2no
2no / resource_access_test.java
Created January 8, 2012 20:42
com.android.internal.R のリソースにアクセス
package com.wakuworks.test;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
// 例)QuickSearchBox の表示
// 参考:http://mpigulski.blogspot.com/2011/03/accessing-comandroidinternalr-resources.html
@2no
2no / temp_conv.php
Created December 6, 2011 07:10
摂氏<->華氏 変換
<?php
$c = 5.0 * ($deg - 32.0) / 9.0; // 摂氏
$f = 9.0 / (5.0 * $deg) + 32.0; // 華氏
printf('%.1f', $c);
printf('%.1f', $f);
@2no
2no / trim.as
Created October 24, 2011 11:02
Flash でトリム?
trace("    hogehoge     ".replace(/^[\s\t\r\n\0\0xB ]*|[\s\t\r\n\0\0xB ]*$/sg, ""));
@2no
2no / sample.php
Created September 11, 2011 09:10
TwitterOAuth でアイコンや背景画像が変更出来るように修正
<?php
/** @see TwitterAOauth */
require_once 'twitteroauth/twitteroauth.php';
$consumer_key = 'xxx';
$consumer_secret = 'xxx';
$oauth_token = 'xxx';
$oauth_token_secret = 'xxx';
@2no
2no / Variables.php
Created August 21, 2011 06:57
自動的に文字列を UTF-8 に変換し、NULL バイト文字を削除する
<?php
class Variables extends ArrayObject
{
/**
* 取得候補の文字コード
*
* @var string
*/
const DETECT_ORDER_ENCODING = 'UTF-8, SJIS-win, eucJP-win';