Skip to content

Instantly share code, notes, and snippets.

@LuckOfWise
LuckOfWise / 移動累計を求めたい
Last active December 13, 2015 17:48
売上明細的なテーブルで、各ショップ、日ごとに対象の日から1年前までの集計値を求める。 これ合ってんのか??
相関クエリ
select T1.shop_id,
T1.sales_date,
( select sum(cash_amount)
from shop_sales_details T2
where T2.shop_id = T1.shop_id
and T2.sales_date between T1.sales_date + cast('-1 year' as interval) and T1.sales_date
) as cash_amount,
( select sum(other0)
from shop_sales_details T2
# -*- coding: utf-8 -*-
task :backup do
FILES = 3
path = "config/database.yml"
info = YAML.load_file(path)["production"]
backup_dir = "/backup"
unless File.exists?(backup_dir)
Dir::mkdir(backup_dir)
end
@LuckOfWise
LuckOfWise / file0.txt
Created October 5, 2012 07:24
会社に新しいMBAが届いたので開発環境構築メモ ref: http://qiita.com/items/e8eb14e3a3ee71b4f3c0
sudo mkdir /usr/local
sudo chown -R (ログインユーザー) /usr/local
cd /usr/local
ln -s /usr/local/homebrew/bin/brew /usr/local/bin/brew
@LuckOfWise
LuckOfWise / Gemfile
Created October 5, 2012 02:06
twitter-bootstrap-rails ことはじめ ref: http://qiita.com/items/7b7e5934004a49591ed8
gem "twitter-bootstrap-rails"
@LuckOfWise
LuckOfWise / gist:2975981
Created June 23, 2012 00:30
[Android]アカウント設定画面の呼び出し
package com.luckofwise.accountcall;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
public class AccountCallActivity extends Activity {
/** Called when the activity is first created. */
@Override