This file contains 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 | |
functions.id, | |
functions.slug, | |
ts_rank(setweight(to_tsvector('english', functions.name), 'A') || setweight(to_tsvector('english', coalesce(functions.search_docs,'')), 'B'), query) as rank | |
FROM ( | |
SELECT DISTINCT on (functions.slug) functions.* | |
FROM functions | |
INNER JOIN "klasses" ON "klasses"."id" = "functions"."klass_id" | |
INNER JOIN "versions" ON "versions"."id" = "klasses"."version_id" | |
ORDER BY functions.slug ASC, string_to_array(regexp_replace(versions.name, '[^0-9.]', '', 'g'), '.')::int[] DESC |
This file contains 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
libref_dev=# EXPLAIN ANALYZE SELECT "functions".* FROM "functions" INNER JOIN "klasses" ON "klasses"."id" = "functions"."klass_id" INNER JOIN "versions" ON "versions"."id" = "klasses"."version_id" WHERE "versions"."project_id" = 2 AND "functions"."slug" = 'ActionController/ParameterEncoding/ClassMethods/instance/skip_parameter_encoding' ORDER BY string_to_array(regexp_replace(versions.name, '[^0-9.]', '', 'g'), '.')::int[] ASC; | |
QUERY PLAN | |
----------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Sort (cost=3189.68..3189.69 rows=1 width=1279) (actual time=45.787..45.788 rows=2 loops=1) | |
Sort Key: ((string_to_array(regexp_replace((versions.name)::text, '[^0-9.]'::text, ''::text, 'g'::text), '.'::text))::integer[]) | |
Sort Method: quicksort Memory: 29kB | |
-> Nested Loop (cost=18.84..3189.67 rows=1 width=1279) (actual time=3.918..45.772 r |
This file contains 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 * FROM ( | |
SELECT "functions".* FROM "functions" WHERE "functions"."klass_id" = 242 AND "functions"."name" = 'change' | |
UNION | |
SELECT "functions".* FROM "functions" WHERE "functions"."klass_id" = 661 AND "functions"."name" = 'change' | |
UNION | |
SELECT "functions".* FROM "functions" INNER JOIN "klasses" ON "klasses"."id" = "functions"."klass_id" INNER JOIN "versions" ON "versions"."id" = "klasses"."version_id" WHERE "versions"."id" = 1 AND "functions"."name" = 'change' | |
) as subquery LIMIT 1 | |
however postgres will execute all union queries even if the first query returns a result |
This file contains 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
ActiveSupport::Notifications.subscribe "instantiation.active_record" do |*args| | |
event = ActiveSupport::Notifications::Event.new(*args) | |
RequestStore.store[:object_count] ||= 0 | |
RequestStore.store[:object_count] += event.payload[:record_count] | |
end | |
ActiveSupport::Notifications.subscribe "process_action.action_controller" do | |
Rails.logger.info "AR Object count: #{RequestStore.store[:object_count]}" | |
end |
This file contains 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
import { ISelectProps } from "@blueprintjs/labs"; | |
import * as React from "react"; | |
import { DropdownButton } from "./DropdownButton"; | |
interface IDisableableSelectProps { | |
disabled?: boolean; | |
text: string; | |
} | |
export function disableableSelect<T>( |
This file contains 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
function replaceInternalLinks2( &$s ) { | |
static $tc = FALSE, $e1, $e1_img; | |
# the % is needed to support urlencoded titles as well | |
if ( !$tc ) { | |
$tc = Title::legalChars() . '#%'; | |
# Match a link having the form [[namespace:link|alternate]]trail | |
$e1 = "/^([{$tc}]+)(?:\\|(.+?))?]](.*)\$/sD"; | |
# Match cases where there is no "]]", which might still be images | |
$e1_img = "/^([{$tc}]+)\\|(.*)\$/sD"; | |
} |
This file contains 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
union [] [] = [] | |
union [] ys = ys | |
union xs [] = xs | |
union (x@(n,_):xs) ys | |
| has n ys = (join x (find n ys)):(union xs (without n ys)) | |
| otherwise = x:(union xs ys) | |
where | |
find p = filter (\x -> fst x == p) | |
without p = filter (\x -> fst x != p) | |
has p = length (find p) != 0 |
This file contains 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
> brew --config ~ | |
HOMEBREW_VERSION: 0.9.3 | |
HEAD: 4baf64237d8fefba68a24e2237d08311592f00bb | |
HOMEBREW_PREFIX: /usr/local | |
HOMEBREW_CELLAR: /usr/local/Cellar | |
CPU: quad-core 64-bit ivybridge | |
OS X: 10.8.1-x86_64 | |
Xcode: 4.5.2 | |
CLT: 4.5.0.0.1.1249367152 | |
LLVM-GCC: build 2336 |
This file contains 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
> brew install cdrtools | |
==> Downloading ftp://ftp.berlios.de/pub/cdrecord/cdrtools-3.00.tar.gz | |
######################################################################## 100.0% | |
######################################################################## 100.0%==> make INS_BASE=/usr/local/Cellar/cdrtools/3.00 INS_RBASE=/usr/local/Cellar/cdrtools/3.00 install | |
/usr/local/Cellar/cdrtools/3.00: 176 files, 1.8M, built in 55 seconds | |
> brew list cdrtools | |
/usr/local/Cellar/cdrtools/3.00/etc/default/rscsi | |
/usr/local/Cellar/cdrtools/3.00/include/scg/ (12 files) | |
/usr/local/Cellar/cdrtools/3.00/include/schily/ (101 files) |
This file contains 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 'gst' | |
require 'sinatra' | |
class App < Sinatra::Application | |
configure do | |
Gst.init | |
@@pipeline = Gst::ElementFactory.make("playbin2") | |
@@pipeline.uri = GLib.filename_to_uri(File.expand_path(File.dirname(__FILE__)) + '/icarus.mp3') | |
end |
NewerOlder