Skip to content

Instantly share code, notes, and snippets.

@yehiaa
yehiaa / AmazonLinux-InstallPostGIS.sh
Created October 20, 2023 16:57 — forked from johnjreiser/AmazonLinux-InstallPostGIS.sh
Script to install PostgreSQL 13 and PostGIS 3.2 on fresh Amazon Linux 2
#!/bin/bash
# Script to install PostgreSQL and PostGIS on a fresh Amazon Linux instance
# Installing from source:
# - GEOS
# GEOS 3.10+ requires CMake 3+, not readily available on Amazon Linux 2.
GEOSVER=3.9.2
GEOSURL=http://download.osgeo.org/geos/geos-${GEOSVER}.tar.bz2
# - PROJ (GDAL requires 6+; 6.2.1 is the last to use SQLite 3.7; 6.2 had build issues, so 6.1.1)
@yehiaa
yehiaa / sort array of objects and get average.js
Last active October 24, 2016 21:00
sort array of objects, get average
var items = [{name:'a', rank:3},{name:'b', rank:2},{name:'d', rank:1},{name:'c', rank:4}];
function getAverage(itemsArray){
var total = 0 ;
itemsArray.map(function (item){
total += item.rank ;
} );
return total / itemsArray.length ;
}
@yehiaa
yehiaa / backbone view bootstrap 3 modal dialog .js
Last active November 28, 2020 03:38
backbone view for bootstrap 3 modal dialog with nested view
var ModalDialog = Backbone.View.extend({
templateId: "dialog", // this is template id
className: "modal fade",
attributes: {tabindex:"-1", role:"dialog",
"aria-labelledby":"myModalLabel",
"aria-hidden":"true"},
initialize: function() {
this.render();
//to change modal width
// this.$el.find(".modal-dialog").css("width","75%");
@yehiaa
yehiaa / domReady.js
Last active March 30, 2017 20:23
dom ready simple function code inspired form DOMAssistant library
var domReady = (function (){
var arrDomReadyCallBacks = [] ;
function excuteDomReadyCallBacks(){
for (var i=0; i < arrDomReadyCallBacks.length; i++) {
arrDomReadyCallBacks[i]();
}
arrDomReadyCallBacks = [] ;
}
return function (callback){