Skip to content

Instantly share code, notes, and snippets.

@Talleyran
Talleyran / layer.rb
Created October 30, 2011 10:57
модель Layer
class Layer
include Mongoid::Document
include Mongoid::Timestamps
#TODO create geotype filter
field :geotypes, type: Array
field :structure_json, type: String
field :is_spatial, type: Boolean, default: true
field :has_many_geoms, type: Boolean, default: false
@Talleyran
Talleyran / layers_object.rb
Created October 30, 2011 11:01
модель LayersObject
class LayersObject
include Mongoid::Document
include Mongoid::Timestamps
field :geom_id, type: Integer
field :geom_ids, type: Array
embedded_in :layer
embeds_many :fields_objects
@Talleyran
Talleyran / fields_object.rb
Created October 30, 2011 11:04
модель FieldsObject
class FieldsObject
include Mongoid::Document
include Mongoid::Timestamps
@@field_types = [
:array,
:big_decimal,
:boolean,
:date,
:date_time,
:float,
@Talleyran
Talleyran / gist:1533538
Created December 29, 2011 11:03
configure params for mapserver compiling
./configure --with-gdal=/usr/bin/gdal-config \
--with-ogr=/usr/bin/gdal-config \
--with-wfsclient \
--with-wmsclient \
--with-curl-config=/usr/bin/curl-config \
--with-proj=/usr/ \
--with-tiff \
--with-jpeg \
--with-freetype=/usr/ \
--with-threads \
# Personalized!
# Grab the current date (%D) and time (%T) wrapped in {}: {%D %T}
DALLAS_CURRENT_TIME_="%{$fg[white]%}%{$fg[yellow]%}%D %T%{$fg[white]%} %{$reset_color%}"
# Grab the current version of ruby in use (via RVM): [ruby-1.8.7]
DALLAS_CURRENT_RUBY_="%{$fg[white]%}%{$fg[magenta]%}\$(rvm-prompt i v)%{$fg[white]%} %{$reset_color%}"
# Grab the current machine name: muscato
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
# Grab the current filepath, use shortcuts: ~/Desktop
# Append the current git branch, if in a git repository: ~aw@master
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set to the name theme to load.
# Look in ~/.oh-my-zsh/themes/
export ZSH_THEME="special_dallas"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
@Talleyran
Talleyran / gist:1985624
Created March 6, 2012 10:39
Генерация разрешений и масштабов для слоя
var maxResolution = 156543.03390625,
resolutions = [],
scales = []
units = 'm'
for( var i=0; i<20; i++){
var res = maxResolution/Math.pow(2,i)
resolutions.push(res)
scales.push(OpenLayers.Util.getScaleFromResolution(res,units))
}
@Talleyran
Talleyran / gist:2043677
Created March 15, 2012 11:05
v3 hybrid hack
var obj = app.mapPanel.map.layers[4].mapObject,
zoom = obj.getZoom()
google.maps.event.addListenerOnce(obj, 'idle', function(){if(zoom != obj.getZoom())obj.setZoom(zoom)})
obj.setZoom(zoom + 1)
@Talleyran
Talleyran / Coffeescript ctags
Created April 22, 2012 02:56 — forked from mads-hartmann/Coffeescript ctags
ctags definitions for Coffeescript. Very basic for now. "> ctags -e -R source_folder" and then M-. to jump to the definition of any function or variable (if you're using emacs)
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/^[ \t]*class ([a-zA-Z_$][0-9a-zA-Z_$]*).*$/\1/c,class/
--regex-coffee=/^[ \t]*([a-zA-Z_$@][0-9a-zA-Z_$\.]*)[ \t]*[:=].*[=-]>.*$/\1/f,function/
--regex-coffee=/^[ \t]*([a-zA-Z_$@][0-9a-zA-Z_$\.]*)[ \t]*=[^->\n]*$/\1/v,variable/
@Talleyran
Talleyran / lorquotes
Created October 30, 2012 05:41
Lorquotes UserScript
// ==UserScript==
// @name lorquotes
// @namespace lor
// @include http://www.linux.org.ru/forum/*/*
// @exclude http://www.linux.org.ru/forum/*/
// @include http://www.linux.org.ru/news/*/*
// @exclude http://www.linux.org.ru/news/*/
// @version 1
// ==/UserScript==
let quotesStore = {}