Skip to content

Instantly share code, notes, and snippets.

View 2no's full-sized avatar
🥳

Kazunori Ninomiya 2no

🥳
View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / gist:3824817
Created October 3, 2012 03:27
Grunt で js を minify して gzip 圧縮
// 個別で js を minify して gzip したかったので、こんな感じになった
// ファイル名などにスペースが入ってた時どうするのか
module.exports = function(grunt) {
'use strict';
var src = 'shared/js/*.js',
files = grunt.file.expandFiles(src),
suffix = '.min',
minFiles = {},
gzFiles = {};
@2no
2no / exsample.js
Created November 24, 2012 12:42
jQuery.timeline.js - アニメーションタイムライン
// jQuery、timeline.js を事前に読み込んでおく必要あり
//
// timeline.js について
// - http://hitsujiwool.tumblr.com/post/31191259501/timeline-js
// - https://github.com/hitsujiwool/timeline
// 使い方1:一括指定して実行
var totalFrames = 200,
tl = $("div").timeline(totalFrames)
@2no
2no / grunt.js
Last active December 13, 2015 21:18
某サイトのマネ。Resource.get をテンプレートに用意して、更新日時を src の最後に追加してキャッシュ対策。 $ npm install grunt-contrib grunt-templater ejs
module.exports = function(grunt) {
'use strict';
var
/**
* ルートパス
*
* @constant
* @type {string}