text: service hubble restart

redpajama_set_name: RedPajamaGithub


text:
define(function(require){

  //
  // L O A D   T H E   A S S E T S   A N D   L I B R A R I E S
  // --------------------------------------------------------------------------------
  //
  var Backbone  = require('backbone'),
      Container = require('text!templates/question_item_list.admin.html'),
      Editor    = require('text!templates/question_item.admin.html'),
      Option    = require('text!templates/option_item.admin.html');

  //
  // I N I T I A L I Z E   T H E   B A C K B O N E   V I E W
  // --------------------------------------------------------------------------------
  //
  var question = Backbone.View.extend({

    //
    // [ DEFINE THE EVENTS ]
    //
    //
    events : {
      'click a.update'             : 'render_editor',
      'click a.close-editor'       : 'render', // render list view
      'click a.cancel'             : 'render_editor',
      'click li a'                 : 'remove_option',
      'click a.save'               : '_save',
      'click a.delete'             : '_suicide',
      'focus ul li input'          : '_enable_save_option',
      'blur ul li input'           : '_disable_save_option',
      'change input[type="radio"]' : 'toggle_options'
    },

    //
    // [ SET THE CONTAINER ]
    //
    //
    tagName : 'li',

    // -----------------
    // SET THE TEMPLATES
    // -----------------
    //
    template : _.template(Container),
    editor   : _.template(Editor),
    option   : _.template(Option),

    // ------------------------
    // THE INITIALIZE FUNCTION
    // ------------------------
    //
    initialize : function(){
      this.listenTo(this.model, 'remove', this.remove);
      this.listenTo(this.model, 'destroy', this.remove);
    },

    //
    // R E N D E R   F U N C T I O N S
    // --------------------------------------------------------------------------------
    //

    // --------------------
    // CALL THE MAIN RENDER
    // --------------------
    //
    render : function(e){
      if(e !== void 0) e.preventDefault();
      this.$el.html(this.template(this.model.attributes));
      var color = this.model.get('section_id') * 15;
      this.el.style.borderRight = "5px solid hsl(" + color + ", 100%, 50%)";
      return this;
    },

    render_editor : function(e){
      if(e !== void 0) e.preventDefault();
      // [0] configura algunas variables
      var options = this.model.get('options');
      // [1] usa el template
      this.$el.html(this.editor(this.model.attributes));
      this.$('.question-panel-editor').show();
      // [2] selecciona el tipo de pregunta
      if(Number(this.model.get('is_location'))){
        this.$('input[value="location"]')[0].checked = 1;
      }
      else if(this.model.get('type') === 'text'){
        this.$('input[value="text"]')[0].checked = 1;
      }
      else if(options.length){
        this.$('input[value="multiple"]')[0].checked = 1;
      }
      else{
        this.$('input[value="number"]')[0].checked = 1;
      }
      // [3] agrega las secciones, si se necesita
      if(options.length){
        this._render_options(options);
      }
      // [4] agrega el selector de sección
      this.render_section_selector();
      var color = this.model.get('section_id') * 15;
      this.el.style.borderRight = "5px solid hsl(" + color + ", 100%, 50%)";
      return this;
    },

    _render_options : function(options){
      this.$('.options-container').show();
      _.each(options, function(option){
        var name = _.uniqueId('lp');
        this.$('.options-container ul').append(this.option({
          name     : name,
          value    : option.cid ? option.get('description') : option.description,
          is_first : false
        }));
      }, this);
    },

    _render_new_option : function(e){
      var is_first = e === void 0;
      if(is_first || (e.keyCode === 13 && e.target.value)){
        var name = _.uniqueId('lp');
        this.$('ul').append(this.option({
          name     : name,
          value    : '',
          is_first : 0 // O___o
        }));

        if(! is_first) this.$('input[name="' + name + '"]')[0].focus();
      }
    },

    remove_option : function(e){
      e.preventDefault();
      this.$(e.target.parentNode).remove();
      if(! this.el.getElementsByTagName('ul')[0].children.length){
        this._render_new_option();
      }
    },

    toggle_options : function(e){
      var el = this.el.querySelectorAll('.options-container')[0];
      if(e.target.value === 'multiple'){
        el.style.display = '';
        if(! this.el.getElementsByTagName('ul')[0].children.length){
          this._render_new_option();
        }
      }else{
        el.style.display = 'none';
      }
    },

    // [ SHOW THE SECTION SELECTOR ]
    //
    //
    render_section_selector : function(){
      var sections = _.uniq(this.model.collection.pluck('section_id')),
          data     = [],
          box      = this.el.querySelector('.section-container'),
          el       = box.querySelector('select'),
          content  = '',
          i;
          box.style.display = '';
      if(!sections){
        data.push({text : 'sección 1', value : 1});
      }
      else{
        if(sections.length >= 2){
          sections = sections.sort(function(a,b){
            return a-b;
          });
        }
        for(i = 1; i<= sections.length; i++){
          data.push({text : 'sección ' + sections[i-1], value : sections[i-1]});
        }
      }
      data.push({text : 'nueva sección', value : Number(sections[sections.length-1]) + 1});

      for(i = 0; i < data.length; i++){
        content +="<option value='" + data[i].value + "' "
                + (this.model.get('section_id') == data[i].value ? 'selected' : '')
                + ">" + data[i].text + "</option>";
      }
      el.innerHTML = content;
    },

    //
    // I N T E R A C T I O N
    // --------------------------------------------------------------------------------
    //
    _enable_save_option : function(e){
       window.onkeyup = this._render_new_option.bind(this);
    },

    _disable_save_option : function(e){
      window.onkeyup = false;
    },

    //
    // I N T E R N A L   F U N C T I O N S
    // --------------------------------------------------------------------------------
    //
    _save : function(e){
      e.preventDefault();
      var type        = this.$el.find('input[name^="type"]:checked').val(),
          title_input = this.$el.find('input[name="question"]'),
          title       = this.$('.question_editor_question input').val(),
          section     = this.el.querySelector('.section-container select').value,
          that        = this;
      if(! title){
        title_input.addClass('error');
        return;
      }
      this.model.set({
        //section_id     : section,
        // blueprint_id   : this.model.id,
        question    : title,
        section_id  : section,
        is_location : type === 'location',
        type        : type === 'text' || type === 'location' ? 'text' : 'number',
        options     : type !== 'multiple' ? [] : this._get_options()
      });

      this.model.save(null, {
        success : function(model, response, options){
          that.render_editor();
        }
      });

    },

    _suicide : function(e){
      e.preventDefault();
      this.model.destroy({wait: true});
    },

    _get_options : function(){
      var inputs = this.$('.options-container input'),
          options = [];
      _.each(inputs, function(op){
        if(op.value) options.push(op.value);
      }, this);

      return options;
    }

  });

  return question;
});


