See the new site: https://postgresisenough.dev
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
| # -------------------------------------------------------------------- | |
| # Recursively find pdfs from the directory given as the first argument, | |
| # otherwise search the current directory. | |
| # Use exiftool and qpdf (both must be installed and locatable on $PATH) | |
| # to strip all top-level metadata from PDFs. | |
| # | |
| # Note - This only removes file-level metadata, not any metadata | |
| # in embedded images, etc. | |
| # | |
| # Code is provided as-is, I take no responsibility for its use, |
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
| -- check for containment | |
| -- i.e. index A contains index B | |
| -- and both share the same first column | |
| -- but they are NOT identical | |
| WITH index_cols_ord as ( | |
| SELECT attrelid, attnum, attname | |
| FROM pg_attribute | |
| JOIN pg_index ON indexrelid = attrelid | |
| WHERE indkey[0] > 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
| -- check for exact matches | |
| WITH index_cols_ord as ( | |
| SELECT attrelid, attnum, attname | |
| FROM pg_attribute | |
| JOIN pg_index ON indexrelid = attrelid | |
| WHERE indkey[0] > 0 | |
| ORDER BY attrelid, attnum | |
| ), | |
| index_col_list AS ( | |
| SELECT attrelid, |
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
| name | default_version | installed_version | comment | |
| ------------------------+-----------------+-------------------+--------------------------------------------------------------------- | |
| pg_buffercache | 1.0 | | examine the shared buffer cache | |
| earthdistance | 1.0 | | calculate great-circle distances on the surface of the Earth | |
| pg_freespacemap | 1.0 | | examine the free space map (FSM) | |
| intagg | 1.0 | | integer aggregator and enumerator (obsolete) | |
| plperl | 1.0 | | PL/Perl procedural language | |
| sslinfo | 1.0 | | information about SSL certificates | |
| btree_gist | 1.0 | | support for indexing common datatypes in GiST | |
| fuzzystrmatch | 1.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
| class Tour < Sequel::Model | |
| many_to_one :vendor_pansion, | |
| :dataset => proc{ Vendor::Pansion.where(:id => self.vendor_pansion_id) }, | |
| :reciprocal => nil, :class => 'Vendor::Pansion', | |
| :eager_loader => (proc do |opts| | |
| opts[:rows].each{ |object| object.associations[:vendor_pansion] = nil } | |
| Vendor::Pansion.where(:id => opts[:id_map].keys).each do |vendor_pansion| | |
| if tours = opts[:id_map][vendor_pansion.id] | |
| tours.each do |tour| |
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
| module ExternalValidator | |
| def self.included(descendant) | |
| descendant.class_eval do | |
| InstanceMethods | |
| end | |
| end | |
| module InstanceMethods | |
| def initialize(object) | |
| @object = object |
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
| ----------------------------------------- | |
| Boilerplate code (in rails_app_root/lib) | |
| ----------------------------------------- | |
| module ContextAccessor | |
| def context | |
| Thread.current[:context] | |
| end | |
| 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
| <?php | |
| /** | |
| * PostGIS to GeoJSON | |
| * Query a PostGIS table or view and return the results in GeoJSON format, suitable for use in OpenLayers, Leaflet, etc. | |
| * | |
| * @param string $bbox Bounding box of request *REQUIRED* | |
| * @param string $geotable The PostGIS layer name *REQUIRED* | |
| * @param string $geomfield The PostGIS geometry field *REQUIRED* | |
| * @param string $srid The SRID of the returned GeoJSON *OPTIONAL (If omitted, EPSG: 4326 will be used)* |
NewerOlder