text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Greasemonkey on Personal Blog</title>
    <link>http://localhost:1313/blog/tags/greasemonkey/</link>
    <description>Recent content in Greasemonkey on Personal Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 09 Nov 2011 21:02:57 +0000</lastBuildDate>
    <atom:link href="http://localhost:1313/blog/tags/greasemonkey/index.xml" rel="self" type="application/rss+xml" />

    <item>
      <title>Optimizar espacio en Google Reader</title>
      <link>http://localhost:1313/blog/posts/optimizar-espacio-en-google-reader/</link>
      <pubDate>Wed, 09 Nov 2011 21:02:57 +0000</pubDate>

      <guid>http://localhost:1313/blog/posts/optimizar-espacio-en-google-reader/</guid>
      <description>
Como ya todos los usuarios de Google Reader se habrán dado cuenta, Google arruinó un gran servicio.
No voy a hablar de lo que ya me quejé mucho en Google+ y Twitter ;)

Estuve buscando alternativas, ninguna satisfació mis necesidades. Por suerte existen algunas modificaciones que podemos hacer para optimizar un poco el espacio, que tanto saca esa fucking barra superior de 0.1% de usabilidad.

Primer hay que instalar GraseMonkey (addon en Firefox, supongo que está en otros navegadores), que permite via Javascript modificar funcionalidades de las páginas.
El Script que más me gustó es Google Reader Compact Minimal For Small Screen  pero hay muchos mas (muchos usuarios salieron furiosos a hacerlos). Sólo basta apretar &ldquo;Install&rdquo; con la extensión ya activada.

Así quedaría una vez instalado. Como verán saqué el screenshot en una ventana chica y se ve bastante espacio util. Una pena que la funcionalidad de compartir no pueda ser habilitada tan fácilmente.

</description>
    </item>

  </channel>
</rss>

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace WellCommerce\Bundle\AvailabilityBundle\DataGrid;

use WellCommerce\Bundle\CoreBundle\DataGrid\AbstractDataGrid;
use WellCommerce\Component\DataGrid\Column\Column;
use WellCommerce\Component\DataGrid\Column\ColumnCollection;
use WellCommerce\Component\DataGrid\Column\Options\Appearance;
use WellCommerce\Component\DataGrid\Column\Options\Filter;

/**
 * Class AvailabilityDataGrid
 *
 * @author  Adam Piotrowski <adam@wellcommerce.org>
 */
class AvailabilityDataGrid extends AbstractDataGrid
{
    /**
     * {@inheritdoc}
     */
    public function configureColumns(ColumnCollection $collection)
    {
        $collection->add(new Column([
            'id'         => 'id',
            'caption'    => $this->trans('common.label.id'),
            'appearance' => new Appearance([
                'width'   => 90,
                'visible' => false,
            ]),
            'filter'     => new Filter([
                'type' => Filter::FILTER_BETWEEN,
            ]),
        ]));

        $collection->add(new Column([
            'id'      => 'name',
            'caption' => $this->trans('common.label.name'),
        ]));
    }
}


text:
package cc.wanko.karin.app.activities;

import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import cc.wanko.karin.app.R;
import cc.wanko.karin.app.adapters.MainPagerAdapter;
import cc.wanko.karin.app.client.TwitterProvider;
import roboguice.activity.RoboActionBarActivity;
import roboguice.inject.InjectView;
import roboguice.util.Ln;
import roboguice.util.RoboAsyncTask;
import twitter4j.Status;
import twitter4j.Twitter;

public class MainActivity extends RoboActionBarActivity {
    @InjectView(R.id.main_pager)
    private ViewPager viewPager;
    @InjectView(R.id.tweet_text)
    private EditText tweetText;
    @InjectView(R.id.tweet_button)
    private Button tweetButton;

    private Twitter twitter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (!TwitterProvider.hasAccessToken(this)) {
            startActivity(OAuthActivity.createIntent(this));
            return;
        }