text:
title: Simple things are most impressive
category: Philosophy
tags:
  - Philosophy
date: 2015-02-09
layout: 'post'
---

It seems as though the simple things, those we take for granted, are
always the most complex and impressive. It's quite incredible to know
that I am breathing right now, not just because breathing is
incredible (it is) but beyond that that I recognize myself. That's
incredible. I know who I am physically, and where I am. I know what it
feels like to touch sandpaper or cold tile. I know what it means to
feel sadness and joy, I know what heat feels like. I can see objects
in front of me and touch them.

I can walk. I can amble around on two feet, over slippery ice, or
different gradients and surfaces. I know what it's like to feel my own
face, to have an identity and to change the world around me.

I can think, I know information and can do things with it. If I want
to learn something I can, and beyond that I can want! What does that
even mean? It's so inexplicable and we almost **never** stop to think
about it.

All these super feats are largely unnoticed. This may be a good thing,
allowing us to transcend the simplistic and reach for the
sophisticated. But at the same time its nice to revisit the incredible
powers of being human.


text:
<?php

namespace app\components;

use app\models\Bill;
use Yii;
use yii\base\Component;
use yii\base\ErrorException;

class XmlRpcComponent extends Component
{
    const ERROR_CONNECTION_REFUSED = 1;
    const ERROR_XMLRPC_IS_FAULT = 2;
    const SUCCESS = 0;

    private $state = self::SUCCESS;
    private $response = null;

    public function enableBillTypes()
    {
        $bills = Bill::find()
            ->select('bill_type')
            ->where(['enabled' => true])
            ->asArray()->all();

        $data = [];
        foreach ($bills as $bill) {
            $data[] = (int) $bill['bill_type'];
        }

        $this->sendCommand('enable_bill_types', [$data]);
    }

    public function sendCommand($command, $params = [])
    {
        $this->response = null;

        $request = xmlrpc_encode_request($command, $params);
        $context = stream_context_create(['http' => [
            'method' => "POST",
            'header' => "Content-Type: text/xml",
            'content' => $request
        ]]);

        try {
            $file = file_get_contents(Yii::$app->params['daemon']['xmlrpc_url'],
                false, $context);
        } catch (ErrorException $e) {
            $this->state = self::ERROR_CONNECTION_REFUSED;
            return;
        }

        $response = xmlrpc_decode($file);
        if (is_string($response)) {
            $response = [$response];
        }

        if ($response && xmlrpc_is_fault($response)) {
            $this->state = self::ERROR_XMLRPC_IS_FAULT;
            return;
        }

        $this->state = self::SUCCESS;
        $this->response = $response;
    }

    public function getErrorMessage($code)
    {
        $errors = [
            self::ERROR_CONNECTION_REFUSED => 'Connection refused',
            self::ERROR_XMLRPC_IS_FAULT => 'XMLRPC is fault',
        ];

        return $errors[$code];
    }

    public function hasError()
    {
        return $this->state !== self::SUCCESS;
    }

    public function getErrorCode()
    {
        return $this->state;
    }

    public function getResponse()
    {
        return $this->response;
    }
}


text:
* {
padding: 0px;
margin: 0px;
}

.cf:before, .cf:after {
	content: "";
	display: table;
}

.cf:after {
	clear: both;
}

.cf {
	zoom: 1;
}

html,body {
	width: 100%;
	height: 100%;
	margin: 0px;
	padding: 0px;
	font-size: 12px;
	font-family: sans-serif;
	line-height:1.25em;
}

.sigma-parent {
	position: relative;
	height: 100%;
}

.sigma-expand {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	background-color: #eee;
	background-position: center center;
	background-repeat: no-repeat;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

canvas#sigma_bg_1 {
	display: none;
}

