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 static int ArrayPlusArray(int[] arr1, int[] arr2) | |
{ | |
int preSum1 = 0; | |
int preSum2 = 0; | |
for (int i = 0; i < arr1.Length; i++) | |
{ | |
if (arr1[i] > 0) | |
{ | |
preSum1 += arr1[i]; |
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 static int CountSmiley(string[] smileys) | |
{ | |
// :) :D ;-D :~) - Valid. | |
// ;( :> :} :] - Invalid. | |
int counter = 0; | |
foreach (string item in smileys) | |
{ | |
switch (item) | |
{ |
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 static int[] VowelIndices(string word) | |
{ | |
List<int> myVowelList = new List<int>(); | |
for (int i = 0; i < word.Length; i++) | |
{ | |
switch (word.ToLower()[i]) | |
{ | |
case 'a': | |
myVowelList.Add(i + 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
public static IEnumerable<int> GetIntegersFromList(List<object> listOfItems) | |
{ | |
// Believe 👍 | |
List<int> integerList = new List<int>(); | |
int content; | |
foreach (var item in listOfItems) | |
{ | |
if (item is int) | |
{ | |
int.TryParse(item.ToString(), out content); |
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> | |
/// Replace every letter with its position in the alphabet. | |
/// If anything in the text isn't a letter, ignore it and don't return it. | |
/// A being 1, B being 2, etc. | |
/// </summary> | |
/// <param name="text"></param> | |
/// <returns></returns> | |
public static string AlphabetPosition(string text) | |
{ | |
int index; |
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> | |
/// Check to see if a string has the same amount of 'x's and 'o's. | |
/// The method must return a boolean and be case insensitive. | |
/// </summary> | |
/// <param name="input">The string can contain any char.</param> | |
/// <returns></returns> | |
public static bool XO(string input) | |
{ | |
int xCounter = 0; | |
int oCounter = 0; |
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> | |
/// Converts dash/underscore delimited words into camel casing. | |
/// The first word within the output should be capitalized only if the original word was capitalized. | |
/// </summary> | |
/// <param name="str"></param> | |
/// <returns></returns> | |
public static string ToCamelCase(string str) | |
{ | |
StringBuilder sb = new StringBuilder(); | |
string tempStr = str; |
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 void ExecuteCMDCommand(string strCommandToCMD) | |
{ | |
Process cmd = new Process(); | |
cmd.StartInfo.FileName = "cmd.exe"; | |
cmd.StartInfo.RedirectStandardInput = true; | |
cmd.StartInfo.RedirectStandardOutput = true; | |
cmd.StartInfo.CreateNoWindow = true; | |
cmd.StartInfo.UseShellExecute = false; | |
cmd.Start(); |
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
javascript:var s = document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='http://erkie.github.com/asteroids.min.js';void(0); |
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
javascript:var i,s,ss=['http://kathack.com/js/kh.js','http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js'];for(i=0;i!=ss.length;i++){s=document.createElement('script');s.src=ss[i];document.body.appendChild(s);}void(0); |
OlderNewer