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
static void FizzBuzz(int number) | |
{ | |
// 3 MOD 3 = 0. We actually want 1 for multiples of 3. | |
// So we store an incremented number so that we get 1 | |
// for the binary operations. This applies to 5 as | |
// well. | |
// Valid numbers for X MOD 3 are { 0, 1, 2 }. Therefore | |
// we can simply AND it with 1. As such: | |
// { 0, 1, 2 } AND 1 = |
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
private Socket _socket; | |
private ArraySegment<byte> _buffer; | |
public void StartReceive() | |
{ | |
ReceiveAsyncLoop(null); | |
} | |
// Note that this method is not guaranteed (in fact | |
// unlikely) to remain on a single thread across | |
// async invocations. |
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
private Socket _socket; | |
private Stream _targetStream; | |
private SslStream _tlsStream; | |
public void BeginStartTls(AsyncCallback callback, object asyncState) | |
{ | |
_targetStream = _tlsStream = new SslStream(_targetStream); | |
_tlsStream.BeginAuthenticateAsServer(GetServerCerticate(), callback, asyncState); | |
} |
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
/// <summary> | |
/// Represents a buffer pool. | |
/// </summary> | |
public class BufferPool | |
{ | |
private readonly int _segmentsPerChunk; | |
private readonly int _segmentSize; | |
private readonly ConcurrentStack<ArraySegment<byte>> _buffers; | |
/// <summary> |
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
private Encoding _encoding; | |
private Decoder _decoder; | |
private char[] _charData = new char[4]; | |
public PushTextReader(Encoding encoding) | |
{ | |
_encoding = encoding; | |
_decoder = _encoding.GetDecoder(); | |
} |
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.ActiveCamera.Position = new Vector3(0, 100, 200); | |
this.ActiveCamera.LookAt(new Vector3(0, 0, 0)); | |
this.ActiveSceneManager.AmbientLight = ColorEx.Black; | |
this.ActiveSceneManager.ShadowTechnique = ShadowTechnique.TextureModulative; | |
Entity entity = ActiveSceneManager.CreateEntity("Ninja", "ninja.mesh"); | |
entity.CastShadows = true; | |
ActiveSceneManager.RootSceneNode.CreateChildSceneNode("NinjaNode").AttachObject(entity); |
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.ServiceModel.Web; | |
using System.ServiceModel.Configuration; | |
using System.ServiceModel.Description; | |
using System.ServiceModel.Channels; | |
using System.ServiceModel.Dispatcher; | |
using System.ServiceModel; |
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
// Assert.IsTrue(Environment.Developer.IsConfused, "Assumed.") | |
Assert.IsNotNull(select.WhereClause, "Where present"); | |
select.WhereClause.Expression.BinaryExpr | |
( | |
a => a.BinaryExpr | |
( | |
b => b.BinaryExpr | |
( | |
c => c.BinaryExpr | |
( |
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
# | |
# Don't include stuff created by Windows. | |
# | |
Thumbs.db | |
# | |
# Don't include stuff created by Visual Studio. | |
# | |
*.obj | |
*.vshost.exe | |
*.user |
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
{ | |
"api_response": { | |
"error_count": "0", | |
"method": "ACCESS_GetAccountUsage", | |
"response_begin": null, | |
"response_end": null, | |
"usage": { | |
"day_count": "31", | |
"days": { | |
"day": [ |