Skip to content

Instantly share code, notes, and snippets.

View pksorensen's full-sized avatar

Poul Kjeldager Sørensen pksorensen

View GitHub Profile
namespace S_Innovations.Projects.EFModel.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Model;
using System.Data.Entity.Migrations.Sql;
public class AzureSqlGenerator : SqlServerMigrationSqlGenerator
{
protected override void Generate(CreateTableOperation op)
{
(function () {
"use strict";
c1metro.setOptions(
function () {
c1metro.options = {
appTitle: "Open Cph Store Magazine App", // App title text
dataHostUrl: "http://c1gitmagazine.azurewebsites.net/", // Host part of URL where data is downloaded from
websiteUrl: "http://c1gitmagazine.azurewebsites.net/", // Your website URL
privacyUrl: "http://c1gitmagazine.azurewebsites.net/Privacy", // Privacy URL - your app won't be accepted by MS if this is not in place
@pksorensen
pksorensen / gist:5626622
Last active December 17, 2015 14:48
BlogSitemap.ashx
<%@ WebHandler Language="C#" Class="BlogSitemap" %>
using System;
using System.Globalization;
using System.Text;
using System.Web;
using System.Linq;
using Composite.Data;
using Composite.Data.Types;
using Composite.Core.Routing;
using Composite.Community.Blog;
@pksorensen
pksorensen / node_zip_file_unix.js
Created June 23, 2013 10:50
How to return a zip file with express, nodejs on linux.
//http://stackoverflow.com/questions/5754153/zip-archives-in-node-js
var spawn = require('child_process').spawn;
app.get('/scripts/archive', function(req, res) {
// Options -r recursive -j ignore directory info - redirect to stdout
var zip = spawn('zip', ['-rj', '-', SCRIPTS_PATH]);
res.contentType('zip');
// Keep writing stdout to res
zip.stdout.on('data', function (data) {
interface TwilioRestClient {
}
interface TwilioSmsInfo
{
to: string;
from: string;
body: string;
}
interface TwilioSmsCallbackMessage {
@pksorensen
pksorensen / TestController.cs
Created June 25, 2013 21:52
A little Hello World WebApi Controller
namespace Composite.Core.WebApi
{
using System.Web.Http;
public class TestController : ApiController
{
public string Get()
{
@pksorensen
pksorensen / WebApiConfig.cs
Created June 25, 2013 21:58
A little configuration file for WebAPI removing the XML formatter.
namespace Composite.Core.WebApi
{
using System.Linq;
using System.Web.Http;
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
@pksorensen
pksorensen / IC1Repository.cs
Created June 25, 2013 22:14
A repository for C1, it dont have the Get(id) as one can filter on the GetAll()
namespace Composite.Core.WebApi
{
using System.Linq;
public interface IC1Repository<T>
{
IQueryable<T> GetAll();
T Add(T item);
void Remove(T item);
bool Update(T item);
@pksorensen
pksorensen / C1ApiRepository.cs
Created June 25, 2013 22:15
A implementation of the Repository.
namespace Composite.Core.WebApi
{
using Composite.Data;
using System.Linq;
public class C1ApiRepository<T> : IC1Repository<T> where T : class, IData
{
DataConnection conn = new DataConnection();
@pksorensen
pksorensen / C1ApiController
Created June 25, 2013 22:16
A controller base class for easy exposure of data types.
namespace Composite.Core.WebApi
{
using Composite.Data;
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;