Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
# -------------------------------------------------------------------- | |
# 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, |
-- 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 |
-- 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, |
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 |
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| |
module ExternalValidator | |
def self.included(descendant) | |
descendant.class_eval do | |
InstanceMethods | |
end | |
end | |
module InstanceMethods | |
def initialize(object) | |
@object = object |
----------------------------------------- | |
Boilerplate code (in rails_app_root/lib) | |
----------------------------------------- | |
module ContextAccessor | |
def context | |
Thread.current[:context] | |
end | |
end |
<?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)* |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.