Unless we're on the front page we'll have a kind_slug like 'movies'.
        We need to translate that into an event `kind` like 'movie'.
972322
def get_event_kind(self):
        
        slug = self.kwargs.get('kind_slug', None)
        if slug is None:
            return None  # Front page; showing all Event kinds.
        else:
            slugs_to_kinds = {v:k for k,v in Event.KIND_SLUGS.items()}
            return slugs_to_kinds.get(slug, None)
880363
function onResponse(type, pRes) {
    contentTypes[type] = pRes.headers['content-type'].split(';')[0];
    responses[type]    = pRes;

    //
    // If we have both a public and a private
    // response.
    //
    if (responses.public && responses.private) {
      if (contentTypes.public === contentTypes.private) {
        return self.merge.handlers[contentTypes.public](req, res, responses);
      }

      res.writeHead(500, { 'content-type': 'text/plain' });
      res.end('Content-Type mismatch: ' + JSON.stringify(contentTypes));
    }
  }
496744
function slugToTitle (slug) {
  slug = slug.replace('.md', '').trim();
  return _s.titleize(_s.humanize(path.basename(slug)));
}
95110
function(_id,_event){
            var _type = _event.type.toLowerCase();
            _t1.requestAnimationFrame(function(){
                _v._$dispatchEvent(_id,_type);
            });
        }
515253
protected function maybe_prompt() {
		if ( ! $this->is_time() ) {
			return;
		}

		\add_action( 'admin_footer', array( $this, 'script' ) );
		if ( false !== $this->op['notice_callback'] ) {
			call_user_func_array( $this->op['notice_callback'], array( &$this ) );
		} else {
			\add_action( 'admin_notices', array( $this, 'add_notice' ) );
		}
	}
468626
function (event, fn, context) {
		this._events = this._events || {};
		var e = this._events[event] || (this._events[event] = []);
		e.push([fn, context]);
	}
