Skip to content

Instantly share code, notes, and snippets.

View geshan's full-sized avatar

Geshan Manandhar geshan

View GitHub Profile
@geshan
geshan / vagrant-up
Created July 5, 2014 09:03
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)
@geshan
geshan / 0_reuse_code.js
Created July 19, 2014 12:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@geshan
geshan / gist:1916902
Created February 26, 2012 13:49
a test gist
<?php
print "hello world";
?>
@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
@geshan
geshan / php-unit-checkout.php
Created March 17, 2016 06:59
simple-unit-test
<?php
namespace DataProvider\Example\Test;
use DataProvider\Example\Checkout;
use PHPUnit_Framework_TestCase;
/**
* Checkout test for Cash and Credit card.
*/
@geshan
geshan / generator.js
Created April 21, 2016 10:30
generator
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;
@geshan
geshan / domain-shortlist-page-to-ids.js
Created August 18, 2018 23:22
domain-shortlist-to-ids
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());
@geshan
geshan / exchangeRates.js
Created October 10, 2018 11:23
exchange rates part
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) {
@geshan
geshan / sauce-connect.sh
Last active January 23, 2019 09:35 — forked from sarahhodne/sauce-connect.sh
sauce connect with verbose logging
#!/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 / scope-and-steps-outlines.md
Last active January 5, 2021 23:38
user system ticket

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.