#attributepane {
   	display: block;
	display: none;
    position:absolute;
    height:auto;
    bottom:0;
    top:0;
    right:0;
	width: 240px;
	background-color: #fff;
	margin: 0;
	word-wrap: break-word;
	background-color:rgba(255,255,255,0.8);
	border-left: 1px solid #ccc;
	padding: 0px 18px 0px 18px;
	z-index: 1;
}

#attributepane .text {
	height:100%;
}

#attributepane .headertext {
	color: #000;
	margin-bottom: 5px;
	height: 14px;
	border-bottom: 1px solid #999;
	padding: 0px 0 10px 0;
	font-size:16px;
	font-weight:bold;
}

#attributepane .returntext em {
	background-image: url('../images/sprite.png');
	background-repeat: no-repeat;
	display: block;
	width: 20px;
	height: 20px;
	background-position: -91px -13px;
	float: left;
}

#attributepane .returntext span {
	padding-left: 5px;
	display: block;
}

#attributepane .close {
	padding-left: 14px;
	margin-top: 10px;
}

#attributepane .close .c {
	border-top: 2px solid #999;
	padding: 10px 0 14px 0;
}

#attributepane .close em {
background-image: url('../images/sprite.png');
background-repeat: no-repeat;
background-position: -11px -13px;
display: block;
width: 24px;
height: 16px;
float: left;
}

#attributepane .close span {
display: block;
width: 151px;
float: left;
}

#attributepane .nodeattributes {
	display:block;
	height:85%;
	overflow-y: scroll;
	overflow-x: hidden;
	border-bottom:1px solid #999;
}

#attributepane .name {
font-size: 14px;
cursor: default;
padding-bottom: 10px;
padding-top: 18px;
font-weight:bold;
}

#attributepane .data {

}

#attributepane .data .plus {
background-repeat: no-repeat;
background-image: url('../images/sprite.png');
background-position: -171px -122px;
width: 22px;
height: 20px;
float: left;
display: block;
}

#attributepane .link {
padding: 0 0 0 4px;
}

#attributepane .link li {
padding-top: 2px;
cursor:pointer;
}

#attributepane .p {
padding-top: 10px;
font-weight: bold;
font-size:14px;
}

.left-close {
background-image: url('../images/fancybox_sprite.png');
margin-left:-37px;
z-index:99999;
cursor: pointer;
padding-left:31px;
line-height:36px;
background-repeat: no-repeat;
margin-bottom:25px;
font-weight: bold;
font-size:14px;

}

#developercontainer {
	margin-left:25px;
	margin-bottom:25px;
	position:fixed;
	bottom:0;
}

#jisc {
width: 71px;
height: 56px;
background-image: url('../images/jisc-logo-small.png');
background-repeat: no-repeat;
display:inline-block;
}

#jisc span {
	display:none;
}

#oii {
width: 227px;
height: 56px;
background-image: url('../images/oii_text.png');
background-repeat: no-repeat;
display:inline-block;
margin-right:10px;

}

#oii span {
	display:none;
}

#maintitle {
width: 100%;
height: 72px;
background-repeat: no-repeat;
margin-bottom:20px;
}

#maintitle h1 {
display: none;
}

#mainpanel {
margin-top: 50px;
margin-left: 25px;
background:#fff;
background-color:rgba(255,255,255,0.8);
border:1px solid #ccc;
z-index:20;
position:fixed;
top:0;
}

#mainpanel .b1 {
padding: 0px 0 0 0;
}

#mainpanel .col {
width: 240px;
padding: 18px 18px 18px 18px;
margin: 0;

}

#title {
font-weight: bold;
}

#titletext {
padding: 6px 0 10px 0;
}

#info {
	padding-bottom:15px;
}

#search {
	border-top: 1px solid #999;
	padding: 20px 0 0px 2px;
}

#search input[name=search] {
border: 1px solid #999;
background-color: #fff;
padding: 5px 7px 4px 7px;
width: 205px;
color: #000;
}

#search input.empty {
color: #000;
}

#search .state {
width: 14px;
height: 14px;
background-image: url('../images/sprite.png');
float: right;
margin-top: 6px;
cursor: pointer;
background-position: -131px -13px;
}

#search .state.searching {
background-position: -11px -13px;
}

#search .results {
	display: none;
/*	border: 1px solid #999;*/
	margin: 6px;
	/*height: 150px;*/
	overflow-y: scroll;
	overflow-x: hidden;
}

#search .results b {
padding-left: 2px;
}

#search .results a {
padding: 1px 2px;
display: block;
cursor: pointer;
text-decoration: none;
color: #000;
}

#search .results a:hover {
background-color: #999;
color: #fff;
}

#attributeselect {
margin: 20px 0 13px 0 ;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

#attributeselect .select {
	border: 1px solid #999;
	padding: 5px 7px 4px 7px;
	color: #fff;
	cursor: pointer;
	background-color: #999;
	background-image: url('../images/sprite.png');
	background-repeat: no-repeat;
	background-position: 200px -144px;
}

#attributeselect .close {
background-position: 200px -8px;
}

#attributeselect .list {
	display: none;
	border: 1px solid
	#999;
	padding: 6px;
	height: 150px;
	width: 226px;
	overflow-y: scroll;
	overflow-x: hidden;
	background-color: #999;
	/*position: relative;
		left: 240px;
		bottom: 164px;*/
	position:absolute;
	margin-left: 240px;
	margin-top:-164px;
	color: white;
}

#attributeselect .list a {
display:block;
padding: 2px;
text-decoration: none;
color: #fff;
}

#attributeselect .list a:hover {
background-color: #fff;
color: #000;
}

.link h2 {
font-size: 1em;
padding-top: 1em;
}

#mainpanel dl {
	padding-bottom:10px;
}

#mainpanel h2 {
	font-size:14px;
}

#mainpanel dt {
width: 20px;
height: 20px;
float: left;
background-repeat: no-repeat;
background-image: url('../images/sprite.png');
}

#legend dl {
}

#mainpanel h2 {
	padding-bottom:10px;
}

#legend dd {
margin-bottom: 8px;
color: #000;
}

#mainpanel .infos dd {
margin-bottom: 12px;
}

#mainpanel .node {
background-position: -11px -119px;
}

#mainpanel .edge {
background-position: -51px -122px;
}

#mainpanel .colours {

background-image:url('../images/rainbow.png');

}
#legend .note {
margin-bottom: 8px;

}

#mainpanel .regions {
background-position: -171px -13px;
}

#mainpanel .download {
background-position: -51px -13px;
}

#mainpanel .moreinformation {
background: url('../images/info.png');
background-repeat: no-repeat;
margin-left: 5px;
}

#copyright {
	margin:0 auto;
	position: fixed;
	right: 40px;
	bottom: 25px;
	z-index:0;
}

#copyright a {
color: #000;
}

#copyright .explanation {
display: none;
}

#zoom {
	z-index:999;
	position: fixed;
	left: 45%;
	bottom: 25px;
	margin:0 auto;
	padding: 0;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
	text-align:left;
}

#zoom .z {
	background:#fff;
	background-color:rgba(255,255,255,0.7);
	width: 60px;
	height: 60px;
	cursor: pointer;
	border:1px solid #ccc;
	float:left;
	margin-right:4px;
	background-repeat:no-repeat;
}

#zoom .z[rel=center] {
	background-image: url('../images/zoom_reset.png');
	background-position:center;
}

#zoom .z[rel=in] {
	background-image: url('../images/zoom_in.png');
	background-position:center;
}

#zoom .z[rel=out] {
	background-image: url('../images/zoom_out.png');
	background-position:center;
}

.line {
	font-size: 12px;
	color: #000;
	text-decoration: none;
	font-weight: bold;
	cursor: pointer;
	cursor: hand;
}

#information {
display: none;
background: #fff;
padding: 1px 10px 10px 10px;
}

#information h3 {
margin: 14px 0 4px 0;
}

#information p {
margin: 0 0 4px 0;
}

#information .button {
width: 14px;
height: 14px;
background-image: url('../images/sprite.png');
border: 1px solid #999;
display: inline-block;
*display: inline;
*zoom: 1;
}

#information .button span {
display: none;
}

#information .button.plus {
background-position: -91px -122px;
}

#information .button.moins {
background-position: -131px -122px;
}

#minify {
background-color: #fff;
padding: 4px 4px 4px 25px;
cursor: pointer;
background-image: url('../images/sprite.png');
background-repeat: no-repeat;
background-position: -167px -118px;
position: absolute;
top: 65px;
left: 15px;
display: none;
}

#minifier {
position: absolute;
width: 20px;
height: 16px;
background-image: url('../images/sprite.png');
background-repeat: no-repeat;
background-position: -45px -147px;
cursor: pointer;
display: none;
}

iframe {
margin-left:auto;
margin-right:auto;
	display:block;
}


text:
CertificateReportingMetricsProvider::CertificateReportingMetricsProvider() {}

CertificateReportingMetricsProvider::~CertificateReportingMetricsProvider() {}

void CertificateReportingMetricsProvider::ProvideCurrentSessionData(
    metrics::ChromeUserMetricsExtension* unused) {
  // When ProvideCurrentSessionData is called, this class is being asked to
  // provide metrics to the metrics service. It doesn't provide any metrics
  // though, instead it tells CertificateReportingService to upload any pending
  // reports.
  ProfileManager* profile_manager = g_browser_process->profile_manager();
  if (!profile_manager)
    return;

  // Do not try to create profile here if it does not exist, because this method
  // can be called during browser shutdown.
  Profile* profile = profile_manager->GetLastUsedProfileIfLoaded();
  if (!profile)
    return;

  CertificateReportingService* service =
      CertificateReportingServiceFactory::GetForBrowserContext(profile);
  if (service)
    service->SendPending();
}


text:
require 'rails' # from railties
require 'active_record'
require 'action_controller'
require 'rbconfig'

module Refinery
  require 'refinery/errors'

  autoload :Activity, 'refinery/activity'
  autoload :ApplicationController, 'refinery/application_controller'
  autoload :Engine, 'refinery/engine'
  autoload :Menu, 'refinery/menu'
  autoload :MenuItem, 'refinery/menu_item'
  autoload :Plugin,  'refinery/plugin'
  autoload :Plugins, 'refinery/plugins'
  autoload :Version, 'refinery/version'
  autoload :Crud, 'refinery/crud'
  autoload :BasePresenter, 'refinery/base_presenter'

  module Admin
    autoload :BaseController, 'refinery/admin/base_controller'
  end

  autoload :CmsGenerator, 'generators/refinery/cms/cms_generator'
  autoload :DummyGenerator, 'generators/refinery/dummy/dummy_generator'
  autoload :CoreGenerator, 'generators/refinery/core/core_generator'
  autoload :EngineGenerator, 'generators/refinery/engine/engine_generator'

  class << self
    @@extensions = []

    # Returns an array of modules representing currently registered Refinery Engines
    #
    # Example:
    #   Refinery.extensions  =>  [Refinery::Core, Refinery::Pages]
    def extensions
      @@extensions
    end

    # Register an extension with Refinery
    #
    # Example:
    #   Refinery.register_extension(Refinery::Core)
    def register_extension(const)
      return if extension_registered?(const)

      validate_extension!(const)

      @@extensions << const
    end
    alias_method :register_engine, :register_extension

    # Unregister an extension from Refinery
    #
    # Example:
    #   Refinery.unregister_extension(Refinery::Core)
    def unregister_extension(const)
      @@extensions.delete(const)
    end

    # Returns true if an extension is currently registered with Refinery
    #
    # Example:
    #   Refinery.extension_registered?(Refinery::Core)
    def extension_registered?(const)
      @@extensions.include?(const)
    end

    # Constructs a deprecation warning message and warns with Kernel#warn
    #
    # Example:
    #   Refinery.deprecate('foo') => "The use of 'foo' is deprecated"
    #
    # An options parameter can be specified to construct a more detailed deprecation message
    #
    # Options:
    #   when - version that this deprecated feature will be removed
    #   replacement - a replacement for what is being deprecated
    #   caller - who called the deprecated feature
    #
    # Example:
    #   Refinery.deprecate('foo', :when => 'tomorrow', :replacement => 'bar') =>
    #       "The use of 'foo' is deprecated and will be removed at version 2.0. Please use 'bar' instead."
    def deprecate(what, options = {})
      # Build a warning.
      warning = "\n-- DEPRECATION WARNING --\nThe use of '#{what}' is deprecated"
      warning << " and will be removed at version #{options[:when]}" if options[:when]
      warning << "."
      warning << "\nPlease use #{options[:replacement]} instead." if options[:replacement]

      # See if we can trace where this happened
      if (invoker = detect_invoker(options[:caller])).present?
        warning << invoker
      end

      # Give stern talking to.
      warn warning
    end

    # Returns a Pathname to the root of the Refinery CMS project
    def root
      @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
    end

    # Returns an array of Pathnames pointing to the root directory of each extension that
    # has been registered with Refinery.
    #
    # Example:
    #   Refinery.roots => [#<Pathname:/Users/Reset/Code/refinerycms/core>, #<Pathname:/Users/Reset/Code/refinerycms/pages>]
    #
    # An optional extension_name parameter can be specified to return just the Pathname for
    # the specified extension. This can be represented in Constant, Symbol, or String form.
    #
    # Example:
    #   Refinery.roots(Refinery::Core)    =>  #<Pathname:/Users/Reset/Code/refinerycms/core>
    #   Refinery.roots(:'refinery/core')  =>  #<Pathname:/Users/Reset/Code/refinerycms/core>
    #   Refinery.roots("refinery/core")   =>  #<Pathname:/Users/Reset/Code/refinerycms/core>
    def roots(extension_name = nil)
      return @roots ||= self.extensions.map(&:root) if extension_name.nil?

      extension_name.to_s.camelize.constantize.root
    end

    def version
      Refinery::Version.to_s
    end

    # Returns string version of url helper path. We need this to temporarily support namespaces
    # like Refinery::Image and Refinery::Blog::Post
    #
    # Example:
    #   Refinery.route_for_model(Refinery::Image) => "admin_image_path"
    #   Refinery.route_for_model(Refinery::Image, {:plural => true}) => "admin_images_path"
    #   Refinery.route_for_model(Refinery::Blog::Post) => "blog_admin_post_path"
    #   Refinery.route_for_model(Refinery::Blog::Post, {:plural => true}) => "blog_admin_posts_path"
    #   Refinery.route_for_model(Refinery::Blog::Post, {:admin => false}) => "blog_post_path"
    def route_for_model(klass, options = {})
      options = {:plural => false, :admin => true}.merge options

      klass = klass.constantize if klass.respond_to?(:constantize)
      active_name = ::ActiveModel::Name.new(
        klass, (Refinery if klass.parents.include?(Refinery))
      )

      if options[:admin]
        # Most of the time this gets rid of 'refinery'
        parts = active_name.to_s.underscore.split('/').reject do |name|
          active_name.singular_route_key.exclude?(name)
        end

        # Get the singular resource_name from the url parts
        resource_name = parts.pop
        resource_name = resource_name.pluralize if options[:plural]

        [parts.join("_"), "admin", resource_name, "path"].reject(&:blank?).join "_"
      else
        path = options[:plural] ? active_name.route_key : active_name.singular_route_key

        [path, 'path'].join '_'
      end
    end

    def include_once(base, extension_module)
      base.send :include, extension_module unless included_extension_module?(base, extension_module)
    end

    private
    def detect_invoker(the_caller = caller)
      return '' unless the_caller && the_caller.respond_to?(:detect)
      the_caller.detect{ |c| /#{Rails.root}/ === c }.inspect.to_s.split(':in').first
    end

    # plain Module#included? or Module#included_modules doesn't cut it here
    def included_extension_module?(base, extension_module)
      if base.kind_of?(Class)
        direct_superclass = base.superclass
        base.ancestors.take_while { |ancestor| ancestor != direct_superclass}.include?(extension_module)
      else
        base < extension_module # can't do better than that for modules
      end
    end

    def validate_extension!(const)
      unless const.respond_to?(:root) && const.root.is_a?(Pathname)
        raise InvalidEngineError, "Engine must define a root accessor that returns a pathname to its root"
      end
    end
  end
end


text:
module OpenConferenceWare
  module UserFavoritesHelper
    # Add JavaScript to layout that populates the user's favorites and binds these controls.
    def include_user_favorites_javascript
      if user_favorites?
        expose_to_js :favorites_path, user_favorites_path(user_id: :me)
        run_when_dom_is_ready 'populate_user_favorites();'
        run_when_dom_is_ready 'bind_user_favorite_controls();'
      end
    end

    # Return link for a UserFavorite control for the given +proposal+.
    def user_favorite_control_for(proposal)
      if user_favorites?
        return link_to(content_tag(:span, "*"), user_favorites_path(:me), class: "favorite favorite_#{proposal.id}")
      end
    end
  end
end


text:
// *****************************************************************************

// *****************************************************************************
#ifndef MeshConvCmdLine_h
#define MeshConvCmdLine_h

#include <string>

#include <brigand/algorithms/for_each.hpp>

#include "Macro.hpp"
#include "Keywords.hpp"
#include "HelpFactory.hpp"
#include "MeshConv/Types.hpp"

namespace meshconv {
//! Mesh converter control facilitating user input to internal data transfer
namespace ctr {

//! Member data for tagged tuple
using CmdLineMembers = brigand::list<
    tag::io,         ios
  , tag::verbose,    bool
  , tag::chare,      bool
  , tag::reorder,    bool
  , tag::help,       bool
  , tag::quiescence, bool
  , tag::trace,      bool
  , tag::version,    bool
  , tag::license,    bool
  , tag::cmdinfo,    tk::ctr::HelpFactory
  , tag::ctrinfo,    tk::ctr::HelpFactory
  , tag::helpkw,     tk::ctr::HelpKw
  , tag::error,      std::vector< std::string >
>;

//! \brief CmdLine is a TaggedTuple specialized to MeshConv
//! \details The stack is a tagged tuple, a hierarchical heterogeneous data
//!    structure where all parsed information is stored.
//! \see Base/TaggedTuple.h
//! \see Control/MeshConv/Types.h
class CmdLine : public tk::TaggedTuple< CmdLineMembers > {

  public:
    //! \brief MeshConv command-line keywords
    //! \see tk::grm::use and its documentation
    using keywords = tk::cmd_keywords< kw::verbose
                                     , kw::charestate
                                     , kw::help
                                     , kw::helpkw
                                     , kw::input
                                     , kw::output
                                     , kw::screen
                                     , kw::reorder_cmd
                                     , kw::quiescence
                                     , kw::trace
                                     , kw::version
                                     , kw::license
                                     >;

    //! Set of tags to ignore when printing this CmdLine
    using ignore =
      brigand::set< tag::cmdinfo
                  , tag::ctrinfo
                  , tag::helpkw >;

    //! \brief Constructor: set defaults.
    //! \details Anything not set here is initialized by the compiler using the
    //!   default constructor for the corresponding type. While there is a
    //!   ctrinfo parameter, it is unused here, since meshconv does not have a
    //!   control file parser.
    //! \see walker::ctr::CmdLine
    CmdLine() {
      get< tag::io, tag::screen >() =
        tk::baselogname( tk::meshconv_executable() );
      get< tag::verbose >() = false; // Use quiet output by default
      get< tag::chare >() = false; // No chare state output by default
      get< tag::reorder >() = false; // Do not reorder by default
      get< tag::trace >() = true; // Output call and stack trace by default
      get< tag::version >() = false; // Do not display version info by default
      get< tag::license >() = false; // Do not display license info by default
      // Initialize help: fill from own keywords
      brigand::for_each< keywords::set >( tk::ctr::Info(get<tag::cmdinfo>()) );
    }

    /** @name Pack/Unpack: Serialize CmdLine object for Charm++ */
    ///@{
    //! \brief Pack/Unpack serialize member function
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    void pup( PUP::er& p ) { tk::TaggedTuple< CmdLineMembers >::pup(p); }
    //! \brief Pack/Unpack serialize operator|
    //! \param[in,out] p Charm++'s PUP::er serializer object reference
    //! \param[in,out] c CmdLine object reference
    friend void operator|( PUP::er& p, CmdLine& c ) { c.pup(p); }
    //@}

    //! Compute and return log file name
    //! \param[in] def Default log file name (so we don't mess with user's)
    //! \param[in] nrestart Number of times restarted
    //! \return Log file name
    std::string logname( const std::string& def, int nrestart ) const {
      if (get< tag::io, tag::screen >() != def)
        return get< tag::io, tag::screen >();
      else
        return tk::logname( tk::meshconv_executable(), nrestart );
    }
};

} // ctr::
} // meshconv::

#endif // MeshConvCmdLine_h


text:
<!DOCTYPE html>

  <title> ania's corner </title>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.css">
  <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.css">
  <link rel="stylesheet" type"text/css" href="../styles/c5.css">

  <link rel="shortcut icon" href="favicon.ico" type="favicon.ico">
  <link rel="icon" href="../favicon.ico" type="favicon.ico">

  <link href="https://fonts.googleapis.com/css?family=Bubbler+One" rel="stylesheet">

Self Confidence

 mindfulness and self awareness

 Mindfulness is an aspect of self-awareness
 or the other way round...:)