        final ActionBar actionBar = getSupportActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        MainPagerAdapter pagerAdapter = new MainPagerAdapter(this);
        viewPager.setAdapter(pagerAdapter);
        viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
            @Override
            public void onPageSelected(int position) {
                actionBar.selectTab(actionBar.getTabAt(position));
            }
        });
        ActionBar.TabListener tabListener = new ActionBar.TabListener() {
            @Override
            public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
                viewPager.setCurrentItem(tab.getPosition());
            }

            @Override
            public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
            }

            @Override
            public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
            }
        };
        for (int i = 0; i < pagerAdapter.getCount(); i++) {
            actionBar.addTab(actionBar.newTab()
                    .setText(pagerAdapter.getPageTitle(i))
                    .setTabListener(tabListener));
        }

        tweetButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String text = tweetText.getText().toString();
                if (!text.isEmpty()) {
                    updateStatus(text);
                }
            }
        });

        twitter = TwitterProvider.get(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        switch (item.getItemId()) {
            case R.id.action_settings:
                return true;
            case R.id.action_authorize:
                startActivity(OAuthActivity.createIntent(this));
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    private void updateStatus(final String text) {
        tweetButton.setEnabled(false);
        new RoboAsyncTask<Status>(this) {
            @Override
            public Status call() throws Exception {
                return twitter.updateStatus(text);
            }

            @Override
            protected void onSuccess(Status status) throws Exception {
                Toast.makeText(getContext(), "Updated", Toast.LENGTH_SHORT).show();
                tweetText.setText("");
            }

            @Override
            protected void onException(Exception e) throws RuntimeException {
                reportException("Could not update status", e);
            }

            @Override
            protected void onFinally() throws RuntimeException {
                tweetButton.setEnabled(true);
            }
        }.execute();
    }

    private void reportException(String message, Exception e) {
        message += ": " + e.getClass().getSimpleName() + ": " + e.getMessage();
        Toast.makeText(this, message, Toast.LENGTH_LONG).show();
        Ln.e(message);
        e.printStackTrace();
    }
}


text:
package com.easybpms.domain;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.hibernate.annotations.GenericGenerator;

@Entity
public class Parameter implements IEntity{

	@Id
	@GeneratedValue(generator="ParameterId")
	@GenericGenerator(name="ParameterId", strategy="increment")
	private int id;

	private String name;

	private String type;

	@OneToMany(mappedBy = "parameter", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<ParameterInstance> parameterInstances = new ArrayList<ParameterInstance>();

	@ManyToOne
    @JoinColumn(name = "activity_id",foreignKey=@ForeignKey(name = "activity_parameter_FK"))
    private Activity activity;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}

	public List<ParameterInstance> getParameterInstances() {
		return parameterInstances;
	}

	public void setParameterInstances(List<ParameterInstance> parameterInstances) {
		this.parameterInstances = parameterInstances;
	}

	//sincroniza a associacao bidirecional Parameter-ParameterInstance
	public void addParameterInstance(ParameterInstance parameterInstance){
		parameterInstances.add(parameterInstance);
		parameterInstance.setParameter(this);
	}

	//sincroniza a associacao bidirecional Parameter-ParameterInstance
	public void removeParameterInstance(ParameterInstance parameterInstance){
		parameterInstances.remove(parameterInstance);
		parameterInstance.setParameter(null);
	}
}


text:
    #include "wx/msw/colordlg.h"
#elif defined(__WXMAC__) && !defined(__WXUNIVERSAL__)
    #include "wx/mac/colordlg.h"
#elif defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
    #include "wx/gtk/colordlg.h"
#elif defined(__WXPALMOS__)
    #include "wx/palmos/colordlg.h"
#else
    #include "wx/generic/colrdlgg.h"

    #define wxColourDialog wxGenericColourDialog
#endif

// get the colour from user and return it
wxColour WXDLLEXPORT
wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL,
                    const wxColour& colInit = wxNullColour);

#endif // wxUSE_COLOURDLG

#endif
    // _WX_COLORDLG_H_BASE_


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>ProjectDependency (Gradle API 2.3)</title>
<meta name="date" content="2015-02-16">
<link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.gradle.api.artifacts

Interface ProjectDependency

All Superinterfaces:

Buildable, Dependency, ModuleDependency, SelfResolvingDependency

public interface ProjectDependency
extends ModuleDependency, SelfResolvingDependency

A ProjectDependency is a Dependency on another project in the current project hierarchy.

Field Summary

Fields inherited from interface org.gradle.api.artifacts.Dependency

ARCHIVES_CONFIGURATION, CLASSIFIER, DEFAULT_CONFIGURATION

Method Summary

Methods

Modifier and Type
Method and Description

ProjectDependency
copy()

Creates and returns a new dependency with the property values of this one.

Project
getDependencyProject()

Returns the project associated with this project dependency.

Configuration
getProjectConfiguration()

Returns the configuration associated with this project dependency.

Methods inherited from interface org.gradle.api.artifacts.ModuleDependency

addArtifact, artifact, exclude, getArtifacts, getConfiguration, getExcludeRules, isTransitive, setTransitive

Methods inherited from interface org.gradle.api.artifacts.SelfResolvingDependency

resolve, resolve

Methods inherited from interface org.gradle.api.artifacts.Dependency

contentEquals, getGroup, getName, getVersion

Methods inherited from interface org.gradle.api.Buildable

getBuildDependencies

Method Detail

getDependencyProject

Project getDependencyProject()

Returns the project associated with this project dependency.

getProjectConfiguration

Configuration getProjectConfiguration()

Returns the configuration associated with this project dependency. The configuration belongs to the project
 associated with this project dependency.

See Also:

getDependencyProject()

copy

ProjectDependency copy()

Creates and returns a new dependency with the property values of this one.

Specified by:

copy in interface Dependency

Specified by:

copy in interface ModuleDependency

Returns:

The copy. Never returns null.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
const _ = require('lodash');
const toSafestNumber = require('../../helpers/to-safest-number');
const toSquareMeters = require('../../helpers/to-square-meters');
const toUAH = require('../../helpers/to-uah');

const getBelongingHash = belonging => belonging.owningDate +
  belonging.totalArea +
  belonging.ua_cityType +
  belonging.ua_postCode +
  belonging.country;

