profile
viewpoint
Jussi Kinnula jussikinnula @WunderdogSW Helsinki Senior Software Developer & Consultant at @wunderdogsw, Full Stack Developer, JavaScript Frameworks, Perl, PHP, WordPress and beyond.

jussikinnula/angular-socket-io-chat 133

An example Angular chat app, made on top of ExpressJS & Socket.io.

jussikinnula/angular-mean-starter 37

Angular MEAN starter - MongoDB + ExpressJS + Angular + NodeJS

jussikinnula/angular2-universal-wordpress 14

Angular 2 Universal + WordPress REST API

jussikinnula/angular2-express-phantom 5

Angular 2 + ExpressJS + PhantomJS pre-rendering boilerplate

femafi/femafi 2

Finnish Electronic Music Association website

jussikinnula/angular-catalyst-starter 2

Angular Catalyst Starter

jussikinnula/angular2-universal-wordpress-wp-test 2

WordPress boilerplate with modern development tools, easier configuration, and an improved folder structure.

jussikinnula/angular-webshop 1

Webshop platform made with AngularJS, Bootstrap and Catalyst Framework

jussikinnula/catalyst-analytics-tool 1

A simple analytics tool

jussikinnula/catalyst-oauth-example 1

An example Catalyst WebApp for using OAuth2 on Facebook, Google and Instagram.

PR opened romeovs/lcov-reporter-action

Add statement coverage into tabulate

I wanted to make the comment match the same format as is produced by clover.xml and lcov.info report producing tools. So basically adding statement coverage into comment.

Preview

coverage

+14 -1

0 comment

1 changed file

pr created time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha 61b6e49c4c52d577ca596a3c5463bb4ad04de4f0

Add statement coverage into tabulate

view details

Jussi Kinnula

commit sha c2bed6c3730bd9fe1df6c0d198ae7f1a973f3d4d

Build

view details

push time in 20 days

create barnchjussikinnula/lcov-reporter-action

branch : add-statement-coverage

created branch time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha 4d6f0f866367f476b750fdda83e360eabc49da98

WIP

view details

push time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha d4d9a56e32aa4b7dc7fb45fe4bd246611fd4b0c2

WIP

view details

push time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha 1f5b66137e705ac12ea5b630972769cc654747be

WIP

view details

push time in 20 days

fork jussikinnula/lcov-reporter-action

Comments a pull request with the jest code coverage

fork in 20 days

push eventjussikinnula/coverage-monitor-action

Jussi Kinnula

commit sha bfaeebb6f95c91feb4b257dd8e9c395df35cc16b

