Skip to content

Instantly share code, notes, and snippets.

View oliverlundquist's full-sized avatar

Oliver Lundquist oliverlundquist

View GitHub Profile
select
CAST(SUM(`o_p`.`cost` * `o_p`.`count`) as UNSIGNED) as `cost`,
CAST(SUM(`o_t`.`subtotal`) as UNSIGNED) as `subtotal`,
CAST(SUM(`o_t`.`shipping_fee`) as UNSIGNED) as `shipping_fee`,
CAST(SUM(`o_t`.`payment_fee`) as UNSIGNED) as `payment_fee`,
CAST(SUM(`o_t`.`wrapping_total`) as UNSIGNED) as `wrapping_total`,
CAST(SUM(`o_t`.`points_discount`) as UNSIGNED) as `points_discount`,
CAST(SUM(`o_t`.`total`) as UNSIGNED) as `total`
from
order_products as o_p,
<?php namespace Kurashicom\Store\Analytics\Sales;
use Illuminate\Database\DatabaseManager as SqlDatabaseManager;
use Kurashicom\Traits\MetaPropertiesTrait;
class Sales implements SalesInterface
{
use MetaPropertiesTrait;
/**

Who's Oliver Lundquist?

  • 9 years experience of living and working in Japan.
  • Built an e-commerce platform from scratch with 1.1 million USD in monthly sales and 10 million pageviews per month.
  • 6 years experience developing web applications and corporate sites.
  • Full-stack developer with strong proficiency in
    • JavaScript (AngularJS, ReactJS, NodeJS, ExpressJS, jQuery)
    • PHP (Laravel, WordPress)
    • Ruby (Sinatra, Rails)
  • Testing (Jasmine, Mocha, PHPUnit, RSpec)
<?php
function monthly($from, $to)
{
$months = $this->monthsBetween($from, $to);
$salesData = [];
if (count($months) > 6) {
return null;
}
@oliverlundquist
oliverlundquist / double-to-single-byte.js
Created May 11, 2016 02:19
Double Byte to Single Byte (JS)
var input = 'Taro Suzuki 234234234456456';
var output = input
.replace(/[Aa]/g, 'A')
.replace(/[Bb]/g, 'B')
.replace(/[Cc]/g, 'C')
.replace(/[Dd]/g, 'D')
.replace(/[Ee]/g, 'E')
.replace(/[Ff]/g, 'F')
.replace(/[Gg]/g, 'G')
.replace(/[Hh]/g, 'H')
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>.letter { position: absolute; font-size: 15px; }</style>
</head>
<body>
<div class="letter">k</div>
<div class="letter">u</div>
<div class="letter">r</div>
@oliverlundquist
oliverlundquist / Makefile
Last active June 17, 2016 11:59
Docker Makefile
##
# Environment Variables
##
NAMESPACE=oliverlundquist
TAG=latest
NETWORK_NAME=mystore-api
REPO_PATH=~/repositories/mystoreno/mystore-api
NGINX_ID=`docker ps | grep $(NAMESPACE)/nginx:$(TAG) | cut -d ' ' -f1`
PHP_ID=`docker ps | grep $(NAMESPACE)/php7:$(TAG) | cut -d ' ' -f1`
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 <<- ENDSSH > test.txt
mysqldump -h0.0.0.0 -uroot -proot -d mystore2 mysql -h0.0.0.0 -uroot -proot -D mystore2 -Bse "SHOW TABLES LIKE 'chips_%'"
ENDSSH
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 '
HOST=0.0.0.0
USERNAME=root
PASSWORD=root
DATABASE=mystore2
ssh -i ~/.vagrant.d/insecure_private_key 192.168.100.109 '
HOST='0.0.0.0'
USERNAME=root
PASSWORD=root
DATABASE=mystore2
TABLES='mysql --host=$HOST --user=$USERNAME --password=$PASSWORD --database=$DATABASE --batch --silent --execute \'SHOW TABLES LIKE \'chips_%\'\''
mysqldump --host=$HOST --user=$USERNAME --password=$PASSWORD --no-data $DATABASE $TABLES
' > test.sql
<!DOCTYPE html>
<html>
<head>
<title>RxJS Playground</title>
<style>
body {
padding-top: 50px;
}
.cube {