"Self-awareness … is a neutral mode that maintains self-reflectiveness even in the midst of turbulent emotions."

              —Daniel Goleman

"Mindfulness means paying attention in a particular way: on purpose, in the present moment, and non-judgmentally."

              —Jon Kabat-Zinn

Excerpt From: Tan, Chade-Meng. "Search Inside Yourself: The Unexpected Path to Achieving Success, Happiness (and World Peace)."

            body scan

            I tried body skan and it felt good, I don't remember much of it as I fell asleep ... it looks like I still need some more practice.

            "My Emotions are Not Me"
 section

 .. was inspiring and re-confirming.

               back to top ↑

            home
            |
            blog
            |
            about


text:
package org.apache.camel.maven.packaging.dsl.component;

import java.util.Objects;

import javax.annotation.Generated;

import org.apache.camel.maven.packaging.ComponentDslMojo;
import org.apache.camel.maven.packaging.dsl.DslHelper;
import org.apache.camel.tooling.model.ComponentModel;
import org.apache.camel.tooling.util.srcgen.JavaClass;
import org.apache.camel.tooling.util.srcgen.Method;

/**
 * DSL Generator class that generates main component specific builder factory, e.g: KafkaComponentBuilderFactory
 */
public final class ComponentDslBuilderFactoryGenerator {
    private static final String BUILDER_FACTORY_SUFFIX = "BuilderFactory";