Fix coverage reporting + change method -> function (in JavaScript it's always "function")

view details

Jussi Kinnula

commit sha 6e6bba266bd4d9441e5afc65af8b31d68383dbeb

Build

view details

push time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha 4bd6e65287254ab2338c0bc6691b4728f3a2434a

WIP

view details

push time in 20 days

push eventjussikinnula/lcov-reporter-action

Jussi Kinnula

commit sha dfeb258c4c1ff9ec88ea5f0c73abeb4b31386730

Add statements percentage into a column

view details

Jussi Kinnula

commit sha 661fd786f935be5fbded5863df519e073bbd832d

WIP

view details

push time in 20 days

fork jussikinnula/lcov-reporter-action

Comments a pull request with the jest code coverage

fork in 20 days

push eventjussikinnula/circle-flags

Jussi Kinnula

commit sha e2d181e5b213c32aecee0321066ab630526cda4b

Add package.json & instructions how to install with NPM

view details

push time in a month

fork jussikinnula/circle-flags

A collection of 300+ minimal circular SVG country flags

https://hatscripts.github.io/circle-flags

fork in a month

push eventjussikinnula/rn-text-detector

Jussi Kinnula

commit sha 3576165fa0b50cda1bc463e84c97605d4e934e01

Fix Android

view details

push time in 2 months

push eventfemafi/femafi

push time in 2 months

create barnchfemafi/femafi

branch : temp

created branch time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 840ffe2887b421db7345b71c53d1fff63748e498

Remove .nvmrc

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 01ba3795384208524dbf546ad1f2609868db5073

Second attempt: Upgrade only essential packages + remove ts-optchain

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha a315241c5a0bcbcf79018eb6ed412a3f8a86c525

Try adding .babelrc

view details

Jussi Kinnula

commit sha bb144317b909235b5ac9eef2e27ffae64cfaa140

Use latest NodeJS again

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 896ec8e869169119be6389928a9a910b750e2e61

Use NodeJS v12.18.3

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 5101e5cd6abe9833007f6c7d482bf73433bc57b4

Use latest NodeJS and use workaround to fix Gatsby GraphQL issue

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 18c2e2b625e4082023f0c333157ac4c03b4759b1

Use v12.13.1 NodeJS version in .nvmrc

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 3c2e80a5cdb2a0db81dc81c2446c54de4c6ae8c6

Add .nvmrc

view details

push time in 2 months

push eventfemafi/femafi

Jussi Kinnula

commit sha 8a6195a702433ffed150bf2bae04ed0e6a4652bf

Upgrade packages + fix Quicksand font + change iframe slice to use @react-hook/window-size

view details

push time in 2 months

startedzombodb/zombodb

started time in 3 months

issue openedporsager/postgres

Feature: There should be easier way to WHERE/OR/AND combinations

Here's working code similar I use in an application. The application is closed source, I haven't tested this actual code - but I'll test it and fix if there are issues.

So I'm proposing that there should be sql.or() orsql.and()` kind of mechanism so that complex WHERE/OR/AND combinations could be written. This example illustrates the "problem":

import postgres from 'postgres';

// How to make getItems simpler?
const getItems = (where: {
  foo: string[];
  bar: string[];
  baz: string[];
} = {}) => {
  const { foo = [], bar = [], baz = [] } = params;

  // This should be enough (pseudo code, also OR case should be thought of)
  //
  // return sql`
  //   SELECT * FROM items WHERE ${sql.and(where)}
  // `;
  // 
  // For inspiration, Perl DBIx has a pretty good and versatile syntax:
  // https://stackoverflow.com/questions/27962418/how-do-i-do-where-or-and-and-with-dbixclass

  if (foos.length && bars.length && bazs.length) {
    return sql`
      SELECT * FROM items
        WHERE foo IN (${foo})
          AND bar IN (${bar})
          AND baz NOT IN (${baz})
    `;
  }

  if (foos.length && bars.length) {
    return sql`
      SELECT * FROM items
        WHERE foo IN (${foo})
          AND bar IN (${bar})
    `;
  }

  if (foos.length && bazs.length) {
    return sql`
      SELECT * FROM items
        WHERE foo IN (${foo})
          AND baz NOT IN (${baz})
    `;
  }

  if (bars.length && bazs.length) {
    return sql`
      SELECT * FROM items
        WHERE bar IN (${bar})
          AND baz NOT IN (${baz})
    `;
  }

  if (bars.length) {
    return sql`
      SELECT * FROM items
        WHERE bar IN (${bar})
    `;
  }

  if (bazs.length) {
    return sql`
      SELECT * FROM items
        WHERE NOT baz IN (${bazs})
    `;
  }}

(async function run() {
  const sql = postgres(process.env.DATABASE_URL || 'postgres://localhost:5432/test');

  await sql`
    DROP TABLE IF EXISTS test
  `;

  await sql`
    CREATE TABLE items (
      id int NOT NULL,
      foo char(1) NOT NULL,
      bar char(1) NOT NULL,
      baz char(1) NOT NULL,
      CONSTRAINT foos_pk PRIMARY KEY (id)
    );
  `;

  const items = [
    { id: 1, foo: 'a', bar: 'a', baz: 'a' },
    { id: 2, foo: 'a', bar: 'a', baz: 'b' },
    { id: 3, foo: 'a', bar: 'b', baz: 'a' },
    { id: 4, foo: 'b', bar: 'a', baz: 'a' },
    { id: 5, foo: 'b', bar: 'a', baz: 'b' },
    { id: 6, foo: 'a', bar: 'b', baz: 'b' },
    { id: 7, foo: 'b', bar: 'b', baz: 'b' },
    { id: 8, foo: 'b', bar: 'b', baz: 'c' },
    { id: 9, foo: 'b', bar: 'c', baz: 'b' },
    { id: 10, foo: 'c', bar: 'b', baz: 'b' },
    { id: 11, foo: 'c', bar: 'b', baz: 'c' },
    { id: 12, foo: 'c', bar: 'c', baz: 'c' },
  ];

  const rows = await sql`
    INSERT INTO items ${sql(items, Object.keys(items[0]))}
  `;

  console.log(await getItems({ foos: ['a', 'b'] }));
  console.log(await getItems({ bars: ['c'], bazs: ['a', 'c'] }));
  console.log(await getItems({ foos: ['c'], bars: ['b', 'c'], bazs: ['b'] }));

  process.exit();
})();

created time in 3 months

issue commentporsager/postgres

Cannot escape column names

There's a typo in the second insert statement. The table name should be users instead of foo.

Sorry about the typo. It is now fixed. Anyway, if changing the table column name user to for example user2 - both of the cases work.

There's a list of reserved words, which need quotes. So there should be anyway some way to use column names with those reserved words, like on the Step 1 one can do.

I'm talking about this list: https://www.postgresql.org/docs/8.1/sql-keywords-appendix.html

jussikinnula

comment created time in 3 months

startedporsager/postgres

started time in 3 months

issue openedporsager/postgres

Cannot escape column names

Test case:

import postgres from 'postgres';

(async function run() {
  const sql = postgres(process.env.DATABASE_URL || 'postgres://localhost:5432/test');

  await sql`
    DROP TABLE IF EXISTS users
  `;

  await sql`
    CREATE TABLE users (
      "user" varchar(255) NOT NULL,
      CONSTRAINT users_pk PRIMARY KEY ("user")
    );
  `;

  // Works
  console.info('Step 1: Insert user with manually escaping restricted word')
  const rows = await sql`
    INSERT INTO users ("user") VALUES('test user')
  `;
  console.info('Step 1: Completed\n')

  // Does not work
  console.info('Step 2: Insert user by using JS object')
  const user = { user: 'another test user' };
  await sql`
    INSERT INTO foo ${sql(user, 'user')}
  `.catch(() => {
    console.error('Step 2: As expected, it did fail...');
    return Promise.resolve();
  });
  console.info('Step 2: Completed\n')

  console.info('All done!')

  process.exit();
})();

created time in 3 months

issue openedporsager/postgres

Insert many leaks memory (column name hash)

Test case:

import postgres from 'postgres';

let index = 0;
const nextIndex = () => {
  index += 1;
  return index;
};

const createItems = (size: number, label: string) => [...Array(size)].map(() => ({
  id: nextIndex(),
  label,
}));

(async function run() {
  const sql = postgres(process.env.DATABASE_URL || 'postgres://localhost:5432/test');

  await sql`
    DROP TABLE IF EXISTS foo
  `;

  await sql`
    CREATE TABLE foo (
      id integer NOT NULL,
      label varchar(255) NOT NULL,
      CONSTRAINT foo_pk PRIMARY KEY (id)
    );
  `;

  // Works
  console.info('Step 1: Inserting 32767 items started...')
  const items = createItems(32767, 'This works');
  const rows = await sql`
    INSERT INTO foo ${sql(items, 'id', 'label')}
  `;
  console.info('Step 1: Completed\n')

  // Does not work
  console.info('Step 2: Try to insert 32768 in array...')
  const items2 = createItems(32768, 'This does not work');
  await sql`
    INSERT INTO foo ${sql(items2, 'id', 'label')}
  `.catch(() => {
    console.error('Step 2: As expected, it did fail...');
    return Promise.resolve();
  });
  console.info('Step 2: Completed\n')

  // Does not work
  console.info('Step 3: Inserting 32768 items started one item at time...')
  const items3 = createItems(32768, 'Workaround');
  await Promise.all(items3.map(item => sql`
    INSERT INTO foo ${sql(item, 'id', 'label')}
  `));
  console.info('Step 3: Completed\n')

  console.info('All done!')

  process.exit();
})();

Most probably inserting many rows at once should use a Set instead of Array to overcome the problem.

created time in 3 months

more