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 class SaltedHash | |
{ | |
public static byte[] GenerateSalt() | |
{ | |
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); | |
int minSaltSize = 16; | |
int maxSaltSize = 32; | |
Random random = new Random(); | |
int saltSize = random.Next(minSaltSize, maxSaltSize); | |
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 void SendEmail(string fromEmailAddress, string fromName, string fromPassword, string host, int port, | |
string toEmailAddress, string toName, string subject, string body, bool isHtmlEmail) | |
{ | |
var fromAddress = new MailAddress(fromEmailAddress, fromName); | |
var toAddress = new MailAddress(toEmailAddress, toName); | |
var smtp = new SmtpClient() | |
{ | |
Host = host, | |
Port = port, |
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
'use strict'; | |
Application.Directives.directive("loadable", function() { | |
return { | |
restrict: "A", | |
templateUrl: "/partials/loading/loadable.html", | |
transclude: true, | |
scope: { | |
loadable: "@" |
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
app = angular.module 'forms', [] | |
app.directive 'ngInitial', -> | |
restrict: 'A' | |
controller: ['$scope', '$element', '$attrs', '$parse', ($scope, $element, $attrs, $parse) -> | |
val = $attrs.sbInitial || $attrs.value | |
getter = $parse($attrs.ngModel) | |
setter = getter.assign | |
setter($scope, val) | |
] |
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
DECLARE @intPage int; | |
DECLARE @intPageSize int; | |
SET @intPage = 1; | |
SET @intPageSize = 20; | |
DECLARE @intStartRow int; | |
DECLARE @intEndRow int; | |
SET @intStartRow = (@intPage -1) * @intPageSize + 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
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store("My","LocalMachine") | |
$store.Open("ReadOnly") | |
$store.Certificates |
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
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"link"]]; | |
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request | |
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) { | |
NSDictionary *jsonDict = (NSDictionary *) JSON; | |
NSArray *products = [jsonDict objectForKey:@"products"]; | |
[products enumerateObjectsUsingBlock:^(id obj,NSUInteger idx, BOOL *stop){ | |
NSString *productIconUrl = [obj objectForKey:@"icon_url"]; | |
}]; | |
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, |
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 rangeStart = new DateTime(2012, 1, 1); | |
var rangeEnd = new DateTime(2012, 12, 31); | |
var res = list | |
.Where(item => (item.StartTime < rangeStart ? rangeStart : item.StartTime) < (item.EndTime < rangeEnd ? item.EndTime : rangeEnd) ) | |
.ToList(); |
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
#### Run the Visual Studio Native Tools As an Administrator | |
#### The Exchange flag is VERY IMPORTANT | |
makecert -n CN=local.covertonight.com -sr LocalMachine -ss My -sky Exchange -pe |
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 Promise = require('bluebird'); | |
var fetchPostById = function(postId){ | |
return new Promise(function(resolve, reject){ | |
mySampleAsyncDatabaseFetch(postId, function(err, post){ | |
if(err){ | |
reject(err); | |
} | |
resolve(post); | |
}); |
OlderNewer