SPC
SPC
find file,
switch bufferA.
browse files:
MX;
EX<
switch buffer
/* | |
* Customize Footnotify on your site by adding custom css. | |
* | |
* This file is NOT loaded by the script and must be | |
* implemented on the site in order to apply. | |
* | |
* More info: https://gist.github.com/1046538 | |
* | |
*/ |
if Rails.env.development? | |
require 'active_record/connection_adapters/postgresql_adapter' | |
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | |
def __explain_analyze(sql, command, *args) | |
meth = "#{command}_without_explain_analyze".to_sym | |
if /\A\s*SELECT/i.match(sql) | |
newsql = "EXPLAIN ANALYZE #{sql}" | |
plan = send(meth, newsql, *args).map { |row| row['QUERY PLAN'] }.join("\n") | |
Rails.logger.debug("\e[1m\e[31mQUERY PLAN FOR: #{sql.strip};\n#{plan}\e[0m") |
package main | |
import ( | |
"fmt" | |
"errors" | |
) | |
type Maybe interface { | |
Return(value interface{}) Maybe | |
Bind(func(interface{}) Maybe) Maybe |
def profile(**options) | |
fail "U WOT M8" unless block_given? | |
result = RubyProf.profile { yield } | |
Tempfile.open %w[vmm .cachegrind] do |tmp| | |
RubyProf::CallTreePrinter.new(result).print(tmp, **options) | |
spawn 'qcachegrind', tmp.path | |
end |
http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
#payload: [{"kind"=>"person"}] | |
Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
#data: {"interest"=>["music", "movies", "programming"]} | |
Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
Segment.where("jsonb_array_length(data->'interest') > 1") |
def paralleln(items : Indexable(T), &block : T -> R) forall T, R | |
results = Array(R).new(items.size) { r = uninitialized R } | |
done = Channel(Exception?).new | |
items.each_with_index do |item, i| | |
spawn do | |
begin | |
results[i] = block.call(item) | |
rescue e | |
done.send e |
Mute these words in your settings here: https://twitter.com/settings/muted_keywords | |
ActivityTweet | |
generic_activity_highlights | |
generic_activity_momentsbreaking | |
RankedOrganicTweet | |
suggest_activity | |
suggest_activity_feed | |
suggest_activity_highlights | |
suggest_activity_tweet |