Skip to content

Instantly share code, notes, and snippets.

View rainerborene's full-sized avatar

Rainer Borene rainerborene

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.032740931957960129</real>
<key>Green Component</key>
<real>0.032747700810432434</real>
@rainerborene
rainerborene / ctrlp.vim
Last active November 22, 2017 13:52
Close buffer via <C-@> using CtrlP
let g:ctrlp_buffer_func = { 'enter': 'CtrlPMappings' }
function! CtrlPMappings()
nnoremap <buffer> <silent> <C-@> :call <sid>DeleteBuffer()<cr>
endfunction
function! s:DeleteBuffer()
let path = fnamemodify(getline('.')[2:], ':p')
let bufn = matchstr(path, '\v\d+\ze\*No Name')
exec "bd" bufn ==# "" ? path : bufn
class SocialProxy < SimpleDelegator
attr_reader :auth
def initialize(auth)
@auth = auth
@provider = auth.provider.to_sym
case @provider
when :facebook then require 'koala'
when :twitter then require 'twitter'

data

weekday | start_time | end_time
---------+------------+----------
      6 | 17:30:00   | 00:00:00
      7 | 11:30:00   | 01:00:00
(2 rows)

schema

id | ancestry | path | created_at
--------+---------------+---------------------------------------------------------+----------------------------
213703 | 213701/213702 | {1397457810,213702,1397457473,213701,1397457945,213703} | 2014-04-14 06:45:45.878378
213718 | 213701 | {1397457473,213701,1397482294,213718} | 2014-04-14 13:31:34.509714
213701 | | {1397457473,213701} | 2014-04-14 06:37:53.96286
213725 | 213701 | {1397457473,213701,1397493839,213725} | 2014-04-14 16:43:59.824504
213702 | 213701 | {1397457473,213701,1397457810,213702} | 2014-04-14 06:43:30.375029
213701 | | {1397457473,213701} | 2014-04-14 06:37:53.96286
213697 | 213696 | {1397452306,213696,1397452646,213697} | 2014-04-14 05:17:26.964411
213696 | | {1397452
--- Available models:
---
--- ActsAsTaggableOn::Tag
--- ActsAsTaggableOn::Tagging
SELECT "tags"."name",
COUNT(*),
bool_or("taggings"."tagger_id" = $1)
FROM "tags"
INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id"
@rainerborene
rainerborene / classification_query.rb
Last active August 29, 2015 14:01
Classification Query Object
class ClassificationQuery
Tag = ActsAsTaggableOn::Tag
Tagging = ActsAsTaggableOn::Tagging
def initialize(bill, tagger = nil)
@bill, @tagger = bill, tagger
end
def count
relation = Tag.select(Tag[:name], Arel.star.count).where(
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `async_exec'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `block in exec_no_cache'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
activesupport (4.1.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:815:in `exec_no_cache'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:137:in `exec_query'
activerecord (4.1.1) lib/active_record/connection_adapters/postgresql_adapter.rb:947:in `select'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/database_statements.rb:31:in `select_all'
activerecord (4.1.1) lib/active_record/connection_adapters/abstract/query_cache.rb:67:in `block in sele
@rainerborene
rainerborene / database.rb
Created August 17, 2014 17:16
Sidekiq Initializer
module Platform
module Database
def connect(size=35)
config = ActiveRecord::Base.configurations[Rails.env]
config['pool'] = ENV['DB_POOL'] || size
ActiveRecord::Base.establish_connection(config)
end
def disconnect
ActiveRecord::Base.connection_pool.disconnect!
<?xml version="1.0"?>
<root>
<item>
<name>Use the correct shift keys.</name>
<identifier>private.correct_shift_keys</identifier>
<autogen>--KeyToKey-- KeyCode::Q, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::W, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::E, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>
<autogen>--KeyToKey-- KeyCode::R, ModifierFlag::SHIFT_L, KeyCode::VK_NONE</autogen>