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
# prints 0-9 | |
for x in range(10): | |
print x | |
# prints 1-10 | |
for x in range(1, 11): | |
print x | |
# remember, we don't need to declare variables | |
# we can just assign them |
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
// JS array equivalents to C# LINQ methods - by Dan B. | |
// Here's a simple array of "person" objects | |
var people = [ | |
{ name: "John", age: 20 }, | |
{ name: "Mary", age: 35 }, | |
{ name: "Arthur", age: 78 }, | |
{ name: "Mike", age: 27 }, | |
{ name: "Judy", age: 42 }, | |
{ name: "Tim", age: 8 } |
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
class Program | |
{ | |
static void Main() | |
{ | |
const string apiKey = "99999999999999999999999999999999-us2"; // Replace it before | |
const string listId = "b999jw9999"; // Replace it before | |
var options = new List.SubscribeOptions{DoubleOptIn = true,EmailType = List.EmailType.Html,SendWelcome = false}; | |
var merges = new List<List.Merges> { new List.Merges("john@provider.com", List.EmailType.Html) { { "FNAME", "John" }, { "LNAME", "Smith" } } }; | |
var mcApi = new MCApi(apiKey, false); |
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
[diff] | |
indentHeuristic = true | |
submodule = log | |
[color] | |
diff = always | |
interactive = always | |
status = always | |
branch = always | |
[alias] | |
st = status |
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 int Largest(int[] list) | |
{ | |
int index, max = Int32.MaxValue; | |
for (index = 0; index < list.Length - 1; index++) | |
{ | |
if (list[index] > max) | |
{ | |
max = list[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
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace RequestBinExample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
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
Install-Package EntityFramework.SqlServerCompact -version 6.0.1 | |
Install-Package MvcScaffolding -Version 1.0.8-vs2013 -Pre | |
public class Category { | |
public int CategoryId { get; set; } | |
public string Name { get; set; } | |
} | |
public class Product | |
{ |
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 void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |
routes.MapRoute( | |
name: "CustomRoute", | |
url: "{controller}/{action}/{startYear}/{startMonth}/{startDay}/{endYear}/{endMonth}/{endDay}", | |
defaults: new | |
{ | |
controller = "Home", |
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 string GetJsonFromURL(string url) | |
{ | |
var request = WebRequest.Create(url); | |
var response = request.GetResponse(); | |
var dataStream = response.GetResponseStream(); | |
var reader = new StreamReader(dataStream); | |
string json = HttpUtility.HtmlDecode(reader.ReadToEnd()); | |
reader.Close(); |
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
var tasks = new Task[10]; | |
for (var i = 0; i < 10; i++) | |
{ | |
var x = i; | |
tasks[i] = Task.Factory.StartNew(() => new WorkerClass(x).Do()); | |
} | |
Task.WaitAll( tasks ); |
NewerOlder