#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| from tastypie.authentication import Authentication | |
| class DjangoAuthentication(Authentication): | |
| """Authenticate based upon Django session""" | |
| def is_authenticated(self, request, **kwargs): | |
| return request.user.is_authenticated() |
| class MyGeoResource(Resource): | |
| def apply_sorting(self, objects, options=None): | |
| if options and "longitude" in options and "latitude" in options: | |
| return objects.distance(Point(options['latitude'], options['longitude'])).order_by('distance') | |
| return super(MyGeoResource, self).apply_sorting(objects, options) | |
| #!/bin/sh | |
| if [ -z $1 ]; then | |
| echo "Usage: $0 <filename.mbtiles>" | |
| exit 1 | |
| fi | |
| sqlite3 -line $1 'select * from metadata;' | sed -e 's/^\(.\{85\}\).*/\1.../' -e 's/^ name = /+++/' -e 's/value = //' | grep -v ^$ | sed -e 's/^\([^+++]\)/ \1/' -e 's/^+++//' | |
| echo "size" |
| #!/bin/bash | |
| # | |
| # Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box | |
| # http://wildfish.com | |
| # add the ubuntu gis ppa | |
| sudo apt-get -y install python-software-properties | |
| sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
| sudo apt-get update |
#Create bitbucket branch
##Create local branch
$ git checkout -b sync
Switched to a new branch 'sync'
$ git branch
master
* sync
| Layer = Backbone.Model.extend(); | |
| Layer.prototype.initialize = function() { | |
| var lyr = new olCls(this.get('name'), this.get('url'), opts); | |
| this.set({ olLayer: lyr }); | |
| }; | |
| LayerView.prototype.render = function() { | |
| var view = this; | |
| var trucks = new Layer({name: 'Vehicles'); | |
| view.map.addLayer(trucks); | |
| // refresh the vehicles and turn them into markers |
| #!/bin/bash | |
| set -e # Exit on error | |
| set -x # Print each command | |
| apt-get install -y lsb-release | |
| # Set up the OpsCode repository | |
| echo "deb http://apt.opscode.com/ `lsb_release -cs`-0.10 main" | tee /etc/apt/sources.list.d/opscode.list | |
| gpg --keyserver keys.gnupg.net --recv-keys 83EF826A |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
| var user = { | |
| validateCredentials: function (username, password) { | |
| return ( | |
| (!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
| : (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
| : (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
| : (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
| : (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
| : false | |
| ); |