const percentOwnership = function percentOwnership(belonging, belongings) {
  const belongingHash = getBelongingHash(belonging);
  const groupedByHashesBelonging = _.groupBy(
    _.map(belongings, getBelongingHash),
    bHashe => bHashe === belongingHash,
  );

  const percentOwnershipLookup =
    _.get(belonging, 'rights.1') ||

    // Refactor: this is based on side-effect that non-belongings rights object has only one key
    _.first(_.values(_.get(belonging, 'rights')));

  // if percent is set
  if (_.get(percentOwnershipLookup, 'percent-ownership')) {
    return toSafestNumber(_.get(percentOwnershipLookup, 'percent-ownership')) / 100;
  }

  const percentOwnershipProposal = toSafestNumber(1 / _.size(_.values(_.get(belonging, 'rights'))));

  if (percentOwnershipProposal === 1 && _.size(groupedByHashesBelonging.true) > 1) {
    return toSafestNumber(1 / _.size(groupedByHashesBelonging.true));
  }

  return percentOwnershipProposal;
};

const belongsToDeclarant = belonging => _.includes(_.keys(belonging.rights), '1');

module.exports = {
  getYear: function getYear(declaration) {
    const yearVariant = _.get(declaration, 'step_0.changesYear');
    const yearVariant1 = _.get(declaration, 'step_0.declarationYear1');
    const yearVariant2 = _.get(declaration, 'step_0.declarationYear2');
    const yearVariant3 = _.get(declaration, 'step_0.declarationYear3');
    const yearVariant4 = _.get(declaration, 'step_0.declarationYear4');
    return toSafestNumber(yearVariant || yearVariant1 || yearVariant2 || yearVariant3 || yearVariant4);
  },

  // Add getFamilyBankAccount
  getBankAccount: function getBankAccount(declaration) {
    return toSafestNumber(_.reduce(_.get(declaration, 'step_12'), (sum, belonging) => {
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'банк')) {
        return sum + toUAH(belonging.sizeAssets, belonging.assetsCurrency);
      }
      return sum;
    }, 0));
  },

  // Add getFamilyCash
  getCash: function getCash(declaration) {
    return toSafestNumber(_.reduce(_.get(declaration, 'step_12'), (sum, belonging) => {
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'готівк')) {
        return sum + (toUAH(belonging.sizeAssets, belonging.assetsCurrency) * percentOwnership(belonging));
      }
      return sum;
    }, 0));
  },
  getIncome: function getIncome(declaration) {
    return toSafestNumber(_.reduce(_.get(declaration, 'step_11'), (sum, belonging) => {
      if (belongsToDeclarant(belonging)) {
        return sum + toSafestNumber(belonging.sizeIncome);
      }
      return sum;
    }, 0));
  },
  getCarAmount: function getCarAmount(declaration) {
    return _.reduce(_.get(declaration, 'step_6'), (sum, belonging) => {
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'авто')) {
        return sum + 1;
      }
      return sum;
    }, 0);
  },
  getFlatArea: function getFlatArea(declaration) {
    return toSafestNumber(
      _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
        if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'квартира')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging);
        }
        return sum;
      }, 0),
    );
  },
  getFlatAmount: function getFlatAmount(declaration) {
    return _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'квартира')) {
        return sum + 1;
      }
      return sum;
    }, 0);
  },
  getHouseArea: function getHouseArea(declaration) {
    return toSafestNumber(
      _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
        if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'будинок')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging);
        }
        return sum;
      }, 0),
    );
  },
  getHouseAmount: function getHouseAmount(declaration) {
    return _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'будинок')) {
        return sum + 1;
      }
      return sum;
    }, 0);
  },
  getLandArea: function getLandArea(declaration) {
    return toSafestNumber(
      _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
        // "Земельна ділянка"
        if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'земел')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging);
        }
        return sum;
      }, 0),
    );
  },
  getLandAmount: function getLandAmount(declaration) {
    return _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
      // "Земельна ділянка"
      if (belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'земел')) {
        return sum + 1;
      }
      return sum;
    }, 0);
  },
  getFamilyIncome: function getFamilyIncome(declaration) {
    return toSafestNumber(_.reduce(_.get(declaration, 'step_11'), (sum, belonging) => {
      if (!belongsToDeclarant(belonging)) {
        return sum + toSafestNumber(belonging.sizeIncome);
      }
      return sum;
    }, 0));
  },
  getFamilyCarAmount: function getFamilyCarAmount(declaration) {
    return _.reduce(_.get(declaration, 'step_6'), (sum, belonging) => {
      if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'авто')) {
        return sum + 1;
      }
      return sum;
    }, 0);
  },
  getFamilyFlatArea: function familyFlatArea(declaration) {
    const belongings = _.get(declaration, 'step_3');
    return toSafestNumber(
      _.reduce(belongings, (sum, belonging) => {
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'квартира')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging, belongings);
        }
        return sum;
      }, 0),
    );
  },
  getFamilyFlatAmount: function familyFlatAmount(declaration) {
    return _.chain(_.get(declaration, 'step_3'))
      .reduce((belongingHashes, belonging) => {
        // "квартира"
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'квартира')) {
          belongingHashes.push(getBelongingHash(belonging));
        }
        return belongingHashes;
      }, [])
      .uniq()
      .thru(belongingHashes => _.size(belongingHashes))
      .value();
  },
  getFamilyHouseArea: function getFamilyHouseArea(declaration) {
    const belongings = _.get(declaration, 'step_3');
    return toSafestNumber(
      _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'будинок')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging, belongings);
        }
        return sum;
      }, 0),
    );
  },
  getFamilyHouseAmount: function getFamilyHouseAmount(declaration) {
    return _.chain(_.get(declaration, 'step_3'))
      .reduce((belongingHashes, belonging) => {
        // "будинок"
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'будинок')) {
          belongingHashes.push(getBelongingHash(belonging));
        }
        return belongingHashes;
      }, [])
      .uniq()
      .thru(belongingHashes => _.size(belongingHashes))
      .value();
  },
  getFamilyLandArea: function getFamilyLandArea(declaration) {
    const belongings = _.get(declaration, 'step_3');
    return toSafestNumber(
      _.reduce(_.get(declaration, 'step_3'), (sum, belonging) => {
        // "Земельна ділянка"
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'земел')) {
          return sum + toSquareMeters(belonging.totalArea) * percentOwnership(belonging, belongings);
        }
        return sum;
      }, 0),
    );
  },
  getFamilyLandAmount: function getFamilyLandAmount(declaration) {
    return _.chain(_.get(declaration, 'step_3'))
      .reduce((belongingHashes, belonging) => {
        // "Земельна ділянка"
        if (!belongsToDeclarant(belonging) && _.includes(_.lowerCase(belonging.objectType), 'земел')) {
          belongingHashes.push(getBelongingHash(belonging));
        }
        return belongingHashes;
      }, [])
      .uniq()
      .thru(belongingHashes => _.size(belongingHashes))
      .value();
  },
};


