This file contains hidden or 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.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace FormFader | |
{ | |
/// <summary> | |
/// An object used to control fading forms in and out. | |
/// </summary> | |
class Fader |
This file contains hidden or 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 work (Modern Encryption of a String C#, by James Tuley), | |
* identified by James Tuley, is free of known copyright restrictions. | |
* https://gist.github.com/4336842 | |
* http://creativecommons.org/publicdomain/mark/1.0/ | |
*/ | |
using System; | |
using System.IO; | |
using System.Text; |
This file contains hidden or 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
protected void Application_Start() | |
{ | |
//check for bin files to be loaded | |
CheckAddBinPath(); | |
} | |
public static void CheckAddBinPath() | |
{ | |
// find path to 'bin' folder | |
var binPath = Path.Combine(new string[] { AppDomain.CurrentDomain.BaseDirectory, "bin" }); |
This file contains hidden or 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
//exclude the special character | |
[ValidateInput(false)] | |
public FileResult TextToMp3(string text) | |
{ | |
//Primary memory stream for storing mp3 audio | |
var mp3Stream = new MemoryStream(); | |
//Speech format | |
var speechAudioFormatConfig = new SpeechAudioFormatInfo(samplesPerSecond: 8000, bitsPerSample: AudioBitsPerSample.Sixteen, channel: AudioChannel.Stereo); | |
//Naudio's wave format used for mp3 conversion. Mirror configuration of speech config. | |
var waveFormat = new WaveFormat(speechAudioFormatConfig.SamplesPerSecond, speechAudioFormatConfig.BitsPerSample, speechAudioFormatConfig.ChannelCount); |
This file contains hidden or 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
public class WeightedModel { | |
private WeightedModel() { | |
_set = new WeightedModelFluentInterface(this); | |
} | |
public static WeightedModelFluentInterface Create() { | |
return new WeightedModel().Set; | |
} |
This file contains hidden or 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 static List<Category> FlatToHierarchy(List<Category> list, int parentID = 0) | |
{ | |
return (from l in list | |
where l.ctgParentID == parentID | |
select new Category | |
{ | |
ctgID = l.ctgID, | |
ctgParentID = l.ctgParentID, | |
ctgName = l.ctgName, | |
childCategories = FlatToHierarchy(list, l.ctgID), |
This file contains hidden or 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
public class GetGeoLocation | |
{ | |
public PlacesApiQueryResponse GetGNBSresult(string querystring) { | |
byte[] bResult = null; | |
PlacesApiQueryResponse result = null; | |
using (WebClient wc = new WebClient()) | |
{ | |
bResult = wc.DownloadData(querystring); | |
string jsonstring = Encoding.UTF8.GetString(bResult); |
This file contains hidden or 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.Threading; | |
static class Program { | |
static void Main() { | |
Console.Write("Performing some task... "); | |
using (var progress = new ProgressBar()) { | |
for (int i = 0; i <= 100; i++) { | |
progress.Report((double) i / 100); |
This file contains hidden or 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; | |
// you can also use other imports, for example: | |
// using System.Collections.Generic; | |
// you can write to stdout for debugging purposes, e.g. | |
// Console.WriteLine("this is a debug message"); | |
class Solution { | |
public int solution(int[] A) { | |
double sum = 0; |
This file contains hidden or 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; | |
// you can also use other imports, for example: | |
// using System.Collections.Generic; | |
// you can write to stdout for debugging purposes, e.g. | |
// Console.WriteLine("this is a debug message"); | |
class Solution { | |
public int solution(int X, int Y, int D) { | |
if ((Y - X) < D && Y != X) return 1; |
NewerOlder