Skip to content

Instantly share code, notes, and snippets.

🎯
$mol on atom2

nin-jin nin-jin

🎯
$mol on atom2
Block or report user

Report or block nin-jin

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
@nin-jin
nin-jin / harp-request.md
Last active Jun 22, 2019
HARP - Hypermedia Abstract Resource Protocol
View harp-request.md

Requirements:

  1. One line query through uri.
  2. Filtering
  3. Sorting
  4. Limitation
  5. Partial fetching
  6. Fetching linked resources
  7. Normalized response
  8. Bulk requests
@nin-jin
nin-jin / args.js
Created May 2, 2017
NodeJS arguments processing
View args.js
var args = {}
process.argv.slice(2).forEach( param => {
var values = param.split( '=' )
var key = values.shift()
args[ key ] = ( args[ key ] || [] ).concat( values.join( '=' ) )
} )
var actions = {
'help help' : args => `help\t\tPrints help (default action)\n` ,
'help' : args => `\nSuper-puper server!\n${ actions['actions']() }${ actions['options']() }`,
@nin-jin
nin-jin / cycle_hello.js
Last active Jan 26, 2017
CycleJS vs $mol
View cycle_hello.js
import {run} from '@cycle/xstream-run';
import {div, label, input, hr, h1, makeDOMDriver} from '@cycle/dom';
function main(sources) {
const sinks = {
DOM: sources.DOM.select('.field').events('input')
.map(ev => ev.target.value)
.startWith('')
.map(name =>
div([
View todomvc.view2.tree.sass
$mol_app_todomvc : $mol_scroller
#childs /
#pager : $mol_lister
.childs /
#titler : $mol_viewer
.heightMinimal = 142
.childs /
#title @ \todos
#paneler : $mol_lister
.rows <= #panels /
View gist:33f744f60a5da7c10151
// Открываем http://nin-jin.github.io/demo/list/index.html
// Вводим в консоль:
// Включаем все логи
$jin2_log_filter=/./
// Меняем фамилию одного персонажа
$jin2_demo_list_person.item( '55e06d82e14bac808b2bc77f' ).lastName.set( 'Aaron' )
// Получаем следующие обновления состояний:
View string-mixin-runtime-error.d
import std.stdio;
T eval( string op , T )( T a , T b ) {
return mixin( q{a} ~ op ~ q{b} );
}
unittest {
writeln( eval!q{/}( 123 , 0 ) );
}
@nin-jin
nin-jin / coroutine.d
Last active Oct 9, 2015
Sorting comparison
View coroutine.d
import vibe.core.core;
import core.time;
import std.stdio;
int counter;
void say( string name ) {
for ( int i = 0 ; i < 3; i++ ) {
sleep( 100.msecs );
writeln( ++counter , " " , name );
@nin-jin
nin-jin / gist:111f32935da5c758a1c8
Last active Nov 25, 2015
Dlang non blocking messaging
View gist:111f32935da5c758a1c8
import std.stdio;
import std.concurrency;
import std.conv;
import core.thread;
shared class Msg
{
string value;
Msg next = null;
Tid from;
You can’t perform that action at this time.