Skip to content

Instantly share code, notes, and snippets.

Zhen Deng ZhenDeng

Block or report user

Report or block ZhenDeng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Model DataAnnotation test
Model:
public class OrganisationVM
{
public int Id { get; set; }
[Required]
[MinLength(5, ErrorMessage = "Must be at least 5 characters long")]
public string Name { get; set; }
[Required]
View userful tool
FileZilla, winscp -- FTP
progress telerik fiddler web debugger -- http
progress telerik justdecompile -- decompile dll file
snipping tool -- screenshot
paint.net -- small ps
View update object in object array
shoppingCarts: ShoppingCart[] = [];
shoppingCart: ShoppingCart;
this.shoppingCarts.map((value, key) => {
if(value.id == this.shoppingCart.id){
this.shoppingCarts[key] = this.shoppingCart;
}
});
View cookie
View covert EpochTime to Datetime and covert Datetime to EpochTime
/// <summary>
/// Converts the given date value to epoch time.
/// </summary>
public static long ToEpochTime(this DateTime dateTime)
{
var date = dateTime.ToUniversalTime();
var ticks = date.Ticks - new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
var ts = ticks / TimeSpan.TicksPerSecond;
return ts;
}
View autocomplete
$.fn.showPostcodeAutoComplete = function (pcode) {
console.log(pcode);
$(this).autocomplete({
source: function (request, response) {
$.ajax({
url: 'api/checkout/GetPostCodeList',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(pcode),
dataType: 'json',
View text box with an arrow
.widget-text {
background-color: #999590;
color: white;
margin: 10px 0 0 70px;
padding: 1px 20px;
position: relative;
}
.widget-text:before, .widget-text:after {
content: "";
View how to remove account
I was able to fix the issues by deleting the files in ~Library/Accounts/ and ~/Library/Preferences/MobileMeAccounts.plist
then logging out and in again before opening the panels again.
Warning: This also removes every other account you have listed in the accounts folder.
View call Restful api
public enum WebMethods
{
GET,
POST
}
public static T GetJsonResult<T>(string baseUrl, WebMethods method, dynamic queryParameters = null, dynamic bodyContent = null, dynamic token = null) where T : new()
{
string url = string.Empty;
if (queryParameters != null)
View Ajax sample
$.ajax({
url: '/Account/Login',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(loginInfo),
dataType: 'json',
success: function (output) {
if (output.Status == 'fail') {
hideProgress();
$('#btnLogin').hideProgress();
You can’t perform that action at this time.