Skip to content

Instantly share code, notes, and snippets.

View ArsalanDotMe's full-sized avatar

Arsalan Ahmad ArsalanDotMe

View GitHub Profile
@ArsalanDotMe
ArsalanDotMe / Shuffle
Created November 16, 2014 12:06
Shuffle Extension and Take random subelements
public static class EnumerableExtensions
{
public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> source)
{
return source.Shuffle(new Random());
}
public static IEnumerable<T> Shuffle<T>(
this IEnumerable<T> source, Random rng)
{
@ArsalanDotMe
ArsalanDotMe / gist:c8297af60a6c714c006a
Last active August 29, 2015 14:10
Sample json data.
{
"title": "The Alchemist",
"time_scraped": 2032123123,
"images": ["http://www.786cart.com/images/9780061233845.jpg"],
"price": 230,
"attributes": {
"excrept": "Haza Baza",
"description": "Nilo turbare circulos mios",
"pages": 320,
"cover": "Hard"
@ArsalanDotMe
ArsalanDotMe / casper.js
Last active August 29, 2015 14:19
Casper Test Case
casper.test.begin('Results are within price range', function (test) {
var MAX_PRICE = 5000, MIN_PRICE = 1000;
function getPrices() {
var priceNodes = document.querySelectorAll('.productinfo > h2');
return Array.prototype.map.call(priceNodes, function (e) {
var pt = e.textContent;
var num = /[\d,]+/.exec(pt);
var cleanNumber = num[0].replace(/,/g, '');
return Number(cleanNumber);
});
@ArsalanDotMe
ArsalanDotMe / macro.js
Created May 26, 2015 16:46
Feedback Submitter
javascript:(function(){var a=document.querySelectorAll('tr > td:nth-child(2) > input[type="radio"]:nth-child(1)');for(var i=0;i<a.length;i++){a.item(i).checked=true}})();
@ArsalanDotMe
ArsalanDotMe / VagrantFile
Last active August 29, 2015 14:24
Node Development VagrantFile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@ArsalanDotMe
ArsalanDotMe / sdk.md
Created July 13, 2015 07:18
SDK Documentation

#Functions

ReturnTotalDiscountCall()

Returns simple item*quantity amount of items in cart.

ReturnTotal()

Like ReturnTotalDiscountCall but applies discounts and taxes.

returnDiscount()

Returns discount.

@ArsalanDotMe
ArsalanDotMe / problems.txt
Created June 19, 2017 11:28
Simple Programming Test
Problem 1:
Given a list of numbers, find the most frequent integer
Input Example:
12 5 6.7 234 0 22 5
Output Example:
5

Keybase proof

I hereby claim:

  • I am arsalandotme on github.
  • I am arsalandotme (https://keybase.io/arsalandotme) on keybase.
  • I have a public key ASAMjh475z_xNZSMwVAZMO7z0E_6pyF9FibN876TM5gzygo

To claim this, I am signing this object: