Warning: Undefined array key "rss_show_deleted" in /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/feed.php on line 53
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/feed.php on line 54
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/feed.php on line 55
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/feed.php on line 56
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/inc/httputils.php on line 32
Warning: Cannot modify header information - headers already sent by (output started at /var/www/w12/dw/inc/Feed/FeedCreatorOptions.php:86) in /var/www/w12/dw/inc/httputils.php on line 33 wi12.unix7.org - js
https://w12.unix7.org/
Wed, 05 Aug 2026 03:50:11 +0000FeedCreator 1.8https://w12.unix7.org/_media/wiki/dokuwiki.svgwi12.unix7.org
https://w12.unix7.org/
Angular 2 micro application with NgRx store
https://w12.unix7.org/js/angular-mini-ngrx
js
Angular 2 micro application with NgRx store
import { Component, NgModule } from '@angular/core'
import { Store, Action, StoreModule } from '@ngrx/store'
import { Observable } from 'rxjs'
import { BrowserModule } from '@angular/platform-browser'
interface AppState {
counter: number
}
export function reducer(counter: number = 0, action: Action) {
console.log('#called reducer with action.type=' + action.type)
return counter + 1
}
@Component({
selector: 'app-root',
temp…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Angular NgRx store
https://w12.unix7.org/js/angular-store
js
Angular NgRx store
models/user.model.ts
export interface User {
auth? : boolean
id? : number
name? : string
password? : string
}
store/reducers/auth.reducer.ts
import { Actions, userLogin, userLogout } from '../actions/auth.actions'
import { User } from '../../models/user.model'
const initialState: User = {
auth: false
}
export function authReducer(state : User = initialState, action : Actions) {
switch(action.type) {
case userLogin:
state…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000
https://w12.unix7.org/js/calendar-periods
js
/*
*
* Author, Copyright: Oleg Borodin <onborodin@gmail.com>
*
*/
let moment = require('moment')
moment.locale('ru')
function getMonths(year, quarter) {
let startDate = ''
switch (quarter) {
case 1:
startDate = year + '-01-01T00:00:00'
break
case 2:
startDate = year + '-04-01T00:00:00'
break
case 3:
startDate = year + '-07-01T00:00:00'
break
case 4:
default:
…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000
https://w12.unix7.org/js/catobj
js
/*
* Author, Copyright: Oleg Borodin <onborodin@gmail.com>
*/
let fs = require('fs')
let path = require('path')
let _ = require('lodash')
let baseDir = './zuxxxx'
let classes = [
'axxx',
'cxxxx',
'cxxxx',
'cxxxx',
'cxxxx',
'cxxxx',
'foxxx',
'inxxx'
]
for (let n in classes) {
let className = classes[n]
let dir = path.join(baseDir, className)
let files = fs.readdirSync(dir)
let mix = {}
for (let i in files) {
data = fs.readFileSy…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000AngularII sample
https://w12.unix7.org/js/hello-angular2
js
AngularII sample
It is example of very simple state engine on Angular II.
Run there <https://de7.unix7.org>
app.component.html
<h5>{{ header }}</h5>
{{ message }}
<table>
<thead>
<tr>
<th>#</th>
<th>имя</th>
<th>рейтинг</th>
<th>состояние</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let item of dataRecords; let i = index" >
<td>{{ i + 1 }}</td>
<td [ngStyle]="setStyle(i)" >{{ item…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Vue JSON RPC plugin
https://w12.unix7.org/js/jeyson-vue-plugin
js
Vue JSON RPC plugin
Using this plugin you can do remote procedure call into any component with one shared method like
this.$jclient.request('add', { x: 1, y: 2 }, function(err, res) {
if(!err) {
.....
}
})
Plugin
'use strict'
import jayson from 'jayson/lib/client/browser'
import axios from 'axios'
var createTransport = function(url) {
return function(request, callback) {
axios
.post(url, request,
{ transformResponse: …anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Jeyson JSON RPC usage sample
https://w12.unix7.org/js/jeyson
js
Jeyson JSON RPC usage sample
In the sample I used named parameters.
NPM: <https://www.npmjs.com/package/jayson>
Server code
const express = require('express')
const bodyParser = require('body-parser')
const jayson = require('jayson')
const rpcBundle = {
add: function(a, b, callback) {
console.log({a, b})
let c = a + b;
callback(null, c);
}
}
const app = express()
app.use(bodyParser.urlencoded({extended: true}))
app.use(bodyParser.json())
app.post('/api…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000JQuery dynamic dialog sample
https://w12.unix7.org/js/jquery-req-cirlce
js
JQuery dynamic dialog sample
Learning sample.
<!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phalcon App</title>
<link rel="stylesheet" href="/css/foundation-float.min.css">
<link rel="stylesheet" href="/css/app.css">
<link rel="stylesheet" href="/icons/found…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Mixin usage sample
https://w12.unix7.org/js/mixin-w-vs-wo-demo
js
Mixin usage sample
Component with mixin, 50 lines
<template src="./users.html"></template>
<style scoped src="./users.css"></style>
<script lang="ts">
import { Vue, Component, Mixins } from "vue-property-decorator"
import foundation from '../foundation'
interface DataRecord {
id: number,
name: string,
password: string
}
import PageNav from './page-nav'
import PageNavMixin from './mixins/page-nav-mixin'
import CRUDFormsMixin from './mixins/crud-forms-mixin'
import SortRecor…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Sample CRUD model and controller
https://w12.unix7.org/js/mvc-sample
js
Sample CRUD model and controller
Router
'use sctrict'
...
const users = require('users-controller').new(knex)
const express = require('express')
const app = express()
app.get('/api/users/list', users.list.bind(users))
app.post('/api/users/add', users.add.bind(users))
app.post('/api/users/update', users.update.bind(users))
app.post('/api/users/drop', users.drop.bind(users))anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Pseudo private attributes in JS
https://w12.unix7.org/js/oop-pr
js
Pseudo private attributes in JS
Very pseudo. =)
#!/usr/bin/env node
'use strict';
class A {
constructor(name) {
this._name = name;
}
name(n) {
if (n) { this._name = n; return this; }
return this._name;
}
}
let a = new A("abc");
console.log("name = " + a.name());
a.name("bbc");
console.log("name = " + a.name());
//EOFanonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000JS Promise() sample
https://w12.unix7.org/js/promise-sample
js
JS Promise() sample
#!/usr/bin/env node
// $Id$
'use strict';
var promise = new Promise(function(resolve, reject) {
resolve(5);
});
promise.then(
function(result) {
console.log('Promis resolve result: ' + result);
return 10;
}
);
function promiseDelay(interval) {
return new Promise(function(resolve) {
setTimeout(resolve, interval);
});
}
console.log('Step 0');
var oneSecondDelay = promiseDelay(2000);
oneSecondDelay
.then(
func…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Redux like
https://w12.unix7.org/js/redux-like.js
js
Redux like
Sample for demo.
“REDUX TECH”!!! =)
/*
* Author, Copyright: Oleg Borodin <onborodin@gmail.com>
*/
function createStore(reducer, initialState) {
let state = initialState
let listener = () => {}
return {
dispatch: (action, payload) => {
state = reducer(state, action, payload)
listener(state)
},
getState: () => {
return state
},
subscribe: (newListener) => {
listener = newListene…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000data aggregate class
https://w12.unix7.org/js/register.js
js
data aggregate class
var data = [
{
id: 6,
name: "gnorb",
income: 23,
},
{
id: 2,
name: "zurb",
income: 5
},
]
class Register {
constructor (data) {
this.data = data
this.sumIncome = 0
this.data.forEach((item) => {
this.sumIncome += item.income
})
}
insert(record) {
this.data.push(record)
this.sumIncome += record.income
}
}
register = new Register(d…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000
https://w12.unix7.org/js/stock-sample
js vue
<template>
<div id="lorem" class="grid-container">
<div class="grid-x grid-margin-x align-center">
<div class="cell medium-8">
<h5>Stock</h5>
<table>
<thead>
<tr>
<th>#</th>
<th>pn</th>
<th>name</th>
<th>count</th>
<th>cost</th>
…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Typescript transformation sample
https://w12.unix7.org/js/typescript-transform-sample
js
Typescript transformation sample
Original TS
class Bar {
private _percent: number = 0
constructor() {
}
get percent() : number {
return this._percent
}
set percent(percent : number) {
this._percent = percent
}
getPercent() : number {
return this._percent
}
setPercent(percent : number) : void {
this._percent = percent
}
}
let bar = new Bar()
let some : number
some = bar.percent
console.log(some)
bar.percen…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000Store: store.ts
https://w12.unix7.org/js/vue-store-w-typescipt
js
Store: store.ts
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import login from './modules/login'
export default new Vuex.Store({
state: {},
modules: {
login: login
}
})
Store module: module/login.ts
import { Module, VuexModule, Mutation, Action } from 'vuex-module-decorators'
@Module
export default class login extends VuexModule {
auth : boolean = false
@Mutation
login() {
this.auth = true
}
@Mutation
logout() {…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000
https://w12.unix7.org/js/wasm-sample
js
#include <stdio.h>
int main(int argc, char ** argv) {
printf("Hello World\n");
}
$ time emcc hello.c -s WASM=1 -o hello.html
cache:INFO: generating system asset: is_vanilla.txt... (this will be cached in "/home/xxxx/.emscripten_cache/is_vanilla.txt" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library: libc.a... (this will be cached in "/home/xxxx/.emscripten_cache/wasm-obj/libc.a" for subsequent builds)
cache:INFO: - ok
cache:INFO: generating system library…anonymous@undisclosed.example.com (Anonymous)Sat, 27 Nov 2021 13:26:11 +0000