Skip to content

Instantly share code, notes, and snippets.

View jalalhejazi's full-sized avatar
:octocat:
🐝 DevOps Experimentation | Continuous Learning 🐝

Jalal Hejazi jalalhejazi

:octocat:
🐝 DevOps Experimentation | Continuous Learning 🐝
  • Denmark
View GitHub Profile
@jalalhejazi
jalalhejazi / order.xml
Created May 12, 2013 17:15
xml: Order.xsd & order.xml
<Order xsi:schemaLocation="http://www.company.com/examples/purchaseorder order.xsd" xmlns="http://www.company.com/examples/purchaseorder" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ShippingAddress>
<Street1>123 First St.</Street1>
<City>Allston</City>
<State>MA</State>
<Zip>02115</Zip>
</ShippingAddress>
<BillingAddress>
<Street1>22 XML Road</Street1>
<City>Cambridge</City>
@jalalhejazi
jalalhejazi / library.xml
Created May 12, 2013 17:34
xml: library.xml and 3 (library.xsd) XSD version 1+2+3
<?xml version="1.0" encoding="utf-8"?>
<book isbn="0836217462">
<title>Being a Dog Is a Full-Time Job</title>
<author>Charles M. Schulz</author>
<character>
<name>Snoopy</name>
<friend-of>Peppermint Patty</friend-of>
<since>1950-10-04</since>
<qualification>
@jalalhejazi
jalalhejazi / gist:5594650
Last active December 17, 2015 10:28 — forked from mikeyk/gist:1329319
redis: python Script performance of hashing
#! /usr/bin/env python
import redis
import random
import pylibmc
import sys
r = redis.Redis(host = 'localhost', port = 6389)
mc = pylibmc.Client(['localhost:11222'])
@jalalhejazi
jalalhejazi / AuthorService.cs
Created May 22, 2013 07:10 — forked from mythz/AuthorService.cs
ServiceStack: AuthorService as REST Interface
/*
With no other C# or config other than OrmLite DB config in AppHost below - this web service provides all the screenshots attached, out-of-the-box, for free.
container.Register<IDbConnectionFactory>(
new OrmLiteConnectionFactory(ConfigUtils.GetConnectionString("AppDb"), //ConnectionString in Web.Config
SqlServerOrmLiteDialectProvider.Instance) {
ConnectionFilter = x => new ProfiledDbConnection(x, Profiler.Current) });
-- Code-first Simplicity at Great Speed - http://www.servicestack.net/benchmarks/
@jalalhejazi
jalalhejazi / ServiceStack_Redis_Todo.cs
Created May 24, 2013 17:44
ServiceStack: Todos with Redis Store
using System;
using ServiceStack.Redis;
using ServiceStack.ServiceInterface;
using ServiceStack.WebHost.Endpoints;
using Funq;
using ServiceStack.Text;
//The entire C# source code for the ServiceStack + Redis TODO REST backend. There is no other .cs :)
namespace Backbone.Todos
{
@jalalhejazi
jalalhejazi / IIS_Verbs.config
Created May 26, 2013 16:58
CORS: Web.config to enable CORS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS"/>
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
</customHeaders>
</httpProtocol>
@jalalhejazi
jalalhejazi / vejret.htm
Created June 14, 2013 21:35
vejret: vejret i forskellige HTML måder
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>vejret i DK</title>
<link rel="stylesheet" href="http://supermobile.dk/html5/WebApp.Bynavn/styles/fluid.css">
</head>
<body>
<p>
@jalalhejazi
jalalhejazi / AWS_Søgning.htm
Created June 15, 2013 18:14
Address WebService: Adresse søgning
<!DOCTYPE html>
<html>
<head>
<title>Kodeeksempel på brug af adressedelens af Geoservicens web API</title>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(function () {
var kriterie = {};
kriterie['vejnavn'] = '*kilde*';
--> Jalal Hejazi STDistance using The Great Circle Formular with SQL Spatial GeoType
-- OpenSource GEO DB
-- http://workshops.opengeo.org/postgis-intro/geometries_exercises.html
-- http://workshops.opengeo.org/postgis-intro/geography.html
--> SQLServer Spatial DB
--> http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.types.sqlgeography.stdistance.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
/*
@jalalhejazi
jalalhejazi / jQuery.loadScript
Created September 15, 2013 20:10 — forked from bradvin/jQuery.loadScript
jQuery.loadScript
jQuery.loadScript = function (url, arg1, arg2) {
var cache = false, callback = null;
//arg1 and arg2 can be interchangable as either the callback function or the cache bool
if ($.isFunction(arg1)){
callback = arg1;
cache = arg2 || cache;
} else {
cache = arg1 || cache;
callback = arg2 || callback;
}