This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ServiceStack.WebHost.Endpoints; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Net; | |
using System.Security; | |
using ServiceStack.Common.Web; | |
using ServiceStack.Logging; | |
using ServiceStack.ServiceHost; | |
using ServiceStack.ServiceInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Net; | |
using ServiceStack.Text; | |
using System.Runtime.Serialization; | |
using System.Xml; | |
[assembly: ContractNamespace("", ClrNamespace = "ServiceStackTester")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
### BEGIN INIT INFO | |
# http://yojimbo87.github.io/2010/03/14/mono-startup-script.html | |
# Provides: monoserve.sh | |
# Required-Start: $local_fs $syslog $remote_fs | |
# Required-Stop: $local_fs $syslog $remote_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start fastcgi mono server with hosts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// http://seattlesoftware.wordpress.com/2008/09/11/hexadecimal-value-0-is-an-invalid-character/ | |
/// http://stackoverflow.com/questions/157646/best-way-to-encode-text-data-for-xml/732135#732135 | |
public string Clean(string text) | |
{ | |
return new string(text.Where(XmlConvert.IsXmlChar).ToArray()); | |
} | |
public static string CleanInvalidXmlChars(string text) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.RequestFilters.Add((httpReq, httpResp, requestDto) => | |
{ | |
var hasFilter = requestDto as IAllowPartialUpdate; | |
if (hasFilter != null) | |
{ | |
if (httpReq.QueryString["fields"] != null) | |
{ | |
// store for later | |
httpReq.Items.Add("Patch_Fields", httpReq.QueryString["fields"].Split(new[] {','})); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:html'; | |
import 'dart:convert'; | |
import 'package:crypto/crypto.dart'; | |
void main() { | |
String secret = 'secret'; | |
String message = 'Message'; | |
List<int> secretBytes = UTF8.encode('secret'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Call this ad the end of your app host Configure(Funq.Container container) method | |
private void AddOptionsVerbToAllRoutes(IServiceRoutes routes) | |
{ | |
var map = EndpointHost.ServiceManager.ServiceController.RestPathMap; | |
foreach (var key in map.Keys) | |
{ | |
foreach (RestPath rp in map[key]) | |
{ | |
routes.Add(rp.RequestType, rp.Path, "OPTIONS"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Socket.IO chat</title> | |
</head> | |
<body> | |
<form action=""> | |
<input type="input" id="m" /><button>Send</button> | |
</form> | |
<pre id="output"></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell HMAC SHA 256 | |
$message = 'Message' | |
$secret = 'secret' | |
$hmacsha = New-Object System.Security.Cryptography.HMACSHA256 | |
$hmacsha.key = [Text.Encoding]::ASCII.GetBytes($secret) | |
$signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message)) | |
$signature = [Convert]::ToBase64String($signature) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "securehelloworld", | |
"version": "1.0.0", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", |
OlderNewer