    private final ComponentModel componentModel;
    private final String packageName;
    private JavaClass javaClass;
    private ComponentDslInnerBuilderGenerator componentDslInnerBuilderGenerator;
    private ComponentDslInnerImplBuilderGenerator componentDslInnerImplBuilderGenerator;

    private ComponentDslBuilderFactoryGenerator(final ComponentModel componentModel, final ClassLoader classLoader, final String packageName) {
        this.componentModel = componentModel;
        this.packageName = packageName;

        javaClass = new JavaClass(classLoader);
        // generate java class
        generateJavaClass();
    }

    public static ComponentDslBuilderFactoryGenerator generateClass(final ComponentModel componentModel, final ClassLoader classLoader, final String componentDslPackageName) {
        Objects.requireNonNull(componentModel);
        Objects.requireNonNull(classLoader);

        return new ComponentDslBuilderFactoryGenerator(componentModel, classLoader, componentDslPackageName);
    }

    public static String getExpectedGeneratedClassName(final ComponentModel componentModel) {
        return DslHelper.generateComponentBuilderClassName(componentModel, BUILDER_FACTORY_SUFFIX);
    }

    public String printClassAsString() {
        return javaClass.printClass(true);
    }

    @Override
    public String toString() {
        return printClassAsString();
    }

    public String getGeneratedClassName() {
        return getExpectedGeneratedClassName(componentModel);
    }

    public ComponentDslInnerBuilderGenerator getComponentDslInnerBuilderGenerator() {
        return componentDslInnerBuilderGenerator;
    }

    public ComponentDslInnerImplBuilderGenerator getComponentDslInnerImplBuilderGenerator() {
        return componentDslInnerImplBuilderGenerator;
    }

    private void generateJavaClass() {
        setPackage();
        setImports();
        setJavaDoc();
        setMainAnnotations();
        setBuilderFactoryClassNameAndType();
        componentDslInnerBuilderGenerator = ComponentDslInnerBuilderGenerator.generateClass(javaClass.addNestedType(), componentModel);
        componentDslInnerImplBuilderGenerator = ComponentDslInnerImplBuilderGenerator.generateClass(javaClass.addNestedType(), componentModel, componentDslInnerBuilderGenerator.getGeneratedInterfaceName());
        setDslEntryMethod(componentDslInnerBuilderGenerator.getGeneratedInterfaceName(), componentDslInnerImplBuilderGenerator.getGeneratedClassName());
    }

    private void setPackage() {
        javaClass.setPackage(packageName + ".dsl");
    }

    private void setImports() {
        javaClass.addImport("org.apache.camel.Component");
        javaClass.addImport(packageName + ".AbstractComponentBuilder");
        javaClass.addImport(packageName + ".ComponentBuilder");
        javaClass.addImport(componentModel.getJavaType());
    }

    private void setJavaDoc() {
        String doc = "Generated by camel-package-maven-plugin - do not edit this file!";
        if (!componentModel.getDescription().isEmpty()) {
            doc = componentModel.getDescription() + "\n\n" + doc;
        }
        javaClass.getJavaDoc().setText(doc);
    }

    private void setMainAnnotations() {
        javaClass.addAnnotation(Generated.class).setStringValue("value", ComponentDslMojo.class.getName());
    }

    private void setBuilderFactoryClassNameAndType() {
        javaClass.setClass(false)
                .setName(getGeneratedClassName());

    }