text:
package org.kie.uberfire.social.activities.servlet;

import java.util.Date;
import java.util.List;

import org.apache.abdera.Abdera;
import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Feed;
import org.kie.uberfire.social.activities.model.SocialActivitiesEvent;

public class AtomSocialTimelineConverter {

    public static String generate( List<SocialActivitiesEvent> eventTimeline, String type ) {
        Abdera abdera = new Abdera();
        Feed feed = abdera.newFeed();

        feed.setId( "tag:org.uberfire,2014:/"+ type );
        feed.setTitle( "Social Activities Feed" );
        feed.setUpdated( new Date() );
        feed.addAuthor( "Red Hat JBoss" );

        for ( SocialActivitiesEvent event : eventTimeline ) {
            Entry entry = feed.addEntry();
            entry.setTitle( event.getType() );
            entry.setSummary( event.getSocialUser().getUserName() + "  " + event.toString() );
            entry.setUpdated( event.getTimestamp() );
            entry.setPublished( event.getTimestamp() );
        }
        return feed.toString();
    }
}


text:
=[G/CreativeCommons-4.0-CmA/BY-NC-SA.md]

/Note=https://wiki.creativecommons.org/images/d/d1/Building_the_4.0_Suite.pdf - To make BY 4.0:

/Note=Remove "NonCommercial-ShareAlike" from license title in html title tag (including abbreviation), heading, and first sentence

Title=Creative Commons Attribution 4.0 International Public License

/Note=Remove definition of "BY-NC-SA Compatible License"
/Note=Remove definition of "License Elements"
/Note=Remove definition of "NonCommercial"
/Note=Fix lettering of definitions section
s1={s1.Title}

{Def.Adapted Material}

