Skip to content

Instantly share code, notes, and snippets.

Geshan Manandhar geshan

Block or report user

Report or block geshan

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
@geshan
geshan / exchangeRates.js
Created Oct 10, 2018
exchange rates part
View exchangeRates.js
async function get(params) {
const today = new Date().toISOString().split('T')[0];
const {fromCurrency='AUD', toCurrency='USD', onDate=today} = params;
let exchangeRates = await db.query(
`SELECT rate, created_at FROM exchange_rates WHERE from_currency = ? AND to_currency = ? AND on_date = ?`,
[fromCurrency, toCurrency, onDate]
);
if (exchangeRates.length) {
View domain-shortlist-page-to-ids.js
urls = $$('a.listing-result__address');
links = [];
ids = [];
for (url in urls) {
links.push(urls[url].href.split('-'));
}
for(linkArr of links) {
ids.push(linkArr[linkArr.length - 1]);
}
console.log(ids.join());
View generator.js
var codes = generateUniqueCodes(10000000);
var query = printQuery(codes);
console.log(query);
function unique(arr) {
var sorted = arr;
sorted.sort();
return sorted.filter(function(value, index, arr){
if(index < 1)
return true;
View php-unit-checkout.php
<?php
namespace DataProvider\Example\Test;
use DataProvider\Example\Checkout;
use PHPUnit_Framework_TestCase;
/**
* Checkout test for Cash and Credit card.
*/
View checkout_with_offline_payment.feature
@checkout
Feature: Checkout with offline payment
In order to pay with cash or by external means
As a Customer
I want to be able to complete checkout process without paying
Background:
Given the store operates on a single channel in "France"
And the store has a product "PHP T-Shirt" priced at "$19.99"
And the store ships everywhere for free
View scope-and-steps-outlines.md

Scope and steps for user system ticket - PX-4

Proposed steps to develop the ticket:

  1. Add new table to the main db users table, with needed columns (id, email, password, first_name, last_name, restore_key, created_at, updated_at)
  2. Add a migration for the columns mentioned above
  3. Tests the migration on local and also record the time it takes to run locally.
  4. Add form to create new user and make persist it in the db table. Password will be encrypted using SHA512.
  5. Do basic validation like required
  6. Enhance validation to accept only email in email field, accept only alphabets (not numbers) for first name and last name.
@geshan
geshan / sauce-connect.sh
Last active Jan 23, 2019 — forked from sarahhodne/sauce-connect.sh
sauce connect with verbose logging
View sauce-connect.sh
#!/bin/bash
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
echo "This script can't run without your Sauce credentials"
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
echo "export SAUCE_USERNAME=ur-username"
echo "export SAUCE_ACCESS_KEY=ur-access-key"
exit 1
fi
SAUCE_TMP_DIR="$(mktemp -d -t sc.XXXX)"
@geshan
geshan / 0_reuse_code.js
Created Jul 19, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View vagrant-up
~/Projects/vagrant ᐅ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'puphpet/ubuntu1404-x64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 9137 (adapter 1)
View gist:1916902
<?php
print "hello world";
?>
You can’t perform that action at this time.