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 ListMatcher | |
| { | |
| public bool MeetsRequirements(IEnumerable<string> required, IEnumerable<string> possessed) | |
| { | |
| //possessed = new List<string> { "a", "b", "d", "g" }; | |
| //required = new List<string> { "b", "c" }; | |
| var meetsRequirements = required.All(r => possessed.Contains(r)); // false | |
| return meetsRequirements; | |
| } |
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 SqlFacade | |
| { | |
| public static bool ExecuteBulkNonQuery<T>(string connectionString, CommandType commandType, | |
| string commandText, IEnumerable<T> listItems, Func<T,SqlParameter[]> setParameters) | |
| { | |
| var fails = 0; | |
| using (var conn = new SqlConnection(connectionString)) | |
| { | |
| using (var comm = new SqlCommand(commandText, conn)) | |
| { |
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
| ################################################################ | |
| # Script: Play random unwatched movie | |
| # Description: Plays a random movie from your library that | |
| # has not yet been played completely | |
| # Written By: Jeremy Stafford | |
| # Date: 11/15/2012 | |
| # Tested On: XBMC Eden | |
| ################################################################ | |
| import urllib2 |
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
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| const string messageFormat = "{0} gave you a {1}, which is a type of {2}"; | |
| // this operation expects to use a Character object | |
| Character _char; | |
| _char = new Character("Cecil"); |
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
| void Main() | |
| { | |
| var inst1 = Employee.Instance; | |
| Console.WriteLine(Employee.Count); //1 | |
| Console.WriteLine(Employee.Count); //1 | |
| var inst2 = Employee.Instance; | |
| Console.WriteLine(Employee.Count); //2 | |
| Console.WriteLine(Employee.Count); //2 | |
| } |
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 IEnumerable<Card> Shuffle(IList<Card> cards) | |
| { | |
| var rnd = new Random(); | |
| for (var n = cards.Count - 1; n > 0; --n) | |
| { | |
| var newPosition = rnd.Next(n + 1); | |
| var temp = cards[n]; | |
| cards[n] = cards[newPosition]; | |
| cards[newPosition] = temp; | |
| } |
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; | |
| namespace mycompany.employee_manager.Core.Data.Repository | |
| { | |
| public class UnitOfWork : IDisposable | |
| { | |
| #region -- Fields -- | |
| private readonly MyContext _context = new MyContext(); | |
| private GenericRepository<User> _userRepository; | |
| private GenericRepository<Department> _departmentRepository; |
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.Collections.Generic; | |
| using System.Data.Entity; | |
| using System.Linq; | |
| namespace mycompany.employee_manager.Core.Data.Repository | |
| { | |
| public class GenericRepository<TEntity> | |
| where TEntity : class | |
| { | |
| internal ProvausioEmployeeManagerContext Context; |
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
| /* | |
| Width: 1000px | |
| # Columns : 12 | |
| Column width: 65px | |
| Gutter : 20px | |
| */ | |
| .grid_1 { width: 65px; } | |
| .grid_2 { width: 150px; } | |
| .grid_3 { width: 235px; } |
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
| String.prototype.format = String.prototype.f = function() { | |
| var s = this, | |
| i = arguments.length; | |
| while (i--) { | |
| s = s.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]); | |
| } | |
| return s; | |
| }; |
OlderNewer