Skip to content

Instantly share code, notes, and snippets.

View romaninsh's full-sized avatar
🚴‍♂️
Focusing

Romans Malinovskis romaninsh

🚴‍♂️
Focusing
View GitHub Profile
@romaninsh
romaninsh / lambda-vpc-internet-access-cloudformation.yml
Last active December 22, 2021 00:26
CloudFormation template implementing Private network which can be used by Serverless to deploy Lambda into VPCs an maintaining internet access
# Add the following to your existing VPC CF stack
# create 2 subnets, lambdas like to be in multiple subnets
Private1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs ]
CidrBlock: !Ref Private1CIDR
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("jQuery"));
else if(typeof define === 'function' && define.amd)
define("atk4JS", ["jQuery"], factory);
else if(typeof exports === 'object')
exports["atk4JS"] = factory(require("jQuery"));
else
root["atk4JS"] = factory(root["jQuery"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@romaninsh
romaninsh / ui-app.php
Created January 16, 2017 15:40
A fully-featured web app in 30-lines with Agile UI.
<?php
$app = new \atk4\ui\App('Hello World');
$db = new \atk4\data\Persistence_SQL($dsn);
$app->initLayout('Fluid');
$app->menu->addItem(['Demo1', 'icon'=>'form'], ['demo'=>'form']);
$app->menu->addItem(['Demo2', 'icon'=>'crud'], ['demo'=>'crud']);
$this->layout->add('View', ['view box'])->set('Entire Web APP in 30 lines of code!');
@romaninsh
romaninsh / pugwatch
Created December 22, 2016 16:54
Watch your .pug and .jade files
#!/bin/bash
## Save this file into ~/bin and make it writeable (chmod +x pugwatch)
## Execute it from your project folder, e.g. ~/Sites
## It starts up very fast, takes no memory and will instantly compile any
## JADE / PUG files as soon as you create them.
## All dependencies will be installed automatically too.
## Created this because CodeKit (which I purchased) keeps hanging and crashing and being slow for a few years now
Hello, {$tag1}, my name is {$tag2}
<?php
namespace smbo;
class Model_Report_Ledger2 extends UnionModel {
use \atk4\core\AppScopeTrait;
function init() {
parent::init();
$this->addInvoices();
$this->addPayments();
<?php
namespace smbo\tests;
/**
* Tests usage of classes thorugh bridge
*/
class InvoiceTest extends TestCase
{
function testInvoiceCreation()
{
<?php
namespace smbo\tests;
class VATRules extends TestCase
{
function complextest($is_invoice_basis, $is_invoice_locked, $is_purchase) {
if($is_invoice_basis) {
$this->app->system['is_invoice_basis'] = true;
}
@romaninsh
romaninsh / Controller_UniqueFields.php
Created October 26, 2016 13:33
Define Unique Fields in Domain Model with Agile Data
<?php
namespace smbo;
class Controller_UniqueFields {
use \atk4\core\InitializerTrait {
init as _init;
}
use \atk4\core\TrackableTrait;
use \atk4\core\AppScopeTrait;