237575
function filterAfter(posts) {
      after = moment(after.replace(/\//g, '-'), 'MM-DD-YYYY', true);
      if (!after.isValid()) {
        console.log(chalk.red('After date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
        return posts;
      }

      return posts.filter(function filterPosts(post) {
        return moment(post.date).isAfter(after);
      });
    }
200347
function(type) {
        var self = this,
            event,
            context,
            func,
            selector,
            win = $(window),
            doc = $(document);

        $.each(this.__events, function(i, value) {
            event = value[0];
            context = value[1];
            func = value[2];
            selector = value[3];

            // Determine the correct context
            if (self[context]) {
                context = self[context];

            } else if (context === 'window') {
                context = win;

            } else if (context === 'document') {
                context = doc;
            }

            // Ready events
            if (event === 'ready') {
                doc.ready(func);

            // Delegated events
            } else if (selector) {
                $(context)[type](event, selector, func);

            // Regular events
            } else {
                $(context)[type](event, func);
            }
        });
    }
1249547
def new_genre(self, program, genre, relevance):
        """"""

        if self.__v_genre:
            # [Genre: SP002709210000, Sports event, 0]
            # [Genre: SP002709210000, Basketball, 1]
            # [Genre: SP002737310000, Sports event, 0]
            # [Genre: SP002737310000, Basketball, 1]
            # [Genre: SH016761790000, News, 0]
            # [Genre: SH016761790000, Talk, 1]
            # [Genre: SH016761790000, Interview, 2]
            # [Genre: SH016761790000, Politics, 3]
            print("[Genre: %s, %s, %s]" % (program, genre, relevance))
1305297
function posts (content, contentType) {
  let output = {}
  const allFiles = content.filter(each => each.dir.includes(`/${contentType}`))
  const index = allFiles.filter(each => each.base === 'index.md')[0]
  index.attr.forEach(each => {
    allFiles.forEach(file => {
      if (file.name === each) {
        output[each] = file
      }
    })
  })
  return output
}
643756
def p_recent(self, kind, cur_p='', with_catalog=True, with_date=True):
        '''
        
        '''
        if cur_p == '':
            current_page_number = 1
        else:
            current_page_number = int(cur_p)

        current_page_number = 1 if current_page_number < 1 else current_page_number

        pager_num = int(MPost.total_number(kind) / CMS_CFG['list_num'])
        kwd = {
            'pager': '',
            'title': 'Recent posts.',
            'with_catalog': with_catalog,
            'with_date': with_date,
            'kind': kind,
            'current_page': current_page_number,
            'post_count': MPost.get_counts(),
            'router': config.router_post[kind],
        }
        self.render('admin/post_ajax/post_list.html',
                    kwd=kwd,
                    view=MPost.query_recent(num=20, kind=kind),
                    infos=MPost.query_pager_by_slug(
                        kind=kind,
                        current_page_num=current_page_number
                    ),
                    format_date=tools.format_date,
                    userinfo=self.userinfo,
                    cfg=CMS_CFG, )
697736
def shamelessly_promote():
    

    click.echo("Need " + click.style("help", fg='green', bold=True) +
               "? Found a " + click.style("bug", fg='green', bold=True) +
               "? Let us " + click.style("know", fg='green', bold=True) + "! :D")
    click.echo("File bug reports on " + click.style("GitHub", bold=True) + " here: "
               + click.style("https://github.com/Miserlou/Zappa", fg='cyan', bold=True))
    click.echo("And join our " + click.style("Slack", bold=True) + " channel here: "
               + click.style("https://slack.zappa.io", fg='cyan', bold=True))
    click.echo("Love!,")
    click.echo(" ~ Team " + click.style("Zappa", bold=True) + "!")
1045560
def acts_as_noteworthy(options={})
      class_inheritable_accessor :options
      self.options = options

      unless included_modules.include? InstanceMethods
        instance_eval do
          has_many :mentions, :as => :owner, :order => 'date desc'

          with_options :as => :owner, :class_name => "Mention" do |c|
            c.has_many :google_news_mentions, :conditions => {:search_source => "Google News"}, :order => 'date desc'
            c.has_many :google_blog_mentions, :conditions => {:search_source => "Google Blogs"}, :order => 'date desc'
#            c.has_many :technorati_mentions, :conditions => {:search_source => "Technorati"}, :order => 'date desc'
            c.has_many :bing_mentions, :conditions => {:search_source => "Bing"}, :order => 'date desc'
          end
        end

        extend ClassMethods
        include InstanceMethods
      end
    end
307609
function kindToResource(kind, humanize) {
    if (!kind) {
      return "";
    }
    var resource = kind;
    if (humanize) {
      var humanizeKind = $filter("humanizeKind");
      resource = humanizeKind(resource);
    }
    resource = String(resource).toLowerCase();
    if (resource === 'endpoints' || resource === 'securitycontextconstraints') {
      // no-op, plural is the singular
    }
    else if (resource[resource.length-1] === 's') {
      resource = resource + 'es';
    }
    else if (resource[resource.length-1] === 'y') {
      resource = resource.substring(0, resource.length-1) + 'ies';
    }
    else {
      resource = resource + 's';
    }

    return resource;
  }
897508
def _getUpcomingEvents(self, request):
        """"""
        home = request.site.root_page
        return getAllUpcomingEvents(request, home=home)
689755
def respond(self, request, view, newsitems, extra_context={}):
        """"""
        context = self.get_context(request, view=view)
        context.update(self.paginate_newsitems(request, newsitems))
        context.update(extra_context)
        template = self.get_template(request, view=view)
        return TemplateResponse(request, template, context)
706694
public function onBeforeWrite()
    {
        parent::onBeforeWrite();
        /** Check if we have translatable and a NewsHolderPage. If no HolderPage available, skip (Create an orphan) */
        if (!$this->NewsHolderPages()->count()) {
            if (!class_exists('Translatable') && $page = NewsHolderPage::get()->first()) {
                $this->NewsHolderPages()->add($page);
            } elseif (class_exists('Translatable')) {
                Translatable::disable_locale_filter();
                $page = NewsHolderPage::get()->first();
                $this->NewsHolderPages()->add($page);
                Translatable::enable_locale_filter();
            }
        }
        if (!$this->Type || $this->Type === '') {
            $this->Type = 'news';
        }
        /** Set PublishFrom to today to prevent errors with sorting. New since 2.0, backward compatible. */
        if (!$this->PublishFrom) {
            $this->PublishFrom = SS_Datetime::now()->Rfc2822();
        }
        /**
         * Make sure the link is valid.
         */
        if (substr($this->External, 0, 4) !== 'http' && $this->External != '') {
            $this->External = 'http://' . $this->External;
        }
        $this->setURLValue();
        $this->setAuthorData();
    }