This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
sum(num) | |
FROM | |
generate_series(1, 999) AS t(num) | |
WHERE | |
(num % 3) = 0 | |
OR (num % 5) = 0 | |
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE t ( | |
id int | |
,p cube | |
); | |
CREATE INDEX _idx_p ON t USING gist (p); | |
INSERT INTO t VALUES (1, '(1,2,3)'); | |
EXPLAIN SELECT * FROM t WHERE p <@ '(0,0,0),(3,3,3)'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS t; | |
CREATE TABLE t ( | |
id int PRIMARY KEY | |
,adj int[] | |
); | |
CREATE INDEX _idx_adj on t USING gin (adj); | |
INSERT INTO t VALUES | |
(1, ARRAY[2,3,4,5]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
checkTweet(); | |
$('#input').submit(function(){ | |
var name = $('#name').val(); | |
var tweet = $('#tweet').val(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"quickrun_config for psql | |
unlet! g:quickrun_config | |
let g:quickrun_config = { | |
\ 'sql':{ | |
\ 'command': 'psql', | |
\ 'cmdopt': '-d postgres', | |
\ 'exec': '%c %o -f %s', | |
\ }, | |
\} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION sieve_of_eratosthenes(int) RETURNS SETOF int AS $$ | |
WITH RECURSIVE | |
--数列を用意 | |
t1(n) AS ( | |
SELECT generate_series(2, $1) | |
), | |
t2 (n, i) AS ( | |
--初期化:2で割り切れない集合を作成 | |
SELECT | |
n |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let g:surround_custom_mapping.vim= { | |
\'z': "\"{{{ \r \"}}}" | |
\ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BSONObjBuilder b; | |
b.append( "query", BSONObj() ); // append original BSON object of query | |
b.append( "$maxScan", 1 ); // append special parameter | |
auto_ptr<DBClientCursor> cursor = c.query( ns, Query(b.obj()) ); | |
while( cursor->more() ){ | |
BSONObj p = cursor->next(); | |
cout << p.toString() << endl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS t; | |
CREATE TABLE t ( | |
id int PRIMARY KEY | |
,adj int[] | |
); | |
INSERT INTO t VALUES | |
(1, ARRAY[2,3,4,5]) | |
,(2, ARRAY[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:save_cpo = &cpo | |
set cpo&vim | |
let s:api = { | |
\ 'name': 'log', | |
\ } | |
function! s:api.depends() | |
return ['log'] | |
endfunction |
OlderNewer