answer stringlengths 15 1.25M |
|---|
#include "vsmanager.h"
#include "vsproject.h"
#include "vsprojectconstants.h"
using namespace ProjectExplorer;
namespace VsProjectManager {
namespace Internal {
Project *VsManager::openProject(const QString &fileName, QString *errorString)
{
if (!QFileInfo(fileName).isFile()) {
if (errorString)
*errorString = tr("Failed opening project \"%1\": Project is not a file")
.arg(fileName);
return 0;
}
return new VsProject(this, fileName);
}
QString VsManager::mimeType() const
{
return QLatin1String(Constants::MIMETYPE);
}
void VsManager::<API key>()
{
if (m_contextProject && m_contextProject->vsProjectData())
{
m_contextProject->vsProjectData()->openInDevenv();
}
}
void VsManager::setContextProject(VsProject* project)
{
m_contextProject = project;
}
} // namespace Internal
} // namespace VsProjectManager |
package org.data2semantics.mustard.learners.evaluation;
import java.util.HashMap;
import java.util.Map;
import org.data2semantics.mustard.learners.Prediction;
/**
* The macro-F1 evaluation measure, i.e. the average of the F1 for each class.
* The micro-F1 would be computed by taking the average precision and average recall.
*
* F1 = (2 * TP) / (2 * TP + FP + FN)
*
* @author Gerben
*
*/
public class F1 implements EvaluationFunction {
public double computeScore(double[] target, Prediction[] prediction) {
Map<Double, Double> counts = new HashMap<Double, Double>();
for (int i = 0; i < target.length; i++) {
if (!counts.containsKey(target[i])) {
counts.put(target[i], 1.0);
} else {
counts.put(target[i], counts.get(target[i]) + 1);
}
}
double f1 = 0, temp1 = 0, temp2 = 0;
for (double label : counts.keySet()) {
for (int i = 0; i < prediction.length; i++) {
if ((prediction[i].getLabel() == label && target[i] == label)) {
temp1 += 1;
}
else if ((prediction[i].getLabel() == label || target[i] == label)) { // FP || FN (because we have all the TP already)
temp2 += 1;
}
}
f1 += (2*temp1) /((2*temp1) + temp2);
temp1 = 0;
temp2 = 0;
}
return f1 / (counts.size());
}
public boolean isBetter(double scoreA, double scoreB) {
return (scoreA > scoreB) ? true : false;
}
public String getLabel() {
return "F1";
}
public boolean isHigherIsBetter() {
return true;
}
} |
/* eslint no-console:0 */
import { namespace } from './utils/namespace';
import CopyToClipboard from './globals/CopyToClipboard';
import Pagination from './globals/Pagination';
import PingChart from './websites/PingChart';
import Polyglot from 'node-polyglot';
class Dispatcher {
constructor() {
this.pageName = document.body.dataset.page;
}
route() {
switch (this.pageName) {
case 'websites:index':
new Pagination('websites').init();
break;
case 'websites:response_time:index':
new PingChart('[data-behavior="response-time-chart"]').init();
break;
case 'tokens:index':
case 'users:instructions:index':
new CopyToClipboard().init();
break;
}
}
feather() {
feather.replace();
}
translate() {
const phrases = document
.querySelector('[data-behavior="translations"]')
.getAttribute('data-phrases');
window.polyglot = new Polyglot({ phrases: JSON.parse(phrases) });
}
}
document.addEventListener('turbolinks:load', () => {
const dispatcher = new Dispatcher();
dispatcher.feather();
dispatcher.route();
dispatcher.translate();
}); |
require("./24.js");
require("./49.js");
require("./98.js");
require("./195.js");
module.exports = 196; |
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace LeetCode.Test
{
[TestClass]
public class <API key>
{
[TestMethod]
public void <API key>()
{
var solution = new <API key>();
var result = solution.GenerateParenthesis(3);
Assert.AreEqual(5, result.Count);
Assert.AreEqual("((()))", result[0]);
Assert.AreEqual("(()())", result[1]);
Assert.AreEqual("(())()", result[2]);
Assert.AreEqual("()(())", result[3]);
Assert.AreEqual("()()()", result[4]);
}
[TestMethod]
public void <API key>()
{
var solution = new <API key>();
var result = solution.GenerateParenthesis(-1);
Assert.AreEqual(0, result.Count);
}
[TestMethod]
public void <API key>()
{
var solution = new <API key>();
var result = solution.GenerateParenthesis(0);
Assert.AreEqual(0, result.Count);
}
[TestMethod]
public void <API key>()
{
var solution = new <API key>();
var result = solution.GenerateParenthesis(1);
Assert.AreEqual(1, result.Count);
Assert.AreEqual("()", result[0]);
}
[TestMethod]
public void <API key>()
{
var solution = new <API key>();
var result = solution.GenerateParenthesis(4);
Assert.AreEqual(14, result.Count);
result = solution.GenerateParenthesis(5);
Assert.AreEqual(42, result.Count);
result = solution.GenerateParenthesis(6);
Assert.AreEqual(132, result.Count);
}
}
} |
const {bar, baz} = (function () {
DEFINE_MACRO(FOO, () => "bar");
function bar() {
return FOO();
}
const baz = (function () {
DEFINE_MACRO(FOO, () => "baz");
return function baz() {
return FOO();
};
})();
return {bar, baz};
})();
export default function demo() {
return [bar(), baz()];
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="stylesheets/homepage.css">
<link rel="stylesheet" type="text/css" href="stylesheets/blog-index.css">
<link href='http://fonts.googleapis.com/css?family=Alegreya+Sans+SC' rel='stylesheet' type='text/css'>
<title>g10n Blog Index</title>
</head>
<body>
<header>
<a href="homepage.html" id="logo">g10n</a>
<nav>
<ul>
<li class="nav-menu"><a href="projects/index.html">Portfolio</a></li>
<li class="nav-menu"><a href="blog-index.html">Blog</a></li>
<li class="nav-menu"><a href="about-me.html">About me</a></li>
</ul>
</nav>
</header>
<section id="main-section">
<div class="box">
<h3>Cultural blog: the DBC experience and beyond</h3>
<ol>
<li><a href="blog-posts/c1-chefs-kitchen.html">Dev Bootcamp: the community, the culture, the experience</a></li>
<li><a href="blog-posts/c3-thinking-style.html">A look at Gregorc Thinking Styles</a></li>
<li><a href="blog-posts/c4-tech-issues.html">Women in tech: how to improve the industry</a></li>
<li><a href="blog-posts/c5-feedback.html">Pairing and Giving Feedback at Dev Bootcamp</a></li>
<li><a href="blog-posts/<API key>.html">The curse of stereotype threats</a></li>
<li><a href="blog-posts/c7-values.html">True values</a></li>
<li><a href="blog-posts/c8-conflict.html">Conflict at the workplace</a></li>
<li><a href="blog-posts/c9-questions.html">4 tips to write a terrific coding question</a></li>
</ol>
</div>
<div class="box">
<h3>Technical blog: trying to explain what I learn</h3>
<ol>
<li><a href="blog-posts/t1-git-blog.html">Version control with Git</a></li>
<li><a href="blog-posts/t2-css-design.html">Relative, absolute and fixed: your CSS "ahah" moment</a></li>
<li><a href="blog-posts/t3-arrays-hashes.html">Storing Data: arrays vs. hashes</a></li>
<li><a href="blog-posts/<API key>.html">The cycle method in Ruby</a></li>
<li><a href="blog-posts/t5-ruby-classes.html">A first look at Ruby classes</a></li>
<li><a href="blog-posts/t6-oop-concepts.html">Blocs, procs and lambdas in Ruby</a></li>
<li><a href="blog-posts/t7-JavaScript.html">Ruby vs. JavaScript: a first look at data structures</a></li>
<li><a href="blog-posts/cheat-sheet.html">JavaScript objects manipulation cheat sheet</a></li>
<li><a href="blog-posts/t8-tech.html">Development frameworks</a></li>
<li><a href="blog-posts/t9-blog-update.html">A fresh look at my website</a></li>
</ol>
</div>
</section>
<section id="footer">
<a href="https://twitter.com/gaelbergeron" target="_blank"><img src="social-icons/twitter.png" id="twitter" width=60px height=60px /></a>
<a href="https:
<a href="https://github.com/gaelbergeron" target="_blank"><img src="social-icons/github.png" id="github" width=60px height=60px /></a>
<a href="https://instagram.com/gramgael/" target="_blank"><img src="social-icons/instagram.png" id="instagram" width=60px height=60px /></a>
<a href="https://soundcloud.com/bergui" target="_blank"><img src="social-icons/soundcloud.png" id="soundcloud" width=60px height=60px /></a>
<a href="mailto:gael.bergeron@gmail.com" target="_blank"><img src="social-icons/email.png" id="email" width=60px height=60px /></a>
</section>
</body>
</html> |
import { loadModels } from '<API key>/utils/load-models';
const Definitions = {};
const loadDefinitions = function(definitions) {
for (const key in definitions) {
if (!definitions.hasOwnProperty(key)) {
continue;
}
Definitions[key] = definitions[key];
}
};
const <API key> = function(schema, options) {
return function() {
loadDefinitions(loadModels(schema, options));
};
};
export default Definitions;
export { loadDefinitions, <API key> }; |
layout: default
<div id="main" role="main" class="job">
<div class="row">
<div class="col-md-7">
<article class="wrap" itemscope itemtype="http://schema.org/Article">
{% if page.image.feature %}
<div class="page-feature">
<div class="page-image">
<img src="{{ site.url }}/images/{{ page.image.feature }}" class="page-feature-image" alt="{{ page.title }}" itemprop="image"> {% if page.image.credit %}{% include image-credit.html %}{% endif %}
</div>
<!-- /.page-image -->
</div>
<!-- /.page-feature -->
{% endif %}
<!-- include breadcrumbs.html -->
<div class="inner-wrap">
<nav class="toc"></nav>
<!-- /.toc -->
<a href="{{site.baseurl}}/jobs">Return to jobs overview and application</a>
<div id="content" class="page-content" itemprop="articleBody">
<h2>Background</h2>
<p>Code for San Francisco is a collection of creative volunteers working to improve the lives of San Franciscans. We have grown a lot recently: from 400 people in January 2014 to 1700 people in July 2015. We continue to advocate for open public data, we continue to build useful civic apps like LocalFreeWeb and SF in Progress, and we continue to work on civic infrastructure like BallotAPI and OpenReferral.</p>
<p><b>But <u>we want to do more</u> and to do it better.</b> To that end, we are building our leadership team.
{{ content }}
<hr />
<div class="page-footer">
<p>Please submit your application or nomination by September 1st by 11:59 PM. If you have questions about this new team and the process you can find out more on our <a href="{{site.baseurl}}/jobs/faq">FAQ page</a>.</p>
<p>We are committed to building an inclusive, diverse organization. Everyone is encouraged to apply.</p>
</div>
<!-- /.footer -->
</div>
<!-- /.content -->
</div>
<!-- /.inner-wrap -->
</article>
<!-- ./wrap -->
</div>
<div class="col-md-5">
{% include application.html %}
</div>
</div>
</div>
<!-- /#main --> |
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
[ **IMPORTANT: Please remove or replace everything between two square brackets ( [ ] ) before posting your issue.** ]
Describe the bug
[ Please explain your problem here, tell all the step you've taken and how you found the issue. ]
To Reproduce
[ Add steps to reproduce your problem ]
Screenshots
[ If applicable, add screenshots to help explain your problem. ]
System information
* **Rainmeter Version:** [You can check this here: https://docs.rainmeter.net/manual/user-interface/about/#VersionTab]
* **OS Version:** [You can check this here: https://docs.rainmeter.net/manual/user-interface/about/#VersionTab]
* **Skin Version:** [You can check this here: Right-Click the Skin -> Open variables file. It should be at the top of the file]
* **Spotify Version:** [You can check this here: https://docs.rainmeter.net/manual/user-interface/about/#PluginsTab]
Additional context / media
[ Add any other context or screenshots about the problem here. ] |
'use strict';
angular
.module('freelook.info')
.controller('input.menu.ctrl',
function (nav) {
var vm = this;
vm.items = [
{
name: 'index.input.menu.filter',
icon: 'filter',
go: nav.goHome,
action: 'filter'
},
{
name: 'index.input.menu.user',
icon: 'user',
go: nav.goProfile,
action: 'user'
},
{
name: 'index.input.menu.add',
icon: 'plus',
go: nav.goAdd,
action: 'add'
}
];
}); |
import _extends from "@babel/runtime/helpers/esm/extends";
import <API key> from "@babel/runtime/helpers/esm/<API key>";
/* eslint-disable jsx-a11y/aria-role */
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import ButtonBase from '../ButtonBase';
import IconButton from '../IconButton';
import withStyles from '../styles/withStyles';
import <API key> from '../ExpansionPanel/<API key>';
export var styles = function styles(theme) {
var transition = {
duration: theme.transitions.duration.shortest
};
return {
/* Styles applied to the root element. */
root: {
display: 'flex',
minHeight: 8 * 6,
transition: theme.transitions.create(['min-height', 'background-color'], transition),
padding: '0 24px 0 24px',
'&:hover:not($disabled)': {
cursor: 'pointer'
},
'&$expanded': {
minHeight: 64
},
'&$focused': {
backgroundColor: theme.palette.grey[300]
},
'&$disabled': {
opacity: 0.38
}
},
/* Pseudo-class applied to the root element, children wrapper element and `IconButton` component if `expanded={true}`. */
expanded: {},
/* Pseudo-class applied to the root element if `focused={true}`. */
focused: {},
/* Pseudo-class applied to the root element if `disabled={true}`. */
disabled: {},
/* Styles applied to the children wrapper element. */
content: {
display: 'flex',
flexGrow: 1,
transition: theme.transitions.create(['margin'], transition),
margin: '12px 0',
'&$expanded': {
margin: '20px 0'
}
},
/* Styles applied to the `IconButton` component when `expandIcon` is supplied. */
expandIcon: {
transform: 'rotate(0deg)',
transition: theme.transitions.create('transform', transition),
'&:hover': {
// Disable the hover effect for the IconButton,
// because a hover effect should apply to the entire Expand button and
// not only to the IconButton.
backgroundColor: 'transparent'
},
'&$expanded': {
transform: 'rotate(180deg)'
}
}
};
};
var <API key> = React.forwardRef(function <API key>(props, ref) {
var children = props.children,
classes = props.classes,
className = props.className,
expandIcon = props.expandIcon,
IconButtonProps = props.IconButtonProps,
onBlur = props.onBlur,
onClick = props.onClick,
onFocusVisible = props.onFocusVisible,
other = <API key>(props, ["children", "classes", "className", "expandIcon", "IconButtonProps", "onBlur", "onClick", "onFocusVisible"]);
var _React$useState = React.useState(false),
focusedState = _React$useState[0],
setFocusedState = _React$useState[1];
var handleFocusVisible = function handleFocusVisible(event) {
setFocusedState(true);
if (onFocusVisible) {
onFocusVisible(event);
}
};
var handleBlur = function handleBlur(event) {
setFocusedState(false);
if (onBlur) {
onBlur(event);
}
};
var _React$useContext = React.useContext(<API key>),
_React$useContext$dis = _React$useContext.disabled,
disabled = _React$useContext$dis === void 0 ? false : _React$useContext$dis,
expanded = _React$useContext.expanded,
toggle = _React$useContext.toggle;
var handleChange = function handleChange(event) {
if (toggle) {
toggle(event);
}
if (onClick) {
onClick(event);
}
};
return /*#__PURE__*/React.createElement(ButtonBase, _extends({
focusRipple: false,
disableRipple: true,
disabled: disabled,
component: "div",
"aria-expanded": expanded,
className: clsx(classes.root, className, disabled && classes.disabled, expanded && classes.expanded, focusedState && classes.focused),
onFocusVisible: handleFocusVisible,
onBlur: handleBlur,
onClick: handleChange,
ref: ref
}, other), /*#__PURE__*/React.createElement("div", {
className: clsx(classes.content, expanded && classes.expanded)
}, children), expandIcon && /*#__PURE__*/React.createElement(IconButton, _extends({
className: clsx(classes.expandIcon, expanded && classes.expanded),
edge: "end",
component: "div",
tabIndex: null,
role: null,
"aria-hidden": true
}, IconButtonProps), expandIcon));
});
process.env.NODE_ENV !== "production" ? <API key>.propTypes = {
/**
* The content of the expansion panel summary.
*/
children: PropTypes.node,
/**
* Override or extend the styles applied to the component.
* See [CSS API](#css) below for more details.
*/
classes: PropTypes.object.isRequired,
/**
* @ignore
*/
className: PropTypes.string,
/**
* The icon to display as the expand indicator.
*/
expandIcon: PropTypes.node,
/**
* Props applied to the `IconButton` element wrapping the expand icon.
*/
IconButtonProps: PropTypes.object,
/**
* @ignore
*/
onBlur: PropTypes.func,
/**
* @ignore
*/
onClick: PropTypes.func,
/**
* @ignore
*/
onFocusVisible: PropTypes.func
} : void 0;
export default withStyles(styles, {
name: '<API key>'
})(<API key>); |
/* jshint node: true */
'use strict';
module.exports = {
name: 'supertree-auth',
included: function(app) {
this._super.included(app);
app.import('vendor/ember-simple-auth/register-version.js');
},
}; |
<html>
<head>
<!-- include bootstrap for easy styling -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="<API key>+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="row text-center">
<img id="fowlJSLogo" src="FowlJS.png"><h1><strong>FowlJS</strong></h1>
</div>
<br />
<div class="row">
<div class="form-group">
<label for="testInput">Enter some text to test FowlJS: </label>
<input type='text' id="testInput" class="form-control">
</div>
</div>
<div class="row">
<!--<ul id="fowlTextList">-->
<!--<li>There are currently no fowl words.</li>-->
<div class="table-responsive">
<table id="fowlTextList" class="table" cellspacing="0" width="100%">
<thead>
<tr><th></th></tr>
</thead>
<tbody>
<tr><td>There are currently no fowl words.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- include FowlJS -->
<script src="fowl.min.js" type="text/javascript"></script>
<!-- include jQuery for easy example -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- include bootstrap for table pagination -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="<API key>" crossorigin="anonymous"></script>
<!-- jQuery dataTables plugin -->
<script src="//cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<script>
$(function() {
var dataTable = $('#fowlTextList').DataTable({
"pageLength": 5,
"paging": true,
"searching": false,
"lengthChange": false,
"info": false
});
$('#testInput').on('input', function() {
var fowlText = fowl.isTextFowl($(this).val());
if(fowlText.length < 1) {
$("#fowlTextList tbody tr").each(function() {
dataTable.row($(this)).remove().draw(false);
});
dataTable.row.add(['There are currently no fowl words']).draw(false);
} else {
$("#fowlTextList tbody tr").each(function() {
dataTable.row($(this)).remove().draw(false);
});
for(var i = 0; i < fowlText.length; i++) {
dataTable.row.add([fowlText[i]]).draw(false);
}
}
});
});
</script>
</body>
</html> |
# Ansible & Speed
* Q) How do I make ansible go faster?
* A) If you have a large number of nodes you're running these playbooks against you can increase the number of forks via the command line or in your /etc/ansible/ansible.cfg file.
<br />
Command line Example:
ansible-playbook -i hosts www thing_to_run.yml -f 10
Pipelining reduces the number of SSH operations required per-module execution. If you're concerned with being the first onto a machine, you shoud look into this.
* Q) How do I enable it?
* A) /etc/ansible/ansible.cfg; set pipelining=true. |
package util;
import org.metacsp.dispatching.DispatchingFunction;
import org.metacsp.multi.activity.<API key>;
public class ExampleComponent extends Component {
private DispatchingFunction df = null;
public ExampleComponent(String name, DispatchingFunction df) {
super(name);
this.df = df;
}
@Override
public ActivityCallback doStart(final <API key> act) {
return new ActivityCallback() {
@Override
public Object onFinish() {
df.finish(act);
return null;
}
@Override
public Object onStart() {
// TODO Auto-generated method stub
return null;
}
@Override
public Object onProgress() {
// TODO Auto-generated method stub
return null;
}
};
}
} |
class TermsController < <API key>
before_filter :find_book
# GET /terms
# GET /terms.xml
def index
@q = params[:q]
total_entries = @book && @q.nil? ? @book.terms_count : nil
@terms = (@book ? @book.terms : Term).search @q, :page => params[:page], :total_entries => total_entries
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @terms }
end
end
# GET /terms/1
# GET /terms/1.xml
def show
@term = Term.find(params[:id])
@nodes = @term.nodes :include => :book
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @term }
end
end
# GET /terms/new
# GET /terms/new.xml
def new
@term = Term.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @term }
end
end
# GET /terms/1/edit
def edit
@term = Term.find(params[:id])
end
# POST /terms
# POST /terms.xml
def create
@term = Term.new(params[:term])
respond_to do |format|
if @term.save
flash[:notice] = 'Term was successfully created.'
format.html { redirect_to(@term) }
format.xml { render :xml => @term, :status => :created, :location => @term }
else
format.html { render :action => "new" }
format.xml { render :xml => @term.errors, :status => :<API key> }
end
end
end
# PUT /terms/1
# PUT /terms/1.xml
def update
@term = Term.find(params[:id])
respond_to do |format|
if @term.update_attributes(params[:term])
flash[:notice] = 'Term was successfully updated.'
format.html { redirect_to(@term) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @term.errors, :status => :<API key> }
end
end
end
# DELETE /terms/1
# DELETE /terms/1.xml
def destroy
@term = Term.find(params[:id])
@term.destroy
respond_to do |format|
format.html { redirect_to(terms_url) }
format.xml { head :ok }
end
end
protected
def find_book
if params[:book_id]
@book = Book.find params[:book_id]
end
end
end |
import pandas as pd
import numpy as np
import pytest
from bioframe.core import stringops
from bioframe.core.stringops import parse_region
def test_to_ucsc_string():
assert stringops.to_ucsc_string(("chr21", 1, 4)) == "chr21:1-4"
def test_parse_region():
# UCSC-style names
assert parse_region("chr21") == ("chr21", 0, None)
assert parse_region("chr21:1000-2000") == ("chr21", 1000, 2000)
assert parse_region("chr21:1,000-2,000") == ("chr21", 1000, 2000)
# Ensembl style names
assert parse_region("6") == ("6", 0, None)
assert parse_region("6:1000-2000") == ("6", 1000, 2000)
assert parse_region("6:1,000-2,000") == ("6", 1000, 2000)
# FASTA style names
assert parse_region("gb|accession|locus") == ("gb|accession|locus", 0, None)
assert parse_region("gb|accession|locus:1000-2000") == (
"gb|accession|locus",
1000,
2000,
)
assert parse_region("gb|accession|locus:1,000-2,000") == (
"gb|accession|locus",
1000,
2000,
)
# Punctuation in names (aside from :)
assert parse_region("name-with-hyphens-") == ("name-with-hyphens-", 0, None)
assert parse_region("GL000207.1") == ("GL000207.1", 0, None)
assert parse_region("GL000207.1:1000-2000") == ("GL000207.1", 1000, 2000)
# Trailing dash
assert parse_region("chr21:1000-") == ("chr21", 1000, None)
# Humanized units
assert parse_region("6:1kb-2kb") == ("6", 1000, 2000)
assert parse_region("6:1k-2000") == ("6", 1000, 2000)
assert parse_region("6:1kb-2M") == ("6", 1000, 2000000)
assert parse_region("6:1Gb-") == ("6", 1000000000, None)
with pytest.raises(ValueError):
parse_region("chr1:2,000-1,000") # reverse selection
with pytest.raises(ValueError):
parse_region("chr1::1000-2000") # more than one colon
def <API key>():
assert stringops.parse_region_string("6:1kb-2kb") == ("6", 1000, 2000)
assert stringops.parse_region_string("6:1,000-2,000") == ("6", 1000, 2000)
assert stringops.parse_region_string("c6:1000-2000") == ("c6", 1000, 2000)
def <API key>():
assert stringops.<API key>("chrX:1M-2M") is True
assert stringops.<API key>("chrX") is False
assert stringops.<API key>("1M-2M") is False
assert stringops.<API key>(1000) is False
assert stringops.<API key>(np.array([100, 200])) is False
assert stringops.<API key>(np.array(["chr1:100-200"])) is False |
<?php
// Initialize the session
session_start();
// Check if the user is already logged in, if yes then redirect him to welcome page
if(isset($_SESSION["loggedin"]) && $_SESSION["loggedin"] === true){
header("location: welcome.php");
exit;
}
// Include config file
require_once "config.php";
// Define variables and initialize with empty values
$username = $password = "";
$username_err = $password_err = "";
// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
// Check if username is empty
if(empty(trim($_POST["username"]))){
$username_err = "Please enter username.";
} else{
$username = trim($_POST["username"]);
}
// Check if password is empty
if(empty(trim($_POST["password"]))){
$password_err = "Please enter your password.";
} else{
$password = trim($_POST["password"]);
}
// Validate credentials
if(empty($username_err) && empty($password_err)){
// Prepare a select statement
$sql = "SELECT id, username, password FROM users WHERE username = ?";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
<API key>($stmt, "s", $param_username);
// Set parameters
$param_username = $username;
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Store result
<API key>($stmt);
// Check if username exists, if yes then verify password
if(<API key>($stmt) == 1){
// Bind result variables
<API key>($stmt, $id, $username, $hashed_password);
if(mysqli_stmt_fetch($stmt)){
if(password_verify($password, $hashed_password)){
// Password is correct, so start a new session
session_start();
// Store data in session variables
$_SESSION["loggedin"] = true;
$_SESSION["id"] = $id;
$_SESSION["username"] = $username;
// Redirect user to welcome page
header("location: welcome.php");
} else{
// Display an error message if password is not valid
$password_err = "The password you entered was not valid.";
}
}
} else{
// Display an error message if username doesn't exist
$username_err = "No account found with that username.";
}
} else{
echo "Oops! Something went wrong. Please try again later.";
}
}
// Close statement
mysqli_stmt_close($stmt);
}
// Close connection
mysqli_close($link);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<style type="text/css">
body{ font: 14px sans-serif; }
.wrapper{ width: 350px; padding: 20px; }
</style>
</head>
<body>
<div class="wrapper">
<h2>Login</h2>
<p>Please fill in your credentials to login.</p>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div class="form-group <?php echo (!empty($username_err)) ? 'has-error' : ''; ?>">
<label>Username</label>
<input type="text" name="username" class="form-control" value="<?php echo $username; ?>">
<span class="help-block"><?php echo $username_err; ?></span>
</div>
<div class="form-group <?php echo (!empty($password_err)) ? 'has-error' : ''; ?>">
<label>Password</label>
<input type="password" name="password" class="form-control">
<span class="help-block"><?php echo $password_err; ?></span>
</div>
<div class="form-group">
<input type="submit" class="btn btn-primary" value="Login">
</div>
<p>Don't have an account? <a href="register.php">Sign up now</a>.</p>
</form>
</div>
</body>
</html> |
<!DOCTYPE html>
<html>
<head>
<title>page2</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="<API key>" content="yes"/>
<link href="resources/css/axure_rp_page.css" type="text/css" rel="stylesheet"/>
<link href="data/styles.css" type="text/css" rel="stylesheet"/>
<link href="files/page2/styles.css" type="text/css" rel="stylesheet"/>
<script src="resources/scripts/jquery-1.7.1.min.js"></script>
<script src="resources/scripts/jquery-ui-1.8.10.custom.min.js"></script>
<script src="resources/scripts/axure/axQuery.js"></script>
<script src="resources/scripts/axure/globals.js"></script>
<script src="resources/scripts/axutils.js"></script>
<script src="resources/scripts/axure/annotation.js"></script>
<script src="resources/scripts/axure/axQuery.std.js"></script>
<script src="resources/scripts/axure/doc.js"></script>
<script src="data/document.js"></script>
<script src="resources/scripts/messagecenter.js"></script>
<script src="resources/scripts/axure/events.js"></script>
<script src="resources/scripts/axure/recording.js"></script>
<script src="resources/scripts/axure/action.js"></script>
<script src="resources/scripts/axure/expr.js"></script>
<script src="resources/scripts/axure/geometry.js"></script>
<script src="resources/scripts/axure/flyout.js"></script>
<script src="resources/scripts/axure/ie.js"></script>
<script src="resources/scripts/axure/model.js"></script>
<script src="resources/scripts/axure/repeater.js"></script>
<script src="resources/scripts/axure/sto.js"></script>
<script src="resources/scripts/axure/utils.temp.js"></script>
<script src="resources/scripts/axure/variables.js"></script>
<script src="resources/scripts/axure/drag.js"></script>
<script src="resources/scripts/axure/move.js"></script>
<script src="resources/scripts/axure/visibility.js"></script>
<script src="resources/scripts/axure/style.js"></script>
<script src="resources/scripts/axure/adaptive.js"></script>
<script src="resources/scripts/axure/tree.js"></script>
<script src="resources/scripts/axure/init.temp.js"></script>
<script src="files/page2/data.js"></script>
<script src="resources/scripts/axure/legacy.js"></script>
<script src="resources/scripts/axure/viewer.js"></script>
<script src="resources/scripts/axure/math.js"></script>
<script type="text/javascript">
$axure.utils.<API key> = function() { return 'resources/images/transparent.gif'; };
$axure.utils.getOtherPath = function() { return 'resources/Other.html'; };
$axure.utils.getReloadPath = function() { return 'resources/reload.html'; };
</script>
</head>
<body>
<div id="base" class="">
</div>
</body>
</html> |
function insert(receiver, type, sender, msg)
triggerClientEvent(receiver, "UCDchat.chatbox.insert", sender, type, msg)
end
addEvent("UCDchat.chatbox.send", true)
addEventHandler("UCDchat.chatbox.send", root,
function (type, msg)
if (not exports.UCDchecking:canPlayerDoAction(client, "Chat")) then return end
if (type == "main" or type == "team") then
triggerEvent("onPlayerChat", client, msg, type == "main" and 0 or 2)
elseif (type == "local") then
localChat(client, _, msg)
elseif (type == "support") then
supportChat(client, _, msg)
elseif (type == "group" and exports.UCDgroups:getPlayerGroup(client)) then
exports.UCDgroups:groupChat(client, _, msg)
elseif (type == "alliance") then
exports.UCDgroups:allianceChat(client, _, msg)
end
end
) |
# Proba
> Website monitor written in Elixir
A pun with the english word probe and the swedish word prova, meaning to test something. Coinciding well with me testing out Elixir.
It monitors a site and when it is done it sends a notification with terminal-notifier (needs to be installed).
sh
$ ./proba --url=https://github.com/vikeri
## Parameters
--url
The url to poll (does not work with redirects)
--polltime
Poll interval (in ms)
--selector
CSS selector to watch, eg. "body" or "#footer"
## Requirements
* Elixir (the escript does not seem to work with only Erlang yet)
* mix (for building from source)
* Homebrew (for installing terminal-notifier)
## Installation
1. Install [terminal-notifier](https://github.com/julienXX/terminal-notifier)
$ brew install terminal-notifier
2. Download executable
https://github.com/vikeri/proba/releases/download/v0.0.1/proba
2. ALT: Build from source
sh
$ git clone git@github.com:vikeri/proba.git
$ cd proba
$ mix escript.build |
/* reset */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,nav ul,nav li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline;}
article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;}
ol,ul{list-style:none;margin:0;padding:0;}
blockquote,q{quotes:none;}
blockquote:before,blockquote:after,q:before,q:after{content:'';content:none;}
table{border-collapse:collapse;border-spacing:0;}
/* start editing from here */
a{text-decoration:none;}
.txt-rt{text-align:right;}/* text align right */
.txt-lt{text-align:left;}/* text align left */
.txt-center{text-align:center;}/* text align center */
.float-rt{float:right;}/* float right */
.float-lt{float:left;}/* float left */
.clear{clear:both;}/* clear float */
.pos-relative{position:relative;}/* Position Relative */
.pos-absolute{position:absolute;}/* Position Absolute */
.vertical-base{ vertical-align:baseline;}/* vertical align baseline */
.vertical-top{ vertical-align:top;}/* vertical align top */
.underline{ padding-bottom:5px; border-bottom: 1px solid #eee; margin:0 0 20px 0;}/* Add 5px bottom padding and a underline */
nav.vertical ul li{ display:block;}/* vertical menu */
nav.horizontal ul li{ display: inline-block;}/* horizontal menu */
img{max-width:100%;}
/*end reset*/
@font-face {
font-family: 'ambleregular';
src:url(../font/<API key>.ttf) format('truetype');
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #FFF;
}
.wrap {
width:80%;
margin: 0 auto;
transition:all .2s linear;
-moz-transition:all .2s linear;/* firefox */
-webkit-transition:all .2s linear; /* safari and chrome */
-o-transition:all .2s linear; /* opera */
-ms-transition:all .2s linear;
}
.header {
background: #FFF;
}
.headertop_desc{
padding:20px 0;
background:#222;
border-bottom:1px solid #EEE;
}
.nav_list{
float:left;
}
.nav_list li{
display:inline;
border-left: 2px ridge #3D3B3B;
}
.nav_list li a{
font-size:0.823em;
color:#9C9C9C;
padding:0 10px;
font-family: 'ambleregular';
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.nav_list li a:hover{
color:#FFF;
}
.nav_list li:first-child{
border:none;
}
.account_desc{
float:right;
}
.account_desc li{
display:inline;
border-left: 2px ridge #3D3B3B;
}
.account_desc li:first-child{
border:none;
}
.account_desc li a{
font-size:0.823em;
color:#9C9C9C;
padding:0 10px;
font-family: 'ambleregular';
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.account_desc li a:hover{
color:#FFF;
}
.header_top {
padding:20px 0;
}
.logo {
float: left;
}
.header_top_right{
float:right;
padding:18px 0;
}
.search_box {
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
border: 1px solid #D2D2D2;
position: relative;
float: left;
margin-right: 15px;
}
.search_box form input[type="text"] {
border: none;
outline: none;
background: none;
font-size:0.85em;
color: #acacac;
font-family: 'ambleregular';
width:74%;
padding:9px;
-webkit-apperance:none;
}
.search_box form input[type="submit"] {
border: none;
cursor: pointer;
background: url(../images/search.png) no-repeat 0px 12px;
position: absolute;
right: 0;
width: 25px;
height:32px;
}
.cart{
float:right;
position: relative;
padding:6px 150px 6px 15px;
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
border: 1px solid #D2D2D2;
font-family: 'ambleregular';
}
.cart p{
font-size:0.9em;
color:#303030;
display:inline-block;
}
.cart p span{
font-size:1.5em;
color:#FC7D01;
text-transform:uppercase;
vertical-align:middle;
}
.wrapper-dropdown-2 {
display:inline-block;
margin: 0 auto;
font-size:0.9em;
color:#303030;
padding:0px 5px;
cursor: pointer;
outline: none;
}
.wrapper-dropdown-2:after {
content: "";
width: 0;
height: 0;
position: absolute;
right:15px;
top: 50%;
margin-top:0px;
border-width: 6px 6px 0 6px;
border-style: solid;
border-color:#FC7D01 transparent;
}
.wrapper-dropdown-2 .dropdown {
position: absolute;
top: 100%;
width:100%;
right: 0px;
z-index:1;
background:#FFF;
margin-top:2px;
border:1px solid #CCC;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
list-style: none;
opacity: 0;
pointer-events: none;
}
.wrapper-dropdown-2 .dropdown li{
display: block;
text-decoration: none;
color: #333;
font-size:0.823em;
padding: 10px;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-ms-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.wrapper-dropdown-2 .dropdown li:hover a {
color:red;
background:#AAA;
}
.wrapper-dropdown-2.active:after {
border-width: 0 6px 6px 6px;
}
.wrapper-dropdown-2.active .dropdown {
opacity: 1;
pointer-events: auto;
}
.header_slide{
margin-top:10px;
}
.header_bottom_left{
float:left;
width:25%;
}
.categories{
border:1px solid #EEE;
}
.categories h3{
font-size:1.2em;
color:#FFF;
padding:10px;
background:#FC7D01;
text-transform:uppercase;
font-family: 'ambleregular';
}
.categories li{
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
}
.categories li a{
display:block;
font-size:0.85em;
padding:9px 15px;
color: #9C9C9C;
font-family: 'ambleregular';
margin:0 20px;
background:url(../images/drop_arrow.png) no-repeat 0;
border-bottom: 1px solid #F1F1F1;
text-transform:uppercase;
}
.categories li:last-child a{
border:none;
}
.categories li a:hover{
color:#FC7D01;
}
.header_bottom_right{
margin: 0 auto;
width:80%;
margin-top: 10px;
padding-left:1%;
}
.content {
padding: 20px 0;
background: #FFF;
}
.content_top{
padding:10px 20px;
border: 1px solid #EBE8E8;
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
}
.content_bottom {
padding:10px 20px;
border: 1px solid #EBE8E8;
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
margin-top: 2.6%;
}
.heading h3 {
font-family: 'ambleregular';
font-size:1.2em;
color:#FC7D01;
text-transform: uppercase;
}
.grid_1_of_5 {
display: block;
float: left;
margin: 1% 0 1% 1.6%;
box-shadow: 0px 0px 3px rgb(150, 150, 150);
-webkit-box-shadow: 0px 0px 3px rgb(150, 150, 150);
-moz-box-shadow: 0px 0px 3px rgb(150, 150, 150);
-o-box-shadow: 0px 0px 3px rgb(150, 150, 150);
}
.grid_1_of_5:first-child {
/*margin-left: 0;*/
}
.images_1_of_5 {
width: 20%;
padding:1.5%;
text-align: center;
position: relative;
}
.images_1_of_5 img {
max-width: 100%;
}
.images_1_of_5 h2 a{
color:#888;
font-family: 'ambleregular';
font-size:1em;
padding-top:2px;
}
.images_1_of_5 p {
font-size: 0.8125em;
padding: 0.4em 0;
color: #333;
}
.images_1_of_5 p span.price {
font-size: 18px;
font-family: 'ambleregular';
color:#CC3636;
}
.price-details{
margin-top:10px;
}
.price-number{
float: left;
}
.price-details p span.rupees{
font-size:1.2em;
font-family: 'ambleregular';
color:#383838;
}
.add-cart{
float:right;
display: inline-block;
}
.add-cart h4 a{
font-size:0.85em;
display: block;
padding:8px 10px;
font-family: 'ambleregular';
background:#FC7D01;
color: #FFF;
text-decoration: none;
outline: 0;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.add-cart h4 a:hover{
text-shadow: 0px 0px 1px #000;
background:#292929;
}
/*** Footer ***/
.footer {
position: relative;
background: #FCFCFC;
border-top: 1px solid #CECECE;
margin:20px auto;
}
.section {
clear: both;
padding: 0px;
margin: 0px;
}
.group:before, .group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
}
.col_1_of_4 {
display: block;
float: left;
margin:0% 0 1% 3.6%;
}
.col_1_of_4:first-child {
margin-left: 0;
}/* all browsers except IE6 and lower */
.span_1_of_4 {
width: 20.5%;
padding:1.5% 1.5% 0 0;
border-left:1px solid #CECECE;
}
.span_1_of_4 h4 {
color:#4F4F4F;
margin-bottom: .5em;
font-size: 1.2em;
line-height: 1.2;
font-family: 'ambleregular';
font-weight: normal;
margin-top: 0px;
letter-spacing: -1px;
text-transform: uppercase;
border-bottom: 1px solid #CECECE;
padding-bottom: 0.5em;
padding-left:20px;
}
.span_1_of_4 ul{
padding-left:20px;
}
.span_1_of_4 li a {
font-size: 0.8125em;
padding: 0.4em 0;
color:#9C9C9C;
font-family: 'ambleregular';
display: block;
}
.span_1_of_4 li span{
font-size:1em;
font-family: 'ambleregular';
color:#2A5C86;
cursor:pointer;
margin:10px 0;
display:block;
}
.span_1_of_4 li a:hover, .span_1_of_4 li span:hover {
color:#FC7D01;
}
/*** Social Icons ***/
.social-icons {
padding-top: 8%;
}
.social-icons li {
padding: 0px 5px 0 5px;
margin: 0;
display: inline-block;
cursor: pointer;
background:#222;
border-radius:5px;
-<API key>:5px;
-moz-border-radius:5px;
-o-border-radius:5px;
}
.social-icons li:hover {
background:#000;
}
.social-icons li a img{
vertical-align:middle;
}
.copy_right {
text-align: center;
border-top: 1px solid #EEE;
padding: 10px 0;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;
}
.copy_right p {
font-size:0.823em;
color: #747474;
}
.copy_right p a {
color:#FC7D01;
font-family: 'ambleregular';
text-decoration: underline;
}
.copy_right p a:hover {
color:#222;
text-decoration: none;
}
/*** move top **/
#toTop {
display: none;
text-decoration: none;
position: fixed;
bottom: 10px;
right: 10px;
overflow: hidden;
width: 48px;
height: 48px;
border: none;
text-indent: 100%;
background: url(../images/arrow_up.png) no-repeat right top;
}
#toTopHover {
width: 48px;
height: 48px;
display: block;
overflow: hidden;
float: right;
opacity: 0;
-moz-opacity: 0;
filter: alpha(opacity=0);
}
#toTop:active, #toTop:focus {
outline: none;
}
.back-links {
float: left;
padding-top: 5px;
}
.back-links p {
font-size: 0.8125em;
color: #333;
}
.back-links p a {
font-size: 0.9em;
padding: 0 1.3%;
color: #333;
font-family: 'ambleregular';
}
.back-links p a:hover, .back-links p a.active {
color:#FC7D01;
}
.image {
clear: both;
padding: 0px;
margin: 0px;
padding: 1.5%;
}
.group:before, .group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
}
.cont-desc {
display: block;
float: left;
clear: both;
}
.rightsidebar {
display: block;
float: left;
margin: 0% 0 0% 1.6%;
}
.cont-desc:first-child {
margin-left: 0;
}
.desc {
display: block;
float: left;
margin: 0% 0 0% 2.6%;
}
.product-details{
margin:30px 0;
}
.span_1_of_2 {
width: 67.1%;
padding: 1.5%;
}
.images_3_of_2 {
width: 44.2%;
float: left;
text-align: center;
}
.span_3_of_2 {
width: 53.2%;
}
.span_3_of_1 {
width: 25.2%;
padding: 1.5%;
}
.images_3_of_2 img {
max-width: 100%;
display:block;
border: 1px solid #DFDFDF;
}
.span_3_of_2 h2 {
font-family: 'ambleregular';
font-size: 1.2em;
color:#FC7D01;
font-weight: normal;
margin-top: 0px;
text-transform: uppercase;
}
.span_3_of_2 p{
font-size: 0.8125em;
padding: 0.3em 0;
color: #969696;
line-height: 1.6em;
font-family: verdana, arial, helvetica, helve, sans-serif;
}
.price p {
font-size: 0.85em;
padding:20px 0;
color: #666;
vertical-align: top;
}
.price p span {
font-size:2em;
font-family: 'ambleregular';
color:#FC7D01;
}
.available {
padding: 10px 0;
border-top: 1px solid #EBEBEB;
}
.available li span{
font-size:1em;
color: #333;
font-family: 'ambleregular';
}
.available li {
display:block;
color:#707070;
font-size:1em;
padding:5px 0;
}
.share-desc{
margin-bottom:15px;
}
.share{
float:left;
}
.share p {
padding-top: 10px;
font-size:1em;
color: #333;
display:inline;
font-family: 'ambleregular';
}
.text_box{
display:inline;
width:60px;
padding:3px 5px;
outline:none;
margin-left:5px;
font-size:1em;
color:#444;
}
.wish-list{
padding:15px 0;
border-bottom: 1px solid #E6E6E6;
border-top: 1px solid #E6E6E6;
}
.wish-list li{
display:inline-block;
margin-right:45px;
}
.wish-list li a{
color: #383838;
font-size:1em;
font-family: 'ambleregular';
padding-left:22px;
text-decoration: underline;
}
.wish-list li a:hover {
color:#FC7D01;
}
.wish-list li.wish{
background:url(../images/wishlist.png) no-repeat 0;
}
.wish-list li.compare{
background:url(../images/compare.png) no-repeat 0;
margin-right:0;
}
.product_desc h2{
font-size:1.2em;
color: #333;
font-family: 'ambleregular';
}
.product_desc p{
font-size: 0.85em;
padding:5px 0;
color: #969696;
line-height: 1.8em;
}
.span_3_of_2 .button {
float: right;
}
.span_3_of_2 .button a {
font-size:0.85em;
display: block;
padding:8px 10px;
font-family: 'ambleregular';
background:#FC7D01;
color: #FFF;
text-decoration: none;
outline: 0;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.span_3_of_2 .button a:hover {
text-shadow: 0px 0px 1px #000;
background:#292929;
}
.sidebar h2{
padding:10px 20px;
border: 1px solid #EBE8E8;
background: url(../images/strip-bg.gif) repeat-x #F6F6F6;
font-family: 'ambleregular';
font-size:1.2em;
color:#FC7D01;
text-transform: uppercase;
}
.special_movies{
border: 1px solid #ECE9E9;
margin-top:20px;
}
.movie_poster{
float:left;
width:33%;
}
.movie_poster img{
display:block;
max-width:100%;
}
.movie_desc{
float:left;
width:55%;
margin-left:5%;
padding:10px;
}
.movie_desc h3 a{
color: #888;
font-family: 'ambleregular';
font-size:1.2em;
}
.movie_desc p{
font-size:1em;
font-family: 'ambleregular';
color:#383838;
padding:8px 0;
}
.movie_desc p span{
text-decoration:line-through;
color:#888;
}
.movie_desc span a{
font-size:0.8em;
display:inline-block;
padding:6px 10px;
font-family: 'ambleregular';
background:#FC7D01;
color: #FFF;
text-decoration: none;
outline: 0;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
.movie_desc span a:hover{
text-shadow: 0px 0px 1px #000;
background:#292929;
}
.section {
clear: both;
padding: 0px;
margin: 0px;
}
.group:before, .group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
}
.col {
display: block;
float: center;
margin:3% 0 1% 1.6%;
}
.col:first-child {
margin-left: 0;
}
.span_2_of_3 {
float:center;
width: 80%;
padding: 1.5%;
}
.span_1_of_3 {
width: 29.2%;
padding: 1.5%;
}
.span_2_of_3 h2, .span_1_of_3 h2 {
font-family: 'ambleregular';
font-size:1.2em;
color:#333;
text-transform:uppercase;
margin-bottom:10px;
}
.contact-form {
position: relative;
padding-bottom: 30px;
}
.contact-form div {
padding: 5px 0;
}
.contact-form span {
display: block;
font-size: 0.8125em;
color: #757575;
padding-bottom: 5px;
font-family: verdana, arial, helvetica, helve, sans-serif;
}
.contact-form input[type="text"], .contact-form textarea {
padding: 8px;
display: block;
width:100%;
background:none;
border:1px solid #CACACA;
outline: none;
color: #464646;
font-size:1em;
font-weight:bold;
font-family: Arial, Helvetica, sans-serif;
-webkit-appearance: none;
}
.contact-form textarea {
resize: none;
height:120px;
}
.mybutton {
font-size:1em;
padding:10px 25px;
font-family: 'ambleregular';
background:#FC7D01;
text-transform:uppercase;
color: #FFF;
border:none;
text-decoration: none;
outline: 0;
cursor:pointer;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
position: absolute;
right: 0;
-webkit-apperance:none;
}
.mybutton:hover {
text-shadow: 0px 0px 1px #000;
background: #292929;
}
.company_address p,.company_address p span a{
font-size: 0.85em;
color: #757575;
padding:5px 0;
font-family: Arial, Helvetica, sans-serif;
}
.company_address p span a{
text-decoration: underline;
color: #444;
cursor: pointer;
}
.company_address p span a:hover{
text-decoration:none;
}
.map {
margin-bottom: 15px;
}
@media only screen and (max-width: 1366px) and (min-width: 1280px) {
.wrap{
width:90%;
}
}
@media only screen and (max-width: 1280px) and (min-width: 1024px) {
.wrap{
width:90%;
}
}
@media only screen and (max-width: 1024px) {
.wrap {
width: 90%;
}
.movie_desc{
width:50%;
}
.movie_desc p{
font-size:0.8em;
}
}
@media only screen and (max-width: 800px) {
.wrap {
width: 95%;
}
.rightsidebar{
margin:0;
}
.span_1_of_2{
width:94%;
padding:3%;
}
.span_3_of_1{
width:94%;
padding:3%;
}
.movie_desc {
margin-left:0;
}
.movie_desc p{
font-size:1.2em;
padding:10px 0;
}
}
@media only screen and (max-width: 640px) {
.wrap {
width: 95%;
}
.account_desc li a{
padding:0 5px;
}
.cart{
padding: 6px 50px 6px 15px;
}
.header_bottom_right{
float:none;
width:100%;
padding-left:0;
margin-top:10px;
}
.header_bottom_left{
float:none;
width:100%;
}
.images_1_of_5{
width: 28.72%;
}
.col_1_of_4{
margin:10px 0;
}
.span_1_of_4{
width:100%;
padding:0%;
}
.wish-list li{
margin-right:15px;
}
.col{
margin:2% 0;
}
.span_2_of_3,.span_1_of_3 {
width:94%;
padding:3%;
}
.contact-form input[type="text"], .contact-form textarea{
width:100%;
}
}
@media only screen and (max-width: 480px) {
.wrap {
width: 95%;
}
.headertop_desc{
padding:10px 0;
}
.header_top{
padding:0;
}
.logo{
float:none;
text-align:center;
}
.header_top_right{
float:none;
padding:5px 0;
}
.nav_list li a,.account_desc li a{
font-size:0.7em;
padding:0 2px;
}
.images_1_of_5 {
width: 44.72%;
}
.images_3_of_2,.span_3_of_2{
width:100%;
}
.desc{
margin:10px 0;
}
.product-details{
margin:0;
}
}
@media only screen and (max-width: 320px) {
.wrap {
width: 95%;
}
.nav_list,.account_desc{
width:100%;
text-align:center;
}
.account_desc{
margin-top:5px;
}
.cart{
float:none;
margin-bottom:5px;
}
.search_box{
float:none;
width:100%;
margin-right:0;
}
.price p{
padding:10px 0;
}
.content{
padding:0;
}
.grid_1_of_5{
margin:10px 5px;
}
.images_1_of_5{
width:43.5%;
padding:1.5%;
}
.images_1_of_5 h2 a{
font-size:0.75em;
}
.price-number,.add-cart{
float:none;
text-align:center;
}
.price-details{
margin-top:0;
}
.wish-list li a{
font-size:0.85em;
}
.movie_desc p{
font-size:0.8em;
padding:5px 0;
}
.contact-form input[type="text"], .contact-form textarea{
width:100%;
}
} |
<!DOCTYPE html PUBLIC "-
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="pages_3.js"></script>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div id="SRResults"></div>
<script type="text/javascript"><!
createResults();
--></script>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
<script type="text/javascript"><!
document.getElementById("Loading").style.display="none";
document.getElementById("NoMatches").style.display="none";
var searchResults = new SearchResults("searchResults");
searchResults.Search();
--></script>
</div>
</body>
</html> |
#include "pstree.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h>
static pstree_node_t *pstree_do_node(int pid, pstree_node_t *root);
pstree_node_t *pstree_create(void)
{
DIR *dirp = opendir("/proc");
if (!dirp) {
static int did_perror = 0;
if (!did_perror++)
perror("Opening /proc");
return NULL;
}
// manually allocate the root, since pstree_do_node won't like a NULL root
pstree_node_t *root = calloc(1, sizeof(*root));
root->pid = 0;
root->exec = calloc(1,1);
struct dirent *entry;
while ((entry = readdir(dirp)) != NULL) {
char *endp = NULL;
errno = 0;
int pid = strtol(entry->d_name, &endp, 10);
if (errno != 0 || !endp || endp[0] != '\0')
continue;
pstree_do_node(pid, root);
}
closedir(dirp);
return root;
}
static pstree_node_t *pstree_do_node(int pid, pstree_node_t *root)
{
pstree_node_t *rv = NULL;
int fd = -1;
int readlen = 0;
int rv_allocated = 0;
char *readbuf = NULL;
char *openparen = NULL, *closeparen = NULL;
char *c;
char fnbuf[32];
char *sp = fnbuf;
if (root == NULL || pid < 0)
return NULL;
// If the node already exists, return it. It would have been created in
// response to seeing a child pid before the parent.
// If the exec is not filled in yet, fill in the node as normal, but don't
// deallocate the node if reading /proc fails, otherwise the tree might
// have an invalid node in the middle somewhere.
if ((rv = pstree_find(root, pid)) != NULL && rv->exec)
return rv;
sp += sprintf(fnbuf, "/proc/%d/", pid);
strcpy(sp, "stat");
if ((fd = open(fnbuf, O_RDONLY)) < 0)
goto fail;
// The first 4 fields of the stat file are:
// 1. pid
// 2. executable name, in parens
// 3. status code (single char)
// 4. parent pid -- this is what we want
// All fields that follow are numeric.
// Unfortunately, the executable name may contain spaces or parens,
// so it is necessary to find the last instance of ')' in the file to
// properly find the 4th field.
readbuf = malloc(1024);
readlen = 0;
while (1) {
int n = read(fd, readbuf + readlen, 1024);
if (n < 0)
goto fail;
if (n == 0)
break;
readlen += n;
readbuf = realloc(readbuf, 1024 + readlen);
}
close(fd);
fd = -1;
openparen = strchr(readbuf, '(');
closeparen = strrchr(readbuf, ')');
if (!openparen || !closeparen || openparen > closeparen)
goto fail;
if (closeparen[1] != ' ')
goto fail;
if (!rv) {
rv_allocated = 1;
rv = calloc(1, sizeof(*rv));
rv->pid = pid;
}
rv->exec = malloc(closeparen - openparen);
strncpy(rv->exec, openparen+1, closeparen - openparen - 1);
rv->exec[closeparen - openparen - 1] = '\0';
{
errno = 0;
pstree_node_t *parentnode = NULL;
// ") X <pid> ..." + 4 = "<pid> ..."
int parentpid = strtol(closeparen+4, &c, 10);
if (parentpid < 0 || errno != 0 || *c != ' ')
goto fail;
if (parentpid == 0 && pid != 1)
goto fail;
parentnode = pstree_do_node(parentpid, root);
if (parentnode == NULL)
goto fail;
rv->parent = parentnode;
if (parentnode->child)
rv->sibling = parentnode->child;
parentnode->child = rv;
}
free(readbuf);
return rv;
fail:
if (rv_allocated) {
if (rv->exec)
free(rv->exec);
free(rv);
}
if (readbuf)
free(readbuf);
if (fd > -1)
close(fd);
return NULL;
}
void pstree_free(pstree_node_t *root)
{
if (root == NULL)
return;
for (pstree_node_t *n = root->child, *next = NULL; n; n = next) {
next = n->sibling;
pstree_free(n);
}
free(root->exec);
free(root);
}
pstree_node_t *pstree_find(pstree_node_t *root, int pid)
{
if (root->pid == pid)
return root;
for (pstree_node_t *n = root->child; n; n = n->sibling) {
pstree_node_t *rv = pstree_find(n, pid);
if (rv)
return rv;
}
return NULL;
}
pstree_node_t *pstree_next_leaf(pstree_node_t *cur)
{
if (cur == NULL)
return NULL;
if (cur->parent == NULL) {
// Edge case: root is a leaf
if (cur->child == NULL)
return NULL;
// Traverse down "left edge" to find first leaf
while (cur->child)
cur = cur->child;
return cur;
}
// Handle upwards part of walk to find next lateral move
while (!cur->sibling) {
cur = cur->parent;
if (!cur)
return NULL;
}
// Do lateral move
cur = cur->sibling;
// Traverse down "left edge" to find leaf
while (cur->child)
cur = cur->child;
return cur;
} |
#include <MantaTypes.h>
#include <Model/Cameras/EnvironmentCamera.h>
#include <Core/Util/Args.h>
#include <Core/Exceptions/IllegalArgument.h>
#include <Interface/Context.h>
#include <Interface/MantaInterface.h>
#include <Interface/RayPacket.h>
#include <Interface/Scene.h>
#include <Core/Geometry/BBox.h>
#include <Core/Geometry/AffineTransform.h>
#include <Core/Math/MiscMath.h>
#include <Core/Math/Trig.h>
#include <Core/Util/Assert.h>
#include <Core/Util/NotFinished.h>
#include <iostream>
using namespace Manta;
using namespace std;
EnvironmentCamera::EnvironmentCamera(const Vector& eye_,
const Vector& lookat_,
const Vector& up_ )
: eye( eye_ ), lookat( lookat_ ), up( up_ )
{
haveCamera = true;
setup();
}
EnvironmentCamera::EnvironmentCamera(const vector<string>& args)
{
haveCamera = false;
bool gotEye=false;
bool gotLookat=false;
bool gotUp=false;
normalizeRays=false;
for (size_t i=0; i<args.size(); i++) {
string arg=args[i];
if (arg=="-eye") {
if (!getVectorArg(i, args, eye))
throw IllegalArgument("EnvironmentCamera -eye", i, args);
gotEye=true;
haveCamera = true;
} else if (arg=="-lookat") {
if (!getVectorArg(i, args, lookat))
throw IllegalArgument("EnvironmentCamera -lookat", i, args);
gotLookat=true;
haveCamera = true;
} else if (arg=="-up") {
if (!getVectorArg(i, args, up))
throw IllegalArgument("EnvironmentCamera -up", i, args);
gotUp=true;
haveCamera = true;
} else if (arg=="-normalizeRays") {
normalizeRays=true;
} else {
throw IllegalArgument("EnvironmentCamera", i, args);
}
}
if (!gotEye || !gotLookat || !gotUp)
throw IllegalArgument("EnvironmentCamera needs -eye -lookat and -up", 0, args);
setup();
}
EnvironmentCamera::~EnvironmentCamera()
{
}
Camera* EnvironmentCamera::create(const vector<string>& args)
{
return new EnvironmentCamera(args);
}
void EnvironmentCamera::preprocess(const PreprocessContext& context)
{
Scene* scene = context.manta_interface->getScene();
if(!haveCamera){
const BasicCameraData* bookmark = scene->currentBookmark();
if(bookmark){
if (context.proc == 0) {
setBasicCameraData(*bookmark);
}
} else {
BBox bbox;
scene->getObject()->computeBounds(context, bbox);
if (context.proc == 0) {
autoview(bbox);
}
}
context.done();
haveCamera = true;
}
}
void EnvironmentCamera::getBasicCameraData(BasicCameraData& cam) const
{
// fov doesn't make sense for this camera - use a reasonable default
cam = BasicCameraData(eye, lookat, up, 60, 60);
}
void EnvironmentCamera::setBasicCameraData(BasicCameraData cam)
{
eye = cam.eye;
lookat = cam.lookat;
up = cam.up;
setup();
}
void EnvironmentCamera::reset( const Vector &eye_, const Vector &up_,
const Vector &lookat_ )
{
eye = eye_;
up = up_;
lookat = lookat_;
setup();
}
void EnvironmentCamera::setup()
{
direction=lookat - eye;
n=direction;
n.normalize();
v=Cross(direction, up);
if (v.length2()==0.0) {
std::cerr << __FILE__ << " line: " << __LINE__ << " Ambiguous up direciton...\n";
}
v.normalize();
u=Cross(v, direction);
u.normalize();
v=-v;
}
void EnvironmentCamera::makeRays(const RenderContext& context, RayPacket& rays) const
{
ASSERT(rays.getAllFlags() & RayPacket::<API key>);
rays.setFlag(RayPacket::ConstantOrigin);
if (normalizeRays) {
for (int i=rays.begin(); i<rays.end(); i++) {
Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * rays.getImageCoordinates(i, 1));
Real phi = (Real)M_PI * rays.getImageCoordinates(i, 0) + (Real)M_PI;
Vector xyz(Sin(theta)*Cos(phi), Sin(theta)*Sin(phi),
Cos(theta));
Vector raydir(Dot(xyz, v),
Dot(xyz, n),
Dot(xyz, u));
raydir.normalize();
rays.setRay(i, eye, raydir);
}
rays.setFlag(RayPacket::<API key>);
} else {
for (int i=rays.begin(); i<rays.end(); i++) {
Real theta = (Real)0.5 * ((Real)M_PI - (Real)M_PI * rays.getImageCoordinates(i, 1));
Real phi = (Real)M_PI * rays.getImageCoordinates(i, 0) + (Real)M_PI;
Vector xyz(Sin(theta)*Cos(phi), Sin(theta)*Sin(phi),
Cos(theta));
Vector raydir(Dot(xyz, v),
Dot(xyz, n),
Dot(xyz, u));
rays.setRay(i, eye, raydir);
}
}
}
void EnvironmentCamera::scaleFOV(Real /*scale*/)
{
// This functionality doesn't make much sense with the environment camera
}
void EnvironmentCamera::translate(Vector t)
{
Vector trans(u*t.y() + v*t.x());
eye += trans;
lookat += trans;
setup();
}
void EnvironmentCamera::dolly(Real scale)
{
Vector dir=lookat - eye;
eye += dir*scale;
setup();
}
void EnvironmentCamera::transform(AffineTransform t, TransformCenter center)
{
Vector cen;
switch(center) {
case Eye:
cen=eye;
break;
case LookAt:
cen=lookat;
break;
case Origin:
cen=Vector(0, 0, 0);
break;
}
Vector lookdir(eye - lookat);
AffineTransform frame;
frame.initWithBasis(v.normal(), u.normal(), lookdir.normal(), cen);
AffineTransform frame_inv=frame;
frame_inv.invert();
AffineTransform t2=frame*t*frame_inv;
up = t2.multiply_vector(up);
eye = t2.multiply_point(eye);
lookat = t2.multiply_point(lookat);
setup();
}
void EnvironmentCamera::autoview(const BBox /*bbox*/)
{
// This functionality doesn't make much sense with the environment camera
}
void EnvironmentCamera::output( std::ostream &os ) {
os << "environment( -eye " << eye
<< " -lookat " << lookat
<< " -up " << up
<< " )"
<< std::endl;
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><API key>: Not compatible </title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.15.0 / <API key> - 1.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
<API key>
<small>
1.1
<span class="label label-info">Not compatible </span>
</small>
</h1>
<p> <em><script>document.write(moment("2022-03-09 10:04:44 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-09 10:04:44 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 4 Virtual package relying on a GMP lib system installation
coq 8.15.0 Formal proof management system
dune 3.0.3 Fast, portable, and opinionated build system
ocaml 4.09.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.09.1 Official release 4.09.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "pierre-yves@strub.nu"
homepage: "https://github.com/math-comp/multinomials-ssr"
bug-reports: "https://github.com/math-comp/multinomials-ssr/issues"
dev-repo: "git+https://github.com/math-comp/multinomials.git"
license: "CeCILL-B"
authors: ["Pierre-Yves Strub"]
build: [
[make "INSTMODE=global" "config"]
[make "-j%{jobs}%"]
]
install: [
[make "install"]
]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/SsrMultinomials"]
depends: [
"ocaml"
"coq" {>= "8.5"}
"<API key>" {>= "1.6" & < "1.8.0~"}
"<API key>" {>= "1.6" & < "1.8.0~"}
"<API key>" {>= "1.0.0" & < "1.1.0~"}
"coq-mathcomp-finmap" {>= "1.0.0" & < "1.1.0~"}
]
tags: [
"keyword:multinomials"
"keyword:monoid algebra"
"category:Math/Algebra/Multinomials"
"category:Math/Algebra/Monoid algebra"
"date:2016"
"logpath:SsrMultinomials"
]
synopsis: "A multivariate polynomial library for the Mathematical Components Library"
flags: light-uninstall
url {
src: "https://github.com/math-comp/multinomials/archive/1.1.tar.gz"
checksum: "md5=<API key>"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install </h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action <API key>.1.1 coq.8.15.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.15.0).
The following dependencies couldn't be met:
- <API key> -> coq-mathcomp-finmap < 1.1.0~ -> <API key> < 1.8~ -> coq < 8.10~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base <API key>.1.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install </h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https:
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html> |
using System.Web.Mvc;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
namespace Tasks.Infrastructure
{
public class ControllerInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(FindControllers().LifestyleTransient());
}
private static BasedOnDescriptor FindControllers()
{
return Classes.FromThisAssembly()
.BasedOn<IController>()
.Configure(c => c.Named(c.Implementation.Name));
}
}
} |
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using HttpMultipartParser;
using Nancy.ModelBinding;
using Nancy.Swagger.Annotations.Attributes;
using Nancy.Swagger.Demo.Models;
using Nancy.Swagger.Services;
using Swagger.ObjectModel;
namespace Nancy.Swagger.Demo.Modules
{
public class <API key> : NancyModule
{
private const string ServiceTagName = "Service Details";
private const string <API key> = "Operations for handling the service";
private const string WidgetsTagName = "Available Widgets";
public <API key>(<API key> modelCatalog, ISwaggerTagCatalog tagCatalog) : base("/service")
{
modelCatalog.AddModel<ServiceOwner>();
modelCatalog.AddModel<Widget>();
tagCatalog.AddTag(new Tag()
{
Name = ServiceTagName,
Description = <API key>
});
Get("/", _ => GetHome(), null, "ServiceHome");
Get("/details", _ => GetServiceDetails(), null, "GetDetails");
Get("/widgets", _ => GetWidgets(), null, "GetWidgets");
Get("/customers", _ => GetServiceCustomers(), null, "GetCustomers");
//shows massaging multiple query params into single handler parameter.
Get("/customerspaged", _ => <API key>(GetRequestPaging()), null, "GetCustomersPaged");
Get("/customers/{name}", parameters => GetServiceCustomer(parameters.name), null, "GetCustomer");
Post("/customer/{serviceGuid:guid}", parameters => PostServiceCustomer(parameters.serviceGuid, this.Bind<ServiceCustomer>()), null, "PostNewCustomer");
Post("/customer/{name}/file", parameters => PostCustomerReview(parameters.name, null), null, "PostCustomerReview");
}
private object GetRequestPaging()
{
return new object(); //faking it, we would retun an object which reflects skip & take query params.
}
[Route("ServiceHome")]
[Route(HttpMethod.Get, "/")]
[Route(Summary = "Get Service Home")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK")]
[Route(Tags = new[] { ServiceTagName })]
private string GetHome()
{
return "Hello again, Swagger!";
}
[Route("GetDetails")]
[Route(HttpMethod.Get, "/details")]
[Route(Summary = "Get Service Details")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(ServiceDetails))]
[Route(Tags = new[] { ServiceTagName })]
private ServiceDetails GetServiceDetails()
{
return new ServiceDetails()
{
Name = "Nancy Swagger Service",
Owner = new ServiceOwner()
{
CompanyName = "Swagger Example Inc.",
CompanyContactEmail = "company@swaggerexample.inc"
},
Customers = new[]
{
new ServiceCustomer() {CustomerName = "Jack"},
new ServiceCustomer() {CustomerName = "Jill"}
}
};
}
[Route("GetWidgets")]
[Route(HttpMethod.Get, "/widgets")]
[Route(Summary = "Get List of Widgets available")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(List<Widget>))]
[Route(Tags = new[] { WidgetsTagName })]
private List<Widget> GetWidgets()
{
return new List<Widget>()
{
new Widget("FooWidget", 1.23),
new Widget("BarWidget", 4.56)
};
}
[Route("GetCustomers")]
[Route(HttpMethod.Get, "/customers")]
[Route(Summary = "Get Service Customers")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(IEnumerable<ServiceCustomer>))]
[Route(Tags = new[] { ServiceTagName })]
private ServiceCustomer[] GetServiceCustomers()
{
return new[]
{
new ServiceCustomer() {CustomerName = "Jack"},
new ServiceCustomer() {CustomerName = "Jill"}
};
}
//Shows multiple attribute usage on handler parameter
[Route("GetCustomersPaged")]
[Route(HttpMethod.Get, "/customerspaged")]
[Route(Summary = "Get Service Customers")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(IEnumerable<ServiceCustomer>))]
[Route(Tags = new[] { ServiceTagName })]
private ServiceCustomer[] <API key>([RouteParam(ParameterIn.Query, Name ="Skip", DefaultValue = "0")] [RouteParam(ParameterIn.Query, Name = "Take", DefaultValue = "10")] object paging)
{
return new[]
{
new ServiceCustomer() {CustomerName = "Jack"},
new ServiceCustomer() {CustomerName = "Jill"}
};
}
[Route("GetCustomer")]
[Route(HttpMethod.Get, "/customers/{name}")]
[Route(Summary = "Get Service Customer")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(ServiceCustomer))]
[Route(Tags = new[] { ServiceTagName })]
private ServiceCustomer GetServiceCustomer([RouteParam(ParameterIn.Path, DefaultValue = "Jack")] string name)
{
return new ServiceCustomer() { CustomerName = name, CustomerEmail = name + "@my-service.com" };
}
[Route("PostNewCustomer")]
[Route(Summary = "Post Service Customer")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(ServiceCustomer))]
[Route(Produces = new[] { "application/json" })]
[Route(Consumes = new[] { "application/json", "application/xml" })]
[Route(Tags = new[] { ServiceTagName })]
[RouteSecurity(SecuritySchemes.Basic)]
private ServiceCustomer PostServiceCustomer(
[RouteParam(ParameterIn.Path, Description = "The GUID that identifies the service")] string serviceGuid,
[RouteParam(ParameterIn.Body)] ServiceCustomer customer)
{
return customer;
}
[Route("PostCustomerReview")]
[Route(HttpMethod.Post, "/customer/{name}/file")]
[Route(Summary = "Post Customer Review")]
[SwaggerResponse(HttpStatusCode.OK, Message = "OK", Model = typeof(SwaggerFile))]
[Route(Tags = new[] { ServiceTagName })]
[Route(Consumes = new[] { "multipart/form-data" })]
[RouteSecurity(SecuritySchemes.Basic)]
private string PostCustomerReview(
[RouteParam(ParameterIn.Path, DefaultValue = "Jill")] string name,
[RouteParam(ParameterIn.Form)] SwaggerFile file) //'file' is unused, but needed for the swagger doc
{
var parsed = new <API key>(Request.Body);
var uploadedFile = parsed.Files.FirstOrDefault()?.Data;
if (uploadedFile == null)
{
return "File Parsing Failed";
}
var reader = new StreamReader(uploadedFile);
return reader.ReadToEnd();
}
}
} |
-- boundary3.test
-- db eval {
-- SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
-- WHERE t2.a=37
-- ORDER BY t1.rowid
SELECT t1.a FROM t1 JOIN t2 ON t1.rowid <= CAST(t2.r AS real)
WHERE t2.a=37
ORDER BY t1.rowid |
#pragma once
#include <QMainWindow>
class <API key>;
namespace Ui
{
class <API key>;
}
class <API key> : public QMainWindow
{
Q_OBJECT
public:
explicit <API key>(QSharedPointer<<API key>> <API key>,
QWidget *parent = 0);
~<API key>();
private:
Ui::<API key> *ui;
QSharedPointer<<API key>> <API key>;
}; |
using LNF.Repository;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Xml;
namespace LNF.Data
{
public class DataFeedUtility
{
public IProvider Provider { get; }
public DataFeedUtility(IProvider provider)
{
Provider = provider;
}
public static DataCommandBase ReadOnlyCommand(CommandType type = CommandType.StoredProcedure) => ReadOnlyDataCommand.Create(type);
public static DataTable GetDataTable(string alias, object parameters)
{
string query = CommonTools.Utility.GetQueryString(parameters);
string url = $"http://ssel-sched.eecs.umich.edu/data/feed/{alias}/xml/{query}";
DataSet ds = new DataSet();
ds.ReadXml(url);
DataTable dt = ds.Tables[0];
return dt;
}
public static string GetCSV(string alias, object parameters, string host = "ssel-sched.eecs.umich.edu")
{
string result = string.Empty;
string query = CommonTools.Utility.GetQueryString(parameters);
string url = $"http://{host}/data/feed/{alias}/csv/{query}";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
using (HttpWebResponse resp = (HttpWebResponse)req.GetResponse())
using (StreamReader reader = new StreamReader(resp.GetResponseStream()))
{
result = reader.ReadToEnd();
reader.Close();
resp.Close();
}
return result;
}
public static IEnumerable<T> GetData<T>(string alias, object parameters)
{
List<T> result = new List<T>();
DataTable dt = GetDataTable(alias, parameters);
foreach (DataRow dr in dt.Rows)
{
T item = Activator.CreateInstance<T>();
foreach (DataColumn dc in dt.Columns)
{
object val = dr[dc.ColumnName];
if (val == DBNull.Value) val = null;
PropertyInfo pi = item.GetType().GetProperty(dc.ColumnName);
val = Convert.ChangeType(val, pi.PropertyType);
if (pi != null)
pi.SetValue(item, val, null);
}
result.Add(item);
}
return result;
}
public DataSet ExecuteQuery(IDataFeed feed, ScriptParameters parameters)
{
DataSet ds = new DataSet();
DataTable dt;
string sql = feed.FeedQuery;
string name = feed.FeedName;
if (parameters != null)
name = parameters.Replace(name);
ds.DataSetName = name;
if (feed.FeedType == DataFeedType.SQL)
{
var command = ReadOnlyCommand(CommandType.Text);
if (parameters != null)
{
sql = parameters.Replace(sql);
command.Param(parameters);
}
command.FillDataSet(ds, sql);
if (ds.Tables.Count > 0)
ds.Tables[0].TableName = "default";
}
else
{
ScriptResult result = Provider.Data.Feed.ScriptEngine.Run(feed.FeedQuery, parameters);
if (result.Exception != null)
throw result.Exception;
foreach (var kvp in result.DataSet)
{
dt = kvp.Value.AsDataTable();
dt.TableName = kvp.Key;
ds.Tables.Add(dt);
}
}
return ds;
}
public static IList<DataTable> GetTables(DataSet ds, string key)
{
IList<DataTable> result = null;
if (string.IsNullOrEmpty(key))
result = ds.Tables.Cast<DataTable>().ToList();
else
result = ds.Tables.Cast<DataTable>().Where(x => x.TableName == key).ToList();
return result;
}
public static void DeleteFeed(IDataFeed feed, IPrivileged client)
{
if (feed != null)
{
if (DataFeedItem.CanDeleteFeed(client))
{
feed.FeedAlias += "$DELETED$" + DateTime.Now.ToString("yyyyMMddHHmmss");
feed.Deleted = true;
}
}
}
public string CsvFeedContent(DataFeedResult feed, string key)
{
if (string.IsNullOrEmpty(key)) key = "default";
var dt = feed.Data[key];
StringBuilder sb = new StringBuilder();
string comma = string.Empty;
foreach (string k in dt.Keys())
{
sb.AppendFormat("{0}\"{1}\"", comma, k.Replace("\"", "\"\""));
comma = ",";
}
sb.Append(Environment.NewLine);
foreach (var dr in dt)
{
comma = string.Empty;
foreach (string k in dr.Keys())
{
sb.AppendFormat("{0}\"{1}\"", comma, dr[k].Replace("\"", "\"\""));
comma = ",";
}
sb.Append(Environment.NewLine);
}
return sb.ToString();
}
public string XmlFeedContent(DataFeedResult feed)
{
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml("<?xml version=\"1.0\"?><data></data>");
XmlNode data = xdoc.SelectSingleNode("/data");
XmlAttribute attr;
attr = xdoc.CreateAttribute("name");
attr.Value = feed.Name;
data.Attributes.Append(attr);
if (feed.Data.Count > 0)
{
foreach (var kvp in feed.Data)
{
XmlNode table = xdoc.CreateElement("table");
attr = xdoc.CreateAttribute("name");
attr.Value = kvp.Key;
table.Attributes.Append(attr);
foreach (var item in kvp.Value)
{
XmlNode row = xdoc.CreateElement("row");
foreach (var k in item.Keys())
{
XmlNode child = xdoc.CreateElement(k.Replace("/", "_"));
child.InnerText = item[k].ToString();
row.AppendChild(child);
}
table.AppendChild(row);
}
data.AppendChild(table);
}
}
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xdoc.WriteTo(xw);
return sw.GetStringBuilder().ToString();
}
public string RssFeedContent(DataFeedResult feed, string key, Uri requestUri, string absolutePath)
{
if (string.IsNullOrEmpty(key)) key = "default";
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\"?><rss version=\"2.0\"><channel></channel></rss>");
XmlNode channel = xdoc.SelectSingleNode("/rss/channel");
XmlNode child;
child = xdoc.CreateElement("title");
child.InnerText = feed.Name;
channel.AppendChild(child);
child = xdoc.CreateElement("description");
if (string.IsNullOrEmpty(feed.Description))
child.InnerText = $"{GlobalSettings.Current.CompanyName} On-Line Services Data Feed";
else
child.InnerText = feed.Description;
channel.AppendChild(child);
child = xdoc.CreateElement("link");
child.InnerText = requestUri.GetLeftPart(UriPartial.Authority);
channel.AppendChild(child);
child = xdoc.CreateElement("lastBuildDate");
child.InnerText = DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH':'mm':'ss '+0000'");
channel.AppendChild(child);
child = xdoc.CreateElement("pubDate");
child.InnerText = DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH':'mm':'ss '+0000'");
channel.AppendChild(child);
var dt = feed.Data[key];
int i = 0;
foreach (var dr in dt)
{
XmlNode item = xdoc.CreateElement("item");
child = xdoc.CreateElement("title");
if (dr.Keys().Contains("Title"))
child.InnerText = dr["Title"].ToString();
else
child.InnerText = "Missing \"Title\" field.";
item.AppendChild(child);
child = xdoc.CreateElement("description");
if (dr.Keys().Contains("Description"))
child.InnerText = dr["Description"].ToString();
else
child.InnerText = "Missing \"Description\" field.";
item.AppendChild(child);
child = xdoc.CreateElement("link");
if (dr.Keys().Contains("Link"))
child.InnerText = dr["Link"].ToString();
else
child.InnerText = "Missing \"Link\" field.";
item.AppendChild(child);
child = xdoc.CreateElement("guid");
child.InnerText = DataFeedUtility.FeedItemURL(feed, "rss", requestUri, absolutePath) + "&i=" + i.ToString();
item.AppendChild(child);
child = xdoc.CreateElement("pubDate");
if (dr.Keys().Contains("PubDate"))
child.InnerText = Convert.ToDateTime(dr["PubDate"]).ToString("ddd, dd MMM yyyy HH':'mm':'ss '+0000'");
else
child.InnerText = DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH':'mm':'ss '+0000'");
item.AppendChild(child);
channel.AppendChild(item);
i++;
}
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xdoc.WriteTo(xw);
return sw.GetStringBuilder().ToString();
}
public string HtmlFeedContent(DataFeedResult feed, string format = null)
{
bool fullPage = format != "table";
//DataSet ds = ExecuteQuery(feed, parameters);
//IList<DataTable> tables = GetTables(ds, key);
StringBuilder sb = new StringBuilder();
if (fullPage)
{
sb.AppendLine("<!DOCTYPE html>");
sb.AppendLine("<html>");
sb.AppendLine("<head>");
sb.AppendLine($"<title>{GlobalSettings.Current.CompanyName} Feed</title>");
sb.AppendLine("<style>");
sb.AppendLine(".lnf-feed-container {margin: 10px;}");
sb.AppendLine(".grid.lnf-feed {margin-bottom: 10px;}");
sb.AppendLine("</style>");
sb.AppendLine("</head>");
sb.AppendLine("<body>");
}
sb.AppendLine("<div class=\"lnf-feed-container app\">");
foreach (var dt in feed.Data)
{
sb.AppendLine("<table class=\"lnf-feed grid table\">");
sb.AppendLine("<thead>");
sb.AppendLine("<tr>");
foreach (string k in dt.Value.Keys())
{
sb.AppendLine($"<th>{k}</th>");
}
sb.AppendLine("</tr>");
sb.AppendLine("</thead>");
sb.AppendLine("<tbody>");
foreach (var dr in dt.Value)
{
sb.AppendLine("<tr>");
foreach (string k in dr.Keys())
{
sb.AppendLine($"<td>{dr[k]}</td>");
}
sb.AppendLine("</tr>");
}
sb.AppendLine("</tbody>");
sb.AppendLine("</table>");
}
sb.AppendLine("</div>");
if (fullPage)
{
sb.AppendLine("</body>");
sb.AppendLine("</html>");
}
return sb.ToString();
}
public string JsonFeedContent(DataFeedResult feed, string key, string format = null)
{
object obj;
Hashtable data = new Hashtable();
foreach (var dt in feed.Data)
{
ArrayList table = new ArrayList();
foreach (var dr in dt.Value)
{
Hashtable hash = new Hashtable();
foreach (string k in dr.Keys())
{
hash.Add(k, dr[k]);
}
table.Add(hash);
}
data.Add(dt.Key, table);
}
if (format == "datatables")
{
if (string.IsNullOrEmpty(key))
obj = new { aaData = data["default"] };
else
obj = new { aaData = data[key] };
}
else
{
obj = new
{
feed.ID,
feed.GUID,
feed.Name,
feed.Private,
feed.Active,
Data = data
};
}
string result = ServiceProvider.Current.Utility.Serialization.Json.Serialize(obj);
return result;
}
public string IcalFeedContent(DataFeedResult feed, string key, string localAddr)
{
if (string.IsNullOrEmpty(key)) key = "default";
var dt = feed.Data[key];
StringBuilder sb = new StringBuilder();
string serverIP = localAddr;
DateTime buildTime = DateTime.UtcNow;
sb.AppendLine("BEGIN:VCALENDAR");
sb.AppendLine("METHOD:PUBLISH");
sb.AppendLine($"PRODID:-//{serverIP}//NONSGML {GlobalSettings.Current.CompanyName}-ICAL 1.0//");
sb.AppendLine("VERSION:2.0");
sb.AppendLine("X-WR-CALNAME:" + feed.Name);
sb.AppendLine($"X-WR-CALDESC:{GlobalSettings.Current.CompanyName} Online Services Data Feed");
sb.AppendLine("X-WR-TIMEZONE:US-Eastern");
int i = 0;
foreach (var dr in dt)
{
sb.AppendLine("BEGIN:VEVENT");
sb.AppendLine("UID:" + feed.Alias + "@" + serverIP);
sb.AppendLine("DTSTAMP:" + buildTime.ToString("yyyyMMdd'T'HHmmss'Z'"));
if (dt.Keys().Contains("DESCRIPTION"))
sb.AppendLine("DESCRIPTION:" + dr["DESCRIPTION"].ToString());
if (dt.Keys().Contains("DTSTART"))
sb.AppendLine("DTSTART:" + Convert.ToDateTime(dr["DTSTART"]).ToUniversalTime().ToString("yyyyMMdd'T'HHmmss'Z'"));
if (dt.Keys().Contains("DTSTART"))
sb.AppendLine("DTEND:" + Convert.ToDateTime(dr["DTSTART"]).ToUniversalTime().ToString("yyyyMMdd'T'HHmmss'Z'"));
if (dt.Keys().Contains("SUMMARY"))
sb.AppendLine("SUMMARY:" + dr["SUMMARY"].ToString());
sb.AppendLine("END:VEVENT");
i++;
}
sb.Append("END:VCALENDAR");
return sb.ToString();
}
public static string FeedItemURL(DataFeedResult feed, string format, Uri requestUri, string absolutePath)
{
string result = requestUri.GetLeftPart(UriPartial.Authority) + absolutePath + "/feed/";
result += feed.Alias + "/";
result += (string.IsNullOrEmpty(format) ? "xml" : format);
return result;
}
}
} |
# IR Station
Infrared Remote Controller with ESP8266 WiFi-module
You can control your home appliances with your smartphone or laptop.
## How to Use IR-Station
Setup the Device
1. Supply power to the device.
1. Connect your cellphone or laptop to Wi-Fi SSID "IR-Station". Its password is "IR-Station".
1. Access http://192.168.4.1 in a browser
1. Enter Wi-Fi SSID of your home and its password.
1. Enter a device name you like. We call it the hostname. Because it will be a part of URL, you cannot use space character.
1. If connection succeeded, IR-Station's local IP address is displayed. Please make a note of it.
1. Connect your cellphone or laptop to your home's Wi-Fi.
1. Access http:/xxx.xxx.xx.xx (IR-Station's local IP address) in a browser. (for example http://192.168.11.3 )
1. If something appears, setup is complete.

Store Signals
1. Access http:/192.168.xx.xx (one example) in a browser.
1. Look at the form of the bottom of the screen.
1. Select "record a new Signal" action.
1. Select a channel you want to assign a new signal.
1. Enter a name of the signal.
1. When you click the "Submit" button, the green LED of your IR-Station will light up.
1. Press a button on your remote controller toward your IR-Station to store a new signal.
Remote Control
1. Access your IR-Station in a browser.
1. Click a button which assigned a signal you want to send.

Available Functions
* Record a new Signal
* Rename a Signal
* Move a Signal
* Upload a Signal
* Download a Signal
* Clear a Signal
* Clear all Signals
* Schedule a Signal
* Change IP (Fix IP Address)
* Change WiFi (Disconnect WiFi)

Meanings of LED Indicator
| Color | Status |
| :
| Red | Error |
| Green | Processing |
| Blue | Listening |
 |
<?php
if (!function_exists('WPInsertStatement')) {
function WPInsertStatement($table, $array, $format)
{
global $wpdb;
$wpdb->insert($table, $array, $format);
return $wpdb->insert_id;
}
}
if (!function_exists('WPExecuteStatement')) {
function WPExecuteStatement($statement)
{
global $wpdb;
$wpdb->query($statement);
}
}
if (!function_exists('WPExecuteQuery')) {
function WPExecuteQuery($query)
{
global $wpdb;
$result = $wpdb->get_results($query);
return $result;
}
}
if (!function_exists('arr_to_obj')) {
function arr_to_obj($array = array()) {
$return = new stdClass();
foreach ($array as $key => $val) {
if (is_array($val)) {
$return->$key = $this-><API key>($val);
} else {
$return->{$key} = $val;
}
}
return $return;
}
}
//Theme Data Functions
function OutputThemeData($tabs, $values=null)
{
$isFirst = true;
echo '<div class="span12 tabbable">';
if (count($tabs) > 1)
{
echo '<ul class="nav nav-tabs">';
foreach ($tabs as $tab)
{
OutputTabNav($tab["id"], $tab["name"], $tab["icon"], $isFirst);
if ($isFirst)
{
$isFirst = false;
}
}
echo '</ul>'; //Done with nav
}
echo '<div class="row tab-content">';
$isFirst = true;
foreach ($tabs as $tab)
{
echo OutputTabContent($tab["id"], $tab["sections"], $isFirst, $values);
if ($isFirst)
{
$isFirst = false;
}
}
echo '</div>'; //Done with tab content
//return $output;
}
function OutputTabNav($id, $name, $icon, $isFirst)
{
$tabTemplate = '<li%s><a href="#%s" data-toggle="tab"><i class="icon-%s"></i> %s</a></li>';
$class = "";
if ($isFirst)
{
$class = ' class="active"';
}
echo sprintf($tabTemplate, $class, $id, $icon, $name);
}
function OutputTabContent($id, $sections, $isFirst, $values)
{
$tabContentTemplate = '<div class="tab-pane%s" id="%s">';
$class = "";
if ($isFirst)
{
$class = ' active';
}
echo sprintf($tabContentTemplate, $class, $id);
foreach ($sections as $section)
{
OutputSection($section["name"], $section["size"], $section["fields"], $values);
}
echo "</div>";
//return $output;
}
function OutputSection($name, $size, $fields, $values)
{
$sectionTemplate = '<div class="span%s"><legend>%s</legend>';
echo sprintf($sectionTemplate, $size, $name);
foreach ($fields as $field)
{
$options = isset($field["options"])?$field["options"]:array();
MMRootsField($field["id"], $field["label"], $field["type"], $options, $values);
}
echo "</div>";
}
function GetThemeDataFields($tabs)
{
$fields = array();
foreach ($tabs as $tab)
{
foreach ($tab["sections"] as $section)
{
$fields = array_merge($fields, $section["fields"]);
}
}
return $fields;
}
function MMRootsField($id, $label, $type, $options=null, $values=null)
{
global $MMM_Roots;
$formField = "";
if (isset($values))
{
$value = isset($values[$id])?stripslashes($values[$id]):"";
$formField = createFormField($id, $label, $value, $type, $options);
}
else
{
$formField = createFormField($id, $label, $MMM_Roots->get_setting($id), $type, $options);
}
//return $formField;
}
?> |
// <auto-generated>
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Synapse
{
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
using System.Threading;
using System.Threading.Tasks;
<summary>
Extension methods for <API key>.
</summary>
public static partial class <API key>
{
<summary>
Get server's extended blob auditing policy.
</summary>
<remarks>
Get a workspace SQL server's extended blob auditing policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
public static <API key> Get(this <API key> operations, string resourceGroupName, string workspaceName)
{
return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult();
}
<summary>
Get server's extended blob auditing policy.
</summary>
<remarks>
Get a workspace SQL server's extended blob auditing policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='cancellationToken'>
The cancellation token.
</param>
public static async Task<<API key>> GetAsync(this <API key> operations, string resourceGroupName, string workspaceName, Cancellation<API key> = default(CancellationToken))
{
using (var _result = await operations.<API key>(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
<summary>
Create or Update server's extended blob auditing policy.
</summary>
<remarks>
Create or Update a workspace managed sql server's extended blob auditing
policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='parameters'>
Properties of extended blob auditing policy.
</param>
public static <API key> CreateOrUpdate(this <API key> operations, string resourceGroupName, string workspaceName, <API key> parameters)
{
return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult();
}
<summary>
Create or Update server's extended blob auditing policy.
</summary>
<remarks>
Create or Update a workspace managed sql server's extended blob auditing
policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='parameters'>
Properties of extended blob auditing policy.
</param>
<param name='cancellationToken'>
The cancellation token.
</param>
public static async Task<<API key>> CreateOrUpdateAsync(this <API key> operations, string resourceGroupName, string workspaceName, <API key> parameters, Cancellation<API key> = default(CancellationToken))
{
using (var _result = await operations.<API key>(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
<summary>
List server's extended blob auditing policies.
</summary>
<remarks>
List workspace managed sql server's extended blob auditing policies.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
public static IPage<<API key>> ListByWorkspace(this <API key> operations, string resourceGroupName, string workspaceName)
{
return operations.<API key>(resourceGroupName, workspaceName).GetAwaiter().GetResult();
}
<summary>
List server's extended blob auditing policies.
</summary>
<remarks>
List workspace managed sql server's extended blob auditing policies.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='cancellationToken'>
The cancellation token.
</param>
public static async Task<IPage<<API key>>> <API key>(this <API key> operations, string resourceGroupName, string workspaceName, Cancellation<API key> = default(CancellationToken))
{
using (var _result = await operations.<API key>(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
<summary>
Create or Update server's extended blob auditing policy.
</summary>
<remarks>
Create or Update a workspace managed sql server's extended blob auditing
policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='parameters'>
Properties of extended blob auditing policy.
</param>
public static <API key> BeginCreateOrUpdate(this <API key> operations, string resourceGroupName, string workspaceName, <API key> parameters)
{
return operations.<API key>(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult();
}
<summary>
Create or Update server's extended blob auditing policy.
</summary>
<remarks>
Create or Update a workspace managed sql server's extended blob auditing
policy.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='resourceGroupName'>
The name of the resource group. The name is case insensitive.
</param>
<param name='workspaceName'>
The name of the workspace.
</param>
<param name='parameters'>
Properties of extended blob auditing policy.
</param>
<param name='cancellationToken'>
The cancellation token.
</param>
public static async Task<<API key>> <API key>(this <API key> operations, string resourceGroupName, string workspaceName, <API key> parameters, Cancellation<API key> = default(CancellationToken))
{
using (var _result = await operations.<API key>(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
<summary>
List server's extended blob auditing policies.
</summary>
<remarks>
List workspace managed sql server's extended blob auditing policies.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='nextPageLink'>
The NextLink from the previous successful call to List operation.
</param>
public static IPage<<API key>> ListByWorkspaceNext(this <API key> operations, string nextPageLink)
{
return operations.<API key>(nextPageLink).GetAwaiter().GetResult();
}
<summary>
List server's extended blob auditing policies.
</summary>
<remarks>
List workspace managed sql server's extended blob auditing policies.
</remarks>
<param name='operations'>
The operations group for this extension method.
</param>
<param name='nextPageLink'>
The NextLink from the previous successful call to List operation.
</param>
<param name='cancellationToken'>
The cancellation token.
</param>
public static async Task<IPage<<API key>>> <API key>(this <API key> operations, string nextPageLink, Cancellation<API key> = default(CancellationToken))
{
using (var _result = await operations.<API key>(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
return _result.Body;
}
}
}
} |
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include "../Precompiled.h"
#include <cassert>
#include <EASTL/internal/thread_support.h>
#include "../Container/RefCounted.h"
#include "../Core/Macros.h"
#if URHO3D_CSHARP
# include "../Script/Script.h"
#endif
namespace Urho3D
{
RefCount* RefCount::Allocate()
{
void* const memory = EASTLAlloc(*ea::<API key>((Allocator*)nullptr), sizeof(RefCount));
assert(memory != nullptr);
return ::new(memory) RefCount();
}
void RefCount::Free(RefCount* instance)
{
instance->~RefCount();
EASTLFree(*ea::<API key>((Allocator*)nullptr), instance, sizeof(RefCount));
}
RefCounted::RefCounted()
: refCount_(RefCount::Allocate())
{
// Hold a weak ref to self to avoid possible double delete of the refcount
refCount_->weakRefs_++;
}
RefCounted::~RefCounted()
{
assert(refCount_);
assert(refCount_->refs_ == 0);
assert(refCount_->weakRefs_ > 0);
#if URHO3D_CSHARP
// Dispose of managed object when native object was a part of other object (did not use refcounting). Native
// destructors have run their course already. This is fine, because Dispose(true) is called only for wrapped but not
// inherited classes and Dispose(true) of wrapper classes merely sets C++ pointer to null and does not interact with
// native object in any way.
if (scriptObject_)
{
// API may be null when application when finalizers run on application exit.
ScriptRuntimeApi* api = Script::GetRuntimeApi();
assert(api != nullptr);
SetScriptObject(nullptr, false);
assert(scriptObject_ == nullptr);
}
#endif
// Mark object as expired, release the self weak ref and delete the refcount if no other weak refs exist
refCount_->refs_ = -1;
if (ea::Internal::atomic_decrement(&refCount_->weakRefs_) == 0)
RefCount::Free(refCount_);
refCount_ = nullptr;
}
int RefCounted::AddRef()
{
int refs = ea::Internal::atomic_increment(&refCount_->refs_);
assert(refs > 0);
#if URHO3D_CSHARP
if (URHO3D_UNLIKELY(scriptObject_ && !isScriptStrongRef_))
{
// More than one native reference exists. Ensure strong GC handle to prevent garbage collection of managed
// wrapper object.
ScriptRuntimeApi* api = Script::GetRuntimeApi();
assert(api != nullptr);
isScriptStrongRef_ = true;
scriptObject_ = api->RecreateGCHandle(scriptObject_, true);
}
#endif
return refs;
}
int RefCounted::ReleaseRef()
{
int refs = ea::Internal::atomic_decrement(&refCount_->refs_);
assert(refs >= 0);
#if URHO3D_CSHARP
if (refs == 0)
{
// Dispose managed object while native object is still intact. This code path is taken for user classes that
// inherit from a native base, because such objects are always heap-allocated. Because of this, it is guaranteed
// that user's Dispose(true) method will be called before execution of native object destructors.
if (scriptObject_)
{
// API may be null when application when finalizers run on application exit.
ScriptRuntimeApi* api = Script::GetRuntimeApi();
assert(api != nullptr);
api->Dispose(this);
}
delete this;
}
#else
if (refs == 0)
delete this;
#endif
return refs;
}
int RefCounted::Refs() const
{
return refCount_->refs_;
}
int RefCounted::WeakRefs() const
{
// Subtract one to not return the internally held reference
return refCount_->weakRefs_ - 1;
}
#if URHO3D_CSHARP
void RefCounted::SetScriptObject(void* handle, bool isStrong)
{
if (scriptObject_ != nullptr)
{
auto api = Script::GetRuntimeApi();
assert(api != nullptr);
api->FreeGCHandle(scriptObject_);
}
scriptObject_ = handle;
isScriptStrongRef_ = isStrong;
}
void RefCounted::ResetScriptObject()
{
scriptObject_ = nullptr;
isScriptStrongRef_ = false;
}
#endif
} |
package com.apcompsci.fate2.screens;
import com.apcompsci.fate2.Main;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.utils.viewport.FillViewport;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.badlogic.gdx.utils.viewport.StretchViewport;
/**
* Main Menu For The Game With Music And Splash Screen
*/
public class MainMenu implements Screen {
private Stage stage;
private Music introMusic;
private Music demoMusic;
private Texture splashScreen;
private InputProcessor ip;
private final Main game;
public MainMenu(final Main game){
this.game = game;
introMusic = Gdx.audio.newMusic(Gdx.files.internal("assets/music/Intro_Theme.mp3"));
demoMusic= Gdx.audio.newMusic(Gdx.files.internal("assets/music/opening-demo.mp3"));
stage = new Stage(new ScreenViewport());
Gdx.input.setInputProcessor(stage);
splashScreen= new Texture("assets/splash_screen.jpg");
}
@Override
public void show() {
introMusic.play();
demoMusic.setLooping(true);
Gdx.input.setInputProcessor(ip);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0,0,0,1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
game.batch.begin();
game.batch.draw(splashScreen,0,0);
game.batch.end();
if(!introMusic.isPlaying()&&!demoMusic.isPlaying()){
demoMusic.play();
}
if(Gdx.input.isTouched()){
dispose();
game.setScreen(new GameScreen(game));
}
}
@Override
public void resize(int width, int height) {
stage.getViewport().update(width,height,true);
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
introMusic.dispose();
demoMusic.dispose();
stage.dispose();
splashScreen.dispose();
}
} |
#include "assert.h"
#include "chainparams.h"
#include "core.h"
#include "protocol.h"
#include "util.h"
// Main network
unsigned int pnSeed[] =
{
0x3db2528b, 0xa0cfa5bc, 0x609ec836, 0x90e9156b, 0xd9baa76b, 0x9ad19f55, 0x677c98c8, 0x5bc3f6da,
0x829a3eb2, 0x886f8a43, 0x7c1afc2e, 0x72218368, 0x97d59dc0, 0x66b2528b, 0xf216ba6a, 0x29b9b992,
0xf77ddf4e, 0x4530dc1f, 0x0e431c45, 0x55efaa6b, 0x95d9aa6b, 0xb075c7c6, 0x3b1eba6a, 0x99e04cad,
0xab745c57, 0xed174142, 0xdda23eb2, 0x468bfeb6, 0x5b24aa58, 0x80a03eb2, 0x823300ad, 0xc9ec2fd4,
0x540dc405, 0xaca34305, 0x522ad176, 0x5713a4d8, 0x0f58e9bc, 0x5ae0574f, 0x9d743ac6, 0x7c561dde,
0x8c5cc818, 0xcd5cd454, 0x75af3851, 0xce0e255c, 0xad0be9bc, 0x956d7e2e, 0x6a902002, 0x28d4482e,
0xfc22a068, 0x0c862442, 0x84a67870, 0x45dae64e, 0x37bd1dd9, 0x4122555f, 0x5ab6b95d, 0xaec8cc47,
0xa08ad54e, 0x165df950, 0xdf19ca5b, 0xb8324ada, 0xeb6d3ac6, 0xd85ce362, 0x89ffba32, 0x48c5e052,
0xb2ecd048, 0xe580e068, 0x48261a3d, 0x3f5e9c5a, 0xe68ba1cb, 0xe40ec273, 0x87dd6f4f, 0x270a5975,
0xf3035272, 0xef802442, 0x8068777d, 0xa3a8dacb, 0x71e9ae6e, 0x30cdc973, 0x778ad54e, 0x8e50e08c,
0x44bb48de, 0x8bc6bb25, 0x48515d72, 0x344dfd54, 0xc22ad0a2, 0x41671bb2, 0xf2cd3c92, 0x50161a3d,
0xc49e206e, 0x5dc27161, 0xc5aba33e, 0x56e96db6, 0x543eddd8, 0x65c3eb7a, 0x74456077, 0xca56c082,
0x0a818b77, 0x8885cc25, 0x6753fd72, 0xfb61fc6d, 0xb4af7a7d, 0x06fbd05e, 0x55b39a0e, 0x3ac9482e,
0x7894f472, 0x36e60401, 0x6b5e787d, 0x743ddd72, 0xf022c2bc, 0x2f37be6d, 0xd1bfb87c, 0x4289206e,
0x8c4da976, 0xdcc41dc9, 0x8deb0401, 0x72e50401, 0x5d27bbbc, 0x4e46c281, 0x8a9f2442, 0x59e39f2a,
0xfba0221f, 0x3e154171, 0xcadf5e02, 0x6d25105a, 0x8570bd12, 0x7c0ae6bc, 0x132dbe6d, 0x1212b37c,
0x194b5d72, 0xe7aa0e79, 0xcb24f874, 0x03fe0401, 0xa3cf3c92, 0xc1e80401, 0xbcc0206e, 0x7eba16c9,
0xeec4ba56, 0x721cbd54, 0x33af7631, 0x1ca8e95e, 0x61c31f5d, 0x4eb2528b, 0xab2dbd54, 0x30154605,
0xc02fa43a, 0x37b5a056, 0xe5317059, 0x608b20bc, 0xb5a6505d, 0x8c6b2549, 0x3cf32b43, 0xd2465d72,
0x9a387059, 0xe3be1dc9, 0xa036546a, 0x9afbe44f, 0xdcd25872, 0x86ca206e, 0xd931439a, 0x69f60401,
0x9c595d72, 0x7e764658, 0x45c8e179, 0xc910a201, 0xd4bdea4e, 0x9b69695c, 0xa79ab07c, 0x5993d46d,
0xfa3a7059, 0xc5d6d5ba, 0x4c51e08c, 0xaf2c61b1, 0x5e7eecb3, 0xb9419cba, 0xe7fa9d6d, 0x6846c36e,
0x34d3846d, 0x49a2301f, 0x55bd5252, 0x75a2767d, 0xb8a208af, 0x59c6206e, 0x34314e5c, 0xbfe60c1b,
0xf688b455, 0xad528fb4, 0xf795df5e, 0x53a3135d, 0xe72abd54, 0xd7485393, 0x5f22ec59, 0xe89dfc71,
0x35f0e44f, 0x0a90b455, 0x989ab54f, 0x27ababb4, 0xab682cbc, 0x236b828a, 0x706b5d02, 0x6237787b,
0x890bf572, 0x4c4ba4dc, 0xdf500c87, 0x3929b2cd, 0x296a6d2e, 0x9d9f80db, 0x10fad5ba, 0xfee0533e,
0x851504c9, 0x9dc17470, 0xf9d2126e, 0x4a6f3fb7, 0x676d4471, 0x2b184e5c, 0x9d893251, 0xe6a9254e,
0x6d297059, 0x63d667d5, 0xef09517a, 0xa500bd54, 0x0b43c36e, 0x5fa88156, 0x2f45c36e, 0x93de5658,
0x2b2a173a, 0x6d6d4471, 0x898aa53d, 0xe03efb76, 0x83c15a4b, 0xbbcb482e, 0x92d2d5ba, 0x27810477,
0x14f50401, 0xbea40244, 0x8c7ff12e, 0x7626bb58, 0xccf86c4e, 0xbc86b455, 0xf3e7ba58, 0x29845d02,
0x02e10bc6, 0xe569e352, 0x3b8d6944, 0xc5740a1b, 0x7c40de4e, 0x1ef9d5ba, 0xacb7f5dc, 0xef2d0f1b,
0x48e58b50, 0x3ae00401, 0xf7ab3244, 0xe38cb455, 0x631ff671, 0x569a515d, 0x4ef51f5f, 0x3038c26e,
0xbda2a165, 0xc51c4150, 0x5470a243, 0xd14af976, 0x9520f4bc, 0x4a5434c9, 0x3144c170, 0xa628904e,
0x9676e36d, 0xaf3b7059, 0x1b28b458, 0x3052690e, 0xa6afc6dd, 0x67c85dab, 0x5e1408b2, 0xfc15b2d4,
0x1054972e, 0xe5ea0401, 0x0596206e, 0xa1031bbd, 0x9c2bcc62, 0x5d50e08c, 0x97d7cd9f, 0xd09df3a2,
0xaef5055a, 0x9050e08c, 0xe07d4605, 0xceabf1ba, 0xdd63256a, 0x15bf454b, 0x84285272, 0x31892002,
0x91bab3de, 0xd67cf972, 0x0ce81dc9, 0xbf6f41ad, 0xc6d90db7, 0x24a2f2b6, 0x52f1a07c, 0xe7e0ed82,
0x4baf728d, 0xc9cdd5ba, 0x183b6272, 0x901ef2b6, 0x8bf6cd2e, 0x36f5c36e, 0x1d5f6f4f, 0x4f9f5231,
0xacd9d5ba, 0x62533e46, 0x74378725, 0x8180ac77, 0x4840733b, 0xa7a130ba, 0x00d3f572, 0x6ef79c3e,
0x57071979, 0x094a225b, 0xf492787d, 0x26aa10b7, 0x0b69cdb1, 0x4968cdb1, 0xd182cf1f, 0x4197b455,
0x177daade, 0xee4d9f1b, 0x1ac122b2, 0xd82b2c5c, 0x79505d72, 0xa38ab455, 0xbe2b9e7b, 0x399afc71,
0xe39dd6ba, 0xbf9af1ba, 0xfc455d72, 0xc538d879, 0x6e8ea065, 0x02e2ff3a, 0x7d154171, 0xfb529389,
0xbc4ac36e, 0x47811855, 0xcd0ab86e, 0x50dc164d, 0xac70cb7b, 0xb8dad73c, 0x87f0c36e, 0xc3ded5ba,
0x9f55372e, 0x181819ad, 0xb7d5482e, 0x580a737b, 0xfd9bcd3e, 0x70a648de, 0x4e431979, 0x3a465d72,
0xeb50e08c, 0x264d4e7c, 0xd28db455, 0x21500c87, 0x10bcae3b, 0xd2bcae65, 0xe2e9a377, 0xec54fe18,
0xcf26d05a, 0x7399d6ba, 0xbb9b2eb7, 0x88480852, 0x33e89389, 0x16c01b3c, 0x1b789aa5, 0x4f903a4d,
0x96ea9f7b, 0x75dbfc3c, 0xbfb0a658, 0x6d8366b4, 0x74fee874, 0x4af6cd2e, 0x3f76690e, 0x43c0002e,
0x5a516270, 0xbf82cb1b, 0x8ad255df, 0x5333d91b, 0x57b8b858, 0x7474507a, 0x4c04a63a, 0xe6add6ba,
0x120e1874, 0x4141c86e, 0xe3a4f872, 0xf399e179, 0xcf2b41de, 0xbb5d25b7, 0xb2c57cb2, 0xe48bc22e,
0x54f34250, 0x7efb1974, 0x8850e08c, 0x6082eadd, 0x2f1a1bbd, 0xf0ed6b54, 0x9240507a, 0x47b7a63d,
0x199fc257, 0x38266b51, 0x60f0b47c, 0xe948217d, 0x4d500c87, 0xd2d8b47c, 0xf0f6bb3d, 0xb28f8368,
0x431aa0b4, 0x5d5be974, 0xd2e90a1b, 0xb6756377, 0x9007f470, 0xe2f3ae55, 0xbfa4227d, 0x555ab259,
0x98d5384a, 0x9bb04371, 0x03e2ff3a, 0x8d940db7, 0x06ce51bd, 0x71797080, 0xec4cec5c, 0x33e8d979,
0x80883924, 0x72811056, 0x1e85b455, 0x0b86be6b, 0x92f2cd2e, 0xb9b8f371, 0xe8ced6ab, 0x7da4c88b,
0x9562fbb0, 0x9803be6d, 0x2db51cc2, 0x662b2177, 0x9d9dfc71, 0xc0a31118, 0x1544c170, 0x48b8096b,
0x54350e70, 0x7e282177, 0x9e139473, 0x429b0344, 0x8c8232ba, 0x376d4071, 0x0f0d1979, 0x329dfc71,
0x7e586171, 0x8e6c7276, 0xe84d5f70, 0x5c38e670, 0xfd8d2d70, 0x706b60b8, 0x839a1853, 0x775a5975,
0x3e8fb455, 0x4a585378, 0x5151375f, 0x65c5c39e, 0xef8eb67b, 0x30e36871, 0x7d80811f, 0x4cda0eb0,
0x387e692e, 0x6a53787b, 0xf4b0a56f, 0x5312a932, 0xa720f5dc, 0xfcad9389, 0xbd500c87, 0x6a48b756,
0x53644465, 0x982c1bbd, 0xdff947b2, 0x860322b7, 0xbc84b455, 0x5295d2b2, 0x46fea6dc, 0xff1c1979,
0x820b5975, 0x0a97b455, 0xa61058df, 0x841db05b, 0xe7be750e, 0xd58c4305, 0xc634dd72, 0xd2fcae55,
0x0e1be9db, 0x442a7b7b, 0xd1e31dc9, 0xea64e32a, 0x1708e9dc, 0x624479c0, 0x89d49e7c, 0xeee00b79,
0x88a9be6d, 0x52855718, 0xb8d1dd72, 0x88524252, 0x154c652a, 0x6f88253a, 0x76225a75, 0x6e8d357b,
0x375f0653, 0x7d50cd1b, 0xcd892218, 0x8c1f4f59, 0x1bb9303d, 0xf1d1497d, 0xa08c11b7, 0x980f27b7,
0x7129321f, 0xa7ed84b1, 0xad93b8dc, 0x7d50e08c, 0xc73bd9de, 0x7c566c59, 0x3156957b, 0x9d899dd9,
0x3705b47c, 0x935b6270, 0xd68d81b6, 0xebfc727b, 0xf5f55301, 0x04292177, 0x2d81a7df, 0x70b7c27a,
0xd0a11c75, 0xf62b173a, 0x268d81b6, 0x74ced6ab, 0x78add61b, 0x29987e0e, 0xcaad16d2, 0x77ae8e5b,
0xc94fc268, 0x8d92cd18, 0x2bced6ab, 0xc78ae75a, 0xccb02843, 0xf292506a, 0x26995353, 0x37af7871,
0x6a22a068, 0xc665063c, 0x0cc0fc1b, 0xe2aa0e79, 0xf7c1c147, 0xa7a0b032, 0x0a6d58b6, 0xbc4bf771,
0xcb5a9bc0, 0xac9cfc71, 0x2e50e08c, 0x90bd3077, 0xfccb5171, 0x67edf7b7, 0x54e03fda, 0x56fa5971,
0x93aed61b, 0xc5baa77c, 0x70f64675, 0x5c925675, 0xd4861e53, 0x463e2db7, 0xc881da73, 0x4b72170e,
0x1589b455, 0xde3d21b6, 0x1fa2a956, 0x9634b975, 0x84ecb8b7, 0xda834fdf, 0xe0712b7d, 0x8ccccb45,
0xd3d95ede, 0x193a524f, 0x274b7274, 0xa1e89bb4, 0x7997b455, 0xa31df57b, 0xe6a4598f, 0x449f1787,
0xd7da0db7, 0xa4a1dd57, 0x32b0a1b4, 0x5300bb25, 0xcd50e08c, 0x8a9331c3, 0x350d1801, 0x621f173a,
0xc08d1874, 0x2727787b, 0xc2733156, 0x3097357b, 0xb835787b, 0xc6a3bfde, 0x1ad3884f, 0xef822442
};
class CMainParams : public CChainParams {
public:
CMainParams() {
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
pchMessageStart[0] = 0xf0;
pchMessageStart[1] = 0xda;
pchMessageStart[2] = 0xbb;
pchMessageStart[3] = 0xd2;
vAlertPubKey = ParseHex("04fc9702847840aaf195de8442ebecedf5b095cdbb9bc716bda9110971b28a49e0ead8564ff0db22209e0374782c093bb899692d524e9d6a6956e7c5ecbcd68284");
nDefaultPort = 28333;
nRPCPort = 28332;
bnProofOfWorkLimit = CBigNum(~uint256(0) >> 1);
nTxBits = 0x1e00ffff;
<API key> = 210000;
// Build the genesis block. Note that the output of the genesis coinbase cannot
// be spent as it did not originally exist in the database.
// CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
// CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
// CTxOut(nValue=50.00000000, scriptPubKey=<API key>)
// vMerkleTree: 4a5e1e
const char* pszTimestamp = "The Times 09/Jul/2013 Globo caught bribing Receita Federal employee to rob R$615M worth tax evasion documents.";
CTransaction txNew;
txNew.message = CScript() << string(pszTimestamp);
txNew.userName = CScript() << string("nobody");
txNew.nNonce = 0; // spamMessage is not required to show POW to ease "extranonce" support
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock = 0;
genesis.hashMerkleRoot = genesis.BuildMerkleTree();
genesis.nVersion = 1;
genesis.nHeight = 0;
genesis.nTime = 1384394255;
//genesis.nBits = 0x1d00ffff;
genesis.nBits = 0x1f03ffff;
genesis.nNonce = 2934;
hashGenesisBlock = genesis.GetHash();
assert(hashGenesisBlock == uint256("<SHA256-like>"));
vSeeds.push_back(CDNSSeedData("twister.net.co", "seed.twister.net.co"));
vSeeds.push_back(CDNSSeedData("gombadi.com", "dnsseed.gombadi.com"));
vSeeds.push_back(CDNSSeedData("twister.net.co", "seed2.twister.net.co"));
vSeeds.push_back(CDNSSeedData("twister.net.co", "seed3.twister.net.co"));
vSeeds.push_back(CDNSSeedData("twisterseed.tk", "twisterseed.tk"));
vSeeds.push_back(CDNSSeedData("cruller.tasty.sexy", "cruller.tasty.sexy"));
vSeeds.push_back(CDNSSeedData("twister-seeder.muh.freedu.ms", "twister-seeder.muh.freedu.ms"));
base58Prefixes[PUBKEY_ADDRESS] = 0;
base58Prefixes[SCRIPT_ADDRESS] = 5;
base58Prefixes[SECRET_KEY] = 128;
// Convert the pnSeeds array into usable address objects.
for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)
{
// It'll only connect to one or two seed nodes because once it connects,
// it'll get a pile of addresses with newer timestamps.
// Seed nodes are given a random 'last seen time' of between one and two
// weeks ago.
const int64 nOneWeek = 7*24*60*60;
struct in_addr ip;
memcpy(&ip, &pnSeed[i], sizeof(ip));
CAddress addr(CService(ip, GetDefaultPort()));
addr.nTime = GetTime() - GetRand(nOneWeek) - nOneWeek;
vFixedSeeds.push_back(addr);
}
}
virtual const CBlock& GenesisBlock() const { return genesis; }
virtual Network NetworkID() const { return CChainParams::MAIN; }
virtual const vector<CAddress>& FixedSeeds() const {
return vFixedSeeds;
}
protected:
CBlock genesis;
vector<CAddress> vFixedSeeds;
};
static CMainParams mainParams;
// Testnet (v3)
class CTestNetParams : public CMainParams {
public:
CTestNetParams() {
// The message start string is designed to be unlikely to occur in normal data.
// The characters are rarely used upper ASCII, not valid as UTF-8, and produce
// a large 4-byte int at any alignment.
pchMessageStart[0] = 0x0b;
pchMessageStart[1] = 0x11;
pchMessageStart[2] = 0x09;
pchMessageStart[3] = 0x07;
vAlertPubKey = ParseHex("04302390343f91cc401d56d68b123028bf52e5fca1939df127f63c6467cdf9c8e2c14b61104cf817d0b780da337893ecc4aaff1309e536162dabbdb45200ca2b0a");
nDefaultPort = 18333;
nRPCPort = 18332;
strDataDir = "testnet3";
// Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602;
genesis.nNonce = 414098458;
hashGenesisBlock = genesis.GetHash();
//assert(hashGenesisBlock == uint256("<SHA256-like>"));
vFixedSeeds.clear();
vSeeds.clear();
//vSeeds.push_back(CDNSSeedData("bitcoin.petertodd.org", "testnet-seed.bitcoin.petertodd.org"));
//vSeeds.push_back(CDNSSeedData("bluematt.me", "testnet-seed.bluematt.me"));
base58Prefixes[PUBKEY_ADDRESS] = 111;
base58Prefixes[SCRIPT_ADDRESS] = 196;
base58Prefixes[SECRET_KEY] = 239;
}
virtual Network NetworkID() const { return CChainParams::TESTNET; }
};
static CTestNetParams testNetParams;
// Regression test
class CRegTestParams : public CTestNetParams {
public:
CRegTestParams() {
pchMessageStart[0] = 0xfa;
pchMessageStart[1] = 0xbf;
pchMessageStart[2] = 0xb5;
pchMessageStart[3] = 0xda;
<API key> = 150;
bnProofOfWorkLimit = CBigNum(~uint256(0) >> 1);
nTxBits = 0x207fffff;
genesis.nTime = 1296688602;
genesis.nBits = 0x207fffff;
genesis.nNonce = 2;
hashGenesisBlock = genesis.GetHash();
nDefaultPort = 18444;
strDataDir = "regtest";
//assert(hashGenesisBlock == uint256("<API key>"));
vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
base58Prefixes[PUBKEY_ADDRESS] = 0;
base58Prefixes[SCRIPT_ADDRESS] = 5;
base58Prefixes[SECRET_KEY] = 128;
}
virtual bool RequireRPCPassword() const { return false; }
virtual Network NetworkID() const { return CChainParams::REGTEST; }
};
static CRegTestParams regTestParams;
static CChainParams *pCurrentParams = &mainParams;
const CChainParams &Params() {
return *pCurrentParams;
}
void SelectParams(CChainParams::Network network) {
switch (network) {
case CChainParams::MAIN:
pCurrentParams = &mainParams;
break;
case CChainParams::TESTNET:
pCurrentParams = &testNetParams;
break;
case CChainParams::REGTEST:
pCurrentParams = ®TestParams;
break;
default:
assert(false && "Unimplemented network");
return;
}
}
bool <API key>() {
bool fRegTest = GetBoolArg("-regtest", false);
bool fTestNet = GetBoolArg("-testnet", false);
if (fTestNet && fRegTest) {
return false;
}
if (fRegTest) {
SelectParams(CChainParams::REGTEST);
} else if (fTestNet) {
SelectParams(CChainParams::TESTNET);
} else {
SelectParams(CChainParams::MAIN);
}
return true;
} |
"""
A pythonic interface to the Zabbix API.
"""
from .api import Api, ApiException
from .objects.host import Host
from .objects.hostgroup import HostGroup
from .objects.item import Item
from .objects.trigger import Trigger
from .objects.itservice import ItService |
/*
* Audit hook for intercepting both requests and responses and looking for a custom audit object.
* Note that
* The request/response MUST contain an audit object or whatever key you specify in <API key> config as part of your JSON:
YOUR JSON REQUEST/RESPONSE OBJECT BEGIN...
audit: {
target: {
YOUR TARGET DATA
},
type: YOUR TYPE // eg: 'SmartExport',
category: YOUR CATEGORY // eg: 'Status Change',
data: {
YOUR DATA
}
}
YOUR JSON REQUEST/RESPONSE OBJECT END ...
*/
var _ = require('lodash');
module.exports = function(sails) {
// Service function to create the actual audit record in the db
function customLogicFn(req, params){
// YOUR CUSTOM LOGIC GOES HERE!
}
return {
defaults: {
auditor: {
auditKey: 'audit',
<API key>: false
}
},
routes: {
before: { |
<?php
namespace Symfony\Component\Security\Http\Logout;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Generator\<API key>;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
use Symfony\Component\Security\Core\Authentication\Token\Storage\<API key>;
use Symfony\Component\Security\Csrf\Csrf<API key>;
/**
* Provides generator functions for the logout URL.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jeremy Mikola <jmikola@gmail.com>
*/
class LogoutUrlGenerator
{
private $requestStack;
private $router;
private $tokenStorage;
private $listeners = [];
private $currentFirewall;
public function __construct(RequestStack $requestStack = null, <API key> $router = null, <API key> $tokenStorage = null)
{
$this->requestStack = $requestStack;
$this->router = $router;
$this->tokenStorage = $tokenStorage;
}
/**
* Registers a firewall's LogoutListener, allowing its URL to be generated.
*
* @param string $key The firewall key
* @param string $logoutPath The path that starts the logout process
* @param string|null $csrfTokenId The ID of the CSRF token
* @param string|null $csrfParameter The CSRF token parameter name
* @param string|null $context The listener context
*/
public function registerListener(string $key, string $logoutPath, ?string $csrfTokenId, ?string $csrfParameter, Csrf<API key> $csrfTokenManager = null, string $context = null)
{
$this->listeners[$key] = [$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager, $context];
}
/**
* Generates the absolute logout path for the firewall.
*
* @return string
*/
public function getLogoutPath(string $key = null)
{
return $this->generateLogoutUrl($key, <API key>::ABSOLUTE_PATH);
}
/**
* Generates the absolute logout URL for the firewall.
*
* @return string
*/
public function getLogoutUrl(string $key = null)
{
return $this->generateLogoutUrl($key, <API key>::ABSOLUTE_URL);
}
public function setCurrentFirewall(?string $key, string $context = null)
{
$this->currentFirewall = [$key, $context];
}
/**
* Generates the logout URL for the firewall.
*/
private function generateLogoutUrl(?string $key, int $referenceType): string
{
[$logoutPath, $csrfTokenId, $csrfParameter, $csrfTokenManager] = $this->getListener($key);
if (null === $logoutPath) {
throw new \LogicException('Unable to generate the logout URL without a path.');
}
$parameters = null !== $csrfTokenManager ? [$csrfParameter => (string) $csrfTokenManager->getToken($csrfTokenId)] : [];
if ('/' === $logoutPath[0]) {
if (!$this->requestStack) {
throw new \LogicException('Unable to generate the logout URL without a RequestStack.');
}
$request = $this->requestStack->getCurrentRequest();
$url = <API key>::ABSOLUTE_URL === $referenceType ? $request->getUriForPath($logoutPath) : $request->getBaseUrl().$logoutPath;
if (!empty($parameters)) {
$url .= '?'.http_build_query($parameters, '', '&');
}
} else {
if (!$this->router) {
throw new \LogicException('Unable to generate the logout URL without a Router.');
}
$url = $this->router->generate($logoutPath, $parameters, $referenceType);
}
return $url;
}
/**
* @throws \<API key> if no LogoutListener is registered for the key or could not be found automatically
*/
private function getListener(?string $key): array
{
if (null !== $key) {
if (isset($this->listeners[$key])) {
return $this->listeners[$key];
}
throw new \<API key>(sprintf('No LogoutListener found for firewall key "%s".', $key));
}
// Fetch the current provider key from token, if possible
if (null !== $this->tokenStorage) {
$token = $this->tokenStorage->getToken();
// @deprecated since 5.4
if ($token instanceof AnonymousToken) {
throw new \<API key>('Unable to generate a logout url for an anonymous token.');
}
if (null !== $token) {
if (method_exists($token, 'getFirewallName')) {
$key = $token->getFirewallName();
} elseif (method_exists($token, 'getProviderKey')) {
trigger_deprecation('symfony/security-http', '5.2', 'Method "%s::getProviderKey()" has been deprecated, rename it to "getFirewallName()" instead.', \get_class($token));
$key = $token->getProviderKey();
}
if (isset($this->listeners[$key])) {
return $this->listeners[$key];
}
}
}
// Fetch from injected current firewall information, if possible
[$key, $context] = $this->currentFirewall;
if (isset($this->listeners[$key])) {
return $this->listeners[$key];
}
foreach ($this->listeners as $listener) {
if (isset($listener[4]) && $context === $listener[4]) {
return $listener;
}
}
throw new \<API key>('Unable to find the current firewall LogoutListener, please provide the provider key manually.');
}
} |
/* eslint-disable react/prefer-es6-class */
import React from 'react';
import { ReactMeteorData } from 'meteor/react-meteor-data';
import PowerSearch from '../../../api/search/search_source';
import SearchSort from '../../../api/search/search_sort';
import SearchLogger from '../../../utility/search_logger';
import getSuggestions from '../../../api/search/autosuggest';
import WelcomeContent from '../WelcomeContent/WelcomeContent';
import WelcomeSidebar from '../WelcomeSidebar/WelcomeSidebar';
import ResultsCount from '../ResultsCount/ResultsCount';
import Sorting from '../Sorting/Sorting';
import SearchResults from '../SearchResults/SearchResults';
import Pagination from '../Pagination/Pagination';
import <API key> from '../<API key>/<API key>';
import SearchFacet from '../SearchFacet/SearchFacet';
import SearchLogo from '../SearchLogo/SearchLogo';
import SearchBar from '../SearchBar/SearchBar';
import Footer from '../Footer/Footer';
const SearchContainer = React.createClass({
mixins: [ReactMeteorData],
getInitialState() {
return {
searchParams: this.defaultSearchParams(),
searchSuggestions: [],
};
},
getMeteorData() {
const searchParams = this.state.searchParams;
if (searchParams.keywords) {
PowerSearch.search(
searchParams.keywords,
{
currentPage: searchParams.currentPage,
fields: searchParams.fields,
resultsPerPage: searchParams.resultsPerPage,
sorting: SearchSort.getSolrSort(searchParams.sorting),
}
);
}
const searchResults = PowerSearch.getData({
sort: SearchSort.getMongoSort(searchParams.sorting),
transform(matchText, regExp) {
return matchText.replace(regExp, '<strong>$&</strong>');
},
});
const searchMetadata = PowerSearch.getMetadata();
return {
searchResults,
searchMetadata,
};
},
defaultSearchParams() {
return {
keywords: '',
fields: {},
currentPage: 1,
resultsPerPage: 10,
lastAddedFieldName: null,
suggestionKeywords: '',
sorting: SearchSort.lookup.relevancy.id,
};
},
updateSearchParams(newSearchParams) {
if (newSearchParams) {
this.setState({
searchParams: newSearchParams,
});
SearchLogger.logSearchToCloud(newSearchParams);
} else {
this.setState({
searchParams: this.defaultSearchParams(),
searchSuggestions: [],
});
}
},
provideSuggestions(suggestionKeywords) {
if (suggestionKeywords) {
getSuggestions.call({
suggestionKeywords,
}, (error, suggestions) => {
this.setState({
searchSuggestions: suggestions,
});
});
} else {
this.setState({
searchSuggestions: [],
});
}
},
renderMain() {
let mainContent;
if (!this.state.searchParams.keywords) {
mainContent = (
<main>
<WelcomeContent />
</main>
);
} else if (PowerSearch.getStatus().loaded) {
if (this.data.searchResults.length) {
mainContent = (
<main>
<div className="row">
<div className="col-md-9">
<ResultsCount
searchMetadata={this.data.searchMetadata}
searchParams={this.state.searchParams}
/>
</div>
<div className="col-md-3">
<Sorting
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
</div>
</div>
<SearchResults
searchResults={this.data.searchResults}
searchParams={this.state.searchParams}
searchMetadata={this.data.searchMetadata}
/>
<Pagination
searchMetadata={this.data.searchMetadata}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
</main>
);
} else {
mainContent = (<main>No results found.</main>);
}
} else if (PowerSearch.getStatus().loading) {
mainContent = (
<main>
Loading ...
</main>
);
} else {
mainContent = (
<main>
Oh no! Looks like we're having problems completing your search!
</main>
);
}
return mainContent;
},
renderSidebar() {
let sidebarContent;
if (!this.state.searchParams.keywords) {
sidebarContent = (<WelcomeSidebar />);
} else if (this.data.searchMetadata.facets) {
sidebarContent = (
<aside>
<h2>Refine Your Search</h2>
<<API key>
field="source"
name="Categories"
categories={this.data.searchMetadata.nestedCategories.source}
<API key>={this.state.searchParams.fields.source}
showHelp
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
<<API key>
field="date_ss"
name="Date"
categories={this.data.searchMetadata.nestedCategories.date_ss}
<API key>={this.state.searchParams.fields.date_ss}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
rootNodeLimit={10} sortRootNodesDesc
/>
<SearchFacet
key="ml_entity_location"
name="Location"
field="ml_entity_location"
values={this.data.searchMetadata.facets.ml_entity_location}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
<SearchFacet
key="ml_keyword"
name="Related Terms"
field="ml_keyword"
values={this.data.searchMetadata.facets.ml_keyword}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
<SearchFacet
key="<API key>"
name="Organization"
field="<API key>"
values={this.data.searchMetadata.facets.<API key>}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
<SearchFacet
key="author"
name="Author"
field="author"
values={this.data.searchMetadata.facets.author}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
<SearchFacet
key="doctype"
name="Document Type"
field="doctype"
values={this.data.searchMetadata.facets.doctype}
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
/>
</aside>
);
}
return sidebarContent;
},
render() {
return (
<div className="search-container">
<header>
<nav className="navbar navbar-default navbar-fixed-top">
<div className="container">
<div className="row">
<div className="col-md-2">
<SearchLogo />
</div>
<div className="col-md-10">
<SearchBar
searchParams={this.state.searchParams}
<API key>={this.updateSearchParams}
searchSuggestions={this.state.searchSuggestions}
requestSuggestions={this.provideSuggestions}
/>
</div>
</div>
</div>
</nav>
</header>
<div className="search-body">
<div className="container">
<div className="row">
<div className="col-md-8">
{this.renderMain()}
</div>
<div className="col-md-4">
{this.renderSidebar()}
</div>
</div>
</div>
</div>
<Footer />
</div>
);
},
});
export default SearchContainer; |
NOT READY FOR USE!
Happy-builder Maven Plugin
Happy-builder Maven Plugin automatically generates builder classes for your POJOs.
Builder class should be understood as implementation of builder pattern that provides fluent API to create customized instances of your POJO. |
// nativescript
import { <API key> } from '<API key>/platform';
import * as tnsOAuthModule from 'nativescript-oauth';
import * as app from 'application';
import SocialLogin = require("<API key>");
// app
import { NativeModule } from './native.module';
// let linkedInInitOptions : tnsOAuthModule.<API key> = {
// clientId: '81b04j6ndos3l6',
// client<API key>,
// scope: ['r_basicprofile'] //Leave blank and the default scopes will be used
// tnsOAuthModule.initLinkedIn(linkedInInitOptions);
// var facebookInitOptions : tnsOAuthModule.<API key> = {
// clientId: '114705639114730',
// client<API key>,
// scope: ['email'] //whatever other scopes you need
// tnsOAuthModule.initFacebook(facebookInitOptions);
<API key>().bootstrapModule(NativeModule); |
import sys, re
from subprocess import Popen, PIPE
import framework.mynumpy as np
info = {}
QUIET=True
ONLY_TIME=True
USE_CODE_COUNTERS=True
import framework.beamformer.capon.getCaponCUDA as getCaponCUDA
#sys.path.append('/home/me/Work/UiO/Phd/Code/Profile')
def getTimings(app_name='<API key>',
functions=['gauss_solve','buildR_kernel','amplitude_capon'],
M=8,L=4):
if USE_CODE_COUNTERS:
prof = Popen("./%s testEfficiency <API key> %d %d"%(app_name,M,L), shell=True, stdout=PIPE, stderr=PIPE)
output, error = prof.communicate()
return np.zeros((3,))
def run(M=24,L=8,verbose=False):
# print "nvprof -u us -t 0.1 --devices 0 %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L
prof = Popen("nvprof -u ns %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L), shell=True, stdout=PIPE, stderr=PIPE)
output, error = prof.communicate()
if error == '':
if verbose:
print output
return output
else:
print output
raise Exception(error)
events=''
profiler_output = run(M,L)
lines = re.split("\n+", profiler_output)
runtimes = np.zeros([])
entered_once = False
for l in lines:
for i,function in enumerate(functions):
if re.search(".+%s.+"%function, l):
timings = re.sub("^\s*", '', l)
timings = re.sub("[\sa-zA-Z]*%s.+"%function, '', timings)
columns = re.split("\s+", timings)
if not entered_once:
entered_once = True
runtimes = np.zeros((functions.__len__(),columns.__len__()))
runtimes[i] = map(float,columns)
break
else:
pass
return runtimes[:,3]/1e3
def getMemoryOps(app_name='<API key>',
functions=['gauss_solve','buildR_kernel','amplitude_capon'],
M=16,L=4):
if not ONLY_TIME:
def run(M=24,L=8,verbose=False):
# print "nvprof -u us --devices 0 --events %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L)
prof = Popen("nvprof -u ns --devices 0 --events %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L), shell=True, stdout=PIPE, stderr=PIPE)
output, error = prof.communicate()
if error == '':
if verbose:
print output
return output
else:
print output
raise Exception(error)
events = "gld_request,gst_request,shared_load,shared_store"
events_list = re.split(',',events)
profiler_output = run(M,L)
lines = re.split("\n+", profiler_output)
memops = np.zeros((functions.__len__(),events_list.__len__()))
for i,l in enumerate(lines):
for j,function in enumerate(functions):
if re.search(".+%s.+"%function, l):
for k,event in enumerate(events_list):
timings = re.sub("^\s*", '', lines[i+k+1])
timings = re.sub("\s*%s.*"%event, '', timings)
columns = re.split("\s+", timings)
memops[j,k] = float(columns[1])
else:
pass
# print "Recorded runtimes [ms]: "
# print runtimes[:,3]/1e3
return memops
else:
return np.zeros((3,))
def getInstructions(app_name='<API key>',
functions=['gauss_solve','buildR_kernel','amplitude_capon'],
M=16,L=8):
if not ONLY_TIME:
def run(M=16,L=4,verbose=False):
# print "nvprof -u us --devices 0 --events %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L)
prof = Popen("nvprof -u ns --devices 0 --events %s ./%s testEfficiency <API key> %d %d"%(events,app_name,M,L), shell=True, stdout=PIPE, stderr=PIPE)
output, error = prof.communicate()
if error == '':
if verbose:
print output
return output
else:
print output
raise Exception(error)
events = "inst_issued1_0,inst_issued2_0,inst_issued1_1,inst_issued2_1"
# l2_read_requests,l2_write_requests,<API key>"
events_list = re.split(',',events)
profiler_output = run(M,L)
lines = re.split("\n+", profiler_output)
instructions = np.zeros((functions.__len__(),events_list.__len__()))
for i,l in enumerate(lines):
for j,function in enumerate(functions):
if re.search(".+%s.+"%function, l):
for k,event in enumerate(events_list):
timings = re.sub("^\s*", '', lines[i+k+1])
timings = re.sub("\s*%s.*"%event, '', timings)
columns = re.split("\s+", timings)
instructions[j,k] = float(columns[1])
else:
pass
##From CUPTI Users manual:
## inst_issued1_0 + (inst_issued2_0 * 2) + inst_issued1_1 + (inst_issued2_1 * 2)
# print instructions
instructions = instructions[:,0] + 2*instructions[:,1] + instructions[:,2] + 2*instructions[:,3]
# print "Recorded runtimes [ms]: "
# print runtimes[:,3]/1e3
return instructions
## events = "--events inst_issued1_0,inst_issued2_0,inst_issued1_1,inst_issued2_1"#,\
## l2_read_requests,l2_write_requests,<API key>"
else:
return np.zeros((3,))
def collectResults(M=32,L=16):
if QUIET:
print "Collecting results for M=%d, L=%d"%(M,L)
if not QUIET:
print "
print "## DEFAULT #"
print "
print ""
functions=['gauss_solve','buildR_kernel','amplitude_capon']
timings_default = getTimings(functions=functions,M=M,L=L)
memops_default = getMemoryOps(functions=functions,M=M,L=L)
<API key> = getInstructions(functions=functions,M=M,L=L)
if not QUIET:
print 'Runtimes: %d %d %d'%tuple(timings_default)
print ''
print 'Memory instructions (gld_request gst_request shared_load shared_store):'
for i,key in enumerate(functions):
a = [functions[i]]
a.extend(memops_default[i])
print '%s: %d %d %d %d'%tuple(a)
print ''
print 'Instructions %d %d %d'%tuple(<API key>)
#print "## DEFAULT #"
#print ""
#print "Runtimes: 40700 2510 742"
#print ""
#print "Memory instructions (gld_request gst_request shared_load shared_store):"
#print "gauss_solve: 160000 10000 7380000 2860000"
#print "buildR_kernel: 10000 85000 555000 95000"
#print "amplitude_capon: 15000 10000 245000 20000"
#print ""
#print "Instructions 65520464 7268280 2220345"
if not QUIET:
print ""
print "
print "## MEMORY #"
print "
print ""
timings_memory = getTimings(app_name='<API key>', functions=functions,M=M,L=L)
memops_memory = getMemoryOps(app_name='<API key>', functions=functions,M=M,L=L)
instructions_memory = getInstructions(app_name='<API key>', functions=functions,M=M,L=L)
if not QUIET:
print 'Runtimes [ms]: %d %d %d'%tuple(timings_memory)
print ''
print 'Memory instructions diff (should be all zeros):'
for i,key in enumerate(functions):
a = [functions[i]]
a.extend(memops_memory[i]-memops_default[i])
print '%s: %d %d %d %d'%tuple(a)
print ''
print 'Instructions %d %d %d'%tuple(instructions_memory)
if not QUIET:
print ""
print "
print "## MATH GLOBAL #"
print "
print ""
timings_math = getTimings(app_name='<API key>', functions=functions,M=M,L=L)
memops_math = getMemoryOps(app_name='<API key>', functions=functions,M=M,L=L)
instructions_math = getInstructions(app_name='<API key>', functions=functions,M=M,L=L)
if not QUIET:
print 'Runtimes [ms]: %d %d %d'%tuple(timings_math)
print ''
print 'Memory instructions diff (should be all zeros):'
for i,key in enumerate(functions):
a = [functions[i]]
a.extend(memops_math[i]-memops_default[i])
print '%s: %d %d %d %d'%tuple(a)
print ''
print 'Instructions %d %d %d'%tuple(instructions_math)
print ""
print "
print "## MATH SHARED #"
print "
print ""
timings_math = getTimings(app_name='<API key>', functions=functions,M=M,L=L)
memops_math = getMemoryOps(app_name='<API key>', functions=functions,M=M,L=L)
instructions_math = getInstructions(app_name='<API key>', functions=functions,M=M,L=L)
if not QUIET:
print 'Runtimes [ms]: %d %d %d'%tuple(timings_math)
print ''
print 'Memory instructions diff (should be all zeros):'
for i,key in enumerate(functions):
a = [functions[i]]
a.extend(memops_math[i]-memops_default[i])
print '%s: %d %d %d %d'%tuple(a)
print ''
print 'Instructions %d %d %d'%tuple(instructions_math)
if not QUIET:
print ""
print "
print "## MATH #"
print "
print ""
timings_math = getTimings(app_name='<API key>', functions=functions,M=M,L=L)
memops_math = getMemoryOps(app_name='<API key>', functions=functions,M=M,L=L)
instructions_math = getInstructions(app_name='<API key>', functions=functions,M=M,L=L)
if not QUIET:
print 'Runtimes [ms]: %d %d %d'%tuple(timings_math)
print ''
print 'Memory instructions diff (should be all zeros):'
for i,key in enumerate(functions):
a = [functions[i]]
a.extend(memops_math[i]-memops_default[i])
print '%s: %d %d %d %d'%tuple(a)
print ''
print 'Instructions %d %d %d'%tuple(instructions_math)
if not QUIET:
print ""
print "
print "## TOTAL #"
print "
print ""
# time_total = timings_default[0] + timings_default[1]
# time_math = timings_math[0] + timings_math[1]
# time_memory = timings_memory[0] + timings_memory[1]
return np.array([timings_default[0],timings_default[1],
timings_math[0], timings_math[1],
timings_memory[0], timings_memory[1]])
USING PROFILER
## Analysing instruction / byte ratio with the use of the profiler:
## events = "--events inst_issued1_0,inst_issued2_0,inst_issued1_1,inst_issued2_1"#,\
## l2_read_requests,l2_write_requests,<API key>"
## default_event_run = run()
##From CUPTI Users manual:
## inst_issued1_0 + (inst_issued2_0 * 2) + inst_issued1_1 + (inst_issued2_1 * 2)
##events = "--events gld_request,gst_request,shared_load,shared_store"
##lines = re.split("\n+", default_run)
##k = -1
## Inst_per_SM = 32 * instructions_issued (32 - warp size)
## Mem_per_SM = 32B * (l2_read_requests+l2_write_requests+<API key>)
## Compare Inst_per_SM / Mem_per_SM
##for l in lines:
## if re.search("\s+Kernel.+", l):
## kernels.append(table)
## else:
## table.append( re.split("\s+",l) )
## MEMORY #
#app_name = "<API key>"
#memory_run = run()
#print "Check that removing math did not reduce load/store instruction count... "
#events = "--events gld_request,gst_request,shared_load,shared_store"
#memory_event_run = run(verbose=True)
MATH
##app_name = "<API key>"
##math_run = run()
##events = "--events gld_request,gst_request,shared_load,shared_store"
##math_event_run = run()
#return info
##export PYTHONPATH="/home/me/Work/UiO/Phd/Code/Profile"
##python testEfficiency.py <API key>
##nvprof ./testEfficiency testEfficiency <API key>
M = 8
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
for l,L in enumerate(L_list):
time[l] = collectResults(M,L)
np.savetxt('time-M%d.txt'%M,time)
M = 16
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
for l,L in enumerate(L_list):
time[l] = collectResults(M,L)
np.savetxt('time-M%d.txt'%M,time)
M = 32
L_list = np.arange(M-1)+2
time = np.zeros((L_list.shape[0],6))
for l,L in enumerate(L_list):
time[l] = collectResults(M,L)
np.savetxt('time-M%d.txt'%M,time) |
<?php
namespace Eden\Sqlite;
use Eden\Sql\Exception as SqlException;
/**
* Sql Errors
*
* @vendor Eden
* @package Sqlite
* @author Christian Blanquera cblanquera@openovate.com
*/
class Exception extends SqlException
{
} |
#!/bin/bash
set -x
docker run --rm -e MYSQL_ROOT_PASSWORD=toor -t -i -v $(pwd):/kanban -v $(pwd)/config.sh:/root/.yukan_config.sh mysql /kanban/db_test_inside.sh |
'use strict';
// Configuring the Articles module
angular.module('dashboards').run(['Menus', 'gettextCatalog',
function(Menus, gettextCatalog) {
// Translate menu item
var title = gettextCatalog.getString('Dashboards');
// Set top bar menu items
Menus.addMenuItem('topbar', title, 'dashboards', '/dashboards', true);
}
]); |
package edu.washington.cs.figer.analysis.feature;
import edu.washington.cs.figer.data.EntityProtos.Mention;
import edu.washington.cs.figer.ml.Model;
import java.util.ArrayList;
public interface AbstractFeaturizer {
public void apply(Mention m, ArrayList<String> features, Model model);
public void init(Model m);
} |
import { <API key> } from 'constants/ActionTypes';
let localStorage = window.localStorage;
let localAdminInfo = JSON.parse(localStorage.getItem('adminInfo'));
const initialState = {
adminInfo: {
name: '',
avator: '',
email: '',
gender: '',
campous: '',
address: '',
phoneNum: '',
navigation: []
}
};
if (localAdminInfo) {
initialState.adminInfo = localAdminInfo;
};
export function adminInfo(state = initialState, action) {
switch (action.type) {
case <API key>:
let state = {
state,
adminInfo: {
name: action.name,
avator: action.avator,
email: action.email,
gender: action.gender,
campous: action.campous,
address: action.address,
phoneNum: action.phoneNum,
navigation: action.navigation
}
};
window.localStorage.setItem('adminInfo',JSON.stringify(state.adminInfo));
return state;
default:
return state;
}
} |
<!DOCTYPE html>
<html>
<head>
<title>MOC 06 - Time</title>
<script src="assets/ga.js"></script>
</head>
<body>
<div id="moc06">
<iframe src='http://cdn.knightlab.com/libs/timeline/latest/embed/index.html?source=<API key>&font=Bevan-PotanoSans&maptype=toner&lang=en&hash_bookmark=true&start_zoom_adjust=-4&height=650' width='100%' height='650' frameborder='0'></iframe>
</div>
</body>
</html> |
#ifndef SUBJECT_H_
#define SUBJECT_H_
#include <vector>
#include "observer.h"
Represents a subject in observer pattern.
All subject should inherit form this class.
class Subject
{
public:
virtual ~Subject ();
Registers a new observer.
void RegisterObserver (Observer * observer);
protected:
Notifies all its observers.
void NotifyObservers ();
private:
std::vector<Observer *> m_Observers;
};
#endif // SUBJECT_H_ |
<?php if(!defined('IS_INCLUDED')) exit('Access denied!');
class Slug{
public static function update($str,PDO $DB,$tbl_name,$col_slug_name, $col_primary_name, $record_id){
if(!isset($str,$tbl_name,$col_slug_name,$DB,$col_primary_name,$record_id)){
return $this;
}
$stmt=$DB->prepare("SELECT $col_slug_name as current_slug FROM $tbl_name WHERE $col_primary_name=:ID");
$param=array("ID"=>$record_id);
$stmt->execute($param);
$rows=$stmt->fetch(PDO::FETCH_OBJ);
$current_slug=$rows->current_slug; //current slug that store in the database
$slug=self::convert($str); //convert the string to slug
$baseSlug=$slug;
$i=2;
while(self::countSlug($slug,$tbl_name,$col_slug_name,$DB,$current_slug)>0){
$slug=$baseSlug."-".$i++;
}
if($slug!=$current_slug){
//if slug change and not equal to the existing slug, make a new slug
$slug=self::make($str,$DB,$tbl_name,$col_slug_name);
}
return $slug;
}
public static function make($str,PDO $DB,$tbl_name,$col_slug_name){
if(!isset($str,$tbl_name,$col_slug_name,$DB)){
return $this;
}
$slug=self::convert($str); //convert the string to slug
$baseSlug=$slug;
$i=2;
while(self::countSlug($slug,$tbl_name,$col_slug_name,$DB)>0){
$slug=$baseSlug."-".$i++;
}
return $slug;
}
private function countSlug($slug,$tbl_name,$col_slug_name,PDO $DB, $current_slug=""){
if($current_slug==""){
$sql="SELECT COUNT(*) as Count FROM $tbl_name WHERE $col_slug_name=:slug";
$param=array("slug"=>$slug);
}else{
$sql="SELECT COUNT(*) as Count FROM $tbl_name WHERE $col_slug_name=:slug AND $col_slug_name!=:current_slug";
$param=array("slug"=>$slug,'current_slug'=>$current_slug);
}
$stmt=$DB->prepare($sql);
$stmt->execute($param);
$rows=$stmt->fetch(PDO::FETCH_OBJ);
return $rows->Count;
}
public static function convert($str, $options = array()) {
// Make sure string is in UTF-8 and strip invalid UTF-8 characters
$str = mb_convert_encoding((string)$str, 'UTF-8', mb_list_encodings());
$defaults = array(
'delimiter' => '-',
'limit' => null,
'lowercase' => true,
'replacements' => array(),
'transliterate' => false,
);
// Merge options
$options = array_merge($defaults, $options);
$char_map = array(
// Latin
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C',
'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',
'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ő' => 'O',
'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ű' => 'U', 'Ý' => 'Y', 'Þ' => 'TH',
'ß' => 'ss',
'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c',
'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i',
'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ő' => 'o',
'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ű' => 'u', 'ý' => 'y', 'þ' => 'th',
'ÿ' => 'y',
// Latin symbols
'©' => '(c)',
// Greek
'Α' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D', 'Ε' => 'E', 'Ζ' => 'Z', 'Η' => 'H', 'Θ' => '8',
'Ι' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M', 'Ν' => 'N', 'Ξ' => '3', 'Ο' => 'O', 'Π' => 'P',
'Ρ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'PS', 'Ω' => 'W',
'Ά' => 'A', 'Έ' => 'E', 'Ί' => 'I', 'Ό' => 'O', 'Ύ' => 'Y', 'Ή' => 'H', 'Ώ' => 'W', 'Ϊ' => 'I',
'Ϋ' => 'Y',
'α' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', 'ε' => 'e', 'ζ' => 'z', 'η' => 'h', 'θ' => '8',
'ι' => 'i', 'κ' => 'k', 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => '3', 'ο' => 'o', 'π' => 'p',
'ρ' => 'r', 'σ' => 's', 'τ' => 't', 'υ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'ps', 'ω' => 'w',
'ά' => 'a', 'έ' => 'e', 'ί' => 'i', 'ό' => 'o', 'ύ' => 'y', 'ή' => 'h', 'ώ' => 'w', 'ς' => 's',
'ϊ' => 'i', 'ΰ' => 'y', 'ϋ' => 'y', 'ΐ' => 'i',
// Turkish
'Ş' => 'S', 'İ' => 'I', 'Ç' => 'C', 'Ü' => 'U', 'Ö' => 'O', 'Ğ' => 'G',
'ş' => 's', 'ı' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o', 'ğ' => 'g',
// Russian
'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'Yo', 'Ж' => 'Zh',
'З' => 'Z', 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O',
'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C',
'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sh', 'Ъ' => '', 'Ы' => 'Y', 'Ь' => '', 'Э' => 'E', 'Ю' => 'Yu',
'Я' => 'Ya',
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'zh',
'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o',
'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c',
'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sh', 'ъ' => '', 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'yu',
'я' => 'ya',
// Ukrainian
'Є' => 'Ye', 'І' => 'I', 'Ї' => 'Yi', 'Ґ' => 'G',
'є' => 'ye', 'і' => 'i', 'ї' => 'yi', 'ґ' => 'g',
// Czech
'Č' => 'C', 'Ď' => 'D', 'Ě' => 'E', 'Ň' => 'N', 'Ř' => 'R', 'Š' => 'S', 'Ť' => 'T', 'Ů' => 'U',
'Ž' => 'Z',
'č' => 'c', 'ď' => 'd', 'ě' => 'e', 'ň' => 'n', 'ř' => 'r', 'š' => 's', 'ť' => 't', 'ů' => 'u',
'ž' => 'z',
// Polish
'Ą' => 'A', 'Ć' => 'C', 'Ę' => 'e', 'Ł' => 'L', 'Ń' => 'N', 'Ó' => 'o', 'Ś' => 'S', 'Ź' => 'Z',
'Ż' => 'Z',
'ą' => 'a', 'ć' => 'c', 'ę' => 'e', 'ł' => 'l', 'ń' => 'n', 'ó' => 'o', 'ś' => 's', 'ź' => 'z',
'ż' => 'z',
// Latvian
'Ā' => 'A', 'Č' => 'C', 'Ē' => 'E', 'Ģ' => 'G', 'Ī' => 'i', 'Ķ' => 'k', 'Ļ' => 'L', 'Ņ' => 'N',
'Š' => 'S', 'Ū' => 'u', 'Ž' => 'Z',
'ā' => 'a', 'č' => 'c', 'ē' => 'e', 'ģ' => 'g', 'ī' => 'i', 'ķ' => 'k', 'ļ' => 'l', 'ņ' => 'n',
'š' => 's', 'ū' => 'u', 'ž' => 'z'
);
// Make custom replacements
$str = preg_replace(array_keys($options['replacements']), $options['replacements'], $str);
// Transliterate characters to ASCII
if ($options['transliterate']) {
$str = str_replace(array_keys($char_map), $char_map, $str);
}
// Replace non-alphanumeric characters with our delimiter
$str = preg_replace('/[^\p{L}\p{Nd}]+/u', $options['delimiter'], $str);
// Remove duplicate delimiters
$str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);
// Truncate slug to max. characters
$str = mb_substr($str, 0, ($options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8')), 'UTF-8');
// Remove delimiter from ends
$str = trim($str, $options['delimiter']);
return $options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str;
}
}
?> |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Meatings</title>
<link href="{{ asset('/css/app.css') }}" rel="stylesheet">
<!-- Fonts -->
<link href='//fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#<API key>">
<span class="sr-only">Toggle Navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Meatings</a>
</div>
<div class="collapse navbar-collapse" id="<API key>">
<ul class="nav navbar-nav">
<li><a href="{{ url('/') }}">Home</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
@if (Auth::guest())
<li><a href="{{ url('/login') }}">Login</a></li>
<li><a href="{{ url('/login') }}">Register</a></li>
@else
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{{ Auth::user()->name }} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('users.edit', Auth::user()) }}">Edit Profile</a></li>
@if (Auth::user()->calendar_id)
<li><a href="{{ url('/user/' . Auth::user()->id . '/calendar') }}">Show Calendar Events</a></li>
@endif
<li><a href="{{ url('/auth/logout') }}">Logout</a></li>
</ul>
</li>
@endif
</ul>
</div>
</div>
</nav>
@yield('content')
<!-- Scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/<TwitterConsumerkey>/3.3.1/js/bootstrap.min.js"></script>
</body>
</html> |
#!/usr/bin/env python
# encoding: utf-8
import logging
import telegram
import random
import json
from giphypop import translate
with open('quotes.json') as data_file:
quotes = json.load(data_file)
quotes = quotes["quotes"]
def main():
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
bot = telegram.Bot(token='YOUR BOT AUTHORIZATION TOKEN')
try:
LAST_UPDATE_ID = bot.getUpdates()[-1].update_id
except IndexError:
LAST_UPDATE_ID = None
while True:
for update in bot.getUpdates(offset=LAST_UPDATE_ID, timeout=5):
text = update.message.text
chat_id = update.message.chat.id
update_id = update.update_id
if '/start' in text:
custom_keyboard = [["/quote", "/gif"]]
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard, resize_keyboard=True)
bot.sendMessage(chat_id=chat_id,
text="Chose.",
reply_markup=reply_markup)
LAST_UPDATE_ID = update_id + 1
elif '/quote' in text:
answer = quote()
bot.sendMessage(chat_id=chat_id,
text=answer)
LAST_UPDATE_ID = update_id + 1
elif '/gif' in text:
bot.sendMessage(chat_id=chat_id,
text="Nick is searching for an awesome gif.")
img = translate('nicolas cage')
bot.sendDocument(chat_id=chat_id,
document=img.fixed_height.url)
print "Enviar Gif " + img.fixed_height.url
LAST_UPDATE_ID = update_id + 1
def quote():
return random.choice(quotes)
if __name__ == '__main__':
main() |
# Deprecated!
**This has now been merged into main [Packer](https://github.com/mitchellh/packer) project!** (since [PR
The original code is keept in the _original_master_ branch for reference.
Deprecated, this has been merged into Packer.
# Packer Parallels Plugin
This used to be a builder plugin for [Packer](http:

Parallels Desktop is a registered trademark of Parallels Software International, Inc. The Parallels logo is a trademark of Parallels Holdings, Ltd. |
describe('c3 chart legend', function () {
'use strict';
var chart, args;
beforeEach(function (done) {
chart = window.initChart(chart, args, done);
});
describe('legend when multiple charts rendered', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30],
['data2', 50],
['data3', 100]
]
}
};
});
describe('long data names', function () {
beforeAll(function(){
args = {
data: {
columns: [
['long data name 1', 30],
['long data name 2', 50],
['long data name 3', 50],
]
}
};
});
it('should have properly computed legend width', function () {
var expectedLeft = [148, 226, 384],
expectedWidth = [118, 118, 108];
d3.selectAll('.c3-legend-item').each(function (d, i) {
var rect = d3.select(this).node().<API key>();
expect(rect.left).toBeCloseTo(expectedLeft[i], -2);
expect(rect.width).toBeCloseTo(expectedWidth[i], -2);
});
});
});
});
describe('legend position', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
};
});
it('should be located on the center of chart', function () {
var box = chart.internal.legend.node().<API key>();
expect(box.left + box.right).toBe(638);
});
});
describe('legend as inset', function () {
describe('should change the legend to "inset" successfully', function () {
beforeAll(function(){
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
},
legend: {
position: 'inset',
inset: {
step: null
}
}
};
});
it('should be positioned properly', function () {
var box = d3.select('.<API key>').node().<API key>();
expect(box.top).toBe(5.5);
expect(box.left).toBeGreaterThan(30);
});
it('should have automatically calculated height', function () {
var box = d3.select('.<API key>').node().<API key>();
expect(box.height).toBe(48);
});
});
describe('should change the legend step to 1 successfully', function () {
beforeAll(function(){
args.legend.inset.step = 1;
});
it('should have automatically calculated height', function () {
var box = d3.select('.<API key>').node().<API key>();
expect(box.height).toBe(28);
});
});
describe('should change the legend step to 2 successfully', function () {
beforeAll(function(){
args.legend.inset.step = 2;
});
it('should have automatically calculated height', function () {
var box = d3.select('.<API key>').node().<API key>();
expect(box.height).toBe(48);
});
});
describe('with only one series', function () {
beforeAll(function(){
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
]
},
legend: {
position: 'inset'
}
};
});
it('should locate legend properly', function () {
var box = d3.select('.<API key>').node().<API key>();
expect(box.height).toBe(28);
expect(box.width).toBeGreaterThan(64);
});
});
});
describe('legend.hide', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
hide: true
}
};
});
it('should not show legends', function () {
d3.selectAll('.c3-legend-item').each(function () {
expect(d3.select(this).style('visibility')).toBe('hidden');
});
});
describe('hidden legend', function () {
beforeAll(function(){
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
hide: 'data2'
}
};
});
it('should not show legends', function () {
expect(d3.select('.<API key>').style('visibility')).toBe('visible');
expect(d3.select('.<API key>').style('visibility')).toBe('hidden');
});
});
});
describe('legend.show', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
show: false
}
};
});
it('should not initially have rendered any legend items', function () {
expect(d3.selectAll('.c3-legend-item').empty()).toBe(true);
});
it('allows us to show the legend on showLegend call', function () {
chart.legend.show();
d3.selectAll('.c3-legend-item').each(function () {
expect(d3.select(this).style('visibility')).toBe('visible');
// This selects all the children, but we expect it to be empty
expect(d3.select(this).selectAll("*").length).not.toEqual(0);
});
});
});
describe('with legend.show is true', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
show: true
}
};
});
it('should initially have rendered some legend items', function () {
expect(d3.selectAll('.c3-legend-item').empty()).toBe(false);
});
it('should remove rendered every legend items', function () {
chart.legend.hide();
d3.selectAll('.c3-legend-item').each(function () {
expect(d3.select(this).style('visibility')).toBe('hidden');
// This selects all the children, but we expect it to be empty
expect(d3.select(this).selectAll("*").length).toEqual(undefined);
});
});
});
describe('custom legend size', function() {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
item: {
tile: {
width: 15,
height: 2
}
}
}
};
});
it('renders the legend item with the correct width and height', function () {
d3.selectAll('.c3-legend-item-tile').each(function () {
expect(d3.select(this).style('stroke-width')).toBe(args.legend.item.tile.height + 'px');
var tileWidth = d3.select(this).attr('x2') - d3.select(this).attr('x1');
expect(tileWidth).toBe(args.legend.item.tile.width);
});
});
});
describe('custom legend padding', function() {
beforeAll(function () {
args = {
data: {
columns: [
['padded1', 30, 200, 100, 400, 150, 250],
['padded2', 130, 100, 200, 100, 250, 150]
]
},
legend: {
padding: 10
}
};
});
it('renders the correct amount of padding on the legend element', function () {
d3.selectAll('.<API key> .c3-legend-item-tile, .<API key> .c3-legend-item-tile').each(function (el, index) {
var itemWidth = d3.select(this).node().parentNode.getBBox().width,
textBoxWidth = d3.select(d3.select(this).node().parentNode).select('text').node().getBBox().width,
tileWidth = 17, // default value is 10, plus 7 more for padding @TODO verify this, seems PhantomJS@^2 adds another 1px to each side
expectedWidth = textBoxWidth + tileWidth + (index ? 0 : 10) + args.legend.padding;
expect(itemWidth).toBe(expectedWidth);
});
});
});
describe('legend item tile coloring with color_treshold', function () {
beforeAll(function () {
args = {
data: {
columns: [
['padded1', 100],
['padded2', 90],
['padded3', 50],
['padded4', 20]
]
},
type: 'gauge',
color: {
pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'],
threshold: {
values: [30, 80, 95]
}
}
};
});
// espacially for gauges with multiple arcs to have the same coloring between legend tiles, tooltip tiles and arc
it('selects the color from color_pattern if color_treshold is given', function () {
var tileColor = [];
d3.selectAll('.c3-legend-item-tile').each(function () {
tileColor.push(d3.select(this).style('stroke'));
});
expect(tileColor[0]).toBe('rgb(96, 176, 68)');
expect(tileColor[1]).toBe('rgb(246, 198, 0)');
expect(tileColor[2]).toBe('rgb(249, 118, 0)');
expect(tileColor[3]).toBe('rgb(255, 0, 0)');
});
});
describe('legend item tile coloring without color_treshold', function () {
beforeAll(function () {
args = {
data: {
columns: [
['padded1', 100],
['padded2', 90],
['padded3', 50],
['padded4', 20]
],
colors: {
'padded1': '#60b044',
'padded4': '#8b008b'
}
},
type: 'gauge'
};
});
it('selects the color from data_colors, data_color or default', function () {
var tileColor = [];
d3.selectAll('.c3-legend-item-tile').each(function () {
tileColor.push(d3.select(this).style('stroke'));
});
expect(tileColor[0]).toBe('rgb(96, 176, 68)');
expect(tileColor[1]).toBe('rgb(31, 119, 180)');
expect(tileColor[2]).toBe('rgb(255, 127, 14)');
expect(tileColor[3]).toBe('rgb(139, 0, 139)');
});
});
}); |
package mod.mindcraft.advancedmaterials.integration.registry;
import java.util.ArrayList;
import mod.mindcraft.advancedmaterials.integration.IRecipeRegistry;
import mod.mindcraft.advancedmaterials.integration.recipes.CrystallizerRecipe;
import net.minecraft.inventory.IInventory;
import com.google.common.collect.ImmutableList;
public class <API key> implements IRecipeRegistry<CrystallizerRecipe> {
private static final ArrayList<CrystallizerRecipe> recipes = new ArrayList<CrystallizerRecipe>();
@Override
public void addRecipe(CrystallizerRecipe recipe) {
try {
recipes.add(recipe);
} catch (<API key> e) {}
}
@Override
public CrystallizerRecipe getRecipe(IInventory inv) {
for (CrystallizerRecipe recipe : recipes)
if (recipe.matches(inv))
return recipe;
return null;
}
@Override
public ImmutableList<CrystallizerRecipe> getRecipes() {
return ImmutableList.copyOf(recipes);
}
} |
define(
["bin/core/route"],
function(Route)
{
var queryString = bin.toQueryString;
var queryParams = bin.toQueryParams;
var Router = function()
{
}
Router.extend = bin.extend;
var pro = Router.prototype;
pro.init = function()
{
var routes = {prev:null, next:null};
routes.prev = routes;
routes.next = routes;
this._routes = routes;
var self = this;
this._router = new Backbone.Router({
routes:
{
"*path(?*queryString)": function(path, queryString)
{
path = path || "";
queryString = queryString || "";
self.onRoute(path, queryString);
}
}
});
Backbone.history.start();
console.log("Router module initialize");
}
pro.onRoute = function(path, queryString)
{
if(this._routing)
{
return ;
}
this._routing = true;
this._routeContext = {path: path};
if(!queryString)
{
}
else if(bin.isObject(queryString))
{
this._routeContext.queryParams = queryString;
}
else if(bin.isString(queryString))
{
this._routeContext.queryString = queryString;
}
var unmatches = [];
var matches = [];
var fist = this._routes;
var next = fist.next;
var func = null;
while(next !== fist)
{
func = next.onRoute(this._routeContext.path);
if(func)
{
(func.match ? matches : unmatches).push(func);
}
next = next.next;
}
// Do unmatch first, as reverse order
for(var i=unmatches.length-1; i>=0; --i)
{
unmatches[i]();
}
for(var i=0,i_sz=matches.length; i<i_sz; ++i)
{
matches[i]();
}
this.trigger("ROUTE-CHANGE", this._routeContext.path);
this._routing = false;
}
pro.getRouteContext = function()
{
return this._routeContext;
}
pro.getRoutePath = function()
{
return this._routeContext.path;
}
pro.getRouteQueryString = function()
{
if(!this._routeContext.queryString && this._routeContext.queryParams)
{
this._routeContext.queryString = queryString(this._routeContext.queryParams);
}
return this._routeContext.queryString;
}
pro.getRouteQueryParams = function()
{
if(!this._routeContext.queryParams && this._routeContext.queryString)
{
this._routeContext.queryParams = queryParams(this._routeContext.queryString);
}
return this._routeContext.queryParams;
}
pro.addRoute = function(route)
{
var last = this._routes.prev;
route.prev = last;
route.next = this._routes;
last.next = route;
this._routes.prev = route;
}
pro.remRoute = function(route)
{
route.prev.next = route.next;
route.next.prev = route.prev;
route.prev = null;
route.next = null;
}
pro.mock = function(path, data, noTrigger)
{
var i = path.indexOf("?");
if(i > 0)
{
var queryString = path.substring(i+1);
if(!data)
{
data = queryString;
}
else if(bin.isObject(data))
{
data = _.extend(data, queryParams(queryString));
}
else if(bin.isString(data))
{
data = queryString+"&"+data;
}
path = path.substring(0, i);
}
if(noTrigger)
{
this._routeContext = {path: path};
if(!data)
{
}
else if(bin.isObject(data))
{
this._routeContext.queryParams = data;
}
else if(bin.isString(data))
{
this._routeContext.queryString = data;
}
if(!this._routing)
{
this.trigger("ROUTE-CHANGE", this._routeContext.path);
}
}
else
{
this.onRoute(path, data);
}
}
pro.push = function(path, data, options)
{
if(data)
{
path = path+(path.indexOf("?")<0 ? "?" : "&")+queryString(data);
}
if (!options) {
options = {};
}
if (options.trigger === undefined) {
options.trigger = true;
}
Backbone.history.navigate(path, options);
}
pro.pop = function(n)
{
if(!n)
{
n = -1;
}
else if(n>0)
{
n = -n;
}
window.history.go(n);
}
_.extend(pro, Backbone.Events);
return Router;
}); |
#!/usr/bin/env ruby
$:.unshift File.join(File.dirname(__FILE__), "../../lib/")
require 'sqlpostgres'
include SqlPostgres
# Example: ../manual.dbk
pgconn = PGconn.connect('localhost', 5432, '', '', ENV['USER'])
connection = Connection.new('connection'=>pgconn)
# use the connection
connection.close # or, if you prefer, pgconn.close
# End example |
package br.com.jetpack.config.pkg.loader;
import br.com.jetpack.config.pkg.PkgInfo;
import br.com.jetpack.packages.installer.Installer;
public class RemotePackageLoader implements PackageLoader {
@Override
public PkgInfo loadPackage(String pkgName) {
return null;
}
@Override
public Installer loadInstallerScript(String pkgName) {
// TODO Auto-generated method stub
return null;
}
} |
export interface P {
className?: string;
} |
layout: post
title: GContracts 1.1.3 Released!
categories:
- gcontracts
- groovy
- releases
tags: []
status: publish
type: post
published: true
meta:
email_notification: '1289947090'
jabber_published: '1289947088'
_edit_lock: '1294151974'
_edit_last: '13220543'
reddit: s:55:"a:2:{s:5:"count";s:1:"0";s:4:"time";s:10:"1293720062";}";
_wp_old_slug: ''
<API key>: '1'
<API key>: ''
_flattr_post_hidden: '0'
<API key>: text
<API key>: en_GB
I am proud to announce that GContracts 1.1.3 has just been released and is available now in the Central Maven repository [<a href="http:
The release includes bug fixes and advanced support Spring bean classes annotated with GContracts' annotations.
<h4>Concrete <code>AssertionError</code> types</h4>
In parallel with <code>@Invariant</code>, <code>@Requires</code> and <code>@Ensures</code> GContracts 1.1.3 provides separate exception types which all are descendants of <code>AssertionError</code> and I guess do not need further explanation:
<code><API key></code>, <code><API key></code> and <code><API key></code>.
<h4>Advanced Support for Spring Beans</h4>
One of the problems with GContracts is its lack of compatibility especially with Grails artifact classes, i.e. controllers, services, domain classes etc. This topic has been brought to me a few times and if you just want to apply let's say class invariants on Spring bean classes the Spring application container's initialization lifecycle can quickly become your enemy.
Let's consider the following service:
{% highlight groovy %}
@Invariant({ anotherService != null })
class MyService {
def anotherService
static transactional = true
}
{% endhighlight %}
<code>MyService</code> is a simple Grails service class, annotated with a class invariant which ensures that the reference to <code>anotherService</code> will never be <code>null</code>, during the entire life-time of the <code>MyService</code> bean. Sadly enough, whenever the Spring application container tries to create a new instance of a <code>MyService</code> bean it fails because GContracts checks the class invariant directly after the object's constructor has completed successfully. By that time, the Spring application container is not yet done with object construction.
From a theoretical perspective throwing a <code><API key></code> in this place is completely reasonable since an object's class invariant needs to be fulfilled by the object instance during its entire life-time. But from a practical perspective, this is kind of pain. It means that you have to duplicate the class invariant to all methods in the service class, e.g.
{% highlight groovy %}
// avoid invariant checks during construction
class MyService {
def anotherService
static transactional = true
@Requires({ anotherService != null })
def myServiceMethod() {
}
@Requires({ anotherService != null })
def <API key>() {
}
}
{% endhighlight %}
It is not that Design by Contract can not be applied here, it is that Spring simply does define its own rules for object creation and destruction, meaning that whenever an object is created with its constructor the initialization process is not done in the case of the Spring application container.
This circumstance confuses programmers who simply want to apply DbC on their bean classes without thinking about Spring initialization mechanisms and GContracts assertion injection.
GContracts 1.1.3 is the starting point for a bunch of features which are targeted to iron out such integration issues with Spring/Grails applications. Of course it might be questionable whether it makes sense to focus primarily on the Spring framework, but that has been a practical decision (GContracts is for Groovy, Grails uses Groovy, Grails uses Spring...). Furthermore, I tried to make the integration as light as possible without actually introducing a classpath dependency on Spring framework classes.
The first feature which comes with 1.1.3 is a solution for the problem described above: class invariant checks on Spring beans. Henceforth, GContracts will not make class invariant checks on Spring beans during constructor calls, but will create a synthetic <code>@PostConstruct</code> method which overtakes the class invariant check. Since GContracts has no mechanism to know that the given class is a Spring-managed class at runtime, programmers need to annotate their artifact classes with appropriate stereotype annotations [<a href="http://static.springsource.org/spring/docs/3.0.x/<API key>/html/beans.html#<API key>">2</a>], e.g. a service class with <code>@Service</code>, a controller with <code>@Controller</code>, etc.
{% highlight groovy %}
@Service
@Invariant({ anotherService != null })
class MyService {
def anotherService
static transactional = true
}
{% endhighlight %}
The <code>@Service</code> stereotype annotation above triggers GContracts' "Spring compliance mode". Whenever the service bean above has been constructed by the Spring application container it will automatically check the class invariant.
The programmer clearly needs to make a compromise in this case, because the class invariant won't be checked after a construction call anymore (e.g. in a test-case where the programmer simply creates an instance of this service class). But this is a consequence of outsourcing object creation to the application container.
<strong>Hint:</strong> GContracts supports the <code>-ea</code>/<code>-da</code> VM parameters [<a href="https://github.com/andresteingress/gcontracts/wiki/VM-Parameters">3</a>] which you can use to deactivate assertion checking during application execution, whereas activating assertion checking only during test-cases.
<h4>Changes</h4>
ISSUE-25: better support for Spring component classes with class invariants
ISSUE-24: wrong class invariant placement with inherited invariant
ISSUE-23: @Requires on constructor with super statement causes compilation error
ISSUE-22: Separate Exception Types for Pre-, Postconditions and Class Invariant
ISSUE-17: remove direct reference to PowerAssertionError
<br><br><div>[0] <a href="http://repo1.maven.org/maven2/org/gcontracts/gcontracts/1.1.3/">GContracts 1.1.3 in Central Maven Repository</a></div>
<div>[1] <a href="http://github.com/andresteingress/gcontracts/downloads">GContracts at Github</a></div>
<div>[2] <a href="http://static.springsource.org/spring/docs/3.0.x/<API key>/html/beans.html#<API key>">Spring Stereotype Annotations and Classpath Scanning</a></div>
<div>[3] <a href="https://github.com/andresteingress/gcontracts/wiki/VM-Parameters">GContracts VM Parameter Support</a></div>
<a href="http://flattr.com/thing/84856/<API key>" target="_blank">
<img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0" /></a> |
import superagent from "superagent";
export default{
get: (url, params, callback) => {
superagent
.get(url)
.query(params)
.set('Accept', 'application/json')
.end((err, response)=> {
if (err) {
callback(err, null)
return
}
const confirmation = response.body.confirmation
if (confirmation != 'success') {
callback({message: response.body.message}, null)
return
}
callback(null, response.body)
})
},
post: (url, body, callback)=> {
superagent
.post(url)
.send(body)
.set('Accept', 'application/json')
.end((err, response)=> {
if (err) {
callback(err, null)
return
}
const confirmation = response.body.confirmation
if (confirmation != 'success') {
callback({message: response.body.message}, null)
return
}
callback(null, response.body)
})
},
put: ()=> {
},
delete: ()=> {
}
} |
function printUppercaseWords(inputArr) {
//75/100
let words = inputArr.replace(/[!.<>/\,?':"`;]/g," ");
let newWords = '';
for (let i = 0; i < words.length; i++) {
if (words[i] >= 'a' && words[i] <= 'z' || words[i] >= 'A'&& words[i] <= 'Z'){
newWords += words[i];
}else if(words[i] == ' ' && words[i+1] != ' ' && i < words.length-1){
newWords += ", ";
}else if(words[i] == ' ' && words[i+1] == ' '){
continue;
}
}
console.log(newWords.toUpperCase().trim());
}
printUppercaseWords('HI, how are you?'); |
/* jslint node: true, vars: true, white: true */
"use strict";
var connect = function() {
console.log("Nocache Connect");
};
var get = function(key, fn) {
console.log("Memcache get: " + key);
fn(undefined, undefined) ;
};
var set = function(key, val, fn) {
console.log("Memache set: " + key);
if (typeof(fn) === "function") {
fn(undefined);
}
};
module.exports = {
connect: connect,
get: get,
set: set
}; |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace System.Collections
{
<summary>
A Bloom filter is a space-efficient probabilistic data structure that is used to test
whether an element is a member of a set.
False positive matches are possible, but false negatives are not.
See http://wikipedia.org/wiki/Bloom_filter for more information.
</summary>
public interface IBloomFilter
{
<summary>
Adds item to bloom filter. Once an item is added, it will always report as being contained within the bloom filter.
</summary>
<param name="item">Item to add to the bloom filter.</param>
void Add(object item);
<summary>
Checks if item has probably been added to the bloom filter at some point.
</summary>
<param name="item">Item to validate existence within the bloom filter.</param>
<returns>False if it is known for a fact that the item is not contained within the bloom filter, otherwise true.</returns>
<remarks>
This function can return false <API key> stating that the bloom filter contains the item
even though it wasn't actually added to the bloom filter; however, it will not return a false negative--stating
that the bloom filter does not contain the item even though it does.
</remarks>
bool ProbablyContains(object item);
}
namespace Generic
{
<inheritdoc/>
public interface IBloomFilter<ElementT>
: IBloomFilter
{
<inheritdoc/>
void Add(ElementT item);
<inheritdoc/>
bool ProbablyContains(ElementT item);
}
}
} |
class Update < ActiveRecord::Base
belongs_to :user
belongs_to :project
<API key> :user_id, :project_id, :comment, :comment_html
auto_html_for :comment do
html_escape :map => {
'&' => '&',
'>' => '>',
'<' => '<',
'"' => '"' }
image
youtube width: 560, height: 340, wmode: "opaque"
vimeo width: 560, height: 340
redcloth :target => :_blank
link :target => :_blank
end
def email_comment_html
auto_html(comment) do
html_escape :map => {
'&' => '&',
'>' => '>',
'<' => '<',
'"' => '"'
}
image
redcloth :target => :_blank
link :target => :_blank
end
end
def notify_backers
project.subscribed_users.each do |user|
Rails.logger.info "[User #{user.id}] - Creating notification for #{user.name}"
Notification.create_notification :updates, user,
:project_name => project.name,
:project_owner => project.user.display_name,
:update_title => title,
:update => self,
:update_comment => email_comment_html
end
end
end |
package monoxide.forgebackup.backup;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.logging.Level;
import com.google.common.collect.Lists;
import monoxide.forgebackup.BackupLog;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.<API key>;
import net.minecraft.world.MinecraftException;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class Backup {
private final BackupSettings settings;
public Backup(BackupSettings settings) {
this.settings = settings;
}
public void run(ICommandSender sender) {
boolean failure = false;
notifyAdmins(sender, "ForgeBackup.backup.start");
notifyAdmins(sender, Level.FINE, "ForgeBackup.save.disabled");
toggleSavability(false);
try
{
notifyAdmins(sender, Level.FINE, "ForgeBackup.save.force");
forceSaveAllWorlds();
notifyAdmins(sender, Level.FINE, "ForgeBackup.backup.progress");
doBackup(sender);
}
catch (MinecraftException e)
{
notifyAdmins(sender, Level.SEVERE, "ForgeBackup.backup.aborted");
BackupLog.log(Level.SEVERE, e, e.getMessage());
return;
} catch (IOException e) {
notifyAdmins(sender, Level.SEVERE, "ForgeBackup.backup.aborted");
BackupLog.log(Level.SEVERE, e, e.getMessage());
return;
} finally {
notifyAdmins(sender, Level.FINE, "ForgeBackup.save.enabled");
toggleSavability(true);
}
notifyAdmins(sender, "ForgeBackup.backup.complete");
}
private void toggleSavability(boolean canSave) {
for (int i = 0; i < settings.getServer().worldServers.length; ++i)
{
if (settings.getServer().worldServers[i] != null)
{
WorldServer worldServer = settings.getServer().worldServers[i];
worldServer.canNotSave = !canSave;
}
}
}
private void forceSaveAllWorlds()
throws MinecraftException
{
if (settings.getServer().<API key>() != null)
{
settings.getServer().<API key>().saveAllPlayerData();
}
for (int i = 0; i < settings.getServer().worldServers.length; ++i)
{
if (settings.getServer().worldServers[i] != null)
{
WorldServer var5 = settings.getServer().worldServers[i];
boolean var6 = var5.canNotSave;
var5.canNotSave = false;
var5.saveAllChunks(true, null);
var5.canNotSave = var6;
}
}
}
private void doBackup(ICommandSender sender)
throws IOException
{
File backupsFolder = settings.getBackupFolder();
if (backupsFolder.exists() && !backupsFolder.isDirectory()) {
notifyAdmins(sender, Level.WARNING, "ForgeBackup.backup.folderExists");
return;
} else if (!backupsFolder.exists()) {
backupsFolder.mkdirs();
}
if (!settings.<API key>().<API key>(backupsFolder)) {
notifyAdmins(sender, Level.WARNING, "ForgeBackup.backup.folderInvalid");
return;
}
if (!settings.<API key>().isIncremental()) {
settings.<API key>().runBackupCleanup(backupsFolder);
}
List<File> thingsToSave = settings.getFilesToBackup();
List<Integer> disabledDimensions = settings.<API key>();
List<String> <API key> = Lists.newArrayList();
for (int dimension : disabledDimensions) {
WorldProvider provider = WorldProvider.<API key>(dimension);
provider.setDimension(dimension);
<API key>.add(provider.getSaveFolder());
}
settings.<API key>().openFile(backupsFolder, settings.getBackupFileName());
while (!thingsToSave.isEmpty()) {
File current = thingsToSave.remove(0);
if (!current.exists()) { continue; }
if (current.isDirectory()) {
if (<API key>.contains(current.getName()))
{ continue; }
settings.<API key>().addCompressedFile(current);
for (File child : current.listFiles()) {
thingsToSave.add(child);
}
} else {
settings.<API key>().addCompressedFile(current);
}
}
settings.<API key>().closeFile();
}
public void notifyAdmins(ICommandSender sender, String translationKey, Object... parameters) {
notifyAdmins(sender, Level.INFO, translationKey, parameters);
}
public void notifyAdmins(ICommandSender sender, Level level, String translationKey, Object... parameters) {
boolean <API key> = !(settings.getLoggingLevel() == 0);
String message = String.format(LanguageRegistry.instance().<API key>(translationKey), parameters);
if (sender instanceof <API key> && !settings.getServer().worldServers[0].getGameRules().<API key>("commandBlockOutput"))
{
<API key> = false;
}
if (<API key>)
{
for (Object playerObj : settings.getServer().<API key>().playerEntityList)
{
EntityPlayerMP player = (EntityPlayerMP)playerObj;
if ((settings.getServer().<API key>().areCommandsAllowed(player.username) || !settings.getServer().isDedicatedServer()) &&
(settings.getLoggingLevel() == 2 || level != Level.FINE))
{
player.sendChatToPlayer("\u00a77\u00a7o[" + sender.<API key>() + ": " + message + "]");
}
}
}
if (settings.getLoggingLevel() == 2 && level == Level.FINE) {
BackupLog.log(Level.INFO, message);
} else {
BackupLog.log(level, message);
}
}
} |
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
namespace CED.Properties {
[global::System.Runtime.CompilerServices.<API key>()]
[global::System.CodeDom.Compiler.<API key>("Microsoft.VisualStudio.Editors.SettingsDesigner.<API key>", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.<API key> {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.<API key>.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
} |
package com.lob.protocol.request;
import java.util.Map;
public class Filters {
public static Filter ofCount(final int count) {
return new Filter(count, null, null);
}
public static Filter ofOffset(final int offset) {
return new Filter(null, offset, null);
}
public static Filter ofMetadata(final Map<String, String> metadata) {
return new Filter(null, null, metadata);
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace <API key>
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.<API key>();
}
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
} |
/*globals define, $*/
/*jshint browser: true*/
define([
'text!./svgs/state.svg',
'text!./svgs/state-highlight.svg'
], function (STATE_SVG,
HIGHLIGHT_SVG) {
'use strict';
var META_TO_TEMPLATE = {
State: STATE_SVG,
InitialState: STATE_SVG
};
function <API key>() {
this.skinParts.$svg = null;
this.skinParts.$svgContainer = null;
this.prevMetaTypeName = null;
this.metaTypeName = null;
this.highlightColors = [];
this.colorToPathEl = {};
}
function <API key>(percent) {
return {
x: Math.cos(2 * Math.PI * percent),
y: Math.sin(2 * Math.PI * percent)
};
}
<API key>.prototype.updateSvg = function () {
var self = this,
template = META_TO_TEMPLATE[this.metaTypeName] || STATE_SVG,
cumulativePercent = 0,
slicePercent;
if (this.skinParts.$svgHighlight) {
this.skinParts.$svgHighlight.remove();
delete this.skinParts.$svgHighlight;
}
if (this.highlightColors.length > 0) {
this.colorToPathEl = {};
this.skinParts.$svgContainer = this.$el.find('.svg-container');
this.skinParts.$svgContainer.empty();
this.skinParts.$svg = $(template);
this.skinParts.$name = this.skinParts.$svg.find('.name');
this.skinParts.$svg.find('g').css('fill-opacity', 0); // Make default circle transparent
this.skinParts.$svgHighlight = $(HIGHLIGHT_SVG);
slicePercent = 1 / this.highlightColors.length;
this.highlightColors.forEach(function (color) {
var start = <API key>(cumulativePercent),
largeArcFlag = slicePercent > 0.5 ? 1 : 0,
pathEl,
pathData,
end;
// each slice starts where the last slice ended, so keep a cumulative percent
cumulativePercent += slicePercent;
//console.log('cumPer', cumulativePercent);
end = <API key>(cumulativePercent);
// create an array and join it just for code readability
pathData = [
'M', start.x, start.y, // Move
'A 1 1 0', largeArcFlag, '1', end.x, end.y, // Arc
'L 0 0', // Line
].join(' ');
// create a <path> and append it to the <svg> element
pathEl = $(document.createElementNS('http:
pathEl.attr('d', pathData);
pathEl.attr('fill', color);
pathEl.attr('opacity', 0);
self.colorToPathEl[color] = pathEl;
// Append a white clone to ensure the decorator isn't transparent when transitioning.
self.skinParts.$svgHighlight.append(pathEl.clone().attr('fill', 'white').attr('opacity', 1));
self.skinParts.$svgHighlight.append(pathEl);
});
self.skinParts.$svgContainer.append(self.skinParts.$svgHighlight);
} else if (this.prevMetaTypeName !== this.metaTypeName) {
this.skinParts.$svgContainer = this.$el.find('.svg-container');
this.skinParts.$svgContainer.empty();
this.skinParts.$svg = $(template);
this.skinParts.$name = this.skinParts.$svg.find('.name');
} else {
this.skinParts.$svg.find('g').css('fill-opacity', 1); // Make default circle is white again.
}
this.skinParts.$svgContainer.append(this.skinParts.$svg);
if (this.name) {
if (this.name.length < 8) {
this.skinParts.$name.text(this.name);
} else {
this.skinParts.$name.text(this.name.substring(0, 5).concat('...'));
}
if (this.name.length > 7 || this.highlightColors.length > 1) {
this.skinParts.$svgContainer.popover({
delay: {
show: 150,
hide: 0
},
animation: false,
trigger: 'hover',
content: this.name
});
}
}
// Store the current one as previous for next iteration.
this.prevMetaTypeName = this.metaTypeName;
// If state is InitialState then, the border color is red
if (this.metaTypeName === 'InitialState') {
this.skinParts.$svg.find('circle').css('stroke', 'red');
}
};
<API key>.prototype.setHighlightColors = function (colors) {
this.highlightColors = colors;
this.updateSvg();
};
return <API key>;
}); |
#pragma once
#ifndef <API key>
#define <API key>
#include <bgen_core.h>
#include <functional>
#include <string>
#include "<API key>.h"
#include "bgen_casa_common.h"
using namespace std;
namespace bgen {
namespace casa {
namespace gen {
namespace js {
string map_type_cast (js_type type, const type_info * native_type);
inline string id_to_js (const casa::id_t & id) {
return id_to_string (id, ".");
}
inline string id_to_var_name (const casa::id_t & id) {
return id_to_string (id, "_");
}
struct nspace_node {
using shared = shared_ptr < nspace_node >;
using list = vector < shared >;
string name;
nspace_node (const string & name_v);
list nodes;
vector < shared_ptr < service > > services;
vector < shared_ptr < simple_struct > > structures;
};
class inline_definition : public bgen::gen::element_base {
private:
nspace_node::shared _root;
nspace_node::shared get_parent ( const id_t & id );
void write_struct (bgen::gen::output & out, const shared_ptr < simple_struct > & strt, bool is_last) const;
void write_service (bgen::gen::output & out, const shared_ptr < service > & serv, bool is_last) const;
void write_node_children (bgen::gen::output & out, const shared_ptr < nspace_node > & n) const;
void write_node (bgen::gen::output & out, const shared_ptr < nspace_node > & n, bool is_last) const;
public:
void add (const shared_ptr < casa::simple_struct > & stct);
void add (const shared_ptr < casa::service > & serv);
inline_definition ();
virtual void write (bgen::gen::output & out) const override;
};
class struct_definition : public bgen::gen::group {
private:
string _id;
public:
struct_definition (const string & id);
virtual void write (bgen::gen::output & out) const override;
};
class url_element : public bgen::gen::element_base {
private:
shared_ptr < service > _service;
bool _is_last;
public:
url_element (const shared_ptr < service > & serv, bool is_last);
virtual void write (bgen::gen::output & out) const override;
};
class parser_reader : public bgen::gen::element_base {
private:
shared_ptr < simple_struct > _struct;
public:
parser_reader (const shared_ptr < simple_struct > & stct);
virtual void write (bgen::gen::output & out) const override;
};
class init_element : public bgen::gen::element_base {
private:
const vector < shared_ptr < service > > & _services;
public:
init_element (const vector < shared_ptr < service > > & services);
virtual void write (bgen::gen::output & out) const override;
};
void generate (
casa::type_map & types,
const string & output_file_name,
const string & <API key>
);
}
}
}
}
#endif |
import {Property} from "@tsed/schema";
class Product {
@Property()
id: string;
@Property()
title: string;
constructor({id, title}: Partial<Product> = {}) {
id && (this.id = id);
title && (this.title = title);
}
} |
<template>
<require from="./em-chat-todo.css"></require>
<div class="em-chat-todo" show.bind="actived.show == 'todo'">
<div class="ui basic segment">
<div class="ui big fluid icon input">
<input ref="todoInputRef" value.bind="title" type="text" keyup.delegate="addTodoKeyupHandler($event)"
placeholder="...">
<i title="enter(ctrl)"
class="${(ajax && ajax.readyState != 4) ? 'spinner loading' : 'plus'} link icon"
click.delegate="addTodoHandler()"></i>
</div>
<div class="filter-wrapper">
<div class="ui transparent left icon fluid input">
<input ref="searchInputRef" value.bind="todoFilter" type="text"
keyup.trigger="searchKeyupHandler($event)" blur.trigger="searchBlurHandler()"
focus.trigger="searchFocusHandler()" placeholder="...">
<i class="search icon"></i>
<i ref="searchRemoveRef" click.delegate="clearSearchHandler()" class="remove link icon"></i>
</div>
</div>
<h5 class="ui horizontal divider yellow header" style="margin-top: 10px;">
<!-- <i class="filter link icon"></i> -->
${todos | count:todoFilter:'title'}
</h5>
<div ref="tasksAccRef" class="ui accordion">
<div class="active title">
<i class="dropdown icon"></i>
</div>
<div class="active content">
<div data-priority="ZyJj"
class="ui middle aligned divided selection relaxed list <API key>">
<template repeat.for="item of todos | filter:todoFilter:'title' | sortTodo">
<div data-id="${item.id}" data-sort="${item.sortIndex}" class="item tms-task-item"
if.bind="item.priority == 'ZyJj'">
<div class="actions" show.bind="!item.isEditing">
<i click.delegate="<API key>(item, 'ZyBjj')"
class="large angle down circle link icon" title=""></i>
<i click.delegate="<API key>(item, 'Default')"
class="large angle double down circle link icon" title=""></i>
<i click.delegate="statusDoneHandler(item)" class="large check circle link icon"
title=""></i>
<i class="tms-copy tms-clipboard copy link icon large"
data-clipboard-text="${item.title}" title=""></i>
<div ui-dropdown-action class="ui icon right center pointing dropdown"
title="">
<i class="red large trash outline icon" style="margin-right: 0;"></i>
<div class="menu">
<div style="color: red;" class="item"
click.delegate="delHandler(item, 'todo')">
<i class="trash outline icon"></i></div>
</div>
</div>
</div>
<span data-timeago="${item.updateDate}" class="timeago"
title=" ${item.updateDate | date}">${item.updateDate | timeago}</span>
<i show.bind="!item.isEditing" click.delegate="statusToggleHandler(item)"
class="${item.status == 'Doing' ? 'red checkmark box' : 'square outline'} large link icon"></i>
<i show.bind="!item.isEditing"
class="angle ${item.isOpen ? 'down' : 'right'} ${item.content ? 'black' : ''} link icon"
click.delegate="editContentHandler(item, editTextAreaRef)"></i>
<div show.bind="!item.isEditing" dblclick.delegate="editHandler(item, editInputRef)"
class="content ${item.status == 'Doing' ? 'red' : ''}" title="${item.title}">
${item.title}
</div>
<div show.bind="item.isEditing" class="ui transparent icon fluid input">
<input ref="editInputRef" type="text" value.bind="item.title"
keyup.delegate="updateEnterHandler(item, $event) & key"
blur.trigger="updateHandler(item)">
<i class="plus link icon" click.delegate="updateHandler(item)"></i>
</div>
<div class="ui form" show.bind="item.isOpen">
<div class="field">
<textarea ref="editTextAreaRef" value.bind="item.content" autosize rows="2"
keyup.delegate="updateDescHandler(item) & key:'enter':'ctrl'"
blur.trigger="updateDescHandler(item)" placeholder="..."></textarea>
</div>
</div>
</div>
</template>
</div>
</div>
<div class="title">
<i class="dropdown icon"></i>
</div>
<div class="content">
<div data-priority="ZyBjj"
class="ui middle aligned divided selection relaxed list <API key>">
<template repeat.for="item of todos | filter:todoFilter:'title' | sortTodo">
<div data-id="${item.id}" data-sort="${item.sortIndex}" class="item tms-task-item"
if.bind="item.priority == 'ZyBjj'">
<div class="actions" show.bind="!item.isEditing">
<i click.delegate="<API key>(item, 'ZyJj')"
class="large angle up circle link icon" title=""></i>
<i click.delegate="<API key>(item, 'Default')"
class="large angle down circle link icon" title=""></i>
<i click.delegate="statusDoneHandler(item)" class="large check circle link icon"
title=""></i>
<i class="tms-copy tms-clipboard copy link icon large"
data-clipboard-text="${item.title}" title=""></i>
<div ui-dropdown-action class="ui icon right center pointing dropdown"
title="">
<i class="red large trash outline icon" style="margin-right: 0;"></i>
<div class="menu">
<div style="color: red;" class="item"
click.delegate="delHandler(item, 'todo')">
<i class="trash outline icon"></i></div>
</div>
</div>
</div>
<span data-timeago="${item.updateDate}" class="timeago"
title=" ${item.updateDate | date}">${item.updateDate | timeago}</span>
<i show.bind="!item.isEditing" click.delegate="statusToggleHandler(item)"
class="${item.status == 'Doing' ? 'red checkmark box' : 'square outline'} large link icon"></i>
<i show.bind="!item.isEditing"
class="angle ${item.isOpen ? 'down' : 'right'} ${item.content ? 'black' : ''} link icon"
click.delegate="editContentHandler(item, editTextAreaRef)"></i>
<div show.bind="!item.isEditing" dblclick.delegate="editHandler(item, editInputRef)"
class="content ${item.status == 'Doing' ? 'red' : ''}" title="${item.title}">
${item.title}
</div>
<div show.bind="item.isEditing" class="ui transparent icon fluid input">
<input ref="editInputRef" type="text" value.bind="item.title"
keyup.delegate="updateHandler(item) & key" blur.trigger="updateHandler(item)">
<i class="plus link icon" click.delegate="updateHandler(item)"></i>
</div>
<div class="ui form" show.bind="item.isOpen">
<div class="field">
<textarea ref="editTextAreaRef" value.bind="item.content" autosize rows="2"
keyup.delegate="updateDescHandler(item) & key:'enter':'ctrl'"
blur.trigger="updateDescHandler(item)" placeholder="..."></textarea>
</div>
</div>
</div>
</template>
</div>
</div>
<div class="title">
<i class="dropdown icon"></i>
</div>
<div class="content">
<div data-priority="Default"
class="ui middle aligned divided selection relaxed list <API key>">
<template repeat.for="item of todos | filter:todoFilter:'title' | sortTodo">
<div data-id="${item.id}" data-sort="${item.sortIndex}" class="item tms-task-item"
if.bind="item.priority == 'Default'">
<div class="actions" show.bind="!item.isEditing">
<i click.delegate="<API key>(item, 'ZyJj')"
class="large double angle up circle link icon" title=""></i>
<i click.delegate="<API key>(item, 'ZyBjj')"
class="large angle up circle link icon" title=""></i>
<i click.delegate="statusDoneHandler(item)" class="large check circle link icon"
title=""></i>
<i class="tms-copy tms-clipboard copy link icon large"
data-clipboard-text="${item.title}" title=""></i>
<div ui-dropdown-action class="ui icon right center pointing dropdown"
title="">
<i class="red large trash outline icon" style="margin-right: 0;"></i>
<div class="menu">
<div style="color: red;" class="item"
click.delegate="delHandler(item, 'todo')">
<i class="trash outline icon"></i></div>
</div>
</div>
</div>
<span data-timeago="${item.updateDate}" class="timeago"
title=" ${item.updateDate | date}">${item.updateDate | timeago}</span>
<i show.bind="!item.isEditing" click.delegate="statusToggleHandler(item)"
class="${item.status == 'Doing' ? 'red checkmark box' : 'square outline'} large link icon"></i>
<i show.bind="!item.isEditing"
class="angle ${item.isOpen ? 'down' : 'right'} ${item.content ? 'black' : ''} link icon"
click.delegate="editContentHandler(item, editTextAreaRef)"></i>
<div show.bind="!item.isEditing" dblclick.delegate="editHandler(item, editInputRef)"
class="content ${item.status == 'Doing' ? 'red' : ''}" title="${item.title}">
${item.title}
</div>
<div show.bind="item.isEditing" class="ui transparent icon fluid input">
<input ref="editInputRef" type="text" value.bind="item.title"
keyup.delegate="updateHandler(item) & key" blur.trigger="updateHandler(item)">
<i class="plus link icon" click.delegate="updateHandler(item)"></i>
</div>
<div class="ui form" show.bind="item.isOpen">
<div class="field">
<textarea ref="editTextAreaRef" value.bind="item.content" autosize rows="2"
keyup.delegate="updateDescHandler(item) & key:'enter':'ctrl'"
blur.trigger="updateDescHandler(item)" placeholder="..."></textarea>
</div>
</div>
</div>
</template>
</div>
</div>
</div>
<h5 class="ui horizontal divider green header">
<!-- <i class="check circle icon"></i> -->
<!-- ${dones.length} -->
${totalCnt}
</h5>
<div class="ui middle aligned divided selection relaxed list">
<div repeat.for="item of dones | sort:'updateDate':true" class="item tms-task-item">
<div show.bind="!item.isEditing" class="actions">
<i click.delegate="statusNewHandler(item)" class="large square outline link icon"
title=""></i>
<i class="tms-copy tms-clipboard copy link icon large" data-clipboard-text="${item.title}"
title=""></i>
<div ui-dropdown-action class="ui icon right center pointing dropdown" title="">
<i class="red large trash outline icon" style="margin-right: 0;"></i>
<div class="menu">
<div style="color: red;" class="item" click.delegate="delHandler(item, 'done')"><i
class="trash outline icon"></i></div>
</div>
</div>
</div>
<span data-timeago="${item.updateDate}" class="timeago"
title="${item.updateDate | date}">${item.updateDate | timeago}</span>
<i show.bind="!item.isEditing" class="large check circle icon"></i>
<i show.bind="!item.isEditing"
class="angle ${item.isOpen ? 'down' : 'right'} ${item.content ? 'black' : ''} link icon"
click.delegate="editContentHandler(item, editTextAreaRef)"></i>
<div show.bind="!item.isEditing" dblclick.delegate="editHandler(item, editInputRef)" class="content"
title="${item.title}">
${item.title}
</div>
<div show.bind="item.isEditing" class="ui transparent icon fluid input">
<input ref="editInputRef" type="text" value.bind="item.title"
keyup.delegate="updateHandler(item) & key" blur.trigger="updateHandler(item)">
<i class="plus link icon" click.delegate="updateHandler(item)"></i>
</div>
<div class="ui form" show.bind="item.isOpen">
<div class="field">
<textarea ref="editTextAreaRef" value.bind="item.content" autosize rows="2"
keyup.delegate="updateDescHandler(item) & key:'enter':'ctrl'"
blur.trigger="updateDescHandler(item)" placeholder="..."></textarea>
</div>
</div>
</div>
<div if.bind="!last" click.delegate="loadMoreHandler()"
class="ui basic button tms-load-more ${searchMoreP && searchMoreP.readyState != 4 ? 'tms-disabled2' : ''}">
<i show.bind="searchMoreP && searchMoreP.readyState != 4" class="spinner loading icon"></i>
(${moreCnt})</div>
</div>
</div>
<span if.bind="lock" class="tms-hidden-lock" title="${hidden ? '' : ''}"
click.delegate="ppLockHandler()">
<i class="${hidden ? 'unlock alternate' : 'lock'} link icon"></i>
</span>
</div>
</template> |
Meteor.methods({
updateNode: function(siteName, node) {
console.log('updateNode method:', siteName, node);
var site = Sites.findOne({name:siteName});
if (!site) {
console.log('creating a new site');
siteId = Sites.insert({name:siteName});
} else {
siteId = site._id;
}
node.siteId = siteId;
var node_ = Nodes.findOne({siteId:siteId, deviceId:node.deviceId});
if (node_) {
var node__ = deepmerge(node_, node);
Nodes.update({_id:node_._id}, node__);
} else {
Nodes.insert(node);
}
},
updateNodeConfig: function(deviceId, config) {
var node = Nodes.findOne({deviceId:deviceId});
if (!node) {
console.log("updateNodeConfig failed, can't find node");
return;
}
var node_ = deepmerge(node, {config:config});
Nodes.update({deviceId:deviceId}, node_);
},
setNodeOutput: function(deviceId, param, value) {
console.log('setNodeOutput:', deviceId, param, value);
var set = {}
set["outputs." + param] = value;
Nodes.update({deviceId:deviceId}, {$set:set});
}
}); |
import express from 'express'
import path from 'path'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import hbs from 'hbs'
const app = express()
const __dirname = path.join(dirname(fileURLToPath(import.meta.url)), '../')
app.set('view engine', 'html')
app.set('views', path.join(__dirname, 'views'))
app.engine('html', hbs.__express)
app.get('/', (request, response) => {
response.render('index', { title: 'Stormtroopers API', message: 'Always pass on what you have learned.' })
})
app.get('/loop', (request, response) => {
const movies = [
{ name: 'Episode I: The Phantom Menace', release: 1999 },
{ name: 'Episode II: Attack of the Clones', release: 2002 },
{ name: 'Episode III: Revenge of the Sith', release: 2005 },
{ name: 'Rogue One: A Star Wars Story', release: 2016 },
{ name: 'Episode IV: A New Hope', release: 1977 },
{ name: 'Episode V: The Empire Strikes Back', release: 1980 },
{ name: 'Episode VI: Return of the Jedi', release: 1983 },
{ name: 'Episode VII: The Force Awakens', release: 2015 },
{ name: 'Episode VIII: The Last Jedi', release: 2017 },
{ name: 'Solo: A Star Wars Story', release: 2018 },
{ name: 'Episode IX: The Rise of Skywalker', release: 2019 },
]
response.render('loop', { title: 'Loop page', movies })
})
app.get('/if', (request, response) => {
response.render('if', { title: 'if', is3D: false })
})
app.use(express.static(path.join(__dirname, 'public')))
export default app |
#!/bin/bash
set -euo pipefail
# Copies an AMI to all other regions and outputs a build/mappings.yml file
# Local Usage: .buildkite/steps/copy.sh <linux_ami_id> <windows_ami_id>
copy_ami_to_region() {
local source_image_id="$1"
local source_region="$2"
local <API key>="$3"
local <API key>="$4"
aws ec2 copy-image \
--source-image-id "$source_image_id" \
--source-region "$source_region" \
--name "$<API key>" \
--region "$<API key>" \
--query "ImageId" \
--output text
}
<API key>() {
local image_id="$1"
local region="$2"
local image_state
while true; do
image_state=$(aws ec2 describe-images --region "$region" --image-ids "$image_id" --output text --query 'Images[*].State');
echo "$image_id ($region) is $image_state"
if [[ "$image_state" == "available" ]]; then
break
elif [[ "$image_state" == "pending" ]]; then
sleep 10
else
exit 1
fi
done
}
get_image_name() {
local image_id="$1"
local region="$2"
aws ec2 describe-images \
--image-ids "$image_id" \
--output text \
--region "$region" \
--query 'Images[*].Name'
}
make_ami_public() {
local image_id="$1"
local region="$2"
aws ec2 <API key> \
--region "$region" \
--image-id "$image_id" \
--launch-permission "{\"Add\": [{\"Group\":\"all\"}]}"
}
if [[ -z "${<API key>}" ]] ; then
echo "Must set an s3 bucket in <API key> for temporary files"
exit 1
fi
ALL_REGIONS=(
us-east-1
us-east-2
us-west-1
us-west-2
af-south-1
ap-east-1
ap-south-1
ap-northeast-2
ap-northeast-1
ap-southeast-2
ap-southeast-1
ca-central-1
eu-central-1
eu-west-1
eu-west-2
eu-south-1
eu-west-3
eu-north-1
me-south-1
sa-east-1
)
IMAGES=(
)
# Configuration
<API key>="${1:-}"
<API key>="${1:-}"
<API key>="${2:-}"
source_region="${AWS_REGION}"
mapping_file="build/mappings.yml"
# Read the source images from meta-data if no arguments are provided
if [ $# -eq 0 ] ; then
<API key>=$(buildkite-agent meta-data get "<API key>")
<API key>=$(buildkite-agent meta-data get "<API key>")
<API key>=$(buildkite-agent meta-data get "<API key>")
fi
# If we're not on the master branch or a tag build skip the copy
if [[ $BUILDKITE_BRANCH != "master" ]] && [[ "$BUILDKITE_TAG" != "$BUILDKITE_BRANCH" ]] ; then
echo "--- Skipping AMI copy on non-master/tag branch " >&2
mkdir -p "$(dirname "$mapping_file")"
cat << EOF > "$mapping_file"
Mappings:
AWSRegion2AMI:
${AWS_REGION} : { linuxamd64: $<API key>, linuxarm64: $<API key>, windows: $<API key> }
EOF
exit 0
fi
s3_mappings_cache=$(printf "s3://%s/mappings-%s-%s-%s-%s.yml" \
"${<API key>}" \
"${<API key>}" \
"${<API key>}" \
"${<API key>}" \
"${BUILDKITE_BRANCH}")
# Check if there is a previously copy in the cache bucket
if aws s3 cp "${s3_mappings_cache}" "$mapping_file" ; then
echo "--- Skipping AMI copy, was previously copied"
exit 0
fi
# Get the image names to copy to other regions
<API key>=$(get_image_name "$<API key>" "$source_region")
<API key>=$(get_image_name "$<API key>" "$source_region")
<API key>=$(get_image_name "$<API key>" "$source_region")
# Copy to all other regions
# shellcheck disable=SC2048
for region in ${ALL_REGIONS[*]}; do
if [[ $region != "$source_region" ]] ; then
echo "--- :linux: Copying Linux AMD64 $<API key> to $region" >&2
IMAGES+=("$(copy_ami_to_region "$<API key>" "$source_region" "$region" "${<API key>}-${region}")")
echo "--- :linux: Copying Linux ARM64 $<API key> to $region" >&2
IMAGES+=("$(copy_ami_to_region "$<API key>" "$source_region" "$region" "${<API key>}-${region}")")
echo "--- :windows: Copying Windows AMD64 $<API key> to $region" >&2
IMAGES+=("$(copy_ami_to_region "$<API key>" "$source_region" "$region" "${<API key>}-${region}")")
else
IMAGES+=("$<API key>" "$<API key>" "$<API key>")
fi
done
# Write yaml preamble
mkdir -p "$(dirname "$mapping_file")"
cat << EOF > "$mapping_file"
Mappings:
AWSRegion2AMI:
EOF
echo "--- Waiting for AMIs to become available" >&2
# shellcheck disable=SC2048
for region in ${ALL_REGIONS[*]}; do
<API key>="${IMAGES[0]}"
<API key>="${IMAGES[1]}"
<API key>="${IMAGES[2]}"
<API key> "$<API key>" "$region" >&2
# Make the linux AMI public if it's not the source image
if [[ $<API key> != "$<API key>" ]] ; then
echo ":linux: Making Linux AMD64 ${<API key>} public" >&2
make_ami_public "$<API key>" "$region"
fi
<API key> "$<API key>" "$region" >&2
# Make the linux ARM AMI public if it's not the source image
if [[ $<API key> != "$<API key>" ]] ; then
echo ":linux: Making Linux ARM64 ${<API key>} public" >&2
make_ami_public "$<API key>" "$region"
fi
<API key> "$<API key>" "$region" >&2
# Make the windows AMI public if it's not the source image
if [[ $<API key> != "$<API key>" ]] ; then
echo ":windows: Making Windows AMD64 ${<API key>} public" >&2
make_ami_public "$<API key>" "$region"
fi
# Write yaml to file
echo " $region : { linuxamd64: $<API key>, linuxarm64: $<API key>, windows: $<API key> }" >> "$mapping_file"
# Shift off the processed images
IMAGES=("${IMAGES[@]:3}")
done
echo "--- Uploading mapping to s3 cache"
aws s3 cp "$mapping_file" "${s3_mappings_cache}" |
namespace <API key>
{
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using <API key>;
[TestClass]
public class <API key>
{
[TestMethod]
public void <API key>()
{
LinkedList<int> sequence = new LinkedList<int>(new int[] { 2, -4, 5, 5, 6, -2, -5, -6 });
<API key>.<API key>(sequence);
bool <API key> = <API key>(sequence);
Assert.IsFalse(<API key>);
}
[TestMethod]
public void <API key>()
{
LinkedList<int> sequence = new LinkedList<int>(new int[] { 2, 5, 5, 6, 7 });
bool <API key> = <API key>(sequence);
Assert.IsFalse(<API key>);
}
[TestMethod]
public void <API key>()
{
LinkedList<int> sequence = new LinkedList<int>(new int[] { 2, -4, 5, 5, 6, -2, -5, -6 });
<API key>.<API key>(sequence);
var actual = sequence;
var expected = new LinkedList<int>(new int[] { 2, 5, 5, 6});
CollectionAssert.AreEqual(expected, actual);
}
[TestMethod]
public void <API key>()
{
LinkedList<int> sequence = new LinkedList<int>(new int[] { 2, 2, 3, 5, 6 });
<API key>.<API key>(sequence);
var actual = sequence;
var expected = new LinkedList<int>(new int[] { 2, 2, 3, 5, 6 });
CollectionAssert.AreEqual(expected, actual);
}
private bool <API key>(LinkedList<int> sequence)
{
foreach (var item in sequence)
{
if (item < 0)
{
return true;
}
}
return false;
}
}
} |
package pike
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/stevearc/pike/plog"
)
func remove(stringArr []string, str string) {
for i, s := range stringArr {
if s == str {
stringArr[i] = ""
break
}
}
}
// Glob creates a new source node that reads files from a directory. It
// will search recursively under 'root' for any files that match the patterns. The patterns are standard globs, with one exception. If you place a "!" at the beginning of the pattern, it will find all matching files and *remove* them from the existing set of matched files. You can use this, for example, to match all unminified css files:
// n := pike.Glob("src", "*.css", "!*.min.css")
func Glob(root string, patterns ...string) *Node {
sourceFunc := func(in, out []chan File) {
paths := make([]string, 0, 10)
for _, pattern := range patterns {
if pattern[0] == '!' {
for _, unmatch := range matchRecursive(root, pattern[1:]) {
remove(paths, unmatch)
}
} else {
paths = append(paths, matchRecursive(root, pattern)...)
}
}
seenPaths := make(map[string]bool)
for _, name := range paths {
if name == "" || seenPaths[name] {
continue
}
seenPaths[name] = true
fullpath := filepath.Join(root, name)
data, err := ioutil.ReadFile(fullpath)
if err != nil {
plog.Error("Error reading file %q", fullpath)
continue
}
out[0] <- NewFile(root, name, data)
}
close(out[0])
}
runner := FxnRunnable(sourceFunc)
return NewNode(fmt.Sprintf("%s -> %s", root, strings.Join(patterns, ":")), 0, 0, 1, 1, runner)
}
func matchRecursive(root, pattern string) []string {
paths := make([]string, 0, 10)
fullRoot := root
subRoot, pattern := filepath.Split(pattern)
if subRoot != "" {
fullRoot = filepath.Join(root, subRoot)
}
filepath.Walk(fullRoot, func(path string, info os.FileInfo, err error) error {
if err != nil {
plog.Exc(err)
return nil
}
// Ignore directories
if info.IsDir() {
return nil
}
subpath := path[len(root)+1:]
matched, err := filepath.Match(pattern, filepath.Base(path))
if err != nil {
plog.Exc(err)
return nil
}
if matched {
paths = append(paths, subpath)
}
return nil
})
return paths
} |
'use strict';
//var log = require('debug')('compute_modules:clusterer-kmeans');
var kmeans = require('node-kmeans');
module.exports = class {
constructor() {
}
geoCluster(locsToCluster, numberOfClusters, cb) {
var vectorToCluster = []
locsToCluster.forEach(function (loc) {
vectorToCluster.push([loc.lat, loc.lng]);
});
kmeans.clusterize(vectorToCluster, {k: numberOfClusters}, cb);
}
} |
# ArcNavigationView
# Usage
xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<com.rom4ek.arcnavigationview.ArcNavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:fitsSystemWindows="true"
app:itemBackground="@android:color/white"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/<API key>"
app:arc_cropDirection="cropOutside|cropInside"
app:arc_width="96dp"/>
</android.support.v4.widget.DrawerLayout>
# Sample
## Crop Outside
xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<com.rom4ek.arcnavigationview.ArcNavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:fitsSystemWindows="true"
app:itemBackground="@android:color/white"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/<API key>"
app:arc_cropDirection="cropOutside"
app:arc_width="96dp"/>
</android.support.v4.widget.DrawerLayout>
## Crop Inside
xml
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<com.rom4ek.arcnavigationview.ArcNavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:fitsSystemWindows="true"
app:itemBackground="@android:color/white"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/<API key>"
app:arc_cropDirection="cropInside"
app:arc_width="96dp"/>
</android.support.v4.widget.DrawerLayout>
## Translucent status or navigation bar
Simply add next lines to your ```styles-v21``` folder
xml
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:<API key>">true</item>
<item name="android:<API key>">true</item>
</style>
# Download
In your module's build.gradle file:
groovy
dependencies {
compile 'com.rom4ek:arcnavigationview:1.0.3'
}
# Additionally
ArcNavigationView``` also supports end|right gravity mode for displaying it on the right side of the screen. To prevent child views from cutting I recommend to support right-to-left direction. For that you need:
1. Don't forget to support right-to-left mode by adding ```android:supportsRtl="true"``` inside your ```<application/>``` tag in ```AndroidManifest.xml```.
2. Add ```android:layoutDirection="rtl"``` to ```ArcNavigationView```.
## TODO
* Implement child views re-layout to prevent them from cutting, while using end|right gravity mode with left-to-right direction. |
<?php
declare(strict_types=1);
namespace Mihaeu\PhpDependencies\Dependencies;
use Mihaeu\PhpDependencies\DependencyHelper;
use PHPUnit\Framework\TestCase;
/**
* @covers Mihaeu\PhpDependencies\Dependencies\DependencySet
* @covers Mihaeu\PhpDependencies\Util\AbstractCollection
*/
class DependencySetTest extends TestCase
{
public function testAdd(): void
{
$clazzCollection = (new DependencySet())
->add(new Clazz('Test'));
$clazzCollection->each(function (Dependency $clazz) {
assertEquals(new Clazz('Test'), $clazz);
});
}
public function testIsImmutable(): void
{
$clazzCollection = (new DependencySet())
->add(new Clazz('Test'));
$<API key> = $clazzCollection->add(new Clazz('Test'));
assertNotSame($clazzCollection, $<API key>);
}
public function <API key>(): void
{
$clazzCollection = (new DependencySet())
->add(new Clazz('Test'));
assertEquals($clazzCollection, $clazzCollection->add(new Clazz('Test')));
}
public function testToArray(): void
{
$clazzCollection = (new DependencySet())
->add(new Clazz('Test'));
assertEquals([new Clazz('Test')], $clazzCollection->toArray());
}
public function testToString(): void
{
$clazzCollection = (new DependencySet())
->add(new Clazz('Test'))
->add(new Clazz('Test2'));
assertEquals('Test'.PHP_EOL.'Test2', $clazzCollection->__toString());
}
public function testFilter(): void
{
$expected = DependencyHelper::dependencySet('AB, AC');
assertEquals($expected, DependencyHelper::dependencySet('AB, AC, BA, CA')->filter(function (Dependency $dependency) {
return strpos($dependency->toString(), 'A') === 0;
}));
}
public function testReduce(): void
{
assertEquals('ABC', DependencyHelper::dependencySet('A, B, C')->reduce('', function (string $carry, Dependency $dependency) {
return $carry.$dependency->toString();
}));
}
public function <API key>(): void
{
assertTrue(DependencyHelper::dependencySet('AB, AC, BA, CA')->none(function (Dependency $dependency) {
return strpos($dependency->toString(), 'D') === 0;
}));
}
public function <API key>(): void
{
assertFalse(DependencyHelper::dependencySet('AB, AC, BA, CA')->none(function (Dependency $dependency) {
return strpos($dependency->toString(), 'A') === 0;
}));
}
} |
<section data-ng-controller="<API key>" data-ng-init="findOne()">
<div class="page-header">
<h1 data-ng-bind="assignment.name"></h1>
</div>
<div class="pull-right" data-ng-show="((authentication.user) && (authentication.user._id == assignment.user._id))">
<a class="btn btn-primary" href="/#!/assignments/{{assignment._id}}/edit">
<i class="glyphicon glyphicon-edit"></i>
</a>
<a class="btn btn-primary" data-ng-click="remove();">
<i class="glyphicon glyphicon-trash"></i>
</a>
</div>
<small>
<em class="text-muted">
Posted on
<span data-ng-bind="assignment.created | date:'mediumDate'"></span>
by
<span data-ng-bind="assignment.user.displayName"></span>
</em>
</small>
</section> |
class Solution(object):
def numUniqueEmails(self, emails):
ret = set()
for email in emails:
local, rest = email.split("@")
pos = local.find("+")
if pos >= 0:
local = local[0: pos]
local = local.replace(".", "")
ret.add(local + "@" + rest)
return len(ret)
emails = ["test.email+alex@leetcode.com",
"test.e.mail+bob.cathy@leetcode.com",
"testemail+david@lee.tcode.com"]
sol = Solution()
print(sol.numUniqueEmails(emails)) |
// UCN Particle State class
// 19/08/2010
#ifndef SPIN_H
#define SPIN_H
#include "TObject.h"
#include "TVector3.h"
#include "TComplex.h"
// Spinor - Quantum mechanical Spinor //
class Spinor : public TObject
{
private:
Double_t fUpRe, fUpIm; // Spinor components for Spin 'Up'
Double_t fDownRe, fDownIm; // Spinor components for Spin 'Down'
public:
// -- Constructors
Spinor();
Spinor(const Spinor&);
Spinor& operator=(const Spinor&);
virtual ~Spinor();
// -- Set initial polarisation
void PolariseUp(const TVector3& axis);
void PolariseDown(const TVector3& axis);
Bool_t Precess(const TVector3& avgMagField, const Double_t precessTime);
Double_t CalculateProbSpinUp(const TVector3& axis) const;
virtual void Print(Option_t* option = "") const;
ClassDef(Spinor, 1)
};
// Spin - Spin vector object //
class Spin : public TObject
{
private:
Spinor fSpinor;
public:
// -- Constructors
Spin();
Spin(const Spin&);
Spin& operator=(const Spin&);
virtual ~Spin();
// -- Methods
Bool_t Precess(const TVector3& avgMagField, const Double_t precessTime);
Bool_t IsSpinUp(const TVector3& axis) const;
Double_t CalculateProbSpinUp(const TVector3& axis) const;
// -- Set initial polarisation
Bool_t Polarise(const TVector3& axis, const Bool_t up);
virtual void Print(Option_t* option = "") const;
ClassDef(Spin, 1)
};
#endif /*SPIN_H*/ |
<?php
namespace KnpU\OAuth2ClientBundle\Client\Provider;
use ChrisHemmings\OAuth2\Client\Provider\<API key>;
use KnpU\OAuth2ClientBundle\Client\OAuth2Client;
use League\OAuth2\Client\Token\AccessToken;
class DigitalOceanClient extends OAuth2Client
{
/**
* @return <API key>|\League\OAuth2\Client\Provider\<API key>
*/
public function fetchUserFromToken(AccessToken $accessToken)
{
return parent::fetchUserFromToken($accessToken);
}
/**
* @return <API key>|\League\OAuth2\Client\Provider\<API key>
*/
public function fetchUser()
{
return parent::fetchUser();
}
} |
html {
font-size: var(--base-font-size);
line-height: var(--base-line-height);
height: 100%;
}
body {
font-family: var(--ff-sans);
min-width: 20em;
background: var(--color-ultralight);
color: var(--color-grey);
position: relative;
height: 100%;
-<API key>: touch; /*enables smooth scroll for iOS*/
}
img, object, iframe {
vertical-align: middle;
}
img {
max-width: 100%;
height: auto;
} |
<!DOCTYPE html>
<html lang="en" class=" is-copy-enabled is-u2f-enabled">
<head prefix="og: http://ogp.me/ns
<meta charset='utf-8'>
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/frameworks-<SHA256-like>.css" integrity="<API key>/M=" media="all" rel="stylesheet" />
<link crossorigin="anonymous" href="https://assets-cdn.github.com/assets/github-<SHA256-like>.css" integrity="sha256-emfEB7qikg+bBtr8g/<API key>=" media="all" rel="stylesheet" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Language" content="en">
<meta name="viewport" content="width=device-width">
<title>grunt-uncss/uncss.js at master · addyosmani/grunt-uncss</title>
<link rel="search" type="application/<API key>+xml" href="/opensearch.xml" title="GitHub">
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="57x57" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="60x60" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="72x72" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="76x76" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="114x114" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="120x120" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="144x144" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="152x152" href="/<API key>.png">
<link rel="apple-touch-icon" sizes="180x180" href="/<API key>.png">
<meta property="fb:app_id" content="1401488693436528">
<meta content="https://avatars2.githubusercontent.com/u/110953?v=3&s=400" name="twitter:image:src" /><meta content="@github" name="twitter:site" /><meta content="summary" name="twitter:card" /><meta content="addyosmani/grunt-uncss" name="twitter:title" /><meta content="grunt-uncss - :scissors: A grunt task for removing unused CSS from your projects." name="<TwitterConsumerkey>" />
<meta content="https:
<meta name="browser-stats-url" content="https://api.github.com/_private/browser/stats">
<meta name="browser-errors-url" content="https://api.github.com/_private/browser/errors">
<link rel="assets" href="https://assets-cdn.github.com/">
<link rel="web-socket" href="wss://live.github.com/_sockets/NjA3MTQ1NzozMzYxYjYwMmQ0NjBiM2JiYTk5YTViMGVlN2FjNDc5Njo0ZDYxYmYxMzNiMTk3OTgxYzE4ZDYyZDNkY2I4MGJhZTA5NTE5MDcwZThhMzE3NWYzZmI3NmE2ZDZiYWJjMDVl--<SHA1-like>">
<meta name="pjax-timeout" content="1000">
<link rel="sudo-modal" href="/sessions/sudo_modal">
<meta name="request-id" content="BC55E6F8:4CD7:24A10A7C:583E091D" data-pjax-transient>
<meta name="<API key>" content="/windows-tile.png">
<meta name="<API key>" content="#ffffff">
<meta name="selected-link" value="repo_source" data-pjax-transient>
<meta name="<API key>" content="<API key>">
<meta name="<API key>" content="<API key>">
<meta name="google-analytics" content="UA-3769691-2">
<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="BC55E6F8:4CD7:24A10A7C:583E091D" name="<API key>" /><meta content="6071457" name="octolytics-actor-id" /><meta content="kitesurf" name="<API key>" /><meta content="<SHA256-like>" name="<API key>" />
<meta content="/<user-name>/<repo-name>/blob/show" data-pjax-transient="true" name="analytics-location" />
<meta class="js-ga-set" name="dimension1" content="Logged In">
<meta name="hostname" content="github.com">
<meta name="user-login" content="kitesurf">
<meta name="expected-hostname" content="github.com">
<meta name="<API key>" content="ZGFmNDFkMWYyMWMwOTczYTAwMjRjYWZiMDdiMDYyYmMzNGFmYmM3OTUzM2I4YmNlZjExYzdiOTlkOGJiNWI2Y3x7InJlbW90ZV9hZGRyZXNzIjoiMTg4Ljg1LjIzMC4yNDgiLCJyZXF1ZXN0X2lkIjoiQkM1NUU2Rjg6NENENzoyNEExMEE3Qzo1ODNFMDkxRCIsInRpbWVzdGFtcCI6MTQ4MDQ2MDU3MywiaG9zdCI6ImdpdGh1Yi5jb20ifQ==">
<link rel="mask-icon" href="https://assets-cdn.github.com/pinned-octocat.svg" color="#000000">
<link rel="icon" type="image/x-icon" href="https://assets-cdn.github.com/favicon.ico">
<meta name="html-safe-nonce" content="<SHA1-like>">
<meta content="<SHA1-like>" name="form-nonce" />
<meta http-equiv="x-pjax-version" content="<API key>">
<meta name="description" content="grunt-uncss - :scissors: A grunt task for removing unused CSS from your projects.">
<meta name="go-import" content="github.com/addyosmani/grunt-uncss git https://github.com/addyosmani/grunt-uncss.git">
<meta content="110953" name="<API key>" /><meta content="addyosmani" name="<API key>" /><meta content="12821113" name="<API key>" /><meta content="addyosmani/grunt-uncss" name="<API key>" /><meta content="true" name="<API key>" /><meta content="false" name="<API key>" /><meta content="12821113" name="<API key>" /><meta content="addyosmani/grunt-uncss" name="<API key>" />
<link href="https://github.com/addyosmani/grunt-uncss/commits/master.atom" rel="alternate" title="Recent Commits to grunt-uncss:master" type="application/atom+xml">
<link rel="canonical" href="https://github.com/addyosmani/grunt-uncss/blob/master/tasks/uncss.js" data-pjax-transient>
</head>
<body class="logged-in env-production linux vis-public page-blob">
<div id="js-pjax-loader-bar" class="pjax-loader-bar"><div class="progress"></div></div>
<a href="#start-of-content" tabindex="1" class="accessibility-aid js-skip-to-content">Skip to content</a>
<div class="header header-logged-in true" role="banner">
<div class="container clearfix">
<a class="<API key>" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo">
<svg aria-hidden="true" class="octicon octicon-mark-github" height="28" version="1.1" viewBox="0 0 16 16" width="28"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<div class="header-search scoped-search site-scoped-search js-site-search" role="search">
</option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/search" class="js-site-search-form" <API key>="/addyosmani/grunt-uncss/search" <API key>="/search" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<label class="form-control <API key> <API key>">
<div class="header-search-scope">This repository</div>
<input type="text"
class="form-control header-search-input <API key> <API key> is-clearable"
data-hotkey="s"
name="q"
placeholder="Search"
aria-label="Search this repository"
<API key>="Search GitHub"
<API key>="Search"
autocapitalize="off">
</label>
</form></div>
<ul class="header-nav float-left" role="navigation">
<li class="header-nav-item">
<a href="/pulls" aria-label="Pull requests you created" class="<API key> header-nav-link" data-ga-click="Header, click, Nav menu - item:pulls context:user" data-hotkey="g p" data-selected-links="/pulls /pulls/assigned /pulls/mentioned /pulls">
Pull requests
</a> </li>
<li class="header-nav-item">
<a href="/issues" aria-label="Issues you created" class="<API key> header-nav-link" data-ga-click="Header, click, Nav menu - item:issues context:user" data-hotkey="g i" data-selected-links="/issues /issues/assigned /issues/mentioned /issues">
Issues
</a> </li>
<li class="header-nav-item">
<a class="header-nav-link" href="https://gist.github.com/" data-ga-click="Header, go to gist, text:gist">Gist</a>
</li>
</ul>
<ul class="header-nav user-nav float-right" id="user-links">
<li class="header-nav-item">
<a href="/notifications" aria-label="You have no unread notifications" class="header-nav-link <API key> tooltipped tooltipped-s js-socket-channel <API key>" data-channel="tenant:1:<API key>:6071457" data-ga-click="Header, go to notifications, icon:read" data-hotkey="g n">
<span class="mail-status "></span>
<svg aria-hidden="true" class="octicon octicon-bell" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 12v1H0v-1l.73-.58c.77-.77.81-2.55 1.19-4.42C2.69 3.23 6 2 6 2c0-.55.45-1 1-1s1 .45 1 1c0 0 3.39 1.23 4.16 5 .38 1.88.42 3.66 1.19 4.42l.66.58H14zm-7 4c1.11 0 2-.89 2-2H5c0 1.11.89 2 2 2z"/></svg>
</a>
</li>
<li class="header-nav-item dropdown js-menu-container">
<a class="header-nav-link tooltipped tooltipped-s js-menu-target" href="/new"
aria-label="Create new…"
data-ga-click="Header, create new, icon:add">
<svg aria-hidden="true" class="octicon octicon-plus float-left" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 <API key>"/></svg>
<span class="dropdown-caret"></span>
</a>
<div class="<API key> js-menu-content">
<ul class="dropdown-menu dropdown-menu-sw">
<a class="dropdown-item" href="/new" data-ga-click="Header, create new repository">
New repository
</a>
<a class="dropdown-item" href="/new/import" data-ga-click="Header, import a repository">
Import repository
</a>
<a class="dropdown-item" href="https://gist.github.com/" data-ga-click="Header, create new gist">
New gist
</a>
<a class="dropdown-item" href="/organizations/new" data-ga-click="Header, create new organization">
New organization
</a>
<div class="dropdown-divider"></div>
<div class="dropdown-header">
<span title="addyosmani/grunt-uncss">This repository</span>
</div>
<a class="dropdown-item" href="/addyosmani/grunt-uncss/issues/new" data-ga-click="Header, create new issue">
New issue
</a>
</ul>
</div>
</li>
<li class="header-nav-item dropdown js-menu-container">
<a class="header-nav-link name tooltipped tooltipped-sw js-menu-target" href="/kitesurf"
aria-label="View profile and more"
data-ga-click="Header, show menu, icon:avatar">
<img alt="@kitesurf" class="avatar" height="20" src="https://avatars2.githubusercontent.com/u/6071457?v=3&s=40" width="20" />
<span class="dropdown-caret"></span>
</a>
<div class="<API key> js-menu-content">
<div class="dropdown-menu dropdown-menu-sw">
<div class="dropdown-header <API key> css-truncate">
Signed in as <strong class="css-truncate-target">kitesurf</strong>
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/kitesurf" data-ga-click="Header, go to profile, text:your profile">
Your profile
</a>
<a class="dropdown-item" href="/kitesurf?tab=stars" data-ga-click="Header, go to starred repos, text:your stars">
Your stars
</a>
<a class="dropdown-item" href="/explore" data-ga-click="Header, go to explore, text:explore">
Explore
</a>
<a class="dropdown-item" href="/integrations" data-ga-click="Header, go to integrations, text:integrations">
Integrations
</a>
<a class="dropdown-item" href="https://help.github.com" data-ga-click="Header, go to help, text:help">
Help
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="/settings/profile" data-ga-click="Header, go to settings, icon:settings">
Settings
</a>
</option></form><form accept-charset="UTF-8" action="/logout" class="logout-form" data-form-nonce="<SHA1-like>" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="<API key>/<API key>==" /></div>
<button type="submit" class="dropdown-item dropdown-signout" data-ga-click="Header, sign out, icon:logout">
Sign out
</button>
</form> </div>
</div>
</li>
</ul>
</div>
</div>
<div id="start-of-content" class="accessibility-aid"></div>
<div id="js-flash-container">
</div>
<div role="main">
<div itemscope itemtype="http://schema.org/SoftwareSourceCode">
<div id="<API key>" data-pjax-container>
<div class="pagehead repohead instapaper_ignore readability-menu experiment-repo-nav">
<div class="container <API key>">
<ul class="pagehead-actions">
<li>
</option></form><form accept-charset="UTF-8" action="/notifications/subscribe" class="js-social-container" data-autosubmit="true" data-form-nonce="<SHA1-like>" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="0xN5Kvn/<API key>==" /></div> <input class="form-control" id="repository_id" name="repository_id" type="hidden" value="12821113" />
<div class="select-menu js-menu-container js-select-menu">
<a href="/addyosmani/grunt-uncss/subscription"
class="btn btn-sm btn-with-count select-menu-button js-menu-target" role="button" tabindex="0" aria-haspopup="true"
data-ga-click="Repository, click Watch settings, action:blob#show">
<span class="js-select-button">
<svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
Watch
</span>
</a>
<a class="social-count js-social-count"
href="/addyosmani/grunt-uncss/watchers"
aria-label="127 users are watching this repository">
127
</a>
<div class="<API key>">
<div class="select-menu-modal <API key> js-menu-content" aria-hidden="true">
<div class="select-menu-header <API key>" tabindex="-1">
<svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
<span class="select-menu-title">Notifications</span>
</div>
<div class="select-menu-list <API key>" role="menu">
<div class="select-menu-item js-navigation-item selected" role="menuitem" tabindex="0">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<div class="<API key>">
<input checked="checked" id="do_included" name="do" type="radio" value="included" />
<span class="<API key>">Not watching</span>
<span class="description">Be notified when participating or @mentioned.</span>
<span class="<API key> <API key>">
<svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
Watch
</span>
</div>
</div>
<div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<div class="<API key>">
<input id="do_subscribed" name="do" type="radio" value="subscribed" />
<span class="<API key>">Watching</span>
<span class="description">Be notified of all conversations.</span>
<span class="<API key> <API key>">
<svg aria-hidden="true" class="octicon octicon-eye" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.06 2C3 2 0 8 0 8s3 6 8.06 6C13 14 16 8 16 8s-3-6-7.94-6zM8 12c-2.2 0-4-1.78-4-4 0-2.2 1.8-4 4-4 2.22 0 4 1.8 4 4 0 2.22-1.78 4-4 4zm2-4c0 1.11-.89 2-2 2-1.11 0-2-.89-2-2 0-1.11.89-2 2-2 1.11 0 2 .89 2 2z"/></svg>
Unwatch
</span>
</div>
</div>
<div class="select-menu-item js-navigation-item " role="menuitem" tabindex="0">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<div class="<API key>">
<input id="do_ignore" name="do" type="radio" value="ignore" />
<span class="<API key>">Ignoring</span>
<span class="description">Never be notified.</span>
<span class="<API key> <API key>">
<svg aria-hidden="true" class="octicon octicon-mute" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8 2.81v10.38c0 .67-.81 1-1.28.53L3 10H1c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h2l3.72-3.72C7.19 1.81 8 2.14 8 2.81zm7.53 3.22l-1.06-1.06-1.97 1.97-1.97-1.97-1.06 1.06L11.44 8 9.47 9.97l1.06 1.06 1.97-1.97 1.97 1.97 1.06-1.06L13.56 8l1.97-1.97z"/></svg>
Stop ignoring
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</li>
<li>
<div class="<API key> js-social-container starring-container ">
</option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/unstar" class="starred" data-form-nonce="<SHA1-like>" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="rxZWZaNPGh/Y+dotMvZq+Pzv/9EnzG/<API key>+<API key>==" /></div>
<button
type="submit"
class="btn btn-sm btn-with-count js-toggler-target"
aria-label="Unstar this repository" title="Unstar addyosmani/grunt-uncss"
data-ga-click="Repository, click unstar button, action:blob#show; text:Unstar">
<svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg>
Unstar
</button>
<a class="social-count js-social-count" href="/addyosmani/grunt-uncss/stargazers"
aria-label="3853 users starred this repository">
3,853
</a>
</form>
</option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/star" class="unstarred" data-form-nonce="<SHA1-like>" data-remote="true" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="sJIR49YbDUPof2X/<API key>/<API key>==" /></div>
<button
type="submit"
class="btn btn-sm btn-with-count js-toggler-target"
aria-label="Star this repository" title="Star addyosmani/grunt-uncss"
data-ga-click="Repository, click star button, action:blob#show; text:Star">
<svg aria-hidden="true" class="octicon octicon-star" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M14 6l-4.9-.64L7 1 4.9 5.36 0 6l3.6 3.26L2.67 14 7 11.67 11.33 14l-.93-4.74z"/></svg>
Star
</button>
<a class="social-count js-social-count" href="/addyosmani/grunt-uncss/stargazers"
aria-label="3853 users starred this repository">
3,853
</a>
</form> </div>
</li>
<li>
</option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/fork" class="btn-with-count" data-form-nonce="<SHA1-like>" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="<API key>/<API key>/YK7W6E9Vrng==" /></div>
<button
type="submit"
class="btn btn-sm btn-with-count"
data-ga-click="Repository, show fork modal, action:blob#show; text:Fork"
title="Fork your own copy of addyosmani/grunt-uncss to your account"
aria-label="Fork your own copy of addyosmani/grunt-uncss to your account">
<svg aria-hidden="true" class="octicon octicon-repo-forked" height="16" version="1.1" viewBox="0 0 10 16" width="10"><path fill-rule="evenodd" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
Fork
</button>
</form>
<a href="/addyosmani/grunt-uncss/network" class="social-count"
aria-label="187 users forked this repository">
187
</a>
</li>
</ul>
<h1 class="public ">
<svg aria-hidden="true" class="octicon octicon-repo" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M4 <API key> .55-.45 1-1 1H6v2l-1.5-1.5L3 16v-2H1c-.55 0-1-.45-1-1V1c0-.55.45-1 1-1h10c.55 0 1 .45 1 1zm-1 <API key>"/></svg>
<span class="author" itemprop="author"><a href="/addyosmani" class="url fn" rel="author">addyosmani</a></span><!
--><span class="path-divider">/</span><!--
--><strong itemprop="name"><a href="/addyosmani/grunt-uncss" data-pjax="#<API key>">grunt-uncss</a></strong>
</h1>
</div>
<div class="container">
<nav class="reponav js-repo-nav <API key>"
itemscope
itemtype="http://schema.org/BreadcrumbList"
role="navigation"
data-pjax="#<API key>">
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a href="/addyosmani/grunt-uncss" aria-selected="true" class="<API key> selected reponav-item" data-hotkey="g c" data-selected-links="repo_source repo_downloads repo_commits repo_releases repo_tags repo_branches /addyosmani/grunt-uncss" itemprop="url">
<svg aria-hidden="true" class="octicon octicon-code" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M9.5 3L8 4.5 11.5 8 8 11.5 9.5 13 14 8 9.5 3zm-5 0L0 8l4.5 5L6 11.5 2.5 8 6 4.5 4.5 3z"/></svg>
<span itemprop="name">Code</span>
<meta itemprop="position" content="1">
</a> </span>
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a href="/addyosmani/grunt-uncss/issues" class="<API key> reponav-item" data-hotkey="g i" data-selected-links="repo_issues repo_labels repo_milestones /addyosmani/grunt-uncss/issues" itemprop="url">
<svg aria-hidden="true" class="octicon <API key>" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"/></svg>
<span itemprop="name">Issues</span>
<span class="counter">17</span>
<meta itemprop="position" content="2">
</a> </span>
<span itemscope itemtype="http://schema.org/ListItem" itemprop="itemListElement">
<a href="/addyosmani/grunt-uncss/pulls" class="<API key> reponav-item" data-hotkey="g p" data-selected-links="repo_pulls /addyosmani/grunt-uncss/pulls" itemprop="url">
<svg aria-hidden="true" class="octicon <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"/></svg>
<span itemprop="name">Pull requests</span>
<span class="counter">0</span>
<meta itemprop="position" content="3">
</a> </span>
<a href="/addyosmani/grunt-uncss/projects" class="<API key> reponav-item" data-selected-links="repo_projects new_repo_project repo_project /addyosmani/grunt-uncss/projects">
<svg aria-hidden="true" class="octicon octicon-project" height="16" version="1.1" viewBox="0 0 15 16" width="15"><path fill-rule="evenodd" d="M10 <API key> 4h3V2H2v12zm-1 1h13V1H1v14zM14 0H1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h13a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1z"/></svg>
Projects
<span class="counter">0</span>
</a>
<a href="/addyosmani/grunt-uncss/wiki" class="<API key> reponav-item" data-hotkey="g w" data-selected-links="repo_wiki /addyosmani/grunt-uncss/wiki">
<svg aria-hidden="true" class="octicon octicon-book" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M3 5h4v1H3V5zm0 3h4V7H3v1zm0 <API key> 2h-4v1h4V7zm0 2h-4v1h4V9zm2-6v9c0 .55-.45 1-1 1H9.5l-1 1-1-1H2c-.55 0-1-.45-1-1V3c0-.55.45-1 1-1h5.5l1 1 1-1H15c.55 0 1 .45 1 1zm-8 .5L7.5 3H2v9h6V3.5zm7-.5H9.5l-.5.5V12h6V3z"/></svg>
Wiki
</a>
<a href="/addyosmani/grunt-uncss/pulse" class="<API key> reponav-item" data-selected-links="pulse /addyosmani/grunt-uncss/pulse">
<svg aria-hidden="true" class="octicon octicon-pulse" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M11.5 8L8.8 5.4 6.6 8.5 5.5 1.6 2.38 8H0v2h3.6l.9-1.8.9 5.4L9 8.5l1.6 1.5H14V8z"/></svg>
Pulse
</a>
<a href="/addyosmani/grunt-uncss/graphs" class="<API key> reponav-item" data-selected-links="repo_graphs repo_contributors /addyosmani/grunt-uncss/graphs">
<svg aria-hidden="true" class="octicon octicon-graph" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M16 14v1H0V0h1v14h15zM5 13H3V8h2v5zm4 0H7V3h2v10zm4 0h-2V6h2v7z"/></svg>
Graphs
</a>
</nav>
</div>
</div>
<div class="container <API key> experiment-repo-nav">
<div class="repository-content">
<a href="/addyosmani/grunt-uncss/blob/<SHA1-like>/tasks/uncss.js" class="d-none <API key>" data-hotkey="y">Permalink</a>
<!-- blob contrib key: blob_contributors:v21:<API key> -->
<div class="file-navigation <API key>">
<div class="select-menu branch-select-menu js-menu-container js-select-menu float-left">
<button class="btn btn-sm select-menu-button js-menu-target css-truncate" data-hotkey="w"
type="button" aria-label="Switch branches or tags" tabindex="0" aria-haspopup="true">
<i>Branch:</i>
<span class="js-select-button css-truncate-target">master</span>
</button>
<div class="<API key> js-menu-content <API key>" data-pjax aria-hidden="true">
<div class="select-menu-modal">
<div class="select-menu-header">
<svg aria-label="Close" class="octicon octicon-x js-menu-close" height="16" role="img" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
<span class="select-menu-title">Switch branches/tags</span>
</div>
<div class="select-menu-filters">
<div class="<API key>">
<input type="text" aria-label="Filter branches/tags" id="<API key>" class="form-control js-filterable-field <API key>" placeholder="Filter branches/tags">
</div>
<div class="select-menu-tabs">
<ul>
<li class="select-menu-tab">
<a href="#" data-tab-filter="branches" <API key>="Filter branches/tags" class="js-select-menu-tab" role="tab">Branches</a>
</li>
<li class="select-menu-tab">
<a href="
</li>
</ul>
</div>
</div>
<div class="select-menu-list <API key> <API key>" data-tab-filter="branches" role="menu">
<div data-filterable-for="<API key>" <API key>="substring">
<a class="select-menu-item js-navigation-item js-navigation-open selected"
href="/addyosmani/grunt-uncss/blob/master/tasks/uncss.js"
data-name="master"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target <API key>">
master
</span>
</a>
</div>
<div class="<API key>">Nothing to show</div>
</div>
<div class="select-menu-list <API key> <API key>" data-tab-filter="tags">
<div data-filterable-for="<API key>" <API key>="substring">
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.6.1/tasks/uncss.js"
data-name="v0.6.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.6.1">
v0.6.1
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.6.0/tasks/uncss.js"
data-name="v0.6.0"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.6.0">
v0.6.0
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.5.2/tasks/uncss.js"
data-name="v0.5.2"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.5.2">
v0.5.2
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.5.1/tasks/uncss.js"
data-name="v0.5.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.5.1">
v0.5.1
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.5.0/tasks/uncss.js"
data-name="v0.5.0"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.5.0">
v0.5.0
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.4.4/tasks/uncss.js"
data-name="v0.4.4"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.4.4">
v0.4.4
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.4.3/tasks/uncss.js"
data-name="v0.4.3"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.4.3">
v0.4.3
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.4.2/tasks/uncss.js"
data-name="v0.4.2"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.4.2">
v0.4.2
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.4.1/tasks/uncss.js"
data-name="v0.4.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.4.1">
v0.4.1
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.4.0/tasks/uncss.js"
data-name="v0.4.0"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.4.0">
v0.4.0
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.8/tasks/uncss.js"
data-name="v0.3.8"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.8">
v0.3.8
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.7/tasks/uncss.js"
data-name="v0.3.7"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.7">
v0.3.7
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.6/tasks/uncss.js"
data-name="v0.3.6"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.6">
v0.3.6
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.5/tasks/uncss.js"
data-name="v0.3.5"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.5">
v0.3.5
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.4/tasks/uncss.js"
data-name="v0.3.4"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.4">
v0.3.4
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.3/tasks/uncss.js"
data-name="v0.3.3"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.3">
v0.3.3
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.2/tasks/uncss.js"
data-name="v0.3.2"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.2">
v0.3.2
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.1/tasks/uncss.js"
data-name="v0.3.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.1">
v0.3.1
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.3.0/tasks/uncss.js"
data-name="v0.3.0"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.3.0">
v0.3.0
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.2.2/tasks/uncss.js"
data-name="v0.2.2"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.2.2">
v0.2.2
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.2.1/tasks/uncss.js"
data-name="v0.2.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.2.1">
v0.2.1
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.2.0/tasks/uncss.js"
data-name="v0.2.0"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.2.0">
v0.2.0
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.9/tasks/uncss.js"
data-name="v0.1.9"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.9">
v0.1.9
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.7/tasks/uncss.js"
data-name="v0.1.7"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.7">
v0.1.7
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.6/tasks/uncss.js"
data-name="v0.1.6"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.6">
v0.1.6
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.5/tasks/uncss.js"
data-name="v0.1.5"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.5">
v0.1.5
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.3/tasks/uncss.js"
data-name="v0.1.3"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.3">
v0.1.3
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.2/tasks/uncss.js"
data-name="v0.1.2"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.2">
v0.1.2
</span>
</a>
<a class="select-menu-item js-navigation-item js-navigation-open "
href="/addyosmani/grunt-uncss/tree/v0.1.1/tasks/uncss.js"
data-name="v0.1.1"
data-skip-pjax="true"
rel="nofollow">
<svg aria-hidden="true" class="octicon octicon-check <API key>" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M12 5l-8 8-4-4 1.5-1.5L4 10l6.5-6.5z"/></svg>
<span class="<API key> css-truncate-target" title="v0.1.1">
v0.1.1
</span>
</a>
</div>
<div class="<API key>">Nothing to show</div>
</div>
</div>
</div>
</div>
<div class="BtnGroup float-right">
<a href="/addyosmani/grunt-uncss/find/master"
class="<API key> btn btn-sm BtnGroup-item"
data-pjax
data-hotkey="t">
Find file
</a>
<button aria-label="Copy file path to clipboard" class="js-zeroclipboard btn btn-sm BtnGroup-item tooltipped tooltipped-s" data-copied-hint="Copied!" type="button">Copy path</button>
</div>
<div class="breadcrumb <API key>">
<span class="repo-root js-repo-root"><span class="js-path-segment"><a href="/addyosmani/grunt-uncss"><span>grunt-uncss</span></a></span></span><span class="separator">/</span><span class="js-path-segment"><a href="/addyosmani/grunt-uncss/tree/master/tasks"><span>tasks</span></a></span><span class="separator">/</span><strong class="final-path">uncss.js</strong>
</div>
</div>
<include-fragment class="commit-tease" src="/addyosmani/grunt-uncss/contributors/master/tasks/uncss.js">
<div>
Fetching contributors…
</div>
<div class="<API key>">
<img alt="" class="loader-loading float-left" height="16" src="https://assets-cdn.github.com/images/spinners/<API key>.gif" width="16" />
<span class="loader-error">Cannot retrieve contributors at this time</span>
</div>
</include-fragment>
<div class="file">
<div class="file-header">
<div class="file-actions">
<div class="BtnGroup">
<a href="/addyosmani/grunt-uncss/raw/master/tasks/uncss.js" class="btn btn-sm BtnGroup-item" id="raw-url">Raw</a>
<a href="/addyosmani/grunt-uncss/blame/master/tasks/uncss.js" class="btn btn-sm <API key> BtnGroup-item">Blame</a>
<a href="/addyosmani/grunt-uncss/commits/master/tasks/uncss.js" class="btn btn-sm BtnGroup-item" rel="nofollow">History</a>
</div>
</option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/edit/master/tasks/uncss.js" class="inline-form <API key>" data-form-nonce="<SHA1-like>" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="<API key>/<API key>==" /></div>
<button class="btn-octicon tooltipped tooltipped-nw" type="submit"
aria-label="Fork this project and edit the file" data-hotkey="e" data-disable-with>
<svg aria-hidden="true" class="octicon octicon-pencil" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 0 1 1.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z"/></svg>
</button>
</form> </option></form><form accept-charset="UTF-8" action="/addyosmani/grunt-uncss/delete/master/tasks/uncss.js" class="inline-form" data-form-nonce="<SHA1-like>" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /><input name="authenticity_token" type="hidden" value="7WnX58E2tzo27YDC4ZE2GyAU5iaMc6tYljDrw39RUS3r8Df1PwX9w9WAD4nyn3rN3BjPzzpEFZjzR0Mfl/ePng==" /></div>
<button class="btn-octicon btn-octicon-danger tooltipped tooltipped-nw" type="submit"
aria-label="Fork this project and delete the file" data-disable-with>
<svg aria-hidden="true" class="octicon octicon-trashcan" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 <API key>"/></svg>
</button>
</form> </div>
<div class="file-info">
79 lines (65 sloc)
<span class="file-info-divider"></span>
2.67 KB
</div>
</div>
<div itemprop="text" class="blob-wrapper data type-javascript">
<table class="highlight tab-size <API key>" data-tab-size="8">
<tr>
<td id="L1" class="blob-num js-line-number" data-line-number="1"></td>
</tr>
<tr>
<td id="L8" class="blob-num js-line-number" data-line-number="8"></td>
<td id="LC8" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L9" class="blob-num js-line-number" data-line-number="9"></td>
<td id="LC9" class="blob-code blob-code-inner js-file-line"><span class="pl-s"><span class="pl-pds">'</span>use strict<span class="pl-pds">'</span></span>;</td>
</tr>
<tr>
<td id="L10" class="blob-num js-line-number" data-line-number="10"></td>
<td id="LC10" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L11" class="blob-num js-line-number" data-line-number="11"></td>
<td id="LC11" class="blob-code blob-code-inner js-file-line"><span class="pl-k">var</span> uncss <span class="pl-k">=</span> <span class="pl-c1">require</span>( <span class="pl-s"><span class="pl-pds">'</span>uncss<span class="pl-pds">'</span></span> ),</td>
</tr>
<tr>
<td id="L12" class="blob-num js-line-number" data-line-number="12"></td>
<td id="LC12" class="blob-code blob-code-inner js-file-line"> chalk <span class="pl-k">=</span> <span class="pl-c1">require</span>( <span class="pl-s"><span class="pl-pds">'</span>chalk<span class="pl-pds">'</span></span> ),</td>
</tr>
<tr>
<td id="L13" class="blob-num js-line-number" data-line-number="13"></td>
<td id="LC13" class="blob-code blob-code-inner js-file-line"> maxmin <span class="pl-k">=</span> <span class="pl-c1">require</span>( <span class="pl-s"><span class="pl-pds">'</span>maxmin<span class="pl-pds">'</span></span> ),</td>
</tr>
<tr>
<td id="L14" class="blob-num js-line-number" data-line-number="14"></td>
<td id="LC14" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">async</span> <span class="pl-k">=</span> <span class="pl-c1">require</span>( <span class="pl-s"><span class="pl-pds">'</span>async<span class="pl-pds">'</span></span> );</td>
</tr>
<tr>
<td id="L15" class="blob-num js-line-number" data-line-number="15"></td>
<td id="LC15" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L16" class="blob-num js-line-number" data-line-number="16"></td>
<td id="LC16" class="blob-code blob-code-inner js-file-line"><span class="pl-c1">module</span>.<span class="pl-en">exports</span> <span class="pl-k">=</span> <span class="pl-k">function</span> ( <span class="pl-smi">grunt</span> ) {</td>
</tr>
<tr>
<td id="L17" class="blob-num js-line-number" data-line-number="17"></td>
<td id="LC17" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-en">registerMultiTask</span>( <span class="pl-s"><span class="pl-pds">'</span>uncss<span class="pl-pds">'</span></span>, <span class="pl-s"><span class="pl-pds">'</span>Remove unused CSS<span class="pl-pds">'</span></span>, <span class="pl-k">function</span> () {</td>
</tr>
<tr>
<td id="L18" class="blob-num js-line-number" data-line-number="18"></td>
<td id="LC18" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L19" class="blob-num js-line-number" data-line-number="19"></td>
<td id="LC19" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> done <span class="pl-k">=</span> <span class="pl-v">this</span>.<span class="pl-en">async</span>(),</td>
</tr>
<tr>
<td id="L20" class="blob-num js-line-number" data-line-number="20"></td>
<td id="LC20" class="blob-code blob-code-inner js-file-line"> options <span class="pl-k">=</span> <span class="pl-v">this</span>.<span class="pl-c1">options</span>({</td>
</tr>
<tr>
<td id="L21" class="blob-num js-line-number" data-line-number="21"></td>
<td id="LC21" class="blob-code blob-code-inner js-file-line"> report<span class="pl-k">:</span> <span class="pl-s"><span class="pl-pds">'</span>min<span class="pl-pds">'</span></span></td>
</tr>
<tr>
<td id="L22" class="blob-num js-line-number" data-line-number="22"></td>
<td id="LC22" class="blob-code blob-code-inner js-file-line"> });</td>
</tr>
<tr>
<td id="L23" class="blob-num js-line-number" data-line-number="23"></td>
<td id="LC23" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L24" class="blob-num js-line-number" data-line-number="24"></td>
<td id="LC24" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">function</span> <span class="pl-en">processFile</span> ( <span class="pl-smi">file</span>, <span class="pl-smi">done</span> ) {</td>
</tr>
<tr>
<td id="L25" class="blob-num js-line-number" data-line-number="25"></td>
<td id="LC25" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L26" class="blob-num js-line-number" data-line-number="26"></td>
<td id="LC26" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> src <span class="pl-k">=</span> <span class="pl-smi">file</span>.<span class="pl-smi">src</span>.<span class="pl-en">filter</span>(<span class="pl-k">function</span> ( <span class="pl-smi">filepath</span> ) {</td>
</tr>
<tr>
<td id="L27" class="blob-num js-line-number" data-line-number="27"></td>
<td id="LC27" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (<span class="pl-sr"> <span class="pl-pds">/</span><span class="pl-k">^</span>https<span class="pl-k">?</span>:<span class="pl-cce">\/\/</span><span class="pl-pds">/</span></span>.<span class="pl-c1">test</span>(filepath) ) {</td>
</tr>
<tr>
<td id="L28" class="blob-num js-line-number" data-line-number="28"></td>
<td id="LC28" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// This is a remote file: leave it in src array for uncss to handle.</span></td>
</tr>
<tr>
<td id="L29" class="blob-num js-line-number" data-line-number="29"></td>
<td id="LC29" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-c1">true</span>;</td>
</tr>
<tr>
<td id="L30" class="blob-num js-line-number" data-line-number="30"></td>
<td id="LC30" class="blob-code blob-code-inner js-file-line"> } <span class="pl-k">else</span> <span class="pl-k">if</span> ( <span class="pl-k">!</span><span class="pl-smi">grunt</span>.<span class="pl-smi">file</span>.<span class="pl-en">exists</span>( filepath ) ) {</td>
</tr>
<tr>
<td id="L31" class="blob-num js-line-number" data-line-number="31"></td>
<td id="LC31" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Warn on and remove invalid local source files (if nonull was set).</span></td>
</tr>
<tr>
<td id="L32" class="blob-num js-line-number" data-line-number="32"></td>
<td id="LC32" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">log</span>.<span class="pl-en">warn</span>( <span class="pl-s"><span class="pl-pds">'</span>Source file <span class="pl-pds">'</span></span> <span class="pl-k">+</span> <span class="pl-smi">chalk</span>.<span class="pl-en">cyan</span>( filepath ) <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">'</span> not found.<span class="pl-pds">'</span></span> );</td>
</tr>
<tr>
<td id="L33" class="blob-num js-line-number" data-line-number="33"></td>
<td id="LC33" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-c1">false</span>;</td>
</tr>
<tr>
<td id="L34" class="blob-num js-line-number" data-line-number="34"></td>
<td id="LC34" class="blob-code blob-code-inner js-file-line"> } <span class="pl-k">else</span> {</td>
</tr>
<tr>
<td id="L35" class="blob-num js-line-number" data-line-number="35"></td>
<td id="LC35" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">return</span> <span class="pl-c1">true</span>;</td>
</tr>
<tr>
<td id="L36" class="blob-num js-line-number" data-line-number="36"></td>
<td id="LC36" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L37" class="blob-num js-line-number" data-line-number="37"></td>
<td id="LC37" class="blob-code blob-code-inner js-file-line"> });</td>
</tr>
<tr>
<td id="L38" class="blob-num js-line-number" data-line-number="38"></td>
<td id="LC38" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L39" class="blob-num js-line-number" data-line-number="39"></td>
<td id="LC39" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> ( <span class="pl-smi">src</span>.<span class="pl-c1">length</span> <span class="pl-k">===</span> <span class="pl-c1">0</span> <span class="pl-k">&&</span> <span class="pl-smi">file</span>.<span class="pl-smi">src</span>.<span class="pl-c1">length</span> <span class="pl-k">===</span> <span class="pl-c1">0</span> ) {</td>
</tr>
<tr>
<td id="L40" class="blob-num js-line-number" data-line-number="40"></td>
<td id="LC40" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">fail</span>.<span class="pl-en">warn</span>( <span class="pl-s"><span class="pl-pds">'</span>Destination (<span class="pl-pds">'</span></span> <span class="pl-k">+</span> <span class="pl-smi">file</span>.<span class="pl-smi">dest</span> <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">'</span>) not written because src files were empty.<span class="pl-pds">'</span></span> );</td>
</tr>
<tr>
<td id="L41" class="blob-num js-line-number" data-line-number="41"></td>
<td id="LC41" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L42" class="blob-num js-line-number" data-line-number="42"></td>
<td id="LC42" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L43" class="blob-num js-line-number" data-line-number="43"></td>
<td id="LC43" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">try</span> {</td>
</tr>
<tr>
<td id="L44" class="blob-num js-line-number" data-line-number="44"></td>
<td id="LC44" class="blob-code blob-code-inner js-file-line"> <span class="pl-en">uncss</span>( src, options, <span class="pl-k">function</span> ( <span class="pl-smi">error</span>, <span class="pl-smi">output</span>, <span class="pl-smi">report</span> ) {</td>
</tr>
<tr>
<td id="L45" class="blob-num js-line-number" data-line-number="45"></td>
<td id="LC45" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> ( error ) {</td>
</tr>
<tr>
<td id="L46" class="blob-num js-line-number" data-line-number="46"></td>
<td id="LC46" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">throw</span> error;</td>
</tr>
<tr>
<td id="L47" class="blob-num js-line-number" data-line-number="47"></td>
<td id="LC47" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L48" class="blob-num js-line-number" data-line-number="48"></td>
<td id="LC48" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L49" class="blob-num js-line-number" data-line-number="49"></td>
<td id="LC49" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">file</span>.<span class="pl-c1">write</span>( <span class="pl-smi">file</span>.<span class="pl-smi">dest</span>, output );</td>
</tr>
<tr>
<td id="L50" class="blob-num js-line-number" data-line-number="50"></td>
<td id="LC50" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">log</span>.<span class="pl-c1">writeln</span>(<span class="pl-s"><span class="pl-pds">&
</tr>
<tr>
<td id="L51" class="blob-num js-line-number" data-line-number="51"></td>
<td id="LC51" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> (<span class="pl-k">typeof</span>(<span class="pl-smi">options</span>.<span class="pl-smi">reportFile</span>) <span class="pl-k">!==</span> <span class="pl-s"><span class="pl-pds">'</span>undefined<span class="pl-pds">'</span></span> <span class="pl-k">&&</span> <span class="pl-smi">options</span>.<span class="pl-smi">reportFile</span>.<span class="pl-c1">length</span> <span class="pl-k">></span> <span class="pl-c1">0</span>) {</td>
</tr>
<tr>
<td id="L52" class="blob-num js-line-number" data-line-number="52"></td>
<td id="LC52" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">file</span>.<span class="pl-c1">write</span>(<span class="pl-smi">options</span>.<span class="pl-smi">reportFile</span>, <span class="pl-c1">JSON</span>.<span class="pl-en">stringify</span>(report));</td>
</tr>
<tr>
<td id="L53" class="blob-num js-line-number" data-line-number="53"></td>
<td id="LC53" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L54" class="blob-num js-line-number" data-line-number="54"></td>
<td id="LC54" class="blob-code blob-code-inner js-file-line"> <span class="pl-en">done</span>();</td>
</tr>
<tr>
<td id="L55" class="blob-num js-line-number" data-line-number="55"></td>
<td id="LC55" class="blob-code blob-code-inner js-file-line"> });</td>
</tr>
<tr>
<td id="L56" class="blob-num js-line-number" data-line-number="56"></td>
<td id="LC56" class="blob-code blob-code-inner js-file-line"> } <span class="pl-k">catch</span> ( e ) {</td>
</tr>
<tr>
<td id="L57" class="blob-num js-line-number" data-line-number="57"></td>
<td id="LC57" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">var</span> err <span class="pl-k">=</span> <span class="pl-k">new</span> <span class="pl-en">Error</span>( <span class="pl-s"><span class="pl-pds">'</span>Uncss failed.<span class="pl-pds">'</span></span> );</td>
</tr>
<tr>
<td id="L58" class="blob-num js-line-number" data-line-number="58"></td>
<td id="LC58" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> ( <span class="pl-smi">e</span>.<span class="pl-smi">msg</span> ) {</td>
</tr>
<tr>
<td id="L59" class="blob-num js-line-number" data-line-number="59"></td>
<td id="LC59" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">err</span>.<span class="pl-smi">message</span> <span class="pl-k">+=</span> <span class="pl-s"><span class="pl-pds">'</span>, <span class="pl-pds">'</span></span> <span class="pl-k">+</span> <span class="pl-smi">e</span>.<span class="pl-smi">msg</span> <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">'</span>.<span class="pl-pds">'</span></span>;</td>
</tr>
<tr>
<td id="L60" class="blob-num js-line-number" data-line-number="60"></td>
<td id="LC60" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L61" class="blob-num js-line-number" data-line-number="61"></td>
<td id="LC61" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">err</span>.<span class="pl-smi">origError</span> <span class="pl-k">=</span> e;</td>
</tr>
<tr>
<td id="L62" class="blob-num js-line-number" data-line-number="62"></td>
<td id="LC62" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">log</span>.<span class="pl-en">warn</span>( <span class="pl-s"><span class="pl-pds">'</span>Uncssing source "<span class="pl-pds">'</span></span> <span class="pl-k">+</span> src <span class="pl-k">+</span> <span class="pl-s"><span class="pl-pds">'</span>" failed.<span class="pl-pds">'</span></span> );</td>
</tr>
<tr>
<td id="L63" class="blob-num js-line-number" data-line-number="63"></td>
<td id="LC63" class="blob-code blob-code-inner js-file-line"> <span class="pl-smi">grunt</span>.<span class="pl-smi">fail</span>.<span class="pl-en">warn</span>( err );</td>
</tr>
<tr>
<td id="L64" class="blob-num js-line-number" data-line-number="64"></td>
<td id="LC64" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L65" class="blob-num js-line-number" data-line-number="65"></td>
<td id="LC65" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L66" class="blob-num js-line-number" data-line-number="66"></td>
<td id="LC66" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L67" class="blob-num js-line-number" data-line-number="67"></td>
<td id="LC67" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L68" class="blob-num js-line-number" data-line-number="68"></td>
<td id="LC68" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">if</span> ( <span class="pl-v">this</span>.<span class="pl-smi">files</span>.<span class="pl-c1">length</span> <span class="pl-k">===</span> <span class="pl-c1">1</span> ) {</td>
</tr>
<tr>
<td id="L69" class="blob-num js-line-number" data-line-number="69"></td>
<td id="LC69" class="blob-code blob-code-inner js-file-line"> <span class="pl-en">processFile</span>( <span class="pl-v">this</span>.<span class="pl-smi">files</span>[<span class="pl-c1">0</span>], done );</td>
</tr>
<tr>
<td id="L70" class="blob-num js-line-number" data-line-number="70"></td>
<td id="LC70" class="blob-code blob-code-inner js-file-line"> } <span class="pl-k">else</span> {</td>
</tr>
<tr>
<td id="L71" class="blob-num js-line-number" data-line-number="71"></td>
<td id="LC71" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">// Processing multiple files must be done sequentially</span></td>
</tr>
<tr>
<td id="L72" class="blob-num js-line-number" data-line-number="72"></td>
<td id="LC72" class="blob-code blob-code-inner js-file-line"> <span class="pl-c">
</tr>
<tr>
<td id="L73" class="blob-num js-line-number" data-line-number="73"></td>
<td id="LC73" class="blob-code blob-code-inner js-file-line"> <span class="pl-k">async</span>.<span class="pl-en">eachSeries</span>( <span class="pl-v">this</span>.<span class="pl-smi">files</span>, processFile, done );</td>
</tr>
<tr>
<td id="L74" class="blob-num js-line-number" data-line-number="74"></td>
<td id="LC74" class="blob-code blob-code-inner js-file-line"> }</td>
</tr>
<tr>
<td id="L75" class="blob-num js-line-number" data-line-number="75"></td>
<td id="LC75" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L76" class="blob-num js-line-number" data-line-number="76"></td>
<td id="LC76" class="blob-code blob-code-inner js-file-line"> });</td>
</tr>
<tr>
<td id="L77" class="blob-num js-line-number" data-line-number="77"></td>
<td id="LC77" class="blob-code blob-code-inner js-file-line">
</td>
</tr>
<tr>
<td id="L78" class="blob-num js-line-number" data-line-number="78"></td>
<td id="LC78" class="blob-code blob-code-inner js-file-line">};</td>
</tr>
</table>
</div>
</div>
<button type="button" data-facebox="#jump-to-line" data-facebox-class="linejump" data-hotkey="l" class="d-none">Jump to Line</button>
<div id="jump-to-line" style="display:none">
</option></form><form accept-charset="UTF-8" action="" class="<API key>" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<input class="form-control linejump-input <API key>" type="text" placeholder="Jump to line…" aria-label="Jump to line" autofocus>
<button type="submit" class="btn">Go</button>
</form></div>
</div>
<div class="modal-backdrop js-touch-events"></div>
</div>
</div>
</div>
</div>
<div class="container <API key>">
<div class="site-footer" role="contentinfo">
<ul class="site-footer-links float-right">
<li><a href="https://github.com/contact" data-ga-click="Footer, go to contact, text:contact">Contact GitHub</a></li>
<li><a href="https://developer.github.com" data-ga-click="Footer, go to api, text:api">API</a></li>
<li><a href="https://training.github.com" data-ga-click="Footer, go to training, text:training">Training</a></li>
<li><a href="https://shop.github.com" data-ga-click="Footer, go to shop, text:shop">Shop</a></li>
<li><a href="https://github.com/blog" data-ga-click="Footer, go to blog, text:blog">Blog</a></li>
<li><a href="https://github.com/about" data-ga-click="Footer, go to about, text:about">About</a></li>
</ul>
<a href="https://github.com" aria-label="Homepage" class="site-footer-mark" title="GitHub">
<svg aria-hidden="true" class="octicon octicon-mark-github" height="24" version="1.1" viewBox="0 0 16 16" width="24"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<ul class="site-footer-links">
<li>© 2016 <span title="0.20803s from <API key>.iad.github.net">GitHub</span>, Inc.</li>
<li><a href="https://github.com/site/terms" data-ga-click="Footer, go to terms, text:terms">Terms</a></li>
<li><a href="https://github.com/site/privacy" data-ga-click="Footer, go to privacy, text:privacy">Privacy</a></li>
<li><a href="https://github.com/security" data-ga-click="Footer, go to security, text:security">Security</a></li>
<li><a href="https://status.github.com/" data-ga-click="Footer, go to status, text:status">Status</a></li>
<li><a href="https://help.github.com" data-ga-click="Footer, go to help, text:help">Help</a></li>
</ul>
</div>
</div>
<div id="ajax-error-message" class="ajax-error-message flash flash-error">
<svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 <API key>"/></svg>
<button type="button" class="flash-close js-flash-close <API key>" aria-label="Dismiss error">
<svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
</button>
You can't perform that action at this time.
</div>
<script crossorigin="anonymous" integrity="sha256-fjanzKa4+<API key>/ZxrAUZgpuY=" src="https://assets-cdn.github.com/assets/frameworks-<SHA256-like>.js"></script>
<script async="async" crossorigin="anonymous" integrity="<API key>+C2/wdes3sB5OX+MUIZbtRJ76vXqk=" src="https://assets-cdn.github.com/assets/github-<SHA256-like>.js"></script>
<div class="<API key> stale-session-flash flash flash-warn flash-banner d-none">
<svg aria-hidden="true" class="octicon octicon-alert" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 <API key>"/></svg>
<span class="signed-in-tab-flash">You signed in with another tab or window. <a href="">Reload</a> to refresh your session.</span>
<span class="<API key>">You signed out in another tab or window. <a href="">Reload</a> to refresh your session.</span>
</div>
<div class="facebox" id="facebox" style="display:none;">
<div class="facebox-popup">
<div class="facebox-content" role="dialog" aria-labelledby="facebox-header" aria-describedby="facebox-description">
</div>
<button type="button" class="facebox-close js-facebox-close" aria-label="Close modal">
<svg aria-hidden="true" class="octicon octicon-x" height="16" version="1.1" viewBox="0 0 12 16" width="12"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"/></svg>
</button>
</div>
</div>
</body>
</html> |
using System.Runtime.Serialization;
namespace BingRestServices.DataContracts
{
[DataContract]
public class RoutePath
{
[DataMember(Name = "line", EmitDefaultValue = false)]
public Line Line { get; set; }
[DataMember(Name = "generalizations", EmitDefaultValue = false)]
public Generalization[] Generalizations { get; set; }
}
} |
Pattern: Use of `as-cast` syntax
Issue: -
## Description
Prefer the tradition type casts instead of the new `as-cast` syntax. For
example, prefer `<string>myVariable` instead of `myVariable as string`.
## Further Reading
* [TSLint - prefer-type-cast](https://github.com/microsoft/<API key>/blob/master/README.md#supported-rules) |
<!DOCTYPE html><html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="description">
<meta name="keywords" content="static content generator,static site generator,static site,HTML,web development,.NET,C#,Razor,Markdown,YAML">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/OpenTl.Schema/assets/img/favicon.ico" type="image/x-icon">
<link rel="icon" href="/OpenTl.Schema/assets/img/favicon.ico" type="image/x-icon">
<title>OpenTl.Schema - API - <API key>.UrlAsBinary Property</title>
<link href="/OpenTl.Schema/assets/css/mermaid.css" rel="stylesheet">
<link href="/OpenTl.Schema/assets/css/highlight.css" rel="stylesheet">
<link href="/OpenTl.Schema/assets/css/bootstrap/bootstrap.css" rel="stylesheet">
<link href="/OpenTl.Schema/assets/css/adminlte/AdminLTE.css" rel="stylesheet">
<link href="/OpenTl.Schema/assets/css/theme/theme.css" rel="stylesheet">
<link href="//fonts.googleapis.com/css?family=Roboto+Mono:400,700|Roboto:400,400i,700,700i" rel="stylesheet">
<link href="/OpenTl.Schema/assets/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="/OpenTl.Schema/assets/css/override.css" rel="stylesheet">
<script src="/OpenTl.Schema/assets/js/jquery-2.2.3.min.js"></script>
<script src="/OpenTl.Schema/assets/js/bootstrap.min.js"></script>
<script src="/OpenTl.Schema/assets/js/app.min.js"></script>
<script src="/OpenTl.Schema/assets/js/highlight.pack.js"></script>
<script src="/OpenTl.Schema/assets/js/jquery.slimscroll.min.js"></script>
<script src="/OpenTl.Schema/assets/js/jquery.sticky-kit.min.js"></script>
<script src="/OpenTl.Schema/assets/js/mermaid.min.js"></script>
<!--[if lt IE 9]>
<script src="/OpenTl.Schema/assets/js/html5shiv.min.js"></script>
<script src="/OpenTl.Schema/assets/js/respond.min.js"></script>
<![endif]
</head>
<body class="hold-transition wyam layout-boxed ">
<div class="top-banner"></div>
<div class="wrapper with-container">
<!-- Header -->
<header class="main-header">
<a href="/OpenTl.Schema/" class="logo">
<span>OpenTl.Schema</span>
</a>
<nav class="navbar navbar-static-top" role="navigation">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle visible-xs-block" data-toggle="offcanvas" role="button">
<span class="sr-only">Toggle side menu</span>
<i class="fa <API key>"></i>
</a>
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">Toggle side menu</span>
<i class="fa <API key>"></i>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="/OpenTl.Schema/about.html">About This Project</a></li>
<li class="active"><a href="/OpenTl.Schema/api">API</a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
<!-- Navbar Right Menu -->
</nav>
</header>
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar ">
<section class="infobar" data-spy="affix" data-offset-top="60" data-offset-bottom="200">
<div id="infobar-headings"><h6>On This Page</h6><p><a href="#Summary">Summary</a></p>
<p><a href="#Syntax">Syntax</a></p>
<p><a href="#Attributes">Attributes</a></p>
<p><a href="#Value">Value</a></p>
<hr class="infobar-hidden">
</div>
</section>
<section class="sidebar">
<script src="/OpenTl.Schema/assets/js/lunr.min.js"></script>
<script src="/OpenTl.Schema/assets/js/searchIndex.js"></script>
<div class="sidebar-form">
<div class="input-group">
<input type="text" name="search" id="search" class="form-control" placeholder="Search Types...">
<span class="input-group-btn">
<button class="btn btn-flat"><i class="fa fa-search"></i></button>
</span>
</div>
</div>
<div id="search-results">
</div>
<script>
function runSearch(query){
$("#search-results").empty();
if( query.length < 2 ){
return;
}
var results = searchModule.search("*" + query + "*");
var listHtml = "<ul class='sidebar-menu'>";
listHtml += "<li class='header'>Type Results</li>";
if(results.length == 0 ){
listHtml += "<li>No results found</li>";
} else {
for(var i = 0; i < results.length; ++i){
var res = results[i];
listHtml += "<li><a href='" + res.url + "'>" + htmlEscape(res.title) + "</a></li>";
}
}
listHtml += "</ul>";
$("#search-results").append(listHtml);
}
$(document).ready(function(){
$("#search").on('input propertychange paste', function() {
runSearch($("#search").val());
});
});
function htmlEscape(html) {
return document.createElement('div')
.appendChild(document.createTextNode(html))
.parentNode
.innerHTML;
}
</script>
<hr>
<ul class="sidebar-menu">
<li class="header">Namespace</li>
<li><a href="/OpenTl.Schema/api/OpenTl.Schema">OpenTl<wbr>.Schema</a></li>
<li class="header">Type</li>
<li><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>">T<wbr>Input<wbr>Media<wbr>Photo<wbr>External</a></li>
<li role="separator" class="divider"></li>
<li class="header">Property Members</li>
<li><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>/E3C99268.html">Flags</a></li>
<li><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>/C22046E0.html">TtlSeconds</a></li>
<li><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>/E0CF9A74.html">Url</a></li>
<li class="selected"><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>/15233124.html">UrlAsBinary</a></li>
</ul>
</section>
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<section class="content-header">
<h3><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>">T<wbr>Input<wbr>Media<wbr>Photo<wbr>External</a>.</h3>
<h1>UrlAsBinary <small>Property</small></h1>
</section>
<section class="content">
<h1 id="Summary">Summary</h1>
<div class="lead">Binary representation for the 'Url' property</div>
<div class="panel panel-default">
<div class="panel-body">
<dl class="dl-horizontal">
<dt>Namespace</dt>
<dd><a href="/OpenTl.Schema/api/OpenTl.Schema">OpenTl<wbr>.Schema</a></dd>
<dt>Containing Type</dt>
<dd><a href="/OpenTl.Schema/api/OpenTl.Schema/<API key>">T<wbr>Input<wbr>Media<wbr>Photo<wbr>External</a></dd>
</dl>
</div>
</div>
<h1 id="Syntax">Syntax</h1>
<pre><code>[SerializationOrder(1)]
public byte[] UrlAsBinary { get; set; }</code></pre>
<h1 id="Attributes">Attributes</h1>
<div class="box">
<div class="box-body no-padding table-responsive">
<table class="table table-striped table-hover two-cols">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>Serialization<wbr>Order<wbr>Attribute</td>
<td></td>
</tr>
</tbody></table>
</div>
</div>
<h1 id="Value">Value</h1>
<div class="box">
<div class="box-body no-padding table-responsive">
<table class="table table-striped table-hover two-cols">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody><tr>
<td>byte[]</td>
<td></td>
</tr>
</tbody></table>
</div>
</div>
</section>
</div>
<!-- Footer -->
<footer class="main-footer">
</footer>
</div>
<div class="wrapper bottom-wrapper">
<footer class="bottom-footer">
Generated by <a href="https://wyam.io">Wyam</a>
</footer>
</div>
<a href="javascript:" id="return-to-top"><i class="fa fa-chevron-up"></i></a>
<script>
// Close the sidebar if we select an anchor link
$(".main-sidebar a[href^='#']:not('.expand')").click(function(){
$(document.body).removeClass('sidebar-open');
});
$(document).load(function() {
mermaid.initialize(
{
flowchart:
{
htmlLabels: false,
useMaxWidth:false
}
});
mermaid.init(undefined, ".mermaid")
$('svg').addClass('img-responsive');
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
hljs.<API key>();
// Back to top
$(window).scroll(function() {
if ($(this).scrollTop() >= 200) { // If page is scrolled more than 50px
$('#return-to-top').fadeIn(1000); // Fade in the arrow
} else {
$('#return-to-top').fadeOut(1000); // Else fade out the arrow
}
});
$('#return-to-top').click(function() { // When arrow is clicked
$('body,html').animate({
scrollTop : 0 // Scroll to top of body
}, 500);
});
</script>
</body></html> |
// RuleContainsText.cs
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// all copies or substantial portions of the Software.
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
namespace TriggerSol.Validation
{
public class RuleContainsText : RuleBase
{
public RuleContainsText(string ruleId, string targetProperty, Type targetType) : base(ruleId, targetProperty, targetType)
{
}
public string Text { get; set; }
}
} |
package com.wuest.prefab.structures.config.enums;
public class AdvancedFarmOptions extends BaseOption {
public static AdvancedFarmOptions AutomatedBambooFarm = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.bamboo",
"assets/prefab/structures/<API key>.zip",
"textures/gui/<API key>.png",
false,
true);
public static AdvancedFarmOptions AutomatedBeeFarm = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.bee",
"assets/prefab/structures/automated_bee_farm.zip",
"textures/gui/<API key>.png",
false,
true);
public static AdvancedFarmOptions AutomatedMelonFarm = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.melon",
"assets/prefab/structures/<API key>.zip",
"textures/gui/<API key>.png",
false,
true);
public static AdvancedFarmOptions Barn = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.barn",
"assets/prefab/structures/barn.zip",
"textures/gui/barn_topdown.png",
false,
false);
public static AdvancedFarmOptions GreenHouse = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.green_house",
"assets/prefab/structures/green_house.zip",
"textures/gui/green_house_topdown.png",
false,
false);
public static AdvancedFarmOptions LargeHorseStable = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.horse",
"assets/prefab/structures/<API key>.zip",
"textures/gui/<API key>.png",
false,
false);
public static AdvancedFarmOptions MonsterMasher = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.monster",
"assets/prefab/structures/monster_masher.zip",
"textures/gui/<API key>.png",
false,
true);
public static AdvancedFarmOptions ProduceFarm = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.produce",
"assets/prefab/structures/producefarm.zip",
"textures/gui/<API key>.png",
false,
true);
public static AdvancedFarmOptions TreeFarm = new AdvancedFarmOptions(
"prefab.gui.advanced.farm.tree",
"assets/prefab/structures/treefarm.zip",
"textures/gui/tree_farm_top_down.png",
false,
false);
protected AdvancedFarmOptions(String translationString,
String assetLocation,
String pictureLocation,
boolean hasBedColor,
boolean hasGlassColor) {
super(
translationString,
assetLocation,
pictureLocation,
hasBedColor,
hasGlassColor);
}
} |
module Lexeme
module Language
def self.natural
Proc.new do
token :STOP => /^\.$/
token :COMA => /^,$/
token :QUES => /^\?$/
token :EXCL => /^!$/
token :QUOT => /^"$/
token :APOS => /^'$/
token :WORD => /^[\w\-]+$/
end
end
end
end |
#!/bin/bash
if [[ $(screen -ls|grep foxybot) == "" ]]
then
screen -L -dmS foxybot ./foxyloop.sh
echo "Bot has been started!"
else
echo "Bot already running!"
exit 1
fi
exit 0 |
#ifndef _inffast_c_
#define _inffast_c_
#include "zutil.h"
#include "inftrees.h"
#include "inflate.h"
#include "inffast.h"
#ifndef ASMINF
/* Allow machine dependent optimization for post-increment or pre-increment.
Based on testing to date,
Pre-increment preferred for:
- PowerPC G3 (Adler)
- MIPS R5000 (Randers-Pehrson)
Post-increment preferred for:
- none
No measurable difference:
- Pentium III (Anderson)
- 68060 (Nikl)
*/
#ifdef POSTINC
# define OFF 0
# define PUP(a) *(a)++
#else
# define OFF 1
# define PUP(a) *++(a)
#endif
/*
Decode literal, length, and distance codes and write out the resulting
literal and match bytes until either not enough input or output is
available, an end-of-block is encountered, or a data error is encountered.
When large enough input and output buffers are supplied to inflate(), for
example, a 16K input buffer and a 64K output buffer, more than 95% of the
inflate execution time is spent in this routine.
Entry assumptions:
state->mode == LEN
strm->avail_in >= 6
strm->avail_out >= 258
start >= strm->avail_out
state->bits < 8
On return, state->mode is one of:
LEN -- ran out of enough output space or enough available input
TYPE -- reached end of block code, inflate() to interpret next block
BAD -- error in block data
Notes:
- The maximum input bits used by a length/distance pair is 15 bits for the
length code, 5 bits for the length extra, 15 bits for the distance code,
and 13 bits for the distance extra. This totals 48 bits, or six bytes.
Therefore if strm->avail_in >= 6, then there is enough input to avoid
checking for available input while decoding.
- The maximum bytes that a single length/distance pair can output is 258
bytes, which is the maximum length that can be coded. inflate_fast()
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
void inflate_fast(z_streamp strm, unsigned start)
{
struct inflate_state FAR *state;
unsigned char FAR *in; /* local strm->next_in */
unsigned char FAR *last; /* while in < last, enough input available */
unsigned char FAR *out; /* local strm->next_out */
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
unsigned char FAR *end; /* while out < end, enough space available */
unsigned wsize; /* window size or zero if not using window */
unsigned whave; /* valid bytes in the window */
unsigned write; /* window write index */
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
unsigned long hold; /* local strm->hold */
unsigned bits; /* local strm->bits */
code const FAR *lcode; /* local strm->lencode */
code const FAR *dcode; /* local strm->distcode */
unsigned lmask; /* mask for first level of length codes */
unsigned dmask; /* mask for first level of distance codes */
code thiss; /* retrieved table entry */
unsigned op; /* code bits, operation, extra bits, or */
/* window position, window bytes to copy */
unsigned len; /* match length, unused bytes */
unsigned dist; /* match distance */
unsigned char FAR *from; /* where to copy match from */
/* copy state to local variables */
state = (struct inflate_state FAR *)strm->state;
in = strm->next_in - OFF;
last = in + (strm->avail_in - 5);
out = strm->next_out - OFF;
beg = out - (start - strm->avail_out);
end = out + (strm->avail_out - 257);
wsize = state->wsize;
whave = state->whave;
write = state->write;
window = state->window;
hold = state->hold;
bits = state->bits;
lcode = state->lencode;
dcode = state->distcode;
lmask = (1U << state->lenbits) - 1;
dmask = (1U << state->distbits) - 1;
/* decode literals and length/distances until end-of-block or not enough
input data or output space */
do {
if (bits < 15) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
thiss = lcode[hold & lmask];
dolen:
op = (unsigned)(thiss.bits);
hold >>= op;
bits -= op;
op = (unsigned)(thiss.op);
if (op == 0) { /* literal */
Tracevv((stderr, thiss.val >= 0x20 && thiss.val < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", thiss.val));
PUP(out) = (unsigned char)(thiss.val);
}
else if (op & 16) { /* length base */
len = (unsigned)(thiss.val);
op &= 15; /* number of extra bits */
if (op) {
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
len += (unsigned)hold & ((1U << op) - 1);
hold >>= op;
bits -= op;
}
Tracevv((stderr, "inflate: length %u\n", len));
if (bits < 15) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
thiss = dcode[hold & dmask];
dodist:
op = (unsigned)(thiss.bits);
hold >>= op;
bits -= op;
op = (unsigned)(thiss.op);
if (op & 16) { /* distance base */
dist = (unsigned)(thiss.val);
op &= 15; /* number of extra bits */
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
if (bits < op) {
hold += (unsigned long)(PUP(in)) << bits;
bits += 8;
}
}
dist += (unsigned)hold & ((1U << op) - 1);
hold >>= op;
bits -= op;
Tracevv((stderr, "inflate: distance %u\n", dist));
op = (unsigned)(out - beg); /* max distance in output */
if (dist > op) { /* see if copy from window */
op = dist - op; /* distance back in window */
if (op > whave) {
strm->msg = (char *)"invalid distance too far back";
state->mode = BAD;
break;
}
from = window - OFF;
if (write == 0) { /* very common case */
from += wsize - op;
if (op < len) { /* some from window */
len -= op;
do {
PUP(out) = PUP(from);
} while (--op);
from = out - dist; /* rest from output */
}
}
else if (write < op) { /* wrap around window */
from += wsize + write - op;
op -= write;
if (op < len) { /* some from end of window */
len -= op;
do {
PUP(out) = PUP(from);
} while (--op);
from = window - OFF;
if (write < len) { /* some from start of window */
op = write;
len -= op;
do {
PUP(out) = PUP(from);
} while (--op);
from = out - dist; /* rest from output */
}
}
}
else { /* contiguous in window */
from += write - op;
if (op < len) { /* some from window */
len -= op;
do {
PUP(out) = PUP(from);
} while (--op);
from = out - dist; /* rest from output */
}
}
while (len > 2) {
PUP(out) = PUP(from);
PUP(out) = PUP(from);
PUP(out) = PUP(from);
len -= 3;
}
if (len) {
PUP(out) = PUP(from);
if (len > 1)
PUP(out) = PUP(from);
}
}
else {
from = out - dist; /* copy direct from output */
do { /* minimum length is three */
PUP(out) = PUP(from);
PUP(out) = PUP(from);
PUP(out) = PUP(from);
len -= 3;
} while (len > 2);
if (len) {
PUP(out) = PUP(from);
if (len > 1)
PUP(out) = PUP(from);
}
}
}
else if ((op & 64) == 0) { /* 2nd level distance code */
thiss = dcode[thiss.val + (hold & ((1U << op) - 1))];
goto dodist;
}
else {
strm->msg = (char *)"invalid distance code";
state->mode = BAD;
break;
}
}
else if ((op & 64) == 0) { /* 2nd level length code */
thiss = lcode[thiss.val + (hold & ((1U << op) - 1))];
goto dolen;
}
else if (op & 32) { /* end-of-block */
Tracevv((stderr, "inflate: end of block\n"));
state->mode = TYPE;
break;
}
else {
strm->msg = (char *)"invalid literal/length code";
state->mode = BAD;
break;
}
} while (in < last && out < end);
/* return unused bytes (on entry, bits < 8, so in won't go too far back) */
len = bits >> 3;
in -= len;
bits -= len << 3;
hold &= (1U << bits) - 1;
/* update state and return */
strm->next_in = in + OFF;
strm->next_out = out + OFF;
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
strm->avail_out = (unsigned)(out < end ?
257 + (end - out) : 257 - (out - end));
state->hold = hold;
state->bits = bits;
return;
}
/*
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
- Using bit fields for code structure
- Different op definition to avoid & for extra bits (do & for table bits)
- Three separate decoding do-loops for direct, window, and write == 0
- Special case for distance > 1 copies to do overlapped load and store copy
- Explicit branch predictions (based on measured branch probabilities)
- Deferring match copy and interspersed it with decoding subsequent codes
- Swapping literal/length else
- Swapping window/direct else
- Larger unrolled copy loops (three is about right)
- Moving len -= 3 statement into middle of loop
*/
#endif /* !ASMINF */
#endif |
namespace OggVorbisEncoder.Setup.Templates.FloorBooks
{
public class Line128X4Sub0 : IStaticCodeBook
{
public int Dimensions { get; } = 1;
public byte[] LengthList { get; } = {
2, 2, 2, 2
};
public CodeBookMapType MapType { get; } = CodeBookMapType.None;
public int QuantMin { get; } = 0;
public int QuantDelta { get; } = 0;
public int Quant { get; } = 0;
public int QuantSequenceP { get; } = 0;
public int[] QuantList { get; } = null;
}
} |
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import enUS from './enUS'
import ja from './ja'
const resources = {
'en-US': enUS,
ja: ja
}
i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
fallbackLng: 'en-US',
keySeparator: false, // we do not use keys in form messages.welcome
interpolation: {
escapeValue: false // react already safes from xss
}
})
export default i18n |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.