Skip to content

Instantly share code, notes, and snippets.

View oliverlundquist's full-sized avatar

Oliver Lundquist oliverlundquist

View GitHub Profile
@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')
<?php
function monthly($from, $to)
{
$months = $this->monthsBetween($from, $to);
$salesData = [];
if (count($months) > 6) {
return null;
}

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 namespace Kurashicom\Store\Analytics\Sales;
use Illuminate\Database\DatabaseManager as SqlDatabaseManager;
use Kurashicom\Traits\MetaPropertiesTrait;
class Sales implements SalesInterface
{
use MetaPropertiesTrait;
/**
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,
@oliverlundquist
oliverlundquist / gist:bf345ef3eb06bd02cb0d
Created October 29, 2015 06:00
sublime user settings
{
"color_scheme": "Packages/Colorsublime - Themes/Github.tmTheme",
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"font_size": 13,
"ignored_packages":
[
"Vintage"
],
"trim_automatic_white_space": false,
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Graph 1</title>
<style>
body {
background-color:#eee;
text-align:center;
}
<?php
class SymfonyFile extends SplFileInfo
{
public function __construct($path, $originalName, $mimeType = null, $size = null) {
parent::__construct($path);
}
}
class FileHandler
<?php
trait MetaProperties {
public function getLimit() {
return $this->limit;
}
public function setLimit($limit) {
$this->limit = $limit <= $this->maxLimit ? $limit : $this->maxLimit;
}
}
<?php
trait MetaProperties {
public $limit = 0;
public function setLimit($limit) {
$this->limit = $limit <= $this->maxCount ? $limit : $this->maxCount;
}
public function getLimit() {
return $this->limit;