Skip to content

Instantly share code, notes, and snippets.

View gladiatorAsh's full-sized avatar
🎯
Focusing

Ashutosh Singh gladiatorAsh

🎯
Focusing
View GitHub Profile
function CheckGreaterThanZero($element) {
if ($element.is('input:text')) {
if ($element.val().trim() == "") {
return;
}
if ($.inArray($element[0], objValidationFailed) === -1) {
if (!$.validate($element.val(), "greaterThanZero")) {
validated = false;
objValidationFailed.push($element[0]);
$element.addClass('error');
function CheckDate($element) {
if ($element.is('input:text')) {
if ($element.val().trim() == "") {
return;
}
if ($.inArray($element[0], objValidationFailed) === -1) {
if (!$.validate($element.val().trim(), "isDate")) {
validated = false;
objValidationFailed.push($element[0]);
$element.addClass('error');
function validateDetails() {
/**
Clear all errors at the start
*/
for (i = 0; i < objValidationFailed.length; i++) {
$(objValidationFailed[i]).removeClass('error');
}
validated = true;
General
1. Site uses a cache buster for expiring .js, .css, and images
2. JavaScript and CSS is minified and concatenated into logical groupings
3. Images have been optimized by ImageOptim (http://imageoptim.com/)
Markup
1. Code does not contain inline JavaScript event listeners
public bool HasError()
{
int responseCode = (int)StatusCode;
return responseCode >= 400;
}
PaymentResponse response = _networking.SendRequest(request);
PaymentValidationResult result = PaymentValidationResult.Success;
if (response.StatusCode.Is(400))
{
'''
REST Ful WEB API in Flask
Simple Rest api in which resource is list of tasks
methods are implemented for GET, POST, PUT, DELETE
Reference: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
'''
from flask import Flask, jsonify, abort, make_response, request, url_for
from flask.ext.httpauth import HTTPBasicAuth

Questions about Distributed systems by @tsantero.

  1. explain the life of an http request.
  2. what does the FLP result teach us?
  3. what is a byzantine failure?
  4. explain CRDTs
  5. explain linearizability.
  6. how does DNS work?
  7. crash-stop vs crash-recovery?
  8. difference between soft and hard real time
@gladiatorAsh
gladiatorAsh / gist:f7be3ebaec87e4d6e18c014f25ba1c0b
Created March 31, 2018 09:33
JavaScript equivalent for document.ready of jQuery
/*
//Works for-
//IE6 and up
//Firefox 3.6 and up
//Chrome 14 and up
//Safari 5.1 and up
//Opera 11.6 and up
//Multiple iOS devices
//Multiple Android devices
@gladiatorAsh
gladiatorAsh / pwd.js
Created May 17, 2018 04:53
List of most used passwords (Why this approach??)
{passwords:"123456,password,12345678,qwerty,123456789,12345,1234,111111,1234567,dragon,123123,baseball,abc123,football,monkey,letmein,shadow,master,696969,mustang,666666,qwertyuiop,123321,1234567890,pussy,superman,654321,1qaz2wsx,7777777,fuckyou,qazwsx,jordan,123qwe,000000,killer,trustno1,hunter,harley,zxcvbnm,asdfgh,buster,batman,soccer,tigger,charlie,sunshine,iloveyou,fuckme,ranger,hockey,computer,starwars,asshole,pepper,klaster,112233,zxcvbn,freedom,princess,maggie,pass,ginger,11111111,131313,fuck,love,cheese,159753,summer,chelsea,dallas,biteme,matrix,yankees,6969,corvette,austin,access,thunder,merlin,secret,diamond,hello,hammer,fucker,1234qwer,silver,gfhjkm,internet,samantha,golfer,scooter,test,orange,cookie,q1w2e3r4t5,maverick,sparky,phoenix,mickey,bigdog,snoopy,guitar,whatever,chicken,camaro,mercedes,peanut,ferrari,falcon,cowboy,welcome,sexy,samsung,steelers,smokey,dakota,arsenal,boomer,eagles,tigers,marina,nascar,booboo,gateway,yellow,porsche,monster,spider,diablo,hannah,bulldog,junior,london,purple,co
/**
* Scores a password's strength.
*
* It scores a password according to several factors like character variation,
* repetition and length. The passwords are scored in a numeric point scale that
* varies from less than 0 to 100 and more. A safe password score should be
* considered as 49 points or more.
*
* @param {String} pwd The password string to score.
*