Skip to content

Instantly share code, notes, and snippets.

🚴
Focusing

Romans Malinovskis romaninsh

🚴
Focusing
Block or report user

Report or block romaninsh

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
@romaninsh
romaninsh / lambda-vpc-internet-access-cloudformation.yml
Last active Oct 4, 2019
CloudFormation template implementing Private network which can be used by Serverless to deploy Lambda into VPCs an maintaining internet access
View lambda-vpc-internet-access-cloudformation.yml
# 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
View atk4JS.js
(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__) {
View countries.sql
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 Jan 16, 2017
A fully-featured web app in 30-lines with Agile UI.
View ui-app.php
<?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 Dec 22, 2016
Watch your .pug and .jade files
View pugwatch
#!/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
View Agile Data - UNION Model usage.php
<?php
namespace smbo;
class Model_Report_Ledger2 extends UnionModel {
use \atk4\core\AppScopeTrait;
function init() {
parent::init();
$this->addInvoices();
$this->addPayments();
View test2.php
<?php
namespace smbo\tests;
/**
* Tests usage of classes thorugh bridge
*/
class InvoiceTest extends TestCase
{
function testInvoiceCreation()
{
View testscript.php
<?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 Oct 26, 2016
Define Unique Fields in Domain Model with Agile Data
View Controller_UniqueFields.php
<?php
namespace smbo;
class Controller_UniqueFields {
use \atk4\core\InitializerTrait {
init as _init;
}
use \atk4\core\TrackableTrait;
use \atk4\core\AppScopeTrait;
You can’t perform that action at this time.