View gist:3071037
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
String.IsNullOrEmpty = function(value) { | |
var isNullOrEmpty = true; | |
if (value) { | |
if (typeof (value) == 'string') { | |
if (value.length > 0) | |
isNullOrEmpty = false; | |
} | |
} | |
return isNullOrEmpty; | |
} |
View CarsCache.cs
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 CarsCache | |
{ | |
private AsyncExpiringLazy<List<Car>> Cars { get; set; } | |
public CarService CarService { get; set; } | |
public CarsCache() | |
{ | |
Cars = new AsyncExpiringLazy<List<Car>>(async metadata => | |
{ |
View jquery.Globalize.js
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
$.when( | |
$.get( "cldr/main/en/ca-gregorian.json" ), | |
$.get( "cldr/main/fr/ca-gregorian.json" ), | |
$.get( "cldr/supplemental/likelySubtags.json" ), | |
$.get( "cldr/supplemental/timeData.json" ), | |
$.get( "cldr/supplemental/weekData.json" ) | |
).then(function() { | |
return [].slice.apply( arguments, [ 0 ] ).map(function( result ) { | |
return result[ 0 ]; | |
}); |
View decimal.cs
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
[Required] | |
[Range(Min=0, Max=int.MaxValue) | |
public decimal Salary { get; set; } |
View Horror.cs
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
foreach (var r in registrations) | |
{ | |
if ((count++) % 10 == 0); | |
Console.Write("\r{0} %", Math.Round((double)count / registrations.Count * 100d)); | |
} |
View this-is-bridge.cs
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
//Get the employee list | |
var employees = EmployeeService.GetAllEmployees(); | |
//Sort employee by name | |
employees = employees.OrderBy(p => p.Name); | |
//Send email to employee | |
MailService.SendMail(employee.Email); | |
//Get today's date |
View grouping.cs
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
IEnumerable<IGrouping<int, string>> query = elements.GroupBy(k => k.Age, e => e.Name); |
View identity.cs
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 userStore = new UserStore<IdentityUser>(); | |
var manager = new UserManager<IdentityUser>(userStore); | |
var user = new IdentityUser() { UserName = UserName.Text }; | |
IdentityResult result = manager.Create(user, Password.Text); | |
if (result.Succeeded) | |
{ | |
StatusMessage.Text = string.Format("User {0} was created successfully!", user.UserName); | |
} |
View using.cs
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 (var sftp = new SftpClient(Host, Username, Password)) | |
using (new EditContext(importSettings, SecurityCheck.Disable)) | |
{ | |
//du code ici | |
} |
View test.cs
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(var lol as Bob) | |
{ | |
using(var yolo as Fred) | |
{ | |
Console.log("Hey!") | |
} | |
} | |
using(var lol as Bob) | |
using(var yolo as Fred) |
NewerOlder