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
| require 'msgpack/rpc' | |
| c = MessagePack::RPC::Client.new('localhost',9090) | |
| c.call(:print, 'hello') #=> サーバー側に'hello'が表示される | |
| c.notify(:print, 'hello') #=> 何も起きない |
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 fizzbuzz(num Int) RETURNS SETOF Text AS $$ | |
| WITH RECURSIVE | |
| fizz(f) AS ( | |
| SELECT ARRAY[NULL,NULL,'fizz'] | |
| ) | |
| ,buzz(b) AS ( | |
| SELECT ARRAY[NULL,NULL,NULL,NULL,'buzz'] | |
| ) | |
| ,fizzbuzz(fb) AS ( | |
| SELECT |
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
| nnoremap <SID>[tweetvim] <Nop> | |
| nmap <Leader>t <SID>[tweetvim] | |
| nnoremap <silent> <SID>[tweetvim]s :<C-u>TweetVimSay<CR> | |
| nnoremap <silent> <SID>[tweetvim]t :<C-u>call <SID>tweetvim_open('TweetVimHomeTimeline')<CR> | |
| nnoremap <silent> <SID>[tweetvim]m :<C-u>call <SID>tweetvim_open('TweetVimMentions')<CR>gnmgn | |
| function! s:check_tweetvim_buffer() | |
| let bufnlist = tabpagebuflist() | |
| for num in bufnlist | |
| if getbufvar(num, '&filetype') ==# 'tweetvim' |
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
| require 'msgpack' | |
| require 'thread' | |
| class ProcessPool | |
| def initialize(num_process, args={}) | |
| queue_size, worker_class = parse_args([ | |
| :queue_size, nil, | |
| :worker_class, Worker, | |
| ], args) |
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
| call textobj#user#plugin('rubyexpr', { | |
| \ '-': { | |
| \ '*pattern*': ['#{', '}'], | |
| \ 'select-a': 'a#', | |
| \ 'select-i': 'i#', | |
| \ }, | |
| \ }) |
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
| nnoremap <buffer> <SID>[ghcmod] <Nop> | |
| nmap <buffer> <Leader>h <SID>[ghcmod] | |
| nnoremap <buffer> <silent> <SID>[ghcmod]y :<C-u>call <SID>paste_type_signature()<CR> | |
| function! s:paste_type_signature() | |
| try | |
| let signature = expand('<cword>').' :: '.ghcmod#type()[1] | |
| catch | |
| return | |
| endtry |
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 FUNCTION eval(text); | |
| CREATE FUNCTION eval(sql Text) RETURNS SETOF Record AS $$ | |
| BEGIN | |
| RETURN QUERY EXECUTE sql; | |
| RETURN; | |
| END; | |
| $$ LANGUAGE plpgsql; | |
| SELECT * FROM eval('SELECT * FROM( VALUES (1,''a''), (3,''b'') ) AS t') AS (i Int, c Text); |
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
| job.setOutputFormatClass(classOf[TextOutputFormat]) // エラー | |
| job.setOutputFormatClass(classOf[TextOutputFormat[Text, Text]]) // OK |
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
| yum_key "Impala-GPG-KEY" do | |
| url "http://beta.cloudera.com/impala/redhat/6/x86_64/impala/RPM-GPG-KEY-cloudera" | |
| action :add | |
| end | |
| yum_repository "Impala" do | |
| url "http://beta.cloudera.com/impala/redhat/6/x86_64/impala/0/" | |
| gpg "Impala-GPG-KEY" | |
| action :add | |
| end |
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
| scala> import org.fluentd.logger.scala.FluentLoggerFactory | |
| import org.fluentd.logger.scala.FluentLoggerFactory | |
| scala> val l = FluentLoggerFactory.getLogger("debug") | |
| l: org.fluentd.logger.scala.FluentLogger = org.fluentd.logger.FluentLogger{tagPrefix=debug,sender=localhost_24224_3000_1048576} | |
| scala> l.log("hoge", Map("a" -> 1)) | |
| <console>:12: error: overloaded method value log with alternatives: | |
| (label: String,data: scala.collection.immutable.Map[String,java.lang.Object])Boolean <and> | |
| (label: String,data: scala.collection.mutable.Map[String,java.lang.Object])Boolean |