    private void setDslEntryMethod(final String innerBuilderInterfaceName, final String innerBuilderImplName) {
        final Method method = javaClass.addMethod()
                .setStatic()
                .setReturnType(innerBuilderInterfaceName)
                .setName(DslHelper.toCamelCaseLower(componentModel.getScheme()))
                .setBody(String.format("return new %s();", innerBuilderImplName));

        if (componentModel.isDeprecated()) {
            method.addAnnotation(Deprecated.class);
        }

        method.getJavaDoc().setFullText(DslHelper.getMainDescriptionWithoutPathOptions(componentModel));
    }
}


text:
package com.youzu.android.framework.bitmap.download;

import com.youzu.android.framework.BitmapUtils;
import com.youzu.android.framework.util.IOUtils;
import com.youzu.android.framework.util.LogUtils;
import com.youzu.android.framework.util.OtherUtils;

import java.io.*;
import java.net.URL;
import java.net.URLConnection;

public class DefaultDownloader extends Downloader {

    /**
     * Download bitmap to outputStream by uri.
     *
     * @param uri          file path, assets path(assets/xxx) or http url.
     * @param outputStream
     * @param task
     * @return The expiry time stamp or -1 if failed to download.
     */
    @Override
    public long downloadToStream(String uri, OutputStream outputStream, final BitmapUtils.BitmapLoadTask<?> task) {

        if (task == null || task.isCancelled() || task.getTargetContainer() == null) return -1;

        URLConnection urlConnection = null;
        BufferedInputStream bis = null;

        OtherUtils.trustAllHttpsURLConnection();

        long result = -1;
        long fileLen = 0;
        long currCount = 0;
        try {
            if (uri.startsWith("/")) {
                FileInputStream fileInputStream = new FileInputStream(uri);
                fileLen = fileInputStream.available();
                bis = new BufferedInputStream(fileInputStream);
                result = System.currentTimeMillis() + this.getDefaultExpiry();
            } else if (uri.startsWith("assets/")) {
                InputStream inputStream = this.getContext().getAssets().open(uri.substring(7, uri.length()));
                fileLen = inputStream.available();
                bis = new BufferedInputStream(inputStream);
                result = Long.MAX_VALUE;
            } else {
                final URL url = new URL(uri);
                urlConnection = url.openConnection();
                urlConnection.setConnectTimeout(this.getDefaultConnectTimeout());
                urlConnection.setReadTimeout(this.getDefaultReadTimeout());
                bis = new BufferedInputStream(urlConnection.getInputStream());
                result = urlConnection.getExpiration();
                result = result < System.currentTimeMillis() ? System.currentTimeMillis() + this.getDefaultExpiry() : result;
                fileLen = urlConnection.getContentLength();
            }

            if (task.isCancelled() || task.getTargetContainer() == null) return -1;

            byte[] buffer = new byte[4096];
            int len = 0;
            BufferedOutputStream out = new BufferedOutputStream(outputStream);
            while ((len = bis.read(buffer)) != -1) {
                out.write(buffer, 0, len);
                currCount += len;
                if (task.isCancelled() || task.getTargetContainer() == null) return -1;
                task.updateProgress(fileLen, currCount);
            }
            out.flush();
        } catch (Throwable e) {
            result = -1;
            LogUtils.e(e.getMessage(), e);
        } finally {
            IOUtils.closeQuietly(bis);
        }
        return result;
    }
}


text:
require 'spec_helper'

module Clubhouse
  RSpec.describe 'User actions', type: :integration do

    subject { User.new }

    describe '#save' do
      it 'raises an exception' do
        expect{ subject.save }.to raise_error NotSupportedByAPIError,
          "You can't create users over the API, please use clubhouse web"
      end
    end

    describe '#delete' do
      it 'raises an exception' do
        expect{ User.delete("1234-1234-1234") }.to raise_error NotSupportedByAPIError,
          "You can't delete users over the API, please use clubhouse web"
      end
    end

    describe '.find' do
      before { stub_get_resource_with(:users, id, :user) }

      let(:id) { '12345678-9012-3456-7890-123456789012' }
      let(:user) { User.find(id) }
      let(:perm) { user.permissions.first }

      it 'returns a user' do
        expect(user.name).to eq 'Jon N'
        expect(user.two_factor_auth_activated).to be_truthy
        expect(user.username).to eq 'jondemo'
        expect(user.deactivated).to be_truthy

        expect(perm.role).to eq 'admin'
        expect(perm.disabled).to be_truthy
        expect(perm.email_address).to eq 'foo@example.com'
      end
    end

    describe '.all' do
      before { stub_all_resource_with(:users, :users) }

      let(:users) { User.all }
      let(:user_a) { users.first }
      let(:user_b) { users.last }
      let(:user_b_perm) { user_b.permissions.first }

      it 'returns users array' do
        expect(user_a.name).to eq 'Jon N'
        expect(user_b.name).to eq 'Mia N'

        expect(user_a.id).to eq '12345678-9012-3456-7890-123456789012'
        expect(user_b.id).to eq '02345678-9012-6789-0123-123456789012'

        expect(user_b_perm.role).to eq 'admin'
        expect(user_b_perm.disabled).to be_truthy
        expect(user_b_perm.email_address).to eq 'mia@example.com'
      end
    end
  end
end