text
stringlengths 2
1.04M
| meta
dict |
---|---|
import React from 'react';
import { TypeInfo, getPropTypes } from './proptypes';
const Enum = ({ propType }) => (
<span>
{getPropTypes(propType)
.map(({ value }) => value)
.join(' | ')}
</span>
);
Enum.propTypes = {
propType: TypeInfo.isRequired,
};
| {
"content_hash": "46256a280474d6874d5094cecce6d173",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 53,
"avg_line_length": 19.571428571428573,
"alnum_prop": 0.583941605839416,
"repo_name": "rhalff/storybook",
"id": "2de8d4830a877c640bf097feefa214b296173a1e",
"size": "274",
"binary": false,
"copies": "1",
"ref": "refs/heads/addon-actions",
"path": "addons/info/src/components/types/Enum.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2668"
},
{
"name": "HTML",
"bytes": "19272"
},
{
"name": "Java",
"bytes": "2658"
},
{
"name": "JavaScript",
"bytes": "740774"
},
{
"name": "Objective-C",
"bytes": "8846"
},
{
"name": "Python",
"bytes": "3468"
},
{
"name": "Shell",
"bytes": "7425"
},
{
"name": "TypeScript",
"bytes": "30458"
},
{
"name": "Vue",
"bytes": "13203"
}
],
"symlink_target": ""
} |
'use strict';
const parseArgs = require('./args');
const debug = require('debug')('clite');
const getSettings = require('./settings');
const path = require('path');
const findRoot = require('./find-root');
const read = require('./read-stdin');
module.exports = (config, root) => {
const paths = (root ?
[path.join(root, 'node_modules')] :
module.parent.parent.paths).slice(0); // copy
let settings = getSettings(config);
let help = '';
return Promise.all([
parseArgs(process.argv, config),
read(),
findRoot(paths).then(res => root = res),
]).then(res => {
let args = res[0].args;
help = res[0].help;
let body = res[1];
if (!args.$_ && !settings.commands._ && !body) {
var e = new Error('BAD_ARGS');
e.code = 'BAD_ARGS';
return Promise.reject(e);
}
return loadCommand(root, args, body, settings);
}).then(res => {
require('./update')({ root: root });
/* istanbul ignore if */
if (!settings.return && res != undefined) { // jshint ignore:line
return console.log(res);
}
return res;
}).catch(e => {
var promise = Promise.reject(e);
if (e.code === 'BAD_ARGS') {
// show either the configured help or the automatically generated help
promise = loadCommand(root, {
$_: ':::./help', help: true,
}, null, settings).then(res => {
var error = new Error(res); // based on loaded help
error.code = 'BAD_ARGS';
return Promise.reject(error);
}).catch(error => {
if (error.code === 'NO_HELP_CONFIGURED') {
error.code = 'BAD_ARGS';
error.message = help.trim();
}
if (error.code === 'BAD_ARGS' && e.message !== 'BAD_ARGS') {
error.message = `${e.message}\n\n${error.message}`;
}
return Promise.reject(error);
});
}
return promise.catch(e => {
/* istanbul ignore if */
if (!settings.return) {
debug(e.stack);
console.error(e.message);
return process.exit(1);
}
return Promise.reject(e);
});
});
};
function loadCommand(root, args, body, settings) {
var filename = args.$_;
if (!filename) {
var error = new Error('No command given');
error.code = 'NO_COMMAND';
return Promise.reject(error);
}
var internal = filename.indexOf(':::') === 0;
if (internal) {
filename = filename.slice(3);
args.root = root;
debug('loading internal module: %s', filename);
} else {
filename = path.resolve(root, filename);
debug('loading %s', filename);
}
return new Promise(resolve => {
resolve(require(filename));
}).catch(e => {
e.message = `Fatal: command failed to load "${filename}"`;
return Promise.reject(e);
}).then(res => res(args, settings, body)).then(res => {
/* istanbul ignore if */
if (!settings.return && internal) {
console.log(res);
// internal commands always immediately exit
return process.exit(0);
}
return res;
});
} | {
"content_hash": "e54eb6ba40c9d6ddcd800a9cb559180f",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 76,
"avg_line_length": 27.69724770642202,
"alnum_prop": 0.5680688969857569,
"repo_name": "sumifit/hunters",
"id": "49df650f892023090c471aa349989e32fbc96981",
"size": "3019",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "node_modules/alertify.js/node_modules/snyk/node_modules/snyk-resolve-deps/node_modules/clite/lib/index.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "401019"
},
{
"name": "HTML",
"bytes": "3575250"
},
{
"name": "JavaScript",
"bytes": "2816818"
},
{
"name": "PHP",
"bytes": "445524"
}
],
"symlink_target": ""
} |
using System;
using System.IO;
using NUnit.Framework;
using Realms;
using Realms.Exceptions;
using ExplicitAttribute = NUnit.Framework.ExplicitAttribute;
namespace Tests.Database
{
[TestFixture, Preserve(AllMembers = true)]
public class ConfigurationTests
{
private static void ReliesOnEncryption()
{
#if ENCRYPTION_DISABLED
Assert.Ignore("This test relies on encryption which is not enabled in this build");
#endif
}
[Test]
public void DefaultConfigurationShouldHaveValidPath()
{
// Arrange
var config = RealmConfiguration.DefaultConfiguration;
// Assert
Assert.That(Path.IsPathRooted(config.DatabasePath));
}
[Test]
public void CanSetConfigurationPartialPath()
{
// Arrange
var config = RealmConfiguration.DefaultConfiguration.ConfigWithPath("jan" + Path.DirectorySeparatorChar + "docs" + Path.DirectorySeparatorChar);
// Assert
Assert.That(Path.IsPathRooted(config.DatabasePath));
Assert.That(config.DatabasePath, Does.EndWith(Path.Combine("jan", "docs", "default.realm")));
}
[Test]
public void PathIsCanonicalised()
{
// Arrange
var config = RealmConfiguration.DefaultConfiguration.ConfigWithPath(Path.Combine("..", "Documents", "fred.realm"));
// Assert
Assert.That(Path.IsPathRooted(config.DatabasePath));
Assert.That(config.DatabasePath, Does.EndWith(Path.Combine("Documents", "fred.realm")));
Assert.IsFalse(config.DatabasePath.Contains("..")); // our use of relative up and down again was normalised out
}
[Test]
public void CanOverrideConfigurationFilename()
{
// Arrange
var config = new RealmConfiguration();
var config2 = config.ConfigWithPath("fred.realm");
// Assert
Assert.That(config2.DatabasePath, Does.EndWith("fred.realm"));
}
[Test]
public void CanSetDefaultConfiguration()
{
// Arrange
var config = new RealmConfiguration();
RealmConfiguration.DefaultConfiguration = config.ConfigWithPath("fred.realm");
// Assert
Assert.That(RealmConfiguration.DefaultConfiguration.DatabasePath, Does.EndWith("fred.realm"));
}
[Test]
public void EncryptionKeyMustBe64Bytes()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("EncryptionKeyMustBe64Bytes.realm");
var smallKey = new byte[] { 1, 2, 3 };
var bigKey = new byte[656];
// Assert
Assert.Throws<FormatException>(() => config.EncryptionKey = smallKey);
Assert.Throws<FormatException>(() => config.EncryptionKey = bigKey);
}
[Test]
public void ValidEncryptionKeyAccepted()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("ValidEncryptionKeyAcceoted.realm");
var goldilocksKey = new byte[64];
// Assert
Assert.DoesNotThrow(() => config.EncryptionKey = goldilocksKey);
Assert.DoesNotThrow(() => config.EncryptionKey = null);
}
[Test]
public void UnableToOpenWithNoKey()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("UnableToOpenWithNoKey.realm");
Realm.DeleteRealm(config); // ensure guarded from prev tests
var emptyKey = new byte[64];
config.EncryptionKey = emptyKey;
using (Realm.GetInstance(config))
{
}
config.EncryptionKey = null;
// Assert
Assert.Throws<RealmFileAccessErrorException>(() =>
{
using (Realm.GetInstance(config))
{
}
});
}
[Test]
public void UnableToOpenWithKeyIfNotEncrypted()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("UnableToOpenWithKeyIfNotEncrypted.realm");
Realm.DeleteRealm(config); // ensure guarded from prev tests
var openedWithoutKey = Realm.GetInstance(config);
openedWithoutKey.Dispose();
var emptyKey = new byte[64];
config.EncryptionKey = emptyKey;
// Assert
Assert.Throws<RealmFileAccessErrorException>(() =>
{
using (Realm.GetInstance(config))
{
}
});
}
[Test]
public void UnableToOpenWithDifferentKey()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("UnableToOpenWithDifferentKey.realm");
Realm.DeleteRealm(config); // ensure guarded from prev tests
var emptyKey = new byte[64];
config.EncryptionKey = emptyKey;
var openedWithKey = Realm.GetInstance(config);
openedWithKey.Dispose();
config.EncryptionKey[0] = 42;
// Assert
Assert.Throws<RealmFileAccessErrorException>(() =>
{
using (Realm.GetInstance(config))
{
}
});
}
[Test]
public void AbleToReopenEncryptedWithSameKey()
{
ReliesOnEncryption();
// Arrange
var config = new RealmConfiguration("AbleToReopenEncryptedWithSameKey.realm");
Realm.DeleteRealm(config); // ensure guarded from prev tests
var answerKey = new byte[64];
answerKey[0] = 42;
config.EncryptionKey = answerKey;
var openedWithKey = Realm.GetInstance(config);
openedWithKey.Dispose();
var config2 = new RealmConfiguration("AbleToReopenEncryptedWithSameKey.realm");
var answerKey2 = new byte[64];
answerKey2[0] = 42;
config2.EncryptionKey = answerKey2;
// Assert
Assert.DoesNotThrow(() =>
{
using (Realm.GetInstance(config2))
{
}
});
}
[Test]
public void ReadOnlyFilesMustExist()
{
// Arrange
var config = new RealmConfiguration("FileNotThere.realm")
{
IsReadOnly = true
};
// Assert
Assert.Throws<RealmFileNotFoundException>(() =>
{
Realm.GetInstance(config);
});
}
[Test, Explicit("Currently, a RealmMismatchedConfigException is thrown. Registered as #580")]
public void ReadOnlyRealmsWillNotAutoMigrate()
{
// Arrange
var config = new RealmConfiguration("WillBeReadonly.realm");
Realm.DeleteRealm(config); // ensure start clean
config.IsReadOnly = true;
config.SchemaVersion = 42;
TestHelpers.CopyBundledDatabaseToDocuments(
"ForMigrationsToCopyAndMigrate.realm", "WillBeReadonly.realm");
// Assert
Assert.Throws<RealmMigrationNeededException>(() =>
{
Realm.GetInstance(config);
});
}
[Test]
public void ReadOnlyRealmsArentWritable()
{
// Arrange
var config = new RealmConfiguration("WillBeReadonly.realm");
Realm.DeleteRealm(config); // ensure start clean
config.SchemaVersion = 0; // must set version before file can be opened readOnly
using (var openToCreate = Realm.GetInstance(config))
{
openToCreate.Write(() =>
{
openToCreate.Add(new Person());
});
}
config.IsReadOnly = true;
using (var openedReadonly = Realm.GetInstance(config))
{
// Assert
Assert.Throws<RealmInvalidTransactionException>(() =>
{
openedReadonly.Write(() =>
{
openedReadonly.Add(new Person());
});
});
}
}
}
} | {
"content_hash": "70154dc5ca638eb996277cd8e5a20193",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 156,
"avg_line_length": 32.02247191011236,
"alnum_prop": 0.5442105263157895,
"repo_name": "Shaddix/realm-dotnet",
"id": "f8e4b5a873ba20416b1a34b3df0898fdf9b5f262",
"size": "9294",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tests/Tests.Shared/ConfigurationTests.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "1519982"
},
{
"name": "C++",
"bytes": "129713"
},
{
"name": "CMake",
"bytes": "1772"
},
{
"name": "CSS",
"bytes": "4690"
},
{
"name": "HTML",
"bytes": "4054"
},
{
"name": "JavaScript",
"bytes": "4942"
},
{
"name": "Makefile",
"bytes": "8791"
},
{
"name": "PowerShell",
"bytes": "1820"
},
{
"name": "XSLT",
"bytes": "2042"
}
],
"symlink_target": ""
} |
package org.openqa.selenium;
import org.openqa.selenium.internal.BuildInfo;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
public class WebDriverException extends RuntimeException {
public static final String SESSION_ID = "Session ID";
public static final String DRIVER_INFO = "Driver info";
protected static final String BASE_SUPPORT_URL = "http://seleniumhq.org/exceptions/";
private Map<String, String> extraInfo = new HashMap<>();
public WebDriverException() {
super();
}
public WebDriverException(String message) {
super(message);
}
public WebDriverException(Throwable cause) {
super(cause);
}
public WebDriverException(String message, Throwable cause) {
super(message, cause);
}
@Override
public String getMessage() {
return super.getCause() instanceof WebDriverException
? super.getMessage() : createMessage(super.getMessage());
}
private String createMessage(String originalMessageString) {
String supportMessage = getSupportUrl() == null ?
"" : "For documentation on this error, please visit: " + getSupportUrl() + "\n";
return (originalMessageString == null ? "" : originalMessageString + "\n")
+ supportMessage
+ getBuildInformation() + "\n"
+ getSystemInformation()
+ getAdditionalInformation();
}
public String getSystemInformation() {
String host = "N/A";
String ip = "N/A";
try{
host = InetAddress.getLocalHost().getHostName();
ip = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException throw_away) {}
return String.format("System info: host: '%s', ip: '%s', os.name: '%s', os.arch: '%s', os.version: '%s', java.version: '%s'",
host,
ip,
System.getProperty("os.name"),
System.getProperty("os.arch"),
System.getProperty("os.version"),
System.getProperty("java.version"));
}
public String getSupportUrl() {
return null;
}
public BuildInfo getBuildInformation() {
return new BuildInfo();
}
public static String getDriverName(StackTraceElement[] stackTraceElements) {
String driverName = "unknown";
for (StackTraceElement e : stackTraceElements) {
if (e.getClassName().endsWith("Driver")) {
String[] bits = e.getClassName().split("\\.");
driverName = bits[bits.length - 1];
}
}
return driverName;
}
public void addInfo(String key, String value) {
extraInfo.put(key, value);
}
public String getAdditionalInformation() {
if (! extraInfo.containsKey(DRIVER_INFO)) {
extraInfo.put(DRIVER_INFO, "driver.version: " + getDriverName(getStackTrace()));
}
String result = "";
for (Map.Entry<String, String> entry : extraInfo.entrySet()) {
if (entry.getValue() != null && entry.getValue().startsWith(entry.getKey())) {
result += "\n" + entry.getValue();
} else {
result += "\n" + entry.getKey() + ": " + entry.getValue();
}
}
return result;
}
}
| {
"content_hash": "2f2c5bafe4da95d7ac25d515ff91921c",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 129,
"avg_line_length": 28.564814814814813,
"alnum_prop": 0.6521880064829821,
"repo_name": "gurayinan/selenium",
"id": "2665d40746ab3c7a86d6213d9f9ecba3a2c93a3e",
"size": "3889",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "java/client/src/org/openqa/selenium/WebDriverException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "825"
},
{
"name": "Batchfile",
"bytes": "307"
},
{
"name": "C",
"bytes": "62040"
},
{
"name": "C#",
"bytes": "2761258"
},
{
"name": "C++",
"bytes": "1900856"
},
{
"name": "CSS",
"bytes": "27283"
},
{
"name": "HTML",
"bytes": "1840822"
},
{
"name": "Java",
"bytes": "4427396"
},
{
"name": "JavaScript",
"bytes": "4993982"
},
{
"name": "Makefile",
"bytes": "4655"
},
{
"name": "Objective-C",
"bytes": "4376"
},
{
"name": "Python",
"bytes": "712369"
},
{
"name": "Ragel",
"bytes": "3086"
},
{
"name": "Ruby",
"bytes": "723482"
},
{
"name": "Shell",
"bytes": "3456"
},
{
"name": "XSLT",
"bytes": "1047"
}
],
"symlink_target": ""
} |
import React from 'react';
import ReactDOM from 'react-dom';
import Menu, { SubMenu, Item as MenuItem } from 'rc-menu';
import closest from 'dom-closest';
import classNames from 'classnames';
import Dropdown from '../dropdown';
import Icon from '../icon';
import Checkbox from '../checkbox';
import Radio from '../radio';
import FilterDropdownMenuWrapper from './FilterDropdownMenuWrapper';
export interface FilterMenuProps {
locale: any;
selectedKeys: string[];
column: {
filterMultiple?: boolean,
filterDropdown?: React.ReactNode,
filters?: { text: string; value: string, children?: any[] }[],
filterDropdownVisible?: boolean,
onFilterDropdownVisibleChange?: (visible: boolean) => any,
fixed?: boolean | string,
filterIcon?: React.ReactNode;
};
confirmFilter: (column: Object, selectedKeys: string[]) => any;
prefixCls: string;
dropdownPrefixCls: string;
}
export default class FilterMenu extends React.Component<FilterMenuProps, any> {
static defaultProps = {
handleFilter() {},
column: {},
};
neverShown: boolean;
constructor(props) {
super(props);
const visible = ('filterDropdownVisible' in props.column) ?
props.column.filterDropdownVisible : false;
this.state = {
selectedKeys: props.selectedKeys,
keyPathOfSelectedItem: {}, // 记录所有有选中子菜单的祖先菜单
visible,
};
}
componentDidMount() {
const { column } = this.props;
const rootNode = ReactDOM.findDOMNode(this);
const filterBelongToScrollBody = !!closest(rootNode, `.ant-table-scroll`);
if (filterBelongToScrollBody && column.fixed) {
// When fixed column have filters, there will be two dropdown menus
// Filter dropdown menu inside scroll body should never be shown
// To fix https://github.com/ant-design/ant-design/issues/5010
this.neverShown = true;
}
}
componentWillReceiveProps(nextProps) {
const { column } = nextProps;
const newState = {} as {
selectedKeys: string[];
visible: boolean;
};
if ('selectedKeys' in nextProps) {
newState.selectedKeys = nextProps.selectedKeys;
}
if ('filterDropdownVisible' in column) {
newState.visible = column.filterDropdownVisible;
}
if (Object.keys(newState).length > 0) {
this.setState(newState);
}
}
setSelectedKeys = ({ selectedKeys }) => {
this.setState({ selectedKeys });
}
setVisible(visible) {
const { column } = this.props;
if (!('filterDropdownVisible' in column)) {
this.setState({ visible });
}
if (column.onFilterDropdownVisibleChange) {
column.onFilterDropdownVisibleChange(visible);
}
}
handleClearFilters = () => {
this.setState({
selectedKeys: [],
}, this.handleConfirm);
}
handleConfirm = () => {
this.setVisible(false);
this.confirmFilter();
}
onVisibleChange = (visible) => {
this.setVisible(visible);
if (!visible) {
this.confirmFilter();
}
}
confirmFilter() {
if (this.state.selectedKeys !== this.props.selectedKeys) {
this.props.confirmFilter(this.props.column, this.state.selectedKeys);
}
}
renderMenuItem(item) {
const { column } = this.props;
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
const input = multiple ? (
<Checkbox checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
) : (
<Radio checked={this.state.selectedKeys.indexOf(item.value.toString()) >= 0} />
);
return (
<MenuItem key={item.value}>
{input}
<span>{item.text}</span>
</MenuItem>
);
}
hasSubMenu() {
const { column: { filters = [] } } = this.props;
return filters.some(item => !!(item.children && item.children.length > 0));
}
renderMenus(items) {
return items.map(item => {
if (item.children && item.children.length > 0) {
const { keyPathOfSelectedItem } = this.state;
const containSelected = Object.keys(keyPathOfSelectedItem).some(
key => keyPathOfSelectedItem[key].indexOf(item.value) >= 0,
);
const subMenuCls = containSelected ? `${this.props.dropdownPrefixCls}-submenu-contain-selected` : '';
return (
<SubMenu title={item.text} className={subMenuCls} key={item.value.toString()}>
{this.renderMenus(item.children)}
</SubMenu>
);
}
return this.renderMenuItem(item);
});
}
handleMenuItemClick = (info) => {
if (info.keyPath.length <= 1) {
return;
}
const keyPathOfSelectedItem = this.state.keyPathOfSelectedItem;
if (this.state.selectedKeys.indexOf(info.key) >= 0) {
// deselect SubMenu child
delete keyPathOfSelectedItem[info.key];
} else {
// select SubMenu child
keyPathOfSelectedItem[info.key] = info.keyPath;
}
this.setState({ keyPathOfSelectedItem });
}
renderFilterIcon = () => {
const { column, locale, prefixCls } = this.props;
const filterIcon = column.filterIcon as any;
const dropdownSelectedClass = this.props.selectedKeys.length > 0 ? `${prefixCls}-selected` : '';
return filterIcon ? React.cloneElement(filterIcon as any, {
title: locale.filterTitle,
className: classNames(filterIcon.className, {
[`${prefixCls}-icon`]: true,
}),
}) : <Icon title={locale.filterTitle} type="filter" className={dropdownSelectedClass} />;
}
render() {
const { column, locale, prefixCls, dropdownPrefixCls } = this.props;
// default multiple selection in filter dropdown
const multiple = ('filterMultiple' in column) ? column.filterMultiple : true;
const dropdownMenuClass = classNames({
[`${dropdownPrefixCls}-menu-without-submenu`]: !this.hasSubMenu(),
});
const menus = column.filterDropdown ? (
<FilterDropdownMenuWrapper>
{column.filterDropdown}
</FilterDropdownMenuWrapper>
) : (
<FilterDropdownMenuWrapper className={`${prefixCls}-dropdown`}>
<Menu
multiple={multiple}
onClick={this.handleMenuItemClick}
prefixCls={`${dropdownPrefixCls}-menu`}
className={dropdownMenuClass}
onSelect={this.setSelectedKeys}
onDeselect={this.setSelectedKeys}
selectedKeys={this.state.selectedKeys}
>
{this.renderMenus(column.filters)}
</Menu>
<div className={`${prefixCls}-dropdown-btns`}>
<a
className={`${prefixCls}-dropdown-link confirm`}
onClick={this.handleConfirm}
>
{locale.filterConfirm}
</a>
<a
className={`${prefixCls}-dropdown-link clear`}
onClick={this.handleClearFilters}
>
{locale.filterReset}
</a>
</div>
</FilterDropdownMenuWrapper>
);
return (
<Dropdown
trigger={['click']}
overlay={menus}
visible={this.neverShown ? false : this.state.visible}
onVisibleChange={this.onVisibleChange}
getPopupContainer={triggerNode => triggerNode.parentNode as HTMLElement}
>
{this.renderFilterIcon()}
</Dropdown>
);
}
}
| {
"content_hash": "9d9b24ef6fed875cec73321d238bb20a",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 109,
"avg_line_length": 30.476793248945146,
"alnum_prop": 0.6311781808112973,
"repo_name": "mitchelldemler/ant-design",
"id": "d5b012227add136bfbc0d78f16e568f55f08a93a",
"size": "7253",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/table/filterDropdown.tsx",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "356675"
},
{
"name": "HTML",
"bytes": "4859"
},
{
"name": "JavaScript",
"bytes": "178713"
},
{
"name": "Shell",
"bytes": "238"
},
{
"name": "TypeScript",
"bytes": "364361"
}
],
"symlink_target": ""
} |
//
// BBCommonMetrics.m
// BHP
//
// Created by Samuel on 14-9-11.
// Copyright (c) 2014年 Samuel. All rights reserved.
//
#import "BBCoreMetrics.h"
CGRect BBScreenBounds(void) {
return [[UIScreen mainScreen] bounds];
}
CGFloat BBScreenHeight(void) {
return [[UIScreen mainScreen] bounds].size.height;
}
CGFloat BBScreenWidth(void) {
return [[UIScreen mainScreen] bounds].size.width;
}
CGRect BBContentFrame(void) {
return [[UIScreen mainScreen] applicationFrame];
}
CGFloat BBContentHeight(void) {
return [[UIScreen mainScreen] applicationFrame].size.height;
}
CGFloat BBContentWidth(void) {
return [[UIScreen mainScreen] applicationFrame].size.width;
}
CGFloat BBNavigationBarHeight(void)
{
return 44.0f;
}
CGFloat BBTabBarHeight(void)
{
return 49.0f;
}
CGFloat BBStatusBarHeight(void)
{
return [UIApplication sharedApplication].statusBarFrame.size.height;
}
CGFloat BBScreenScale(void)
{
return [[UIScreen mainScreen] scale];
}
CGFloat BBAdaptiveCofficient()
{
static CGFloat coffient = 0;
if (coffient == 0)
{
coffient = BBScreenWidth()/320.0;
coffient = [[NSString stringWithFormat:@"%.2f",coffient] floatValue];
}
return coffient;
}
CGFloat BBAdjustedWH(CGFloat wh)
{
return wh * BBAdaptiveCofficient();
}
CGFloat BBDefaultValueWidth(UIFont *font)
{
NSString *string = @"-10.00%";
NSDictionary *attributes = @{NSFontAttributeName: font};
return [string sizeWithAttributes:attributes].width;
}
| {
"content_hash": "505a23e9659e2cd548df984e23cf7fe8",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 77,
"avg_line_length": 17.870588235294118,
"alnum_prop": 0.7004608294930875,
"repo_name": "ddrdjboy/BBSpeed",
"id": "5231149569d6b78e77d454fe0a7eaead12b6d062",
"size": "1521",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BBSpeed/UIKit/Core/BBCoreMetrics.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "23865"
},
{
"name": "Objective-C",
"bytes": "1342684"
},
{
"name": "Ruby",
"bytes": "4206"
},
{
"name": "Shell",
"bytes": "9130"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/greengrass/Greengrass_EXPORTS.h>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace Greengrass
{
namespace Model
{
class AWS_GREENGRASS_API UpdateLoggerDefinitionResult
{
public:
UpdateLoggerDefinitionResult();
UpdateLoggerDefinitionResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
UpdateLoggerDefinitionResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
};
} // namespace Model
} // namespace Greengrass
} // namespace Aws
| {
"content_hash": "a30927588d7e06c9c3806055cc080f1b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 116,
"avg_line_length": 20.606060606060606,
"alnum_prop": 0.7647058823529411,
"repo_name": "JoyIfBam5/aws-sdk-cpp",
"id": "976ea74fafcbec82ed20efbdf66762af3d58be24",
"size": "1253",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-greengrass/include/aws/greengrass/model/UpdateLoggerDefinitionResult.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "11868"
},
{
"name": "C++",
"bytes": "167818064"
},
{
"name": "CMake",
"bytes": "591577"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "271801"
},
{
"name": "Python",
"bytes": "85650"
},
{
"name": "Shell",
"bytes": "5277"
}
],
"symlink_target": ""
} |
<div id=timeline-view-selection-div>
<ul>
<li id=timeline-view-open-sockets><label><input type=checkbox checked />
█ <span class=timeline-view-text>Open sockets</span></label>
</input></li>
<li id=timeline-view-in-use-sockets><label><input type=checkbox checked />
█ <span class=timeline-view-text>In use sockets</span></label>
</input></li>
<li id=timeline-view-url-requests><label><input type=checkbox checked />
█ <span class=timeline-view-text>URL requests</span></label>
</input></li>
<li id=timeline-view-dns-requests><label><input type=checkbox checked />
█ <span class=timeline-view-text>DNS requests</span></label>
</input></li>
<li id=timeline-view-bytes-received><label><input type=checkbox checked />
█ <span class=timeline-view-text>Bytes received</span></label>
</input></li>
<li id=timeline-view-bytes-sent><label><input type=checkbox checked />
█ <span class=timeline-view-text>Bytes sent</span></label>
</input></li>
<li id=timeline-view-disk-cache-bytes-read><label><input type=checkbox checked />
█ <span class=timeline-view-text>Disk cache bytes read</span></label>
</input></li>
<li id=timeline-view-disk-cache-bytes-written><label><input type=checkbox />
█ <span class=timeline-view-text>Disk cache bytes written</span></label>
</input></li>
</ul>
</div>
<div id=timeline-view-vertical-splitter class=vertical-splitter></div>
<div id=timeline-view-graph-div>
<canvas id=timeline-view-graph-canvas>
</canvas>
</div>
<div id=timeline-view-scrollbar-div>
<div id=timeline-view-scrollbar-inner-div>
</div>
</div>
| {
"content_hash": "996a7e0d3dce7154c52f211096f4b40b",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 83,
"avg_line_length": 44.62162162162162,
"alnum_prop": 0.6977589339794065,
"repo_name": "aYukiSekiguchi/ACCESS-Chromium",
"id": "6805398924740b5ba417fb9143c35866769fc8c2",
"size": "1651",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "chrome/browser/resources/net_internals/timeline_view.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "1174606"
},
{
"name": "C",
"bytes": "65916105"
},
{
"name": "C++",
"bytes": "113472993"
},
{
"name": "F#",
"bytes": "381"
},
{
"name": "Go",
"bytes": "10440"
},
{
"name": "Java",
"bytes": "11354"
},
{
"name": "JavaScript",
"bytes": "8864255"
},
{
"name": "Objective-C",
"bytes": "8990130"
},
{
"name": "PHP",
"bytes": "97796"
},
{
"name": "Perl",
"bytes": "903036"
},
{
"name": "Python",
"bytes": "5269405"
},
{
"name": "R",
"bytes": "524"
},
{
"name": "Shell",
"bytes": "4123452"
},
{
"name": "Tcl",
"bytes": "277077"
}
],
"symlink_target": ""
} |
#include "XmlItemAbstractListModel.h"
#include <QDebug>
#include "XmlItem.h"
XmlItemAbstractListModel::XmlItemAbstractListModel(XmlItem* xmlItemPrototype, QObject *parent) :
QAbstractListModel(parent),
m_list(QList<XmlItem*>()),
m_xmlItemPrototype(xmlItemPrototype)
{
}
XmlItemAbstractListModel::~XmlItemAbstractListModel()
{
delete m_xmlItemPrototype;
clear();
}
int XmlItemAbstractListModel::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return m_list.size();
}
void XmlItemAbstractListModel::clear()
{
beginResetModel();
qDeleteAll(m_list);
m_list.clear();
endResetModel();
}
QVariant XmlItemAbstractListModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= m_list.size())
return QVariant();
return m_list.at(index.row())->data(role);
}
bool XmlItemAbstractListModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if (index.row() < 0 || index.row() >= m_list.size())
return false;
bool result = m_list.at(index.row())->setData(value, role);
if (result)
emit dataChanged(index, index);
return result;
}
bool XmlItemAbstractListModel::contains(XmlItem *xmlItem) const
{
for(int row = 0; row < m_list.size(); ++row) {
if (m_list.at(row)->isEqual(xmlItem))
return true;
}
return false;
}
bool XmlItemAbstractListModel::isEmpty() const
{
return rowCount() == 0;
}
void XmlItemAbstractListModel::appendXmlItem(XmlItem *xmlItem)
{
beginInsertRows(QModelIndex(), m_list.size(), m_list.size());
m_list.append(xmlItem);
endInsertRows();
}
void XmlItemAbstractListModel::preprendXmlItem(XmlItem *xmlItem)
{
beginInsertRows(QModelIndex(), 0, 0);
m_list.prepend(xmlItem);
endInsertRows();
}
void XmlItemAbstractListModel::appendXmlItems(QList<XmlItem *> xmlItemsList)
{
beginInsertRows(QModelIndex(), m_list.size(), m_list.size() + xmlItemsList.size() - 1);
m_list.append(xmlItemsList);
endInsertRows();
}
void XmlItemAbstractListModel::removeXmlItemAt(int row)
{
beginRemoveRows(QModelIndex(), row, row);
m_list.removeAt(row);
endRemoveRows();
}
void XmlItemAbstractListModel::deleteXmlItems(const QVariant &value, int role)
{
QMutableListIterator<XmlItem*> iterator(m_list);
XmlItem* xmlItem;
beginResetModel();
while (iterator.hasNext()) {
xmlItem = iterator.next();
if (xmlItem->data(role) == value) {
iterator.remove();
delete xmlItem;
}
}
endResetModel();
}
XmlItem* XmlItemAbstractListModel::itemAt(int row)
{
if (row < 0 || row >= m_list.size())
return NULL;
return m_list.at(row);
}
bool XmlItemAbstractListModel::areEquals(XmlItem *xmlItem1, XmlItem *xmlItem2)
{
return xmlItem1->isEqual(xmlItem2);
}
QMap<QString, QVariant> XmlItemAbstractListModel::itemNameData(int row)
{
QMap<QString, QVariant> result;
QHash<int, QByteArray> roleNames = m_xmlItemPrototype->roleNames();
QHashIterator<int, QByteArray> iterator(roleNames);
QVariant itemValue;
QString roleName;
int roleInt;
while (iterator.hasNext()) {
iterator.next();
roleInt = iterator.key();
roleName = QString(iterator.value());
itemValue = data(index(row), roleInt);
result.insert(roleName, itemValue);
}
return result;
}
QModelIndex XmlItemAbstractListModel::indexOf(XmlItem *xmlItem) const
{
for(int row = 0; row < m_list.size(); ++row) {
if (m_list.at(row)->isEqual(xmlItem))
return index(row);
}
return QModelIndex();
}
void XmlItemAbstractListModel::setDataItem(XmlItem *xmlItem, const QVariant &value, int role, bool exclusive, const QVariant &value2)
{
for (int row = 0; row < m_list.size(); ++row) {
if (m_list.at(row)->isEqual(xmlItem)) {
setData(index(row) ,value, role);
} else if (!exclusive) {
setData(index(row) ,value2, role);
}
}
}
void XmlItemAbstractListModel::setDataItems(const QVariant &checkValue, int checkRole, const QVariant &value, int role)
{
for (int row = 0; row < m_list.size(); ++row) {
if (m_list.at(row)->data(checkRole) == checkValue) {
setData(index(row) ,value, role);
}
}
}
void XmlItemAbstractListModel::setDataAll(const QVariant &value, int role)
{
for (int row = 0; row < m_list.size(); ++row) {
setData(index(row) ,value, role);
}
}
| {
"content_hash": "9a0da9a4bcb1720a3a38df5a190ef01e",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 133,
"avg_line_length": 24.570652173913043,
"alnum_prop": 0.6575978765759788,
"repo_name": "tardypad/sailfishos-somafm",
"id": "56c19e0c375911b372eb6c3021ee2b17552e2c7f",
"size": "4703",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/XmlItem/XmlItemAbstractListModel.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "127639"
},
{
"name": "JavaScript",
"bytes": "1565"
},
{
"name": "QML",
"bytes": "93992"
},
{
"name": "QMake",
"bytes": "1049"
}
],
"symlink_target": ""
} |
module AWS
module Core
# @private
module ConfiguredGrammars
# @private
module ClassMethods
include ApiConfig
def base_grammar
raise NotImplementedError
end
def operation_grammar(name)
customized_name = "Customized#{name}"
if const_defined?(customized_name)
const_get(customized_name)
else
const_get(name)
end
end
def input_or_output
raise NotImplementedError
end
def process_customizations(name, customizations)
customizations
end
def define_configured_grammars
api_config[:operations].each do |name, data|
customizations = process_customizations(name,
data[input_or_output])
const_set(name,
base_grammar.customize(customizations))
# BaseResponse.customize([{
# "#{name}Result" =>
# [:ignore, *data[:output]]
# }]))
end
end
end
end
end
end
| {
"content_hash": "543cf2204d1827d2421dad88573c46d3",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 85,
"avg_line_length": 26.12,
"alnum_prop": 0.44716692189892804,
"repo_name": "wearelung/portoalegrecc",
"id": "b188c7dbb0218596d8a22615f5aa446189ecf470",
"size": "1877",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "vendor/cache/ruby/1.8/gems/aws-sdk-1.3.4/lib/aws/core/configured_grammars.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "48011"
},
{
"name": "CSS",
"bytes": "252438"
},
{
"name": "JavaScript",
"bytes": "3519478"
},
{
"name": "PHP",
"bytes": "52609"
},
{
"name": "Ruby",
"bytes": "125149"
},
{
"name": "Shell",
"bytes": "848"
}
],
"symlink_target": ""
} |
#include "mock_io.h"
#include <audioengine.h>
#include <sequencer.h>
#include <utilities/debug.h>
Mock_IO::Mock_IO()
{
MockData::engine_started = true;
}
Mock_IO::~Mock_IO()
{
// nowt...
}
int Mock_IO::writeOutput( float *buffer, int size )
{
// AudioEngine thread will halt all unit test execution
// android_AudioOut is called upon each iteration, here
// we can check whether we can halt the thread
int outputChannels = AudioEngineProps::OUTPUT_CHANNELS;
int singleBufferSize = size / outputChannels;
Debug::log( "Audio Engine test %d running", MockData::test_program );
switch ( MockData::test_program )
{
case 0: // engine start test
case 1: // engine tempo update test
++MockData::test_program; // advance to next test
AudioEngine::stop();
break;
case 2: // output test
if ( Sequencer::playing )
{
// test 1. ensure all buffer iterations are calculated accordingly
// when this method runs the engine is writing its renderer output (and has thus
// incremented buffer position pointers accordingly), we can thus assume that on
// first run the current iteration is 1, not 0 (as it has completed its run)
int currentIteration = ++MockData::render_iterations;
int maxIterations = ( AudioEngine::max_buffer_position - AudioEngine::min_buffer_position ) / AudioEngineProps::BUFFER_SIZE;
int expectedBufferPosition = currentIteration * AudioEngineProps::BUFFER_SIZE;
if ( currentIteration == 1 )
MockData::test_successful = true; // will be falsified as applicable by the assertions below
if ( AudioEngine::bufferPosition != expectedBufferPosition )
MockData::test_successful = false;
// test 2. evaluate buffer contents
// expected samples as defined in audioengine_test.cpp
SAMPLE_TYPE event1buffer[] = { -1,-1,-1,-1, 0,0,0,0, 1,1,1,1, 0,0,0,0 };
SAMPLE_TYPE event2buffer[] = { .5,.5,.5,.5, 1,1,1,1, -.5,-.5,-.5,-.5, -1,-1,-1,-1 };
SAMPLE_TYPE event3buffer[] = { .25,.25,.25,.25, 0,0,0,0, -.25,-.25,-.25,-.25, 0,0,0,0 };
int event2start = 16;
int event2end = event2start + 16;
int event3start = 24; // event 3 ends at singleBufferSize end
for ( int i = 0, j = 0; i < singleBufferSize; ++i, j += AudioEngineProps::OUTPUT_CHANNELS )
{
// minus 1 as we are testing the last iterations output buffer
int sequencerPos = (( currentIteration - 1 ) * AudioEngineProps::BUFFER_SIZE ) + i;
// 16 == size of the expected event buffers
// note that the contents of float* are interleaved
// (every other value is a sample for the other channel, hence the j increment)
int readOffset = (( currentIteration * AudioEngineProps::BUFFER_SIZE ) + j ) % 16;
SAMPLE_TYPE leftSample = buffer[ j ];
SAMPLE_TYPE rightSample = buffer[ j + 1 ];
SAMPLE_TYPE expectedLeftSample = 0.f;
SAMPLE_TYPE expectedRightSample = 0.f;
// test 2.1 test event1buffer (range 0 - 16)
if ( sequencerPos < event2start ) {
// mono event will be mixed into both channels
expectedLeftSample = expectedRightSample = event1buffer[ sequencerPos ];
}
else if ( sequencerPos >= event2start && sequencerPos < event3start ) {
// stereo event that only has right channel contents
expectedRightSample = event2buffer[ sequencerPos - event2start ];
}
else if ( sequencerPos >= event3start )
{
// left buffer is expected to contain event 3 samples only
expectedLeftSample = event3buffer[ sequencerPos - event3start ];
// right buffer will have overlap with tail of event 2
expectedRightSample = event3buffer[ sequencerPos - event3start ];
if ( sequencerPos <= event2end )
expectedRightSample += event2buffer[ sequencerPos - event2start ];
}
// apply the clipping prevention when exceeding the ceiling
expectedLeftSample = preventClip(( float ) expectedLeftSample );
expectedRightSample = preventClip(( float ) expectedRightSample );
if ( leftSample != expectedLeftSample )
{
Debug::log( "TEST 2 expected left sample: %f, got %f at buffer readoffset %d at sequencer position %d",
expectedLeftSample, leftSample, readOffset, sequencerPos );
}
else if ( rightSample != expectedRightSample )
{
Debug::log( "TEST 2 expected right sample: %f, got %f at buffer readoffset %d at sequencer position %d",
expectedRightSample, rightSample, readOffset, sequencerPos );
}
else {
continue;
}
MockData::test_successful = false;
AudioEngine::stop();
break;
}
// stop the engine once it has rendered the full loop range
if ( currentIteration == maxIterations )
{
Debug::log( "Audio Engine test %d done", MockData::test_program );
++MockData::test_program; // advance to next test
AudioEngine::stop();
}
}
break;
case 3: // loop test
if ( Sequencer::playing )
{
MockData::test_successful = true; // will be falsified by assertions below
// test 3. ensure the buffers of both the event at the end of the loop and
// at the start of the Sequencers loop have been mixed into the output buffer
for ( int i = 0, c = 0, bufferPosition = 88100; i < singleBufferSize; ++i, ++bufferPosition, c += outputChannels )
{
// 77175 being audioEvent1 start, -0.25f being audioEvent1 contents, _0.5f being audioEvent2 contents
SAMPLE_TYPE expected = ( bufferPosition > 77175 ) ? -0.25f : +0.5f;
// divide by amount of channels (as volume is corrected for summing purposes)
expected /= 2;
// apply the clipping prevention when exceeding the ceiling
expected = preventClip(( float ) expected );
SAMPLE_TYPE sample = buffer[ c ];
if ( sample != expected )
{
Debug::log( "TEST 3 expected %f, got %f at iteration %d (buffer pos %d)", expected, sample, i, bufferPosition );
MockData::test_successful = false;
AudioEngine::stop();
break;
}
if ( bufferPosition >= AudioEngine::max_buffer_position )
bufferPosition = AudioEngine::min_buffer_position - 1; // will be incremented at end of iteration
}
// stop the engine
++MockData::test_program; // advance to next test
AudioEngine::stop();
}
break;
}
return size;
}
bool MockData::engine_started = false;
int MockData::test_program = 0;
bool MockData::test_successful = false;
int MockData::render_iterations = 0;
| {
"content_hash": "f2ae41a39429f14bfc27013211350839",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 143,
"avg_line_length": 43.58288770053476,
"alnum_prop": 0.5268711656441718,
"repo_name": "igorski/MWEngine",
"id": "fec252a790566763fa1ff3e48aa6e69f1f315a16",
"size": "9321",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "mwengine/src/main/cpp/drivers/mock_io.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "21755"
},
{
"name": "C++",
"bytes": "1061605"
},
{
"name": "CMake",
"bytes": "10006"
},
{
"name": "Java",
"bytes": "46030"
},
{
"name": "SWIG",
"bytes": "5135"
}
],
"symlink_target": ""
} |
using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using POESKillTree.TreeGenerator.Algorithm;
namespace UnitTests
{
[TestClass]
public class WeightedSamplerTests
{
private const int TotalWeight = 38;
private static readonly int[] Weights =
{
1, 0, 5, 10, 3, 2, 1, 7, 4, 5
};
private static readonly int[] WeightsAdded =
{
1,1,6,16,19,21,22,29,33,38
};
private static readonly int[] Sequence =
{
21, 19, 7, 10, 26, 21, 30, 29, 35, 35, 0, 38
};
private class FixedRandom : Random
{
private int _i;
public override double NextDouble()
{
var randomNumber = Sequence[_i++];
return (WeightsAdded.First(n => n >= randomNumber) - 0.5) / TotalWeight;
}
}
[TestMethod]
public void RandomSampleTest()
{
var sampler = new WeightedSampler<int>(new FixedRandom());
for (var i = 0; i < Weights.Length; i++)
{
sampler.AddEntry(i, Weights[i]);
}
foreach (var t in Sequence)
{
Assert.AreEqual(WeightsAdded.First(n => n >= t), WeightsAdded[sampler.RandomSample()]);
}
}
}
} | {
"content_hash": "15eaec02fd1c8754f06e202723e5662c",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 103,
"avg_line_length": 26.056603773584907,
"alnum_prop": 0.5097755249818972,
"repo_name": "nikibobi/PoESkillTree",
"id": "e533d68d558f3c8fe00d622a3a5a8dbe4c3cf8fa",
"size": "1383",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "UnitTests/WeightedSamplerTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2099"
},
{
"name": "C#",
"bytes": "1040221"
},
{
"name": "Inno Setup",
"bytes": "18167"
}
],
"symlink_target": ""
} |
package org.spincast.website.tests;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.spincast.core.templating.TemplatingEngine;
import org.spincast.core.utils.SpincastStatics;
import com.google.inject.Inject;
public class PebbleCustomTest extends WebsiteIntegrationTestBase {
@Inject
protected TemplatingEngine templatingEngine;
protected TemplatingEngine getTemplatingEngine() {
return this.templatingEngine;
}
@Test
public void stripHtmlTagsFilter() throws Exception {
String template = "<div>{{var | strip}}</div>";
String var = "<h1>This <em>should not</em> contain any <code>HTML tags</code>!</h1>";
String result = getTemplatingEngine().evaluate(template, SpincastStatics.params("var", var));
assertEquals("<div>This should not contain any HTML tags!</div>", result);
}
}
| {
"content_hash": "41bcb495aecc971974197e83822277de",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 101,
"avg_line_length": 28.612903225806452,
"alnum_prop": 0.7204058624577226,
"repo_name": "spincast/spincast-framework",
"id": "275eaf309d745cdc2fb0ed0b4710cc1dcdce2e23",
"size": "887",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spincast-website/src/test/java/org/spincast/website/tests/PebbleCustomTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "40884"
},
{
"name": "HTML",
"bytes": "1573425"
},
{
"name": "Java",
"bytes": "5355717"
},
{
"name": "JavaScript",
"bytes": "113097"
},
{
"name": "Shell",
"bytes": "6315"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EmployeeData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EmployeeData")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7c6f45ac-6825-4c73-9bd5-64f2b51cbfb1")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "18ed1a340044d7044aad330e1b79fc28",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 38.80555555555556,
"alnum_prop": 0.7451682176091625,
"repo_name": "dimanov/Primitive-Data-Types-and-Variables",
"id": "823d2bd96c2eb2826c085b09cf03a32de5298d45",
"size": "1400",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "EmployeeData/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "31414"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
NUB Generator [autonym]
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "6200fcb57e7ae20af3e9f5d472441e31",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 23,
"avg_line_length": 9.076923076923077,
"alnum_prop": 0.6779661016949152,
"repo_name": "mdoering/backbone",
"id": "4a28595c0a71ffc23c0d84785c6a9a008bbaf54c",
"size": "176",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Moraceae/Dorstenia/Dorstenia cuspidata/Dorstenia cuspidata cuspidata/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.cloud.vm;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import com.cloud.host.Host;
import org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDao;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.messagebus.MessageBus;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.test.utils.SpringUtils;
import com.cloud.agent.AgentManager;
import com.cloud.capacity.CapacityManager;
import com.cloud.capacity.dao.CapacityDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.DedicatedResourceDao;
import com.cloud.dc.dao.HostPodDao;
import com.cloud.deploy.DataCenterDeployment;
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentClusterPlanner;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.deploy.DeploymentPlanner.PlannerResourceUsage;
import com.cloud.deploy.DeploymentPlanningManagerImpl;
import com.cloud.deploy.FirstFitPlanner;
import com.cloud.deploy.PlannerHostReservationVO;
import com.cloud.deploy.dao.PlannerHostReservationDao;
import com.cloud.exception.AffinityConflictException;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.gpu.dao.HostGpuGroupsDao;
import com.cloud.host.dao.HostDao;
import com.cloud.host.dao.HostTagsDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.resource.ResourceManager;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDetailsDao;
import com.cloud.storage.Storage.ProvisioningType;
import com.cloud.storage.StorageManager;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.AccountManager;
import com.cloud.utils.component.ComponentContext;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class DeploymentPlanningManagerImplTest {
@Inject
DeploymentPlanningManagerImpl _dpm;
@Inject
PlannerHostReservationDao _plannerHostReserveDao;
@Inject
VirtualMachineProfileImpl vmProfile;
@Inject
AffinityGroupVMMapDao _affinityGroupVMMapDao;
@Inject
ExcludeList avoids;
@Inject
DataCenterVO dc;
@Inject
DataCenterDao _dcDao;
@Mock
FirstFitPlanner _planner;
@Inject
ClusterDao _clusterDao;
@Inject
DedicatedResourceDao _dedicatedDao;
@Inject
UserVmDetailsDao vmDetailsDao;
@Mock
Host host;
private static long domainId = 5L;
private static long dataCenterId = 1L;
private static long hostId = 1l;
@BeforeClass
public static void setUp() throws ConfigurationException {
}
@Before
public void testSetUp() {
MockitoAnnotations.initMocks(this);
ComponentContext.initComponentsLifeCycle();
PlannerHostReservationVO reservationVO = new PlannerHostReservationVO(200L, 1L, 2L, 3L, PlannerResourceUsage.Shared);
Mockito.when(_plannerHostReserveDao.persist(Matchers.any(PlannerHostReservationVO.class))).thenReturn(reservationVO);
Mockito.when(_plannerHostReserveDao.findById(Matchers.anyLong())).thenReturn(reservationVO);
Mockito.when(_affinityGroupVMMapDao.countAffinityGroupsForVm(Matchers.anyLong())).thenReturn(0L);
VMInstanceVO vm = new VMInstanceVO();
Mockito.when(vmProfile.getVirtualMachine()).thenReturn(vm);
Mockito.when(vmDetailsDao.listDetailsKeyPairs(Matchers.anyLong())).thenReturn(null);
Mockito.when(_dcDao.findById(Matchers.anyLong())).thenReturn(dc);
Mockito.when(dc.getId()).thenReturn(dataCenterId);
ClusterVO clusterVO = new ClusterVO();
clusterVO.setHypervisorType(HypervisorType.XenServer.toString());
Mockito.when(_clusterDao.findById(Matchers.anyLong())).thenReturn(clusterVO);
Mockito.when(_planner.getName()).thenReturn("FirstFitPlanner");
List<DeploymentPlanner> planners = new ArrayList<DeploymentPlanner>();
planners.add(_planner);
_dpm.setPlanners(planners);
Mockito.when(host.getId()).thenReturn(hostId);
}
@Test
public void dataCenterAvoidTest() throws InsufficientServerCapacityException, AffinityConflictException {
ServiceOfferingVO svcOffering =
new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User, domainId,
null, "FirstFitPlanner");
Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
Mockito.when(avoids.shouldAvoid((DataCenterVO)Matchers.anyObject())).thenReturn(true);
DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids, null);
assertNull("DataCenter is in avoid set, destination should be null! ", dest);
}
@Test
public void plannerCannotHandleTest() throws InsufficientServerCapacityException, AffinityConflictException {
ServiceOfferingVO svcOffering =
new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User, domainId,
null, "UserDispersingPlanner");
Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
Mockito.when(avoids.shouldAvoid((DataCenterVO)Matchers.anyObject())).thenReturn(false);
Mockito.when(_planner.canHandle(vmProfile, plan, avoids)).thenReturn(false);
DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids, null);
assertNull("Planner cannot handle, destination should be null! ", dest);
}
@Test
public void emptyClusterListTest() throws InsufficientServerCapacityException, AffinityConflictException {
ServiceOfferingVO svcOffering =
new ServiceOfferingVO("testOffering", 1, 512, 500, 1, 1, false, false, false, "test dpm",
ProvisioningType.THIN, false, false, null, false, VirtualMachine.Type.User, domainId,
null, "FirstFitPlanner");
Mockito.when(vmProfile.getServiceOffering()).thenReturn(svcOffering);
DataCenterDeployment plan = new DataCenterDeployment(dataCenterId);
Mockito.when(avoids.shouldAvoid((DataCenterVO)Matchers.anyObject())).thenReturn(false);
Mockito.when(_planner.canHandle(vmProfile, plan, avoids)).thenReturn(true);
Mockito.when(((DeploymentClusterPlanner)_planner).orderClusters(vmProfile, plan, avoids)).thenReturn(null);
DeployDestination dest = _dpm.planDeployment(vmProfile, plan, avoids, null);
assertNull("Planner cannot handle, destination should be null! ", dest);
}
@Test
public void testCheckAffinityEmptyPreferredHosts() {
assertTrue(_dpm.checkAffinity(host, new ArrayList<>()));
}
@Test
public void testCheckAffinityNullPreferredHosts() {
assertTrue(_dpm.checkAffinity(host, null));
}
@Test
public void testCheckAffinityNotEmptyPreferredHostsContainingHost() {
assertTrue(_dpm.checkAffinity(host, Arrays.asList(3l, 4l, hostId, 2l)));
}
@Test
public void testCheckAffinityNotEmptyPreferredHostsNotContainingHost() {
assertFalse(_dpm.checkAffinity(host, Arrays.asList(3l, 4l, 2l)));
}
@Configuration
@ComponentScan(basePackageClasses = {DeploymentPlanningManagerImpl.class}, includeFilters = {@Filter(value = TestConfiguration.Library.class,
type = FilterType.CUSTOM)}, useDefaultFilters = false)
public static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
@Bean
public FirstFitPlanner firstFitPlanner() {
return Mockito.mock(FirstFitPlanner.class);
}
@Bean
public DeploymentPlanner deploymentPlanner() {
return Mockito.mock(DeploymentPlanner.class);
}
@Bean
public DataCenterVO dataCenter() {
return Mockito.mock(DataCenterVO.class);
}
@Bean
public ExcludeList excludeList() {
return Mockito.mock(ExcludeList.class);
}
@Bean
public VirtualMachineProfileImpl virtualMachineProfileImpl() {
return Mockito.mock(VirtualMachineProfileImpl.class);
}
@Bean
public HostTagsDao hostTagsDao() {
return Mockito.mock(HostTagsDao.class);
}
@Bean
public ClusterDetailsDao clusterDetailsDao() {
return Mockito.mock(ClusterDetailsDao.class);
}
@Bean
public ResourceManager resourceManager() {
return Mockito.mock(ResourceManager.class);
}
@Bean
public ServiceOfferingDetailsDao serviceOfferingDetailsDao() {
return Mockito.mock(ServiceOfferingDetailsDao.class);
}
@Bean
public AffinityGroupDomainMapDao affinityGroupDomainMapDao() {
return Mockito.mock(AffinityGroupDomainMapDao.class);
}
@Bean
public DataStoreManager cataStoreManager() {
return Mockito.mock(DataStoreManager.class);
}
@Bean
public StorageManager storageManager() {
return Mockito.mock(StorageManager.class);
}
@Bean
public HostDao hostDao() {
return Mockito.mock(HostDao.class);
}
@Bean
public HostPodDao hostPodDao() {
return Mockito.mock(HostPodDao.class);
}
@Bean
public ClusterDao clusterDao() {
return Mockito.mock(ClusterDao.class);
}
@Bean
public DedicatedResourceDao dedicatedResourceDao() {
return Mockito.mock(DedicatedResourceDao.class);
}
@Bean
public GuestOSDao guestOSDao() {
return Mockito.mock(GuestOSDao.class);
}
@Bean
public GuestOSCategoryDao guestOSCategoryDao() {
return Mockito.mock(GuestOSCategoryDao.class);
}
@Bean
public CapacityManager capacityManager() {
return Mockito.mock(CapacityManager.class);
}
@Bean
public StoragePoolHostDao storagePoolHostDao() {
return Mockito.mock(StoragePoolHostDao.class);
}
@Bean
public VolumeDao volumeDao() {
return Mockito.mock(VolumeDao.class);
}
@Bean
public ConfigurationDao configurationDao() {
return Mockito.mock(ConfigurationDao.class);
}
@Bean
public DiskOfferingDao diskOfferingDao() {
return Mockito.mock(DiskOfferingDao.class);
}
@Bean
public PrimaryDataStoreDao primaryDataStoreDao() {
return Mockito.mock(PrimaryDataStoreDao.class);
}
@Bean
public CapacityDao capacityDao() {
return Mockito.mock(CapacityDao.class);
}
@Bean
public PlannerHostReservationDao plannerHostReservationDao() {
return Mockito.mock(PlannerHostReservationDao.class);
}
@Bean
public AffinityGroupProcessor affinityGroupProcessor() {
return Mockito.mock(AffinityGroupProcessor.class);
}
@Bean
public AffinityGroupDao affinityGroupDao() {
return Mockito.mock(AffinityGroupDao.class);
}
@Bean
public AffinityGroupVMMapDao affinityGroupVMMapDao() {
return Mockito.mock(AffinityGroupVMMapDao.class);
}
@Bean
public AccountManager accountManager() {
return Mockito.mock(AccountManager.class);
}
@Bean
public AgentManager agentManager() {
return Mockito.mock(AgentManager.class);
}
@Bean
public MessageBus messageBus() {
return Mockito.mock(MessageBus.class);
}
@Bean
public UserVmDao userVMDao() {
return Mockito.mock(UserVmDao.class);
}
@Bean
public UserVmDetailsDao userVmDetailsDao() {
return Mockito.mock(UserVmDetailsDao.class);
}
@Bean
public VMInstanceDao vmInstanceDao() {
return Mockito.mock(VMInstanceDao.class);
}
@Bean
public DataCenterDao dataCenterDao() {
return Mockito.mock(DataCenterDao.class);
}
@Bean
public VMReservationDao reservationDao() {
return Mockito.mock(VMReservationDao.class);
}
@Bean
public AffinityGroupService affinityGroupService() {
return Mockito.mock(AffinityGroupService.class);
}
@Bean
public HostGpuGroupsDao hostGpuGroupsDap() {
return Mockito.mock(HostGpuGroupsDao.class);
}
public static class Library implements TypeFilter {
@Override
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
ComponentScan cs = TestConfiguration.class.getAnnotation(ComponentScan.class);
return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
}
}
| {
"content_hash": "9b6ec713ef6f228b99bfc6d32e55d08f",
"timestamp": "",
"source": "github",
"line_count": 446,
"max_line_length": 159,
"avg_line_length": 35.125560538116595,
"alnum_prop": 0.7010723860589813,
"repo_name": "wido/cloudstack",
"id": "5d8f9ad21593cdfef523bfd265d12b547506b12c",
"size": "16467",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "server/src/test/java/com/cloud/vm/DeploymentPlanningManagerImplTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "10890"
},
{
"name": "C#",
"bytes": "2356211"
},
{
"name": "CSS",
"bytes": "358651"
},
{
"name": "Dockerfile",
"bytes": "2374"
},
{
"name": "FreeMarker",
"bytes": "4887"
},
{
"name": "Groovy",
"bytes": "146420"
},
{
"name": "HTML",
"bytes": "149088"
},
{
"name": "Java",
"bytes": "36088724"
},
{
"name": "JavaScript",
"bytes": "7976318"
},
{
"name": "Python",
"bytes": "13363686"
},
{
"name": "Ruby",
"bytes": "37714"
},
{
"name": "Shell",
"bytes": "784058"
},
{
"name": "XSLT",
"bytes": "58008"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.camel</groupId>
<artifactId>components</artifactId>
<version>2.20.0-SNAPSHOT</version>
</parent>
<artifactId>camel-groovy</artifactId>
<packaging>jar</packaging>
<name>Camel :: Groovy</name>
<description>Camel Groovy support</description>
<properties>
<camel.osgi.import.pkg>
!org.apache.camel.component.groovy.*,
org.codehaus.groovy.runtime.callsite,
org.apache.camel.*;${camel.osgi.import.camel.version},
${camel.osgi.import.defaults},
*
</camel.osgi.import.pkg>
<camel.osgi.export.pkg>org.apache.camel.language.groovy.*,org.apache.camel.groovy.*</camel.osgi.export.pkg>
<camel.osgi.export.service>org.apache.camel.spi.LanguageResolver;language=groovy</camel.osgi.export.service>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<!-- must use groovy-all as otherwise may have weird class loading issues
when evaluating groovy expressions -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-spring</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project> | {
"content_hash": "d1c983c2a51215697e87d475324467f9",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 201,
"avg_line_length": 35.455555555555556,
"alnum_prop": 0.6938263867126293,
"repo_name": "acartapanis/camel",
"id": "44802fa693ca8d233aebdd26d68b4b3d81dcb247",
"size": "3191",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "components/camel-groovy/pom.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Apex",
"bytes": "6519"
},
{
"name": "Batchfile",
"bytes": "683"
},
{
"name": "CSS",
"bytes": "30373"
},
{
"name": "Elm",
"bytes": "10852"
},
{
"name": "FreeMarker",
"bytes": "11410"
},
{
"name": "Groovy",
"bytes": "49890"
},
{
"name": "HTML",
"bytes": "179541"
},
{
"name": "Java",
"bytes": "62612883"
},
{
"name": "JavaScript",
"bytes": "90232"
},
{
"name": "Protocol Buffer",
"bytes": "578"
},
{
"name": "Python",
"bytes": "36"
},
{
"name": "Ruby",
"bytes": "4802"
},
{
"name": "Scala",
"bytes": "323653"
},
{
"name": "Shell",
"bytes": "16830"
},
{
"name": "Tcl",
"bytes": "4974"
},
{
"name": "XQuery",
"bytes": "546"
},
{
"name": "XSLT",
"bytes": "284394"
}
],
"symlink_target": ""
} |
WebInspector.AuditResultView = function(categoryResults)
{
WebInspector.View.call(this);
this.element.className = "audit-result-view";
function categorySorter(a, b) {
return (a.title || "").localeCompare(b.title || "");
}
categoryResults.sort(categorySorter);
for (var i = 0; i < categoryResults.length; ++i)
this.element.appendChild(new WebInspector.AuditCategoryResultPane(categoryResults[i]).element);
}
WebInspector.AuditResultView.prototype.__proto__ = WebInspector.View.prototype;
WebInspector.AuditCategoryResultPane = function(categoryResult)
{
WebInspector.SidebarPane.call(this, categoryResult.title);
var treeOutlineElement = document.createElement("ol");
this.bodyElement.addStyleClass("audit-result-tree");
this.bodyElement.appendChild(treeOutlineElement);
this._treeOutline = new TreeOutline(treeOutlineElement);
this._treeOutline.expandTreeElementsWhenArrowing = true;
function ruleSorter(a, b)
{
var result = WebInspector.AuditRule.SeverityOrder[a.severity || 0] - WebInspector.AuditRule.SeverityOrder[b.severity || 0];
if (!result)
result = (a.value || "").localeCompare(b.value || "");
return result;
}
categoryResult.ruleResults.sort(ruleSorter);
for (var i = 0; i < categoryResult.ruleResults.length; ++i) {
var ruleResult = categoryResult.ruleResults[i];
var treeElement = this._appendResult(this._treeOutline, ruleResult);
treeElement.listItemElement.addStyleClass("audit-result");
if (ruleResult.severity) {
var severityElement = document.createElement("img");
severityElement.className = "severity-" + ruleResult.severity;
treeElement.listItemElement.appendChild(severityElement);
}
}
this.expand();
}
WebInspector.AuditCategoryResultPane.prototype = {
_appendResult: function(parentTreeElement, result)
{
var title = "";
if (typeof result.value === "string") {
title = result.value;
if (result.violationCount)
title = String.sprintf("%s (%d)", title, result.violationCount);
}
var treeElement = new TreeElement(null, null, !!result.children);
treeElement.titleHTML = title;
parentTreeElement.appendChild(treeElement);
if (result.className)
treeElement.listItemElement.addStyleClass(result.className);
if (typeof result.value !== "string")
treeElement.listItemElement.appendChild(WebInspector.applyFormatters(result.value));
if (result.children) {
for (var i = 0; i < result.children.length; ++i)
this._appendResult(treeElement, result.children[i]);
}
if (result.expanded) {
treeElement.listItemElement.removeStyleClass("parent");
treeElement.listItemElement.addStyleClass("parent-expanded");
treeElement.expand();
}
return treeElement;
}
}
WebInspector.AuditCategoryResultPane.prototype.__proto__ = WebInspector.SidebarPane.prototype;
| {
"content_hash": "6135133527a185d154d46af33ca29609",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 131,
"avg_line_length": 37.43023255813954,
"alnum_prop": 0.6477166821994408,
"repo_name": "hishammk/monthley.com",
"id": "4babb0cb818740efa187232e187a603388496bc9",
"size": "4809",
"binary": false,
"copies": "3",
"ref": "refs/heads/gh-pages",
"path": "node_modules/weinre/web/client/AuditResultView.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "27038"
},
{
"name": "HTML",
"bytes": "34959"
},
{
"name": "JavaScript",
"bytes": "112503"
},
{
"name": "PHP",
"bytes": "1244"
}
],
"symlink_target": ""
} |
layout: post
title: "Gathering Requirements"
date: 2014-08-05 20:09:00
categories:
- blog
- CSI1241
---
Notes taken from:
>[lynda.com](http://www.lynda.com/Programming-tutorials/Foundations-of-Programming-Object-Oriented-Design/96949-2.html) *Foundations of Programming - Object Oriented Design*
- What is the application / system required to do?
- What must it do?
- Define the scope, only add what the app / system **must** do
- Nothing optional
- Do not be too exhaustive
- Requirements will change
- Start with bullet points
## Functional Requirements
- Features
- Capabilities
- Security
### Functional Requirements Examples
- Short, simple, succinct statements
- System must...
- Application must...
>- System **must** display heart rate, temperature and blood pressure of a patient connected to the patient monitor.
- Application **must** allow user to search by customer's last name, telephone number or order number.
- Program **must** allow receipts receipts to be generated via email.
## Non-Functional Requirements
- Help
- Legal
- Performance
- Support
- Security (could also fall in this space)
### Non-Functional Requirements Examples
- Not a feature, but is something that is required
>- System must respond to searches within 2 seconds.
- Help desk should be available by telephone, Mon-Fri 8am-6pm.
- Comply with all relevant HIPAA regulations.
- Be available 99.99% of time during business hours.
<!--more-->
## FURPS / FURPS+
FURPS / FURPS+ is a checklist to confirm all the requirements have been defined.
- **F** unctional requirements
- The features of the app / system
- **U** sability requirements
- Help, documentation, tutorials
- **R** eliability requirements
- Disaster recovery, acceptable failure range, backup strategy
- **P** erformance requirements
- Avaliability, capacity, resources
- **S** upportability
- support other languages, cross platform
- **+**
- **Design** requirements
- must be iphone app, must require relational database
- **Implementation** requirements
- which programming language, comply with standards or methodology
- **Interface** requirements
- interfacing with external system
- **Physical** requirements
- must ship with dvd, must run on device with camera
## Use Cases
### Understanding Use Cases
Write use cases in every day language. Keep it simple, no technical jargon.
- Title
- What is the goal?
- Short phrase, active verb
- Examples:
- Register new member
- Transfer funds
- Purchase items
- Create new page
- Collect late payments
- Process accounts
- Actor
- Who desires it?
- Anything that lives outside the system / app but wants to accomplish something with it
- Could be people or other systems
- It could be:
- User
- Customer
- Member
- Administrator
- Audit system
- Printing service
- HR system
- Scenario
- How is it accomplished?
- Short, succinct
- Could be written as a paragraph
- Could also be written as steps
- Written in the perspective of the user
#### Scenario as Paragraph:
>Customer reviews items in shopping cart. Customer provides payment and shipping information. System validates payment information and responds with confirmation of order and provides order number that Customer can use to check on order status. System will send Customer a confirmation of order details and tracking number in an email.
#### Scenario as Steps:
>1. Customer chooses to enter the checkout process
2. Customer is shown a confirmation page for their order, allowing them to change quantities, remove items or cancel
3. Customer enters his/her shipping address
4. System validates the customer address
5. Customer selects a payment method
6. System validates the payment details
7. System creates an order number that can be used for tracking
8. System displays a confirmation screen to the Customer
9. Email is sent to the Customer with order details
#### Scenario Additional Details
- Describe steps for alternative flows
- Or when things go wrong
- Steps for out-of-stock situations
- Steps for order never finalized
- Steps for payment problems
- Add precondition if applicable
- Only occurs if customer added at least one item to shopping cart
### Identifying the Actors
- An actor is anything with behaviour who lives outside the system, but has a goal they want to accomplish with it.
- Each type of actor will have different goals when using the system.
- Does the system / app need to interact with other computer systems or organisations?
- External data sources
- Web services
- Tax reporting
- Backup systems
- For people, we need to distinguish the following (will prompt use cases)
- Roles / Security groups
- Visitor
- Member
- Administrator
- Owner
- Job Titles / Departments
- Manager
- Payroll Admin
- Production Staff
- Executive Team
- Accounting
- Might be able to simplify it to
- Who requests
- Who approves
### Identifying the Scenarios
- Stay focused on the user's **goal**
- Purchase items
- Create new document
- Balance accounts
- **Not** something like logging in, too specific
- **Not** write book, too broad
- Omit needless words
- Use active words
- **NO:** The system is provided with the payment information and shipping information by the Customer
- **YES:** Customer provides payment and shipping information
- Do not give too much detail
- **NO:** The system connects to the external payment processor over HTTPS and uses JSON to submit the provided payment information to be validated, then waits for a delegated callback response.
- **YES:** System validates payment information
- Focus on intention
- Keep user interface out of the scenario
- Do not mention buttons, page, click, select, mouse etc.
#### Multiple Scenarios
- May need to extend with alternate paths
- As described above as "Additional Details"
### Use Case Prompts
- Who performs system administration tasks?
- Who manages users and security?
- What happens if the system fails?
- Who is looking at performance metrics or logs?
### Diagramming Use Cases
- Primary actors on the left
- System functions in the middle
- Secondary actors on the right
- Not usually referred to sequence
- An overview of multiple actors interacting with the system at the same time
### Employing User Stories
- From user perspective
- Typically written as one or two sentences
- Short and sweet
- Focused on intention
- No mention of user interface
- Expresses one need
- Good for brainstorming use cases
- Format
- As a...
- Type of user
- "Bank Customer"
- I want...
- Goal
- "to change my PIN online"
- So that...
- Reason
- "I don't have to go into a branch" | {
"content_hash": "dd80d056ad2d8afc023b380488f96510",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 335,
"avg_line_length": 31.044843049327355,
"alnum_prop": 0.7206413404593385,
"repo_name": "martymcflywa/martymcflywa.github.io",
"id": "e143bf683aa5a473a6248710c842c80a9155e4bd",
"size": "6928",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2014-08-05-gathering-requirements.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "14763"
},
{
"name": "Ruby",
"bytes": "49"
}
],
"symlink_target": ""
} |
package com.twu.biblioteca.model;
import java.util.Objects;
public class User {
private String userID;
private String password;
private final String name;
private final String email;
private final String phone;
public User(String userID, String password, String name, String email, String phone) {
this.userID = userID;
this.password = password;
this.name = name;
this.email = email;
this.phone = phone;
}
public boolean verify(String userID, String password) {
return Objects.equals(userID, this.userID) && Objects.equals(password, this.password);
}
@Override
public String toString() {
return "UserID : " + userID +
"\nName : " + name +
"\nEmail : " + email +
"\nPhone : " + phone;
}
public String getUserId() {
return userID;
}
public String details() {
return String.format("%16s %1s \n %115s %1s \n %115s %1s\n %115s %1s\n",
"UserID : ", userID, "Name : ", name, "Email : ", email, "Phone : ", phone);
}
} | {
"content_hash": "712f42216896671323a267f23ffe3416",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 96,
"avg_line_length": 27.463414634146343,
"alnum_prop": 0.5710479573712256,
"repo_name": "lipikadugar/twu-biblioteca-lipikadugar",
"id": "bddc046adb08285eec161df70920428ccf080da0",
"size": "1126",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/com/twu/biblioteca/model/User.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "61848"
}
],
"symlink_target": ""
} |
'use strict';
/**
* Test whether value is a Number
* @param {*} value
* @return {Boolean} isNumber
*/
exports.isNumber = function(value) {
return (value instanceof Number) || (typeof value == 'number');
};
/**
* Check if a number is integer
* @param {Number | Boolean} value
* @return {Boolean} isInteger
*/
exports.isInteger = function(value) {
return (value == Math.round(value));
// Note: we use ==, not ===, as we can have Booleans as well
};
/**
* Calculate the sign of a number
* @param {Number} x
* @returns {*}
*/
exports.sign = function(x) {
if (x > 0) {
return 1;
}
else if (x < 0) {
return -1;
}
else {
return 0;
}
};
/**
* Convert a number to a formatted string representation.
*
* Syntax:
*
* format(value)
* format(value, options)
* format(value, precision)
* format(value, fn)
*
* Where:
*
* {Number} value The value to be formatted
* {Object} options An object with formatting options. Available options:
* {String} notation
* Number notation. Choose from:
* 'fixed' Always use regular number notation.
* For example '123.40' and '14000000'
* 'exponential' Always use exponential notation.
* For example '1.234e+2' and '1.4e+7'
* 'auto' (default) Regular number notation for numbers
* having an absolute value between
* `lower` and `upper` bounds, and uses
* exponential notation elsewhere.
* Lower bound is included, upper bound
* is excluded.
* For example '123.4' and '1.4e7'.
* {Number} precision A number between 0 and 16 to round
* the digits of the number.
* In case of notations 'exponential' and
* 'auto', `precision` defines the total
* number of significant digits returned
* and is undefined by default.
* In case of notation 'fixed',
* `precision` defines the number of
* significant digits after the decimal
* point, and is 0 by default.
* {Object} exponential An object containing two parameters,
* {Number} lower and {Number} upper,
* used by notation 'auto' to determine
* when to return exponential notation.
* Default values are `lower=1e-3` and
* `upper=1e5`.
* Only applicable for notation `auto`.
* {Function} fn A custom formatting function. Can be used to override the
* built-in notations. Function `fn` is called with `value` as
* parameter and must return a string. Is useful for example to
* format all values inside a matrix in a particular way.
*
* Examples:
*
* format(6.4); // '6.4'
* format(1240000); // '1.24e6'
* format(1/3); // '0.3333333333333333'
* format(1/3, 3); // '0.333'
* format(21385, 2); // '21000'
* format(12.071, {notation: 'fixed'}); // '12'
* format(2.3, {notation: 'fixed', precision: 2}); // '2.30'
* format(52.8, {notation: 'exponential'}); // '5.28e+1'
*
* @param {Number} value
* @param {Object | Function | Number} [options]
* @return {String} str The formatted value
*/
exports.format = function(value, options) {
if (typeof options === 'function') {
// handle format(value, fn)
return options(value);
}
// handle special cases
if (value === Infinity) {
return 'Infinity';
}
else if (value === -Infinity) {
return '-Infinity';
}
else if (isNaN(value)) {
return 'NaN';
}
// default values for options
var notation = 'auto';
var precision = undefined;
if (options) {
// determine notation from options
if (options.notation) {
notation = options.notation;
}
// determine precision from options
if (exports.isNumber(options)) {
precision = options;
}
else if (options.precision) {
precision = options.precision;
}
}
// handle the various notations
switch (notation) {
case 'fixed':
return exports.toFixed(value, precision);
case 'exponential':
return exports.toExponential(value, precision);
case 'auto':
return exports
.toPrecision(value, precision, options && options.exponential)
// remove trailing zeros after the decimal point
.replace(/((\.\d*?)(0+))($|e)/, function () {
var digits = arguments[2];
var e = arguments[4];
return (digits !== '.') ? digits + e : e;
});
default:
throw new Error('Unknown notation "' + notation + '". ' +
'Choose "auto", "exponential", or "fixed".');
}
};
/**
* Format a number in exponential notation. Like '1.23e+5', '2.3e+0', '3.500e-3'
* @param {Number} value
* @param {Number} [precision] Number of digits in formatted output.
* If not provided, the maximum available digits
* is used.
* @returns {string} str
*/
exports.toExponential = function(value, precision) {
// Note: IE7 does not allow value.toExponential(undefined)
if (precision !== undefined) {
return value.toExponential(Math.min(precision - 1, 20));
}
else {
return value.toExponential();
}
};
/**
* Format a number with fixed notation.
* @param {Number} value
* @param {Number} [precision=0] Optional number of decimals after the
* decimal point. Zero by default.
*/
exports.toFixed = function(value, precision) {
var abs = Math.abs(value);
if ((abs > 1e-20 && abs < 1e20) || abs === 0) {
return value.toFixed(Math.min(precision, 20));
}
else {
var str = exports.toPrecision(value, undefined, {
lower: -Infinity,
upper: Infinity
});
var dot = str.indexOf('.');
var actual = (dot !== -1) ? (str.length - dot - 1) : 0;
var required = precision != undefined ? precision : 0;
if (required > actual) {
// append zeros
return str + (dot === -1 ? '.' : '') + repeat('0', required - actual);
}
else if (required < actual) {
// remove decimals
var end = dot + (required > 0 ? required + 1 : 0);
if (parseInt(str.charAt(end)) < 5) {
// no need to round, just remove the tail
return str.substring(0, end);
}
else {
// round up
// move the dot temporarily to the place where we have to round
var tempDot = str.substring(0, dot) +
str.substring(dot + 1, end) + '.' +
str.substring(end);
// round to the correct number of digits
var zeros = tempDot.match(/^0*/); // leading zeros
var fixed = (zeros ? zeros[0] : '') + parseFloat(tempDot).toFixed();
// restore the original dot
if (required > 0) {
return fixed.substring(0, dot) + '.' + fixed.substring(dot);
}
else {
return fixed.substring(0, dot);
}
}
}
else {
return str;
}
}
};
/**
* Format a number with a certain precision
* @param {Number} value
* @param {Number} [precision=undefined] Optional number of digits.
* @param {{lower: number, upper: number}} [options] By default:
* lower = 1e-3 (excl)
* upper = 1e+5 (incl)
* @return {string}
*/
exports.toPrecision = function(value, precision, options) {
// determine lower and upper bound for exponential notation.
var lower = (options && options.lower !== undefined) ? options.lower : 1e-3;
var upper = (options && options.upper !== undefined) ? options.upper : 1e+5;
// handle special case zero
if (value === 0) return '0';
// determine whether or not to output exponential notation
var abs = Math.abs(value);
if (abs < lower || abs >= upper) {
// exponential notation
return exports.toExponential(value, precision);
}
else {
// normal number notation
// split coefficient and exponent
var str = exports.toExponential(value, precision);
var match = str.match(/^(-?[\d.]+)e([+-]?\d+)$/);
var coefficient = match[1];
var exponent = parseFloat(match[2]);
var digits = coefficient.replace('.', '');
if (exponent === 0) {
// return as is
return coefficient;
}
else if (exponent > 0) {
var diff = exponent + 1 - digits.length;
if (diff >= 0) {
// append zeros
return digits + repeat('0', diff);
}
else {
// insert the dot at the right place
return digits.substr(0, exponent + 1) + '.' + digits.substr(exponent + 1);
}
}
else { // exponent < 0
return '0.' + repeat('0', -(exponent + 1)) + digits;
}
}
};
/**
* Repeat a string
* http://stackoverflow.com/a/5450113/1262753
* @param {string} pattern
* @param {number} count
* @returns {string}
*/
function repeat(pattern, count) {
var c = count;
if (c < 1) return '';
var result = '';
while (c > 1) {
if (c & 1) {
result += pattern;
}
c >>= 1;
pattern += pattern;
}
return result + pattern;
}
/**
* Count the number of significant digits of a number.
*
* For example:
* 2.34 returns 3
* 0.0034 returns 2
* 120.5e+30 returns 4
*
* @param {Number} value
* @return {Number} digits Number of significant digits
*/
exports.digits = function(value) {
return value
.toExponential()
.replace(/e.*$/, '') // remove exponential notation
.replace( /^0\.?0*|\./, '') // remove decimal point and leading zeros
.length
};
/**
* Minimum number added to one that makes the result different than one
*/
exports.DBL_EPSILON = Number.EPSILON || 2.2204460492503130808472633361816E-16;
/**
* Compares two floating point numbers.
* @param {Number} x First value to compare
* @param {Number} y Second value to compare
* @param {Number} [epsilon] The maximum relative difference between x and y
* If epsilon is undefined or null, the function will
* test whether x and y are exactly equal.
* @return {boolean} whether the two numbers are equal
*/
exports.nearlyEqual = function(x, y, epsilon) {
// if epsilon is null or undefined, test whether x and y are exactly equal
if (epsilon == null) return x == y;
// use "==" operator, handles infinities
if (x == y) return true;
// NaN
if (isNaN(x) || isNaN(y)) return false;
// at this point x and y should be finite
if(isFinite(x) && isFinite(y)) {
// check numbers are very close, needed when comparing numbers near zero
var diff = Math.abs(x - y);
if (diff < exports.DBL_EPSILON) {
return true;
}
else {
// use relative error
return diff <= Math.max(Math.abs(x), Math.abs(y)) * epsilon;
}
}
// Infinite and Number or negative Infinite and positive Infinite cases
return false;
};
| {
"content_hash": "a3a86c88a9c610aaebc38d2d069dd55a",
"timestamp": "",
"source": "github",
"line_count": 376,
"max_line_length": 83,
"avg_line_length": 32.066489361702125,
"alnum_prop": 0.5255867960520859,
"repo_name": "jeslopcru/code-refactoring-course",
"id": "7379c6d20a90393cbba968f7839ce0a03f146359",
"size": "12057",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "class6/ejercicio/mathjs-refactor/lib/util/number.js",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7480"
},
{
"name": "HTML",
"bytes": "190474"
},
{
"name": "Java",
"bytes": "46220047"
},
{
"name": "JavaScript",
"bytes": "8567030"
},
{
"name": "OpenSCAD",
"bytes": "12773"
},
{
"name": "PHP",
"bytes": "39466"
},
{
"name": "Ruby",
"bytes": "276530"
}
],
"symlink_target": ""
} |
<?php
namespace Sylius\Bundle\ApiBundle\DependencyInjection;
use Sylius\Bundle\ApiBundle\Form\Type\ClientType;
use Sylius\Bundle\ApiBundle\Model\AccessToken;
use Sylius\Bundle\ApiBundle\Model\AccessTokenInterface;
use Sylius\Bundle\ApiBundle\Model\AuthCode;
use Sylius\Bundle\ApiBundle\Model\AuthCodeInterface;
use Sylius\Bundle\ApiBundle\Model\Client;
use Sylius\Bundle\ApiBundle\Model\ClientInterface;
use Sylius\Bundle\ApiBundle\Model\RefreshToken;
use Sylius\Bundle\ApiBundle\Model\RefreshTokenInterface;
use Sylius\Bundle\ApiBundle\Model\UserInterface;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
use Sylius\Component\Resource\Factory\Factory;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle.
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Paweł Jędrzejewski <[email protected]>
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('sylius_api');
$rootNode
->children()
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
->end()
;
$this->addResourcesSection($rootNode);
return $treeBuilder;
}
/**
* @param ArrayNodeDefinition $node
*/
private function addResourcesSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('resources')
->addDefaultsIfNotSet()
->children()
->arrayNode('api_user')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->isRequired()->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(UserInterface::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('api_client')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(Client::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(ClientInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->arrayNode('form')
->addDefaultsIfNotSet()
->children()
->scalarNode('default')->defaultValue(ClientType::class)->cannotBeEmpty()->end()
->end()
->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_access_token')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(AccessToken::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(AccessTokenInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_refresh_token')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(RefreshToken::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(RefreshTokenInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->arrayNode('api_auth_code')
->addDefaultsIfNotSet()
->children()
->variableNode('options')->end()
->arrayNode('classes')
->addDefaultsIfNotSet()
->children()
->scalarNode('model')->defaultValue(AuthCode::class)->cannotBeEmpty()->end()
->scalarNode('interface')->defaultValue(AuthCodeInterface::class)->cannotBeEmpty()->end()
->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end()
->scalarNode('repository')->cannotBeEmpty()->end()
->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end()
->end()
->end()
->arrayNode('validation_groups')
->addDefaultsIfNotSet()
->children()
->arrayNode('default')
->prototype('scalar')->end()
->defaultValue(['sylius'])
->end()
->end()
->end()
->end()
->end()
->end()
->end()
->end()
;
}
}
| {
"content_hash": "dc0e08d6d0aeec9b4bec0ea17d506e17",
"timestamp": "",
"source": "github",
"line_count": 186,
"max_line_length": 133,
"avg_line_length": 52.38172043010753,
"alnum_prop": 0.3979267166170584,
"repo_name": "adamelso/Sylius",
"id": "68d449577908e01a08bfb54fe2021c95dc608dc6",
"size": "9956",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Sylius/Bundle/ApiBundle/DependencyInjection/Configuration.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "519"
},
{
"name": "Batchfile",
"bytes": "3637"
},
{
"name": "CSS",
"bytes": "78348"
},
{
"name": "Cucumber",
"bytes": "493750"
},
{
"name": "HTML",
"bytes": "541994"
},
{
"name": "JavaScript",
"bytes": "143907"
},
{
"name": "PHP",
"bytes": "6255901"
},
{
"name": "Puppet",
"bytes": "3165"
},
{
"name": "Ruby",
"bytes": "1210"
},
{
"name": "Shell",
"bytes": "26374"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=constant.MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED.html">
</head>
<body>
<p>Redirecting to <a href="constant.MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED.html">constant.MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED.html</a>...</p>
<script>location.replace("constant.MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED.html" + location.search + location.hash);</script>
</body>
</html> | {
"content_hash": "8461552882a99e88835f6ca94a796245",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 144,
"avg_line_length": 44.1,
"alnum_prop": 0.7301587301587301,
"repo_name": "liebharc/clFFT",
"id": "f5b0d5c2e0804e1bd0e80f77f9e4b4c66ab66f3c",
"size": "441",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "docs/bindings/ocl_core/MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED.v.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "141098"
},
{
"name": "C++",
"bytes": "3950190"
},
{
"name": "CMake",
"bytes": "47058"
},
{
"name": "Python",
"bytes": "61560"
},
{
"name": "Rust",
"bytes": "58918"
}
],
"symlink_target": ""
} |
package com.google.android.libraries.cast.companionlibrary.cast.callbacks;
import com.google.android.gms.cast.ApplicationMetadata;
import com.google.android.gms.cast.CastDevice;
import com.google.android.gms.common.api.Status;
/**
* A no-op implementation of the {@link DataCastConsumer}
*/
public class DataCastConsumerImpl extends BaseCastConsumerImpl implements DataCastConsumer {
@Override
public void onApplicationConnected(ApplicationMetadata appMetadata, String applicationStatus,
String sessionId, boolean wasLaunched) {
}
@Override
public void onApplicationDisconnected(int errorCode) {
}
@Override
public void onApplicationStopFailed(int errorCode) {
}
@Override
public void onApplicationConnectionFailed(int errorCode) {
}
@Override
public void onApplicationStatusChanged(String appStatus) {
}
@Override
public void onVolumeChanged(double value, boolean isMute) {
}
@Override
public void onMessageReceived(CastDevice castDevice, String namespace, String message) {
}
@Override
public void onMessageSendFailed(Status status) {
}
@Override
public void onRemoved(CastDevice castDevice, String namespace) {
}
}
| {
"content_hash": "594e23fea36f40e6fde97c2e32167fa1",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 97,
"avg_line_length": 25.11764705882353,
"alnum_prop": 0.7205308352849337,
"repo_name": "tomgus1/DanaCast",
"id": "02349d021eb237a4011dd93b563372f32af9edba",
"size": "1901",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "CastCompanion/src/com/google/android/libraries/cast/companionlibrary/cast/callbacks/DataCastConsumerImpl.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "557677"
}
],
"symlink_target": ""
} |
/// <reference path="../_references.ts" />
module App.Directives {
'use strict';
export function BlurDirective(): ng.IDirective {
return {
link: ($scope: ng.IScope, element: ng.IAugmentedJQuery, attributes: ng.IAttributes) => {
element.bind('blur', () => {
$scope.$apply(attributes['waBlur']);
});
$scope.$on('$destroy', () => {
element.unbind('blur');
});
}
};
}
}
| {
"content_hash": "22a31596c7eeda8db3a48aec2ebeee98",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 100,
"avg_line_length": 27.3,
"alnum_prop": 0.43040293040293043,
"repo_name": "wwdenis/wwa",
"id": "6a02c8b7d2c9e3996d4905b054da8bac55c588c4",
"size": "673",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samples/Marketplace/Marketplace.Web/app/directives/BlurDirective.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "412103"
},
{
"name": "TypeScript",
"bytes": "49075"
}
],
"symlink_target": ""
} |
require 'net/http/persistent'
require 'time'
class Gem::Mirror::Fetcher
# TODO beef
class Error < StandardError; end
def initialize(opts = {})
@http =
if defined?(Net::HTTP::Persistent::DEFAULT_POOL_SIZE)
Net::HTTP::Persistent.new(name: self.class.name, proxy: :ENV)
else
# net-http-persistent < 3.0
Net::HTTP::Persistent.new(self.class.name, :ENV)
end
@opts = opts
# default opts
@opts[:retries] ||= 1
@opts[:skiperror] = true if @opts[:skiperror].nil?
end
# Fetch a source path under the base uri, and put it in the same or given
# destination path under the base path.
def fetch(uri, path)
modified_time = File.exist?(path) && File.stat(path).mtime.rfc822
req = Net::HTTP::Get.new URI.parse(uri).path
req.add_field 'If-Modified-Since', modified_time if modified_time
retries = @opts[:retries]
begin
# Net::HTTP will throw an exception on things like http timeouts.
# Therefore some generic error handling is needed in case no response
# is returned so the whole mirror operation doesn't abort prematurely.
begin
@http.request URI(uri), req do |resp|
return handle_response(resp, path)
end
rescue Exception => e
warn "Error connecting to #{uri.to_s}: #{e.message}"
end
rescue Error
retries -= 1
retry if retries > 0
raise if not @opts[:skiperror]
end
end
# Handle an http response, follow redirects, etc. returns true if a file was
# downloaded, false if a 304. Raise Error on unknown responses.
def handle_response(resp, path)
case resp.code.to_i
when 304
when 301, 302
fetch resp['location'], path
when 200
write_file(resp, path)
when 403, 404
raise Error,"#{resp.code} on #{File.basename(path)}"
else
raise Error, "unexpected response #{resp.inspect}"
end
# TODO rescue http errors and reraise cleanly
end
# Efficiently writes an http response object to a particular path. If there
# is an error, it will remove the target file.
def write_file(resp, path)
FileUtils.mkdir_p File.dirname(path)
File.open(path, 'wb') do |output|
resp.read_body { |chunk| output << chunk }
end
true
ensure
# cleanup incomplete files, rescue perm errors etc, they're being
# raised already.
File.delete(path) rescue nil if $!
end
end
| {
"content_hash": "e10345f79339dc72c1c32775ad7771e6",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 78,
"avg_line_length": 29.301204819277107,
"alnum_prop": 0.6467927631578947,
"repo_name": "rubygems/rubygems-mirror",
"id": "144e60c6a31ee4c2cc46f1aad7833fbdca418ed8",
"size": "2432",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/rubygems/mirror/fetcher.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "18332"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
namespace BddSharp.Web
{
public class BddHelpers
{
public static void ClearDatabase(DbContext context)
{
context.Database.ExecuteSqlCommand("Exec sp_msforeachtable 'Alter Table ? NOCHECK Constraint all' " +
"Exec sp_msforeachtable 'Delete From ?' " +
"Exec sp_msforeachtable 'Alter Table ? With Check Check Constraint all'");
}
}
}
| {
"content_hash": "444bd25adfba14275747370053b16ac8",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 121,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.5884353741496599,
"repo_name": "mishkinf/BddSharp",
"id": "e4e7077abeca6b42e9f92cb87d88350d56f3725c",
"size": "590",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "BddSharp.Web/BddHelpers.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "109"
},
{
"name": "C#",
"bytes": "69273"
},
{
"name": "CSS",
"bytes": "13188"
},
{
"name": "Cucumber",
"bytes": "233"
},
{
"name": "JavaScript",
"bytes": "782"
}
],
"symlink_target": ""
} |
package io.hawtjms.jms.message;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import io.hawtjms.jms.JmsDestination;
import io.hawtjms.jms.JmsTopic;
import java.util.Enumeration;
import java.util.Map;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageFormatException;
import javax.jms.MessageNotWriteableException;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class JmsMessageTest {
private static final Logger LOG = LoggerFactory.getLogger(JmsMessageTest.class);
private final JmsMessageFactory factory = new JmsDefaultMessageFactory();
protected boolean readOnlyMessage;
private String jmsMessageID;
private String jmsCorrelationID;
private JmsDestination jmsDestination;
private JmsDestination jmsReplyTo;
private int jmsDeliveryMode;
private boolean jmsRedelivered;
private String jmsType;
private long jmsExpiration;
private int jmsPriority;
private long jmsTimestamp;
private long[] consumerIDs;
@Before
public void setUp() throws Exception {
this.jmsMessageID = "ID:TEST-ID:0:0:0:1";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new JmsTopic("test.topic");
this.jmsReplyTo = new JmsTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
this.readOnlyMessage = false;
this.consumerIDs = new long[3];
for (int i = 0; i < this.consumerIDs.length; i++) {
this.consumerIDs[i] = i;
}
}
@Test
public void testHashCode() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setJMSMessageID(this.jmsMessageID);
assertTrue(msg.getJMSMessageID().hashCode() == jmsMessageID.hashCode());
}
@Test
public void testSetReadOnly() {
JmsMessage msg = factory.createMessage();
msg.setReadOnlyProperties(true);
boolean test = false;
try {
msg.setIntProperty("test", 1);
} catch (MessageNotWriteableException me) {
test = true;
} catch (JMSException e) {
e.printStackTrace(System.err);
test = false;
}
assertTrue(test);
}
@Test
public void testSetToForeignJMSID() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setJMSMessageID("ID:EMS-SERVER.8B443C380083:429");
}
@Test
public void testEqualsObject() throws Exception {
JmsMessage msg1 = factory.createMessage();
JmsMessage msg2 = factory.createMessage();
msg1.setJMSMessageID(this.jmsMessageID);
assertTrue(!msg1.equals(msg2));
msg2.setJMSMessageID(this.jmsMessageID);
assertTrue(msg1.equals(msg2));
}
@Test
public void testShallowCopy() throws Exception {
JmsMessage msg1 = factory.createMessage();
msg1.setJMSMessageID(jmsMessageID);
JmsMessage msg2 = msg1.copy();
assertTrue(msg1 != msg2 && msg1.equals(msg2));
}
@Test
public void testCopy() throws Exception {
this.jmsMessageID = "testid";
this.jmsCorrelationID = "testcorrelationid";
this.jmsDestination = new JmsTopic("test.topic");
this.jmsReplyTo = new JmsTopic("test.replyto.topic:001");
this.jmsDeliveryMode = Message.DEFAULT_DELIVERY_MODE;
this.jmsRedelivered = true;
this.jmsType = "test type";
this.jmsExpiration = 100000;
this.jmsPriority = 5;
this.jmsTimestamp = System.currentTimeMillis();
this.readOnlyMessage = false;
JmsMessage msg1 = factory.createMessage();
msg1.setJMSMessageID(this.jmsMessageID);
msg1.setJMSCorrelationID(this.jmsCorrelationID);
msg1.setJMSDestination(this.jmsDestination);
msg1.setJMSReplyTo(this.jmsReplyTo);
msg1.setJMSDeliveryMode(this.jmsDeliveryMode);
msg1.setJMSRedelivered(this.jmsRedelivered);
msg1.setJMSType(this.jmsType);
msg1.setJMSExpiration(this.jmsExpiration);
msg1.setJMSPriority(this.jmsPriority);
msg1.setJMSTimestamp(this.jmsTimestamp);
msg1.setReadOnlyProperties(true);
JmsMessage msg2 = msg1.copy();
assertEquals(msg1.getJMSMessageID(), msg2.getJMSMessageID());
assertTrue(msg1.getJMSCorrelationID().equals(msg2.getJMSCorrelationID()));
assertTrue(msg1.getJMSDestination().equals(msg2.getJMSDestination()));
assertTrue(msg1.getJMSReplyTo().equals(msg2.getJMSReplyTo()));
assertTrue(msg1.getJMSDeliveryMode() == msg2.getJMSDeliveryMode());
assertTrue(msg1.getJMSRedelivered() == msg2.getJMSRedelivered());
assertTrue(msg1.getJMSType().equals(msg2.getJMSType()));
assertTrue(msg1.getJMSExpiration() == msg2.getJMSExpiration());
assertTrue(msg1.getJMSPriority() == msg2.getJMSPriority());
assertTrue(msg1.getJMSTimestamp() == msg2.getJMSTimestamp());
LOG.info("Message is: " + msg1);
}
@Test
public void testGetAndSetJMSMessageID() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setJMSMessageID(this.jmsMessageID);
assertEquals(msg.getJMSMessageID(), this.jmsMessageID);
}
@Test
public void testGetAndSetJMSTimestamp() {
JmsMessage msg = factory.createMessage();
msg.setJMSTimestamp(this.jmsTimestamp);
assertTrue(msg.getJMSTimestamp() == this.jmsTimestamp);
}
@Test
public void testGetJMSCorrelationIDAsBytes() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setJMSCorrelationID(this.jmsCorrelationID);
byte[] testbytes = msg.getJMSCorrelationIDAsBytes();
String str2 = new String(testbytes);
assertTrue(this.jmsCorrelationID.equals(str2));
}
@Test
public void testSetJMSCorrelationIDAsBytes() throws Exception {
JmsMessage msg = factory.createMessage();
byte[] testbytes = this.jmsCorrelationID.getBytes();
msg.setJMSCorrelationIDAsBytes(testbytes);
testbytes = msg.getJMSCorrelationIDAsBytes();
String str2 = new String(testbytes);
assertTrue(this.jmsCorrelationID.equals(str2));
}
@Test
public void testGetAndSetJMSCorrelationID() {
JmsMessage msg = factory.createMessage();
msg.setJMSCorrelationID(this.jmsCorrelationID);
assertTrue(msg.getJMSCorrelationID().equals(this.jmsCorrelationID));
}
@Test
public void testGetAndSetJMSReplyTo() throws JMSException {
JmsMessage msg = factory.createMessage();
msg.setJMSReplyTo(this.jmsReplyTo);
assertTrue(msg.getJMSReplyTo().equals(this.jmsReplyTo));
}
@Test
public void testGetAndSetJMSDestination() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setJMSDestination(this.jmsDestination);
assertTrue(msg.getJMSDestination().equals(this.jmsDestination));
}
@Test
public void testGetAndSetJMSDeliveryMode() {
JmsMessage msg = factory.createMessage();
msg.setJMSDeliveryMode(this.jmsDeliveryMode);
assertTrue(msg.getJMSDeliveryMode() == this.jmsDeliveryMode);
}
@Test
public void testGetAndSetMSRedelivered() {
JmsMessage msg = factory.createMessage();
msg.setJMSRedelivered(this.jmsRedelivered);
assertTrue(msg.getJMSRedelivered() == this.jmsRedelivered);
}
@Test
public void testGetAndSetJMSType() {
JmsMessage msg = factory.createMessage();
msg.setJMSType(this.jmsType);
assertTrue(msg.getJMSType().equals(this.jmsType));
}
@Test
public void testGetAndSetJMSExpiration() {
JmsMessage msg = factory.createMessage();
msg.setJMSExpiration(this.jmsExpiration);
assertTrue(msg.getJMSExpiration() == this.jmsExpiration);
}
@Test
public void testGetAndSetJMSPriority() {
JmsMessage msg = factory.createMessage();
msg.setJMSPriority(this.jmsPriority);
assertTrue(msg.getJMSPriority() == this.jmsPriority);
msg.setJMSPriority(-90);
assertEquals(0, msg.getJMSPriority());
msg.setJMSPriority(90);
assertEquals(9, msg.getJMSPriority());
}
@Test
public void testClearProperties() throws JMSException {
JmsMessage msg = factory.createMessage();
msg.setStringProperty("test", "test");
msg.setJMSMessageID(this.jmsMessageID);
msg.clearProperties();
assertNull(msg.getStringProperty("test"));
assertNotNull(msg.getJMSMessageID());
}
@Test
public void testPropertyExists() throws JMSException {
JmsMessage msg = factory.createMessage();
msg.setStringProperty("test", "test");
assertTrue(msg.propertyExists("test"));
msg.setIntProperty("JMSXDeliveryCount", 1);
assertTrue(msg.propertyExists("JMSXDeliveryCount"));
}
@Test
public void testGetBooleanProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "booleanProperty";
msg.setBooleanProperty(name, true);
assertTrue(msg.getBooleanProperty(name));
}
@Test
public void testGetByteProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "byteProperty";
msg.setByteProperty(name, (byte) 1);
assertTrue(msg.getByteProperty(name) == 1);
}
@Test
public void testGetShortProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "shortProperty";
msg.setShortProperty(name, (short) 1);
assertTrue(msg.getShortProperty(name) == 1);
}
@Test
public void testGetIntProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "intProperty";
msg.setIntProperty(name, 1);
assertTrue(msg.getIntProperty(name) == 1);
}
@Test
public void testGetLongProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "longProperty";
msg.setLongProperty(name, 1);
assertTrue(msg.getLongProperty(name) == 1);
}
@Test
public void testGetFloatProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "floatProperty";
msg.setFloatProperty(name, 1.3f);
assertTrue(msg.getFloatProperty(name) == 1.3f);
}
@Test
public void testGetDoubleProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "doubleProperty";
msg.setDoubleProperty(name, 1.3d);
assertTrue(msg.getDoubleProperty(name) == 1.3);
}
@Test
public void testGetStringProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "stringProperty";
msg.setStringProperty(name, name);
assertTrue(msg.getStringProperty(name).equals(name));
}
@Test
public void testGetObjectProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "floatProperty";
msg.setFloatProperty(name, 1.3f);
assertTrue(msg.getObjectProperty(name) instanceof Float);
assertTrue(((Float) msg.getObjectProperty(name)).floatValue() == 1.3f);
}
@Test
@SuppressWarnings("rawtypes")
public void testGetPropertyNames() throws JMSException {
JmsMessage msg = factory.createMessage();
String name1 = "floatProperty";
msg.setFloatProperty(name1, 1.3f);
String name2 = "JMSXDeliveryCount";
msg.setIntProperty(name2, 1);
String name3 = "JMSRedelivered";
msg.setBooleanProperty(name3, false);
boolean found1 = false;
boolean found2 = false;
boolean found3 = false;
for (Enumeration iter = msg.getPropertyNames(); iter.hasMoreElements();) {
Object element = iter.nextElement();
found1 |= element.equals(name1);
found2 |= element.equals(name2);
found3 |= element.equals(name3);
}
assertTrue("prop name1 found", found1);
// spec compliance, only non JMS (and JMSX) props returned
assertFalse("prop name2 not found", found2);
assertFalse("prop name4 not found", found3);
}
@Test
@SuppressWarnings("rawtypes")
public void testGetAllPropertyNames() throws JMSException {
JmsMessage msg = factory.createMessage();
String name1 = "floatProperty";
msg.setFloatProperty(name1, 1.3f);
String name2 = "JMSXDeliveryCount";
msg.setIntProperty(name2, 1);
String name3 = "JMSRedelivered";
msg.setBooleanProperty(name3, false);
boolean found1 = false;
boolean found2 = false;
boolean found3 = false;
for (Enumeration iter = msg.getAllPropertyNames(); iter.hasMoreElements();) {
Object element = iter.nextElement();
found1 |= element.equals(name1);
found2 |= element.equals(name2);
found3 |= element.equals(name3);
}
assertTrue("prop name1 found", found1);
assertTrue("prop name2 found", found2);
assertTrue("prop name4 found", found3);
}
@Test
public void testSetObjectProperty() throws JMSException {
JmsMessage msg = factory.createMessage();
String name = "property";
try {
msg.setObjectProperty(name, "string");
msg.setObjectProperty(name, Byte.valueOf("1"));
msg.setObjectProperty(name, Short.valueOf("1"));
msg.setObjectProperty(name, Integer.valueOf("1"));
msg.setObjectProperty(name, Long.valueOf("1"));
msg.setObjectProperty(name, Float.valueOf("1.1f"));
msg.setObjectProperty(name, Double.valueOf("1.1"));
msg.setObjectProperty(name, Boolean.TRUE);
msg.setObjectProperty(name, null);
} catch (MessageFormatException e) {
fail("should accept object primitives and String");
}
try {
msg.setObjectProperty(name, new byte[5]);
fail("should accept only object primitives and String");
} catch (MessageFormatException e) {
}
try {
msg.setObjectProperty(name, new Object());
fail("should accept only object primitives and String");
} catch (MessageFormatException e) {
}
}
@Test
public void testConvertProperties() throws Exception {
JmsMessage msg = factory.createMessage();
msg.setStringProperty("stringProperty", "string");
msg.setByteProperty("byteProperty", Byte.valueOf("1"));
msg.setShortProperty("shortProperty", Short.valueOf("1"));
msg.setIntProperty("intProperty", Integer.valueOf("1"));
msg.setLongProperty("longProperty", Long.valueOf("1"));
msg.setFloatProperty("floatProperty", Float.valueOf("1.1f"));
msg.setDoubleProperty("doubleProperty", Double.valueOf("1.1"));
msg.setBooleanProperty("booleanProperty", Boolean.TRUE);
msg.setObjectProperty("nullProperty", null);
Map<String, Object> properties = msg.getProperties();
assertEquals(properties.get("stringProperty"), "string");
assertEquals(((Byte) properties.get("byteProperty")).byteValue(), 1);
assertEquals(((Short) properties.get("shortProperty")).shortValue(), 1);
assertEquals(((Integer) properties.get("intProperty")).intValue(), 1);
assertEquals(((Long) properties.get("longProperty")).longValue(), 1);
assertEquals(((Float) properties.get("floatProperty")).floatValue(), 1.1f, 0);
assertEquals(((Double) properties.get("doubleProperty")).doubleValue(), 1.1, 0);
assertEquals(((Boolean) properties.get("booleanProperty")).booleanValue(), true);
assertNull(properties.get("nullProperty"));
}
@Test
public void testSetNullProperty() throws JMSException {
Message msg = factory.createMessage();
String name = "cheese";
msg.setStringProperty(name, "Cheddar");
assertEquals("Cheddar", msg.getStringProperty(name));
msg.setStringProperty(name, null);
assertEquals(null, msg.getStringProperty(name));
}
@Test
public void testSetNullPropertyName() throws JMSException {
JmsMessage msg = factory.createMessage();
try {
msg.setStringProperty(null, "Cheese");
fail("Should have thrown exception");
} catch (IllegalArgumentException e) {
LOG.info("Worked, caught: " + e);
}
}
@Test
public void testSetEmptyPropertyName() throws JMSException {
JmsMessage msg = factory.createMessage();
try {
msg.setStringProperty("", "Cheese");
fail("Should have thrown exception");
} catch (IllegalArgumentException e) {
LOG.info("Worked, caught: " + e);
}
}
@Test
public void testGetAndSetJMSXDeliveryCount() throws JMSException {
JmsMessage msg = factory.createMessage();
msg.setIntProperty("JMSXDeliveryCount", 1);
int count = msg.getIntProperty("JMSXDeliveryCount");
assertTrue("expected delivery count = 1 - got: " + count, count == 1);
}
@Test
public void testClearBody() throws JMSException {
JmsBytesMessage message = factory.createBytesMessage();
message.clearBody();
assertFalse(message.isReadOnlyBody());
assertNull(message.getContent());
}
@Test
public void testBooleanPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setBooleanProperty(propertyName, true);
assertEquals(((Boolean) msg.getObjectProperty(propertyName)).booleanValue(), true);
assertTrue(msg.getBooleanProperty(propertyName));
assertEquals(msg.getStringProperty(propertyName), "true");
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getLongProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testBytePropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setByteProperty(propertyName, (byte) 1);
assertEquals(((Byte) msg.getObjectProperty(propertyName)).byteValue(), 1);
assertEquals(msg.getByteProperty(propertyName), 1);
assertEquals(msg.getShortProperty(propertyName), 1);
assertEquals(msg.getIntProperty(propertyName), 1);
assertEquals(msg.getLongProperty(propertyName), 1);
assertEquals(msg.getStringProperty(propertyName), "1");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testShortPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setShortProperty(propertyName, (short) 1);
assertEquals(((Short) msg.getObjectProperty(propertyName)).shortValue(), 1);
assertEquals(msg.getShortProperty(propertyName), 1);
assertEquals(msg.getIntProperty(propertyName), 1);
assertEquals(msg.getLongProperty(propertyName), 1);
assertEquals(msg.getStringProperty(propertyName), "1");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testIntPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setIntProperty(propertyName, 1);
assertEquals(((Integer) msg.getObjectProperty(propertyName)).intValue(), 1);
assertEquals(msg.getIntProperty(propertyName), 1);
assertEquals(msg.getLongProperty(propertyName), 1);
assertEquals(msg.getStringProperty(propertyName), "1");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testLongPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setLongProperty(propertyName, 1);
assertEquals(((Long) msg.getObjectProperty(propertyName)).longValue(), 1);
assertEquals(msg.getLongProperty(propertyName), 1);
assertEquals(msg.getStringProperty(propertyName), "1");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testFloatPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setFloatProperty(propertyName, (float) 1.5);
assertEquals(((Float) msg.getObjectProperty(propertyName)).floatValue(), 1.5, 0);
assertEquals(msg.getFloatProperty(propertyName), 1.5, 0);
assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
assertEquals(msg.getStringProperty(propertyName), "1.5");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getLongProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testDoublePropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setDoubleProperty(propertyName, 1.5);
assertEquals(((Double) msg.getObjectProperty(propertyName)).doubleValue(), 1.5, 0);
assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
assertEquals(msg.getStringProperty(propertyName), "1.5");
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getLongProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testStringPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
String stringValue = "true";
msg.setStringProperty(propertyName, stringValue);
assertEquals(msg.getStringProperty(propertyName), stringValue);
assertEquals(msg.getObjectProperty(propertyName), stringValue);
assertEquals(msg.getBooleanProperty(propertyName), true);
stringValue = "1";
msg.setStringProperty(propertyName, stringValue);
assertEquals(msg.getByteProperty(propertyName), 1);
assertEquals(msg.getShortProperty(propertyName), 1);
assertEquals(msg.getIntProperty(propertyName), 1);
assertEquals(msg.getLongProperty(propertyName), 1);
stringValue = "1.5";
msg.setStringProperty(propertyName, stringValue);
assertEquals(msg.getFloatProperty(propertyName), 1.5, 0);
assertEquals(msg.getDoubleProperty(propertyName), 1.5, 0);
stringValue = "bad";
msg.setStringProperty(propertyName, stringValue);
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
try {
msg.getLongProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (NumberFormatException e) {
}
assertFalse(msg.getBooleanProperty(propertyName));
}
@Test
public void testObjectPropertyConversion() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
Object obj = new Object();
try {
msg.setProperty(propertyName, obj);
} catch (Exception e) {
}
try {
msg.getStringProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getBooleanProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getByteProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getShortProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getIntProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getLongProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getFloatProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
try {
msg.getDoubleProperty(propertyName);
fail("Should have thrown exception");
} catch (MessageFormatException e) {
}
}
@Test
public void testReadOnlyProperties() throws JMSException {
JmsMessage msg = factory.createMessage();
String propertyName = "property";
msg.setReadOnlyProperties(true);
try {
msg.setObjectProperty(propertyName, new Object());
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setStringProperty(propertyName, "test");
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setBooleanProperty(propertyName, true);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setByteProperty(propertyName, (byte) 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setShortProperty(propertyName, (short) 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setIntProperty(propertyName, 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setLongProperty(propertyName, 1);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setFloatProperty(propertyName, (float) 1.5);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
try {
msg.setDoubleProperty(propertyName, 1.5);
fail("Should have thrown exception");
} catch (MessageNotWriteableException e) {
}
}
@Test
public void testIsExpired() {
JmsMessage msg = factory.createMessage();
msg.setJMSExpiration(System.currentTimeMillis() - 1);
assertTrue(msg.isExpired());
msg.setJMSExpiration(System.currentTimeMillis() + 10000);
assertFalse(msg.isExpired());
}
}
| {
"content_hash": "77502f9242c4c0d7bb67aef85074ce34",
"timestamp": "",
"source": "github",
"line_count": 925,
"max_line_length": 91,
"avg_line_length": 36.211891891891895,
"alnum_prop": 0.6276868879866253,
"repo_name": "fusesource/hawtjms",
"id": "610f50386617e6117a596f91ae8300b84e898208",
"size": "34299",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "hawtjms-core/src/test/java/io/hawtjms/jms/message/JmsMessageTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1495002"
}
],
"symlink_target": ""
} |
import React from "react";
import ReactDOM from "react-dom";
import PlotlyRelayoutEventHandler from "./plotly_relayout_event_handler";
ReactDOM.render(
<React.StrictMode>
<PlotlyRelayoutEventHandler />
</React.StrictMode>,
document.getElementById("root")
);
| {
"content_hash": "e3af49013f44289490b46f1a03d39856",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 73,
"avg_line_length": 24.545454545454547,
"alnum_prop": 0.7555555555555555,
"repo_name": "google-research/pydemos",
"id": "838d241f185ce128afa1340de9cb11c62f7c4048",
"size": "270",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "pydemos/components/streamlit_plotly_event_handler/src/streamlit_plotly_event_handler/frontend/src/index.tsx",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "1927"
},
{
"name": "HTML",
"bytes": "3795"
},
{
"name": "JavaScript",
"bytes": "2408"
},
{
"name": "Python",
"bytes": "111079"
},
{
"name": "Shell",
"bytes": "180"
},
{
"name": "Svelte",
"bytes": "4126"
},
{
"name": "TypeScript",
"bytes": "20257"
}
],
"symlink_target": ""
} |
"""
Utilities for working with external processes.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import print_function
# Stdlib
import os
import sys
# Our own
if sys.platform == 'win32':
from ._process_win32 import _find_cmd, system, getoutput, arg_split, check_pid
elif sys.platform == 'cli':
from ._process_cli import _find_cmd, system, getoutput, arg_split, check_pid
else:
from ._process_posix import _find_cmd, system, getoutput, arg_split, check_pid
from ._process_common import getoutputerror, get_output_error_code, process_handler
from . import py3compat
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
class FindCmdError(Exception):
pass
def find_cmd(cmd):
"""Find absolute path to executable cmd in a cross platform manner.
This function tries to determine the full path to a command line program
using `which` on Unix/Linux/OS X and `win32api` on Windows. Most of the
time it will use the version that is first on the users `PATH`.
Warning, don't use this to find IPython command line programs as there
is a risk you will find the wrong one. Instead find those using the
following code and looking for the application itself::
from IPython.utils.path import get_ipython_module_path
from IPython.utils.process import pycmd2argv
argv = pycmd2argv(get_ipython_module_path('IPython.terminal.ipapp'))
Parameters
----------
cmd : str
The command line program to look for.
"""
try:
path = _find_cmd(cmd).rstrip()
except OSError:
raise FindCmdError('command could not be found: %s' % cmd)
# which returns empty if not found
if path == '':
raise FindCmdError('command could not be found: %s' % cmd)
return os.path.abspath(path)
def is_cmd_found(cmd):
"""Check whether executable `cmd` exists or not and return a bool."""
try:
find_cmd(cmd)
return True
except FindCmdError:
return False
def pycmd2argv(cmd):
r"""Take the path of a python command and return a list (argv-style).
This only works on Python based command line programs and will find the
location of the ``python`` executable using ``sys.executable`` to make
sure the right version is used.
For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe,
.com or .bat, and [, cmd] otherwise.
Parameters
----------
cmd : string
The path of the command.
Returns
-------
argv-style list.
"""
ext = os.path.splitext(cmd)[1]
if ext in ['.exe', '.com', '.bat']:
return [cmd]
else:
return [sys.executable, cmd]
def abbrev_cwd():
""" Return abbreviated version of cwd, e.g. d:mydir """
cwd = py3compat.getcwd().replace('\\','/')
drivepart = ''
tail = cwd
if sys.platform == 'win32':
if len(cwd) < 4:
return cwd
drivepart,tail = os.path.splitdrive(cwd)
parts = tail.split('/')
if len(parts) > 2:
tail = '/'.join(parts[-2:])
return (drivepart + (
cwd == '/' and '/' or tail))
| {
"content_hash": "4f9b58e26d1c29db480698d9cc607cae",
"timestamp": "",
"source": "github",
"line_count": 122,
"max_line_length": 83,
"avg_line_length": 30.42622950819672,
"alnum_prop": 0.5616918103448276,
"repo_name": "initNirvana/Easyphotos",
"id": "64b7254d0650418aa850450aa97eb465d78c2b87",
"size": "3730",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "env/lib/python3.4/site-packages/IPython/utils/process.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "5939"
},
{
"name": "CSS",
"bytes": "13653"
},
{
"name": "HTML",
"bytes": "129191"
},
{
"name": "JavaScript",
"bytes": "1401324"
},
{
"name": "Python",
"bytes": "11874458"
},
{
"name": "Shell",
"bytes": "3668"
},
{
"name": "Smarty",
"bytes": "21402"
}
],
"symlink_target": ""
} |
from tools.load import LoadMatrix
from numpy import ushort
from sg import sg
lm=LoadMatrix()
trainword=ushort(lm.load_numbers('../data/fm_test_word.dat'))
testword=ushort(lm.load_numbers('../data/fm_test_word.dat'))
parameter_list=[[trainword,testword,10,1.4],
[trainword,testword,11,1.5]]
def kernel_linearword (fm_train_word=trainword,fm_test_word=testword,
size_cache=10, scale=1.4):
sg('set_features', 'TRAIN', fm_train_word)
sg('set_features', 'TEST', fm_test_word)
sg('set_kernel', 'LINEAR', 'WORD', size_cache, scale)
km=sg('get_kernel_matrix', 'TRAIN')
km=sg('get_kernel_matrix', 'TEST')
return km
if __name__=='__main__':
print('LinearWord')
kernel_linearword(*parameter_list[0])
| {
"content_hash": "d0d38755836e43f52cca43c47a7cf0e1",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 69,
"avg_line_length": 32.59090909090909,
"alnum_prop": 0.691771269177127,
"repo_name": "Saurabh7/shogun",
"id": "b97f68c5fcef04de1767f6f1f1ecbc691ede58ae",
"size": "717",
"binary": false,
"copies": "22",
"ref": "refs/heads/master",
"path": "examples/undocumented/python_static/kernel_linearword.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "104870"
},
{
"name": "C++",
"bytes": "11435353"
},
{
"name": "CMake",
"bytes": "213091"
},
{
"name": "Lua",
"bytes": "1204"
},
{
"name": "M",
"bytes": "10020"
},
{
"name": "Makefile",
"bytes": "452"
},
{
"name": "Matlab",
"bytes": "66047"
},
{
"name": "Perl",
"bytes": "31939"
},
{
"name": "Perl6",
"bytes": "15714"
},
{
"name": "Protocol Buffer",
"bytes": "1476"
},
{
"name": "Python",
"bytes": "431160"
},
{
"name": "R",
"bytes": "53362"
},
{
"name": "Ruby",
"bytes": "59"
},
{
"name": "Shell",
"bytes": "17074"
}
],
"symlink_target": ""
} |
using Newtonsoft.Json;
using System;
namespace WordPressPCL.Models
{
/// <summary>
/// Type represent Media Entity of WP REST API
/// </summary>
public class MediaItem : Base
{
/// <summary>
/// The date the object was published, in the site’s timezone.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime Date { get; set; }
/// <summary>
/// The date the object was published, as GMT.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("date_gmt", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime DateGmt { get; set; }
/// <summary>
/// The globally unique identifier for the object.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("guid", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Guid Guid { get; set; }
/// <summary>
/// The date the object was last modified, in the site’s timezone.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("modified", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime Modified { get; set; }
/// <summary>
/// The date the object was last modified, as GMT.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("modified_gmt", DefaultValueHandling = DefaultValueHandling.Ignore)]
public DateTime ModifiedGmt { get; set; }
/// <summary>
/// An alphanumeric identifier for the object unique to its type.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("slug")]
public string Slug { get; set; }
/// <summary>
/// A named status for the object.
/// <see cref="Models.Status"/>
/// </summary>
/// <remarks>
/// Context: edit
/// One of: publish, future, draft, pending, private</remarks>
[JsonProperty("status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public MediaQueryStatus Status { get; set; }
/// <summary>
/// Type of Post for the object.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("type")]
public string Type { get; set; }
/// <summary>
/// URL to the object.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("link")]
public string Link { get; set; }
/// <summary>
/// The title for the object.
/// <see cref="Models.Title"/>
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("title")]
public Title Title { get; set; }
/// <summary>
/// The id for the author of the object.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("author")]
public int Author { get; set; }
/// <summary>
/// Whether or not comments are open on the object.
/// <see cref="OpenStatus"/>
/// </summary>
/// <remarks>Context: view, edit
/// One of: open, closed</remarks>
[JsonProperty("comment_status", DefaultValueHandling = DefaultValueHandling.Ignore)]
public OpenStatus? CommentStatus { get; set; }
/// <summary>
/// Whether or not the object can be pinged.
/// <see cref="OpenStatus"/>
/// </summary>
/// <remarks>Context: view, edit
/// One of: open, closed</remarks>
[JsonProperty("ping_status")]
public OpenStatus? PingStatus { get; set; }
/// <summary>
/// Alternative text to display when resource is not displayed.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("alt_text")]
public string AltText { get; set; }
/// <summary>
/// The caption for the resource.
/// <see cref="Models.Caption"/>
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("caption")]
public Caption Caption { get; set; }
/// <summary>
/// The description for the resource.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("description")]
public Description Description { get; set; }
/// <summary>
/// Type of resource.
/// <see cref="Models.MediaType"/>
/// </summary>
/// <remarks>Context: view, edit, embed
/// One of: image, file</remarks>
[JsonProperty("media_type")]
public MediaType MediaType { get; set; }
/// <summary>
/// MIME type of resource.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("mime_type")]
public string MimeType { get; set; }
/// <summary>
/// Details about the resource file, specific to its type.
/// <see cref="Models.MediaDetails"/>
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("media_details")]
public MediaDetails MediaDetails { get; set; }
/// <summary>
/// The id for the associated post of the resource.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("post", NullValueHandling = NullValueHandling.Ignore)]
public int Post { get; set; }
/// <summary>
/// URL to the original resource file.
/// </summary>
/// <remarks>Context: view, edit, embed</remarks>
[JsonProperty("source_url")]
public string SourceUrl { get; set; }
/// <summary>
/// Meta fields.
/// </summary>
/// <remarks>Context: view, edit</remarks>
[JsonProperty("meta", DefaultValueHandling = DefaultValueHandling.Ignore)]
public dynamic Meta { get; set; }
/// <summary>
/// Links to related resources
/// </summary>
[JsonProperty("_links", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Links Links { get; set; }
/// <summary>
/// Parameterless constructor
/// </summary>
public MediaItem()
{
}
}
} | {
"content_hash": "c5988642a567ef18f8e5f337c195c0d6",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 92,
"avg_line_length": 34.56315789473684,
"alnum_prop": 0.5515456068219887,
"repo_name": "cobalto/WordPressPCL",
"id": "240509fe4734327d01602d206952ed2114795f72",
"size": "6573",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "WordPressPCL/Models/MediaItem.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "301096"
},
{
"name": "Shell",
"bytes": "233"
}
],
"symlink_target": ""
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head><title></title>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="search.css"/>
<script type="text/javascript" src="search.js"></script>
</head>
<body class="SRPage">
<div id="SRIndex">
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRResult" id="SR__5fcontainer">
<div class="SREntry">
<a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../classSteinberg_1_1TIterator.html#acf598d56af757c81c61123bac237df29" target="_parent">_container</a>
<span class="SRScope">Steinberg::TIterator</span>
</div>
</div>
<div class="SRResult" id="SR__5fdelta">
<div class="SREntry">
<a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../classSteinberg_1_1TArrayBase.html#a5566c07b716f6b62c094d159812d6298" target="_parent">_delta</a>
<span class="SRScope">Steinberg::TArrayBase</span>
</div>
</div>
<div class="SRResult" id="SR__5fentries">
<div class="SREntry">
<a id="Item2" onkeydown="return searchResults.Nav(event,2)" onkeypress="return searchResults.Nav(event,2)" onkeyup="return searchResults.Nav(event,2)" class="SRSymbol" href="../classSteinberg_1_1TArrayBase.html#afd7bc10249c9c53a611fdaa84d3cc766" target="_parent">_entries</a>
<span class="SRScope">Steinberg::TArrayBase</span>
</div>
</div>
<div class="SRResult" id="SR__5fmeta_5fclass">
<div class="SREntry">
<a id="Item3" onkeydown="return searchResults.Nav(event,3)" onkeypress="return searchResults.Nav(event,3)" onkeyup="return searchResults.Nav(event,3)" class="SRSymbol" href="../classfactory_8h.html#a46dabd263537e5305c29e252e9d4e0df" target="_parent">_META_CLASS</a>
<span class="SRScope">classfactory.h</span>
</div>
</div>
<div class="SRResult" id="SR__5fmeta_5fclass_5fiface">
<div class="SREntry">
<a id="Item4" onkeydown="return searchResults.Nav(event,4)" onkeypress="return searchResults.Nav(event,4)" onkeyup="return searchResults.Nav(event,4)" class="SRSymbol" href="../classfactory_8h.html#acc4233582b4e6b60c26daffd4e9d3573" target="_parent">_META_CLASS_IFACE</a>
<span class="SRScope">classfactory.h</span>
</div>
</div>
<div class="SRResult" id="SR__5fsize">
<div class="SREntry">
<a id="Item5" onkeydown="return searchResults.Nav(event,5)" onkeypress="return searchResults.Nav(event,5)" onkeyup="return searchResults.Nav(event,5)" class="SRSymbol" href="../classSteinberg_1_1TContainer.html#aee81fc560e52347f3a9ff88537292be5" target="_parent">_size</a>
<span class="SRScope">Steinberg::TContainer</span>
</div>
</div>
<div class="SRResult" id="SR__5ftotal">
<div class="SREntry">
<a id="Item6" onkeydown="return searchResults.Nav(event,6)" onkeypress="return searchResults.Nav(event,6)" onkeyup="return searchResults.Nav(event,6)" class="SRSymbol" href="../classSteinberg_1_1TArrayBase.html#a59c916784df3701441d368b050e2b437" target="_parent">_total</a>
<span class="SRScope">Steinberg::TArrayBase</span>
</div>
</div>
<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>
| {
"content_hash": "0572f6f31f43789e1bd130425966da8f",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 278,
"avg_line_length": 59.17741935483871,
"alnum_prop": 0.7372581084764241,
"repo_name": "rcgilbert/csc344-wi14",
"id": "018b830ec5efcaf7c7e67d84b8ad23a271d53b09",
"size": "3669",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "SDKs/VST3 SDK/doc/basemodule/search/all_5f.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "11495015"
},
{
"name": "C++",
"bytes": "12400956"
},
{
"name": "CSS",
"bytes": "117677"
},
{
"name": "DOT",
"bytes": "15057"
},
{
"name": "Erlang",
"bytes": "1470"
},
{
"name": "Java",
"bytes": "24037"
},
{
"name": "JavaScript",
"bytes": "146242"
},
{
"name": "M",
"bytes": "2372"
},
{
"name": "Objective-C",
"bytes": "1152224"
},
{
"name": "PHP",
"bytes": "12544"
},
{
"name": "Perl",
"bytes": "391898"
},
{
"name": "Python",
"bytes": "1350"
},
{
"name": "R",
"bytes": "7719"
},
{
"name": "Shell",
"bytes": "9212"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.IO;
using SocialInsurance.Germany.Messages.Pocos;
using SocialInsurance.Germany.Messages.Pocos.BNA;
using Xunit;
namespace SocialInsurance.Germany.Messages.Tests.bwnac
{
public class BeitragsnachweisTests : TestBasis, IClassFixture<DefaultStreamFactoryFixture>
{
public BeitragsnachweisTests(DefaultStreamFactoryFixture fixture)
: base(fixture.Factory)
{
}
/// <summary>
/// BW02
/// </summary>
[Fact(DisplayName = "TestBW02")]
public void TestBW02()
{
var data = ReadData("ebna0091.a35");
var deuevMessage = GetMessageFromString(data, "bw02-bwnac-v11");
Assert.True(deuevMessage.BW02.Count > 0);
Assert.Equal(data, GetStringFromMessage(deuevMessage, "bw02-bwnac-v11"));
}
[Fact]
public void TestGenericEnvelopeRequest()
{
var data = ReadData("ebna0091.a35");
var deuevMessage = GetMessageFromString(data, "envelope-request-generic");
Assert.Empty(deuevMessage.BW02);
Assert.Single(deuevMessage.VOSZ);
Assert.Single(deuevMessage.NCSZ);
}
[Fact(Skip = "Keine Kundenunabhängigen Testdaten vorhanden")]
public void TestGenericEnvelopeResponse()
{
var data = File.ReadAllText(@"D:\temp\arbeit\meldungen\ebna02457-response.a18");
var deuevMessage = GetMessageFromString(data, "super-message");
Assert.Empty(deuevMessage.BW02);
Assert.Equal(2, deuevMessage.VOSZ.Count);
Assert.Equal(2, deuevMessage.NCSZ.Count);
}
/// <summary>
/// Erstellt die Meldedatei anhand von <paramref name="data"/> neu.
/// </summary>
/// <param name="data">Die Daten die zur Erstellung der Meldedatei benutzt werden sollen</param>
/// <param name="streamName">Der Name des Streams der für die Erstellung der Meldedatei benutzt werden soll</param>
/// <returns>Die Meldedatei</returns>
private string GetStringFromMessage(BwnaMessageData data, string streamName)
{
var output = new StringWriter() {NewLine = "\n"};
var writer = StreamFactory.CreateWriter(streamName, output);
foreach (var record in data.VOSZ)
writer.Write(record);
writer.Write(data.DSKO);
foreach (var record in data.BW02)
writer.Write(record);
foreach (var record in data.NCSZ)
writer.Write(record);
writer.Close();
return output.ToString();
}
/// <summary>
/// Ruft die Meldedatei mit einem bestimmten Dateinamen aus dem Deuev-Ordner ab
/// </summary>
/// <param name="input">Die Meldedatei</param>
/// <param name="name">Name in der Meldungen.xml</param>
/// <returns>Meldedatei als DeuevMessageData-Objekt</returns>
private BwnaMessageData GetMessageFromString(string input, string name)
{
var reader = StreamFactory.CreateReader(name, new StringReader(input));
var deuevMessage = new BwnaMessageData();
try
{
var streamObject = reader.Read();
do
{
var vosz = Assert.IsType<VOSZ06>(streamObject);
deuevMessage.VOSZ.Add(vosz);
streamObject = reader.Read();
}
while (reader.RecordName == "VOSZ" || reader.RecordName == "VOSZ-BNA-v06");
var dsko = Assert.IsType<DSKO02>(streamObject);
deuevMessage.DSKO = dsko;
streamObject = reader.Read();
while (reader.RecordName == "BW02" || reader.RecordName == "BW02-v11")
{
var record = Assert.IsType<BW0211>(streamObject);
deuevMessage.BW02.Add(record);
streamObject = reader.Read();
}
do
{
var ncsz = Assert.IsType<NCSZ06>(streamObject);
deuevMessage.NCSZ.Add(ncsz);
streamObject = reader.Read();
}
while (reader.RecordName != null && (reader.RecordName == "NCSZ" || reader.RecordName == "NCSZ-BNA-v06"));
Assert.Null(reader.RecordName);
Assert.Equal(deuevMessage.VOSZ.Count, deuevMessage.NCSZ.Count);
return deuevMessage;
}
finally
{
reader.Close();
}
}
/// <summary>
/// Hilfsklasse der Meldedatei, die eine Meldedatei im Deuev-Format
/// mit den Datensätzen als Objekte enthält
/// </summary>
private class BwnaMessageData
{
public BwnaMessageData()
{
VOSZ = new List<VOSZ06>();
BW02 = new List<BW0211>();
NCSZ = new List<NCSZ06>();
}
public List<VOSZ06> VOSZ { get; }
public DSKO02 DSKO { get; set; }
public List<BW0211> BW02 { get; }
public List<NCSZ06> NCSZ { get; }
}
}
}
| {
"content_hash": "8a31df1d7627a942f6d5052fb47e82ef",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 123,
"avg_line_length": 36.52739726027397,
"alnum_prop": 0.5544721545096568,
"repo_name": "dataline-gmbh/SocialInsurance.Germany.Messages",
"id": "b7780d3f86fb01fb1041fbf84a43073b00b077ea",
"size": "5339",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "test/Dataline.SocialInsurance.Germany.Messages.Tests/bwnac/BeitragsnachweisTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1191177"
},
{
"name": "PowerShell",
"bytes": "750"
}
],
"symlink_target": ""
} |
.thumbnail > img,
.thumbnail a > img,
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
display: block;
max-width: 100%;
height: auto;
}
.btn-group-lg > .btn {
padding: 18px 27px;
font-size: 17px;
line-height: 1.33;
border-radius: 6px;
}
.btn-group-sm > .btn {
padding: 6px 9px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-group-xs > .btn {
padding: 1px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.dl-horizontal dd:before,
.dl-horizontal dd:after,
.container:before,
.container:after,
.container-fluid:before,
.container-fluid:after,
.row:before,
.row:after,
.form-horizontal .form-group:before,
.form-horizontal .form-group:after,
.btn-toolbar:before,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after,
.nav:before,
.nav:after,
.navbar:before,
.navbar:after,
.navbar-header:before,
.navbar-header:after,
.navbar-collapse:before,
.navbar-collapse:after,
.pager:before,
.pager:after,
.panel-body:before,
.panel-body:after,
.modal-footer:before,
.modal-footer:after,
.config:before,
.config:after {
content: " ";
display: table;
}
.dl-horizontal dd:after,
.container:after,
.container-fluid:after,
.row:after,
.form-horizontal .form-group:after,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:after,
.nav:after,
.navbar:after,
.navbar-header:after,
.navbar-collapse:after,
.pager:after,
.panel-body:after,
.modal-footer:after,
.config:after {
clear: both;
}
.error {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
text-align: center;
}
.error p {
margin-top: 15%;
font-size: 18px;
text-wrap: wrap;
}
.visualize-chart {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
min-height: 0;
min-width: 0;
}
.vis-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
min-height: 0;
min-width: 0;
}
/* YAxis logic */
.y-axis-col-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 0;
min-width: 0;
}
.y-axis-col {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 0 36px;
-ms-flex: 1 0 36px;
flex: 1 0 36px;
min-height: 0;
min-width: 0;
}
.y-axis-spacer-block {
min-height: 45px;
}
.y-axis-div-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
width: 38px;
min-height: 20px;
min-width: 0;
}
.y-axis-div {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 25px;
-ms-flex: 1 1 25px;
flex: 1 1 25px;
min-width: 14px;
min-height: 14px;
}
.y-axis-title {
min-height: 14px;
min-width: 14px;
}
.y-axis-chart-title {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 14px;
min-width: 0;
width: 14px;
}
.y-axis-title text,
.x-axis-title text {
font-size: 9pt;
fill: #848e96;
font-weight: bold;
}
.chart-title {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
min-height: 14px;
min-width: 14px;
}
.chart-title text {
font-size: 11px;
fill: #848e96;
}
.vis-col-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 0 20px;
-ms-flex: 1 0 20px;
flex: 1 0 20px;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 0;
min-width: 0;
margin-right: 8px;
}
.chart-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 0 20px;
-ms-flex: 1 0 20px;
flex: 1 0 20px;
overflow: visible;
margin: 0;
min-height: 0;
min-width: 0;
}
.chart-wrapper-column {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 0 20px;
-ms-flex: 1 0 20px;
flex: 1 0 20px;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
min-height: 0;
min-width: 0;
}
.chart-wrapper-row {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
min-height: 0;
min-width: 0;
}
.chart {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 100%;
-ms-flex: 1 1 100%;
flex: 1 1 100%;
min-height: 0;
min-width: 0;
overflow: visible;
}
.chart > svg {
display: block;
}
.chart-row {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 0;
min-width: 0;
}
.chart-column {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
min-height: 0;
min-width: 0;
}
.x-axis-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 45px;
min-width: 0;
overflow: visible;
}
.x-axis-div-wrapper {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
min-height: 15px;
min-width: 0;
}
.x-axis-chart-title {
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
min-height: 15px;
max-height: 15px;
min-width: 20px;
}
.x-axis-title {
min-height: 15px;
max-height: 15px;
min-width: 20px;
overflow: hidden;
}
.x-axis-div {
margin-top: -5px;
min-height: 20px;
min-width: 20px;
}
.legend-col-wrapper {
-webkit-box-flex: 0;
-moz-box-flex: 0;
-webkit-flex: 0 1 auto;
-ms-flex: 0 1 auto;
flex: 0 1 auto;
z-index: 10;
overflow-x: hidden;
overflow-y: auto;
min-height: 0;
}
.legend-col-wrapper .legend-toggle {
cursor: pointer;
opacity: 0.75;
white-space: nowrap;
font-size: 0.9em;
}
.legend-col-wrapper .legend-toggle .legend-open {
margin-right: 20px;
}
.legend-col-wrapper .legend-toggle .legend-closed {
font-size: 1.5em;
padding-left: 5px;
}
.legend-col-wrapper .column-labels {
text-align: right;
}
.legend-col-wrapper .legend-ul {
list-style-type: none;
padding: 0;
visibility: visible;
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-direction: normal;
-moz-box-direction: normal;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
min-height: 0;
min-width: 60px;
margin-right: 5px;
}
.legend-col-wrapper .legend-ul li.color {
min-height: 22px;
padding: 3px 0 3px 0;
font-size: 12px;
line-height: 13px;
color: #666;
cursor: default;
text-align: left;
-webkit-flex-grow: 2;
flex-grow: 2;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
max-width: 150px;
}
.legend-col-wrapper .legend-ul li.color .dots {
padding-right: 5px;
}
.legend-col-wrapper .legend-ul.hidden {
visibility: hidden;
}
/* Axis Styles */
.axis {
shape-rendering: crispEdges;
stroke-width: 1px;
}
.axis line,
.axis path {
stroke: #ddd;
fill: none;
shape-rendering: crispEdges;
}
.x.axis path {
display: none;
}
.tick text {
font-size: 8pt;
fill: #848e96;
}
/* Brush Styling */
.brush .extent {
stroke: #fff;
fill-opacity: .125;
shape-rendering: crispEdges;
}
/* SVG Element Default Styling */
rect {
stroke: none;
opacity: 1;
}
rect:hover {
opacity: 0.65;
}
circle {
opacity: 0;
}
circle:hover {
opacity: 1;
stroke-width: 10px;
stroke-opacity: 0.65;
}
.overlap_area {
opacity: 0.6;
}
.blur_shape {
opacity: 0.3 !important;
}
.slice:hover {
opacity: 0.65;
}
.leaflet-clickable:hover {
stroke-width: 10px;
stroke-opacity: 0.65;
}
/* Visualization Styling */
.line circle {
opacity: 1;
}
.line circle:hover {
stroke-width: 10px;
stroke-opacity: 0.65;
}
.endzone {
opacity: 0.05;
fill: #000;
pointer-events: none;
}
.vis-tooltip,
.vis-tooltip-sizing-clone {
visibility: hidden;
line-height: 1.1;
font-size: 12px;
font-weight: normal;
background: rgba(34, 34, 34, 0.93);
color: #ecf0f1;
border-radius: 4px;
position: fixed;
z-index: 120;
word-wrap: break-word;
max-width: 40%;
overflow: hidden;
pointer-events: none;
}
.vis-tooltip > :last-child,
.vis-tooltip-sizing-clone > :last-child {
margin-bottom: 8px;
}
.vis-tooltip > *,
.vis-tooltip-sizing-clone > * {
margin: 8px 8px 0;
}
.vis-tooltip table td,
.vis-tooltip-sizing-clone table td,
.vis-tooltip table th,
.vis-tooltip-sizing-clone table th {
padding: 4px;
}
.vis-tooltip table td.row-bucket,
.vis-tooltip-sizing-clone table td.row-bucket,
.vis-tooltip table th.row-bucket,
.vis-tooltip-sizing-clone table th.row-bucket {
word-break: break-all;
}
.vis-tooltip table thead tr,
.vis-tooltip-sizing-clone table thead tr {
border-bottom: 1px solid #95a5a6;
}
.vis-tooltip table tbody tr,
.vis-tooltip-sizing-clone table tbody tr {
border-top: 1px solid #95a5a6;
}
.vis-tooltip table tbody tr:first-child,
.vis-tooltip-sizing-clone table tbody tr:first-child {
border-top: none;
}
.vis-tooltip-header {
margin: 0 0 8px 0;
padding: 4px 8px;
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-moz-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.vis-tooltip-header:last-child {
margin-bottom: 0;
}
.vis-tooltip-header-icon {
-webkit-box-flex: 0;
-moz-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
padding-right: 8px;
}
.vis-tooltip-header-text {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 200px;
-ms-flex: 1 1 200px;
flex: 1 1 200px;
}
.vis-tooltip-header + * {
margin-top: 8px;
}
.vis-tooltip-sizing-clone {
visibility: hidden;
position: fixed;
top: -500px;
left: -500px;
}
/* _tilemap */
.tilemap {
margin-bottom: 6px;
border: 1px solid #DDD;
position: relative;
}
/* leaflet Dom Util div for map label */
.tilemap-legend {
padding: 5px 7px 5px 7px;
margin: 0;
font: 11px/13px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255, 255, 255, 0.92);
box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
border-radius: 5px;
text-align: left;
line-height: 15px;
color: #666;
}
.tilemap-legend i {
width: 10px;
height: 10px;
float: left;
margin: 2px 4px 0 0;
opacity: 1;
border-radius: 50%;
border-width: 1px;
border-style: solid;
border-color: #999;
background: #aaa;
}
/* leaflet Dom Util div for map legend */
.tilemap-info {
padding: 3px 7px 3px 7px;
margin: 0;
font-size: 12px;
background: white;
background: rgba(255, 255, 255, 0.92);
box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
border-radius: 5px;
}
.tilemap-info h2 {
font-size: 12px !important;
margin: 0 !important;
padding: 0;
color: #444;
}
.leaflet-control-fit {
text-align: center;
background: #fff;
width: 26px;
height: 26px;
outline: 1px black;
}
/* over-rides leaflet popup styles to look like kibana tooltip */
.leaflet-container {
background: #fff !important;
outline: 0 !important;
}
.leaflet-popup-content-wrapper {
margin: 0;
padding: 0;
}
.leaflet-popup {
margin-bottom: 16px !important;
}
.leaflet-popup-content-wrapper {
background: rgba(70, 82, 93, 0.95) !important;
color: #ecf0f1 !important;
border-radius: 4px !important;
padding: 0 !important;
}
.leaflet-popup-content {
padding: 8px !important;
margin: 0 !important;
line-height: 14px !important;
}
.leaflet-popup-tip-container,
.leaflet-popup-close-button {
display: none !important;
}
.leaflet-control-layers-expanded {
padding: 0;
margin: 0;
font: 12px/13px Arial, Helvetica, sans-serif;
line-height: 14px !important;
}
.leaflet-control-layers-expanded label {
font-weight: normal !important;
margin: 0 !important;
padding: 0 !important;
}
/* filter to desaturate mapquest tiles */
img.leaflet-tile {
-webkit-filter: brightness(1.03) grayscale(0.83) contrast(1.07);
-moz-filter: brightness(1.03) grayscale(0.83) contrast(1.07);
-ms-filter: brightness(1.03) grayscale(0.83) contrast(1.07);
filter: brightness(1.03) grayscale(0.83) contrast(1.07);
}
img.leaflet-tile.filters-off {
-webkit-filter: none;
-moz-filter: none;
-ms-filter: none;
filter: none;
}
.vis-alerts {
position: relative;
}
.vis-alerts-tray {
position: absolute;
bottom: 5px;
left: 0px;
right: 0px;
list-style: none;
padding: 0;
transition-property: opacity;
transition-delay: 50ms;
transition-duration: 50ms;
}
.vis-alerts .vis-alert {
margin: 0 10px 10px;
padding: 5px 10px 5px 5px;
color: white;
border-radius: 4px;
border: 1px solid white;
display: -webkit-box;
display: -moz-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.vis-alerts .vis-alert-success {
background-color: rgba(49, 196, 113, 0.75);
border-color: #279b59;
color: #ffffff;
}
.vis-alerts .vis-alert-success hr {
border-top-color: #22874e;
}
.vis-alerts .vis-alert-success .alert-link {
color: #e6e6e6;
}
.vis-alerts .vis-alert-info {
background-color: rgba(31, 107, 122, 0.75);
border-color: #154751;
color: #ffffff;
}
.vis-alerts .vis-alert-info hr {
border-top-color: #0f353d;
}
.vis-alerts .vis-alert-info .alert-link {
color: #e6e6e6;
}
.vis-alerts .vis-alert-warning {
background-color: rgba(243, 156, 18, 0.75);
border-color: #c87f0a;
color: #ffffff;
}
.vis-alerts .vis-alert-warning hr {
border-top-color: #b06f09;
}
.vis-alerts .vis-alert-warning .alert-link {
color: #e6e6e6;
}
.vis-alerts .vis-alert-danger {
background-color: rgba(231, 76, 60, 0.75);
border-color: #d62c1a;
color: #ffffff;
}
.vis-alerts .vis-alert-danger hr {
border-top-color: #bf2718;
}
.vis-alerts .vis-alert-danger .alert-link {
color: #e6e6e6;
}
.vis-alerts-icon {
margin: 0;
padding: 0 10px;
-webkit-box-flex: 0;
-moz-box-flex: 0;
-webkit-flex: 0 0 auto;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
-webkit-align-self: center;
-ms-flex-item-align: center;
align-self: center;
}
.vis-alerts-text {
-webkit-box-flex: 1;
-moz-box-flex: 1;
-webkit-flex: 1 1 auto;
-ms-flex: 1 1 auto;
flex: 1 1 auto;
margin: 0;
padding: 0;
}
| {
"content_hash": "da9e5abc9c7d2d27168b033929fac6a5",
"timestamp": "",
"source": "github",
"line_count": 822,
"max_line_length": 66,
"avg_line_length": 20.89051094890511,
"alnum_prop": 0.6610179361751689,
"repo_name": "baozoumanhua/elk-rtf",
"id": "e69881c170b8ca59309ea80ee000759a986f2ff8",
"size": "17172",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "kibana-4-linux-x64/src/public/components/vislib/styles/main.css",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "17439"
},
{
"name": "C",
"bytes": "671808"
},
{
"name": "C++",
"bytes": "433832"
},
{
"name": "CSS",
"bytes": "1297291"
},
{
"name": "DTrace",
"bytes": "12324"
},
{
"name": "Groff",
"bytes": "39012"
},
{
"name": "HTML",
"bytes": "542219"
},
{
"name": "JavaScript",
"bytes": "12684468"
},
{
"name": "Ruby",
"bytes": "38283"
},
{
"name": "Shell",
"bytes": "90856"
},
{
"name": "Smarty",
"bytes": "1516"
}
],
"symlink_target": ""
} |
package fake
import (
clientset "github.com/kubeflow/pytorch-operator/pkg/client/clientset/versioned"
kubeflowv1 "github.com/kubeflow/pytorch-operator/pkg/client/clientset/versioned/typed/pytorch/v1"
fakekubeflowv1 "github.com/kubeflow/pytorch-operator/pkg/client/clientset/versioned/typed/pytorch/v1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
)
// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
cs := &Clientset{tracker: o}
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
cs.AddReactor("*", "*", testing.ObjectReaction(o))
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
gvr := action.GetResource()
ns := action.GetNamespace()
watch, err := o.Watch(gvr, ns)
if err != nil {
return false, nil, err
}
return true, watch, nil
})
return cs
}
// Clientset implements clientset.Interface. Meant to be embedded into a
// struct to get a default implementation. This makes faking out just the method
// you want to test easier.
type Clientset struct {
testing.Fake
discovery *fakediscovery.FakeDiscovery
tracker testing.ObjectTracker
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.discovery
}
func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
// KubeflowV1 retrieves the KubeflowV1Client
func (c *Clientset) KubeflowV1() kubeflowv1.KubeflowV1Interface {
return &fakekubeflowv1.FakeKubeflowV1{Fake: &c.Fake}
}
| {
"content_hash": "1e444288b4af9237d227f126edf729ed",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 107,
"avg_line_length": 33.65625,
"alnum_prop": 0.7525533890436398,
"repo_name": "kubeflow/pytorch-operator",
"id": "882bf4f557ae6fd7110440893606fb1300b4a85b",
"size": "2800",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pkg/client/clientset/versioned/fake/clientset_generated.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "481"
},
{
"name": "Go",
"bytes": "191214"
},
{
"name": "Jsonnet",
"bytes": "7274209"
},
{
"name": "Jupyter Notebook",
"bytes": "16567"
},
{
"name": "Python",
"bytes": "140133"
},
{
"name": "Shell",
"bytes": "19585"
}
],
"symlink_target": ""
} |
import click
from parsec.commands.toolshed_repositories.create_repository import cli as create_repository
from parsec.commands.toolshed_repositories.get_ordered_installable_revisions import cli as get_ordered_installable_revisions
from parsec.commands.toolshed_repositories.get_repositories import cli as get_repositories
from parsec.commands.toolshed_repositories.get_repository_revision_install_info import cli as get_repository_revision_install_info
from parsec.commands.toolshed_repositories.repository_revisions import cli as repository_revisions
from parsec.commands.toolshed_repositories.search_repositories import cli as search_repositories
from parsec.commands.toolshed_repositories.show_repository import cli as show_repository
from parsec.commands.toolshed_repositories.show_repository_revision import cli as show_repository_revision
from parsec.commands.toolshed_repositories.update_repository import cli as update_repository
@click.group()
def cli():
pass
cli.add_command(create_repository)
cli.add_command(get_ordered_installable_revisions)
cli.add_command(get_repositories)
cli.add_command(get_repository_revision_install_info)
cli.add_command(repository_revisions)
cli.add_command(search_repositories)
cli.add_command(show_repository)
cli.add_command(show_repository_revision)
cli.add_command(update_repository)
| {
"content_hash": "c65958ad07c4cfb753ef4939376e60c2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 130,
"avg_line_length": 51.38461538461539,
"alnum_prop": 0.8495508982035929,
"repo_name": "galaxy-iuc/parsec",
"id": "1554224c722d4b19c46382b4c85a8e32ab3b3cd8",
"size": "1336",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "parsec/commands/cmd_toolshed_repositories.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "194"
},
{
"name": "Python",
"bytes": "187279"
}
],
"symlink_target": ""
} |
package _14
| {
"content_hash": "ecfaaecc8dbb0a8712df70755cc100e8",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 11,
"avg_line_length": 12,
"alnum_prop": 0.75,
"repo_name": "brasbug/golangproject",
"id": "94a2dabe370f25d828a644d81fe1c9eadd582a58",
"size": "12",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "leetcode/001-100/014/longestcompre_test.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "32619"
},
{
"name": "HTML",
"bytes": "3070"
},
{
"name": "Ruby",
"bytes": "2065"
}
],
"symlink_target": ""
} |
.. _menpodetect-bob-load_bob_frontal_face_detector:
.. currentmodule:: menpodetect.bob
load_bob_frontal_face_detector
==============================
.. autofunction:: load_bob_frontal_face_detector
| {
"content_hash": "c61e3cdd2803a5c1e48767d97b3e337a",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 51,
"avg_line_length": 28.571428571428573,
"alnum_prop": 0.655,
"repo_name": "yuxiang-zhou/menpodetect",
"id": "d39b6e2af407927b2069fe3ba6c1f54d6ab5003c",
"size": "200",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "docs/source/api/menpodetect/bob/load_bob_frontal_face_detector.rst",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "145"
},
{
"name": "Python",
"bytes": "139804"
},
{
"name": "Shell",
"bytes": "119"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "703d5bf25b2c669656c9176b875e4b15",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "21b0cc27784277ef615bd93f92385397032b4968",
"size": "188",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Pteridophyta/Polypodiopsida/Polypodiales/Dryopteridaceae/Dryopteris/Dryopteris pandiformis/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package org.pentaho.di.starmodeler.generator;
import java.util.List;
import java.util.Set;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.starmodeler.ConceptUtil;
import org.pentaho.di.starmodeler.DefaultIDs;
import org.pentaho.metadata.model.Domain;
import org.pentaho.metadata.model.LogicalModel;
import org.pentaho.metadata.model.LogicalTable;
import org.pentaho.metadata.model.SqlDataSource;
import org.pentaho.metadata.model.SqlDataSource.DataSourceType;
import org.pentaho.metadata.model.SqlPhysicalModel;
import org.pentaho.metadata.model.SqlPhysicalTable;
import org.pentaho.metadata.model.concept.Concept;
import org.pentaho.metadata.model.concept.types.LocalizedString;
public class MetadataGenerator {
private Domain logicalDomain;
private List<DatabaseMeta> databases;
/**
* @param logicalDomain The logical domain containing star schemas without physical layer.
* @param databases The list of databases to reference
*/
public MetadataGenerator(Domain logicalDomain, List<DatabaseMeta> databases) {
this.logicalDomain = logicalDomain;
this.databases = databases;
}
public Domain generatePhysicalMetadataModel() throws KettleException {
// First do some checking and lookups...
//
String targetDatabaseName = ConceptUtil.getString(logicalDomain, DefaultIDs.DOMAIN_TARGET_DATABASE);
if (Const.isEmpty(targetDatabaseName)) {
throw new KettleException("Please specify a target database!");
}
DatabaseMeta targetDatabaseMeta = DatabaseMeta.findDatabase(databases, targetDatabaseName);
if (targetDatabaseMeta==null) {
throw new KettleException("Target database with name '"+targetDatabaseName+"' can't be found!");
}
// Now start creation of a new domain with physical underpinning.
//
Domain domain = new Domain();
// Copy the domain information...
//
domain.setId( createId("DOMAIN", null, domain) );
domain.setName(logicalDomain.getName());
domain.setDescription(logicalDomain.getDescription());
// Now copy all the models...
//
for (LogicalModel logicalModel : logicalDomain.getLogicalModels()) {
// Copy model information...
//
LogicalModel model = new LogicalModel();
model.setId( createId("MODEL", domain, model));
model.setName(logicalModel.getName());
model.setDescription(logicalModel.getDescription());
// Create a physical model...
//
SqlPhysicalModel sqlModel = new SqlPhysicalModel();
sqlModel.setDatasource(createSqlDataSource(targetDatabaseMeta));
model.setPhysicalModel(sqlModel);
for (LogicalTable logicalTable : logicalModel.getLogicalTables()) {
LogicalTable table = new LogicalTable();
table.setId( createId("LOGICAL_TABLE", logicalModel, logicalTable) );
table.setName(logicalTable.getName());
table.setDescription(logicalTable.getDescription());
String targetTable = ConceptUtil.getString(logicalTable, DefaultIDs.LOGICAL_TABLE_PHYSICAL_TABLE_NAME);
SqlPhysicalTable sqlTable = new SqlPhysicalTable(sqlModel);
table.setPhysicalTable(sqlTable);
// Copy name & description from physical level...
//
sqlTable.setId( createId("PHYSICAL_TABLE", logicalModel, logicalTable));
sqlTable.setName(logicalTable.getName());
sqlTable.setDescription(logicalTable.getDescription());
sqlTable.setTableType(ConceptUtil.getTableType(logicalTable));
sqlTable.setTargetSchema(targetDatabaseMeta.getPreferredSchemaName());
sqlTable.setTargetTable(targetTable);
}
}
return domain;
}
private SqlDataSource createSqlDataSource(DatabaseMeta databaseMeta) {
SqlDataSource dataSource = new SqlDataSource();
dataSource.setDatabaseName(databaseMeta.getDatabaseName());
dataSource.setHostname(databaseMeta.getHostname());
dataSource.setUsername(databaseMeta.getUsername());
dataSource.setPassword(databaseMeta.getPassword());
dataSource.setPort(databaseMeta.getDatabasePortNumberString());
dataSource.setAttributes(databaseMeta.getExtraOptions());
DataSourceType dataSourceType;
switch(databaseMeta.getAccessType()) {
case DatabaseMeta.TYPE_ACCESS_NATIVE : dataSourceType = DataSourceType.NATIVE; break;
case DatabaseMeta.TYPE_ACCESS_ODBC : dataSourceType = DataSourceType.ODBC; break;
case DatabaseMeta.TYPE_ACCESS_JNDI : dataSourceType = DataSourceType.JNDI; break;
case DatabaseMeta.TYPE_ACCESS_OCI : dataSourceType = DataSourceType.OCI; break;
default: dataSourceType = DataSourceType.CUSTOM; break;
}
dataSource.setType(dataSourceType);
return dataSource;
}
private String createId(String prefix, Concept parent, Concept item) {
StringBuilder id = new StringBuilder(prefix);
if (parent!=null) {
id.append("_");
id.append( extractId(parent));
}
id.append("_");
id.append( extractId(item));
return id.toString();
}
private String extractId(Concept item) {
LocalizedString localizedName = item.getName();
Set<String> locales = localizedName.getLocales();
if (locales.isEmpty()) return "";
// Just grab the first locale we come across
// This should normally only one for the star modeler
//
String locale = locales.iterator().next();
String id = localizedName.getLocalizedString(locale);
id = id.toUpperCase().replace(" ", "_");
return id;
}
/**
* @return the logicalDomain
*/
public Domain getLogicalDomain() {
return logicalDomain;
}
/**
* @param logicalDomain the logicalDomain to set
*/
public void setLogicalDomain(Domain logicalDomain) {
this.logicalDomain = logicalDomain;
}
/**
* @return the databases
*/
public List<DatabaseMeta> getDatabases() {
return databases;
}
/**
* @param databases the databases to set
*/
public void setDatabases(List<DatabaseMeta> databases) {
this.databases = databases;
}
}
| {
"content_hash": "4871b8ee66c2c9365294d1f6ce463448",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 111,
"avg_line_length": 35.22727272727273,
"alnum_prop": 0.712741935483871,
"repo_name": "jjeb/kettle-trunk",
"id": "1a9b1d8991aa42fd162bf2d53434c7d3322fc035",
"size": "6200",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "plugins/star-modeler/src/org/pentaho/di/starmodeler/generator/MetadataGenerator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package hudson.plugins.jsgames.game;
/**
* This class provides details of a game.
* @author cliffano
*/
public interface Game {
/**
* The game title, displayed on the game menu options below the game icon.
* @return the game title.
*/
String getTitle();
/**
* The game ID, used in the URL path.
* E.g. /plugin/jsgames/<game_id>/icon.png
* @return the game ID
*/
String getId();
}
| {
"content_hash": "87b262cc472a71fc90f3e239d689338f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 78,
"avg_line_length": 19.90909090909091,
"alnum_prop": 0.6004566210045662,
"repo_name": "jenkinsci/jsgames-plugin",
"id": "3803055829f43d3ec0124d4b2e88d5058cb88929",
"size": "1559",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/hudson/plugins/jsgames/game/Game.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "260"
},
{
"name": "Java",
"bytes": "8441"
},
{
"name": "JavaScript",
"bytes": "37823"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JCE.Utils.Extensions;
namespace JCE.Utils.Logging
{
/// <summary>
/// 日志管理器
/// </summary>
public static class LogManager
{
#region Field(字段)
/// <summary>
/// 缓存日志字典
/// </summary>
private static readonly ConcurrentDictionary<string, ILogger> Loggers;
/// <summary>
/// 对象锁
/// </summary>
private static readonly object LockObj = new object();
#endregion
#region Property(属性)
/// <summary>
/// 获取日志适配器集合
/// </summary>
internal static ICollection<ILoggerAdapter> Adapters { get; private set; }
#endregion
#region Constructor(构造函数)
/// <summary>
/// 初始化一个<see cref="LogManager"/>类型的实例
/// </summary>
static LogManager()
{
Loggers = new ConcurrentDictionary<string, ILogger>();
Adapters = new List<ILoggerAdapter>();
}
#endregion
#region AddLoggerAdapter(添加日志适配器)
/// <summary>
/// 添加日志适配器
/// </summary>
/// <param name="adapter">日志适配器</param>
public static void AddLoggerAdapter(ILoggerAdapter adapter)
{
lock (LockObj)
{
if (Adapters.Any(m => m == adapter))
{
return;
}
Adapters.Add(adapter);
Loggers.Clear();
}
}
#endregion
#region RemoveLoggerAdapter(移除日志适配器)
/// <summary>
/// 移除日志适配器
/// </summary>
/// <param name="adapter">日志适配器</param>
public static void RemoveLoggerAdapter(ILoggerAdapter adapter)
{
lock (LockObj)
{
if (Adapters.All(m => m != adapter))
{
return;
}
Adapters.Remove(adapter);
Loggers.Clear();
}
}
#endregion
#region SetEntryInfo(设置日志记录入口参数)
/// <summary>
/// 设置日志记录入口参数
/// </summary>
/// <param name="enabled">是否允许记录日志,如为false,将完全禁止日志记录</param>
/// <param name="entryLevel">日志级别的入口控制,级别决定是否执行相应级别的日志记录功能</param>
public static void SetEntryInfo(bool enabled, LogLevel entryLevel)
{
InternalLogger.EntryEnabled = enabled;
InternalLogger.EntryLogLevel = entryLevel;
}
#endregion
#region GetLogger(获取日志记录器实例)
/// <summary>
/// 获取日志记录器实例
/// </summary>
/// <param name="name">类型名</param>
/// <returns></returns>
public static ILogger GetLogger(string name)
{
name.CheckNotNullOrEmpty("name");
lock (LockObj)
{
ILogger logger;
if (Loggers.TryGetValue(name, out logger))
{
return logger;
}
logger = new InternalLogger(name);
Loggers[name] = logger;
return logger;
}
}
/// <summary>
/// 获取指定类型的日志记录器实例
/// </summary>
/// <param name="type">类型</param>
/// <returns></returns>
public static ILogger GetLogger(Type type)
{
type.CheckNotNull("type");
return GetLogger(type.FullName);
}
/// <summary>
/// 获取指定类型的日志记录器实例
/// </summary>
/// <typeparam name="T">实体类型</typeparam>
/// <returns></returns>
public static ILogger GetLogger<T>()
{
return GetLogger(typeof(T));
}
#endregion
}
}
| {
"content_hash": "62b87aadd5903c8422945a7eabba7f7f",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 82,
"avg_line_length": 27.140845070422536,
"alnum_prop": 0.49403217436429686,
"repo_name": "jianxuanbing/JCE",
"id": "2fb2c1e9e02c880709a962366547fba82bacbceb",
"size": "5025",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "JCE.Utils/Logging/LogManager.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "5548890"
},
{
"name": "CSS",
"bytes": "3900"
},
{
"name": "JavaScript",
"bytes": "123456"
},
{
"name": "Shell",
"bytes": "1019"
}
],
"symlink_target": ""
} |
using System.Threading;
using System.Threading.Tasks;
namespace Proto.Cluster.Identity
{
public class IdentityStorageLookup : IIdentityLookup
{
private const string PlacementActorName = "placement-activator";
private static readonly int PidClusterIdentityStartIndex = PlacementActorName.Length + 1;
private bool _isClient;
private string _memberId = string.Empty;
private PID _placementActor = null!;
private ActorSystem _system = null!;
private PID _worker = null!;
internal Cluster Cluster = null!;
internal MemberList MemberList = null!;
public IdentityStorageLookup(IIdentityStorage storage) => Storage = storage;
internal IIdentityStorage Storage { get; }
public async Task<PID?> GetAsync(ClusterIdentity clusterIdentity, CancellationToken ct)
{
var msg = new GetPid(clusterIdentity, ct);
var res = await _system.Root.RequestAsync<PidResult>(_worker, msg, ct);
return res?.Pid;
}
public async Task SetupAsync(Cluster cluster, string[] kinds, bool isClient)
{
Cluster = cluster;
_system = cluster.System;
_memberId = cluster.System.Id;
MemberList = cluster.MemberList;
_isClient = isClient;
await Storage.Init();
cluster.System.Metrics.Register(new IdentityMetrics(cluster.System.Metrics));
var workerProps = Props.FromProducer(() => new IdentityStorageWorker(this));
_worker = _system.Root.Spawn(workerProps);
//hook up events
cluster.System.EventStream.Subscribe<ClusterTopology>(e => {
//delete all members that have left from the lookup
foreach (var left in e.Left)
//YOLO. event stream is not async
{
_ = RemoveMemberAsync(left.Id);
}
}
);
if (isClient) return;
var props = Props.FromProducer(() => new IdentityStoragePlacementActor(Cluster, this));
_placementActor = _system.Root.SpawnNamed(props, PlacementActorName);
}
public async Task ShutdownAsync()
{
await Cluster.System.Root.StopAsync(_worker);
if (!_isClient) await Cluster.System.Root.StopAsync(_placementActor);
await RemoveMemberAsync(_memberId);
}
public Task RemovePidAsync(ClusterIdentity clusterIdentity, PID pid, CancellationToken ct)
{
if (_system.Shutdown.IsCancellationRequested) return Task.CompletedTask;
return Storage.RemoveActivation(clusterIdentity, pid, ct);
}
internal Task RemoveMemberAsync(string memberId) => Storage.RemoveMember(memberId, CancellationToken.None);
internal PID RemotePlacementActor(string address) => PID.FromAddress(address, PlacementActorName);
}
} | {
"content_hash": "0015afbf13677664f1a9ea2494aa7f7a",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 115,
"avg_line_length": 37.6,
"alnum_prop": 0.6206781914893617,
"repo_name": "AsynkronIT/protoactor-dotnet",
"id": "ba512249ce25797009f131d984a47871906a6ac0",
"size": "3010",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/Proto.Cluster/Identity/IdentityStorageLookup.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "282"
},
{
"name": "C#",
"bytes": "626451"
},
{
"name": "Dockerfile",
"bytes": "916"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>yii2utehn</name>
</data>
</configuration>
</project>
| {
"content_hash": "6e7df86e2c769f08cfb15a38ee9c8ffa",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 63,
"avg_line_length": 35.55555555555556,
"alnum_prop": 0.60625,
"repo_name": "tehnn/yii2utehn",
"id": "676970928b5aca5cc3410a9ab127b2956e5f714a",
"size": "320",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "nbproject/project.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "1364"
},
{
"name": "JavaScript",
"bytes": "818"
},
{
"name": "PHP",
"bytes": "51481"
},
{
"name": "Shell",
"bytes": "1030"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("PasswordlessLogin")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("mplacona")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| {
"content_hash": "d30f3631b82ee4939f06c1874bfaacf6",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 81,
"avg_line_length": 37,
"alnum_prop": 0.7397397397397397,
"repo_name": "mplacona/PasswordlessLogin",
"id": "6cd3bb49e64537f747c5411503321f5516a48739",
"size": "1001",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "PasswordlessLogin/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4528"
}
],
"symlink_target": ""
} |
package com.evanzeimet.jpautils.api;
public class EntityManagerCommandRuntimeException extends RuntimeException {
private static final long serialVersionUID = 7335894732331910418L;
public EntityManagerCommandRuntimeException() {
super();
}
public EntityManagerCommandRuntimeException(String message) {
super(message);
}
public EntityManagerCommandRuntimeException(Throwable cause) {
super(cause);
}
public EntityManagerCommandRuntimeException(String message, Throwable cause) {
super(message, cause);
}
}
| {
"content_hash": "e7e2fb19a747c9e08fffee4441058666",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 79,
"avg_line_length": 24,
"alnum_prop": 0.8049242424242424,
"repo_name": "podnov/jpa-utils",
"id": "206b1d7760abb198699314efce0ce6664323a080",
"size": "528",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/main/java/com/evanzeimet/jpautils/api/EntityManagerCommandRuntimeException.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "12643"
}
],
"symlink_target": ""
} |
<ul class="radius tabs" data-tab>
<li class="tab-title active"><a href="#panel1">Tab 1</a></li>
<li class="tab-title"><a href="#panel2">Tab 2</a></li>
<li class="tab-title"><a href="#panel3">Tab 3</a></li>
<li class="tab-title"><a href="#panel4">Tab 4</a></li>
</ul>
<div class="tabs-content">
<div class="content active" id="panel1">
<p>First panel content goes here. Panel 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="content" id="panel2">
<p>Second panel content goes here. Panel 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="content" id="panel3">
<p>Third panel content goes here. Panel 3. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
<div class="content" id="panel4">
<p>Fourth panel content goes here. Panel 4. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
</div>
</div> | {
"content_hash": "7f3515a41e57868774d186cd08d162e6",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 284,
"avg_line_length": 81.65,
"alnum_prop": 0.7336191059399878,
"repo_name": "pine3ree/foundation",
"id": "999f7edf478ca2906d8c8fd882ab1ecc75dc525f",
"size": "1633",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "doc/includes/tabs/examples_tabs_intro.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.strongback.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Copyright (c) 2005 Brian Goetz and Tim Peierls.<br />
* Released under the Creative Commons Attribution License<br />
* (http://creativecommons.org/licenses/by/2.5)<br />
* Official home: http://www.jcip.net<br />
* Adopted from Java Concurrency in Practice.
* <p>
* This annotation documents that instances of the annotated class are immutable. This means that its state is seen to others as
* never being changed, even though the actual private internal state may indeed change. Therefore, in an immutable class:
* <ul>
* <li>all public fields are final; and</li>
* <li>all public final reference fields refer to other immutable objects; and</li>
* <li>constructors and methods do not publish references to any internal state which is potentially mutable by the
* implementation.</li>
* </ul>
* </p>
*/
@Documented
@Target( ElementType.TYPE )
@Retention( RetentionPolicy.RUNTIME )
public @interface Immutable {
} | {
"content_hash": "17922cdf31784e640141c2f666179319",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 128,
"avg_line_length": 36.75,
"alnum_prop": 0.7559523809523809,
"repo_name": "newtatron/strongback-java",
"id": "abb9180d51c9d90401fe810638b19e8559a24eb2",
"size": "1875",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "strongback/src/org/strongback/annotation/Immutable.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "456269"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Controls.DataVisualization.Charting;
namespace Rawr.Mage.Graphs
{
/// <summary>
/// Interaction logic for ProcUptimeControl.xaml
/// </summary>
public partial class ProcUptimeControl : UserControl
{
private static ProcUptimeControl instance = new ProcUptimeControl();
public static ProcUptimeControl Instance
{
get
{
return instance;
}
}
public ProcUptimeControl()
{
InitializeComponent();
}
public struct TimeData
{
public DateTime Time { get; set; }
public double Value { get; set; }
}
public void UpdateGraph(DisplayCalculations calculations)
{
Chart.Series.Clear();
Chart.Axes.Clear();
DateTime baseTime = new DateTime(2000, 1, 1, 0, 0, 0);
List<SpecialEffect> effectList = new List<SpecialEffect>();
effectList.AddRange(calculations.SpellPowerEffects);
effectList.AddRange(calculations.HasteRatingEffects);
Color[] colors = new Color[] {
Color.FromArgb(255,202,180,96),
Color.FromArgb(255,101,225,240),
Color.FromArgb(255,0,4,3),
Color.FromArgb(255,238,238,30),
Color.FromArgb(255,45,112,63),
Color.FromArgb(255,121,72,210),
Color.FromArgb(255,217,100,54),
Color.FromArgb(255,210,72,195),
Color.FromArgb(255,206,189,191),
Color.FromArgb(255,255,0,0),
Color.FromArgb(255,0,255,0),
Color.FromArgb(255,0,0,255),
};
Style dateTimeAxisLabelStyle = new Style(typeof(DateTimeAxisLabel));
dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.MinutesIntervalStringFormatProperty, "{0:m:ss}"));
dateTimeAxisLabelStyle.Setters.Add(new Setter(DateTimeAxisLabel.SecondsIntervalStringFormatProperty, "{0:m:ss}"));
DateTimeAxis timeAxis = new DateTimeAxis()
{
//Title = "Time",
Minimum = baseTime,
Maximum = baseTime + TimeSpan.FromSeconds(calculations.CalculationOptions.FightDuration),
IntervalType = DateTimeIntervalType.Seconds,
AxisLabelStyle = dateTimeAxisLabelStyle,
Orientation = AxisOrientation.X,
ShowGridLines = true,
Location = AxisLocation.Top,
};
for (int i = 0; i < effectList.Count; i++)
{
float procs = 0.0f;
float triggers = 0.0f;
for (int j = 0; j < calculations.SolutionVariable.Count; j++)
{
if (calculations.Solution[j] > 0)
{
Cycle c = calculations.SolutionVariable[j].Cycle;
if (c != null)
{
switch (effectList[i].Trigger)
{
case Trigger.DamageSpellCrit:
case Trigger.SpellCrit:
triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime;
procs += (float)calculations.Solution[j] * c.CritProcs / c.CastTime;
break;
case Trigger.DamageSpellHit:
case Trigger.SpellHit:
triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime;
procs += (float)calculations.Solution[j] * c.HitProcs / c.CastTime;
break;
case Trigger.SpellMiss:
triggers += (float)calculations.Solution[j] * c.Ticks / c.CastTime;
procs += (float)calculations.Solution[j] * (1 - c.HitProcs) / c.CastTime;
break;
case Trigger.DamageSpellCast:
case Trigger.SpellCast:
if (effectList[i].Stats.ValkyrDamage > 0)
{
triggers += (float)calculations.Solution[j] * c.CastProcs2 / c.CastTime;
procs += (float)calculations.Solution[j] * c.CastProcs2 / c.CastTime;
}
else
{
triggers += (float)calculations.Solution[j] * c.CastProcs / c.CastTime;
procs += (float)calculations.Solution[j] * c.CastProcs / c.CastTime;
}
break;
case Trigger.MageNukeCast:
triggers += (float)calculations.Solution[j] * c.NukeProcs / c.CastTime;
procs += (float)calculations.Solution[j] * c.NukeProcs / c.CastTime;
break;
case Trigger.DamageDone:
case Trigger.DamageOrHealingDone:
triggers += (float)calculations.Solution[j] * c.DamageProcs / c.CastTime;
procs += (float)calculations.Solution[j] * c.DamageProcs / c.CastTime;
break;
case Trigger.DoTTick:
triggers += (float)calculations.Solution[j] * c.DotProcs / c.CastTime;
procs += (float)calculations.Solution[j] * c.DotProcs / c.CastTime;
break;
}
}
}
}
float triggerInterval = calculations.CalculationOptions.FightDuration / triggers;
float triggerChance = Math.Min(1.0f, procs / triggers);
int steps = 200;
TimeData[] plot = new TimeData[steps + 1];
for (int tick = 0; tick <= steps; tick++)
{
float time = tick / (float)steps * calculations.CalculationOptions.FightDuration;
plot[tick] = new TimeData() { Time = baseTime + TimeSpan.FromSeconds(time), Value = effectList[i].GetUptimePlot(triggerInterval, triggerChance, 3.0f, time) };
}
Style style = new Style(typeof(LineDataPoint));
style.Setters.Add(new Setter(LineDataPoint.TemplateProperty, Resources["LineDataPointTemplate"]));
style.Setters.Add(new Setter(LineDataPoint.BackgroundProperty, new SolidColorBrush(colors[i])));
Chart.Series.Add(new LineSeries()
{
Title = effectList[i].ToString(),
ItemsSource = plot,
IndependentValuePath = "Time",
DependentValuePath = "Value",
DataPointStyle = style,
IndependentAxis = timeAxis,
});
}
}
}
}
| {
"content_hash": "d10084eb5872691cb531d44ab3e9379e",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 178,
"avg_line_length": 47.47904191616767,
"alnum_prop": 0.4769832261319208,
"repo_name": "Alacant/Rawr-RG",
"id": "3b1d3b64f1917b8d138272cf0638d15c8d719c6f",
"size": "7931",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Rawr3/Rawr.Mage/Graphs/ProcUptimeControl.xaml.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "3464"
},
{
"name": "C#",
"bytes": "12955708"
},
{
"name": "HTML",
"bytes": "3289"
},
{
"name": "JavaScript",
"bytes": "556553"
}
],
"symlink_target": ""
} |
import os
import sys
import imp
from itertools import product, starmap
import distutils.command.install_lib as orig
class install_lib(orig.install_lib):
"""Don't add compiled flags to filenames of non-Python files"""
def initialize_options(self):
orig.install_lib.initialize_options(self)
self.multiarch = None
self.install_layout = None
def finalize_options(self):
orig.install_lib.finalize_options(self)
self.set_undefined_options('install',('install_layout','install_layout'))
if self.install_layout == 'deb' and sys.version_info[:2] >= (3, 3):
import sysconfig
self.multiarch = sysconfig.get_config_var('MULTIARCH')
def run(self):
self.build()
outfiles = self.install()
if outfiles is not None:
# always compile, in case we have any extension stubs to deal with
self.byte_compile(outfiles)
def get_exclusions(self):
"""
Return a collections.Sized collections.Container of paths to be
excluded for single_version_externally_managed installations.
"""
all_packages = (
pkg
for ns_pkg in self._get_SVEM_NSPs()
for pkg in self._all_packages(ns_pkg)
)
excl_specs = product(all_packages, self._gen_exclusion_paths())
return set(starmap(self._exclude_pkg_path, excl_specs))
def _exclude_pkg_path(self, pkg, exclusion_path):
"""
Given a package name and exclusion path within that package,
compute the full exclusion path.
"""
parts = pkg.split('.') + [exclusion_path]
return os.path.join(self.install_dir, *parts)
@staticmethod
def _all_packages(pkg_name):
"""
>>> list(install_lib._all_packages('foo.bar.baz'))
['foo.bar.baz', 'foo.bar', 'foo']
"""
while pkg_name:
yield pkg_name
pkg_name, sep, child = pkg_name.rpartition('.')
def _get_SVEM_NSPs(self):
"""
Get namespace packages (list) but only for
single_version_externally_managed installations and empty otherwise.
"""
# TODO: is it necessary to short-circuit here? i.e. what's the cost
# if get_finalized_command is called even when namespace_packages is
# False?
if not self.distribution.namespace_packages:
return []
install_cmd = self.get_finalized_command('install')
svem = install_cmd.single_version_externally_managed
return self.distribution.namespace_packages if svem else []
@staticmethod
def _gen_exclusion_paths():
"""
Generate file paths to be excluded for namespace packages (bytecode
cache files).
"""
# always exclude the package module itself
yield '__init__.py'
yield '__init__.pyc'
yield '__init__.pyo'
if not hasattr(imp, 'get_tag'):
return
base = os.path.join('__pycache__', '__init__.' + imp.get_tag())
yield base + '.pyc'
yield base + '.pyo'
def copy_tree(
self, infile, outfile,
preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1
):
assert preserve_mode and preserve_times and not preserve_symlinks
exclude = self.get_exclusions()
if not exclude:
import distutils.dir_util
distutils.dir_util._multiarch = self.multiarch
return orig.install_lib.copy_tree(self, infile, outfile)
# Exclude namespace package __init__.py* files from the output
from setuptools.archive_util import unpack_directory
from distutils import log
outfiles = []
if self.multiarch:
import sysconfig
ext_suffix = sysconfig.get_config_var ('EXT_SUFFIX')
if ext_suffix.endswith(self.multiarch + ext_suffix[-3:]):
new_suffix = None
else:
new_suffix = "%s-%s%s" % (ext_suffix[:-3], self.multiarch, ext_suffix[-3:])
def pf(src, dst):
if dst in exclude:
log.warn("Skipping installation of %s (namespace package)",
dst)
return False
if self.multiarch and new_suffix and dst.endswith(ext_suffix) and not dst.endswith(new_suffix):
dst = dst.replace(ext_suffix, new_suffix)
log.info("renaming extension to %s", os.path.basename(dst))
log.info("copying %s -> %s", src, os.path.dirname(dst))
outfiles.append(dst)
return dst
unpack_directory(infile, outfile, pf)
return outfiles
def get_outputs(self):
outputs = orig.install_lib.get_outputs(self)
exclude = self.get_exclusions()
if exclude:
return [f for f in outputs if f not in exclude]
return outputs
| {
"content_hash": "2e530e53105bd1266b913ea179f1cdf7",
"timestamp": "",
"source": "github",
"line_count": 145,
"max_line_length": 107,
"avg_line_length": 34.08965517241379,
"alnum_prop": 0.5893182277968845,
"repo_name": "cjaffar/jaffarchiosa",
"id": "03cb6f856cbb5b7d468ed17a310211227738666b",
"size": "4943",
"binary": false,
"copies": "9",
"ref": "refs/heads/master",
"path": "jaffarchiosa/lib/python2.7/site-packages/setuptools/command/install_lib.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "52"
},
{
"name": "Python",
"bytes": "1707749"
},
{
"name": "Shell",
"bytes": "3777"
}
],
"symlink_target": ""
} |
// Code generated by informer-gen. DO NOT EDIT.
package v1
import (
"context"
time "time"
eventsv1 "github.com/google/knative-gcp/pkg/apis/events/v1"
versioned "github.com/google/knative-gcp/pkg/client/clientset/versioned"
internalinterfaces "github.com/google/knative-gcp/pkg/client/informers/externalversions/internalinterfaces"
v1 "github.com/google/knative-gcp/pkg/client/listers/events/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// CloudBuildSourceInformer provides access to a shared informer and lister for
// CloudBuildSources.
type CloudBuildSourceInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1.CloudBuildSourceLister
}
type cloudBuildSourceInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewCloudBuildSourceInformer constructs a new informer for CloudBuildSource type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewCloudBuildSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredCloudBuildSourceInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredCloudBuildSourceInformer constructs a new informer for CloudBuildSource type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredCloudBuildSourceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options metav1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.EventsV1().CloudBuildSources(namespace).List(context.TODO(), options)
},
WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.EventsV1().CloudBuildSources(namespace).Watch(context.TODO(), options)
},
},
&eventsv1.CloudBuildSource{},
resyncPeriod,
indexers,
)
}
func (f *cloudBuildSourceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredCloudBuildSourceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *cloudBuildSourceInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&eventsv1.CloudBuildSource{}, f.defaultInformer)
}
func (f *cloudBuildSourceInformer) Lister() v1.CloudBuildSourceLister {
return v1.NewCloudBuildSourceLister(f.Informer().GetIndexer())
}
| {
"content_hash": "2072a93489eaabdab7e02ea3d7f00f84",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 225,
"avg_line_length": 42.171052631578945,
"alnum_prop": 0.8003120124804992,
"repo_name": "google/knative-gcp",
"id": "410981f153cba792c9cdff831df58aec56d43b0b",
"size": "3761",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "pkg/client/informers/externalversions/events/v1/cloudbuildsource.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Go",
"bytes": "3344928"
},
{
"name": "Shell",
"bytes": "70016"
}
],
"symlink_target": ""
} |
<?php
namespace Neos\Flow\Mvc;
use Neos\Flow\Http\Cookie;
use Psr\Http\Message\ResponseInterface;
use function GuzzleHttp\Psr7\stream_for;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Http\Component\ComponentContext;
use Psr\Http\Message\StreamInterface;
use Psr\Http\Message\UriInterface;
use GuzzleHttp\Psr7\Stream;
/**
* The minimal MVC response object.
* It allows for simple interactions with the HTTP response from within MVC actions. More specific requirements can be implemented via HTTP Components.
* @see setComponentParameter()
*
* @Flow\Proxy(false)
* @api
*/
final class ActionResponse
{
/**
* @var Stream
*/
protected $content;
/**
* @var array
*/
protected $componentParameters = [];
/**
* @var UriInterface
*/
protected $redirectUri;
/**
* The HTTP status code
*
* Note the getter has a default value,
* but internally this can be null to signify a status code was never set explicitly.
*
* @var integer|null
*/
protected $statusCode;
/**
* @var string
*/
protected $contentType;
/**
* @var Cookie[]
*/
protected $cookies = [];
public function __construct()
{
$this->content = stream_for();
}
/**
* @param string|StreamInterface $content
* @return void
* @api
*/
public function setContent($content): void
{
if (!$content instanceof StreamInterface) {
$content = stream_for($content);
}
$this->content = $content;
}
/**
* Set content mime type for this response.
*
* @param string $contentType
* @return void
* @api
*/
public function setContentType(string $contentType): void
{
$this->contentType = $contentType;
}
/**
* Set a redirect URI and according status for this response.
*
* @param UriInterface $uri
* @param int $statusCode
* @return void
* @api
*/
public function setRedirectUri(UriInterface $uri, int $statusCode = 303): void
{
$this->redirectUri = $uri;
$this->statusCode = $statusCode;
}
/**
* Set the status code for this response as HTTP status code.
* Other codes than HTTP status may end in unpredictable results.
*
* @param int $statusCode
* @return void
* @api
*/
public function setStatusCode(int $statusCode): void
{
$this->statusCode = $statusCode;
}
/**
* Set a cookie in the HTTP response
* This leads to a corresponding `Set-Cookie` header to be set in the HTTP response
*
* @param Cookie $cookie Cookie to be set in the HTTP response
* @api
*/
public function setCookie(Cookie $cookie): void
{
$this->cookies[$cookie->getName()] = clone $cookie;
}
/**
* Delete a cooke from the HTTP response
* This leads to a corresponding `Set-Cookie` header with an expired Cookie to be set in the HTTP response
*
* @param string $cookieName Name of the cookie to delete
* @api
*/
public function deleteCookie(string $cookieName): void
{
$cookie = new Cookie($cookieName);
$cookie->expire();
$this->cookies[$cookie->getName()] = $cookie;
}
/**
* Set a (HTTP) component parameter for use later in the chain.
* This can be used to adjust all aspects of the later processing if needed.
*
* @param string $componentClassName
* @param string $parameterName
* @param mixed $value
* @return void
* @api
*/
public function setComponentParameter(string $componentClassName, string $parameterName, $value): void
{
if (!isset($this->componentParameters[$componentClassName])) {
$this->componentParameters[$componentClassName] = [];
}
$this->componentParameters[$componentClassName][$parameterName] = $value;
}
/**
* @return string
*/
public function getContent(): string
{
$content = $this->content->getContents();
$this->content->rewind();
return $content;
}
/**
* @return array
*/
public function getComponentParameters(): array
{
return $this->componentParameters;
}
/**
* @return UriInterface
*/
public function getRedirectUri(): ?UriInterface
{
return $this->redirectUri;
}
/**
* @return int
*/
public function getStatusCode(): int
{
return $this->statusCode ?? 200;
}
/**
* @return string
*/
public function getContentType(): string
{
return $this->contentType;
}
/**
* @param ActionResponse $actionResponse
* @return ActionResponse
*/
public function mergeIntoParentResponse(ActionResponse $actionResponse): ActionResponse
{
if ($this->hasContent()) {
$actionResponse->setContent($this->content);
}
if ($this->contentType !== null) {
$actionResponse->setContentType($this->contentType);
}
if ($this->statusCode !== null) {
$actionResponse->setStatusCode($this->statusCode);
}
if ($this->redirectUri !== null) {
$actionResponse->setRedirectUri($this->redirectUri);
}
foreach ($this->componentParameters as $componentClass => $parameters) {
foreach ($parameters as $parameterName => $parameterValue) {
$actionResponse->setComponentParameter($componentClass, $parameterName, $parameterValue);
}
}
foreach ($this->cookies as $cookie) {
$actionResponse->setCookie($cookie);
}
return $actionResponse;
}
/**
* @param ComponentContext $componentContext
* @return ComponentContext
*/
public function mergeIntoComponentContext(ComponentContext $componentContext): ComponentContext
{
$httpResponse = $componentContext->getHttpResponse();
if ($this->statusCode !== null) {
$httpResponse = $httpResponse->withStatus($this->statusCode);
}
if ($this->hasContent()) {
$httpResponse = $httpResponse->withBody($this->content);
}
if ($this->contentType) {
$httpResponse = $httpResponse->withHeader('Content-Type', $this->contentType);
}
if ($this->redirectUri) {
$httpResponse = $httpResponse->withHeader('Location', (string)$this->redirectUri);
}
foreach ($this->componentParameters as $componentClassName => $componentParameterGroup) {
foreach ($componentParameterGroup as $parameterName => $parameterValue) {
$componentContext->setParameter($componentClassName, $parameterName, $parameterValue);
}
}
foreach ($this->cookies as $cookie) {
$httpResponse = $httpResponse->withAddedHeader('Set-Cookie', (string)$cookie);
}
$componentContext->replaceHttpResponse($httpResponse);
return $componentContext;
}
/**
* Note this is a special use case method that will apply the internal properties (Content-Type, StatusCode, Location, Set-Cookie and Content)
* to the given PSR-7 Response and return a modified response. This is used to merge the ActionResponse properties into a possible HttpResponse
* created in a View (see ActionController::renderView()) because those would be overwritten otherwise. Note that any component parameters will
* still run through the component chain and will not be propagated here.
*
* WARNING: Should this ActionResponse contain body content it would replace any content in the given HttpReponse.
*
* @param ResponseInterface $httpResponse
* @return ResponseInterface
* @internal
*/
public function applyToHttpResponse(ResponseInterface $httpResponse): ResponseInterface
{
if ($this->statusCode !== null) {
$httpResponse = $httpResponse->withStatus($this->statusCode);
}
if ($this->hasContent()) {
$httpResponse = $httpResponse->withBody($this->content);
}
if ($this->contentType !== null) {
$httpResponse = $httpResponse->withHeader('Content-Type', $this->contentType);
}
if ($this->redirectUri !== null) {
$httpResponse = $httpResponse->withHeader('Location', (string)$this->redirectUri);
}
foreach ($this->cookies as $cookie) {
$httpResponse = $httpResponse->withAddedHeader('Set-Cookie', (string)$cookie);
}
return $httpResponse;
}
/**
* Does this action response have content?
*
* @return bool
*/
private function hasContent(): bool
{
return $this->content->getSize() > 0;
}
}
| {
"content_hash": "3d5e74a78e07da5ec7ff88571e443ba5",
"timestamp": "",
"source": "github",
"line_count": 320,
"max_line_length": 151,
"avg_line_length": 27.9125,
"alnum_prop": 0.6062472010747872,
"repo_name": "albe/flow-development-collection",
"id": "8cbbced88e0bb9f3b4e6c09e296fde1899cc0367",
"size": "8932",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Neos.Flow/Classes/Mvc/ActionResponse.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "775"
},
{
"name": "CSS",
"bytes": "4358"
},
{
"name": "Gherkin",
"bytes": "10531"
},
{
"name": "HTML",
"bytes": "38276"
},
{
"name": "PHP",
"bytes": "7948356"
},
{
"name": "PLpgSQL",
"bytes": "1164"
},
{
"name": "Shell",
"bytes": "4266"
}
],
"symlink_target": ""
} |
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpModule, JsonpModule, URLSearchParams } from "@angular/http";
import { ReactiveFormsModule } from '@angular/forms';
// import { MdlModule } from '@angular-mdl/core';
import { RouterModule, Routes } from '@angular/router';
import { AppRoutingModule } from './app-routing.module';
import { SharedModule } from './shared/modules/shared.module';
// Components
import { AppComponent } from "./app.component";
import { MainComponent } from "./main/main.component";
import { VideosListComponent } from "./main/videos-list/videos-list.component";
import { VideosPlaylistComponent } from "./main/videos-playlist/videos-playlist.component";
import { VideoPlayerComponent } from "./main/video-player/video-player.component";
import { FilterComponent } from "./main/filter/filter.component";
import { SolrSearchComponent } from "./main/solr-search/solr-search.component";
import { YoutubePlayerModule } from 'ng2-youtube-player';
import { PageNotFoundComponent } from './shared/components/not-found.component';
import { FrontpageComponent } from './frontpage/frontpage.component';
// Services
import { YoutubeApiService } from "./shared/services/youtube-api.service";
import { YoutubePlayerService } from "./shared/services/youtube-player.service";
import { PlaylistStoreService } from "./shared/services/playlist-store.service";
import { NotificationService } from "./shared/services/notification.service";
import { IndexDataService } from './shared/services/indexDataService';
import { FacetService } from './shared/services/facetService';
import { AuthService } from './auth/auth.service';
// Pipes
import { VideoDurationPipe } from "./shared/pipes/video-duration.pipe";
import { VideoLikesPipe } from "./shared/pipes/video-likes.pipe";
import { VideoViewsPipe } from "./shared/pipes/video-views.pipe";
import { PlaylistItemNamePipe } from "./shared/pipes/playlist-item-name.pipe";
import { LazyScroll } from "./shared/directives/lazy-scroll/lazy-scroll.directive";
@NgModule({
imports: [
BrowserModule,
HttpModule,
ReactiveFormsModule,
// MdlModule,
JsonpModule,
YoutubePlayerModule,
BrowserAnimationsModule,
AppRoutingModule,
SharedModule
],
declarations: [
AppComponent,
MainComponent,
VideosListComponent,
VideoPlayerComponent,
VideosPlaylistComponent,
PageNotFoundComponent,
MainComponent,
VideoDurationPipe,
VideoLikesPipe,
VideoViewsPipe,
PlaylistItemNamePipe,
LazyScroll,
FilterComponent,
SolrSearchComponent,
FrontpageComponent,
],
bootstrap: [
AppComponent
],
providers: [
YoutubeApiService,
YoutubePlayerService,
PlaylistStoreService,
NotificationService,
IndexDataService,
FacetService,
AuthService
]
})
export class FoodXModule {
}
| {
"content_hash": "da698a384ea065fefdf8a22894dbc0d3",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 91,
"avg_line_length": 35.93103448275862,
"alnum_prop": 0.7085732565579015,
"repo_name": "metarealm/foodX",
"id": "1fd1b3beb26f7fa4b212dcb835fcfb8f92f431de",
"size": "3126",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/app.module.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "12896"
},
{
"name": "HTML",
"bytes": "14866"
},
{
"name": "JavaScript",
"bytes": "11094"
},
{
"name": "Shell",
"bytes": "118"
},
{
"name": "TypeScript",
"bytes": "69905"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>rem: 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.13.1 / rem - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
rem
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-22 14:17:30 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-22 14:17:30 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.13.1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/rem"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Rem"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: Rem Theorem"
"keyword: Baire space"
"category: Mathematics/Real Calculus and Topology"
]
authors: [
"Henk Barendregt"
]
bug-reports: "https://github.com/coq-contribs/rem/issues"
dev-repo: "git+https://github.com/coq-contribs/rem.git"
synopsis: "Rem Theorem in Baire space"
description: """
A formalisation of Rem Theorem in Baire space"""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/rem/archive/v8.10.0.tar.gz"
checksum: "md5=2e45f63aab2ab55e1de54be629c460ca"
}
</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 coq-rem.8.10.0 coq.8.13.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.13.1).
The following dependencies couldn't be met:
- coq-rem -> coq < 8.11~ -> 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 coq-rem.8.10.0</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://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</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>
| {
"content_hash": "e821f1a0b604f0b2ef2c2107d23dfe36",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 159,
"avg_line_length": 40.111111111111114,
"alnum_prop": 0.5375419157311562,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "bc61d1602e39e39ecbd8193406002ada5d36449a",
"size": "6884",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.06.1-2.0.5/released/8.13.1/rem/8.10.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
<?php
/**
* WooCommerce Core Functions
*
* General core functions available on both the front-end and admin.
*
* @author WooThemes
* @category Core
* @package WooCommerce/Functions
* @version 2.1.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Include core functions (available in both admin and frontend)
include( 'wc-conditional-functions.php' );
include( 'wc-coupon-functions.php' );
include( 'wc-user-functions.php' );
include( 'wc-deprecated-functions.php' );
include( 'wc-formatting-functions.php' );
include( 'wc-order-functions.php' );
include( 'wc-page-functions.php' );
include( 'wc-product-functions.php' );
include( 'wc-term-functions.php' );
include( 'wc-attribute-functions.php' );
/**
* Filters on data used in admin and frontend
*/
add_filter( 'woocommerce_coupon_code', 'html_entity_decode' );
add_filter( 'woocommerce_coupon_code', 'sanitize_text_field' );
add_filter( 'woocommerce_coupon_code', 'strtolower' ); // Coupons case-insensitive by default
add_filter( 'woocommerce_stock_amount', 'intval' ); // Stock amounts are integers by default
/**
* Short Description (excerpt)
*/
add_filter( 'woocommerce_short_description', 'wptexturize' );
add_filter( 'woocommerce_short_description', 'convert_smilies' );
add_filter( 'woocommerce_short_description', 'convert_chars' );
add_filter( 'woocommerce_short_description', 'wpautop' );
add_filter( 'woocommerce_short_description', 'shortcode_unautop' );
add_filter( 'woocommerce_short_description', 'prepend_attachment' );
add_filter( 'woocommerce_short_description', 'do_shortcode', 11 ); // AFTER wpautop()
/**
* Create a new order programmatically
*
* Returns a new order object on success which can then be used to add additional data.
*
* @return WC_Order on success, WP_Error on failure
*/
function wc_create_order( $args = array() ) {
$default_args = array(
'status' => '',
'customer_id' => null,
'customer_note' => null,
'order_id' => 0
);
$args = wp_parse_args( $args, $default_args );
$order_data = array();
if ( $args['order_id'] > 0 ) {
$updating = true;
$order_data['ID'] = $args['order_id'];
} else {
$updating = false;
$order_data['post_type'] = 'shop_order';
$order_data['post_status'] = 'wc-' . apply_filters( 'woocommerce_default_order_status', 'pending' );
$order_data['ping_status'] = 'closed';
$order_data['post_author'] = 1;
$order_data['post_password'] = uniqid( 'order_' );
$order_data['post_title'] = sprintf( __( 'Order – %s', 'woocommerce' ), strftime( _x( '%b %d, %Y @ %I:%M %p', 'Order date parsed by strftime', 'woocommerce' ) ) );
}
if ( $args['status'] ) {
if ( ! in_array( 'wc-' . $args['status'], array_keys( wc_get_order_statuses() ) ) ) {
return new WP_Error( 'woocommerce_invalid_order_status', __( 'Invalid order status', 'woocommerce' ) );
}
$order_data['post_status'] = 'wc-' . $args['status'];
}
if ( ! is_null( $args['customer_note'] ) ) {
$order_data['post_excerpt'] = $args['customer_note'];
}
if ( $updating ) {
$order_id = wp_update_post( $order_data );
} else {
$order_id = wp_insert_post( apply_filters( 'woocommerce_new_order_data', $order_data ), true );
}
if ( is_wp_error( $order_id ) ) {
return $order_id;
}
// Default order meta data.
if ( ! $updating ) {
update_post_meta( $order_id, '_order_key', 'wc_' . apply_filters( 'woocommerce_generate_order_key', uniqid( 'order_' ) ) );
update_post_meta( $order_id, '_order_currency', get_woocommerce_currency() );
update_post_meta( $order_id, '_prices_include_tax', get_option( 'woocommerce_prices_include_tax' ) );
update_post_meta( $order_id, '_customer_ip_address', isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'] );
update_post_meta( $order_id, '_customer_user_agent', isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '' );
update_post_meta( $order_id, '_customer_user', 0 );
}
if ( is_numeric( $args['customer_id'] ) ) {
update_post_meta( $order_id, '_customer_user', $args['customer_id'] );
}
return new WC_Order( $order_id );
}
/**
* Update an order. Uses wc_create_order.
* @param array $args
* @return string | WC_Order
*/
function wc_update_order( $args ) {
if ( ! $args['order_id'] ) {
return new WP_Error( __( 'Invalid order ID', 'woocommerce' ) );
}
return wc_create_order( $args );
}
/**
* Get template part (for templates like the shop-loop).
*
* @access public
* @param mixed $slug
* @param string $name (default: '')
* @return void
*/
function wc_get_template_part( $slug, $name = '' ) {
$template = '';
// Look in yourtheme/slug-name.php and yourtheme/woocommerce/slug-name.php
if ( $name && ! WC_TEMPLATE_DEBUG_MODE ) {
$template = locate_template( array( "{$slug}-{$name}.php", WC()->template_path() . "{$slug}-{$name}.php" ) );
}
// Get default slug-name.php
if ( ! $template && $name && file_exists( WC()->plugin_path() . "/templates/{$slug}-{$name}.php" ) ) {
$template = WC()->plugin_path() . "/templates/{$slug}-{$name}.php";
}
// If template file doesn't exist, look in yourtheme/slug.php and yourtheme/woocommerce/slug.php
if ( ! $template && ! WC_TEMPLATE_DEBUG_MODE ) {
$template = locate_template( array( "{$slug}.php", WC()->template_path() . "{$slug}.php" ) );
}
// Allow 3rd party plugin filter template file from their plugin
if ( ( ! $template && WC_TEMPLATE_DEBUG_MODE ) || $template ) {
$template = apply_filters( 'wc_get_template_part', $template, $slug, $name );
}
if ( $template ) {
load_template( $template, false );
}
}
/**
* Get other templates (e.g. product attributes) passing attributes and including the file.
*
* @access public
* @param string $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void
*/
function wc_get_template( $template_name, $args = array(), $template_path = '', $default_path = '' ) {
if ( $args && is_array( $args ) ) {
extract( $args );
}
$located = wc_locate_template( $template_name, $template_path, $default_path );
if ( ! file_exists( $located ) ) {
_doing_it_wrong( __FUNCTION__, sprintf( '<code>%s</code> does not exist.', $located ), '2.1' );
return;
}
// Allow 3rd party plugin filter template file from their plugin
$located = apply_filters( 'wc_get_template', $located, $template_name, $args, $template_path, $default_path );
do_action( 'woocommerce_before_template_part', $template_name, $template_path, $located, $args );
include( $located );
do_action( 'woocommerce_after_template_part', $template_name, $template_path, $located, $args );
}
/**
* Locate a template and return the path for inclusion.
*
* This is the load order:
*
* yourtheme / $template_path / $template_name
* yourtheme / $template_name
* $default_path / $template_name
*
* @access public
* @param string $template_name
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return string
*/
function wc_locate_template( $template_name, $template_path = '', $default_path = '' ) {
if ( ! $template_path ) {
$template_path = WC()->template_path();
}
if ( ! $default_path ) {
$default_path = WC()->plugin_path() . '/templates/';
}
// Look within passed path within the theme - this is priority
$template = locate_template(
array(
trailingslashit( $template_path ) . $template_name,
$template_name
)
);
// Get default template
if ( ! $template || WC_TEMPLATE_DEBUG_MODE ) {
$template = $default_path . $template_name;
}
// Return what we found
return apply_filters( 'woocommerce_locate_template', $template, $template_name, $template_path );
}
/**
* Get Base Currency Code.
* @return string
*/
function get_woocommerce_currency() {
return apply_filters( 'woocommerce_currency', get_option('woocommerce_currency') );
}
/**
* Get full list of currency codes.
* @return array
*/
function get_woocommerce_currencies() {
return array_unique(
apply_filters( 'woocommerce_currencies',
array(
'AED' => __( 'United Arab Emirates Dirham', 'woocommerce' ),
'AUD' => __( 'Australian Dollars', 'woocommerce' ),
'BDT' => __( 'Bangladeshi Taka', 'woocommerce' ),
'BRL' => __( 'Brazilian Real', 'woocommerce' ),
'BGN' => __( 'Bulgarian Lev', 'woocommerce' ),
'CAD' => __( 'Canadian Dollars', 'woocommerce' ),
'CLP' => __( 'Chilean Peso', 'woocommerce' ),
'CNY' => __( 'Chinese Yuan', 'woocommerce' ),
'COP' => __( 'Colombian Peso', 'woocommerce' ),
'CZK' => __( 'Czech Koruna', 'woocommerce' ),
'DKK' => __( 'Danish Krone', 'woocommerce' ),
'DOP' => __( 'Dominican Peso', 'woocommerce' ),
'EUR' => __( 'Euros', 'woocommerce' ),
'HKD' => __( 'Hong Kong Dollar', 'woocommerce' ),
'HRK' => __( 'Croatia kuna', 'woocommerce' ),
'HUF' => __( 'Hungarian Forint', 'woocommerce' ),
'ISK' => __( 'Icelandic krona', 'woocommerce' ),
'IDR' => __( 'Indonesia Rupiah', 'woocommerce' ),
'INR' => __( 'Indian Rupee', 'woocommerce' ),
'NPR' => __( 'Nepali Rupee', 'woocommerce' ),
'ILS' => __( 'Israeli Shekel', 'woocommerce' ),
'JPY' => __( 'Japanese Yen', 'woocommerce' ),
'KIP' => __( 'Lao Kip', 'woocommerce' ),
'KRW' => __( 'South Korean Won', 'woocommerce' ),
'MYR' => __( 'Malaysian Ringgits', 'woocommerce' ),
'MXN' => __( 'Mexican Peso', 'woocommerce' ),
'NGN' => __( 'Nigerian Naira', 'woocommerce' ),
'NOK' => __( 'Norwegian Krone', 'woocommerce' ),
'NZD' => __( 'New Zealand Dollar', 'woocommerce' ),
'PYG' => __( 'Paraguayan Guaraní', 'woocommerce' ),
'PHP' => __( 'Philippine Pesos', 'woocommerce' ),
'PLN' => __( 'Polish Zloty', 'woocommerce' ),
'GBP' => __( 'Pounds Sterling', 'woocommerce' ),
'RON' => __( 'Romanian Leu', 'woocommerce' ),
'RUB' => __( 'Russian Ruble', 'woocommerce' ),
'SGD' => __( 'Singapore Dollar', 'woocommerce' ),
'ZAR' => __( 'South African rand', 'woocommerce' ),
'SEK' => __( 'Swedish Krona', 'woocommerce' ),
'CHF' => __( 'Swiss Franc', 'woocommerce' ),
'TWD' => __( 'Taiwan New Dollars', 'woocommerce' ),
'THB' => __( 'Thai Baht', 'woocommerce' ),
'TRY' => __( 'Turkish Lira', 'woocommerce' ),
'UAH' => __( 'Ukrainian Hryvnia', 'woocommerce' ),
'USD' => __( 'US Dollars', 'woocommerce' ),
'VND' => __( 'Vietnamese Dong', 'woocommerce' ),
'EGP' => __( 'Egyptian Pound', 'woocommerce' ),
)
)
);
}
/**
* Get Currency symbol.
* @param string $currency (default: '')
* @return string
*/
function get_woocommerce_currency_symbol( $currency = '' ) {
if ( ! $currency ) {
$currency = get_woocommerce_currency();
}
switch ( $currency ) {
case 'AED' :
$currency_symbol = 'د.إ';
break;
case 'AUD' :
case 'CAD' :
case 'CLP' :
case 'COP' :
case 'HKD' :
case 'MXN' :
case 'NZD' :
case 'SGD' :
case 'USD' :
$currency_symbol = '$';
break;
case 'BDT':
$currency_symbol = '৳ ';
break;
case 'BGN' :
$currency_symbol = 'лв.';
break;
case 'BRL' :
$currency_symbol = 'R$';
break;
case 'CHF' :
$currency_symbol = 'CHF';
break;
case 'CNY' :
case 'JPY' :
case 'RMB' :
$currency_symbol = '¥';
break;
case 'CZK' :
$currency_symbol = 'Kč';
break;
case 'DKK' :
$currency_symbol = 'kr.';
break;
case 'DOP' :
$currency_symbol = 'RD$';
break;
case 'EGP' :
$currency_symbol = 'EGP';
break;
case 'EUR' :
$currency_symbol = '€';
break;
case 'GBP' :
$currency_symbol = '£';
break;
case 'HRK' :
$currency_symbol = 'Kn';
break;
case 'HUF' :
$currency_symbol = 'Ft';
break;
case 'IDR' :
$currency_symbol = 'Rp';
break;
case 'ILS' :
$currency_symbol = '₪';
break;
case 'INR' :
$currency_symbol = 'Rs.';
break;
case 'ISK' :
$currency_symbol = 'Kr.';
break;
case 'KIP' :
$currency_symbol = '₭';
break;
case 'KRW' :
$currency_symbol = '₩';
break;
case 'MYR' :
$currency_symbol = 'RM';
break;
case 'NGN' :
$currency_symbol = '₦';
break;
case 'NOK' :
$currency_symbol = 'kr';
break;
case 'NPR' :
$currency_symbol = 'Rs.';
break;
case 'PHP' :
$currency_symbol = '₱';
break;
case 'PLN' :
$currency_symbol = 'zł';
break;
case 'PYG' :
$currency_symbol = '₲';
break;
case 'RON' :
$currency_symbol = 'lei';
break;
case 'RUB' :
$currency_symbol = 'руб.';
break;
case 'SEK' :
$currency_symbol = 'kr';
break;
case 'THB' :
$currency_symbol = '฿';
break;
case 'TRY' :
$currency_symbol = '₺';
break;
case 'TWD' :
$currency_symbol = 'NT$';
break;
case 'UAH' :
$currency_symbol = '₴';
break;
case 'VND' :
$currency_symbol = '₫';
break;
case 'ZAR' :
$currency_symbol = 'R';
break;
default :
$currency_symbol = '';
break;
}
return apply_filters( 'woocommerce_currency_symbol', $currency_symbol, $currency );
}
/**
* Send HTML emails from WooCommerce
*
* @param mixed $to
* @param mixed $subject
* @param mixed $message
* @param string $headers (default: "Content-Type: text/html\r\n")
* @param string $attachments (default: "")
*/
function wc_mail( $to, $subject, $message, $headers = "Content-Type: text/html\r\n", $attachments = "" ) {
$mailer = WC()->mailer();
$mailer->send( $to, $subject, $message, $headers, $attachments );
}
/**
* Get an image size.
*
* Variable is filtered by woocommerce_get_image_size_{image_size}
*
* @param mixed $image_size
* @return array
*/
function wc_get_image_size( $image_size ) {
if ( is_array( $image_size ) ) {
$width = isset( $image_size[0] ) ? $image_size[0] : '300';
$height = isset( $image_size[1] ) ? $image_size[1] : '300';
$crop = isset( $image_size[2] ) ? $image_size[2] : 1;
$size = array(
'width' => $width,
'height' => $height,
'crop' => $crop
);
$image_size = $width . '_' . $height;
} elseif ( in_array( $image_size, array( 'shop_thumbnail', 'shop_catalog', 'shop_single' ) ) ) {
$size = get_option( $image_size . '_image_size', array() );
$size['width'] = isset( $size['width'] ) ? $size['width'] : '300';
$size['height'] = isset( $size['height'] ) ? $size['height'] : '300';
$size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 0;
} else {
$size = array(
'width' => '300',
'height' => '300',
'crop' => 1
);
}
return apply_filters( 'woocommerce_get_image_size_' . $image_size, $size );
}
/**
* Queue some JavaScript code to be output in the footer.
*
* @param string $code
*/
function wc_enqueue_js( $code ) {
global $wc_queued_js;
if ( empty( $wc_queued_js ) ) {
$wc_queued_js = '';
}
$wc_queued_js .= "\n" . $code . "\n";
}
/**
* Output any queued javascript code in the footer.
*/
function wc_print_js() {
global $wc_queued_js;
if ( ! empty( $wc_queued_js ) ) {
echo "<!-- WooCommerce JavaScript -->\n<script type=\"text/javascript\">\njQuery(function($) {";
// Sanitize
$wc_queued_js = wp_check_invalid_utf8( $wc_queued_js );
$wc_queued_js = preg_replace( '/&#(x)?0*(?(1)27|39);?/i', "'", $wc_queued_js );
$wc_queued_js = str_replace( "\r", '', $wc_queued_js );
echo $wc_queued_js . "});\n</script>\n";
unset( $wc_queued_js );
}
}
/**
* Set a cookie - wrapper for setcookie using WP constants
*
* @param string $name Name of the cookie being set
* @param string $value Value of the cookie
* @param integer $expire Expiry of the cookie
* @param string $secure Whether the cookie should be served only over https
*/
function wc_setcookie( $name, $value, $expire = 0, $secure = false ) {
if ( ! headers_sent() ) {
setcookie( $name, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
} elseif ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
headers_sent( $file, $line );
trigger_error( "{$name} cookie cannot be set - headers already sent by {$file} on line {$line}", E_USER_NOTICE );
}
}
/**
* Get the URL to the WooCommerce REST API
*
* @since 2.1
* @param string $path an endpoint to include in the URL
* @return string the URL
*/
function get_woocommerce_api_url( $path ) {
$version = defined( 'WC_API_REQUEST_VERSION' ) ? WC_API_REQUEST_VERSION : WC_API::VERSION;
$url = get_home_url( null, "wc-api/v{$version}/", is_ssl() ? 'https' : 'http' );
if ( ! empty( $path ) && is_string( $path ) ) {
$url .= ltrim( $path, '/' );
}
return $url;
}
/**
* Get a log file path
*
* @since 2.2
* @param string $handle name
* @return string the log file path
*/
function wc_get_log_file_path( $handle ) {
return trailingslashit( WC_LOG_DIR ) . $handle . '-' . sanitize_file_name( wp_hash( $handle ) ) . '.log';
}
/**
* Init for our rewrite rule fixes
*/
function wc_fix_rewrite_rules_init() {
$permalinks = get_option( 'woocommerce_permalinks' );
if ( ! empty( $permalinks['use_verbose_page_rules'] ) ) {
$GLOBALS['wp_rewrite']->use_verbose_page_rules = true;
}
}
add_action( 'init', 'wc_fix_rewrite_rules_init' );
/**
* Various rewrite rule fixes
*
* @since 2.2
* @param array $rules
* @return array
*/
function wc_fix_rewrite_rules( $rules ) {
global $wp_rewrite;
$permalinks = get_option( 'woocommerce_permalinks' );
$product_permalink = empty( $permalinks['product_base'] ) ? _x( 'product', 'slug', 'woocommerce' ) : $permalinks['product_base'];
// Fix the rewrite rules when the product permalink have %product_cat% flag
if ( preg_match( '`/(.+)(/%product_cat%)`' , $product_permalink, $matches ) ) {
foreach ( $rules as $rule => $rewrite ) {
if ( preg_match( '`^' . preg_quote( $matches[1], '`' ) . '/\(`', $rule ) && preg_match( '/^(index\.php\?product_cat)(?!(.*product))/', $rewrite ) ) {
unset( $rules[ $rule ] );
}
}
}
// If the shop page is used as the base, we need to enable verbose rewrite rules or sub pages will 404
if ( ! empty( $permalinks['use_verbose_page_rules'] ) ) {
$page_rewrite_rules = $wp_rewrite->page_rewrite_rules();
$rules = array_merge( $page_rewrite_rules, $rules );
}
return $rules;
}
add_filter( 'rewrite_rules_array', 'wc_fix_rewrite_rules' );
/**
* Prevent product attachment links from breaking when using complex rewrite structures.
*
* @param string $link
* @param id $post_id
* @return string
*/
function wc_fix_product_attachment_link( $link, $post_id ) {
global $wp_rewrite;
$post = get_post( $post_id );
if ( 'product' === get_post_type( $post->post_parent ) ) {
$permalinks = get_option( 'woocommerce_permalinks' );
$product_permalink = empty( $permalinks['product_base'] ) ? _x( 'product', 'slug', 'woocommerce' ) : $permalinks['product_base'];
if ( preg_match( '/\/(.+)(\/%product_cat%)$/' , $product_permalink, $matches ) ) {
$link = home_url( '/?attachment_id=' . $post->ID );
}
}
return $link;
}
add_filter( 'attachment_link', 'wc_fix_product_attachment_link', 10, 2 );
/**
* Protect downloads from ms-files.php in multisite
*
* @param mixed $rewrite
* @return string
*/
function wc_ms_protect_download_rewite_rules( $rewrite ) {
if ( ! is_multisite() || 'redirect' == get_option( 'woocommerce_file_download_method' ) ) {
return $rewrite;
}
$rule = "\n# WooCommerce Rules - Protect Files from ms-files.php\n\n";
$rule .= "<IfModule mod_rewrite.c>\n";
$rule .= "RewriteEngine On\n";
$rule .= "RewriteCond %{QUERY_STRING} file=woocommerce_uploads/ [NC]\n";
$rule .= "RewriteRule /ms-files.php$ - [F]\n";
$rule .= "</IfModule>\n\n";
return $rule . $rewrite;
}
add_filter( 'mod_rewrite_rules', 'wc_ms_protect_download_rewite_rules' );
/**
* WooCommerce Core Supported Themes
*
* @since 2.2
* @return array
*/
function wc_get_core_supported_themes() {
return array( 'twentyfifteen', 'twentyfourteen', 'twentythirteen', 'twentyeleven', 'twentytwelve', 'twentyten' );
}
/**
* Wrapper function to execute the `woocommerce_deliver_webhook_async` cron
* hook, see WC_Webhook::process()
*
* @since 2.2
* @param int $webhook_id webhook ID to deliver
* @param mixed $arg hook argument
*/
function wc_deliver_webhook_async( $webhook_id, $arg ) {
$webhook = new WC_Webhook( $webhook_id );
$webhook->deliver( $arg );
}
add_action( 'woocommerce_deliver_webhook_async', 'wc_deliver_webhook_async', 10, 2 );
/**
* Enables template debug mode
*/
function wc_template_debug_mode() {
if ( ! defined( 'WC_TEMPLATE_DEBUG_MODE' ) ) {
$status_options = get_option( 'woocommerce_status_options', array() );
if ( ! empty( $status_options['template_debug_mode'] ) && current_user_can( 'manage_options' ) ) {
define( 'WC_TEMPLATE_DEBUG_MODE', true );
} else {
define( 'WC_TEMPLATE_DEBUG_MODE', false );
}
}
}
add_action( 'after_setup_theme', 'wc_template_debug_mode', 20 );
/**
* Formats a string in the format COUNTRY:STATE into an array.
* @since 2.3.0
* @param string $country_string
* @return array
*/
function wc_format_country_state_string( $country_string ) {
if ( strstr( $country_string, ':' ) ) {
list( $country, $state ) = explode( ':', $country_string );
} else {
$country = $country_string;
$state = '';
}
return array(
'country' => $country,
'state' => $state
);
}
/**
* Get the store's base location.
* @todo should the woocommerce_default_country option be renamed to contain 'base'?
* @since 2.3.0
* @return array
*/
function wc_get_base_location() {
$default = apply_filters( 'woocommerce_get_base_location', get_option( 'woocommerce_default_country' ) );
return wc_format_country_state_string( $default );
}
/**
* Get the customer's default location. Filtered, and set to base location or left blank.
* @todo should the woocommerce_default_country option be renamed to contain 'base'?
* @since 2.3.0
* @return array
*/
function wc_get_customer_default_location() {
switch ( get_option( 'woocommerce_default_customer_address' ) ) {
case 'geolocation' :
$location = WC_Geolocation::geolocate_ip();
// Base fallback
if ( empty( $location['country'] ) ) {
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
}
break;
case 'base' :
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', get_option( 'woocommerce_default_country' ) ) );
break;
default :
$location = wc_format_country_state_string( apply_filters( 'woocommerce_customer_default_location', '' ) );
break;
}
return $location;
}
// This function can be removed when WP 3.9.2 or greater is required
if ( ! function_exists( 'hash_equals' ) ) :
/**
* Compare two strings in constant time.
*
* This function was added in PHP 5.6.
* It can leak the length of a string.
*
* @since 3.9.2
*
* @param string $a Expected string.
* @param string $b Actual string.
* @return bool Whether strings are equal.
*/
function hash_equals( $a, $b ) {
$a_length = strlen( $a );
if ( $a_length !== strlen( $b ) ) {
return false;
}
$result = 0;
// Do not attempt to "optimize" this.
for ( $i = 0; $i < $a_length; $i++ ) {
$result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
}
return $result === 0;
}
endif;
| {
"content_hash": "bcead51bbb26e504fc5e87b231412a33",
"timestamp": "",
"source": "github",
"line_count": 799,
"max_line_length": 174,
"avg_line_length": 29.401752190237797,
"alnum_prop": 0.6077388046994722,
"repo_name": "jeromio/motr",
"id": "7b9814e126cc73e0eae27755ab6d74c6631c454d",
"size": "23495",
"binary": false,
"copies": "27",
"ref": "refs/heads/master",
"path": "wp-content/bakplugins/woocommerce/includes/wc-core-functions.php",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "6368"
},
{
"name": "Assembly",
"bytes": "1137778"
},
{
"name": "Batchfile",
"bytes": "66"
},
{
"name": "C",
"bytes": "128361"
},
{
"name": "C++",
"bytes": "46792"
},
{
"name": "CSS",
"bytes": "3191179"
},
{
"name": "ColdFusion",
"bytes": "7942"
},
{
"name": "Groff",
"bytes": "155107"
},
{
"name": "HTML",
"bytes": "20588643"
},
{
"name": "JavaScript",
"bytes": "6870285"
},
{
"name": "PHP",
"bytes": "36508700"
},
{
"name": "PLpgSQL",
"bytes": "17239"
},
{
"name": "Perl",
"bytes": "5806"
},
{
"name": "Shell",
"bytes": "9822"
}
],
"symlink_target": ""
} |
from tests import PMGLiveServerTestCase
from tests.fixtures import dbfixture, MemberData
class TestMemberPage(PMGLiveServerTestCase):
def setUp(self):
super(TestMemberPage, self).setUp()
self.fx = dbfixture.data(MemberData,)
self.fx.setup()
def tearDown(self):
self.fx.teardown()
super(TestMemberPage, self).tearDown()
def test_members_page(self):
"""
Test members page (/members)
"""
committee = self.fx.MemberData.veronica
self.make_request("/members/")
self.assertIn("Members of Parliament", self.html)
self.assertIn("Search for members", self.html)
self.check_member(MemberData.veronica)
self.check_member(MemberData.not_current_member)
self.check_member(MemberData.laetitia)
def check_member(self, member):
if member.current:
self.contains_member(member)
else:
self.does_not_contain_member(member)
def does_not_contain_member(self, member):
self.assertNotIn(member.name, self.html)
def contains_member(self, member):
self.assertIn(member.name, self.html)
if hasattr(member, "profile_pic_url"):
self.assertIn(member.profile_pic_url, self.html)
else:
self.assertIn("/static/resources/images/no-profile-pic.svg", self.html)
self.assertIn(member.party.name, self.html)
self.assertIn(member.house.name, self.html)
| {
"content_hash": "4fb7f872da0e5596c5a17a5166b914cd",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 83,
"avg_line_length": 32.17391304347826,
"alnum_prop": 0.6459459459459459,
"repo_name": "Code4SA/pmg-cms-2",
"id": "e36d490fe965f3f40c7cd80d404047b98bac9254",
"size": "1480",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/views/test_members_page.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "204619"
},
{
"name": "HTML",
"bytes": "361071"
},
{
"name": "JavaScript",
"bytes": "109536"
},
{
"name": "Mako",
"bytes": "412"
},
{
"name": "Python",
"bytes": "469838"
}
],
"symlink_target": ""
} |
cask 'proxyman' do
version '1.20.0'
sha256 'd50cf91c1d0bba1f3ae8039cb189dd4572a880579c15df3f15c935890f92342a'
# github.com/ProxymanApp/Proxyman was verified as official when first introduced to the cask
url "https://github.com/ProxymanApp/Proxyman/releases/download/#{version}/Proxyman_#{version}.dmg"
appcast 'https://github.com/ProxymanApp/Proxyman/releases.atom'
name 'Proxyman'
homepage 'https://proxyman.io/'
auto_updates true
app 'Proxyman.app'
uninstall delete: '/Library/PrivilegedHelperTools/com.proxyman.NSProxy.HelperTool',
launchctl: 'com.proxyman.NSProxy.HelperTool'
zap trash: [
'~/Library/Application Support/com.proxyman',
'~/Library/Application Support/com.proxyman.NSProxy',
'~/Library/Caches/Proxyman',
'~/Library/Caches/com.proxyman.NSProxy',
'~/Library/Cookies/com.proxyman.binarycookies',
'~/Library/Cookies/com.proxyman.NSProxy.binarycookies',
'~/Library/Preferences/com.proxyman.plist',
'~/Library/Preferences/com.proxyman.NSProxy.plist',
'~/Library/Saved Application State/com.proxyman.NSProxy.savedState',
'~/.proxyman',
]
end
| {
"content_hash": "032eabc4a9fd780d19d391cb24b179af",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 100,
"avg_line_length": 41.93333333333333,
"alnum_prop": 0.665341812400636,
"repo_name": "lantrix/homebrew-cask",
"id": "fe3975cd7b75e91dd9785660571f116909430a73",
"size": "1258",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Casks/proxyman.rb",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ruby",
"bytes": "2188808"
},
{
"name": "Shell",
"bytes": "35032"
}
],
"symlink_target": ""
} |
export LC_ALL=C
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
BUILDDIR=${BUILDDIR:-$TOPDIR}
BINDIR=${BINDIR:-$BUILDDIR/src}
MANDIR=${MANDIR:-$TOPDIR/doc/man}
BITCOIND=${BITCOIND:-$BINDIR/bitcoind}
BITCOINCLI=${BITCOINCLI:-$BINDIR/bitcoin-cli}
BITCOINTX=${BITCOINTX:-$BINDIR/bitcoin-tx}
WALLET_TOOL=${WALLET_TOOL:-$BINDIR/bitcoin-wallet}
BITCOINUTIL=${BITCOINQT:-$BINDIR/bitcoin-util}
BITCOINQT=${BITCOINQT:-$BINDIR/qt/bitcoin-qt}
[ ! -x "$BITCOIND" ] && echo "$BITCOIND not found or not executable." && exit 1
# Don't allow man pages to be generated for binaries built from a dirty tree
DIRTY=""
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINUTIL $BITCOINQT; do
VERSION_OUTPUT=$($cmd --version)
if [[ $VERSION_OUTPUT == *"dirty"* ]]; then
DIRTY="${DIRTY}${cmd}\n"
fi
done
if [ -n "$DIRTY" ]
then
echo -e "WARNING: the following binaries were built from a dirty tree:\n"
echo -e "$DIRTY"
echo "man pages generated from dirty binaries should NOT be committed."
echo "To properly generate man pages, please commit your changes to the above binaries, rebuild them, then run this script again."
fi
# The autodetected version git tag can screw up manpage output a little bit
read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')"
# Create a footer file with copyright content.
# This gets autodetected fine for bitcoind if --version-string is not set,
# but has different outcomes for bitcoin-qt and bitcoin-cli.
echo "[COPYRIGHT]" > footer.h2m
$BITCOIND --version | sed -n '1!p' >> footer.h2m
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINUTIL $BITCOINQT; do
cmdname="${cmd##*/}"
help2man -N --version-string="${BTCVER[0]}" --include=footer.h2m -o "${MANDIR}/${cmdname}.1" "${cmd}"
sed -i "s/\\\-${BTCVER[1]}//g" "${MANDIR}/${cmdname}.1"
done
rm -f footer.h2m
| {
"content_hash": "d13a50f1df6f08c55c5c6724ff93c28f",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 132,
"avg_line_length": 38.9375,
"alnum_prop": 0.6960941680042804,
"repo_name": "mm-s/bitcoin",
"id": "8da6ff120477a3f31e8d0b2f161bbb3ba60c7058",
"size": "2081",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "contrib/devtools/gen-manpages.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "28178"
},
{
"name": "C",
"bytes": "1228370"
},
{
"name": "C++",
"bytes": "9407360"
},
{
"name": "CMake",
"bytes": "29132"
},
{
"name": "Cap'n Proto",
"bytes": "1256"
},
{
"name": "Dockerfile",
"bytes": "1721"
},
{
"name": "HTML",
"bytes": "21833"
},
{
"name": "Java",
"bytes": "541"
},
{
"name": "M4",
"bytes": "247147"
},
{
"name": "Makefile",
"bytes": "136414"
},
{
"name": "Objective-C++",
"bytes": "5497"
},
{
"name": "Python",
"bytes": "2661378"
},
{
"name": "QMake",
"bytes": "438"
},
{
"name": "Sage",
"bytes": "56897"
},
{
"name": "Scheme",
"bytes": "24076"
},
{
"name": "Shell",
"bytes": "211674"
}
],
"symlink_target": ""
} |
package main
import (
"fmt"
"os"
"time"
"github.com/cloud66-oss/cloud66"
"github.com/cloud66/cli"
)
func runServiceStop(c *cli.Context) {
if len(c.Args()) != 1 {
cli.ShowSubcommandHelp(c)
os.Exit(2)
}
stack := mustStack(c)
serviceName := c.Args()[0]
flagServer := c.String("server")
var serverUid *string
if flagServer == "" {
serverUid = nil
} else {
servers, err := client.Servers(stack.Uid)
if err != nil {
printFatal(err.Error())
}
server, err := findServer(servers, flagServer)
if err != nil {
printFatal(err.Error())
}
if server == nil {
printFatal("Server '" + flagServer + "' not found")
}
if !server.HasRole("docker") && !server.HasRole("kubes") {
printFatal("Server '" + flagServer + "' can not host containers")
}
fmt.Printf("Server: %s\n", server.Name)
serverUid = &server.Uid
}
asyncId, err := startServiceStop(stack.Uid, serviceName, serverUid)
if err != nil {
printFatal(err.Error())
}
genericRes, err := endServiceStop(*asyncId, stack.Uid)
if err != nil {
printFatal(err.Error())
}
printGenericResponse(*genericRes)
return
}
func startServiceStop(stackUid string, serviceName string, serverUid *string) (*int, error) {
asyncRes, err := client.StopService(stackUid, serviceName, serverUid)
if err != nil {
return nil, err
}
return &asyncRes.Id, err
}
func endServiceStop(asyncId int, stackUid string) (*cloud66.GenericResponse, error) {
return client.WaitStackAsyncAction(asyncId, stackUid, 5*time.Second, 20*time.Minute, true)
}
| {
"content_hash": "578918c05537f25d02f355488b3e885c",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 93,
"avg_line_length": 22.5,
"alnum_prop": 0.6738562091503268,
"repo_name": "cloud66/cx",
"id": "07439bd152cd89b53d87814031d7c908ad70b579",
"size": "1530",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "services-stop.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "232091"
},
{
"name": "Shell",
"bytes": "4020"
}
],
"symlink_target": ""
} |
def mask_inv(clip):
""" Returns the color-inversed mask."""
return clip.fl_image(lambda f : 1.0 - f) | {
"content_hash": "a2ee5d1c6dce2fddcec295e2855b9150",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 44,
"avg_line_length": 36,
"alnum_prop": 0.6296296296296297,
"repo_name": "DevinGeo/moviepy",
"id": "c74fb0de9acc6e0336461c92a657103d693a62f9",
"size": "108",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "moviepy/video/fx/mask_inv.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "295"
},
{
"name": "Python",
"bytes": "220312"
},
{
"name": "Shell",
"bytes": "6748"
}
],
"symlink_target": ""
} |
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue
* components and automatically register them with their "basename".
*
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
*/
// const files = require.context('./', true, /\.vue$/i)
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
const app = new Vue({
el: '#app'
}); | {
"content_hash": "9ca1a932464e354441ed6b8b0094424b",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 97,
"avg_line_length": 33.27272727272727,
"alnum_prop": 0.714936247723133,
"repo_name": "halfpetal/OpenNotion",
"id": "e5bb21174c4ed53c899e605854abf65338f3b4aa",
"size": "1098",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/js/app.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "249621"
},
{
"name": "PHP",
"bytes": "107471"
},
{
"name": "Vue",
"bytes": "552"
}
],
"symlink_target": ""
} |
package pkg1;
/**
* Class 1. This is a test.
* Refer <a href="{@docRoot}/../technotes/guides/index.html">Here</a>. Lets see if this works
* or not.
*/
public class C1 {}
| {
"content_hash": "5aef0cc8a486679ab56a12d43e44b2b6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 93,
"avg_line_length": 17.7,
"alnum_prop": 0.6214689265536724,
"repo_name": "gijsleussink/ceylon",
"id": "9bca4584a7c14c0524591442f45df2bcf4e5c487",
"size": "1227",
"binary": false,
"copies": "36",
"ref": "refs/heads/master",
"path": "compiler-java/langtools/test/com/sun/javadoc/testDocRootLink/pkg1/C1.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "4574"
},
{
"name": "CSS",
"bytes": "19001"
},
{
"name": "Ceylon",
"bytes": "5755595"
},
{
"name": "GAP",
"bytes": "167605"
},
{
"name": "Groff",
"bytes": "47559"
},
{
"name": "HTML",
"bytes": "4562"
},
{
"name": "Java",
"bytes": "23452104"
},
{
"name": "JavaScript",
"bytes": "480101"
},
{
"name": "Makefile",
"bytes": "19934"
},
{
"name": "Perl",
"bytes": "2756"
},
{
"name": "Shell",
"bytes": "185109"
},
{
"name": "XSLT",
"bytes": "2000144"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '0027_auto_20171019_1540'),
]
operations = [
migrations.AlterField(
model_name='partnercollaborationevidence',
name='date_received',
field=models.DateField(auto_now=True, verbose_name='Date Received'),
),
]
| {
"content_hash": "15ec9618400bb431076f5df7304d51c2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 80,
"avg_line_length": 24.27777777777778,
"alnum_prop": 0.6270022883295194,
"repo_name": "unicef/un-partner-portal",
"id": "f39f10e0fdd7e4cc92f46785cfa6d93139be4b98",
"size": "510",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "backend/unpp_api/apps/partner/migrations/0028_auto_20171020_2202.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "468629"
},
{
"name": "Dockerfile",
"bytes": "2303"
},
{
"name": "HTML",
"bytes": "49027"
},
{
"name": "JavaScript",
"bytes": "2199879"
},
{
"name": "Python",
"bytes": "1322681"
},
{
"name": "Shell",
"bytes": "4734"
},
{
"name": "Smarty",
"bytes": "751"
}
],
"symlink_target": ""
} |
@class FLAssetsLibraryPhotoBrowserController;
@interface FLAssetsLibraryPhotoBrowserController : FLAssetsLibraryBrowserBase<FLImageAssetCellWidgetDelegate> {
@private
ALAssetsGroup* _group;
NSArray* _assets;
BOOL _rangeSelectMode;
NSUInteger _rangedSelectedCount;
NSUInteger _rangeStartIndex;
UIView* _notificationView;
}
@property (readwrite, retain, nonatomic) NSArray* assets;
@property (readwrite, retain, nonatomic) ALAssetsGroup* group;
- (void) beginLoadingAssets;
- (id) initWithAssetQueue:(FLAssetQueue*) queue withGroup:(ALAssetsGroup*) group;
+ (FLAssetsLibraryPhotoBrowserController*) assetsLibraryPhotoBrowserController:(FLAssetQueue*) assetsQueue withGroup:(ALAssetsGroup*) group;
@end
| {
"content_hash": "7ad184415f2d4a1045f77db686367981",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 140,
"avg_line_length": 26.392857142857142,
"alnum_prop": 0.7889039242219216,
"repo_name": "fishlamp-released/FishLamp2",
"id": "ef3826b50610871a2ed2cd5ff0ed1dc09ea5d4ca",
"size": "1135",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Frameworks/iOS/Classes/AssetsLibrary/FLAssetsLibraryPhotoBrowserController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "56278"
},
{
"name": "C++",
"bytes": "3770"
},
{
"name": "Matlab",
"bytes": "2104"
},
{
"name": "Objective-C",
"bytes": "6583424"
},
{
"name": "Shell",
"bytes": "38669"
}
],
"symlink_target": ""
} |
using Windsor.Extension.Demo.Sample.ResolveByName;
namespace Windsor.Extension.Demo.Sample.Scope
{
public class ScopeDemo
{
private readonly ILogger logger;
public ScopeDemo(ILogger logger)
{
this.logger = logger;
}
public void Run()
{
logger.Log("Deneme");
}
}
} | {
"content_hash": "b6df627ffb0bbb3282000b0cd9f904ee",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 51,
"avg_line_length": 18.894736842105264,
"alnum_prop": 0.5682451253481894,
"repo_name": "onureker/Windsor.Extension",
"id": "8e909f222e9b1e75e14d162cea65408c08ac053b",
"size": "361",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/Demos/Windsor.Extension.Demo/Sample.Scope/ScopeDemo.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "43262"
}
],
"symlink_target": ""
} |
var Marionette = require('backbone.marionette'),
_ = require('underscore'),
events = require('../events'),
resumeModel = require('./models/resume.model'),
ResumeLayout = require('./views/resume.layout');
var ResumeController = Marionette.Object.extend({
initialize : function (options) {
_.bindAll(this, 'show', '_onResumeDone', '_onResumeFail');
_.extend(this, _.pick(options, 'region'));
if(!this.region) {
throw Error('No region provided');
}
this.listenTo(events.dispatcher, 'user:authenticated', this.show);
this.resume = resumeModel;
},
show : function () {
var token = events.reqres.request('user:token');
if(token) {
this.resume.fetch({
headers : {
'Authorization' : 'Bearer ' + token
}
}).then(this._onResumeDone, this._onResumeFail);
} else {
this.auth();
}
},
auth : function () {
events.commands.execute('user:auth');
},
_onResumeDone : function () {
this.region.show(new ResumeLayout({
model : this.resume
}));
events.commands.execute('menu:load');
},
_onResumeFail : function () {
this.auth();
}
});
module.exports = ResumeController; | {
"content_hash": "6b4e9a7c02a6bdd3240d93dc4c6eaf6e",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 70,
"avg_line_length": 22.867924528301888,
"alnum_prop": 0.6014851485148515,
"repo_name": "backdesk/backdesk.trumpet",
"id": "40b0dd18061d3814b7547e03786e3c48ea2b0ff2",
"size": "1212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/scripts/resume/resume.controller.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "9255"
},
{
"name": "HTML",
"bytes": "2234"
},
{
"name": "JavaScript",
"bytes": "24899"
}
],
"symlink_target": ""
} |
import argparse
import os
import math
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import plot
#based on https://stackoverflow.com/questions/990477/how-to-calculate-the-entropy-of-a-file
def calc_entropy(array, size):
entropy = 0.0
for val in range(0, len(array)):
p = array[val] / float(size)
if (p > 0):
entropy = entropy - p*math.log(p,2)
return entropy
def entropy_of_file(filename):
f = open(filename, "rb")
bytes = [0] * 256
for i in range(os.stat(filename).st_size):
byte = f.read(1)
bytes[ord(byte)] += 1
return calc_entropy(bytes, os.stat(filename).st_size)
def entropy_of_file_chunks(filename, chunksize, outputfile):
f = open(filename, "rb")
outfile = open(outputfile, "a")
filesize = os.stat(filename).st_size
filetype = os.path.splitext(filename)[1]
filename = os.path.basename(filename)
for i in range(filesize/chunksize + 1):
size_of_chunk = min(10000, filesize - (chunksize * (i)))
bytes = [0] * 256
if size_of_chunk == 0:
continue
for j in range(size_of_chunk):
byte = f.read(1)
bytes[ord(byte)] += 1
entropy = calc_entropy(bytes, size_of_chunk)
string = filename + ", " + filetype + ", " + str(entropy) + ", " + str(filesize) + ", " + str(size_of_chunk) + ", " + str(i) + "\n"
outfile.write(string)
outfile.close()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("filename", help="Look at this file")
args = parser.parse_args()
f = open(args.filename, "rb")
bytes = [0]*256
for i in range(os.stat(args.filename).st_size):
byte = f.read(1)
# bytes[byte] += 1
# print "\"" + byte + "\""# + " " + ord(byte))
bytes[ord(byte)] += 1
#for byte in f:
# bytes[int(byte)] += 1
#for i in range(256):
# print "bytes[" + str(i) +"] = " + str(bytes[i])
print calc_entropy(bytes, os.stat(args.filename).st_size)
plot.figsize(600, 300)
p = plot.plot_hist(bytes, 1, color='red')
plot.figstuff(title='byte counts for file', xlabel='Byte value', ylabel='Byte count', xlim=[0,255], fn="test.pdf")
| {
"content_hash": "f007263b28bdebaff543303dc42d3bc8",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 139,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.5812003530450133,
"repo_name": "sdonovan1985/entropy-calculation",
"id": "34d3ca76495fbbdbd65faed97c0ce14194bcfa2a",
"size": "2299",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "entropycalc.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "11882"
}
],
"symlink_target": ""
} |
int main(int argc, char* argv[]) {
Application *kernel = new Application();
scv::Kernel::setInstance(kernel);
kernel->init();
kernel->run();
return 0;
}
| {
"content_hash": "dcba209261ff33a2fbe7a635cc48d50c",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 43,
"avg_line_length": 18.1,
"alnum_prop": 0.580110497237569,
"repo_name": "yuriks/SCV",
"id": "a51b9a02283c1581d9048c5a27385b5777bdbc09",
"size": "229",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "userProject/src/main.cpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "1585981"
},
{
"name": "C++",
"bytes": "1034842"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Sun May 15 19:31:52 CAT 2016 -->
<title>com.rpfsoftwares.systembuilderlib.database Class Hierarchy</title>
<meta name="date" content="2016-05-15">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.rpfsoftwares.systembuilderlib.database Class Hierarchy";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/rpfsoftwares/systembuilderlib/annotation/package-tree.html">Prev</a></li>
<li><a href="../../../../com/rpfsoftwares/systembuilderlib/window/package-tree.html">Next</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/rpfsoftwares/systembuilderlib/database/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title">Hierarchy For Package com.rpfsoftwares.systembuilderlib.database</h1>
<span class="packageHierarchyLabel">Package Hierarchies:</span>
<ul class="horizontal">
<li><a href="../../../../overview-tree.html">All Packages</a></li>
</ul>
</div>
<div class="contentContainer">
<h2 title="Class Hierarchy">Class Hierarchy</h2>
<ul>
<li type="circle">java.lang.Object
<ul>
<li type="circle">javax.swing.table.AbstractTableModel (implements java.io.Serializable, javax.swing.table.TableModel)
<ul>
<li type="circle">javax.swing.table.DefaultTableModel (implements java.io.Serializable)
<ul>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/NonEditableModel.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">NonEditableModel</span></a></li>
</ul>
</li>
</ul>
</li>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/ContentValues.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">ContentValues</span></a></li>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/ForeignKey.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">ForeignKey</span></a></li>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/JContentValues.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">JContentValues</span></a></li>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/JDbUtils.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">JDbUtils</span></a></li>
<li type="circle">com.rpfsoftwares.systembuilderlib.database.<a href="../../../../com/rpfsoftwares/systembuilderlib/database/JMySQLHelper.html" title="class in com.rpfsoftwares.systembuilderlib.database"><span class="typeNameLink">JMySQLHelper</span></a></li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li class="navBarCell1Rev">Tree</li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/rpfsoftwares/systembuilderlib/annotation/package-tree.html">Prev</a></li>
<li><a href="../../../../com/rpfsoftwares/systembuilderlib/window/package-tree.html">Next</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/rpfsoftwares/systembuilderlib/database/package-tree.html" target="_top">Frames</a></li>
<li><a href="package-tree.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| {
"content_hash": "dd481a89b27bdbfcae6d653f190e4891",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 267,
"avg_line_length": 43.64,
"alnum_prop": 0.6501680415520928,
"repo_name": "rosariopfernandes/systembuilderlib",
"id": "b0ef851cb5bb8f43822d0ade8717f9052a632fa8",
"size": "6546",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "doc/com/rpfsoftwares/systembuilderlib/database/package-tree.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "56308"
},
{
"name": "Java",
"bytes": "893571"
}
],
"symlink_target": ""
} |
Image::Image( int width, int height, int channels, void *data )
: m_width( width ), m_height( height ), m_channels( channels )
{
unsigned int size = width * height * channels;
m_data.resize( size );
std::copy( (unsigned char *)data, (unsigned char *)data + size, m_data.begin() );
}
uchar4 Image::get( int x, int y )
{
uchar4 res( 0, 0, 0, 0 );
int index = ( y * m_width + x ) * m_channels;
for( int i = 0; i < m_channels; ++i )
res[i] = m_data[ index++ ];
return res;
}
| {
"content_hash": "4a5d603fc8c48b2e69a34bb52b603a45",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 82,
"avg_line_length": 25.3,
"alnum_prop": 0.575098814229249,
"repo_name": "GuyTristram/grt",
"id": "d615261c7520d2d7fda0e48c77ab4019c54c80f1",
"size": "557",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/resource/image.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "374"
},
{
"name": "C",
"bytes": "387151"
},
{
"name": "C++",
"bytes": "327200"
},
{
"name": "CMake",
"bytes": "1255"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "a06e721384c6f8a2c6bc8198fae4be7c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "d6b23b9d4fffbea955156c87331569e319b15113",
"size": "178",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Ericales/Sapotaceae/Sideroxylon/Sideroxylon rotundifolium/ Syn. Bumelia purdiaei/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
require 'test_helper'
class ChatroomTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| {
"content_hash": "e81854b5f7e7fdc7a045477f8b57573d",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 44,
"avg_line_length": 17.428571428571427,
"alnum_prop": 0.6967213114754098,
"repo_name": "busster/Mercury",
"id": "bbec81ab84548e60d760ea403f54a1046fbf75b2",
"size": "122",
"binary": false,
"copies": "7",
"ref": "refs/heads/master",
"path": "test/models/chatroom_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "2467"
},
{
"name": "CoffeeScript",
"bytes": "633"
},
{
"name": "HTML",
"bytes": "19001"
},
{
"name": "JavaScript",
"bytes": "1857"
},
{
"name": "Ruby",
"bytes": "58761"
}
],
"symlink_target": ""
} |
#import <MatrixKit/MatrixKit.h>
/**
Link string used in attributed strings to mark a keys re-request action.
*/
FOUNDATION_EXPORT NSString *const EventFormatterOnReRequestKeysLinkAction;
/**
Parameters separator in the link string.
*/
FOUNDATION_EXPORT NSString *const EventFormatterLinkActionSeparator;
/**
Link string used in attributed strings to mark an edited event action.
*/
FOUNDATION_EXPORT NSString *const EventFormatterEditedEventLinkAction;
/**
`EventFormatter` class inherits from `MXKEventFormatter` to define Vector formatting
*/
@interface EventFormatter : MXKEventFormatter
/**
Add a "(edited)" mention to edited message.
Default is YES.
*/
@property (nonatomic) BOOL showEditionMention;
/**
Text color used to display message edited mention.
Default is `textSecondaryColor`.
*/
@property (nonatomic) UIColor *editionMentionTextColor;
/**
Text font used to display message edited mention.
Default is system font 12.
*/
@property (nonatomic) UIFont *editionMentionTextFont;
/**
String attributes for event timestamp displayed in chat history.
*/
- (NSDictionary*)stringAttributesForEventTimestamp;
@end
| {
"content_hash": "8f3a313080a226bd2870a3936ae5d019",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 85,
"avg_line_length": 23.9375,
"alnum_prop": 0.7754569190600522,
"repo_name": "vector-im/riot-ios",
"id": "4952f1441260ffd3cfd4affa313a4cde1dea682b",
"size": "1716",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "Riot/Utils/EventFormatter.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "104"
},
{
"name": "HTML",
"bytes": "92812"
},
{
"name": "JavaScript",
"bytes": "2513"
},
{
"name": "Objective-C",
"bytes": "3097241"
},
{
"name": "Objective-C++",
"bytes": "946"
},
{
"name": "Ruby",
"bytes": "20271"
},
{
"name": "Shell",
"bytes": "12290"
},
{
"name": "Swift",
"bytes": "1135252"
}
],
"symlink_target": ""
} |
SCENARIO( "Test that CommandLineParser parses arguments correctly", "[tools]" )
{
GIVEN( "A CommandLineParser instance registered with some dummy options" )
{
tools::CommandLineParser optionParser;
optionParser.addOption( "help", tools::CommandLineParser::NoArgument );
optionParser.addOption( "port", tools::CommandLineParser::RequiredArgument );
optionParser.addOption( "verbose", tools::CommandLineParser::NoArgument );
WHEN( "Parsing a dummy command line that is correctly formed" )
{
const char* testLine1[]={ "myExe", "--port", "22", "file1.txt", "file2.txt", "file3.txt" };
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
CHECK( optionParser.executableName()=="myExe" );
CHECK( optionParser.optionHasBeenSet("help")==false );
CHECK( optionParser.optionHasBeenSet("verbose")==false );
CHECK( optionParser.optionHasBeenSet("port")==true );
CHECK( optionParser.optionArguments("port").size()==1 );
if( !optionParser.optionArguments("port").empty() ) // Protect against segfault
{
CHECK( optionParser.optionArguments("port").front()=="22" );
}
CHECK( optionParser.nonOptionArguments().size()==3 );
if( optionParser.nonOptionArguments().size()>=3 ) // Protect against segfault
{
CHECK( optionParser.nonOptionArguments()[0]=="file1.txt" );
CHECK( optionParser.nonOptionArguments()[1]=="file2.txt" );
CHECK( optionParser.nonOptionArguments()[2]=="file3.txt" );
}
}
WHEN( "Parsing a dummy command line that is correctly formed but uses the \"option=value\" syntax" )
{
// Exactly the same test as before, except with "--port=22" instead of "--port 22"
const char* testLine1[]={ "myExe", "--port=22", "file1.txt", "file2.txt", "file3.txt" };
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
CHECK( optionParser.executableName()=="myExe" );
CHECK( optionParser.optionHasBeenSet("help")==false );
CHECK( optionParser.optionHasBeenSet("verbose")==false );
CHECK( optionParser.optionHasBeenSet("port")==true );
CHECK( optionParser.optionArguments("port").size()==1 );
if( !optionParser.optionArguments("port").empty() ) // Protect against segfault
{
CHECK( optionParser.optionArguments("port").front()=="22" );
}
CHECK( optionParser.nonOptionArguments().size()==3 );
if( optionParser.nonOptionArguments().size()>=3 ) // Protect against segfault
{
CHECK( optionParser.nonOptionArguments()[0]=="file1.txt" );
CHECK( optionParser.nonOptionArguments()[1]=="file2.txt" );
CHECK( optionParser.nonOptionArguments()[2]=="file3.txt" );
}
}
WHEN( "Providing options that haven't been registered" )
{
const char* testLine1[]={ "myExe", "--blah", "--foo", "connect", "file1.txt", "file2.txt", "file3.txt" };
CHECK_THROWS( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
}
WHEN( "Providing options that haven't been registered (error_code version)" )
{
// Exactly the same as the last test, but the version with an error_code
const char* testLine1[]={ "myExe", "--blah", "--foo", "connect", "file1.txt", "file2.txt", "file3.txt" };
std::error_code error;
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1, error ) );
CHECK( error==tools::CommandLineParser::error::unknown_option );
}
WHEN( "Providing values for options that don't accept options" )
{
const char* testLine1[]={ "myExe", "--help=true", "--port", "22", "file1.txt", "file2.txt", "file3.txt" };
CHECK_THROWS( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
}
WHEN( "Providing values for options that don't accept options (error_code version)" )
{
// Exactly the same as the last test, but the version with an error_code
const char* testLine1[]={ "myExe", "--help=true", "--port", "22", "file1.txt", "file2.txt", "file3.txt" };
std::error_code error;
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1, error ) );
CHECK( error==tools::CommandLineParser::error::unexepected_option_value );
}
WHEN( "Providing a value starting with \"--\" to an option" )
{
const char* testLine1[]={ "myExe", "--port", "--http-port", "file1.txt", "file2.txt", "file3.txt" };
CHECK_THROWS( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
}
WHEN( "Providing a value starting with \"--\" to an option (error_code version)" )
{
// Exactly the same as the last test, but the version with an error_code
const char* testLine1[]={ "myExe", "--port", "--http-port", "file1.txt", "file2.txt", "file3.txt" };
std::error_code error;
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1, error ) );
CHECK( error==tools::CommandLineParser::error::option_as_value );
}
WHEN( "Providing a value starting with \"--\" to an option using the \"option=value\" syntax" )
{
const char* testLine1[]={ "myExe", "--port=--http-port", "file1.txt", "file2.txt", "file3.txt" };
CHECK_NOTHROW( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
CHECK( optionParser.executableName()=="myExe" );
CHECK( optionParser.optionHasBeenSet("help")==false );
CHECK( optionParser.optionHasBeenSet("verbose")==false );
CHECK( optionParser.optionHasBeenSet("port")==true );
CHECK( optionParser.optionArguments("port").size()==1 );
if( !optionParser.optionArguments("port").empty() ) // Protect against segfault
{
CHECK( optionParser.optionArguments("port").front()=="--http-port" );
}
CHECK( optionParser.nonOptionArguments().size()==3 );
if( optionParser.nonOptionArguments().size()>=3 ) // Protect against segfault
{
CHECK( optionParser.nonOptionArguments()[0]=="file1.txt" );
CHECK( optionParser.nonOptionArguments()[1]=="file2.txt" );
CHECK( optionParser.nonOptionArguments()[2]=="file3.txt" );
}
}
WHEN( "Check that a parse error does not stop the rest of the command line being parsed" )
{
const char* testLine1[]={ "myExe", "--blah", "--port", "22", "file1.txt", "--verbose", "file2.txt", "file3.txt" };
CHECK_THROWS( optionParser.parse( sizeof(testLine1)/sizeof(const char*), testLine1 ) );
// Even though the parse threw an exception, see if all the other arguments were parsed correctly.
CHECK( optionParser.executableName()=="myExe" );
CHECK( optionParser.optionHasBeenSet("help")==false );
CHECK( optionParser.optionHasBeenSet("verbose")==true );
CHECK( optionParser.optionHasBeenSet("port")==true );
CHECK( optionParser.optionArguments("port").size()==1 );
if( !optionParser.optionArguments("port").empty() ) // Protect against segfault
{
CHECK( optionParser.optionArguments("port").front()=="22" );
}
CHECK( optionParser.nonOptionArguments().size()==3 );
if( optionParser.nonOptionArguments().size()>=3 ) // Protect against segfault
{
CHECK( optionParser.nonOptionArguments()[0]=="file1.txt" );
CHECK( optionParser.nonOptionArguments()[1]=="file2.txt" );
CHECK( optionParser.nonOptionArguments()[2]=="file3.txt" );
}
}
}
}
| {
"content_hash": "4b6403af6e77b24b9524de6d964a7edd",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 117,
"avg_line_length": 51.25714285714286,
"alnum_prop": 0.6783723522853957,
"repo_name": "mark-grimes/ClientServer",
"id": "2df8a079661c270551a27fa0ff0e3f2ecbfc2aeb",
"size": "7235",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/tools/testCommandLineParser.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C++",
"bytes": "417420"
},
{
"name": "CMake",
"bytes": "4980"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reactive.Linq;
using Avalonia.Media;
using OpenUtau.App.Controls;
using OpenUtau.Core;
using OpenUtau.Core.Ustx;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
namespace OpenUtau.App.ViewModels {
public class ExpSelectorViewModel : ViewModelBase, ICmdSubscriber {
[Reactive] public int Index { get; set; }
[Reactive] public int SelectedIndex { get; set; }
[Reactive] public ExpDisMode DisplayMode { get; set; }
[Reactive] public UExpressionDescriptor? Descriptor { get; set; }
public ObservableCollection<UExpressionDescriptor> Descriptors => descriptors;
public string Header => header.Value;
[Reactive] public IBrush TagBrush { get; set; }
[Reactive] public IBrush Background { get; set; }
ObservableCollection<UExpressionDescriptor> descriptors = new ObservableCollection<UExpressionDescriptor>();
ObservableAsPropertyHelper<string> header;
public ExpSelectorViewModel() {
DocManager.Inst.AddSubscriber(this);
this.WhenAnyValue(x => x.DisplayMode)
.Subscribe(_ => RefreshBrushes());
this.WhenAnyValue(x => x.Descriptor)
.Select(descriptor => descriptor == null ? string.Empty : descriptor.abbr.ToUpperInvariant())
.ToProperty(this, x => x.Header, out header);
this.WhenAnyValue(x => x.Descriptor)
.Subscribe(SelectionChanged);
this.WhenAnyValue(x => x.Index, x => x.Descriptors)
.Subscribe(tuple => {
if (tuple.Item2 != null && tuple.Item2.Count > tuple.Item1) {
Descriptor = tuple.Item2[tuple.Item1];
}
});
MessageBus.Current.Listen<ThemeChangedEvent>()
.Subscribe(_ => RefreshBrushes());
TagBrush = ThemeManager.ExpNameBrush;
Background = ThemeManager.ExpBrush;
OnListChange();
}
public void OnSelected() {
if (DisplayMode != ExpDisMode.Visible && Descriptor != null) {
DocManager.Inst.ExecuteCmd(new SelectExpressionNotification(Descriptor.abbr, Index, true));
}
}
void SelectionChanged(UExpressionDescriptor? descriptor) {
if (descriptor != null) {
DocManager.Inst.ExecuteCmd(new SelectExpressionNotification(descriptor.abbr, Index, DisplayMode != ExpDisMode.Visible));
}
}
public void OnNext(UCommand cmd, bool isUndo) {
if (cmd is LoadProjectNotification ||
cmd is LoadPartNotification ||
cmd is ConfigureExpressionsCommand) {
OnListChange();
} else if (cmd is SelectExpressionNotification) {
OnSelectExp((SelectExpressionNotification)cmd);
}
}
private void OnListChange() {
var selectedIndex = SelectedIndex;
Descriptors.Clear();
DocManager.Inst.Project.expressions.Values.ToList().ForEach(Descriptors.Add);
if (selectedIndex >= descriptors.Count) {
selectedIndex = Index;
}
SelectedIndex = selectedIndex;
}
private void OnSelectExp(SelectExpressionNotification cmd) {
if (Descriptors.Count == 0) {
return;
}
if (cmd.SelectorIndex == Index) {
if (Descriptors[SelectedIndex].abbr != cmd.ExpKey) {
SelectedIndex = Descriptors.IndexOf(Descriptors.First(d => d.abbr == cmd.ExpKey));
}
DisplayMode = ExpDisMode.Visible;
} else if (cmd.UpdateShadow) {
DisplayMode = DisplayMode == ExpDisMode.Visible ? ExpDisMode.Shadow : ExpDisMode.Hidden;
}
}
private void RefreshBrushes() {
TagBrush = DisplayMode == ExpDisMode.Visible
? ThemeManager.ExpActiveNameBrush
: DisplayMode == ExpDisMode.Shadow
? ThemeManager.ExpShadowNameBrush
: ThemeManager.ExpNameBrush;
Background = DisplayMode == ExpDisMode.Visible
? ThemeManager.ExpActiveBrush
: DisplayMode == ExpDisMode.Shadow
? ThemeManager.ExpShadowBrush
: ThemeManager.ExpBrush;
}
}
}
| {
"content_hash": "d0598d3deea998414ab985fa6e00043d",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 136,
"avg_line_length": 42.271028037383175,
"alnum_prop": 0.5894317930577051,
"repo_name": "stakira/OpenUtau",
"id": "efa10c7446af8f6c1c06d6ccaa54acf5f07183c6",
"size": "4525",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "OpenUtau/ViewModels/ExpSelectorViewModel.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1757505"
},
{
"name": "Python",
"bytes": "5920"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "ca99efa25beaca41f843a8a06979de3f",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "c4dd0edc0eb94fc04d156dcb98f2fe8ecb67cba2",
"size": "170",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rhamnaceae/Rhamnus/Frangula anceps/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
'use strict';
var path = require('path'),
readFile = require('./read-file');
module.exports = function(base, grunt){
return function compiler (req, res, next) {
if (path.extname(req.url) !== '.js') {
return next();
}
var url = req.url[0] === '/' ? req.url : '/' + req.url,
result = readFile(base + req.url),
code = result[0],
output = result[1],
contentType = (code === 200 ? 'application/javascript' : 'text/html');
if (code === 500) {
grunt.log.write("\nCoffeeScript error in: " + req.url + "\n");
grunt.log.write(output);
}
res.set('Content-Type', contentType);
res.send(code, output);
};
}; | {
"content_hash": "be9c39a5232932a85fb0af1d44c19eea",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 78,
"avg_line_length": 24.535714285714285,
"alnum_prop": 0.5473071324599709,
"repo_name": "appleton/grunt-coffee-server",
"id": "e26efac38f05a3ab2b240c56c3ad65f0b182d405",
"size": "843",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tasks/lib/compiler.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "3714"
}
],
"symlink_target": ""
} |
namespace lslboost { namespace mpl {
template<
typename Tag1
, typename Tag2
>
struct less_equal_impl
: if_c<
( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
> BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
)
, aux::cast2nd_impl< less_equal_impl< Tag1,Tag1 >,Tag1, Tag2 >
, aux::cast1st_impl< less_equal_impl< Tag2,Tag2 >,Tag1, Tag2 >
>::type
{
};
/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct less_equal_impl< na,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct less_equal_impl< na,integral_c_tag >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template<> struct less_equal_impl< integral_c_tag,na >
{
template< typename U1, typename U2 > struct apply
{
typedef apply type;
BOOST_STATIC_CONSTANT(int, value = 0);
};
};
template< typename T > struct less_equal_tag
{
typedef typename T::tag type;
};
template<
typename BOOST_MPL_AUX_NA_PARAM(N1)
, typename BOOST_MPL_AUX_NA_PARAM(N2)
>
struct less_equal
: less_equal_impl<
typename less_equal_tag<N1>::type
, typename less_equal_tag<N2>::type
>::template apply< N1,N2 >::type
{
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, less_equal, (N1, N2))
};
BOOST_MPL_AUX_NA_SPEC2(2, 2, less_equal)
}}
namespace lslboost { namespace mpl {
template<>
struct less_equal_impl< integral_c_tag,integral_c_tag >
{
template< typename N1, typename N2 > struct apply
: bool_< ( BOOST_MPL_AUX_VALUE_WKND(N1)::value <= BOOST_MPL_AUX_VALUE_WKND(N2)::value ) >
{
};
};
}}
| {
"content_hash": "c05656f0ab11c1c1c446da15639a1c1f",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 97,
"avg_line_length": 22.03614457831325,
"alnum_prop": 0.6079825041006014,
"repo_name": "nihospr01/OpenSpeechPlatform-UCSD",
"id": "90ce720e4ce21c00971066f720f72060d72cbef5",
"size": "2126",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Sources/liblsl/lslboost/boost/mpl/aux_/preprocessed/no_ctps/less_equal.hpp",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "24043"
},
{
"name": "C++",
"bytes": "267883"
},
{
"name": "CMake",
"bytes": "4152"
},
{
"name": "CSS",
"bytes": "81981"
},
{
"name": "Common Lisp",
"bytes": "12791"
},
{
"name": "HTML",
"bytes": "1021565"
},
{
"name": "Hack",
"bytes": "17036"
},
{
"name": "Mathematica",
"bytes": "34"
},
{
"name": "PHP",
"bytes": "161461"
},
{
"name": "Roff",
"bytes": "30772"
},
{
"name": "Shell",
"bytes": "1756"
},
{
"name": "TeX",
"bytes": "41954"
},
{
"name": "VHDL",
"bytes": "2579937"
},
{
"name": "Verilog",
"bytes": "22557"
},
{
"name": "Vue",
"bytes": "563"
}
],
"symlink_target": ""
} |
/* $Id$ */
PHPAPI extern php_stream_wrapper php_glob_stream_wrapper;
PHPAPI extern php_stream_ops php_glob_stream_ops;
BEGIN_EXTERN_C()
PHPAPI char* _php_glob_stream_get_path(php_stream *stream, int copy, size_t *plen STREAMS_DC);
#define php_glob_stream_get_path(stream, copy, plen) _php_glob_stream_get_path((stream), (copy), (plen) STREAMS_CC)
PHPAPI char* _php_glob_stream_get_pattern(php_stream *stream, int copy, size_t *plen STREAMS_DC);
#define php_glob_stream_get_pattern(stream, copy, plen) _php_glob_stream_get_pattern((stream), (copy), (plen) STREAMS_CC)
PHPAPI int _php_glob_stream_get_count(php_stream *stream, int *pflags STREAMS_DC);
#define php_glob_stream_get_count(stream, pflags) _php_glob_stream_get_count((stream), (pflags) STREAMS_CC)
END_EXTERN_C()
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
| {
"content_hash": "638d20f4bfa66ee8218ed5ee2eeae43f",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 121,
"avg_line_length": 32.714285714285715,
"alnum_prop": 0.7019650655021834,
"repo_name": "xfsnow/serverless",
"id": "cf3492cf6fd880cee639854be1aee93457560470",
"size": "2062",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "face/functions/list/php-7-bin/include/php/main/streams/php_stream_glob_wrapper.h",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "2635"
},
{
"name": "C",
"bytes": "4409950"
},
{
"name": "C++",
"bytes": "90990"
},
{
"name": "CSS",
"bytes": "181135"
},
{
"name": "HTML",
"bytes": "8548"
},
{
"name": "Java",
"bytes": "85124"
},
{
"name": "JavaScript",
"bytes": "82161"
},
{
"name": "M4",
"bytes": "90534"
},
{
"name": "Objective-C",
"bytes": "12980"
},
{
"name": "PHP",
"bytes": "1918989"
},
{
"name": "Python",
"bytes": "2134"
},
{
"name": "Roff",
"bytes": "24379"
},
{
"name": "Shell",
"bytes": "274814"
}
],
"symlink_target": ""
} |
from __future__ import print_function
import cv2
import numpy as np
import backgnd_sub
import colorSampleLocation
import colorSampler as cs
import angleDerivation as ad
from utils import image_utils
class Lympht:
def __init__(self):
self.capture = cv2.VideoCapture(0)
self.main_window_name = "lympht"
self.font = cv2.FONT_HERSHEY_SIMPLEX
self.bg_sub = backgnd_sub.BackgroundSubtractor()
self.cs = None
self.csl = colorSampleLocation.ColorSampleLocation(self.capture.read()[1])
self.cs_locations = self.csl.get_color_sample_locations()
self.max_angle = 0
def run(self):
while True:
_, frame = self.capture.read()
frame = image_utils.mirror_image(frame)
draw_frame = frame.copy()
bg = frame.copy()
frame_height, frame_width, frame_channels = frame.shape
frame_hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
# Listen for ESC or ENTER key
c = cv2.waitKey(7) % 0x100
if c == 27 or c == 10:
break
# On 'b' keypress, we save the background
elif c == ord('b'):
self.bg_sub.set_frame_as_background(bg)
elif c == ord('c'):
self.cs = cs.ColorSampler(frame_hsv, self.cs_locations)
self.cs.addColorRangesFromFrame()
elif c == ord('a'):
self.cs.addColorRangesFromFrame()
elif c == ord('r'):
self.max_angle = 0
# If background is set, we can differentiate
# foreground and background
if self.bg_sub.background_set is True:
bg_thresh, contours = self.bg_sub.get_diff(bg)
contour_count = len(contours)
cv2.imshow('thresh', bg_thresh)
# If skin color is sampled, we can isolate the sampled colors in the image
if self.cs is not None:
thresh = self.cs.get_color_mask(frame_hsv)
cv2.imshow('color_thresh', thresh)
else:
self.csl.draw_sample_locations(draw_frame)
if self.bg_sub.background_set and self.cs is not None:
combined = cv2.bitwise_and(bg_thresh, thresh)
_, contours, _ = cv2.findContours(combined.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
contour_count = len(contours)
# find largest contour
try:
largest_contour_index, largest_contour = max(enumerate(contours), key=lambda x: len(x[1]))
except ValueError:
largest_contour_index, largest_contour = 0, [[]]
if contour_count > 0:
hull = cv2.convexHull(largest_contour)
# count, _, _ = hull.shape
hull.ravel()
# hull.shape = count, 2
cv2.polylines(frame, np.int32([hull]), True, (0, 255, 0), 3)
area = cv2.contourArea(largest_contour)
#cv2.putText(draw_frame, "largest contour area " + str(area) + "px",
#(0, frame_height / 6), self.font, 0.5, (50, 50, 255), 2)
hull_area = cv2.contourArea(hull)
#cv2.putText(draw_frame, "hull area " + str(hull_area) + "px",
# (0, frame_height / 8), self.font, 3, (50, 50, 255), 7)
rows, cols = thresh.shape[:2]
[vx, vy, x, y] = cv2.fitLine(largest_contour, cv2.DIST_L2, 0, 0.01, 0.01)
lefty = int((-x * vy / vx) + y)
righty = int(((cols - x) * vy / vx) + y)
verticalLine = [(cols / 2, 0), (cols / 2, rows - 1)]
contourLine = [(cols - 1, righty), (0, lefty)]
verticalVector = (0, 1)
contourVector = (vx, vy)
angle = ad.AngleDerivation.findAngle(verticalVector, contourVector)
if angle > self.max_angle:
self.max_angle = angle
cv2.line(draw_frame, contourLine[0], contourLine[1], (0, 255, 0), 4)
cv2.line(draw_frame, verticalLine[0], verticalLine[1], (0, 255, 0), 4)
cv2.putText(draw_frame, "max angle " + str(self.max_angle)[0:8] + " degs",
(0, frame_height - (frame_height / 8)), self.font, 3, (50, 50, 255), 7)
cv2.putText(draw_frame, "angle " + str(angle)[0:8] + " degs",
(0, frame_height - (frame_height / 4)), self.font, 3, (50, 50, 255), 7)
cv2.drawContours(draw_frame, contours, largest_contour_index, (255, 255, 0), 3)
cv2.imshow('combined', combined)
cv2.imshow(self.main_window_name, draw_frame)
cv2.destroyAllWindows()
if __name__ == "__main__":
lympht = Lympht()
lympht.run()
| {
"content_hash": "fce89c89fe9f57ad9a82e21dc806a7c9",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 110,
"avg_line_length": 41.93388429752066,
"alnum_prop": 0.5072920772566023,
"repo_name": "andytuwm/lympht",
"id": "f629b81a80eafa642369f89233fd54cbd5c0da65",
"size": "5074",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main.py",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "10195"
}
],
"symlink_target": ""
} |
@ECHO OFF
SETLOCAL
CLS
ECHO.
ECHO. Initializing Adblock Plus for Internet Explorer download.
bitsadmin.exe /transfer "Adblock Plus for Internet Explorer Installer" https://update.adblockplus.org/latest/adblockplusie.exe %USERPROFILE%\Downloads\adblockplusie.exe
ECHO. The Adblock Plus for Internet Explorer Installer is opening in another window...
%USERPROFILE%\Downloads\adblockplusie.exe
ECHO. The Adblock Plus for Internet Explorer installation is complete.
ECHO. Deleting temporary Adblock Plus for Internet Explorer installation files...
DEL %USERPROFILE%\Downloads\adblockplusie.exe
GOTO:EOF | {
"content_hash": "6946ffd31b42279b057938666b666200",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 168,
"avg_line_length": 43.785714285714285,
"alnum_prop": 0.8107667210440457,
"repo_name": "JustinMuniz/Computer-Shop-Utilities",
"id": "334e8cdd54ba084ad7ad321d564b13055feacdcc",
"size": "613",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Windows/Batch/Build-Scripts/Install-Adblock-IE.bat",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Batchfile",
"bytes": "18911"
},
{
"name": "PowerShell",
"bytes": "20464"
}
],
"symlink_target": ""
} |
@implementation LTTMockHeading
@synthesize magneticHeading;
@synthesize trueHeading;
@synthesize headingAccuracy;
@synthesize timestamp;
@synthesize description;
@synthesize x;
@synthesize y;
@synthesize z;
@end
| {
"content_hash": "35c713d06a82beec5516a12158491ba7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 30,
"avg_line_length": 17.833333333333332,
"alnum_prop": 0.8177570093457944,
"repo_name": "samodom/Leech",
"id": "538186aef3e4be03c5b75dfdea34273d8a77ebf5",
"size": "377",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Leech/LTTMockHeading.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "348754"
},
{
"name": "Ruby",
"bytes": "920"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint — statsmodels v0.10.2 documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params" href="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params.html" />
<link rel="prev" title="statsmodels.tsa.vector_ar.vecm.VECMResults.resid" href="statsmodels.tsa.vector_ar.vecm.VECMResults.resid.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />
<script type="text/javascript" src="../_static/scripts.js">
</script>
<script type="text/javascript" src="../_static/facebox.js">
</script>
<script type="text/javascript">
$.facebox.settings.closeImage = "../_static/closelabel.png"
$.facebox.settings.loadingImage = "../_static/loading.gif"
</script>
<script>
$(document).ready(function() {
$.getJSON("../../versions.json", function(versions) {
var dropdown = document.createElement("div");
dropdown.className = "dropdown";
var button = document.createElement("button");
button.className = "dropbtn";
button.innerHTML = "Other Versions";
var content = document.createElement("div");
content.className = "dropdown-content";
dropdown.appendChild(button);
dropdown.appendChild(content);
$(".header").prepend(dropdown);
for (var i = 0; i < versions.length; i++) {
if (versions[i].substring(0, 1) == "v") {
versions[i] = [versions[i], versions[i].substring(1)];
} else {
versions[i] = [versions[i], versions[i]];
};
};
for (var i = 0; i < versions.length; i++) {
var a = document.createElement("a");
a.innerHTML = versions[i][1];
a.href = "../../" + versions[i][0] + "/index.html";
a.title = versions[i][1];
$(".dropdown-content").append(a);
};
});
});
</script>
</head><body>
<div class="headerwrap">
<div class = "header">
<a href = "../index.html">
<img src="../_static/statsmodels_hybi_banner.png" alt="Logo"
style="padding-left: 15px"/></a>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params.html" title="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="statsmodels.tsa.vector_ar.vecm.VECMResults.resid.html" title="statsmodels.tsa.vector_ar.vecm.VECMResults.resid"
accesskey="P">previous</a> |</li>
<li><a href ="../install.html">Install</a></li> |
<li><a href="https://groups.google.com/forum/?hl=en#!forum/pystatsmodels">Support</a></li> |
<li><a href="https://github.com/statsmodels/statsmodels/issues">Bugs</a></li> |
<li><a href="../dev/index.html">Develop</a></li> |
<li><a href="../examples/index.html">Examples</a></li> |
<li><a href="../faq.html">FAQ</a></li> |
<li class="nav-item nav-item-1"><a href="../vector_ar.html" >Vector Autoregressions <code class="xref py py-mod docutils literal notranslate"><span class="pre">tsa.vector_ar</span></code></a> |</li>
<li class="nav-item nav-item-2"><a href="statsmodels.tsa.vector_ar.vecm.VECMResults.html" accesskey="U">statsmodels.tsa.vector_ar.vecm.VECMResults</a> |</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="statsmodels-tsa-vector-ar-vecm-vecmresults-stderr-coint">
<h1>statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint<a class="headerlink" href="#statsmodels-tsa-vector-ar-vecm-vecmresults-stderr-coint" title="Permalink to this headline">¶</a></h1>
<p>method</p>
<dl class="method">
<dt id="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint">
<code class="sig-prename descclassname">VECMResults.</code><code class="sig-name descname">stderr_coint</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/statsmodels/tsa/vector_ar/vecm.html#VECMResults.stderr_coint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint" title="Permalink to this definition">¶</a></dt>
<dd><p>Standard errors of beta and deterministic terms inside the
cointegration relation.</p>
<p class="rubric">Notes</p>
<p>See p. 297 in <a class="reference internal" href="#r3cf920721ef2-1" id="id1">[1]</a>. Using the rule</p>
<div class="math notranslate nohighlight">
\[vec(B R) = (B' \otimes I) vec(R)\]</div>
<p>for two matrices B and R which are compatible for multiplication.
This is rule (3) on p. 662 in <a class="reference internal" href="#r3cf920721ef2-1" id="id2">[1]</a>.</p>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r3cf920721ef2-1"><span class="brackets">1</span><span class="fn-backref">(<a href="#id1">1</a>,<a href="#id2">2</a>,<a href="#id3">3</a>)</span></dt>
<dd><p>Lütkepohl, H. 2005. <em>New Introduction to Multiple Time Series Analysis</em>. Springer.</p>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="statsmodels.tsa.vector_ar.vecm.VECMResults.resid.html"
title="previous chapter">statsmodels.tsa.vector_ar.vecm.VECMResults.resid</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params.html"
title="next chapter">statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_params</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/generated/statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer" role="contentinfo">
© Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 2.2.1.
</div>
</body>
</html> | {
"content_hash": "676e5c682ebade559ec0ddfa10816cae",
"timestamp": "",
"source": "github",
"line_count": 177,
"max_line_length": 464,
"avg_line_length": 47.84180790960452,
"alnum_prop": 0.6448984411903638,
"repo_name": "statsmodels/statsmodels.github.io",
"id": "01770d2ca7e72b5c532b651130251b86d24f793e",
"size": "8473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "v0.10.2/generated/statsmodels.tsa.vector_ar.vecm.VECMResults.stderr_coint.html",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
layout: post
title: " Back from Turkey... "
date: 2005-05-06 21:09:00 +0100
comments: true
published: true
categories: ["blog", "archives"]
tags: ["On Travels"]
alias: ["/mattsblog/archive/2005/05/06/375.aspx"]
---
<!-- more -->
<P>Just a short note to say that I'm back from Turkey, and back in the old grind again...</P>
<P>Actually, I've been back for nearly a week now, but I've been too lazy to post anything. I've also been too lazy to reply to any emails, so, if you're waiting for a reply from me, I apologise - I'll get there eventually... Maybe.</P>
<P>Turkey was great- Istanbul was lot different to what I expected - a lot more modern than I expected. I had a good time down at Gallipoli - got a little knarky at all the yobo Australians there, but it was still good. I'll come back and write a proper post at some point soon. Hopefully.</P>
| {
"content_hash": "2b3616eb38737c027403ba5027339646",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 294,
"avg_line_length": 61.285714285714285,
"alnum_prop": 0.7144522144522144,
"repo_name": "matt-richardson/matt-richardson.github.io",
"id": "40fa975ef36e702076128c3033f247eed481f42d",
"size": "862",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2005-05-06-375.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "22438"
},
{
"name": "HTML",
"bytes": "19577"
},
{
"name": "JavaScript",
"bytes": "367"
}
],
"symlink_target": ""
} |
// Provides control sap.ui.commons.Splitter.
sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Control', 'sap/ui/core/Popup', 'sap/ui/core/ResizeHandler', 'sap/ui/core/delegate/ItemNavigation', 'jquery.sap.events', 'jquery.sap.keycodes'],
function(jQuery, library, Control, Popup, ResizeHandler, ItemNavigation/* , jQuerySap, jQuerySap1 */) {
"use strict";
/**
* Constructor for a new Splitter.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Allows to split the screen into two areas. Make sure that the container for the splitter has an absolute height or set an absolute height for the splitter using the height property. Otherwise the height of the splitter is calculated by the height of its contents.
* @extends sap.ui.core.Control
* @version 1.38.7
*
* @constructor
* @public
* @deprecated Since version 1.38. Instead, use the <code>sap.ui.layout.Splitter</code> control.
* @alias sap.ui.commons.Splitter
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Splitter = Control.extend("sap.ui.commons.Splitter", /** @lends sap.ui.commons.Splitter.prototype */ { metadata : {
library : "sap.ui.commons",
properties : {
/**
* The splitter can have horizontal or vertical orientation.
*/
splitterOrientation : {type : "sap.ui.core.Orientation", group : "Behavior", defaultValue : sap.ui.core.Orientation.Vertical},
/**
* Position of splitter bar in percentage.
* The default value means that the splitter is positioned in the middle of the area that is available for the splitter.
*/
splitterPosition : {type : "sap.ui.core.Percentage", group : "Behavior", defaultValue : '50%'},
/**
* The minimum size (width for vertical splitter or height for horizontal splitter) of the first Pane
*/
minSizeFirstPane : {type : "sap.ui.core.Percentage", group : "Behavior", defaultValue : '0%'},
/**
* The minimum size (width for vertical splitter or height for horizontal splitter) of the second Pane
*/
minSizeSecondPane : {type : "sap.ui.core.Percentage", group : "Behavior", defaultValue : '0%'},
/**
* The width of the split area in px or in %
*/
width : {type : "sap.ui.commons.SplitterSize", group : "Behavior", defaultValue : '100%'},
/**
* The height of the split area in px or in %
*/
height : {type : "sap.ui.commons.SplitterSize", group : "Behavior", defaultValue : '100%'},
/**
* Specifies if the browser should display scroll bars or simply cut the content of a splitter pane when the content does not fit into its pane.
*/
showScrollBars : {type : "boolean", group : "Behavior", defaultValue : true},
/**
* set the splitter bar to be visible or not.
*/
splitterBarVisible : {type : "boolean", group : "Behavior", defaultValue : true}
},
aggregations : {
/**
* Controls inside the first pane. These are the left ones in case of defining a vertical splitter, and the top ones in case of using the horizontal splitter.
*/
firstPaneContent : {type : "sap.ui.core.Control", multiple : true, singularName : "firstPaneContent"},
/**
* Controls inside the second pane. These are the right ones in case of defining a vertical splitter, and the bottom ones in case of using the horizontal splitter.
*/
secondPaneContent : {type : "sap.ui.core.Control", multiple : true, singularName : "secondPaneContent"}
}
}});
Splitter.prototype.onBeforeRendering = function() {
// cleanup resize event registration before re-rendering
if (this.sResizeListenerId) {
ResizeHandler.deregister(this.sResizeListenerId);
this.sResizeListenerId = null;
}
if (this.sSpecialResizeListenerId) {
ResizeHandler.deregister(this.sSpecialResizeListenerId);
this.sSpecialResizeListenerId = null;
}
};
Splitter.prototype.onAfterRendering = function() {
this._recalculateInternals();
this.sResizeListenerId = ResizeHandler.register(this.splitterDIV, jQuery.proxy(this.onresize, this));
};
Splitter.prototype._recalculateInternals = function() {
this.splitterDIV = this.getDomRef();
this.splitterBar = jQuery.sap.domById(this.getId() + '_SB');
this.firstPane = jQuery.sap.domById(this.getId() + '_firstPane');
this.secondPane = jQuery.sap.domById(this.getId() + '_secondPane');
this.minSizeFP = this.getMinSizeFirstPane();
this.minSizeSP = this.getMinSizeSecondPane();
this.minSizeFP = this.minSizeFP.substring(0, (this.minSizeFP).length - 1);
this.minSizeFP = parseFloat(this.minSizeFP);
this.minSizeSP = this.minSizeSP.substring(0, (this.minSizeSP).length - 1);
this.minSizeSP = parseFloat(this.minSizeSP);
this.spOrientation = this.getSplitterOrientation();
this.sBarPosition = this.getSplitterPosition();
this.sBarPosition = this.sBarPosition.substring(0, this.sBarPosition.length - 1);
this.sBarPosition = parseFloat(this.sBarPosition);
// in hcb mode set splitter bar width to 6 px
if (sap.ui.getCore().getConfiguration().getTheme() == "sap_hcb") {
this.sbSize = 6;
} else {
this.sbSize = 4;
}
this.resizeSplitterElements();
// if no splitter parent height is specified and the splitter height is specified in % the splitter won't be displayed
// and the splitterbar height will be
// FF: 0 in vertical and horizontal splitters
// or in IE: >= the div height (vertical) or != sbSize (horizontal)
// if any above is the case we have to set its height to a fixed pixel value
var splitterBarHeight = jQuery(this.splitterBar).height();
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
if (splitterBarHeight <= 0 || splitterBarHeight > jQuery(this.splitterDIV).height()) {
this.fixHeight();
}
} else {
if (splitterBarHeight <= 0 || splitterBarHeight != this.sbSize) {
this.fixHeight();
}
}
};
Splitter.prototype.onresize = function(oEvent) {
this.resizeSplitterElements();
};
Splitter.prototype.resizeSplitterElements = function() {
var sbW, sbH, width, height, widthSP, heightSP;
/**
* Calculate the equivalent percentage of the 4px : the width/height of the splitter bar
*/
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
width = jQuery(this.splitterDIV).width();
if (width == 0) {
width = 100; //px so it would show something at least
}
sbW = (this.sbSize * 100) / width;
// check if bar is in the far right
if (this.sBarPosition >= 100 || this.sBarPosition + sbW > 100) {
this.sBarPosition = 100 - sbW;
widthSP = 0;
} else {
widthSP = 100 - sbW - this.sBarPosition;
}
jQuery(this.firstPane).css("width", this.sBarPosition + "%");
jQuery(this.splitterBar).css("width", sbW + "%");
jQuery(this.secondPane).css("width", widthSP + "%");
} else {
height = jQuery(this.splitterDIV).height();
if (height == 0 ) {
height = 100; //px so it would show something at least
}
sbH = (this.sbSize * 100) / height;
// check if bar is in the far bottom
if (this.sBarPosition >= 100 || this.sBarPosition + sbH > 100) {
this.sBarPosition = 100 - sbH;
heightSP = 0;
} else {
heightSP = 100 - sbH - this.sBarPosition;
}
jQuery(this.firstPane).css("height", this.sBarPosition + "%");
jQuery(this.splitterBar).css("height", sbH + "%");
jQuery(this.secondPane).css("height", heightSP + "%");
}
// update splitterpos value...suppress rerendering
this.setProperty("splitterPosition", this.sBarPosition + "%", true);
// fix height if splitterdiv height is 0 we set it to 100 px to show something at least
// further resizing should then work correctly
if (jQuery(this.splitterDIV).height() == 0 && !this.splitterDIV.style.height) {
jQuery(this.splitterDIV).css("height", "100px");
jQuery(this.splitterBar).css("height", "100px");
}
};
Splitter.prototype.setSplitterPosition = function(sPos){
if (this.getDomRef()) {
this.setProperty("splitterPosition", sPos, true);
this._recalculateInternals();
} else {
this.setProperty("splitterPosition", sPos);
}
};
Splitter.prototype.setSplitterBarVisible = function(bVisible){
if (this.getDomRef()) {
this.setProperty("splitterBarVisible", bVisible, true);
var sClassPrefix = this.getSplitterOrientation() === sap.ui.core.Orientation.Vertical ? "sapUiVertical" : "sapUiHorizontal";
if (bVisible) {
jQuery.sap.byId(this.getId() + "_SB").removeClass(sClassPrefix + "SplitterBarHidden").addClass(sClassPrefix + "SplitterBar");
} else {
jQuery.sap.byId(this.getId() + "_SB").removeClass(sClassPrefix + "SplitterBar").addClass(sClassPrefix + "SplitterBarHidden");
}
} else {
this.setProperty("splitterBarVisible", bVisible);
}
};
/**
* set height to a fixed height if there is no absolute height specified
*/
Splitter.prototype.fixHeight = function() {
// check the parentNode height
var parentHeight = jQuery(this.splitterDIV.parentNode).height();
var splitterHeight = jQuery(this.splitterDIV).height();
if (parentHeight > splitterHeight) {
splitterHeight = parentHeight;
// check if there was a custom max height set...then we use it regardless
// of container height but only for px values
var customMaxHeight = this.getHeight();
if (customMaxHeight && customMaxHeight.toLowerCase().indexOf("px") != -1) {
splitterHeight = parseInt(customMaxHeight, 10);
}
// for % values we use the splitter div height if the % is < 100% else
// we leave the size as the parent height
if (customMaxHeight && customMaxHeight.toLowerCase().indexOf("%") != -1) {
var percentValue = parseInt(customMaxHeight, 10);
if (percentValue < 100) {
splitterHeight = jQuery(this.splitterDIV).height();
}
}
// if splitterheight is 0 which shouldn't be the case we set the parent height again.
if (splitterHeight <= 0) {
splitterHeight = parentHeight;
}
}
// reset the splitter div height so that its contents fit inside...
jQuery(this.splitterDIV).css("height", splitterHeight + "px");
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
jQuery(this.splitterBar).css("height", splitterHeight + "px");
}
var oParent = this.splitterDIV.parentNode;
if (oParent) {
var fHandler = jQuery.proxy(this.onresizespecial, this);
this.sSpecialResizeListenerId = ResizeHandler.register(oParent, fHandler);
//fHandler({target: oParent});
}
};
/**
* cleanup resize event registration before re-rendering
*/
Splitter.prototype.exit = function() {
if (this.sResizeListenerId) {
ResizeHandler.deregister(this.sResizeListenerId);
this.sResizeListenerId = null;
}
if (this.sSpecialResizeListenerId) {
ResizeHandler.deregister(this.sSpecialResizeListenerId);
this.sSpecialResizeListenerId = null;
}
};
/**
* resize event handler to handle the special case when no splitter parent height is specified and the splitter height is specified in %.
* Then the splitter won't be displayed. In this case when the parent gets resized, get the parents height and use it to adapt the current fixed splitter height in px
* so that everything stays in place.
*/
Splitter.prototype.onresizespecial = function(oEvent) {
var $Splitter = jQuery(this.splitterDIV);
var oldHeight = $Splitter.height();
$Splitter.css("height", "0px");
var oDom = this.getDomRef();
if (oDom && window.getComputedStyle) {
// force browser to apply CSS so that the height is 0 and can then be calculated from new
window.getComputedStyle(oDom);
}
// perhaps this is event handler is not needed. depends on if current child elements should be resized or not
var parentHeight = jQuery(oEvent.target).height();
var currentHeight = $Splitter.height();
if (currentHeight != parentHeight) {
// set bar height to the splitterDIV height value
$Splitter.css("height", parentHeight + "px");
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
jQuery(this.splitterBar).css("height", parentHeight + "px");
}
}
// if there is no parent height set the old height again. This might be the case if the parent doesn't have a height yet...
if (parentHeight <= 0) {
$Splitter.css("height", oldHeight + "px");
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
jQuery(this.splitterBar).css("height", oldHeight + "px");
}
}
};
/**
* mousedown event handler: create a ghost bar for the splitter bar and starts dragging it
*/
Splitter.prototype.onmousedown = function(oEvent) {
if (oEvent.target != this.splitterBar) {
return;
}
var oJBody = jQuery(document.body);
// Fix for IE text selection while dragging
oJBody.bind("selectstart",jQuery.proxy(this.splitterSelectStart,this));
var offset = jQuery(this.splitterBar).offset();
var height = jQuery(this.splitterBar).height();
var width = jQuery(this.splitterBar).width();
var cssClass;
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
cssClass = "sapUiVSBGhost";
} else {
cssClass = "sapUiHSBGhost";
}
var iZIndex = Popup.getLastZIndex() + 5;
if (iZIndex < 20) {
iZIndex = 20;
}
jQuery(document.body).append(
"<div id=\"" + this.getId() + "_ghost\" class=\"" + cssClass + "\" style =\" height:" + height + "px; width:"
+ width + "px; left:" + offset.left + "px; top:" + offset.top + "px;z-index:" + iZIndex + "\"></div>");
// append overlay over splitter to enable correct functionality of moving the splitter
jQuery(document.body).append(
"<div id=\"" + this.getId() + "_overlay\" style =\"left: 0px;" +
" right: 0px; bottom: 0px; top: 0px; position:fixed; z-index:" + iZIndex + "\" ></div>");
jQuery(document).bind("mouseup", jQuery.proxy(this.onGhostMouseRelease, this));
jQuery(document).bind("mousemove", jQuery.proxy(this.onGhostMouseMove, this));
// focus splitter bar
jQuery(this.splitterBar).focus();
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
};
/**
* The selectstart event triggered in IE to select the text.
* @private
* @param {event} oEvent The splitterselectstart event
* @return {boolean} false
*/
Splitter.prototype.splitterSelectStart = function(oEvent){
oEvent.preventDefault();
oEvent.stopPropagation();
return false;
};
/**
* drops the splitter bar
*/
Splitter.prototype.onGhostMouseRelease = function(oEvent) {
var newSbPosition, spHeight, spWidth;
var splitterBarGhost = jQuery.sap.domById(this.getId() + "_ghost");
var rtl = sap.ui.getCore().getConfiguration().getRTL();
if ( this.spOrientation == sap.ui.core.Orientation.Vertical) {
if (!rtl) {
newSbPosition = oEvent.pageX - jQuery(this.firstPane).offset().left;
spWidth = jQuery(this.splitterDIV).width();
newSbPosition = (newSbPosition * 100) / spWidth;
} else {
newSbPosition = oEvent.pageX - jQuery(this.secondPane).offset().left;
spWidth = jQuery(this.splitterDIV).width();
newSbPosition = (( spWidth - newSbPosition ) * 100) / spWidth;
}
} else {
newSbPosition = oEvent.pageY - jQuery(this.firstPane).offset().top;
spHeight = jQuery(this.splitterDIV).height();
newSbPosition = (newSbPosition * 100) / spHeight;
}
if (newSbPosition < this.minSizeFP) {
newSbPosition = this.minSizeFP;
} else if ((100 - newSbPosition) < this.minSizeSP) {
newSbPosition = 100 - this.minSizeSP;
}
this.sBarPosition = newSbPosition;
this.resizeSplitterElements();
jQuery(splitterBarGhost).remove();
jQuery.sap.byId(this.getId() + "_overlay").remove();
var oJBody = jQuery(document.body);
oJBody.unbind("selectstart", this.splitterSelectStart);
jQuery(document).unbind("mouseup", this.onGhostMouseRelease);
jQuery(document).unbind("mousemove", this.onGhostMouseMove);
};
Splitter.prototype.onGhostMouseMove = function(oEvent) {
var splitterBarGhost = jQuery.sap.domById(this.getId() + "_ghost");
var max;
var min;
var rtl = sap.ui.getCore().getConfiguration().getRTL();
var leftFirstPane = jQuery(this.firstPane).offset().left;
var w = jQuery(this.splitterDIV).width();
var leftSecondPane = jQuery(this.secondPane).offset().left;
if (this.getSplitterOrientation() == sap.ui.core.Orientation.Vertical) {
if (!rtl) {
min = leftFirstPane + (w * this.minSizeFP) / 100;
max = leftFirstPane + (w * (100 - this.minSizeSP)) / 100;
if (oEvent.pageX > min && oEvent.pageX < max) {
jQuery(splitterBarGhost).css("left", oEvent.pageX + "px");
}
} else {
min = leftSecondPane + (w * this.minSizeSP) / 100;
max = leftSecondPane + (w * (100 - this.minSizeFP)) / 100;
if (oEvent.pageX > min && oEvent.pageX < max) {
jQuery(splitterBarGhost).css("left", oEvent.pageX + "px");
}
}
} else {
var h = jQuery(this.splitterDIV).height();
min = jQuery(this.firstPane).offset().top + (h * this.minSizeFP) / 100;
max = jQuery(this.secondPane).offset().top + jQuery(this.secondPane).height() - (h * this.minSizeSP) / 100;
if (oEvent.pageY > min && oEvent.pageY < max) {
jQuery(splitterBarGhost).css("top", oEvent.pageY + "px");
}
}
};
/**
* Convenience method for handling of Ctrl key, meta key etc.
*
* @private
*/
Splitter.prototype.getCtrlKey = function(oEvent) {
return !!(oEvent.ctrlKey || oEvent.metaKey); // double negation doesn't have effect on boolean but ensures null and undefined are equivalent to false.
};
/**
* Convenience method to check an event for a certain combination of modifier keys
*
* @private
*/
Splitter.prototype.checkModifierKey = function(oEvent, bCtrlKey, bAltKey, bShiftKey) {
return oEvent.shiftKey == bShiftKey && oEvent.altKey == bAltKey && this.getCtrlKey(oEvent) == bCtrlKey;
};
/**
* Home key minimizes the first pane to the last possible position
*/
Splitter.prototype.onsaphome = function(oEvent) {
if (oEvent.target == this.splitterBar) {
this.sBarPosition = this.minSizeFP;
this.resizeSplitterElements();
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* End key maximizes the first pane to the last possible position
*/
Splitter.prototype.onsapend = function(oEvent) {
if (oEvent.target == this.splitterBar) {
this.sBarPosition = 100 - this.minSizeSP;
this.resizeSplitterElements();
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
Splitter.prototype.onArrowKeys = function(oEvent,oInc) {
var width, height, sbSize, sbPosition, newSbPosition;
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
width = jQuery(this.splitterDIV).width();
sbPosition = jQuery(this.firstPane).width();
sbPosition = (sbPosition * 100) / width;
// move 10 pixels
sbSize = (10 * 100) / width;
} else {
height = jQuery(this.splitterDIV).height();
sbPosition = jQuery(this.firstPane).height();
sbPosition = (sbPosition * 100) / height;
// move 10 pixels
sbSize = (10 * 100) / height;
}
if (oInc == "false") {
newSbPosition = sbPosition - sbSize;
} else if (oInc == "true") {
newSbPosition = sbPosition + sbSize;
}
if (newSbPosition < this.minSizeFP) {
newSbPosition = this.minSizeFP;
} else if ((100 - newSbPosition) < this.minSizeSP) {
newSbPosition = 100 - this.minSizeSP;
}
this.sBarPosition = newSbPosition;
this.resizeSplitterElements();
};
/**
* If the Shift and Up keys are pressed and if the focus is the onsplitterBar moves the horizontal sash bar up by one step
* and the vertical sash bar left one step
*/
Splitter.prototype.onsapupmodifiers = function(oEvent) {
if (this.checkModifierKey(oEvent, false, false, true)) {
if (oEvent.target == this.splitterBar) {
if (this.spOrientation == sap.ui.core.Orientation.Horizontal) {
this.onArrowKeys(oEvent,"false");
} else {
// move vertical splitter left
this.onsapleftmodifiers(oEvent);
}
}
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* If the Shift and Up keys are pressed and if the focus is on the splitterBar moves the horizontal sash bar down by one step
* and the vertical sash bar right one step
*/
Splitter.prototype.onsapdownmodifiers = function(oEvent) {
if (this.checkModifierKey(oEvent, false, false, true)) {
if (oEvent.target == this.splitterBar) {
if (this.spOrientation == sap.ui.core.Orientation.Horizontal) {
this.onArrowKeys(oEvent,"true");
} else {
// move vertical splitter right
this.onsaprightmodifiers(oEvent);
}
}
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* If the Shift and Left keys are pressed and if the focus is on splitterBar moves the vertical sash bar left by one step or
* the horizontal sash bar up one step
*/
Splitter.prototype.onsapleftmodifiers = function(oEvent) {
if (this.checkModifierKey(oEvent, false, false, true)) {
if (oEvent.target == this.splitterBar) {
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
var rtl = sap.ui.getCore().getConfiguration().getRTL();
if (rtl) {
this.onArrowKeys(oEvent,"true");
} else {
this.onArrowKeys(oEvent,"false");
}
} else {
// move horizontal splitter up
this.onsapupmodifiers(oEvent);
}
}
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* If the Shift and Right keys are pressed and if the focus is on the splitterBar moves the vertical sash bar right by one step
* and the horizontal sash bar down one step
*/
Splitter.prototype.onsaprightmodifiers = function(oEvent) {
if (this.checkModifierKey(oEvent, false, false, true)) {
if (oEvent.target == this.splitterBar) {
if (this.spOrientation == sap.ui.core.Orientation.Vertical) {
var rtl = sap.ui.getCore().getConfiguration().getRTL();
if (rtl) {
this.onArrowKeys(oEvent,"false");
} else {
this.onArrowKeys(oEvent,"true");
}
} else {
// move horizontal splitter down
this.onsapdownmodifiers(oEvent);
}
}
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* only drag events are fired; mouse events such as mousemove are not fired during drag operation
*/
/**
* event dragstart fired when the user starts dragging the sash bar
*/
Splitter.prototype.ondragstart = function(oEvent) {
if (oEvent.target != this.splitterBar) {
return;
}
// cancel the event
oEvent.preventDefault();
oEvent.stopPropagation();
};
Splitter.prototype.getText = function(sKey, aArgs) {
var rb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.commons");
if (rb) {
return rb.getText(sKey, aArgs);
}
return sKey;
};
return Splitter;
}, /* bExport= */ true);
| {
"content_hash": "e18601dd7bd04525565fdf66f099005f",
"timestamp": "",
"source": "github",
"line_count": 695,
"max_line_length": 267,
"avg_line_length": 32.985611510791365,
"alnum_prop": 0.6829225736095965,
"repo_name": "SuicidePreventionSquad/SeniorProject",
"id": "4c9cb230d549be4eccb1d9286dd747cfd95739e0",
"size": "23110",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "resources/sap/ui/commons/Splitter-dbg.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4792521"
},
{
"name": "HTML",
"bytes": "6334"
},
{
"name": "JavaScript",
"bytes": "29024184"
}
],
"symlink_target": ""
} |
@import "style.min.css";
@import "sprites-toolbar.min.css";
@import "sprites-toolbar-hover.min.css";
@import "sprites.min.css";
@import "sprites-hover.min.css";
.cms-frontadmin-node {
position: relative;
}
.cms-frontadmin-node:hover {
}
/*
.cms-frontadmin-node-mode-edit {
outline: 1px dashed gray;
}
.cms-frontadmin-node-mode-edit:hover {
outline: 2px dashed red;
}
*/
.cms-empty-node {
height: 8px;
width: 8px;
background-color: red;
}
.cms-frontadmin-node-buttons {
color: #000000;
}
.cms-frontadmin-node-buttons.btn-group {
float: left;
position: absolute;
/*top: -6px;*/
left: 0;
z-index: 999;
}
.cms-frontadmin-node-buttons.btn-group a {
text-decoration: none;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: normal;
font-size: 12px;
text-align: left;
}
.cms-frontadmin-node-buttons.btn-group li {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
.cms-toolbar li {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
ul.dropdown-menu { /* Прижать меню вплотную к плашке*/
margin: 0;
}
.cms-toolbar-navbar a {
text-decoration: none;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-weight: normal;
font-size: 14px !important;
}
.cms-toolbar-navbar ul.nav li.dropdown:hover ul.dropdown-menu {
display: block;
margin: 0;
}
.cms-toolbar-navbar a.menu:after,
.cms-toolbar-navbar .dropdown-toggle:after {
content: none;
}
.cms-toolbar-navbar-nav > li > a {
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.cms-toolbar-navbar {
min-height: 30px !important
}
.cms-toolbar-navbar-brand {
float: left;
height: 30px;
padding: 5px 15px;
font-size: 18px;
line-height: 20px;
}
| {
"content_hash": "5e525cb3fe64dcbe3f650dd85703f94a",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 64,
"avg_line_length": 21.9390243902439,
"alnum_prop": 0.6625903279599777,
"repo_name": "Smart-Core/CMSBundle",
"id": "00faffa416ebee2fcb602d2048cffc3dc75fff1f",
"size": "1825",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Resources/public/frontadmin/frontend.css",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "61416"
},
{
"name": "HTML",
"bytes": "134648"
},
{
"name": "JavaScript",
"bytes": "13554"
},
{
"name": "PHP",
"bytes": "244869"
}
],
"symlink_target": ""
} |
<?php
/**
* This class represents objects dispensed by the MenuItem model
*
* @package Nails\Cms\Resource\Menu
* @category resource
*/
namespace Nails\Cms\Resource\Menu;
use Nails\Cms\Constants;
use Nails\Cms\Resource\Menu;
use Nails\Cms\Resource\Page;
use Nails\Common\Exception\FactoryException;
use Nails\Common\Exception\ModelException;
use Nails\Common\Helper\Model\Expand;
use Nails\Common\Resource\Entity;
use Nails\Common\Resource\ExpandableField;
use Nails\Factory;
/**
* Class Item
*
* @package Nails\Cms\Resource\Menu
*/
class Item extends Entity
{
/** @var int */
public $menu_id;
/** @var Menu|null */
public $menu;
/** @var int */
public $parent_id;
/** @var Item|null */
public $parent;
/** @var int */
public $order;
/** @var int */
public $page_id;
/** @var Page */
public $page;
/** @var string */
public $url;
/** @var string */
public $label;
/** @var ExpandableField|null */
public $children;
// --------------------------------------------------------------------------
/**
* Returns the item's children
*
* @return ExpandableField|null
* @throws FactoryException
* @throws ModelException
*/
public function children(): ?ExpandableField
{
if (empty($this->children)) {
/** @var \Nails\Cms\Model\Menu\Item $oModel */
$oModel = Factory::model('MenuItem', Constants::MODULE_SLUG);
$oItem = $oModel->getById($this->id, [new Expand('children')]);
$this->children = $oItem->children;
}
return $this->children;
}
// --------------------------------------------------------------------------
/**
* Returns the item's page
*
* @return Page|null
* @throws FactoryException
*/
public function page(): ?Page
{
if (empty($this->page) && !empty($this->page_id)) {
/** @var \Nails\Cms\Model\Menu\Item $oModel */
$oModel = Factory::model('MenuItem', Constants::MODULE_SLUG);
$oItem = $oModel->getById($this->id, [new Expand('page')]);
$this->page = $oItem->page;
}
return $this->page;
}
// --------------------------------------------------------------------------
/**
* Returns the menu items URL
*
* @return string|null
* @throws FactoryException
*/
public function getUrl(): ?string
{
if ($this->page_id || $this->page) {
$oPage = $this->page();
}
return $oPage->published->url ?? $this->url;
}
}
| {
"content_hash": "39ee2e3c055e12524c83e192289d3a2a",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 81,
"avg_line_length": 22.033333333333335,
"alnum_prop": 0.5109682299546142,
"repo_name": "nailsapp/module-cms",
"id": "378bd95fe406a546e3ef4f0e597d9551512f10dc",
"size": "2644",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/Resource/Menu/Item.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "31599"
},
{
"name": "JavaScript",
"bytes": "78647"
},
{
"name": "PHP",
"bytes": "363834"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Slider Static Test : Slider vertical range min</title>
<link rel="stylesheet" href="../static.css" type="text/css" />
<link rel="stylesheet" href="../../../themes/base/jquery.ui.base.css" type="text/css" />
<link rel="stylesheet" href="../../../themes/base/jquery.ui.theme.css" type="text/css" title="ui-theme" />
<script type="text/javascript" src="../../../jquery-1.7.1.js"></script>
<script type="text/javascript" src="../static.js"></script>
</head>
<body>
<div class="ui-slider ui-slider-vertical ui-widget ui-widget-content ui-corner-all"><div style="height:25%;" class="ui-slider-range ui-slider-range-min ui-widget-header"></div><a style="bottom: 25%;" class="ui-slider-handle ui-state-default ui-corner-all" href="#"></a></div>
</body>
</html>
| {
"content_hash": "5efe70f17d4e09f0bcd39e8ef1f8b232",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 275,
"avg_line_length": 49.05882352941177,
"alnum_prop": 0.6666666666666666,
"repo_name": "coachcly/Dashboard",
"id": "b43d4511bcc657a7c49208e8a0ca89b9248d13b7",
"size": "834",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "server-scripts/javascript/jquery-ui-1.8.18/tests/static/slider/slider_vertical_range_min.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "257832"
},
{
"name": "JavaScript",
"bytes": "1841527"
},
{
"name": "PHP",
"bytes": "854398"
}
],
"symlink_target": ""
} |
layout: post.njk
title: "Mantine"
summary: "This is a pretty nice looking component library for React. Themmeable, reponsive and compatible with Gatsby, Remix or NextJS. Looks pretty full features. I thought it was cool, but I'd love to know if there's something else people are using."
thumb: "/images/toolbox/2022-04-13_12-13-03.png"
links:
- website: "https://mantine.dev"
category:
tags:
- external
---
| {
"content_hash": "970cd5ca037af44eafd58f41b6a7b42f",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 253,
"avg_line_length": 41.2,
"alnum_prop": 0.7451456310679612,
"repo_name": "planetoftheweb/planetoftheweb.github.io",
"id": "1b234ad1882b49332fd84420aaae6ec8f4bba71f",
"size": "416",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "_site/shorts/2022-04-10-mantine.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "13932"
},
{
"name": "Nunjucks",
"bytes": "46538"
},
{
"name": "SCSS",
"bytes": "12804"
}
],
"symlink_target": ""
} |
require 'heirloom/acl/s3'
| {
"content_hash": "e47f9dadf0fc77e7f8ea4788d4ea5e68",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 25,
"avg_line_length": 26,
"alnum_prop": 0.7692307692307693,
"repo_name": "intuit/heirloom",
"id": "fa6279fe0b8b43033006ed4302bea3125d40e03d",
"size": "26",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/heirloom/acl.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "246909"
}
],
"symlink_target": ""
} |
package org.cyberneko.html;
/**
* This interface is used to pass augmentated information to the
* application through the XNI pipeline.
*
* @author Andy Clark
*
* @version $Id: HTMLEventInfo.java 219322 2012-10-18 12:38:37Z shiym $
*/
public interface HTMLEventInfo {
//
// HTMLEventInfo methods
//
// location information
/** Returns the line number of the beginning of this event.*/
public int getBeginLineNumber();
/** Returns the column number of the beginning of this event.*/
public int getBeginColumnNumber();
/** Returns the character offset of the beginning of this event.*/
public int getBeginCharacterOffset();
/** Returns the line number of the end of this event.*/
public int getEndLineNumber();
/** Returns the column number of the end of this event.*/
public int getEndColumnNumber();
/** Returns the character offset of the end of this event.*/
public int getEndCharacterOffset();
// other information
/** Returns true if this corresponding event was synthesized. */
public boolean isSynthesized();
/**
* Synthesized infoset item.
*
* @author Andy Clark
*/
public static class SynthesizedItem
implements HTMLEventInfo {
//
// HTMLEventInfo methods
//
// location information
/** Returns the line number of the beginning of this event.*/
public int getBeginLineNumber() {
return -1;
} // getBeginLineNumber():int
/** Returns the column number of the beginning of this event.*/
public int getBeginColumnNumber() {
return -1;
} // getBeginColumnNumber():int
/** Returns the character offset of the beginning of this event.*/
public int getBeginCharacterOffset() {
return -1;
} // getBeginCharacterOffset():int
/** Returns the line number of the end of this event.*/
public int getEndLineNumber() {
return -1;
} // getEndLineNumber():int
/** Returns the column number of the end of this event.*/
public int getEndColumnNumber() {
return -1;
} // getEndColumnNumber():int
/** Returns the character offset of the end of this event.*/
public int getEndCharacterOffset() {
return -1;
} // getEndCharacterOffset():int
// other information
/** Returns true if this corresponding event was synthesized. */
public boolean isSynthesized() {
return true;
} // isSynthesized():boolean
//
// Object methods
//
/** Returns a string representation of this object. */
public String toString() {
return "synthesized";
} // toString():String
} // class SynthesizedItem
} // interface HTMLEventInfo
| {
"content_hash": "49b568ec0b60135af264c1cc586c3721",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 74,
"avg_line_length": 27.349056603773583,
"alnum_prop": 0.6133149361848913,
"repo_name": "xuse/ef-others",
"id": "62c151dd1c24b89a8d3fac9f88058697db42dba2",
"size": "3499",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "common-misc/src/main/java/org/cyberneko/html/HTMLEventInfo.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "587"
},
{
"name": "CSS",
"bytes": "2036"
},
{
"name": "HTML",
"bytes": "6788"
},
{
"name": "Java",
"bytes": "2570656"
},
{
"name": "JavaScript",
"bytes": "9129"
}
],
"symlink_target": ""
} |
> see https://aka.ms/autorest
``` yaml
azure-arm: true
require:
- https://github.com/Azure/azure-rest-api-specs/blob/c583b05741fadfdca116be3b9ccb1c4be8a73258/specification/containerservice/resource-manager/readme.md
- https://github.com/Azure/azure-rest-api-specs/blob/c583b05741fadfdca116be3b9ccb1c4be8a73258/specification/containerservice/resource-manager/readme.go.md
license-header: MICROSOFT_MIT_NO_VERSION
module-version: 2.3.0-beta.1
tag: package-preview-2022-09
```
| {
"content_hash": "d15ff4406c7cacc6938e28ec78f4f60b",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 154,
"avg_line_length": 43.18181818181818,
"alnum_prop": 0.8168421052631579,
"repo_name": "Azure/azure-sdk-for-go",
"id": "f5f83bfa36b49a320ac42ff1cbe649c5be704bc8",
"size": "503",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "sdk/resourcemanager/containerservice/armcontainerservice/autorest.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1629"
},
{
"name": "Bicep",
"bytes": "8394"
},
{
"name": "CSS",
"bytes": "6089"
},
{
"name": "Dockerfile",
"bytes": "1435"
},
{
"name": "Go",
"bytes": "5463500"
},
{
"name": "HTML",
"bytes": "8933"
},
{
"name": "JavaScript",
"bytes": "8137"
},
{
"name": "PowerShell",
"bytes": "504494"
},
{
"name": "Shell",
"bytes": "3893"
},
{
"name": "Smarty",
"bytes": "1723"
}
],
"symlink_target": ""
} |
title: "Minimal Mistakes: v4.4.1 with staticman v2 and nested comments"
layout: single
date: 2017-05-11 20:22:28 +0100
excerpt: "Minimal mistakes nested comments: How to implement staticman v2 and nested comments for the Jekyll Minimal Mistakes theme v4.4.1"
classes: wide
categories:
- Jekyll
tags:
- minimal-mistakes
- staticman
---
# Introduction
Prior to starting my (still quite young) blog i had to decide which software to choose
for running the blog. The idea of static pages was quite convincing, in particular in
combination with using staticman for comments.
As i chose [minimal-mistakes](https://github.com/mmistakes/minimal-mistakes)
as theme for my blog, staticman (v1) integration came out of the box.
The nested comment feature as implemented by [Michael Rose](https://mademistakes.com)
(the author of the minimal-mistakes theme) felt convincing and so i tried to implement
it. Often. Failed often. And i failed more often as Javascript, HTML and various other
things utilized by the theme are far away from my comfort zone.
In the end i was able to make it after i understood some of the relationship between
the templates (comment.html, comments.html), javascript (fill form fields dynamically)
and stylesheets (appearance and "formatting").
That felt rather bothersome and i got some kind of training in doing the changes
repeatedly, i try to help others not to loose that much time and hair while trying
to do so. After doing so i created a patch between the initial repository and the
"final" repository which has nested comments with staticman v2 working.
So far i have not easily been able to get mail notifications and reCaptcha working
smoothly and thus they are currently disabled. Will work on that every now and then
to get this incorporated, too.
For anyone interested: I basically copied the relevant files from Michaels jekyll site over and amended things where required.
Note: I didn't get the lazyload stuff working which Michael Rose uses in for his
blog so i included [lazysizes](https://github.com/aFarkas/lazysizes) within the patch.
This is how you could quickly to where i got, too:
# 1. Fork the minimal-mistakes repository
Fork the minimal-mistakes repository into your github account [Click here to fork](https://github.com/mmistakes/minimal-mistakes/fork). For this blog entry i renamed the created
for to "mmistakes441-staticmanv2".
# 2. Add staticman as a collaborator
Add staticman as a collaborator for your forked repository. See the [minimal-mistakes documentation](https://mmistakes.github.io/minimal-mistakes/docs/configuration/) and search for "Add Staticman as a Collaborator". Call the api endpoint of staticman v2 afterwards:
https://api.staticman.net/v2/connect/{ your github username }/mmistakes441-staticmanv2
It is important to use the v2 API (see v2 in the link).
# 3. Get the diff
You can either clone the [minimal-mistakes-441-to-staticman-v2 repository](https://github.com/andreasfaerber/minimal-mistakes-441-to-staticman-v2) or [download the diff
directly](https://raw.githubusercontent.com/andreasfaerber/minimal-mistakes-441-to-staticman-v2/master/mmistakes441-staticmanv2-nested-comments.diff).
# 4. Clone your repository
Clone your freshly forked minimal-mistakes repository and cd into the directory.
{% highlight shell %}
afaerber@a:~/src$ git clone [email protected]:andreasfaerber/mmistakes441-staticmanv2.git
Cloning into 'mmistakes441-staticmanv2'...
remote: Counting objects: 9684, done.
remote: Total 9684 (delta 0), reused 0 (delta 0), pack-reused 9684
Receiving objects: 100% (9684/9684), 31.86 MiB | 4.33 MiB/s, done.
Resolving deltas: 100% (5392/5392), done.
Checking connectivity... done.
afaerber@a:~/src$ cd mmistakes441-staticmanv2
afaerber@a:~/src/mmistakes441-staticmanv2$
{% endhighlight %}
# 5. Apply the patch
Apply the diff downloaded or cloned before. I cloned it parallel to the mmistakes441-staticmanv2 directory.
{% highlight shell %}
afaerber@a:~/src/mmistakes441-staticmanv2$ git apply --reject ../minimal-mistakes-441-to-staticman-v2/mmistakes441-staticmanv2-nested-comments.diff
{% endhighlight %}
# 6. Re-generate Javascript files
Regenerate the Javascript files into the main.min.js file by running the
following shell script created by the patch:
{% highlight shell %}
afaerber@a:~/src/mmistakes441-staticmanv2$ sh ./do_uglify.sh
afaerber@a:~/src/mmistakes441-staticmanv2$
{% endhighlight %}
# 7. Fill in your Github data
Edit "do_update_github.sh" which has also been created via the patch and fill in
your GITHUB_USERNAME, GITHUB_REPOSITORY and GITHUB_BRANCH (which will stay at master if you followed the steps here).
{% highlight shell %}
GITHUB_USERNAME=andreasfaerber
GITHUB_REPOSITORY=mmistakes441-staticmanv2
GITHUB_BRANCH=master
{% endhighlight %}
Execute it:
{% highlight shell %}
afaerber@a:~/src/mmistakes441-staticmanv2$ sh ./do_update_github.sh
afaerber@a:~/src/mmistakes441-staticmanv2$
{% endhighlight %}
# 8. Push changes to Github
Commit and push the changes to Github:
{% highlight shell %}
git add .
git commit -m 'Updated to staticman v2'
git push
{% endhighlight %}
# 9. Jekyll serve
Build and serve your Jekyll
{% highlight shell %}
afaerber@a:~/src/mmistakes441-staticmanv2$ bundle exec jekyll serve
Configuration file: /home/afaerber/src/mmistakes441-staticmanv2/_config.yml
Configuration file: /home/afaerber/src/mmistakes441-staticmanv2/_config.yml
Source: /home/afaerber/src/mmistakes441-staticmanv2
Destination: /home/afaerber/src/mmistakes441-staticmanv2/_site
Incremental build: disabled. Enable with --incremental
Generating...
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
done in 5.755 seconds.
Auto-regeneration: enabled for '/home/afaerber/src/mmistakes441-staticmanv2'
Configuration file: /home/afaerber/src/mmistakes441-staticmanv2/_config.yml
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
{% endhighlight %}
# 9. Testing
Browse to <http://127.0.0.1/> and check if comments and nested comments are working:
Upon submitting a comment you see a new pull request in your Github repository. Merge that
pull request, run "git pull" in your repository and either run Jekyll serve again
or if it's running in the background, wait for it to re-generate your site.
Reload the page.
Let me know if it also works for you or about issues you found.
| {
"content_hash": "4387c8821f9d4016287fe29d7073ef4d",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 266,
"avg_line_length": 41.825806451612905,
"alnum_prop": 0.7755668671911152,
"repo_name": "andreasfaerber/blog.faerber.me",
"id": "976dd18251459ddb8091d32a9da6ea47a31fee51",
"size": "6487",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_posts/2017-05-11-minimal-mistakes441-with-staticman-v2-and-nested-comments.markdown",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2075"
},
{
"name": "Ruby",
"bytes": "4140"
}
],
"symlink_target": ""
} |
setlocal
echo on
set HERE=%~dp0
set LOCALFOLDER=%HERE%local
set LOCALFBREPO=%HERE%local\full-build-org
set LOCALCSREPO=%HERE%local\cassandra-sharp-org
set LOCALCSCREPO=%HERE%local\cassandra-sharp-contrib-org
set LOCALBIN=%HERE%local\bin-org
set PAKET=paket.exe
set PATH=%PATH%;%HERE%..\tools
cd %HERE%
rmdir /s /q %LOCALFOLDER%
rem create binaries folder
mkdir %LOCALBIN%
git config --global user.email "[email protected]"
git config --global user.name "AppVeyor"
rem creating master repository
mkdir %LOCALFBREPO%
git init %LOCALFBREPO%
pushd %LOCALFBREPO%
git config --local receive.denyCurrentBranch updateInstead
echo dummy > dummy.txt
git add dummy.txt
git commit -am "initial commit"
popd
rem cloning repositories
git clone https://github.com/pchalamet/cassandra-sharp %LOCALCSREPO%
pushd %LOCALCSREPO%
git config --local receive.denyCurrentBranch updateInstead
popd
git clone https://github.com/pchalamet/cassandra-sharp-contrib %LOCALCSCREPO%
pushd %LOCALCSCREPO%
git config --local receive.denyCurrentBranch updateInstead
popd
rem fetch tools
%PAKET% restore || goto :ko
type %HERE%paket.lock
| {
"content_hash": "5201ce388b92d2faf2f013ae70983cc5",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 77,
"avg_line_length": 24.8,
"alnum_prop": 0.7948028673835126,
"repo_name": "pchalamet/full-build",
"id": "33c73ff9b51182e746bd8e7d74e758f8e60aa6d9",
"size": "1116",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "qa/qa-prepare.cmd",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "10157"
},
{
"name": "C#",
"bytes": "66"
},
{
"name": "F#",
"bytes": "271899"
},
{
"name": "Shell",
"bytes": "9164"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>t.js</title>
<style>
body { background:black; color:white; padding:40px; font-family: 'PT Sans', Helvetica, Arial, sans-serif;}
a { color:#9bf; }
p > span { display:inline-block; margin:0 10px; font-weight:bold; }
</style>
</head>
<body>
<div id="qunit"></div>
</body>
<script src="http://code.jquery.com/qunit/qunit-1.9.0.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/qunit/qunit-1.9.0.css">
<script src="t.min.js"></script>
<script type="t/template" id="test">
<h1>{{=greeting}}</h1>
<h2>{{=user.display_name}}</h2>
{{user.address}}
<address>{{%user.address}}</address>
{{/user.address}}
<h4>Friends</h4>
{{@user.friends}}
<a href="{{%_val.url}}">{{=_val.name}}</a><br>
{{/@user.friends}}
{{=not_a_value}}
{{=not.a.value}}
{{!not_a_value}}
<p>Missing required information!</p>
{{/!not_a_value}}
{{user.display_name}}
<p>Bacon ipsum {{=user.display_name}}?</p>
{{:user.display_name}}
This should not be here.
{{/user.display_name}}
{{not_a_value}}
This should not be here.
{{:not_a_value}}
<p>Yes bacon ipsum {{=user.display_name}}!</p>
{{/not_a_value}}
{{@user.prefs}}
<p><span>{{=_key}}</span>{{=_val}}</p>
{{/@user.prefs}}
<h4>Test Values</h4>
{{@test_values}}
<p>{{=_key}}<span id="{{=_key}}" data-val="{{%_val}}">{{=_val}}</span></p>
{{/@test_values}}
{{#greeting|hello,world}}
</script>
<script>
console.log(document.getElementById('test').innerHTML);
test("t.js tests", function() {
var div = document.createElement('div');
var template = new t(document.getElementById('test').innerHTML);
template.register("hello",function(data){return data+" Hello";});
template.register("world",function(data){return data+" world!";});
div.innerHTML = template.render({
greeting: "Welcome!",
user: {
display_name: "Jason",
address: "111 State St, Ithaca,<script>alert(1);<\/script> NY 14853",
friends: [
{name: "Kunal", url: "http://whatspop.com"},
{name: "Francisco", url: "http://smalldemons.com"},
{name: "Nick", url: "http://milewise.com"}
],
prefs: {
Notifications: "Yes!",
"Stay logged in": "No"
}
},
test_values: {
"true": true,
"false": false,
"zero": 0,
"string_zero": "0",
"null": null
}
});
document.body.appendChild(div);
console.log(div.innerHTML);
ok(/<h1>Welcome!<\/h1>/.test(div.innerHTML), "Simple interpolation.");
ok(/<h2>Jason<\/h2>/.test(div.innerHTML), "Name-spaced interpolation.");
ok(/<address>/.test(div.innerHTML), "If block.");
ok(/<p>Missing /.test(div.innerHTML), "If-not block.");
ok(/<p>Bacon ipsum Jason\?<\/p>/.test(div.innerHTML), "If-else block (true).");
ok(/<p>Yes bacon ipsum Jason\!<\/p>/.test(div.innerHTML), "If-else block (false).");
ok(/<address>111 State St, Ithaca,<script>alert\(1\);<\/script> NY 14853<\/address>/.test(div.innerHTML), "Scrubbed interpolation.");
equal(div.innerHTML.match(/>(?:Kunal|Francisco|Nick)</g).length, 3, "Array iteration.")
equal(div.innerHTML.match(/>(?:Notifications|Yes!|Stay logged in|No)</g).length, 4, "Object key/val iteration.")
ok(/Welcome! Hello world!/.test(div.innerHTML), "Function test.");
// passing true as a value is a little not-sane but we'll print it for you
equal(document.getElementById("true").innerHTML, "true", "Prints boolean true");
equal(document.getElementById("zero").innerHTML, "0", "Prints zero");
equal(document.getElementById("string_zero").innerHTML, "0", "Prints the string 0");
equal(document.getElementById("false").innerHTML, "", "Does not print boolean false");
equal(document.getElementById("null").innerHTML, "", "Does not print null");
equal((new t("{{%quot}}")).render({quot: '"'}), """, "Escapes quotes properly")
});
</script>
</html> | {
"content_hash": "c914ee073c3ea54370b6ba31f2e986d6",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 147,
"avg_line_length": 29.876923076923077,
"alnum_prop": 0.6240988671472708,
"repo_name": "icyflash/t.js",
"id": "9b15ae74760de6b0a96b9acbffd69b5e21351a37",
"size": "3884",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "t_test.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2399"
}
],
"symlink_target": ""
} |
<!--
The Ohio State University Research Foundation, Emory University,
the University of Minnesota Supercomputing Institute
Distributed under the OSI-approved BSD 3-Clause License.
See http://ncip.github.com/cagrid-grid-incubation/LICENSE.txt for details.
-->
<!--
-->
<?xml version="1.0"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd">
<info organisation="caGrid" module="MonitoringService" revision="${project.version}">
<license name="caGrid" url="http://cagrid.org/wiki/CaGrid:LICENSE-1.3"/>
<description>caGrid Monitoring Service</description>
</info>
<configurations>
<!-- Private Configurations-->
<conf name="target_grid" visibility="private"/>
<conf name="impl" visibility="private" extends="service"/>
<conf name="impl-test" visibility="private"/>
<!-- Public Configurations-->
<conf name="stubs" visibility="public"/>
<conf name="common" extends="stubs" visibility="public"/>
<conf name="client" extends="common" visibility="public"/>
<conf name="db" extends="common" visibility="public"/>
<conf name="service" visibility="public" extends="client"/>
<conf name="extension" visibility="public" extends="service"/>
<conf name="test" visibility="public" extends="service,impl-test"/>
<conf name="serviceTools" visibility="private" />
</configurations>
<publications>
<artifact name="caGrid-${ivy.module}-stubs" conf="stubs" type="jar"/>
<artifact name="caGrid-${ivy.module}-common" conf="common" type="jar"/>
<artifact name="caGrid-${ivy.module}-client" conf="client" type="jar"/>
<artifact name="caGrid-${ivy.module}-service" conf="service" type="jar"/>
<artifact name="caGrid-${ivy.module}-tests" conf="test" type="jar"/>
</publications>
<dependencies>
<!-- Standard caGrid Service Dependencies -->
<dependency rev="latest.integration" org="caGrid" name="core"
conf="service->default;impl-test->test"/>
<dependency rev="latest.integration" org="caGrid" name="metadata"
conf="service->schemas;client->common.jars"/>
<dependency rev="latest.integration" org="caGrid" name="service-security-provider"
conf="client->client;service->service"/>
<dependency rev="latest.integration" org="caGrid" name="advertisement" conf="service->default"/>
<dependency rev="${target.grid}" org="caGrid" name="target_grid" conf="target_grid->urls"/>
<dependency rev="latest.integration" org="caGrid" name="introduce-servicetools" conf="service->default"/>
<dependency rev="latest.integration" org="caGrid" name="metadatautils" conf="service->default"/>
<dependency rev="latest.integration" org="apache" name="commons-lang" conf="service->default"/>
<!-- External Dependencies -->
<dependency rev="1.0" org="jdom" name="jdom" conf="service->*"/>
<dependency rev="latest.integration" org="hibernate" name="hibernate" conf="service->default"/>
<dependency rev="4.4" org="junit" name="junit" conf="impl-test->default"/>
</dependencies>
</ivy-module>
| {
"content_hash": "63bdf592d12ef05ccb42da955d25d79a",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 109,
"avg_line_length": 43.77777777777778,
"alnum_prop": 0.688769035532995,
"repo_name": "NCIP/cagrid-grid-incubation",
"id": "e0e89480fb6529d9a6627af4423d4499cf0c2c76",
"size": "3152",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "grid-incubation/incubator/projects/monitor/projects/monitoringService/ivy.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C#",
"bytes": "332772"
},
{
"name": "Java",
"bytes": "7065405"
},
{
"name": "JavaScript",
"bytes": "59716"
},
{
"name": "Logos",
"bytes": "9561902"
},
{
"name": "Perl",
"bytes": "28244"
},
{
"name": "XQuery",
"bytes": "865184"
},
{
"name": "XSLT",
"bytes": "236294"
}
],
"symlink_target": ""
} |
Budget Module
=============
The budget module is responsible for providing access to budget information.
Budget JSON object
---------------------
All budget information is reported through json objects of the form
BUDGET := {
'id': id
'naam': naam
'current': current value
'minimum': minimum value
}
/budget
-------
Produce budget information belonging to one or more budget ids
Input parameters:
budget_id (1 or more)
Input JSON:
None
Authentication:
Required
Output JSON:
[BUDGET*]
/budget/vereniging
------------------
Produce budget information for all budgets that belong to a vereniging
Input Parameters:
vereniging_id (1 or more)
Input JSON:
None
Authentication:
Required
Output JSON:
[BUDGET*]
| {
"content_hash": "f6607c9b199f6c97a10f1193399a9fc5",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 76,
"avg_line_length": 18.894736842105264,
"alnum_prop": 0.7061281337047354,
"repo_name": "davidv1992/madmin",
"id": "203b82109d04052a31bfc271ce21847a68bd88b2",
"size": "718",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "doc/protocol/budget.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "117851"
}
],
"symlink_target": ""
} |
struct function* newFunction(object_t* (*f)(), char* name, int params) {
struct function *function = (struct function*) malloc(sizeof(struct function));
function->native = true;
function->pointer = f;
function->name = (char* ) malloc(255);
function->name = name;
function->params = params;
return function;
}
struct function* newZFunction(char* name, list_t* args, list_t* body, int params) {
struct function *function = (struct function*) malloc(sizeof(struct function));
function->native = false;
function->name = (char* ) malloc(255);
function->name = name;
function->args = args;
function->body = body;
function->params = params;
return function;
}
| {
"content_hash": "d7aac4138ba0543d084dbb03d4bcb40a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 83,
"avg_line_length": 34.2,
"alnum_prop": 0.6871345029239766,
"repo_name": "hscells/zapper-lang",
"id": "c3bf9b5de2a7b3defd3a4c7fae86da5568e1add8",
"size": "704",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "types.c",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "55438"
},
{
"name": "Makefile",
"bytes": "109"
}
],
"symlink_target": ""
} |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PublicKey.cs" company="Hakan Dilek">
// (c) 2013 Hakan Dilek
// </copyright>
// <summary>
// The public key.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Keysmith.Client.Lib
{
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.X509;
/// <summary>
/// The public key.
/// </summary>
public class PublicKey
{
#region Fields
/// <summary>
/// The public key parameter
/// </summary>
private readonly AsymmetricKeyParameter publicKeyParam;
#endregion
#region Constructors and Destructors
/// <summary>
/// Initializes a new instance of the <see cref="PublicKey"/> class.
/// </summary>
/// <param name="publicKeyParam">
/// The public key parameter
/// </param>
public PublicKey(AsymmetricKeyParameter publicKeyParam)
{
this.publicKeyParam = publicKeyParam;
}
#endregion
#region Public Methods and Operators
/// <summary>
/// The equals.
/// </summary>
/// <param name="obj">
/// The obj.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
public override bool Equals(object obj)
{
if (obj == null || this.GetType() != obj.GetType())
{
return false;
}
var other = obj as PublicKey;
return this.Equals(other);
}
/// <summary>
/// The get hash code.
/// </summary>
/// <returns>
/// The <see cref="int" />.
/// </returns>
public override int GetHashCode()
{
return this.publicKeyParam != null ? this.publicKeyParam.GetHashCode() : 0;
}
/// <summary>
/// The get public key info.
/// </summary>
/// <returns>
/// The <see cref="SubjectPublicKeyInfo" />.
/// </returns>
public SubjectPublicKeyInfo GetPublicKeyInfo()
{
return SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(this.publicKeyParam);
}
/// <summary>
/// The get public key param.
/// </summary>
/// <returns>
/// The <see cref="AsymmetricKeyParameter" />.
/// </returns>
public AsymmetricKeyParameter GetPublicKeyParam()
{
return this.publicKeyParam;
}
#endregion
#region Methods
/// <summary>
/// The equals.
/// </summary>
/// <param name="other">
/// The other.
/// </param>
/// <returns>
/// The <see cref="bool"/>.
/// </returns>
protected bool Equals(PublicKey other)
{
return this.publicKeyParam.Equals(other.publicKeyParam);
}
#endregion
}
} | {
"content_hash": "b80cf00b1495e6f8f3be5ff1f1030be7",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 120,
"avg_line_length": 26.941176470588236,
"alnum_prop": 0.4625701809107923,
"repo_name": "hakandilek/keysmith",
"id": "5288c83fb986dbda77179a5c63231765076a487e",
"size": "3208",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dotnet-client/Keysmith.Client.Lib/PublicKey.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "54749"
},
{
"name": "C++",
"bytes": "1523"
},
{
"name": "Java",
"bytes": "52166"
},
{
"name": "Objective-C",
"bytes": "45356"
},
{
"name": "Shell",
"bytes": "944"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.