{Def.Adaptor's License}

{Def.Copyright and Similar Rights}

{Def.Effective Technological Measures}

{Def.Exceptions and Limitations}

{Def.Licensed Material}

{Def.Licensed Rights}

{Def.Licensor}

{Def.Share}

{Def.Sui Generis Database Rights}

{Def.You}

/Note=Remove "for NonCommercial purposes only" in Section 2(a)(1)(A) and (B)
s2a1A={m-}reproduce and Share the Licensed Material, in whole or in part{-m}
s2a1B={m-}produce, reproduce, and Share Adapted Material{-m}

/Note=Remove "Additional offer from Licensor" provision from Section 2(a)(5)
/Note=Fix lettering of Section 2(a)(5)
s2a5={s2a5.0}

{s2a5A}

{s2a5C}

/Note=Remove "including when the Licensed Material is used for other than NonCommercial purposes" from Section 2(b)(3)

s2b3={m-}To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties{-m}

/Note=Remove Section 3(b)
s3={s3.Title}
{s3.0}

{s3a}

/Note=Insert 3(a)(4): "If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License."
s3a={s3a.Title}

{s3a1}

{s3a2}

{s3a3}

{s3a4}

s3a4={m-}If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.{-m}

/Note=Remove "for NonCommercial purposes only" in Section 4(a)
s4a={m-}for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database{-m}

/Note=Remove "including for purposes of Section 3(b)" in Section 4(b)
s4b={m-}if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material{-m}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>ex.spring.db</groupId>
    <artifactId>spring-db-parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>
  </parent>
  <groupId>ex.spring.db</groupId>
  <artifactId>spring-jndi-mybatis</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>05-postgreSQL-myBatis-JNDI</name>
  <description>example #05
PostgreSQL + JNDI + myBatis</description>

	<dependencies>
		<dependency>
			<groupId>postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>9.1-901.jdbc4</version>
			<scope>compile</scope>
		</dependency>

	<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-jdbc</artifactId>
			<version>${spring-framework.version}</version>
		</dependency>

		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.2.7</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>1.2.2</version>
		</dependency>

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>${spring-framework.version}</version>
		</dependency>
		<dependency>
			<groupId>commons-dbcp</groupId>
			<artifactId>commons-dbcp</artifactId>
			<version>1.4</version>
		</dependency>

		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>

		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.3.172</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
				<version>6.1.26</version>
				<configuration>
					<jettyEnvXml>src/main/jetty/jetty-config.xml</jettyEnvXml>
					<useTestClasspath>true</useTestClasspath>
					<connectors>
						<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
							<port>9090</port>
							<maxIdleTime>60000</maxIdleTime>
						</connector>
					</connectors>
					<contextPath>/</contextPath>
					<scanIntervalSeconds>10</scanIntervalSeconds>
					<stopKey>foo</stopKey>
					<stopPort>9999</stopPort>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<packaging>war</packaging>
</project>


text:
Sample Code from my presentation at ApacheCon for using UIMA to analyze sentiment of tweets then dump into elastic search.

## NOTE
The demo code I wrote used a sentiment analyzer that is not compatible with the Apache License. So in order
to post the examples, I gutted all links to the library and create a stub instead in the SentimentAnalyzer Analytic
Engine.

# Dependencies
All requirements are in the pom.xml


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Moq;
using NUnit.Framework;
using SFA.DAS.PAS.Account.Api.Orchestrator;
using SFA.DAS.PAS.Account.Api.Types;
using SFA.DAS.ProviderApprenticeshipsService.Application.Commands.SendNotification;
using SFA.DAS.ProviderApprenticeshipsService.Domain.Interfaces;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Configuration;
using SFA.DAS.ProviderApprenticeshipsService.Infrastructure.Data;

namespace SFA.DAS.PAS.Account.Api.UnitTests.Orchestrator
{
    [TestFixture]
    public class WhenSendingEmailToAllProviderRecipients_OptOut
    {
        private EmailOrchestrator _sut;
        private Mock<IAccountOrchestrator> _accountOrchestrator;
        private Mock<IMediator> _mediator;
        private long _ukprn;
        private List<string> _emailAddresses;
        private ProviderEmailRequest _request;
        private string _templateId;
        private Dictionary<string, string> _tokens;
        private ProviderApprenticeshipsServiceConfiguration _configuration;

        [SetUp]
        public async Task Setup()
        {
            _ukprn = 228987165;
            _emailAddresses = new List<string>
            {
                "test1@example.com",
                "test2@example.com"
            };
            _templateId = Guid.NewGuid().ToString();
            _tokens = new Dictionary<string, string>();
            _tokens.Add("key1", "value1");
            _tokens.Add("key2", "value2");

            _accountOrchestrator = new Mock<IAccountOrchestrator>();
            _mediator = new Mock<IMediator>();
            _configuration = new ProviderApprenticeshipsServiceConfiguration { CommitmentNotification = new ProviderNotificationConfiguration() };

            _accountOrchestrator
                .Setup(x => x.GetAccountUsers(_ukprn))
                .ReturnsAsync(_emailAddresses.Select(x => new User { EmailAddress = x, ReceiveNotifications = false }));

            _request = new ProviderEmailRequest
            {
                TemplateId = _templateId,
                Tokens = _tokens
            };

            _sut = new EmailOrchestrator(_accountOrchestrator.Object, _mediator.Object, Mock.Of<IProviderCommitmentsLogger>());
            await _sut.SendEmailToAllProviderRecipients(_ukprn, _request);
        }

        [Test]
        public void ShouldNotSendNotificationForOptedOutAddress()
        {
            _mediator.Verify(x => x.Send(It.IsAny<SendNotificationCommand>(), It.IsAny<CancellationToken>()), Times.Never);
        }
    }
}


text:
__author__ = 'Mael Beuget, Pierre Monnin & Thibaut Smith'

from handler.BaseHandler import *
from model.Absentees import *
from model.Logs import *

class ShowAbsenteeHandler(BaseHandler):
    def __init__(self, request=None, response=None):
        super(ShowAbsenteeHandler, self).__init__()
        self.initialize(request, response)
        self.page_name = "administration"

    def get(self):
        if self.is_connected() and get_is_admin_from_id(self.request.cookies.get('user_id').split('|')[0]):
            if self.request.get('id') and self.request.get('id') != "":
                absentee = get_absentee_from_id(self.request.get('id'))

                if self.request.cookies.get('message') and self.request.cookies.get('message') != "":
                    self.render("administration_absentee_show.html", absentee=absentee,
                                infos_messages=self.request.cookies.get('message'))
                    self.response.headers.add_header('Set-Cookie', "message=; Path='/'")
                else:
                    self.render("administration_absentee_show.html", absentee=absentee)

            else:
                self.render("message.html", title="Invalid URL", text="It seems you're using an invalid URL")
        else:
            self.render("message.html", title="Access forbidden",
                        text="It seems you're not an administrator nor a connected user")

    def post(self):
        if self.is_connected() and get_is_admin_from_id(self.request.cookies.get('user_id').split('|')[0]):
            if self.request.get('id') and self.request.get('id') != "":
                log_sentence = None

                #Update absentee entry
                absentee = get_absentee_from_id(self.request.get('id'))

                if self.request.get('justified'):
                    absentee.justification_bool = True
                    log_sentence = "%(admin)s accepted the absence of %(student)s. (%(lesson)s from " \
                                   "%(hour_start)s to %(hour_end)s"
                else:
                    absentee.justification_bool = False
                    log_sentence = "%(admin)s refused the absence of %(student)s. (%(lesson)s from " \
                                   "%(hour_start)s to %(hour_end)s"

                if self.request.get('justification') and self.request.get('justification') != "":
                    absentee.justification_text = self.request.get('justification')
                else:
                    absentee.justification_text = "/"

                absentee.put()
                user_id = self.request.cookies.get('user_id').split('|')[0]
                account = get_account_from_id(user_id)

                log_sentence = log_sentence % {'admin': account.name,
                                               'student': absentee.student_name,
                                               'lesson': absentee.class_title,
                                               'hour_start': absentee.start_hour,
                                               'hour_end': absentee.end_hour
                                              }

                # I don't know why, the date won't accept the same way
                log_sentence = log_sentence + " on the " + absentee.class_date + ".)"
                Logs(
                    date_time=self.date_details.now(),
                    category="absentee control",
                    author=account.name,
                    description=log_sentence
                ).put()

                #Redirect to correct page
                self.response.headers.add_header('Set-Cookie', "message=Saved; Path = '/'")
                self.redirect('/administration/show_absentee/?id=' + self.request.get('id'))

            else:
                self.render("message.html", title="Invalid URL", text="It seems you're using an invalid URL")

        else:
            self.render("message.html", title="Access forbidden",
                        text="It seems you're not an administrator nor a connected user")


text:
package bridge

import (
	"io"

	math "github.com/IBM/mathlib"
)

func newRandOrPanic(curve *math.Curve) io.Reader {
	rng, err := curve.Rand()
	if err != nil {
		panic(err)
	}
	return rng
}


text:
"""Generator layer.
Generates Python 3 code.
"""
import enum

from . import layers, astlib, defs, utils, errors
from .context import ctx

pytype = type
IND_STR = " " * 4
ADRIAN_OBJ_NAME = "AdrianObject"

@enum.unique
class EnvT(enum.Enum):
    interface = 1
    var = 2

class Generator(layers.Layer):

    def __init__(self):
        self.b = layers.b(Generator)

    def decl_a(self, args):
        result = []
        for (name, _, expr) in args:
            if expr:
                result.append("{0}={1}".format(str(name), self.e(expr)))
            else:
                result.append(str(name))
        return ", ".join(result)

    def a(self, args):
        return ", ".join(map(self.e, args))

    def e(self, expr):
        if isinstance(expr, astlib.Literal):
            return expr.text
        elif isinstance(expr, astlib.Name):
            return str(expr)
        elif isinstance(expr, astlib.Cast):
            return self.e(expr.expr)
        elif isinstance(expr, astlib.IsCheck):
            key = None
            if isinstance(expr.type, astlib.Name):
                key = str(expr.type)
            elif isinstance(expr.type, astlib.GenericType):
                key = str(expr.type.base)
            if key is not None:
                type = ctx.env.unsafe_get(key)
                if type and type["entryt"] == EnvT.interface:
                    return "{0}.implements_interface(\"{1}\")".format(
                        self.e(expr.expr), self.t(expr.type))
            return "isinstance({0}, {1})".format(
                self.e(expr.expr), self.e(expr.type))
        elif isinstance(expr, astlib.BinaryExpr):
            if expr.op in defs.BUILTIN_BOOL_OPERATORS:
                return "({0}) {1} ({2})".format(
                    self.e(expr.left), expr.op, self.e(expr.right))
            return "{0} {1} {2}".format(
                self.e(expr.left), expr.op, self.e(expr.right))
        elif isinstance(expr, astlib.UnaryExpr):
            if expr.op == defs.NOT:
                return "not ({0})".format(self.e(expr.expr))
            return "{0}{1}".format(expr.op, self.e(expr.expr))
        elif isinstance(expr, astlib.Field):
            return "{0}.{1}".format(self.e(expr.base), self.e(expr.field))
        elif isinstance(expr, astlib.Subscript):
            return "{0}[{1}]".format(self.e(expr.base), self.e(expr.key))
        elif isinstance(expr, astlib.Slice):
            return "{0}[{1}:{2}]".format(
                self.e(expr.base), self.e(expr.start), self.e(expr.end))
        elif isinstance(expr, astlib.MethodCall):
            name = defs.SPEC_PY_METHODS.get(expr.name.without_mangling, str(expr.name))
            return "{0}.{1}({2})".format(
                self.e(expr.base), name, self.a(expr.args))
        elif isinstance(expr, astlib.Call):
            return "{0}({1})".format(self.e(expr.base), self.a(expr.args))
        elif isinstance(expr, astlib.InternalName):
            if str(expr) == defs.TRUE:
                return "True"
            elif str(expr) == defs.FALSE:
                return "False"
        elif isinstance(expr, astlib.PyName):
            if expr.name == defs.PY_ARGV:
                return "sys.argv"
        elif isinstance(expr, astlib.PyTypeCall):
            if expr.name == defs.PY_INT:
                return self.e(expr.args[0])
            elif expr.name == defs.PY_STR:
                return '"' + self.e(expr.args[0]) + '"'
            elif expr.name == defs.PY_LIST:
                return '[' + self.a(expr.args[0].text) + ']'
            elif expr.name == defs.PY_DICT:
                text = []
                for key, val in expr.args[0].text:
                    text.append("{0}: {1}".format(self.e(key), self.e(val)))
                return '{' + ", ".join(text) + '}'
        elif isinstance(expr, astlib.PyFuncCall):
            if expr.name == defs.PY_PRINT:
                string = expr.args[0]
                end = expr.args[1]
                return "print({0}, end={1})".format(self.e(string), self.e(end))
                # For python 2.7
                # return [
                #     "print {},".format(self.e(string)),
                #     "print {}".format(self.e(end))
                # ]
            elif expr.name == defs.PY_READ_FILE:
                return "read_file({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_WRITE_FILE:
                return "write_file({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_EXIT:
                return "sys.exit({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_TOINT:
                return "int({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_TOSTR:
                return "str({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_LEN:
                return "len({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_HASH:
                return "hash({0})".format(self.a(expr.args))
            elif expr.name == defs.PY_DEL:
                return "del {0}".format(self.a(expr.args))
        elif isinstance(expr, astlib.KeywordArg):
            return "{0}={1}".format(self.e(expr.name), self.e(expr.expr))
        elif isinstance(expr, astlib.ConstructorCall):
            base = self.e(expr.base)
            if base is None:
                errors.specify_adt_explicitly(
                    astlib.ConstructorSugarCall(expr.constructor, expr.args))
            return "{0}_{1}({2})".format(
                base, self.e(expr.constructor), self.a(expr.args))
        elif isinstance(expr, astlib.Constructor):
            base = self.e(expr.base)
            if base is None:
                errors.specify_adt_explicitly(
                    astlib.ConstructorSugar(expr.constructor))
            return "{}_{}".format(base, self.e(expr.constructor))
        elif isinstance(expr, astlib.GenericType):
            return self.e(expr.base)
        elif isinstance(expr, astlib.Contains):
            return "{} in {}".format(self.e(expr.element), self.e(expr.container))
        elif isinstance(expr, astlib.ExistentialBase):
            existential_type = ctx.existential_bases[expr.id]
            if existential_type is None:
                return None
            return self.t(ctx.existential_types[existential_type.id].mapping_type)
        else:
            errors.internal_error("unrecognized node -> {}".format(pytype(expr)))

    def t(self, type):
        if isinstance(type, astlib.Name):
            return str(type)
        elif isinstance(type, astlib.GenericType):
            return self.t(type.base)
        elif isinstance(type, astlib.Constructor):
            return "{0}_{1}".format(self.e(type.base), self.e(type.constructor))
        else:
            errors.internal_error("unrecognized node -> {}".format(pytype(type)))

    def decl(self, node):
        stmt = node.stmt
        ctx.env[str(stmt.name)] = {
            "entryt": EnvT.var
        }
        yield "{0} = {1}".format(str(stmt.name), self.e(stmt.expr))

    def elif_(self, node):
        if not node.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [IND_STR * ctx.indentation_level + s for s in self.b(node.body)]
        return "\n".join(["elif {0}:".format(self.e(node.expr))] + body)

    def else_(self, node):
        if not node.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [IND_STR * ctx.indentation_level + s for s in self.b(node.body)]
        return "\n".join(["else:"] + body)

    @layers.register(astlib.Cond)
    def cond(self, node):
        stmt = node.stmt
        ctx.indentation_level += 1
        if not stmt.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [IND_STR * ctx.indentation_level + s for s in self.b(stmt.body)]
        elifs = [IND_STR * (ctx.indentation_level - 1) + self.elif_(elif_)
                 for elif_ in stmt.elifs]
        else_ = ""
        if elifs:
            else_ += "\n"
        if stmt.else_:
            else_ = "\n" + IND_STR * \
                (ctx.indentation_level - 1) + self.else_(stmt.else_)
        ctx.indentation_level -= 1
        yield "\n".join([
            "if {0}:".format(self.e(stmt.expr))] + body + elifs) + else_

    @layers.register(astlib.Break)
    def break_stmt(self, node):
        yield "break"

    @layers.register(astlib.For)
    def for_stmt(self, node):
        stmt = node.stmt
        if isinstance(stmt.names, astlib.Name):
            names = str(stmt.names)
        else:
            names = ", ".join(map(str, stmt.names.names))
        ctx.indentation_level += 1
        if not stmt.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [
                IND_STR * ctx.indentation_level + s
                for s in self.b(stmt.body)
            ]
        ctx.indentation_level -= 1
        yield "\n".join([
            "for {0} in {1}:".format(names, self.e(stmt.iterable))] + body)

    @layers.register(astlib.While)
    def while_stmt(self, node):
        stmt = node.stmt
        ctx.indentation_level += 1
        if not stmt.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [IND_STR * ctx.indentation_level + s for s in self.b(stmt.body)]
        ctx.indentation_level -= 1
        yield "\n".join(["while {0}:".format(self.e(stmt.expr))] + body)

    @layers.register(astlib.Call)
    def call(self, node):
        expr = self.e(node.stmt)
        yield expr

    @layers.register(astlib.MethodCall)
    def method_call(self, node):
        yield self.e(node.stmt)

    @layers.register(astlib.PyFuncCall)
    def py_func_call(self, node):
        expr = self.e(node.stmt)
        # if isinstance(expr, list):
        #     yield from expr
        # else:
        #     yield expr
        yield expr

    @layers.register(astlib.VarDecl)
    def var_decl(self, node):
        yield from self.decl(node)

    @layers.register(astlib.LetDecl)
    def let_decl(self, node):
        yield from self.decl(node)

    def global_stmt(self, name):
        yield "global {0}".format(str(name))

    @layers.register(astlib.Assignment)
    def assignment(self, node):
        stmt = node.stmt
        base = stmt.left
        if isinstance(base, astlib.Subscript):
            base = base.base
        if isinstance(base, astlib.Field):
            base = base.base
        res, scope = ctx.env.get_with_scope(base)
        if res != EnvT.interface and scope == 0 and ctx.env.scope != 0:
            yield from self.global_stmt(base)
        yield "{0} {1} {2}".format(
            self.e(stmt.left), stmt.op, self.e(stmt.right))

    @layers.register(astlib.FuncDecl)
    def func_decl(self, node):
        stmt = node.stmt
        ctx.indentation_level += 1
        ctx.env.add_scope()
        if not stmt.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [
                IND_STR * ctx.indentation_level + s
                for s in self.b(stmt.body)]
        ctx.env.remove_scope()
        ctx.indentation_level -= 1
        yield "\n".join([
            "def {0}({1}):".format(
                str(stmt.name), self.decl_a(stmt.args))] + body + [""])

    @layers.register(astlib.MethodDecl)
    def method_decl(self, node):
        stmt = node.stmt
        name = defs.SPEC_PY_METHODS.get(stmt.name.without_mangling, str(stmt.name))
        ctx.indentation_level += 1
        ctx.env.add_scope()
        if not stmt.body:
            body = [IND_STR * ctx.indentation_level + "pass"]
        else:
            body = [IND_STR * ctx.indentation_level + s for s in self.b(stmt.body)]
        ctx.env.remove_scope()
        ctx.indentation_level -= 1
        yield "\n".join([
            "def {0}({1}):".format(
                name,
                self.decl_a(
                    [astlib.Arg(
                        astlib.Name("self"), None, None
                    )] + stmt.args))] + body + [""])

    @layers.register(astlib.Return)
    def return_stmt(self, node):
        yield "return {0}".format(self.e(node.stmt.expr))

    def get_impled_interfaces(self, interfaces):
        result = []
        for interface in interfaces:
            if isinstance(interface, astlib.GenericType):
                str_inf = str(interface.base)
            else:
                str_inf = str(interface)
            info = ctx.env.unsafe_get(str_inf)
            if info and info["entryt"] == EnvT.interface:
                result.extend(self.get_impled_interfaces(info["interfaces"]))
            result.append(str_inf)
        return result

    def generate_class(self, struct_decl, super_class_name):
        fields, methods = utils.split_struct_body(struct_decl.body)
        slots_length = 0
        slots = []
        for field in fields:
            slots.append(str(field.stmt.name))
            slots_length += 1
        if slots_length == 0:
            slots_str = ""
        elif slots_length == 1:
            slots_str = '"{}",'.format(slots[0])
        else:
            slots_str = ", ".join(['"{}"'.format(slot) for slot in slots])
        ctx.indentation_level += 1
        ctx.env.add_scope()
        body = [
            IND_STR * ctx.indentation_level + "__slots__ = ({})".format(slots_str),
            IND_STR * ctx.indentation_level + "interfaces = {}".format(
                self.get_impled_interfaces(struct_decl.impled_interfaces)),
            ""
        ]
        body.extend((IND_STR * ctx.indentation_level + s for s in self.b(methods)))
        ctx.env.remove_scope()
        ctx.indentation_level -= 1
        yield "\n".join([
            "", "class {0}({1}):".format(str(struct_decl.name), super_class_name)
            ] + body)

    @layers.register(astlib.StructDecl)
    def struct_decl(self, node):
        yield from self.generate_class(node.stmt, ADRIAN_OBJ_NAME)

    @layers.register(astlib.InterfaceDecl)
    def interface_decl(self, node):
        ctx.env[str(node.stmt.name)] = {
            "entryt": EnvT.interface,
            "interfaces": node.stmt.super_interfaces
        }
        yield from []

    @layers.register(astlib.ConstructorDecl)
    def constructor_decl(self, node):
        stmt = node.stmt
        constructor_name = astlib.Name(str(ctx.parent_adt) + "_" + str(stmt.name))
        yield from self.generate_class(
            astlib.StructDecl(constructor_name, [], [], [], stmt.body),
            str(ctx.parent_adt))

    @layers.register(astlib.AdtDecl)
    def adt_decl(self, node):
        stmt = node.stmt
        prev = ctx.parent_adt
        ctx.parent_adt = stmt.name
        constructor_decls, method_decls = utils.split_body(
            stmt.body, astlib.ConstructorDecl, astlib.MethodDecl)
        yield from self.generate_class(
            astlib.StructDecl(
                stmt.name, [], stmt.impled_interfaces, [], method_decls),
            ADRIAN_OBJ_NAME)
        yield from self.b(constructor_decls)
        ctx.parent_adt = prev

    @layers.register(astlib.ModuleChange)
    def module_change(self, node):
        yield from []

    @layers.register(astlib.ExtensionDecl)
    def extension_decl(self, node):
        yield from []

    @layers.register(astlib.AST)
    def main(self, ast, registry):
        imports = ["import sys\n\n"]
        predef = utils.read_file(
            utils.get_compiler_part_path(defs.PREDEF_FILE_PATH)).splitlines()
        result = list(layers.transform_ast(ast, registry=registry))
        if result and result[0][0] == "\n":
            result[0] = result[0][1:]
        return imports + predef + [""] + result