code
stringlengths
3
1.01M
repo_name
stringlengths
5
116
path
stringlengths
3
311
language
stringclasses
30 values
license
stringclasses
15 values
size
int64
3
1.01M
'use strict'; const chalk = require('chalk'); const inquirer = require('inquirer'); const labels = require('./labels'); module.exports = { multipleWordsInput: (input) => { // node index.js add Super Mario World returns Super Mario World return input.splice(3).join(' '); }, calculateGames: (games) => { return console.log(chalk.cyan(games.length) + ` ${labels.log.gamesInCollection}`); }, gameAdded: (game) => { return console.log(chalk.yellow(chalk.bold(game) + ` ${labels.log.insertedIntoCollection}`)); }, gameRemoved: (game) => { return console.log(chalk.yellow(chalk.bold(game) + ` ${labels.log.removedFromCollection}`)); }, console: (type, message, style) => { if (type === 'log') { console.log( style ? chalk[style](chalk.dim(message)) : chalk.dim(message) ); } if (type === 'warning') { console.log( style ? chalk[style](chalk.yellow(message)) : chalk.yellow(message) ); } if (type === 'success') { console.log( style ? chalk[style](chalk.green(message)) : chalk.green(message) ); } if (type === 'error') { console.log( style ? chalk[style](chalk.red(message)) : chalk.red(message) ); } }, dialog: async (dialogType, dialogMessage, dialogName, dialogChoices, dialogPageSize, dialogNoSelectionMessage) => { return await inquirer.prompt([{ type: dialogType, message: dialogMessage, name: dialogName, choices: dialogChoices, pageSize: dialogPageSize, validate: (answer) => { if (answer.length < 1) { return dialogNoSelectionMessage; } return true; } }]); }, getMatchedGame: (gameFromDB, gamesFromAPI) => { for (const item of gamesFromAPI) { if (gameFromDB.title === item.title && gameFromDB.platform === item.platform) { module.exports.console('success', `${item.title} | ${item.platform}`); return item; } } module.exports.console('error', `${gameFromDB.title} | ${gameFromDB.platform}`); return null; } };
patrickkraaij/gamecollection-cli
utils.js
JavaScript
mit
1,960
<?php namespace OpenFuego; /** * Do not run this file directly. * Edit config.php to set up the application. * Then run fetch.php at the command line. * * This file must be included in scripts. * * Gracias. **/ if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID < 50300) { die(__NAMESPACE__ . ' requires PHP 5.3.0 or higher.'); } define('OPENFUEGO', TRUE); require(__DIR__ . '/config.php'); if (isset($argv) && in_array('-v', $argv)) { define(__NAMESPACE__ . '\VERBOSE', TRUE); } else { define(__NAMESPACE__ . '\VERBOSE', FALSE); } if (\OpenFuego\VERBOSE == TRUE) { ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); } else { ini_set('display_errors', 0); } require_once(__DIR__ . '/lib/TwitterOAuth/TwitterOAuth.class.php'); require_once(__DIR__ . '/lib/Phirehose/OAuthPhirehose.class.php'); spl_autoload_register(function($className) { $className = str_replace('OpenFuego' . '\\', '', $className); $className = strtr($className, '\\', DIRECTORY_SEPARATOR); $path = __DIR__ . '/' . $className . '.class.php'; if (is_readable($path)) { include_once($path); } }); /* Setting miscellaneous constants */ define(__NAMESPACE__ . '\BASE_DIR', __DIR__); define(__NAMESPACE__ . '\TMP_DIR', BASE_DIR . '/tmp'); define(__NAMESPACE__ . '\POSTMASTER', __NAMESPACE__ . '@' . __NAMESPACE__ . '.local'); // from address on error e-mails if (!is_dir(TMP_DIR)) { mkdir(TMP_DIR); file_put_contents(TMP_DIR . '/nothing', 'This file was created to initialize the cache directory. You can delete it.'); } const TWITTER_PREDICATE_LIMIT = 5000; define(__NAMESPACE__ . '\BITLY_PRO_DOMAINS', serialize( array( // assume these domains are shortened with Bitly 'bit.ly', 'bitly.com', 'j.mp' ) )); define(__NAMESPACE__ . '\SHORT_DOMAINS', serialize( array( // domains whose "long" urls are already short 'twitpic.com', 'instagr.am', 'instagram.com', 'yfrog.com', 'twitpic.com', 'vimeo.com', 'i.imgur.com', 'mlkshk.com', 'lockerz.com', 'path.com', 'vine.co' ) )); const DB_DRIVER = 'mysql', USER_AGENT = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)', REFERRER = 'http://google.com'; const IMAGE_SIZE_MAX=5000, IMAGE_SIZE_MIN=125, DAYS_TO_KEEP_ANY_LINK=2, //regardless of weighted count, we keep links this long MIN_WEIGHTED_COUNT_PERMANENT_KEEP=10, //never delete a link if it hits this threshold DAYS_TO_KEEP_SHORT_LINK_CACHE=2; //the 'expanded urls' will be deleted after this number of days (since last_seen). If a link is shared again later, the row will be inserted again /* if (file_exists(OPENFUEGO_DIR . '/openfuego-overrides.php')) { include_once(OPENFUEGO_DIR . '/openfuego-overrides.php'); } */
BBGInnovate/bbgWPFuego
init.php
PHP
mit
2,810
/** * \file * \author Guillaume Papin <guillaume.papin@epitech.eu> * * This file is distributed under the GNU General Public License. See * COPYING for details. */ #include "Irony.h" #include "Command.h" #include "support/CommandLineParser.h" #include <cassert> #include <cstdlib> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <memory> #include <vector> static void printHelp() { std::cout << "usage: irony-server [OPTIONS...] [COMMAND] [ARGS...]\n" "Options:\n" " -v, --version\n" " -h, --help\n" " -i, --interactive\n" " -d, --debug\n" " --log-file PATH\n" "\n" "Commands:\n"; #define X(sym, str, desc) \ if (Command::sym != Command::Unknown) \ std::cout << std::left << std::setw(18) << " " str << desc << "\n"; #include "Commands.def" } static void printVersion() { // do not change the format for the first line, external programs should be // able to rely on it std::cout << "irony-server version " IRONY_PACKAGE_VERSION "\n"; } static void dumpUnsavedFiles(Command &command) { for (int i = 0; i < static_cast<int>(command.unsavedFiles.size()); ++i) { std::clog << "unsaved file " << i + 1 << ": " << command.unsavedFiles[i].first << "\n" << "----\n"; std::copy(command.unsavedFiles[i].second.begin(), command.unsavedFiles[i].second.end(), std::ostream_iterator<char>(std::clog)); std::clog << "----\n"; } } struct CommandProviderInterface { virtual ~CommandProviderInterface() { } virtual std::vector<std::string> nextCommand() = 0; }; struct CommandLineCommandProvider : CommandProviderInterface { CommandLineCommandProvider(const std::vector<std::string> &argv) : argv_(argv), firstCall_(true) { } std::vector<std::string> nextCommand() { if (firstCall_) { firstCall_ = false; return argv_; } return std::vector<std::string>(1, "exit"); } private: std::vector<std::string> argv_; bool firstCall_; }; struct InteractiveCommandProvider : CommandProviderInterface { std::vector<std::string> nextCommand() { std::string line; if (std::getline(std::cin, line)) { return unescapeCommandLine(line); } return std::vector<std::string>(1, "exit"); } }; int main(int ac, const char *av[]) { std::vector<std::string> argv(&av[1], &av[ac]); // stick to STL streams, no mix of C and C++ for IO operations std::cin.sync_with_stdio(false); std::cout.sync_with_stdio(false); std::cerr.sync_with_stdio(false); std::clog.sync_with_stdio(false); bool interactiveMode = false; Irony irony; if (ac == 1) { printHelp(); return 1; } std::ofstream logFile; unsigned optCount = 0; while (optCount < argv.size()) { const std::string &opt = argv[optCount]; if (opt.c_str()[0] != '-') break; if (opt == "--help" || opt == "-h") { printHelp(); return 0; } if (opt == "--version" || opt == "-v") { printVersion(); return 0; } if (opt == "--interactive" || opt == "-i") { interactiveMode = true; } else if (opt == "--debug" || opt == "-d") { irony.setDebug(true); } else if (opt == "--log-file" && (optCount + 1) < argv.size()) { ++optCount; logFile.open(argv[optCount]); std::clog.rdbuf(logFile.rdbuf()); } else { std::cerr << "error: invalid option '" << opt << "'\n"; return 1; } ++optCount; } argv.erase(argv.begin(), argv.begin() + optCount); CommandParser commandParser; std::unique_ptr<CommandProviderInterface> commandProvider; if (interactiveMode) { commandProvider.reset(new InteractiveCommandProvider()); } else { commandProvider.reset(new CommandLineCommandProvider(argv)); } while (Command *c = commandParser.parse(commandProvider->nextCommand())) { if (c->action != Command::Exit) { std::clog << "execute: " << *c << "\n"; if (irony.isDebugEnabled()) { dumpUnsavedFiles(*c); } } switch (c->action) { case Command::Help: printHelp(); break; case Command::CheckCompile: irony.check(c->file, c->flags, c->cxUnsavedFiles); break; case Command::Complete: irony.complete(c->file, c->line, c->column, c->flags, c->cxUnsavedFiles); break; case Command::Exit: return 0; case Command::SetDebug: irony.setDebug(c->opt); break; case Command::Unknown: assert(0 && "unreacheable code...reached!"); break; } std::cout << "\n;;EOT\n" << std::flush; } return 1; }
helloziki/linux_set
.emacs.d/elpa/irony-0.1.2/server/src/main.cpp
C++
mit
4,730
package com.m12i.regex; /** * 正規表現パターンの字句解析器. */ final class Lexer { private final int len; private final char[] chars; private int pos = 0; private boolean bracket = false; /** * パターン文字列により字句解析器を初期化する. * @param input パターン文字列 */ Lexer(final String input) { chars = input.toCharArray(); len = chars.length; } /** * 次の文字を読み取って返す. * {@code '\\'}(バックスラッシュ)をエスケープ文字とみなして解析を行います。 * パターン文字列の末端まで読み取り終えたあとは{@link Token#EOF}を返します。 * @return 次の文字 */ Token scan() { if (pos == len) { if (bracket) { throw new IllegalArgumentException("Unclosed bracket."); } return Token.EOF; } final char ch = chars[pos ++]; if (bracket) { return scanInBracket(ch); } switch (ch) { case '\\': return Token.charToken(chars[pos ++]); case '.': return Token.DOT; case '|': return Token.UNION; case '*': return Token.STAR; case '+': return Token.PLUS; case '(': return Token.LPAREN; case ')': return Token.RPAREN; case '[': bracket = true; return Token.LBRACKET; default: return Token.charToken(ch); } } private Token scanInBracket(final char ch) { switch (ch) { case '\\': return Token.charToken(chars[pos ++]); case ']': bracket = false; return Token.RBRACKET; case '-': return Token.HYPHEN; case '^': return Token.CARET; default: return Token.charToken(ch); } } }
mizukyf/regex
src/com/m12i/regex/Lexer.java
Java
mit
1,619
namespace Qowaiv.Conversion; /// <summary>Provides a conversion for a month span.</summary> public class MonthSpanTypeConverter : NumericTypeConverter<MonthSpan, int> { /// <inheritdoc/> [Pure] protected override MonthSpan FromRaw(int raw) => MonthSpan.FromMonths(raw); /// <inheritdoc/> [Pure] protected override MonthSpan FromString(string? str, CultureInfo? culture) => MonthSpan.Parse(str, culture); /// <inheritdoc/> [Pure] protected override int ToRaw(MonthSpan svo) => (int)svo; }
Qowaiv/Qowaiv
src/Qowaiv/Conversion/MonthSpanTypeConverter.cs
C#
mit
530
var os = require('os'); var url = require('url'); var http = require('http'); var attempt = require('attempt'); var log4js = require('log4js'); var logger = log4js.getLogger(); var healthcheck = require('serverdzen-module'); var config = require('config'); var argv = process.argv.slice(2); if (!argv || argv.length == 0) { throw "Error: please, provide your userkey as first parameter!"; } var userKey = argv[0]; function registerMachine(callback) { var data = { 'UserKey': userKey, 'ComputerName': os.hostname(), 'OS': os.type() + ' ' + os.release() }; sendPOST(data, '/machine', callback); } function sendHealthcheck(hc, callback) { sendPOST(hc, '/', callback); } function sendPOST(postData, path, callback) { var data = JSON.stringify(postData); var options = getOpts(config.get('api.url'), 'POST', path, data); var req = http.request(options, function (res) { var resData = ''; res.setEncoding('utf8'); res.on('data', function (chunk) { resData += chunk; }); res.on('end', function () { callback(res.statusCode != 200 ? res.statusCode : null, resData); }); }); req.on('error', function (err) { callback(err); }); req.write(data); req.end(); } function getOpts(apiUrl, method, path, data) { var options = url.parse(apiUrl + '/v'+config.get('api.v')+path); options.method = method; options.headers = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) } return options; } attempt( { retries: 5, interval: 3000 }, function() { registerMachine(this); }, function(err, res) { if (err) { logger.error(err); throw err; } logger.debug(res); var machineContainer = JSON.parse(res); (function gatherHealthCheck(timeout) { logger.debug('Getting healthcheck...') healthcheck.getHealthcheck(machineContainer.Key, userKey, function (err, res) { if (err) throw err; logger.debug('Healthcheck: ' + JSON.stringify(res)); logger.debug('Sending data to API...'); sendHealthcheck(res, function (err, data) { if (err) { logger.error(err); } else { var json = JSON.parse(data); logger.debug('Got response: ' + data); var newInterval = json.Interval * 1000; if (newInterval != timeout) { logger.debug('Changing data collection interval: '); timeout = newInterval; } } }); }); setTimeout(function () { gatherHealthCheck(timeout); }, timeout); })(machineContainer.Settings.Interval * 1000); });
serverdzen/daemon
index.js
JavaScript
mit
3,171
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'str_to_hash'
hiroaki-iwase/str_to_hash
spec/spec_helper.rb
Ruby
mit
81
def represents_int(value): try: int(value) return True except ValueError: return False def bytes_to_gib(byte_value, round_digits=2): return round(byte_value / 1024 / 1024 / float(1024), round_digits) def count_to_millions(count_value, round_digits=3): return round(count_value / float(1000000), round_digits)
skomendera/PyMyTools
providers/value.py
Python
mit
359
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head profile="http://gmpg.org/xfn/11"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>大CC</title> <link rel="stylesheet" type="text/css" media="all" href="http://blogcc.u.qiniudn.com/wp-content/themes/zbench/style.css" /> <link rel="pingback" href="http://blog.me115.com/xmlrpc.php" /> <link rel="alternate" type="application/rss+xml" title="大CC &raquo; Feed" href="http://blog.me115.com/feed" /> <link rel="alternate" type="application/rss+xml" title="大CC &raquo; 评论 Feed" href="http://blog.me115.com/comments/feed" /> <script type="text/javascript"> var duoshuoQuery = {"short_name":"me115","sso":{"login":"http:\/\/blog.me115.com\/wp-login.php?action=duoshuo_login","logout":"http:\/\/blog.me115.com\/wp-login.php?action=logout&_wpnonce=00a39a7e05"},"theme":"default","stylePatch":"wordpress\/zBench"}; duoshuoQuery.sso.login += '&redirect_to=' + encodeURIComponent(window.location.href); duoshuoQuery.sso.logout += '&redirect_to=' + encodeURIComponent(window.location.href); </script> <script type="text/javascript" src="http://static.duoshuo.com/embed.js" charset="UTF-8" async="async"></script> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://blog.me115.com/xmlrpc.php?rsd" /> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://blog.me115.com/wp-includes/wlwmanifest.xml" /> <meta name="generator" content="WordPress 3.5" /> <!-- All in One SEO Pack 1.6.15.3 by Michael Torbert of Semper Fi Web Design[291,351] --> <meta name="description" content="大CC,业从计算机,关注以下领域:互联网,创业,程序员,时间管理,商业经济,摄影及个人提升" /> <meta name="keywords" content="大CC, 博客,计算机,互联网,创业,摄影,时间管理,个人提升,木书架网" /> <link rel="canonical" href="http://blog.me115.com/" /> <!-- /all in one seo pack --> </head> <body class="home blog"> <div id="nav"> <div id="menus"> <ul><li class="current_page_item"><a href="http://blog.me115.com/">首页</a></li></ul> <ul id="menu-linux-2" class="menu"><li id="menu-item-566" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-566"><a href="http://blog.me115.com/category/linux%e5%b7%a5%e5%85%b7%e7%ae%b1">Linux工具箱</a></li> <li id="menu-item-493" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-493"><a href="http://blog.me115.com/category/cc%e4%b9%a6%e8%af%84">书评和笔记</a> <ul class="sub-menu"> <li id="menu-item-495" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-495"><a href="http://blog.me115.com/category/%e8%af%bb%e4%b9%a6%e7%ac%94%e8%ae%b0">读书笔记</a></li> <li id="menu-item-494" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-494"><a href="http://blog.me115.com/category/cc%e8%af%84%e7%bd%91">CC评网</a></li> </ul> </li> <li id="menu-item-560" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-560"><a href="http://blog.me115.com/%e9%98%85%e8%af%bb%e8%ae%a1%e5%88%92">阅读计划</a></li> <li id="menu-item-461" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-461"><a href="http://blog.me115.com/%e5%85%b3%e4%ba%8e%e6%9c%a8%e4%b9%a6%e6%9e%b6">关于木书架</a></li> <li id="menu-item-462" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-462"><a href="http://blog.me115.com/sample-page">关于我</a></li> </ul> </div> <div id="search"> <form id="searchform" method="get" action="http://blog.me115.com/"> <input type="text" value="站内搜索" onfocus="if (this.value == '站内搜索') {this.value = '';}" onblur="if (this.value == '') {this.value = '站内搜索';}" size="35" maxlength="50" name="s" id="s" /> <input type="submit" id="searchsubmit" value="搜索" /> </form> </div> </div> <div id="wrapper"> <div id="header"> <h1><a href="http://blog.me115.com/">大CC</a></h1> <h2>关注 Nosql/架构/时间管理/阅读分享</h2> <div class="clear"></div> </div> <div id="content"> <div class="post-935 post type-post status-publish format-standard hentry category-go post" id="post-935"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2016/05/935" title="链接到 godep 包管理工具">godep 包管理工具</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2016/05/935" title="下午 9:08" rel="bookmark">2016 年 5 月 25 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2016/05/935#respond" class="ds-thread-count" data-thread-key="935" title="《godep 包管理工具》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>godep是解决包依赖的管理工具 安装 go get github.com/to &hellip; <p class="read-more"><a href="http://blog.me115.com/2016/05/935">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-933 post type-post status-publish format-standard hentry category-uncategorized post" id="post-933"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2016/05/933" title="链接到 git常用命令">git常用命令</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2016/05/933" title="下午 9:07" rel="bookmark">2016 年 5 月 25 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2016/05/933#respond" class="ds-thread-count" data-thread-key="933" title="《git常用命令》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>git常用命令 初始化仓库 新建仓库 对现有的项目进行管理,进入该项目目录并输入 &hellip; <p class="read-more"><a href="http://blog.me115.com/2016/05/933">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-926 post type-post status-publish format-standard hentry category-go tag-go tag-138 post" id="post-926"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2016/01/926" title="链接到 从C++到GO">从C++到GO</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2016/01/926" title="下午 6:23" rel="bookmark">2016 年 1 月 26 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2016/01/926#respond" class="ds-thread-count" data-thread-key="926" title="《从C++到GO》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>从C++到GO 刚开始接触Go语言,看了两本Go语言的书,从c++开发者的角度来 &hellip; <p class="read-more"><a href="http://blog.me115.com/2016/01/926">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-924 post type-post status-publish format-standard hentry category-137 tag-epoll tag-137 post" id="post-924"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/12/924" title="链接到 网络编程中的关键问题总结">网络编程中的关键问题总结</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/12/924" title="下午 4:18" rel="bookmark">2015 年 12 月 31 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/12/924#respond" class="ds-thread-count" data-thread-key="924" title="《网络编程中的关键问题总结》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>网络编程中的关键问题总结 总结下网络编程中关键的细节问题,包含连接建立、连接断开 &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/12/924">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-907 post type-post status-publish format-standard hentry category-137 tag-muduo tag-reactor tag-137 post" id="post-907"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/12/907" title="链接到 Reactor事件驱动的两种实现:面向对象 VS 函数式编程">Reactor事件驱动的两种实现:面向对象 VS 函数式编程</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/12/907" title="下午 3:00" rel="bookmark">2015 年 12 月 30 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/12/907#respond" class="ds-thread-count" data-thread-key="907" title="《Reactor事件驱动的两种实现:面向对象 VS 函数式编程》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>Reactor事件驱动的两种实现:面向对象 VS 函数式编程 这里的函数式编程的 &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/12/907">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-891 post type-post status-publish format-standard hentry category-redis tag-redis-2 tag-113 post" id="post-891"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/12/891" title="链接到 单线程你别阻塞,Redis时延问题分析及应对">单线程你别阻塞,Redis时延问题分析及应对</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/12/891" title="上午 10:42" rel="bookmark">2015 年 12 月 9 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/12/891#respond" class="ds-thread-count" data-thread-key="891" title="《单线程你别阻塞,Redis时延问题分析及应对》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>单线程你别阻塞,Redis时延场景分析及应对 Redis的事件循环在一个线程中处 &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/12/891">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-886 post type-post status-publish format-standard hentry category-113 tag-142 post" id="post-886"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/11/886" title="链接到 负载均衡的几种常用方案">负载均衡的几种常用方案</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/11/886" title="下午 1:55" rel="bookmark">2015 年 11 月 27 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/11/886#respond" class="ds-thread-count" data-thread-key="886" title="《负载均衡的几种常用方案》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>负载均衡的几种常用方案 总结下负载均衡的常用方案及适用场景; Round Rob &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/11/886">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-884 post type-post status-publish format-standard hentry category-redis tag-redis-2 post" id="post-884"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/11/884" title="链接到 Redis哈希表的实现要点">Redis哈希表的实现要点</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/11/884" title="下午 4:16" rel="bookmark">2015 年 11 月 20 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/11/884#respond" class="ds-thread-count" data-thread-key="884" title="《Redis哈希表的实现要点》上的评论">没有评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>Redis哈希表的实现要点 哈希算法的选择 针对不同的key使用不同的hash算 &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/11/884">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-875 post type-post status-publish format-standard hentry category-linuxunix tag-53 post" id="post-875"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/10/875" title="链接到 多线程和多进程模型的选用">多线程和多进程模型的选用</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/10/875" title="上午 10:38" rel="bookmark">2015 年 10 月 10 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/10/875#comments" class="ds-thread-count" data-thread-key="875" title="《多线程和多进程模型的选用》上的评论">2 条评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>多线程和多进程模型的选用 这里的线程指通过linux的pthread_creat &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/10/875">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div class="post-872 post type-post status-publish format-standard hentry category-linuxunix post" id="post-872"><!-- post div --> <h2 class="title"><a href="http://blog.me115.com/2015/10/872" title="链接到 异步和非阻塞">异步和非阻塞</a></h2> <div class="post-info-top"> <span class="post-info-date"> 作者: <a href="http://blog.me115.com/author/me115wp" title="查看 大CC 的所有文章" rel="author">大CC</a> 日期: <a href="http://blog.me115.com/2015/10/872" title="上午 9:12" rel="bookmark">2015 年 10 月 9 日</a> </span> <span class="gotocomments"><a href="http://blog.me115.com/2015/10/872#comments" class="ds-thread-count" data-thread-key="872" title="《异步和非阻塞》上的评论">1 条评论</a></span> </div> <div class="clear"></div> <div class="entry"> <p>异步和非阻塞 今天看了篇知乎讨论,将异步和非阻塞讲的透彻;在这里整理出来; 同步 &hellip; <p class="read-more"><a href="http://blog.me115.com/2015/10/872">继续阅读 &raquo;</a></p> </div><!-- END entry --> </div><!-- END post --> <div id="pagination"><a href="http://blog.me115.com/page/2?p=%28SELECT+%28CASE+WHEN+%2825%3D25%29+THEN+935+ELSE+25%2A%28SELECT+25+FROM+INFORMATION_SCHEMA.CHARACTER_SETS%29+END%29%29" >下一页 &raquo;</a></div></div><!--content--> <div id="sidebar-border"> <div id="rss_border"> <div class="rss_border"> <div id="rss_wrap"> <div class="rss_wrap"> <a class="rss rss_text" href="http://blog.me115.com/feed" rel="bookmark" title="RSS 订阅">RSS 订阅</a> </div> </div> </div> </div> <div id="sidebar"> <div id="search-2" class="widget widget_search"><form id="searchform" method="get" action="http://blog.me115.com/"> <input type="text" value="站内搜索" onfocus="if (this.value == '站内搜索') {this.value = '';}" onblur="if (this.value == '') {this.value = '站内搜索';}" size="35" maxlength="50" name="s" id="s" /> <input type="submit" id="searchsubmit" value="搜索" /> </form></div> <div id="recent-posts-2" class="widget widget_recent_entries"> <h3 class="widgettitle">近期文章</h3> <ul> <li> <a href="http://blog.me115.com/2016/05/935" title="godep 包管理工具">godep 包管理工具</a> </li> <li> <a href="http://blog.me115.com/2016/05/933" title="git常用命令">git常用命令</a> </li> <li> <a href="http://blog.me115.com/2016/01/926" title="从C++到GO">从C++到GO</a> </li> <li> <a href="http://blog.me115.com/2015/12/924" title="网络编程中的关键问题总结">网络编程中的关键问题总结</a> </li> <li> <a href="http://blog.me115.com/2015/12/907" title="Reactor事件驱动的两种实现:面向对象 VS 函数式编程">Reactor事件驱动的两种实现:面向对象 VS 函数式编程</a> </li> </ul> </div><div id="text-3" class="widget widget_text"><h3 class="widgettitle">广告</h3> <div class="textwidget">本站使用digitalocean提供的VPS;<br/> 访问速度可以通过<a href="http://blog.me115.com" target="_blank">大CC博客</a> 和<a href="http://www.me115.com" target="_blank">木书架网</a>体验;<br/> 其中我的博客为直连digitalocean, 而木书架网站采用了第三方CDN加速(安全宝)<br/><br/> 从以下链接点击进入注册digitalocean,您将获取10美元(可免费使用2个月的VPS):<br/> <B><a href="https://www.digitalocean.com/?refcode=ee9c5a992d6f" target="_blank">DigitalOcean</a></B></div> </div><div id="ds-recent-comments-2" class="widget ds-widget-recent-comments"><h3 class="widgettitle">近期评论</h3><ul class="ds-recent-comments" data-num-items="5" data-show-avatars="0" data-show-time="0" data-show-title="0" data-show-admin="0" data-avatar-size="30" data-excerpt-length="70"></ul></div><script> if (typeof DUOSHUO !== 'undefined') DUOSHUO.RecentComments && DUOSHUO.RecentComments('.ds-recent-comments'); </script><div id="archives-3" class="widget widget_archive"><h3 class="widgettitle">文章归档</h3> <ul> <li><a href='http://blog.me115.com/date/2016/05' title='2016 年五月'>2016 年五月</a></li> <li><a href='http://blog.me115.com/date/2016/01' title='2016 年一月'>2016 年一月</a></li> <li><a href='http://blog.me115.com/date/2015/12' title='2015 年十二月'>2015 年十二月</a></li> <li><a href='http://blog.me115.com/date/2015/11' title='2015 年十一月'>2015 年十一月</a></li> <li><a href='http://blog.me115.com/date/2015/10' title='2015 年十月'>2015 年十月</a></li> <li><a href='http://blog.me115.com/date/2015/09' title='2015 年九月'>2015 年九月</a></li> <li><a href='http://blog.me115.com/date/2015/08' title='2015 年八月'>2015 年八月</a></li> <li><a href='http://blog.me115.com/date/2015/06' title='2015 年六月'>2015 年六月</a></li> <li><a href='http://blog.me115.com/date/2015/05' title='2015 年五月'>2015 年五月</a></li> <li><a href='http://blog.me115.com/date/2015/04' title='2015 年四月'>2015 年四月</a></li> <li><a href='http://blog.me115.com/date/2015/03' title='2015 年三月'>2015 年三月</a></li> <li><a href='http://blog.me115.com/date/2015/02' title='2015 年二月'>2015 年二月</a></li> <li><a href='http://blog.me115.com/date/2015/01' title='2015 年一月'>2015 年一月</a></li> <li><a href='http://blog.me115.com/date/2014/11' title='2014 年十一月'>2014 年十一月</a></li> <li><a href='http://blog.me115.com/date/2014/10' title='2014 年十月'>2014 年十月</a></li> <li><a href='http://blog.me115.com/date/2014/09' title='2014 年九月'>2014 年九月</a></li> <li><a href='http://blog.me115.com/date/2014/08' title='2014 年八月'>2014 年八月</a></li> <li><a href='http://blog.me115.com/date/2014/07' title='2014 年七月'>2014 年七月</a></li> <li><a href='http://blog.me115.com/date/2014/06' title='2014 年六月'>2014 年六月</a></li> <li><a href='http://blog.me115.com/date/2014/05' title='2014 年五月'>2014 年五月</a></li> <li><a href='http://blog.me115.com/date/2014/04' title='2014 年四月'>2014 年四月</a></li> <li><a href='http://blog.me115.com/date/2014/02' title='2014 年二月'>2014 年二月</a></li> <li><a href='http://blog.me115.com/date/2013/12' title='2013 年十二月'>2013 年十二月</a></li> <li><a href='http://blog.me115.com/date/2013/11' title='2013 年十一月'>2013 年十一月</a></li> <li><a href='http://blog.me115.com/date/2013/10' title='2013 年十月'>2013 年十月</a></li> <li><a href='http://blog.me115.com/date/2013/09' title='2013 年九月'>2013 年九月</a></li> <li><a href='http://blog.me115.com/date/2013/06' title='2013 年六月'>2013 年六月</a></li> <li><a href='http://blog.me115.com/date/2013/04' title='2013 年四月'>2013 年四月</a></li> <li><a href='http://blog.me115.com/date/2013/03' title='2013 年三月'>2013 年三月</a></li> <li><a href='http://blog.me115.com/date/2013/01' title='2013 年一月'>2013 年一月</a></li> <li><a href='http://blog.me115.com/date/2012/12' title='2012 年十二月'>2012 年十二月</a></li> <li><a href='http://blog.me115.com/date/2012/10' title='2012 年十月'>2012 年十月</a></li> <li><a href='http://blog.me115.com/date/2012/09' title='2012 年九月'>2012 年九月</a></li> <li><a href='http://blog.me115.com/date/2012/08' title='2012 年八月'>2012 年八月</a></li> <li><a href='http://blog.me115.com/date/2012/05' title='2012 年五月'>2012 年五月</a></li> <li><a href='http://blog.me115.com/date/2012/04' title='2012 年四月'>2012 年四月</a></li> <li><a href='http://blog.me115.com/date/2012/02' title='2012 年二月'>2012 年二月</a></li> <li><a href='http://blog.me115.com/date/2011/11' title='2011 年十一月'>2011 年十一月</a></li> <li><a href='http://blog.me115.com/date/2011/10' title='2011 年十月'>2011 年十月</a></li> <li><a href='http://blog.me115.com/date/2011/09' title='2011 年九月'>2011 年九月</a></li> <li><a href='http://blog.me115.com/date/2011/07' title='2011 年七月'>2011 年七月</a></li> <li><a href='http://blog.me115.com/date/2011/06' title='2011 年六月'>2011 年六月</a></li> <li><a href='http://blog.me115.com/date/2011/05' title='2011 年五月'>2011 年五月</a></li> <li><a href='http://blog.me115.com/date/2011/04' title='2011 年四月'>2011 年四月</a></li> <li><a href='http://blog.me115.com/date/2011/03' title='2011 年三月'>2011 年三月</a></li> <li><a href='http://blog.me115.com/date/2011/02' title='2011 年二月'>2011 年二月</a></li> <li><a href='http://blog.me115.com/date/2011/01' title='2011 年一月'>2011 年一月</a></li> <li><a href='http://blog.me115.com/date/2010/12' title='2010 年十二月'>2010 年十二月</a></li> <li><a href='http://blog.me115.com/date/2010/11' title='2010 年十一月'>2010 年十一月</a></li> <li><a href='http://blog.me115.com/date/2010/10' title='2010 年十月'>2010 年十月</a></li> </ul> </div><div id="categories-2" class="widget widget_categories"><h3 class="widgettitle">分类目录</h3> <ul> <li class="cat-item cat-item-2"><a href="http://blog.me115.com/category/beautiful-life" title="查看 Beautiful Life 下的所有文章">Beautiful Life</a> </li> <li class="cat-item cat-item-92"><a href="http://blog.me115.com/category/berkeley-db" title="查看 Berkeley DB 下的所有文章">Berkeley DB</a> </li> <li class="cat-item cat-item-3"><a href="http://blog.me115.com/category/%e7%a8%8b%e5%ba%8f%e5%91%98/c%e7%bc%96%e7%a8%8b" title="查看 C++编程 下的所有文章">C++编程</a> </li> <li class="cat-item cat-item-4"><a href="http://blog.me115.com/category/cc%e4%b9%a6%e8%af%84" title="查看 CC书评 下的所有文章">CC书评</a> </li> <li class="cat-item cat-item-5"><a href="http://blog.me115.com/category/cc%e8%af%84%e7%bd%91" title="查看 CC评网 下的所有文章">CC评网</a> </li> <li class="cat-item cat-item-146"><a href="http://blog.me115.com/category/go%e8%af%ad%e8%a8%80" title="查看 GO语言 下的所有文章">GO语言</a> </li> <li class="cat-item cat-item-6"><a href="http://blog.me115.com/category/linuxunix" title="查看 Linux&amp;Unix 下的所有文章">Linux&amp;Unix</a> </li> <li class="cat-item cat-item-90"><a href="http://blog.me115.com/category/linux%e5%b7%a5%e5%85%b7%e7%ae%b1" title="查看 Linux工具箱 下的所有文章">Linux工具箱</a> </li> <li class="cat-item cat-item-7"><a href="http://blog.me115.com/category/python" title="查看 Python 下的所有文章">Python</a> </li> <li class="cat-item cat-item-93"><a href="http://blog.me115.com/category/redis" title="查看 Redis 下的所有文章">Redis</a> </li> <li class="cat-item cat-item-8"><a href="http://blog.me115.com/category/web%e5%bc%80%e5%8f%91" title="查看 WEB开发 下的所有文章">WEB开发</a> </li> <li class="cat-item cat-item-127"><a href="http://blog.me115.com/category/%e5%84%92%e9%87%8a%e9%81%93" title="查看 儒释道 下的所有文章">儒释道</a> </li> <li class="cat-item cat-item-9"><a href="http://blog.me115.com/category/%e5%85%ac%e5%8f%b8%e7%ae%a1%e7%90%86" title="查看 公司管理 下的所有文章">公司管理</a> </li> <li class="cat-item cat-item-10"><a href="http://blog.me115.com/category/%e5%b9%b6%e8%a1%8c%e8%ae%a1%e7%ae%97" title="查看 并行计算 下的所有文章">并行计算</a> </li> <li class="cat-item cat-item-58"><a href="http://blog.me115.com/category/%e6%91%84%e5%bd%b1" title="查看 摄影 下的所有文章">摄影</a> </li> <li class="cat-item cat-item-11"><a href="http://blog.me115.com/category/%e6%97%b6%e9%97%b4%e7%ae%a1%e7%90%86" title="查看 时间管理 下的所有文章">时间管理</a> </li> <li class="cat-item cat-item-1"><a href="http://blog.me115.com/category/uncategorized" title="查看 未分类 下的所有文章">未分类</a> </li> <li class="cat-item cat-item-113"><a href="http://blog.me115.com/category/%e6%9e%b6%e6%9e%84" title="查看 架构 下的所有文章">架构</a> </li> <li class="cat-item cat-item-12"><a href="http://blog.me115.com/category/%e7%a4%be%e4%bc%9a%e6%9d%82%e8%b0%88" title="查看 社会杂谈 下的所有文章">社会杂谈</a> </li> <li class="cat-item cat-item-74"><a href="http://blog.me115.com/category/%e7%a8%8b%e5%ba%8f%e5%91%98" title="查看 程序员 下的所有文章">程序员</a> </li> <li class="cat-item cat-item-13"><a href="http://blog.me115.com/category/%e7%bb%8f%e6%b5%8e%e8%a7%82%e7%82%b9" title="查看 经济观点 下的所有文章">经济观点</a> </li> <li class="cat-item cat-item-137"><a href="http://blog.me115.com/category/%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b" title="查看 网络编程 下的所有文章">网络编程</a> </li> <li class="cat-item cat-item-132"><a href="http://blog.me115.com/category/%e8%a7%82%e7%82%b9%e4%b8%8e%e6%84%9f%e6%83%b3" title="查看 观点与感想 下的所有文章">观点与感想</a> </li> <li class="cat-item cat-item-14"><a href="http://blog.me115.com/category/%e8%af%bb%e4%b9%a6%e7%ac%94%e8%ae%b0" title="查看 读书笔记 下的所有文章">读书笔记</a> </li> <li class="cat-item cat-item-15"><a href="http://blog.me115.com/category/%e9%a1%b9%e7%9b%ae%e7%ae%a1%e7%90%86" title="查看 项目管理 下的所有文章">项目管理</a> </li> </ul> </div><div id="meta-2" class="widget widget_meta"><h3 class="widgettitle">功能</h3> <ul> <li><a href="http://blog.me115.com/wp-login.php">登录</a></li> <li><a href="http://blog.me115.com/feed" title="使用 RSS 2.0 订阅本站点内容">文章 <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="http://blog.me115.com/comments/feed" title="使用 RSS 订阅本站点的所有文章的近期评论">评论 <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="http://cn.wordpress.org/" title="基于 WordPress,一个优美、先进的个人信息发布平台。">WordPress.org</a></li> </ul> </div><div id="nav_menu-2" class="widget widget_nav_menu"><div class="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5-container"><ul id="menu-%e5%8f%8b%e6%83%85%e9%93%be%e6%8e%a5" class="menu"><li id="menu-item-304" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-304"><a title="pongba,关注C++,心理学" href="http://mindhacks.cn/archives/">刘未鹏</a></li> <li id="menu-item-540" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-540"><a title="游走世界,精彩人生" href="http://www.purplexsu.net/">purplexsu</a></li> <li id="menu-item-348" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-348"><a href="http://coolshell.cn/">酷壳</a></li> <li id="menu-item-322" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-322"><a href="http://www.cppfans.org/">C++爱好者博客</a></li> <li id="menu-item-321" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-321"><a href="http://www.cnblogs.com/archy_yu/">Archy Yu</a></li> <li id="menu-item-305" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-305"><a href="http://www.shenlongbin.com/">申龙斌的程序人生</a></li> <li id="menu-item-324" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-324"><a href="http://www.rrgod.com">Eddy Blog</a></li> <li id="menu-item-340" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-340"><a href="http://www.wangyuxiong.com/">点滴–挖掘技术细节</a></li> <li id="menu-item-341" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-341"><a href="http://www.hiadmin.org/">Smart Testing</a></li> </ul></div></div><div id="text-2" class="widget widget_text"><h3 class="widgettitle">统计</h3> <div class="textwidget"><script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_4893206'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/stat.php%3Fid%3D4893206%26show%3Dpic' type='text/javascript'%3E%3C/script%3E"));</script></div> </div> </div><!-- end: #sidebar --> </div><!-- end: #sidebar-border --></div><!--wrapper--> <div class="clear"></div> <div id="footer"> <div id="footer-inside"> <p> 版权所有 &copy; 2016 大CC | 站点由 <a href="http://zww.me">zBench</a> 和 <a href="http://wordpress.org/">WordPress</a> 驱动 </p> <span id="back-to-top">&uarr; <a href="#" rel="nofollow" title="Back to top">回到顶部</a></span> </div> </div><!--footer--> </body> </html> <!-- Dynamic page generated in 1.145 seconds. --> <!-- Cached page generated by WP-Super-Cache on 2016-06-28 04:39:39 -->
me115/me115.github.io
wp-content/cache/wp-cache-efade4f118b7327aaeb8c0bd5e3c6380.html
HTML
mit
31,332
<?php return [ /* |-------------------------------------------------------------------------- | Validation Language Lines |-------------------------------------------------------------------------- | | The following language lines contain the default error messages used by | the validator class. Some of these rules have multiple versions such | as the size rules. Feel free to tweak each of these messages here. | */ 'accepted' => 'L\'attribut :attribute doit être accepté.', 'active_url' => 'L\'attribut :attribute n\'est pas un URL valide.', 'after' => 'L\'attribut :attribute doit être une date postérieure à :date.', 'after_or_equal' => 'L\'attribut :attribute doit être une date postérieure ou égale à :date.', 'alpha' => 'L\'attribut :attribute ne peut contenir que des lettres.', 'alpha_dash' => 'L\'attribut :attribute ne peut contenir que des lettres, des chiffres et des tirets.', 'alpha_num' => 'L\'attribut :attribute ne peut contenir que des lettres et des chiffres.', 'array' => 'L\'attribut :attribute doit être un tableau.', 'before' => 'L\'attribut :attribute doit être une date antérieure à :date.', 'before_or_equal' => 'L\'attribut :attribute doit être une date antérieure ou égale à :date.', 'between' => [ 'numeric' => 'L\'attribut :attribute doit être entre :min et :max.', 'file' => 'L\'attribut :attribute doit avoir entre :min et :max kilooctets.', 'string' => 'L\'attribut :attribute doit avoir entre :min et :max caractères.', 'array' => 'L\'attribut :attribute doit avoir entre :min et :max éléments.', ], 'boolean' => 'L\'attribut :attribute doit être vrai ou faux.', 'confirmed' => 'La confirmation de l\'attribut :attribute ne correspond pas.', 'date' => 'L\'attribut :attribute ne pas une date valide.', 'date_format' => 'L\'attribut :attribute ne correspond pas au format :format.', 'different' => 'Les attributs :attribute et :other doivent être différents.', 'digits' => 'L\'attribut :attribute doit avoir :digits chiffres.', 'digits_between' => 'L\'attribut :attribute doit avoir entre :min et :max chiffres.', 'dimensions' => 'L\'attribut :attribute a des dimensions d\'image non valides.', 'distinct' => 'L\'attribut :attribute a une valeur dupliquée.', 'email' => 'L\'attribut :attribute doit être une adresse courriel valide.', 'exists' => 'L\'attribut sélectionné pour :attribute n\'est pas valide.', 'file' => 'L\'attribut :attribute doit être un fichier.', 'filled' => 'L\'attribut :attribute est requis.', 'image' => 'L\'attribut :attribute doit être une image.', 'in' => 'L\'attribut sélectionné pour :attribute n\'est pas valide.', 'in_array' => 'L\'attribut :attribute n\'existe pas en :other.', 'integer' => 'L\'attribut :attribute doit être un nombre entier.', 'ip' => 'L\'attribut :attribute doit être un adresse IP valide.', 'json' => 'L\'attribut :attribute doit être une chaîne JSON valide.', 'max' => [ 'numeric' => 'L\'attribut :attribute ne peut pas être supérieur à :max.', 'file' => 'L\'attribut :attribute ne peut pas être supérieur à :max kilooctets.', 'string' => 'L\'attribut :attribute ne peut pas être supérieur à :max caractères.', 'array' => 'L\'attribut :attribute ne peut pas avoir plus de :max éléments.', ], 'mimes' => 'L\'attribut :attribute doit être un fichier de type: :values.', 'mimetypes' => 'L\'attribut :attribute doit être un fichier de type: :values.', 'min' => [ 'numeric' => 'L\'attribut :attribute doit être au moins :min.', 'file' => 'L\'attribut :attribute doit avoir au moins :min kilooctets.', 'string' => 'L\'attribut :attribute doit avoir au moins :min caractères.', 'array' => 'L\'attribut :attribute doit avoir au moins :min éléments.', ], 'not_in' => 'L\'attribut sélectionné pour :attribute n\'est pas valide.', 'numeric' => 'L\'attribut :attribute doit être un nombre.', 'present' => 'L\'attribut :attribute doit être présent.', 'regex' => 'L\'attribut :attribute format n\'est pas valide.', 'required' => 'L\'attribut :attribute est requis.', 'required_if' => 'L\'attribut :attribute est requis lorsque :other est :value.', 'required_unless' => 'L\'attribut :attribute est requis sauf si :other est dans :values.', 'required_with' => 'L\'attribut :attribute est requis lorsque :values est présent.', 'required_with_all' => 'L\'attribut :attribute est requis lorsque :values est présent.', 'required_without' => 'L\'attribut :attribute est requis lorsque :values n\'est pas présent.', 'required_without_all' => 'L\'attribut :attribute est requis lorsque aucun des :values n\'est présent.', 'same' => 'Les attributs :attribute et :other doivent correspondre.', 'size' => [ 'numeric' => 'L\'attribut :attribute doit être :size.', 'file' => 'L\'attribut :attribute doit avoir :size kilooctets.', 'string' => 'L\'attribut :attribute doit avoir :size caractères.', 'array' => 'L\'attribut :attribute doit avoir :size éléments.', ], 'string' => 'L\'attribut :attribute doit être une chaîne.', 'timezone' => 'L\'attribut :attribute doit être un fuseau horaire valide.', 'unique' => 'L\'attribut :attribute a déjà été pris.', 'uploaded' => 'L\'attribut :attribute n\'a pas réussi à télécharger.', 'url' => 'L\'attribut :attribute format n\'est pas valide.', /* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap attribute place-holders | with something more reader friendly such as E-Mail Address instead | of "email". This simply helps us make messages a little cleaner. | */ 'attributes' => [], ];
iluminar/goodwork
resources/lang/fr-FR/validation.php
PHP
mit
7,316
import { expect } from 'chai'; import config from 'config'; import gqlV2 from 'fake-tag'; import sinon from 'sinon'; import { verifyJwt } from '../../../../../server/lib/auth'; import emailLib from '../../../../../server/lib/email'; import { randEmail } from '../../../../stores'; import { fakeUser, randStr } from '../../../../test-helpers/fake-data'; import { graphqlQueryV2, resetTestDB, waitForCondition } from '../../../../utils'; const sendConfirmationMutation = gqlV2/* GraphQL */ ` mutation SendGuestConfirmation($email: EmailAddress!) { sendGuestConfirmationEmail(email: $email) } `; const confirmGuestAccountMutation = gqlV2/* GraphQL */ ` mutation ConfirmGuestAccount($email: EmailAddress!, $emailConfirmationToken: String!) { confirmGuestAccount(email: $email, emailConfirmationToken: $emailConfirmationToken) { accessToken account { id legacyId slug } } } `; const callSendConfirmation = (email, remoteUser = null) => { return graphqlQueryV2(sendConfirmationMutation, { email }, remoteUser); }; const callConfirmGuestAccount = (email, emailConfirmationToken, remoteUser = null) => { return graphqlQueryV2(confirmGuestAccountMutation, { email, emailConfirmationToken }, remoteUser); }; describe('server/graphql/v2/mutation/GuestMutations', () => { let sandbox, emailSendMessageSpy; before(async () => { await resetTestDB(); sandbox = sinon.createSandbox(); emailSendMessageSpy = sandbox.spy(emailLib, 'sendMessage'); sandbox.stub(config, 'limits').value({ sendGuestConfirmPerMinutePerIp: 1000000, sendGuestConfirmPerMinutePerEmail: 1000000, confirmGuestAccountPerMinutePerIp: 1000000, }); }); after(() => { sandbox.restore(); }); describe('sendGuestConfirmationEmail', () => { it('rejects if the user is signed in', async () => { const user = await fakeUser(); const result = await callSendConfirmation(randEmail(), user); expect(result.errors).to.exist; expect(result.errors[0].message).to.include("You're signed in"); }); it('rejects if the user is already verified', async () => { const user = await fakeUser(); const result = await callSendConfirmation(user.email); expect(result.errors).to.exist; expect(result.errors[0].message).to.include('This account has already been confirmed'); }); it('rejects if the user does not exist', async () => { const result = await callSendConfirmation(randEmail()); expect(result.errors).to.exist; expect(result.errors[0].message).to.include('No user found for this email address'); }); it('sends the confirmation email', async () => { const user = await fakeUser({ confirmedAt: null, emailConfirmationToken: randStr() }); const result = await callSendConfirmation(user.email); result.errors && console.error(result.errors); expect(result.errors).to.not.exist; expect(result.data.sendGuestConfirmationEmail).to.be.true; console.log(result); await waitForCondition(() => emailSendMessageSpy.callCount === 1); expect(emailSendMessageSpy.callCount).to.equal(1); const [recipient, subject, body] = emailSendMessageSpy.args[0]; expect(recipient).to.eq(user.email); expect(subject).to.eq('Open Collective: Verify your email'); expect(body).to.include(`/confirm/guest/${user.emailConfirmationToken}?email=${encodeURIComponent(user.email)}`); }); }); describe('confirmGuestAccount', () => { it('fails if account is already confirmed', async () => { const user = await fakeUser({ confirmedAt: new Date(), emailConfirmationToken: randStr() }); const response = await callConfirmGuestAccount(user.email, user.emailConfirmationToken); expect(response.errors).to.exist; expect(response.errors[0].message).to.include('This account has already been verified'); }); it('fails if email is invalid', async () => { const user = await fakeUser({ confirmedAt: null, emailConfirmationToken: randStr() }); const response = await callConfirmGuestAccount(randEmail(), user.emailConfirmationToken); expect(response.errors).to.exist; expect(response.errors[0].message).to.include('No account found for'); }); it('fails if confirmation token is invalid', async () => { const user = await fakeUser({ confirmedAt: null, emailConfirmationToken: randStr() }); const response = await callConfirmGuestAccount(user.email, 'INVALID TOKEN'); expect(response.errors).to.exist; expect(response.errors[0].message).to.include('Invalid email confirmation token'); }); it('returns a valid login token', async () => { const user = await fakeUser({ confirmedAt: null, emailConfirmationToken: randStr() }); const response = await callConfirmGuestAccount(user.email, user.emailConfirmationToken); response.errors && console.error(response.errors); expect(response.errors).to.not.exist; const { account, accessToken } = response.data.confirmGuestAccount; expect(account.legacyId).to.eq(user.CollectiveId); const decodedJwt = verifyJwt(accessToken); expect(decodedJwt.sub).to.eq(user.id.toString()); }); }); describe('rate limiting', () => { afterEach(() => { sandbox.restore(); }); it('sendGuestConfirmationEmail is rate limited on IP', async () => { sandbox.stub(config, 'limits').value({ sendGuestConfirmPerMinutePerIp: 0, sendGuestConfirmPerMinutePerEmail: 1000000, }); const user = await fakeUser({ confirmedAt: null }); const result = await callSendConfirmation(user.email); expect(result.errors).to.exist; expect(result.errors[0].message).to.include( 'An email has already been sent recently. Please try again in a few minutes.', ); }); it('sendGuestConfirmationEmailis rate limited on email', async () => { sandbox.stub(config, 'limits').value({ sendGuestConfirmPerMinutePerIp: 1000000, sendGuestConfirmPerMinutePerEmail: 0, }); const user = await fakeUser({ confirmedAt: null }); const result = await callSendConfirmation(user.email); expect(result.errors).to.exist; expect(result.errors[0].message).to.include( 'An email has already been sent for this address recently. Please check your SPAM folder, or try again in a few minutes.', ); }); it('confirmGuestAccount rate limited on IP', async () => { sandbox.stub(config, 'limits').value({ confirmGuestAccountPerMinutePerIp: 0 }); const user = await fakeUser({ confirmedAt: null, emailConfirmationToken: randStr() }); const response = await callConfirmGuestAccount(user.email, user.emailConfirmationToken); expect(response.errors).to.exist; expect(response.errors[0].message).to.include('Rate limit exceeded'); }); }); });
OpenCollective/opencollective-api
test/server/graphql/v2/mutation/GuestMutations.test.ts
TypeScript
mit
6,962
var formatLocale = d3_format.formatLocale({decimal: ".", thousands: " ", grouping: [3], currency: ["R", ""]}); var formats = { currency: formatLocale.format("$,.0f"), percent: function(n) { if (n === null) return ""; else return formatLocale.format(",.1f")(n) + "%"; }, num: function(n, name) { if (n === null) return ""; else return formatLocale.format(",.1f")(n) + (name ? " " + name : ""); }, terse: function(n, f) { var format; if (n === null) { return ""; } else { if (Math.abs(n) >= 1000 * 1000 * 1000) { format = d3.formatPrefix(1000 * 1000); return f(format.scale(n)) + format.symbol; } else if (Math.abs(n) >= 1000) { format = d3.formatPrefix(1000); return f(format.scale(n)) + format.symbol; } else { return f(n); } } }, }; function wrapText(text, width) { // see https://bl.ocks.org/mbostock/7555321 text.each(function() { var text = d3.select(this), words = text.text().split(/\s+/).reverse(), word, line = [], lineNumber = 0, lineHeight = 1.1, // ems x = text.attr("x"), y = text.attr("y"), dy = parseFloat(text.attr("dy")), tspan = text.text(null).append("tspan").attr("y", y).attr("dy", dy + "em"); while (word = words.pop()) { line.push(word); tspan.text(line.join(" ")); if (tspan.node().getComputedTextLength() > width) { line.pop(); tspan.text(line.join(" ")); line = [word]; tspan = text.append("tspan").attr("x", x).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word); } } }); } var tooltip = d3.select("body").append("div") .attr("class", "chart-tooltip") .style("opacity", 0); function showTooltip(html) { tooltip .style("opacity", 1) .html(html); moveTooltip(); } function moveTooltip() { var height = tooltip.node().getBoundingClientRect().height; tooltip .style("left", (d3.event.pageX) + "px") .style("top", (d3.event.pageY - 20 - height) + "px"); } function hideTooltip() { tooltip.style("opacity", 0); } var HorizontalGroupedBarChart = function() { var self = this; self.discover = function(profileData) { // find all charts $('.chart-container[data-chart^=grouped-bar-]').each(function() { var chart = new HorizontalGroupedBarChart(); chart.init(this, profileData); $(window).on('resize', _.debounce(chart.drawChart, 300)); }); }; self.init = function(container, profileData) { self.container = $(container); self.name = self.container.data('chart').substring(12); // find nested data var data = profileData.indicators; _.each(self.name.split("."), function(p) { data = data[p]; }); self.data = data.values; self.drawChart(); }; self.setDimensions = function(items) { var container_width = self.container.width(); var container_height = (items > 5 ? 10 : 13) * items; var narrow = document.documentElement.clientWidth < 768; if ($('body').hasClass('print')) container_width = 550; self.margin = {top: 10, right: 0, bottom: 10, left: narrow ? 120 : 200}; self.width = container_width - self.margin.left - self.margin.right; self.height = container_height - self.margin.top - self.margin.bottom; self.y0 = d3.scale.ordinal() .rangeRoundBands([0, self.height], 0.2); self.y1 = d3.scale.ordinal(); self.x = d3.scale.linear() .range([0, self.width]); self.yAxis = d3.svg.axis() .scale(self.y0) .orient("left") .tickSize(0, 0) .tickPadding(10); }; self.color = d3.scale.ordinal() .range(["#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]); self.drawChart = function() { var data = self.data, name = self.name, dates = _.keys(_.countBy(data, function(data) { return data.date; })).reverse(), items = _.keys(_.countBy(data, function(data) { return data.item; })); self.container.empty(); self.setDimensions(dates.length * items.length); self.svg = d3.select(self.container[0]).append("svg") .attr("width", self.width + self.margin.left + self.margin.right) .attr("height", self.height + self.margin.top + self.margin.bottom) .append("g") .attr("transform", "translate(" + self.margin.left + "," + self.margin.top + ")") .attr("class", "grouped-bar"); var groupedData = []; items.forEach(function(item){ var val =[]; data.forEach(function (d) { if(item == d.item){ val.push(d); } }); groupedData.push({item: item, values: val}); }); self.y0.domain(groupedData.map(function(d) { return d.item; })); self.y1.domain(dates).rangeRoundBands([0, self.y0.rangeBand()]); self.x.domain([0, d3.max(data, function(d) { return d.percent; })]); // Draw the y-axis self.svg.append("g") .attr("class", "y axis") .call(self.yAxis) .selectAll(".tick text") .call(wrapText, self.margin.left - 10); // Create the groups var group = self.svg.selectAll(".group") .data(groupedData) .enter().append("g") .attr("class", "group") .attr("transform", function(d) { return "translate(0," + self.y0(d.item) + ")"; }); // Draw the bars group.selectAll(".chart-bar") .data(function(d) { return d.values; }) .enter().append("rect") .attr("class", "chart-bar") .attr("y", function(d) { return self.y1(d.date); }) .attr("height", self.y1.rangeBand() - 1) .attr("width", function(d) { return self.x(d.percent); }) .style("fill", function (d) { return self.color(d.date); }) .on("mouseover", function(d) { showTooltip(self.formatTooltip(d)); }) .on("mousemove", moveTooltip) .on("mouseout", hideTooltip); var legend = self.svg.selectAll(".legend") .data(dates) .enter().append("g") .attr("class", "legend") .attr("transform", function(d, i) { return "translate(0," + (self.height - (dates.length - i + 1) * 20) + ")"; }); legend.append("rect") .attr("x", self.width - 18) .attr("width", 18) .attr("height", 18) .style("fill", function (d) { return self.color(d); }); legend.append("text") .attr("x", self.width - 24) .attr("y", 9) .attr("dy", ".35em") .style("text-anchor", "end") .text(function(d) { return d; }); }; self.formatTooltip = function(d) { return "<b>" + d.date + ":</b> " + formats.percent(d.percent) + "<br>" + formats.currency(d.amount); }; }; var VerticalBarChart = function() { var self = this; self.discover = function() { // find all charts $('.chart-container[data-chart^=column-]').each(function() { var chart = new VerticalBarChart(); chart.init(this); $(window).on('resize', _.debounce(chart.drawChart, 300)); }); }; self.init = function(container) { self.container = $(container); self.name = self.container.data('chart').substring(7); // find nested data var data = profileData.indicators; _.each(self.name.split("."), function(p) { data = data[p]; }); self.data = data; // earliest to latest self.data.values.reverse(); // establish format self.format = formats[self.container.data('unit') || "currency"]; self.unit_name = self.container.data('unit-name'); self.drawChart(); }; self.setDimensions = function() { var container_width = self.container.width(); var container_height = 150; if ($('body').hasClass('print')) container_width = 300; self.margin = {top: 20, right: 0, bottom: 25, left: 0}; self.width = container_width - self.margin.left - self.margin.right; self.height = container_height - self.margin.top - self.margin.bottom; self.x = d3.scale.ordinal() .rangeRoundBands([0, self.width], 0.3, 0.1); self.y = d3.scale.linear() .range([self.height, 0]); self.xAxis = d3.svg.axis() .scale(self.x) .orient("bottom") .tickSize(0, 0) .tickPadding(10); }; self.drawChart = function() { var data = self.data.values, comparisons = self.data.comparisons; self.container.empty(); self.setDimensions(); self.svg = d3.select(self.container[0]).append("svg") .attr("width", self.width + self.margin.left + self.margin.right) .attr("height", self.height + self.margin.top + self.margin.bottom) .append("g") .attr("transform", "translate(" + self.margin.left + "," + self.margin.top + ")"); self.x.domain(data.map(function(d) { return d.date; })); self.y.domain([ Math.min(d3.min(data, function(d) { return d.result; }), 0), Math.max(d3.max(data, function(d) { return d.result; }), 0) ]); // Draw the x-axis self.svg.append("g") .attr("class", "x axis") .attr("transform", "translate(0," + self.height + ")") .call(self.xAxis); // Draw the zero line self.svg.append("g") .attr("class", "x axis zero") .attr("transform", "translate(0," + self.y(0) + ")") .call(self.xAxis.tickFormat("").tickSize(0)); // Draw the columns self.svg.selectAll(".chart-column") .data(data) .enter().append("rect") .attr("x", function(d) { return self.x(d.date); }) .attr("width", self.x.rangeBand()) .attr("y", function(d) { return self.y(Math.max(d.result, 0)); }) .attr("height", function(d) { return Math.abs(self.y(d.result) - self.y(0)); }) .attr("class", function(d) { return "chart-column " + d.rating; }) .on("mouseover", function(d) { showTooltip(self.formatTooltip(d, comparisons && comparisons[d.date])); }) .on("mousemove", moveTooltip) .on("mouseout", hideTooltip); // Add the labels self.svg.selectAll("text.bar") .data(data) .enter().append("text") .attr("class", "column-label") .attr("text-anchor", "middle") .attr("x", function(d) { return self.x(d.date) + self.x.rangeBand()/2; }) .attr("y", function(d) { return self.y(Math.max(d.result, 0)) - 5; }) .text(function(d) { return formats.terse(d.result, self.format); }); }; self.formatTooltip = function(d, comparisons) { var t = "<b>" + d.date + ":</b> " + self.format(d.result, self.unit_name); if (comparisons && comparisons.length > 0) { t += '<ul class="comparatives">'; t += _.map(comparisons, function(cmp) { return '<li>' + cmp.comparison + ' similar municipalities ' + cmp.place + ': ' + self.format(cmp.value, self.unit_name) + '</li>'; }).join(' '); } return t; }; }; var IncomeSplitPieChart = function() { var self = this; self.discover = function() { // find all charts $('#income-split-pie').each(function() { var chart = new IncomeSplitPieChart(); chart.init(this); $(window).on('resize', _.debounce(chart.drawChart, 300)); }); }; self.init = function(container) { self.container = $(container); self.color = d3.scale.ordinal() .range(["#bcbd22", "#17becf"]); self.data = [{ name: "From Government", amount: profileData.indicators.revenue_sources.government.amount, }, { name: "Generated locally", amount: profileData.indicators.revenue_sources.local.amount, }]; self.drawChart(); }; self.drawChart = function() { self.container.empty(); self.setDimensions(); self.svg = d3.select(self.container[0]).append("svg") .attr("width", self.width) .attr("height", self.height) .append("g") .attr("transform", "translate(" + self.width / 2 + "," + self.height / 2 + ")") .attr("class", "pie"); var arc = d3.svg.arc() .outerRadius(self.radius - 10) .innerRadius(0); var pie = d3.layout.pie() .sort(null) .value(function(d) { return d.amount; }); var g = self.svg.selectAll(".arc") .data(pie(self.data)) .enter().append("g") .attr("class", "arc"); g.append("path") .attr("d", arc) .style("fill", function(d) { return self.color(d.data.name); }); }; self.setDimensions = function() { self.width = self.container.width(); if ($('body').hasClass('print')) self.width = 100; self.width = Math.min(self.width, 150); self.height = self.width; self.radius = Math.min(self.width, self.height) / 2; }; }; $(function() { new VerticalBarChart().discover(); new IncomeSplitPieChart().discover(); });
Code4SA/municipal-data
scorecard/static/js/charts.js
JavaScript
mit
12,813
#ifndef NEWCONNECTIONDIALOG_H #define NEWCONNECTIONDIALOG_H #include <QDialog> #include <QCanBusDeviceInfo> #include <QSerialPortInfo> #include <QDebug> #include <QUdpSocket> #include "canconnectionmodel.h" #include "connections/canconnection.h" namespace Ui { class NewConnectionDialog; } class NewConnectionDialog : public QDialog { Q_OBJECT public: explicit NewConnectionDialog(QVector<QString>* gvretips, QVector<QString>* kayakips, QWidget *parent = nullptr); ~NewConnectionDialog(); CANCon::type getConnectionType(); QString getPortName(); QString getDriverName(); public slots: void handleConnTypeChanged(); void handleDeviceTypeChanged(); void handleCreateButton(); private: Ui::NewConnectionDialog *ui; QList<QSerialPortInfo> ports; QList<QCanBusDeviceInfo> canDevices; QVector<QString>* remoteDeviceIPGVRET; QVector<QString>* remoteBusKayak; void selectSerial(); void selectKvaser(); void selectSocketCan(); void selectRemote(); void selectKayak(); void selectMQTT(); bool isSerialBusAvailable(); void setPortName(CANCon::type pType, QString pPortName, QString pDriver); }; #endif // NEWCONNECTIONDIALOG_H
collin80/SavvyCAN
connections/newconnectiondialog.h
C
mit
1,213
// Copyright 2015 The Gogs Authors. All rights reserved. // Copyright 2016 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. // Package v1 Gitea API. // // This documentation describes the Gitea API. // // Schemes: http, https // BasePath: /api/v1 // Version: {{AppVer | JSEscape | Safe}} // License: MIT http://opensource.org/licenses/MIT // // Consumes: // - application/json // - text/plain // // Produces: // - application/json // - text/html // // Security: // - BasicAuth : // - Token : // - AccessToken : // - AuthorizationHeaderToken : // - SudoParam : // - SudoHeader : // - TOTPHeader : // // SecurityDefinitions: // BasicAuth: // type: basic // Token: // type: apiKey // name: token // in: query // AccessToken: // type: apiKey // name: access_token // in: query // AuthorizationHeaderToken: // type: apiKey // name: Authorization // in: header // description: API tokens must be prepended with "token" followed by a space. // SudoParam: // type: apiKey // name: sudo // in: query // description: Sudo API request as the user provided as the key. Admin privileges are required. // SudoHeader: // type: apiKey // name: Sudo // in: header // description: Sudo API request as the user provided as the key. Admin privileges are required. // TOTPHeader: // type: apiKey // name: X-GITEA-OTP // in: header // description: Must be used in combination with BasicAuth if two-factor authentication is enabled. // // swagger:meta package v1 import ( "net/http" "reflect" "strings" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/web" "code.gitea.io/gitea/routers/api/v1/admin" "code.gitea.io/gitea/routers/api/v1/misc" "code.gitea.io/gitea/routers/api/v1/notify" "code.gitea.io/gitea/routers/api/v1/org" "code.gitea.io/gitea/routers/api/v1/repo" "code.gitea.io/gitea/routers/api/v1/settings" _ "code.gitea.io/gitea/routers/api/v1/swagger" // for swagger generation "code.gitea.io/gitea/routers/api/v1/user" "code.gitea.io/gitea/services/forms" "gitea.com/go-chi/binding" "gitea.com/go-chi/session" "github.com/go-chi/cors" ) func sudo() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { sudo := ctx.Query("sudo") if len(sudo) == 0 { sudo = ctx.Req.Header.Get("Sudo") } if len(sudo) > 0 { if ctx.IsSigned && ctx.User.IsAdmin { user, err := models.GetUserByName(sudo) if err != nil { if models.IsErrUserNotExist(err) { ctx.NotFound() } else { ctx.Error(http.StatusInternalServerError, "GetUserByName", err) } return } log.Trace("Sudo from (%s) to: %s", ctx.User.Name, user.Name) ctx.User = user } else { ctx.JSON(http.StatusForbidden, map[string]string{ "message": "Only administrators allowed to sudo.", }) return } } } } func repoAssignment() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { userName := ctx.Params("username") repoName := ctx.Params("reponame") var ( owner *models.User err error ) // Check if the user is the same as the repository owner. if ctx.IsSigned && ctx.User.LowerName == strings.ToLower(userName) { owner = ctx.User } else { owner, err = models.GetUserByName(userName) if err != nil { if models.IsErrUserNotExist(err) { if redirectUserID, err := models.LookupUserRedirect(userName); err == nil { context.RedirectToUser(ctx.Context, userName, redirectUserID) } else if models.IsErrUserRedirectNotExist(err) { ctx.NotFound("GetUserByName", err) } else { ctx.Error(http.StatusInternalServerError, "LookupUserRedirect", err) } } else { ctx.Error(http.StatusInternalServerError, "GetUserByName", err) } return } } ctx.Repo.Owner = owner // Get repository. repo, err := models.GetRepositoryByName(owner.ID, repoName) if err != nil { if models.IsErrRepoNotExist(err) { redirectRepoID, err := models.LookupRepoRedirect(owner.ID, repoName) if err == nil { context.RedirectToRepo(ctx.Context, redirectRepoID) } else if models.IsErrRepoRedirectNotExist(err) { ctx.NotFound() } else { ctx.Error(http.StatusInternalServerError, "LookupRepoRedirect", err) } } else { ctx.Error(http.StatusInternalServerError, "GetRepositoryByName", err) } return } repo.Owner = owner ctx.Repo.Repository = repo ctx.Repo.Permission, err = models.GetUserRepoPermission(repo, ctx.User) if err != nil { ctx.Error(http.StatusInternalServerError, "GetUserRepoPermission", err) return } if !ctx.Repo.HasAccess() { ctx.NotFound() return } } } // Contexter middleware already checks token for user sign in process. func reqToken() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if true == ctx.Data["IsApiToken"] { return } if ctx.Context.IsBasicAuth { ctx.CheckForOTP() return } if ctx.IsSigned { ctx.RequireCSRF() return } ctx.Error(http.StatusUnauthorized, "reqToken", "token is required") } } func reqExploreSignIn() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if setting.Service.Explore.RequireSigninView && !ctx.IsSigned { ctx.Error(http.StatusUnauthorized, "reqExploreSignIn", "you must be signed in to search for users") } } } func reqBasicAuth() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.Context.IsBasicAuth { ctx.Error(http.StatusUnauthorized, "reqBasicAuth", "basic auth required") return } ctx.CheckForOTP() } } // reqSiteAdmin user should be the site admin func reqSiteAdmin() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqSiteAdmin", "user should be the site admin") return } } } // reqOwner user should be the owner of the repo or site admin. func reqOwner() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserRepoOwner() && !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqOwner", "user should be the owner of the repo") return } } } // reqAdmin user should be an owner or a collaborator with admin write of a repository, or site admin func reqAdmin() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqAdmin", "user should be an owner or a collaborator with admin write of a repository") return } } } // reqRepoWriter user should have a permission to write to a repo, or be a site admin func reqRepoWriter(unitTypes ...models.UnitType) func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserRepoWriter(unitTypes) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqRepoWriter", "user should have a permission to write to a repo") return } } } // reqRepoReader user should have specific read permission or be a repo admin or a site admin func reqRepoReader(unitType models.UnitType) func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserRepoReaderSpecific(unitType) && !ctx.IsUserRepoAdmin() && !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqRepoReader", "user should have specific read permission or be a repo admin or a site admin") return } } } // reqAnyRepoReader user should have any permission to read repository or permissions of site admin func reqAnyRepoReader() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.IsUserRepoReaderAny() && !ctx.IsUserSiteAdmin() { ctx.Error(http.StatusForbidden, "reqAnyRepoReader", "user should have any permission to read repository or permissions of site admin") return } } } // reqOrgOwnership user should be an organization owner, or a site admin func reqOrgOwnership() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if ctx.Context.IsUserSiteAdmin() { return } var orgID int64 if ctx.Org.Organization != nil { orgID = ctx.Org.Organization.ID } else if ctx.Org.Team != nil { orgID = ctx.Org.Team.OrgID } else { ctx.Error(http.StatusInternalServerError, "", "reqOrgOwnership: unprepared context") return } isOwner, err := models.IsOrganizationOwner(orgID, ctx.User.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrganizationOwner", err) return } else if !isOwner { if ctx.Org.Organization != nil { ctx.Error(http.StatusForbidden, "", "Must be an organization owner") } else { ctx.NotFound() } return } } } // reqTeamMembership user should be an team member, or a site admin func reqTeamMembership() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if ctx.Context.IsUserSiteAdmin() { return } if ctx.Org.Team == nil { ctx.Error(http.StatusInternalServerError, "", "reqTeamMembership: unprepared context") return } var orgID = ctx.Org.Team.OrgID isOwner, err := models.IsOrganizationOwner(orgID, ctx.User.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrganizationOwner", err) return } else if isOwner { return } if isTeamMember, err := models.IsTeamMember(orgID, ctx.Org.Team.ID, ctx.User.ID); err != nil { ctx.Error(http.StatusInternalServerError, "IsTeamMember", err) return } else if !isTeamMember { isOrgMember, err := models.IsOrganizationMember(orgID, ctx.User.ID) if err != nil { ctx.Error(http.StatusInternalServerError, "IsOrganizationMember", err) } else if isOrgMember { ctx.Error(http.StatusForbidden, "", "Must be a team member") } else { ctx.NotFound() } return } } } // reqOrgMembership user should be an organization member, or a site admin func reqOrgMembership() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if ctx.Context.IsUserSiteAdmin() { return } var orgID int64 if ctx.Org.Organization != nil { orgID = ctx.Org.Organization.ID } else if ctx.Org.Team != nil { orgID = ctx.Org.Team.OrgID } else { ctx.Error(http.StatusInternalServerError, "", "reqOrgMembership: unprepared context") return } if isMember, err := models.IsOrganizationMember(orgID, ctx.User.ID); err != nil { ctx.Error(http.StatusInternalServerError, "IsOrganizationMember", err) return } else if !isMember { if ctx.Org.Organization != nil { ctx.Error(http.StatusForbidden, "", "Must be an organization member") } else { ctx.NotFound() } return } } } func reqGitHook() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if !ctx.User.CanEditGitHook() { ctx.Error(http.StatusForbidden, "", "must be allowed to edit Git hooks") return } } } // reqWebhooksEnabled requires webhooks to be enabled by admin. func reqWebhooksEnabled() func(ctx *context.APIContext) { return func(ctx *context.APIContext) { if setting.DisableWebhooks { ctx.Error(http.StatusForbidden, "", "webhooks disabled by administrator") return } } } func orgAssignment(args ...bool) func(ctx *context.APIContext) { var ( assignOrg bool assignTeam bool ) if len(args) > 0 { assignOrg = args[0] } if len(args) > 1 { assignTeam = args[1] } return func(ctx *context.APIContext) { ctx.Org = new(context.APIOrganization) var err error if assignOrg { ctx.Org.Organization, err = models.GetOrgByName(ctx.Params(":org")) if err != nil { if models.IsErrOrgNotExist(err) { redirectUserID, err := models.LookupUserRedirect(ctx.Params(":org")) if err == nil { context.RedirectToUser(ctx.Context, ctx.Params(":org"), redirectUserID) } else if models.IsErrUserRedirectNotExist(err) { ctx.NotFound("GetOrgByName", err) } else { ctx.Error(http.StatusInternalServerError, "LookupUserRedirect", err) } } else { ctx.Error(http.StatusInternalServerError, "GetOrgByName", err) } return } } if assignTeam { ctx.Org.Team, err = models.GetTeamByID(ctx.ParamsInt64(":teamid")) if err != nil { if models.IsErrTeamNotExist(err) { ctx.NotFound() } else { ctx.Error(http.StatusInternalServerError, "GetTeamById", err) } return } } } } func mustEnableIssues(ctx *context.APIContext) { if !ctx.Repo.CanRead(models.UnitTypeIssues) { if log.IsTrace() { if ctx.IsSigned { log.Trace("Permission Denied: User %-v cannot read %-v in Repo %-v\n"+ "User in Repo has Permissions: %-+v", ctx.User, models.UnitTypeIssues, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Anonymous user cannot read %-v in Repo %-v\n"+ "Anonymous user in Repo has Permissions: %-+v", models.UnitTypeIssues, ctx.Repo.Repository, ctx.Repo.Permission) } } ctx.NotFound() return } } func mustAllowPulls(ctx *context.APIContext) { if !(ctx.Repo.Repository.CanEnablePulls() && ctx.Repo.CanRead(models.UnitTypePullRequests)) { if ctx.Repo.Repository.CanEnablePulls() && log.IsTrace() { if ctx.IsSigned { log.Trace("Permission Denied: User %-v cannot read %-v in Repo %-v\n"+ "User in Repo has Permissions: %-+v", ctx.User, models.UnitTypePullRequests, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Anonymous user cannot read %-v in Repo %-v\n"+ "Anonymous user in Repo has Permissions: %-+v", models.UnitTypePullRequests, ctx.Repo.Repository, ctx.Repo.Permission) } } ctx.NotFound() return } } func mustEnableIssuesOrPulls(ctx *context.APIContext) { if !ctx.Repo.CanRead(models.UnitTypeIssues) && !(ctx.Repo.Repository.CanEnablePulls() && ctx.Repo.CanRead(models.UnitTypePullRequests)) { if ctx.Repo.Repository.CanEnablePulls() && log.IsTrace() { if ctx.IsSigned { log.Trace("Permission Denied: User %-v cannot read %-v and %-v in Repo %-v\n"+ "User in Repo has Permissions: %-+v", ctx.User, models.UnitTypeIssues, models.UnitTypePullRequests, ctx.Repo.Repository, ctx.Repo.Permission) } else { log.Trace("Permission Denied: Anonymous user cannot read %-v and %-v in Repo %-v\n"+ "Anonymous user in Repo has Permissions: %-+v", models.UnitTypeIssues, models.UnitTypePullRequests, ctx.Repo.Repository, ctx.Repo.Permission) } } ctx.NotFound() return } } func mustNotBeArchived(ctx *context.APIContext) { if ctx.Repo.Repository.IsArchived { ctx.NotFound() return } } // bind binding an obj to a func(ctx *context.APIContext) func bind(obj interface{}) http.HandlerFunc { var tp = reflect.TypeOf(obj) for tp.Kind() == reflect.Ptr { tp = tp.Elem() } return web.Wrap(func(ctx *context.APIContext) { var theObj = reflect.New(tp).Interface() // create a new form obj for every request but not use obj directly errs := binding.Bind(ctx.Req, theObj) if len(errs) > 0 { ctx.Error(http.StatusUnprocessableEntity, "validationError", errs[0].Error()) return } web.SetForm(ctx, theObj) }) } // Routes registers all v1 APIs routes to web application. func Routes() *web.Route { var m = web.NewRoute() m.Use(session.Sessioner(session.Options{ Provider: setting.SessionConfig.Provider, ProviderConfig: setting.SessionConfig.ProviderConfig, CookieName: setting.SessionConfig.CookieName, CookiePath: setting.SessionConfig.CookiePath, Gclifetime: setting.SessionConfig.Gclifetime, Maxlifetime: setting.SessionConfig.Maxlifetime, Secure: setting.SessionConfig.Secure, SameSite: setting.SessionConfig.SameSite, Domain: setting.SessionConfig.Domain, })) m.Use(securityHeaders()) if setting.CORSConfig.Enabled { m.Use(cors.Handler(cors.Options{ //Scheme: setting.CORSConfig.Scheme, // FIXME: the cors middleware needs scheme option AllowedOrigins: setting.CORSConfig.AllowDomain, //setting.CORSConfig.AllowSubdomain // FIXME: the cors middleware needs allowSubdomain option AllowedMethods: setting.CORSConfig.Methods, AllowCredentials: setting.CORSConfig.AllowCredentials, MaxAge: int(setting.CORSConfig.MaxAge.Seconds()), })) } m.Use(context.APIContexter()) m.Use(context.ToggleAPI(&context.ToggleOptions{ SignInRequired: setting.Service.RequireSignInView, })) m.Group("", func() { // Miscellaneous if setting.API.EnableSwagger { m.Get("/swagger", func(ctx *context.APIContext) { ctx.Redirect("/api/swagger") }) } m.Get("/version", misc.Version) m.Get("/signing-key.gpg", misc.SigningKey) m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown) m.Post("/markdown/raw", misc.MarkdownRaw) m.Group("/settings", func() { m.Get("/ui", settings.GetGeneralUISettings) m.Get("/api", settings.GetGeneralAPISettings) m.Get("/attachment", settings.GetGeneralAttachmentSettings) m.Get("/repository", settings.GetGeneralRepoSettings) }) // Notifications m.Group("/notifications", func() { m.Combo(""). Get(notify.ListNotifications). Put(notify.ReadNotifications) m.Get("/new", notify.NewAvailable) m.Combo("/threads/{id}"). Get(notify.GetThread). Patch(notify.ReadThread) }, reqToken()) // Users m.Group("/users", func() { m.Get("/search", reqExploreSignIn(), user.Search) m.Group("/{username}", func() { m.Get("", reqExploreSignIn(), user.GetInfo) if setting.Service.EnableUserHeatmap { m.Get("/heatmap", user.GetUserHeatmapData) } m.Get("/repos", reqExploreSignIn(), user.ListUserRepos) m.Group("/tokens", func() { m.Combo("").Get(user.ListAccessTokens). Post(bind(api.CreateAccessTokenOption{}), user.CreateAccessToken) m.Combo("/{id}").Delete(user.DeleteAccessToken) }, reqBasicAuth()) }) }) m.Group("/users", func() { m.Group("/{username}", func() { m.Get("/keys", user.ListPublicKeys) m.Get("/gpg_keys", user.ListGPGKeys) m.Get("/followers", user.ListFollowers) m.Group("/following", func() { m.Get("", user.ListFollowing) m.Get("/{target}", user.CheckFollowing) }) m.Get("/starred", user.GetStarredRepos) m.Get("/subscriptions", user.GetWatchedRepos) }) }, reqToken()) m.Group("/user", func() { m.Get("", user.GetAuthenticatedUser) m.Combo("/emails").Get(user.ListEmails). Post(bind(api.CreateEmailOption{}), user.AddEmail). Delete(bind(api.DeleteEmailOption{}), user.DeleteEmail) m.Get("/followers", user.ListMyFollowers) m.Group("/following", func() { m.Get("", user.ListMyFollowing) m.Combo("/{username}").Get(user.CheckMyFollowing).Put(user.Follow).Delete(user.Unfollow) }) m.Group("/keys", func() { m.Combo("").Get(user.ListMyPublicKeys). Post(bind(api.CreateKeyOption{}), user.CreatePublicKey) m.Combo("/{id}").Get(user.GetPublicKey). Delete(user.DeletePublicKey) }) m.Group("/applications", func() { m.Combo("/oauth2"). Get(user.ListOauth2Applications). Post(bind(api.CreateOAuth2ApplicationOptions{}), user.CreateOauth2Application) m.Combo("/oauth2/{id}"). Delete(user.DeleteOauth2Application). Patch(bind(api.CreateOAuth2ApplicationOptions{}), user.UpdateOauth2Application). Get(user.GetOauth2Application) }, reqToken()) m.Group("/gpg_keys", func() { m.Combo("").Get(user.ListMyGPGKeys). Post(bind(api.CreateGPGKeyOption{}), user.CreateGPGKey) m.Combo("/{id}").Get(user.GetGPGKey). Delete(user.DeleteGPGKey) }) m.Combo("/repos").Get(user.ListMyRepos). Post(bind(api.CreateRepoOption{}), repo.Create) m.Group("/starred", func() { m.Get("", user.GetMyStarredRepos) m.Group("/{username}/{reponame}", func() { m.Get("", user.IsStarring) m.Put("", user.Star) m.Delete("", user.Unstar) }, repoAssignment()) }) m.Get("/times", repo.ListMyTrackedTimes) m.Get("/stopwatches", repo.GetStopwatches) m.Get("/subscriptions", user.GetMyWatchedRepos) m.Get("/teams", org.ListUserTeams) }, reqToken()) // Repositories m.Post("/org/{org}/repos", reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepoDeprecated) m.Combo("/repositories/{id}", reqToken()).Get(repo.GetByID) m.Group("/repos", func() { m.Get("/search", repo.Search) m.Get("/issues/search", repo.SearchIssues) m.Post("/migrate", reqToken(), bind(api.MigrateRepoOptions{}), repo.Migrate) m.Group("/{username}/{reponame}", func() { m.Combo("").Get(reqAnyRepoReader(), repo.Get). Delete(reqToken(), reqOwner(), repo.Delete). Patch(reqToken(), reqAdmin(), bind(api.EditRepoOption{}), repo.Edit) m.Post("/transfer", reqOwner(), bind(api.TransferRepoOption{}), repo.Transfer) m.Combo("/notifications"). Get(reqToken(), notify.ListRepoNotifications). Put(reqToken(), notify.ReadRepoNotifications) m.Group("/hooks/git", func() { m.Combo("").Get(repo.ListGitHooks) m.Group("/{id}", func() { m.Combo("").Get(repo.GetGitHook). Patch(bind(api.EditGitHookOption{}), repo.EditGitHook). Delete(repo.DeleteGitHook) }) }, reqToken(), reqAdmin(), reqGitHook(), context.ReferencesGitRepo(true)) m.Group("/hooks", func() { m.Combo("").Get(repo.ListHooks). Post(bind(api.CreateHookOption{}), repo.CreateHook) m.Group("/{id}", func() { m.Combo("").Get(repo.GetHook). Patch(bind(api.EditHookOption{}), repo.EditHook). Delete(repo.DeleteHook) m.Post("/tests", context.RepoRefForAPI, repo.TestHook) }) }, reqToken(), reqAdmin(), reqWebhooksEnabled()) m.Group("/collaborators", func() { m.Get("", reqAnyRepoReader(), repo.ListCollaborators) m.Combo("/{collaborator}").Get(reqAnyRepoReader(), repo.IsCollaborator). Put(reqAdmin(), bind(api.AddCollaboratorOption{}), repo.AddCollaborator). Delete(reqAdmin(), repo.DeleteCollaborator) }, reqToken()) m.Group("/teams", func() { m.Get("", reqAnyRepoReader(), repo.ListTeams) m.Combo("/{team}").Get(reqAnyRepoReader(), repo.IsTeam). Put(reqAdmin(), repo.AddTeam). Delete(reqAdmin(), repo.DeleteTeam) }, reqToken()) m.Get("/raw/*", context.RepoRefForAPI, reqRepoReader(models.UnitTypeCode), repo.GetRawFile) m.Get("/archive/*", reqRepoReader(models.UnitTypeCode), repo.GetArchive) m.Combo("/forks").Get(repo.ListForks). Post(reqToken(), reqRepoReader(models.UnitTypeCode), bind(api.CreateForkOption{}), repo.CreateFork) m.Group("/branches", func() { m.Get("", repo.ListBranches) m.Get("/*", repo.GetBranch) m.Delete("/*", context.ReferencesGitRepo(false), reqRepoWriter(models.UnitTypeCode), repo.DeleteBranch) m.Post("", reqRepoWriter(models.UnitTypeCode), bind(api.CreateBranchRepoOption{}), repo.CreateBranch) }, reqRepoReader(models.UnitTypeCode)) m.Group("/branch_protections", func() { m.Get("", repo.ListBranchProtections) m.Post("", bind(api.CreateBranchProtectionOption{}), repo.CreateBranchProtection) m.Group("/{name}", func() { m.Get("", repo.GetBranchProtection) m.Patch("", bind(api.EditBranchProtectionOption{}), repo.EditBranchProtection) m.Delete("", repo.DeleteBranchProtection) }) }, reqToken(), reqAdmin()) m.Group("/tags", func() { m.Get("", repo.ListTags) m.Delete("/{tag}", repo.DeleteTag) }, reqRepoReader(models.UnitTypeCode), context.ReferencesGitRepo(true)) m.Group("/keys", func() { m.Combo("").Get(repo.ListDeployKeys). Post(bind(api.CreateKeyOption{}), repo.CreateDeployKey) m.Combo("/{id}").Get(repo.GetDeployKey). Delete(repo.DeleteDeploykey) }, reqToken(), reqAdmin()) m.Group("/times", func() { m.Combo("").Get(repo.ListTrackedTimesByRepository) m.Combo("/{timetrackingusername}").Get(repo.ListTrackedTimesByUser) }, mustEnableIssues, reqToken()) m.Group("/issues", func() { m.Combo("").Get(repo.ListIssues). Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueOption{}), repo.CreateIssue) m.Group("/comments", func() { m.Get("", repo.ListRepoIssueComments) m.Group("/{id}", func() { m.Combo(""). Get(repo.GetIssueComment). Patch(mustNotBeArchived, reqToken(), bind(api.EditIssueCommentOption{}), repo.EditIssueComment). Delete(reqToken(), repo.DeleteIssueComment) m.Combo("/reactions"). Get(repo.GetIssueCommentReactions). Post(reqToken(), bind(api.EditReactionOption{}), repo.PostIssueCommentReaction). Delete(reqToken(), bind(api.EditReactionOption{}), repo.DeleteIssueCommentReaction) }) }) m.Group("/{index}", func() { m.Combo("").Get(repo.GetIssue). Patch(reqToken(), bind(api.EditIssueOption{}), repo.EditIssue) m.Group("/comments", func() { m.Combo("").Get(repo.ListIssueComments). Post(reqToken(), mustNotBeArchived, bind(api.CreateIssueCommentOption{}), repo.CreateIssueComment) m.Combo("/{id}", reqToken()).Patch(bind(api.EditIssueCommentOption{}), repo.EditIssueCommentDeprecated). Delete(repo.DeleteIssueCommentDeprecated) }) m.Group("/labels", func() { m.Combo("").Get(repo.ListIssueLabels). Post(reqToken(), bind(api.IssueLabelsOption{}), repo.AddIssueLabels). Put(reqToken(), bind(api.IssueLabelsOption{}), repo.ReplaceIssueLabels). Delete(reqToken(), repo.ClearIssueLabels) m.Delete("/{id}", reqToken(), repo.DeleteIssueLabel) }) m.Group("/times", func() { m.Combo(""). Get(repo.ListTrackedTimes). Post(bind(api.AddTimeOption{}), repo.AddTime). Delete(repo.ResetIssueTime) m.Delete("/{id}", repo.DeleteTime) }, reqToken()) m.Combo("/deadline").Post(reqToken(), bind(api.EditDeadlineOption{}), repo.UpdateIssueDeadline) m.Group("/stopwatch", func() { m.Post("/start", reqToken(), repo.StartIssueStopwatch) m.Post("/stop", reqToken(), repo.StopIssueStopwatch) m.Delete("/delete", reqToken(), repo.DeleteIssueStopwatch) }) m.Group("/subscriptions", func() { m.Get("", repo.GetIssueSubscribers) m.Get("/check", reqToken(), repo.CheckIssueSubscription) m.Put("/{user}", reqToken(), repo.AddIssueSubscription) m.Delete("/{user}", reqToken(), repo.DelIssueSubscription) }) m.Combo("/reactions"). Get(repo.GetIssueReactions). Post(reqToken(), bind(api.EditReactionOption{}), repo.PostIssueReaction). Delete(reqToken(), bind(api.EditReactionOption{}), repo.DeleteIssueReaction) }) }, mustEnableIssuesOrPulls) m.Group("/labels", func() { m.Combo("").Get(repo.ListLabels). Post(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), bind(api.CreateLabelOption{}), repo.CreateLabel) m.Combo("/{id}").Get(repo.GetLabel). Patch(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), bind(api.EditLabelOption{}), repo.EditLabel). Delete(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), repo.DeleteLabel) }) m.Post("/markdown", bind(api.MarkdownOption{}), misc.Markdown) m.Post("/markdown/raw", misc.MarkdownRaw) m.Group("/milestones", func() { m.Combo("").Get(repo.ListMilestones). Post(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), bind(api.CreateMilestoneOption{}), repo.CreateMilestone) m.Combo("/{id}").Get(repo.GetMilestone). Patch(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), bind(api.EditMilestoneOption{}), repo.EditMilestone). Delete(reqToken(), reqRepoWriter(models.UnitTypeIssues, models.UnitTypePullRequests), repo.DeleteMilestone) }) m.Get("/stargazers", repo.ListStargazers) m.Get("/subscribers", repo.ListSubscribers) m.Group("/subscription", func() { m.Get("", user.IsWatching) m.Put("", reqToken(), user.Watch) m.Delete("", reqToken(), user.Unwatch) }) m.Group("/releases", func() { m.Combo("").Get(repo.ListReleases). Post(reqToken(), reqRepoWriter(models.UnitTypeReleases), context.ReferencesGitRepo(false), bind(api.CreateReleaseOption{}), repo.CreateRelease) m.Group("/{id}", func() { m.Combo("").Get(repo.GetRelease). Patch(reqToken(), reqRepoWriter(models.UnitTypeReleases), context.ReferencesGitRepo(false), bind(api.EditReleaseOption{}), repo.EditRelease). Delete(reqToken(), reqRepoWriter(models.UnitTypeReleases), repo.DeleteRelease) m.Group("/assets", func() { m.Combo("").Get(repo.ListReleaseAttachments). Post(reqToken(), reqRepoWriter(models.UnitTypeReleases), repo.CreateReleaseAttachment) m.Combo("/{asset}").Get(repo.GetReleaseAttachment). Patch(reqToken(), reqRepoWriter(models.UnitTypeReleases), bind(api.EditAttachmentOptions{}), repo.EditReleaseAttachment). Delete(reqToken(), reqRepoWriter(models.UnitTypeReleases), repo.DeleteReleaseAttachment) }) }) m.Group("/tags", func() { m.Combo("/{tag}"). Get(repo.GetReleaseByTag). Delete(reqToken(), reqRepoWriter(models.UnitTypeReleases), repo.DeleteReleaseByTag) }) }, reqRepoReader(models.UnitTypeReleases)) m.Post("/mirror-sync", reqToken(), reqRepoWriter(models.UnitTypeCode), repo.MirrorSync) m.Get("/editorconfig/{filename}", context.RepoRefForAPI, reqRepoReader(models.UnitTypeCode), repo.GetEditorconfig) m.Group("/pulls", func() { m.Combo("").Get(repo.ListPullRequests). Post(reqToken(), mustNotBeArchived, bind(api.CreatePullRequestOption{}), repo.CreatePullRequest) m.Group("/{index}", func() { m.Combo("").Get(repo.GetPullRequest). Patch(reqToken(), bind(api.EditPullRequestOption{}), repo.EditPullRequest) m.Get(".diff", repo.DownloadPullDiff) m.Get(".patch", repo.DownloadPullPatch) m.Post("/update", reqToken(), repo.UpdatePullRequest) m.Combo("/merge").Get(repo.IsPullRequestMerged). Post(reqToken(), mustNotBeArchived, bind(forms.MergePullRequestForm{}), repo.MergePullRequest) m.Group("/reviews", func() { m.Combo(""). Get(repo.ListPullReviews). Post(reqToken(), bind(api.CreatePullReviewOptions{}), repo.CreatePullReview) m.Group("/{id}", func() { m.Combo(""). Get(repo.GetPullReview). Delete(reqToken(), repo.DeletePullReview). Post(reqToken(), bind(api.SubmitPullReviewOptions{}), repo.SubmitPullReview) m.Combo("/comments"). Get(repo.GetPullReviewComments) m.Post("/dismissals", reqToken(), bind(api.DismissPullReviewOptions{}), repo.DismissPullReview) m.Post("/undismissals", reqToken(), repo.UnDismissPullReview) }) }) m.Combo("/requested_reviewers"). Delete(reqToken(), bind(api.PullReviewRequestOptions{}), repo.DeleteReviewRequests). Post(reqToken(), bind(api.PullReviewRequestOptions{}), repo.CreateReviewRequests) }) }, mustAllowPulls, reqRepoReader(models.UnitTypeCode), context.ReferencesGitRepo(false)) m.Group("/statuses", func() { m.Combo("/{sha}").Get(repo.GetCommitStatuses). Post(reqToken(), bind(api.CreateStatusOption{}), repo.NewCommitStatus) }, reqRepoReader(models.UnitTypeCode)) m.Group("/commits", func() { m.Get("", repo.GetAllCommits) m.Group("/{ref}", func() { m.Get("/status", repo.GetCombinedCommitStatusByRef) m.Get("/statuses", repo.GetCommitStatusesByRef) }) }, reqRepoReader(models.UnitTypeCode)) m.Group("/git", func() { m.Group("/commits", func() { m.Get("/{sha}", repo.GetSingleCommit) }) m.Get("/refs", repo.GetGitAllRefs) m.Get("/refs/*", repo.GetGitRefs) m.Get("/trees/{sha}", context.RepoRefForAPI, repo.GetTree) m.Get("/blobs/{sha}", context.RepoRefForAPI, repo.GetBlob) m.Get("/tags/{sha}", context.RepoRefForAPI, repo.GetTag) }, reqRepoReader(models.UnitTypeCode)) m.Group("/contents", func() { m.Get("", repo.GetContentsList) m.Get("/*", repo.GetContents) m.Group("/*", func() { m.Post("", bind(api.CreateFileOptions{}), repo.CreateFile) m.Put("", bind(api.UpdateFileOptions{}), repo.UpdateFile) m.Delete("", bind(api.DeleteFileOptions{}), repo.DeleteFile) }, reqRepoWriter(models.UnitTypeCode), reqToken()) }, reqRepoReader(models.UnitTypeCode)) m.Get("/signing-key.gpg", misc.SigningKey) m.Group("/topics", func() { m.Combo("").Get(repo.ListTopics). Put(reqToken(), reqAdmin(), bind(api.RepoTopicOptions{}), repo.UpdateTopics) m.Group("/{topic}", func() { m.Combo("").Put(reqToken(), repo.AddTopic). Delete(reqToken(), repo.DeleteTopic) }, reqAdmin()) }, reqAnyRepoReader()) m.Get("/issue_templates", context.ReferencesGitRepo(false), repo.GetIssueTemplates) m.Get("/languages", reqRepoReader(models.UnitTypeCode), repo.GetLanguages) }, repoAssignment()) }) // Organizations m.Get("/user/orgs", reqToken(), org.ListMyOrgs) m.Get("/users/{username}/orgs", org.ListUserOrgs) m.Post("/orgs", reqToken(), bind(api.CreateOrgOption{}), org.Create) m.Get("/orgs", org.GetAll) m.Group("/orgs/{org}", func() { m.Combo("").Get(org.Get). Patch(reqToken(), reqOrgOwnership(), bind(api.EditOrgOption{}), org.Edit). Delete(reqToken(), reqOrgOwnership(), org.Delete) m.Combo("/repos").Get(user.ListOrgRepos). Post(reqToken(), bind(api.CreateRepoOption{}), repo.CreateOrgRepo) m.Group("/members", func() { m.Get("", org.ListMembers) m.Combo("/{username}").Get(org.IsMember). Delete(reqToken(), reqOrgOwnership(), org.DeleteMember) }) m.Group("/public_members", func() { m.Get("", org.ListPublicMembers) m.Combo("/{username}").Get(org.IsPublicMember). Put(reqToken(), reqOrgMembership(), org.PublicizeMember). Delete(reqToken(), reqOrgMembership(), org.ConcealMember) }) m.Group("/teams", func() { m.Combo("", reqToken()).Get(org.ListTeams). Post(reqOrgOwnership(), bind(api.CreateTeamOption{}), org.CreateTeam) m.Get("/search", org.SearchTeam) }, reqOrgMembership()) m.Group("/labels", func() { m.Get("", org.ListLabels) m.Post("", reqToken(), reqOrgOwnership(), bind(api.CreateLabelOption{}), org.CreateLabel) m.Combo("/{id}").Get(org.GetLabel). Patch(reqToken(), reqOrgOwnership(), bind(api.EditLabelOption{}), org.EditLabel). Delete(reqToken(), reqOrgOwnership(), org.DeleteLabel) }) m.Group("/hooks", func() { m.Combo("").Get(org.ListHooks). Post(bind(api.CreateHookOption{}), org.CreateHook) m.Combo("/{id}").Get(org.GetHook). Patch(bind(api.EditHookOption{}), org.EditHook). Delete(org.DeleteHook) }, reqToken(), reqOrgOwnership(), reqWebhooksEnabled()) }, orgAssignment(true)) m.Group("/teams/{teamid}", func() { m.Combo("").Get(org.GetTeam). Patch(reqOrgOwnership(), bind(api.EditTeamOption{}), org.EditTeam). Delete(reqOrgOwnership(), org.DeleteTeam) m.Group("/members", func() { m.Get("", org.GetTeamMembers) m.Combo("/{username}"). Get(org.GetTeamMember). Put(reqOrgOwnership(), org.AddTeamMember). Delete(reqOrgOwnership(), org.RemoveTeamMember) }) m.Group("/repos", func() { m.Get("", org.GetTeamRepos) m.Combo("/{org}/{reponame}"). Put(org.AddTeamRepository). Delete(org.RemoveTeamRepository) }) }, orgAssignment(false, true), reqToken(), reqTeamMembership()) m.Group("/admin", func() { m.Group("/cron", func() { m.Get("", admin.ListCronTasks) m.Post("/{task}", admin.PostCronTask) }) m.Get("/orgs", admin.GetAllOrgs) m.Group("/users", func() { m.Get("", admin.GetAllUsers) m.Post("", bind(api.CreateUserOption{}), admin.CreateUser) m.Group("/{username}", func() { m.Combo("").Patch(bind(api.EditUserOption{}), admin.EditUser). Delete(admin.DeleteUser) m.Group("/keys", func() { m.Post("", bind(api.CreateKeyOption{}), admin.CreatePublicKey) m.Delete("/{id}", admin.DeleteUserPublicKey) }) m.Get("/orgs", org.ListUserOrgs) m.Post("/orgs", bind(api.CreateOrgOption{}), admin.CreateOrg) m.Post("/repos", bind(api.CreateRepoOption{}), admin.CreateRepo) }) }) m.Group("/unadopted", func() { m.Get("", admin.ListUnadoptedRepositories) m.Post("/{username}/{reponame}", admin.AdoptRepository) m.Delete("/{username}/{reponame}", admin.DeleteUnadoptedRepository) }) }, reqToken(), reqSiteAdmin()) m.Group("/topics", func() { m.Get("/search", repo.TopicSearch) }) }, sudo()) return m } func securityHeaders() func(http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { // CORB: https://www.chromium.org/Home/chromium-security/corb-for-developers // http://stackoverflow.com/a/3146618/244009 resp.Header().Set("x-content-type-options", "nosniff") next.ServeHTTP(resp, req) }) } }
vdbt/gitea
routers/api/v1/api.go
GO
mit
37,722
import mmap import os.path import re from collections import OrderedDict from .base_handler import BaseHandler from .iso9660 import ISO9660Handler from utils import MmappedFile, ConcatenatedFile class GDIParseError(ValueError): pass class GDIHandler(BaseHandler): def test(self): if not re.match('^.*\.gdi', self.file_name, re.IGNORECASE): return False try: self.parse() except GDIParseError: return False return True def parse(self): text = self.read(0, 8*1024) lines = text.decode('ascii').splitlines() if len(lines) == 1: raise GDIParseError try: n_tracks = int(lines.pop(0)) except ValueError: raise GDIParseError if len(lines) != n_tracks: print(len(lines), n_tracks) raise GDIParseError # TODO figure out complete format tracks = [] for track_i, line in enumerate(lines): try: match = re.match('(?P<index>\d+) (?P<sector>\d+) (?P<type>\d+) (?P<sector_size>\d+)' ' (?P<file_name>\S+) (\d+)', line) if not match: raise GDIParseError track = match.groupdict() for key in ('index', 'sector', 'type', 'sector_size'): track[key] = int(track[key]) if track['index'] != track_i + 1: raise GDIParseError tracks.append(track) except ValueError: raise GDIParseError return tracks def get_info(self): tracks = self.parse() for track in tracks: track['path'] = os.path.join(os.path.dirname(self.file_name), track['file_name']) if len(tracks) > 3 and tracks[2]['type'] == 4 and tracks[-1]['type'] == 4: # Dreamcast discs often contain two data tracks (track 3 and the last track) in addition to track 1. mixed_mode = True else: mixed_mode = False track_info = OrderedDict() for track in tracks: if mixed_mode and track == tracks[-1]: continue if mixed_mode and track['index'] == 3: last_track = tracks[-1] offset_gap = (last_track['sector'] - track['sector']) * 2352 track_name = 'Track {}+{}'.format(track['index'], last_track['index']) file = ConcatenatedFile(file_names=[track['path'], last_track['path']], offsets=[0, offset_gap]) # TODO handle different sector sizes else: track_name = 'Track {}'.format(track['index']) file = MmappedFile(track['path']) with file: if track['type'] == 4: handler = DCDataTrackHandler(file=file, file_name=track['file_name'], sector_offset=track['sector'], track_name=track_name) if handler.test(): handler.get_info() track_info[track_name] = handler.info else: track_info[track_name] = 'Data track in unknown format' elif track['type'] == 0: track_info[track_name] = 'Audio track' else: track_info[track_name] = 'Unknown' self.info['Tracks'] = track_info class DCDataTrackHandler(ISO9660Handler): def test(self): if not super().test(): return False if self.read(0, 16) == b'SEGA SEGAKATANA ': return True else: return False def get_info(self): header_info = OrderedDict() header_info['Hardware ID'] = self.unpack('string', 0x00, 16, 0) header_info['Maker ID'] = self.unpack('string', 0x10, 16, 0) header_info['CRC'] = self.unpack('string', 0x20, 4, 0) header_info['Device'] = self.unpack('string', 0x25, 6, 0) header_info['Disc'] = self.unpack('string', 0x2b, 3, 0) header_info['Region'] = self.unpack('string', 0x30, 8, 0).strip() header_info['Peripherals'] = self.unpack('string', 0x38, 8, 0) header_info['Product number'] = self.unpack('string', 0x40, 10, 0) header_info['Product version'] = self.unpack('string', 0x4a, 6, 0) header_info['Release date'] = self.unpack('string', 0x50, 16, 0) header_info['Boot file'] = self.unpack('string', 0x60, 16, 0) header_info['Company name'] = self.unpack('string', 0x70, 16, 0) header_info['Software name'] = self.unpack('string', 0x80, 16, 0) self.info['Header'] = header_info super().get_info()
drx/rom-info
handlers/dreamcast.py
Python
mit
4,779
package org.jabref.model; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import javafx.collections.FXCollections; import javafx.collections.ObservableList; /** * Represents a node in a tree. * <p> * Usually, tree nodes have a value property which allows access to the value stored in the node. * In contrast to this approach, the TreeNode<T> class is designed to be used as a base class which provides the * tree traversing functionality via inheritance. * <p> * Example usage: * private class BasicTreeNode extends TreeNode<BasicTreeNode> { * public BasicTreeNode() { * super(BasicTreeNode.class); * } * } * <p> * This class started out as a copy of javax.swing.tree.DefaultMutableTreeNode. * * @param <T> the type of the class */ // We use some explicit casts of the form "(T) this". The constructor ensures that this cast is valid. @SuppressWarnings("unchecked") public abstract class TreeNode<T extends TreeNode<T>> { /** * Array of children, may be empty if this node has no children (but never null) */ private final ObservableList<T> children; /** * This node's parent, or null if this node has no parent */ private T parent; /** * The function which is invoked when something changed in the subtree. */ private Consumer<T> onDescendantChanged = t -> { /* Do nothing */ }; /** * Constructs a tree node without parent and no children. * * @param derivingClass class deriving from TreeNode<T>. It should always be "T.class". * We need this parameter since it is hard to get this information by other means. */ public TreeNode(Class<T> derivingClass) { parent = null; children = FXCollections.observableArrayList(); if (!derivingClass.isInstance(this)) { throw new UnsupportedOperationException("The class extending TreeNode<T> has to derive from T"); } } /** * Get the path from the root node to this node. * <p> * The elements in the returned list represent the child index of each node in the path, starting at the root. * If this node is the root node, the returned list has zero elements. * * @return a list of numbers which represent an indexed path from the root node to this node */ public List<Integer> getIndexedPathFromRoot() { if (parent == null) { return new ArrayList<>(); } List<Integer> path = parent.getIndexedPathFromRoot(); path.add(getPositionInParent()); return path; } /** * Get the descendant of this node as indicated by the indexedPath. * <p> * If the path could not be traversed completely (i.e. one of the child indices did not exist), * an empty Optional will be returned. * * @param indexedPath sequence of child indices that describe a path from this node to one of its descendants. * Be aware that if indexedPath was obtained by getIndexedPathFromRoot(), this node should * usually be the root node. * @return descendant found by evaluating indexedPath */ public Optional<T> getDescendant(List<Integer> indexedPath) { T cursor = (T) this; for (int index : indexedPath) { Optional<T> child = cursor.getChildAt(index); if (child.isPresent()) { cursor = child.get(); } else { return Optional.empty(); } } return Optional.of(cursor); } /** * Get the child index of this node in its parent. * <p> * If this node is a root, then an UnsupportedOperationException is thrown. * Use the isRoot method to check for this case. * * @return the child index of this node in its parent */ public int getPositionInParent() { return getParent().orElseThrow(() -> new UnsupportedOperationException("Roots have no position in parent")) .getIndexOfChild((T) this).get(); } /** * Gets the index of the specified child in this node's child list. * <p> * If the specified node is not a child of this node, returns an empty Optional. * This method performs a linear search and is O(n) where n is the number of children. * * @param childNode the node to search for among this node's children * @return an integer giving the index of the node in this node's child list * or an empty Optional if the specified node is a not a child of this node * @throws NullPointerException if childNode is null */ public Optional<Integer> getIndexOfChild(T childNode) { Objects.requireNonNull(childNode); int index = children.indexOf(childNode); if (index == -1) { return Optional.empty(); } else { return Optional.of(index); } } /** * Gets the number of levels above this node, i.e. the distance from the root to this node. * <p> * If this node is the root, returns 0. * * @return an int giving the number of levels above this node */ public int getLevel() { if (parent == null) { return 0; } return parent.getLevel() + 1; } /** * Returns the number of children of this node. * * @return an int giving the number of children of this node */ public int getNumberOfChildren() { return children.size(); } /** * Removes this node from its parent and makes it a child of the specified node * by adding it to the end of children list. * In this way the whole subtree based at this node is moved to the given node. * * @param target the new parent * @throws NullPointerException if target is null * @throws ArrayIndexOutOfBoundsException if targetIndex is out of bounds * @throws UnsupportedOperationException if target is an descendant of this node */ public void moveTo(T target) { Objects.requireNonNull(target); Optional<T> oldParent = getParent(); if (oldParent.isPresent() && (oldParent.get() == target)) { this.moveTo(target, target.getNumberOfChildren() - 1); } else { this.moveTo(target, target.getNumberOfChildren()); } } /** * Returns the path from the root, to get to this node. The last element in the path is this node. * * @return a list of nodes giving the path, where the first element in the path is the root * and the last element is this node. */ public List<T> getPathFromRoot() { if (parent == null) { List<T> pathToMe = new ArrayList<>(); pathToMe.add((T) this); return pathToMe; } List<T> path = parent.getPathFromRoot(); path.add((T) this); return path; } /** * Returns the next sibling of this node in the parent's children list. * Returns an empty Optional if this node has no parent or if it is the parent's last child. * <p> * This method performs a linear search that is O(n) where n is the number of children. * To traverse the entire children collection, use the parent's getChildren() instead. * * @return the sibling of this node that immediately follows this node * @see #getChildren */ public Optional<T> getNextSibling() { return getRelativeSibling(+1); } /** * Returns the previous sibling of this node in the parent's children list. * Returns an empty Optional if this node has no parent or is the parent's first child. * <p> * This method performs a linear search that is O(n) where n is the number of children. * * @return the sibling of this node that immediately precedes this node * @see #getChildren */ public Optional<T> getPreviousSibling() { return getRelativeSibling(-1); } /** * Returns the sibling which is shiftIndex away from this node. */ private Optional<T> getRelativeSibling(int shiftIndex) { if (parent == null) { return Optional.empty(); } else { int indexInParent = getPositionInParent(); int indexTarget = indexInParent + shiftIndex; if (parent.childIndexExists(indexTarget)) { return parent.getChildAt(indexTarget); } else { return Optional.empty(); } } } /** * Returns this node's parent or an empty Optional if this node has no parent. * * @return this node's parent T, or an empty Optional if this node has no parent */ public Optional<T> getParent() { return Optional.ofNullable(parent); } /** * Sets the parent node of this node. * <p> * This method does not add this node to the children collection of the new parent nor does it remove this node * from the old parent. You should probably call moveTo or remove to change the tree. * * @param parent the new parent */ protected void setParent(T parent) { this.parent = parent; } /** * Returns the child at the specified index in this node's children collection. * * @param index an index into this node's children collection * @return the node in this node's children collection at the specified index, * or an empty Optional if the index does not point to a child */ public Optional<T> getChildAt(int index) { return childIndexExists(index) ? Optional.of(children.get(index)) : Optional.empty(); } /** * Returns whether the specified index is a valid index for a child. * * @param index the index to be tested * @return returns true when index is at least 0 and less then the count of children */ protected boolean childIndexExists(int index) { return (index >= 0) && (index < children.size()); } /** * Returns true if this node is the root of the tree. * The root is the only node in the tree with an empty parent; every tree has exactly one root. * * @return true if this node is the root of its tree */ public boolean isRoot() { return parent == null; } /** * Returns true if this node is an ancestor of the given node. * <p> * A node is considered an ancestor of itself. * * @param anotherNode node to test * @return true if anotherNode is a descendant of this node * @throws NullPointerException if anotherNode is null * @see #isNodeDescendant */ public boolean isAncestorOf(T anotherNode) { Objects.requireNonNull(anotherNode); if (anotherNode == this) { return true; } else { for (T child : children) { if (child.isAncestorOf(anotherNode)) { return true; } } return false; } } /** * Returns the root of the tree that contains this node. The root is the ancestor with an empty parent. * Thus a node without a parent is considered its own root. * * @return the root of the tree that contains this node */ public T getRoot() { if (parent == null) { return (T) this; } else { return parent.getRoot(); } } /** * Returns true if this node has no children. * * @return true if this node has no children */ public boolean isLeaf() { return (getNumberOfChildren() == 0); } /** * Removes the subtree rooted at this node from the tree, giving this node an empty parent. * Does nothing if this node is the root of it tree. */ public void removeFromParent() { if (parent != null) { parent.removeChild((T) this); } } /** * Removes all of this node's children, setting their parents to empty. * If this node has no children, this method does nothing. */ public void removeAllChildren() { while (getNumberOfChildren() > 0) { removeChild(0); } } /** * Returns this node's first child if it exists (otherwise returns an empty Optional). * * @return the first child of this node */ public Optional<T> getFirstChild() { return getChildAt(0); } /** * Returns this node's last child if it exists (otherwise returns an empty Optional). * * @return the last child of this node */ public Optional<T> getLastChild() { return getChildAt(children.size() - 1); } /** * Returns true if anotherNode is a descendant of this node * -- if it is this node, one of this node's children, or a descendant of one of this node's children. * Note that a node is considered a descendant of itself. * <p> * If anotherNode is null, an exception is thrown. * * @param anotherNode node to test as descendant of this node * @return true if this node is an ancestor of anotherNode * @see #isAncestorOf */ public boolean isNodeDescendant(T anotherNode) { Objects.requireNonNull(anotherNode); return this.isAncestorOf(anotherNode); } /** * Gets a forward-order list of this node's children. * <p> * The returned list is unmodifiable - use the add and remove methods to modify the nodes children. * However, changing the nodes children (for example by calling moveTo) is reflected in a change of * the list returned by getChildren. In other words, getChildren provides a read-only view on the children but * not a copy. * * @return a list of this node's children */ public ObservableList<T> getChildren() { return FXCollections.unmodifiableObservableList(children); } /** * Removes the given child from this node's child list, giving it an empty parent. * * @param child a child of this node to remove */ public void removeChild(T child) { Objects.requireNonNull(child); children.remove(child); child.setParent(null); notifyAboutDescendantChange((T)this); } /** * Removes the child at the specified index from this node's children and sets that node's parent to empty. * <p> * Does nothing if the index does not point to a child. * * @param childIndex the index in this node's child array of the child to remove */ public void removeChild(int childIndex) { Optional<T> child = getChildAt(childIndex); if (child.isPresent()) { children.remove(childIndex); child.get().setParent(null); } notifyAboutDescendantChange((T)this); } /** * Adds the node at the end the children collection. Also sets the parent of the given node to this node. * The given node is not allowed to already be in a tree (i.e. it has to have no parent). * * @param child the node to add * @return the child node */ public T addChild(T child) { return addChild(child, children.size()); } /** * Adds the node at the given position in the children collection. Also sets the parent of the given node to this node. * The given node is not allowed to already be in a tree (i.e. it has to have no parent). * * @param child the node to add * @param index the position where the node should be added * @return the child node * @throws IndexOutOfBoundsException if the index is out of range */ public T addChild(T child, int index) { Objects.requireNonNull(child); if (child.getParent().isPresent()) { throw new UnsupportedOperationException("Cannot add a node which already has a parent, use moveTo instead"); } child.setParent((T) this); children.add(index, child); notifyAboutDescendantChange((T)this); return child; } /** * Removes all children from this node and makes them a child of the specified node * by adding it to the specified position in the children list. * * @param target the new parent * @param targetIndex the position where the children should be inserted * @throws NullPointerException if target is null * @throws ArrayIndexOutOfBoundsException if targetIndex is out of bounds * @throws UnsupportedOperationException if target is an descendant of one of the children of this node */ public void moveAllChildrenTo(T target, int targetIndex) { while (getNumberOfChildren() > 0) { getLastChild().get().moveTo(target, targetIndex); } } /** * Sorts the list of children according to the order induced by the specified {@link Comparator}. * <p> * All children must be mutually comparable using the specified comparator * (that is, {@code c.compare(e1, e2)} must not throw a {@code ClassCastException} * for any children {@code e1} and {@code e2} in the list). * * @param comparator the comparator used to compare the child nodes * @param recursive if true the whole subtree is sorted * @throws NullPointerException if the comparator is null */ public void sortChildren(Comparator<? super T> comparator, boolean recursive) { Objects.requireNonNull(comparator); if (this.isLeaf()) { return; // nothing to sort } int j = getNumberOfChildren() - 1; int lastModified; while (j > 0) { lastModified = j + 1; j = -1; for (int i = 1; i < lastModified; ++i) { T child1 = getChildAt(i - 1).get(); T child2 = getChildAt(i).get(); if (comparator.compare(child1, child2) > 0) { child1.moveTo((T) this, i); j = i; } } } if (recursive) { for (T child : getChildren()) { child.sortChildren(comparator, true); } } } /** * Removes this node from its parent and makes it a child of the specified node * by adding it to the specified position in the children list. * In this way the whole subtree based at this node is moved to the given node. * * @param target the new parent * @param targetIndex the position where the children should be inserted * @throws NullPointerException if target is null * @throws ArrayIndexOutOfBoundsException if targetIndex is out of bounds * @throws UnsupportedOperationException if target is an descendant of this node */ public void moveTo(T target, int targetIndex) { Objects.requireNonNull(target); // Check that the target node is not an ancestor of this node, because this would create loops in the tree if (this.isAncestorOf(target)) { throw new UnsupportedOperationException("the target cannot be a descendant of this node"); } // Remove from previous parent Optional<T> oldParent = getParent(); if (oldParent.isPresent()) { oldParent.get().removeChild((T) this); } // Add as child target.addChild((T) this, targetIndex); } /** * Creates a deep copy of this node and all of its children. * * @return a deep copy of the subtree */ public T copySubtree() { T copy = copyNode(); for (T child : getChildren()) { child.copySubtree().moveTo(copy); } return copy; } /** * Creates a copy of this node, completely separated from the tree (i.e. no children and no parent) * * @return a deep copy of this node */ public abstract T copyNode(); /** * Adds the given function to the list of subscribers which are notified when something changes in the subtree. * * The following events are supported (the text in parentheses specifies which node is passed as the source): * - addChild (new parent) * - removeChild (old parent) * - move (old parent and new parent) * @param subscriber function to be invoked upon a change */ public void subscribeToDescendantChanged(Consumer<T> subscriber) { onDescendantChanged = onDescendantChanged.andThen(subscriber); } /** * Helper method which notifies all subscribers about a change in the subtree and bubbles the event to all parents. * @param source the node which changed */ protected void notifyAboutDescendantChange(T source) { onDescendantChanged.accept(source); if( !isRoot()) { parent.notifyAboutDescendantChange(source); } } }
bartsch-dev/jabref
src/main/java/org/jabref/model/TreeNode.java
Java
mit
21,094
package com.foxrouter.api; import com.yunhuwifi.RouterContext; import com.yunhuwifi.handlers.JsonCallBack; import android.accounts.NetworkErrorException; import android.content.Context; import android.net.wifi.WifiManager; import android.text.format.Formatter; public class RouterModuleDetect extends RouterModule { public RouterModuleDetect(RouterContext context) { super(context); super.setModule("detect"); } public void isSupportedRouter(Context context, JsonCallBack<? extends Object> callback) throws NetworkErrorException { WifiManager wifiManager = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); if (wifiManager.isWifiEnabled()) { String ipaddr = Formatter .formatIpAddress(wifiManager.getDhcpInfo().serverAddress); if (routerContext == null) { routerContext = new RouterContext(); } routerContext.setIPAndPort(ipaddr, 80); super.execute("status", null, callback); } else { throw new NetworkErrorException("未开启手机Wifi."); } } public void autoDetect(Context context, JsonCallBack<? extends Object> callback) throws NetworkErrorException { WifiManager wifiManager = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); if (wifiManager.isWifiEnabled()) { String ipaddr = Formatter .formatIpAddress(wifiManager.getDhcpInfo().serverAddress); if (routerContext == null) { routerContext = new RouterContext(); } routerContext.setIPAndPort(ipaddr, 80); super.execute("status", null, callback); } else { throw new NetworkErrorException("未开启手机Wifi."); } } }
yunhuwifi/yunhuwifi-android-client
src/com/foxrouter/api/RouterModuleDetect.java
Java
mit
1,674
# frozen_string_literal: true require 'spec_helper' describe Gitlab::Analytics::CycleAnalytics::StageEvents::IssueCreated do it_behaves_like 'cycle analytics event' end
stoplightio/gitlabhq
spec/lib/gitlab/analytics/cycle_analytics/stage_events/issue_created_spec.rb
Ruby
mit
173
using System; namespace CSML { public delegate float Easer(float t); public enum EaseType { Linear = 0, QuadIn, QuadOut, QuadInOut, CubeIn, CubeOut, CubeInOut, BackIn, BackOut, BackInOut, ExpoIn, ExpoOut, ExpoInOut, SineIn, SineOut, SineInOut, ElasticIn, ElasticOut, ElasticInOut } public static class Ease { public static readonly Easer Linear = (t) => { return t; }; public static readonly Easer QuadIn = (t) => { return t * t; }; public static readonly Easer QuadOut = (t) => { return 1f - QuadIn(1f - t); }; public static readonly Easer QuadInOut = (t) => { return (t <= 0.5f) ? QuadIn(t * 2f) * 0.5f : QuadOut(t * 2f - 1f) * 0.5f + 0.5f; }; public static readonly Easer CubeIn = (t) => { return t * t * t; }; public static readonly Easer CubeOut = (t) => { return 1f - CubeIn(1f - t); }; public static readonly Easer CubeInOut = (t) => { return (t <= 0.5f) ? CubeIn(t * 2f) * 0.5f : CubeOut(t * 2f - 1f) * 0.5f + 0.5f; }; public static readonly Easer BackIn = (t) => { return t * t * (2.70158f * t - 1.70158f); }; public static readonly Easer BackOut = (t) => { return 1f - BackIn(1f - t); }; public static readonly Easer BackInOut = (t) => { return (t <= 0.5f) ? BackIn(t * 2f) * 0.5f : BackOut(t * 2f - 1f) * 0.5f + 0.5f; }; public static readonly Easer ElasticIn = (t) => { return 1f - ElasticOut(1f - t); }; public static readonly Easer ElasticOut = (t) => { return Calc.Pow(2f, -10f * t) * Calc.Sin((t - 0.075f) * (2f * Calc.PI) / 0.3f) + 1f; }; public static readonly Easer ElasticInOut = (t) => { return (t <= 0.5f) ? ElasticIn(t * 2f) * 0.5f : ElasticOut(t * 2f - 1f) * 0.5f + 0.5f; }; public static string ToString(Easer ease) { if (ease == Linear) return "Linear"; else if (ease == QuadIn) return "QuadIn"; else if (ease == QuadOut) return "QuadOut"; else if (ease == QuadInOut) return "QuadInOut"; else if (ease == CubeIn) return "CubeIn"; else if (ease == CubeOut) return "CubeOut"; else if (ease == CubeInOut) return "CubeInOut"; else if (ease == BackIn) return "BackIn"; else if (ease == BackOut) return "BackOut"; else if (ease == BackInOut) return "BackInOut"; else if (ease == ElasticIn) return "ElasticIn"; else if (ease == ElasticOut) return "ElasticOut"; else if (ease == ElasticInOut) return "ElasticInOut"; return null; } public static Easer FromString(string name) { EaseType type; if (Enum.TryParse(name, out type)) return FromType(type); return null; } public static Easer FromType(EaseType type) { switch (type) { case EaseType.Linear: return Linear; case EaseType.QuadIn: return QuadIn; case EaseType.QuadOut: return QuadOut; case EaseType.QuadInOut: return QuadInOut; case EaseType.CubeIn: return CubeIn; case EaseType.CubeOut: return CubeOut; case EaseType.CubeInOut: return CubeInOut; case EaseType.BackIn: return BackIn; case EaseType.BackOut: return BackOut; case EaseType.BackInOut: return BackInOut; case EaseType.ElasticIn: return ElasticIn; case EaseType.ElasticOut: return ElasticOut; case EaseType.ElasticInOut: return ElasticInOut; default: return Linear; } } public static float Arc(float t, Easer ease) { if (t < 0.5f) return 1f - ease(1f - t * 2f); return 1f - ease((t - 0.5f) * 2f); } } }
ChevyRay/CSML
CSML/Source/Math/Ease.cs
C#
mit
4,160
// // Created by agondek on 12/01/16. // #ifndef GUT_MONTE_CARLO_TREE_SEARCH_WITHUCTSORTROOTPARALLELIZATION_H #define GUT_MONTE_CARLO_TREE_SEARCH_WITHUCTSORTROOTPARALLELIZATION_H #include "../MctsCommon.h" #include "../games/IGameState.h" #include "../tree/Node.h" #include "../utils/OmpHelpers.h" namespace Mcts { namespace Playouts { std::string getBestMoveUsingUctSortRootParallelization( Mcts::GameStates::IGameState* rootState, int maximumIterations); } } #endif //GUT_MONTE_CARLO_TREE_SEARCH_WITHUCTSORTROOTPARALLELIZATION_H
AleksanderGondek/GUT_Monte_Carlo_Tree_Search
source/playouts/WithUctSortRootParallelization.h
C
mit
587
<?php class Demomap { protected $_db; public function __construct(Database $db) { $this->_db = $db; } public function getEffectsByDemo($id) { $params = array( ':id' => $id); $sql = "SELECT * FROM demos_has_effects WHERE demo_id = :id"; $data = $this->_db->select($sql,$params); return $data; } public function getEffectTagByID($id) { $params = array( ':id' => $id); $sql = "SELECT * FROM effects WHERE id = :id"; $data = $this->_db->selectSingle($sql,$params); return $data; } public function getEventsByGeolocation($lat,$lng) { $params = array( ':lat' => $lat, ':lng' => $lng); $sql = "SELECT * FROM events WHERE lat = :lat AND lng = :lng"; $data = $this->_db->select($sql,$params); return $data; } public function getDemosFromEvent($id) { $params = array( ':id' => $id); $sql = "SELECT * FROM demos WHERE events_id = :id"; $data = $this->_db->select($sql,$params); return $data; } public function getAllEventsGroupedByGeolocation() { $locations = array(); $sql = "SELECT DISTINCT lat,lng,city,country FROM events"; $results = $this->_db->select($sql); foreach ($results as $result) { $lat = $result['lat']; $lng = $result['lng']; $city = $result['city']; $country = $result['country']; $events = $this->getEventsByGeolocation($lat,$lng); $location_set = array('lat' => $lat, 'lng' => $lng, 'city' => $city, 'country' => $country, 'events' => $events); array_push($locations, $location_set); } return $locations; } } ?>
gopeter/demomap
frontend/lib/php/demomap.class.php
PHP
mit
1,706
# XeroAPI\XeroPHP\IdentityApi All URIs are relative to *https://api.xero.com* Method | HTTP request | Description ------------- | ------------- | ------------- [**deleteConnection**](IdentityApi.md#deleteConnection) | **DELETE** /Connections/{id} | Deletes a connection for this user (i.e. disconnect a tenant) [**getConnections**](IdentityApi.md#getConnections) | **GET** /Connections | Retrieves the connections for this user # **deleteConnection** > deleteConnection($id) Deletes a connection for this user (i.e. disconnect a tenant) Override the base server url that include version ### Example ```php <?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: OAuth2 $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new XeroAPI\XeroPHP\Api\IdentityApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = 'id_example'; // string | Unique identifier for retrieving single object try { $apiInstance->deleteConnection($id); } catch (Exception $e) { echo 'Exception when calling IdentityApi->deleteConnection: ', $e->getMessage(), PHP_EOL; } ?> ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | [**string**](../Model/.md)| Unique identifier for retrieving single object | ### Return type void (empty response body) ### Authorization [OAuth2](../../README.md#OAuth2) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) # **getConnections** > \XeroAPI\XeroPHP\Models\Identity\Connection[] getConnections($auth_event_id) Retrieves the connections for this user Override the base server url that include version ### Example ```php <?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure OAuth2 access token for authorization: OAuth2 $config = XeroAPI\XeroPHP\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new XeroAPI\XeroPHP\Api\IdentityApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $auth_event_id = 00000000-0000-0000-0000-000000000000; // string | Filter by authEventId try { $result = $apiInstance->getConnections($auth_event_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling IdentityApi->getConnections: ', $e->getMessage(), PHP_EOL; } ?> ``` ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **auth_event_id** | [**string**](../Model/.md)| Filter by authEventId | [optional] ### Return type [**\XeroAPI\XeroPHP\Models\Identity\Connection[]**](../Model/Connection.md) ### Authorization [OAuth2](../../README.md#OAuth2) ### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
unaio/una
modules/boonex/xero/plugins/xeroapi/xero-php-oauth2/doc/identity/Api/IdentityApi.md
Markdown
mit
3,577
#!/bin/bash # # Generate the announce template # # Completely copy/paste of Xorg/util/modular/release.sh: # # Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice (including the next # paragraph) shall be included in all copies or substantial portions of the # Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. export LC_ALL=C #------------------------------------------------------------------------------ # Function: check_local_changes #------------------------------------------------------------------------------ # check_local_changes() { git diff --quiet HEAD > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "" echo "Uncommitted changes found. Did you forget to commit? Aborting." echo "" echo "You can perform a 'git stash' to save your local changes and" echo "a 'git stash apply' to recover them after the tarball release." echo "Make sure to rebuild and run 'make distcheck' again." echo "" echo "Alternatively, you can clone the module in another directory" echo "and run ./configure. No need to build if testing was finished." echo "" return 1 fi return 0 } #------------------------------------------------------------------------------ # Function: check_option_args #------------------------------------------------------------------------------ # # perform sanity checks on cmdline args which require arguments # arguments: # $1 - the option being examined # $2 - the argument to the option # returns: # if it returns, everything is good # otherwise it exit's check_option_args() { option=$1 arg=$2 # check for an argument if [ x"$arg" = x ]; then echo "" echo "Error: the '$option' option is missing its required argument." echo "" usage exit 1 fi # does the argument look like an option? echo $arg | $GREP "^-" > /dev/null if [ $? -eq 0 ]; then echo "" echo "Error: the argument '$arg' of option '$option' looks like an option itself." echo "" usage exit 1 fi } #------------------------------------------------------------------------------ # Function: check_modules_specification #------------------------------------------------------------------------------ # check_modules_specification() { if [ x"$MODFILE" = x ]; then if [ x"${INPUT_MODULES}" = x ]; then echo "" echo "Error: no modules specified (blank command line)." usage exit 1 fi fi } #------------------------------------------------------------------------------ # Function: generate_announce #------------------------------------------------------------------------------ # generate_announce() { cat <<RELEASE Subject: [ANNOUNCE] $pkg_name $pkg_version To: $list_to Cc: $list_cc libratbag $tag_name is out. The list of interesting changes are: See the full log at the end if you are interested in the details. `git log --no-merges "$tag_range" | git shortlog` git tag: $tag_name RELEASE for tarball in $tarbz2 $targz $tarxz; do cat <<RELEASE The libratbag project does not generate tarballs for releases, you can grab one directly from github: https://github.com/libratbag/libratbag/archive/$tag_name/$tarball RELEASE done } #------------------------------------------------------------------------------ # Function: read_modfile #------------------------------------------------------------------------------ # # Read the module names from the file and set a variable to hold them # This will be the same interface as cmd line supplied modules # read_modfile() { if [ x"$MODFILE" != x ]; then # Make sure the file is sane if [ ! -r "$MODFILE" ]; then echo "Error: module file '$MODFILE' is not readable or does not exist." exit 1 fi # read from input file, skipping blank and comment lines while read line; do # skip blank lines if [ x"$line" = x ]; then continue fi # skip comment lines if echo "$line" | $GREP -q "^#" ; then continue; fi INPUT_MODULES="$INPUT_MODULES $line" done <"$MODFILE" fi return 0 } #------------------------------------------------------------------------------ # Function: print_epilog #------------------------------------------------------------------------------ # print_epilog() { epilog="======== Successful Completion" if [ x"$NO_QUIT" != x ]; then if [ x"$failed_modules" != x ]; then epilog="======== Partial Completion" fi elif [ x"$failed_modules" != x ]; then epilog="======== Stopped on Error" fi echo "" echo "$epilog `date`" # Report about modules that failed for one reason or another if [ x"$failed_modules" != x ]; then echo " List of failed modules:" for mod in $failed_modules; do echo " $mod" done echo "========" echo "" fi } #------------------------------------------------------------------------------ # Function: process_modules #------------------------------------------------------------------------------ # # Loop through each module to release # Exit on error if --no-quit was not specified # process_modules() { for MODULE_RPATH in ${INPUT_MODULES}; do if ! process_module ; then echo "Error: processing module \"$MODULE_RPATH\" failed." failed_modules="$failed_modules $MODULE_RPATH" if [ x"$NO_QUIT" = x ]; then print_epilog exit 1 fi fi done } #------------------------------------------------------------------------------ # Function: get_section #------------------------------------------------------------------------------ # Code 'return 0' on success # Code 'return 1' on error # Sets global variable $section get_section() { local module_url local full_module_url # Obtain the git url in order to find the section to which this module belongs full_module_url=`git config --get remote.$remote_name.url | sed 's:\.git$::'` if [ $? -ne 0 ]; then echo "Error: unable to obtain git url for remote \"$remote_name\"." return 1 fi # The last part of the git url will tell us the section. Look for xorg first echo "$full_module_url" module_url=`echo "$full_module_url" | $GREP -o "libratbag/.*"` if [ $? -eq 0 ]; then module_url=`echo $module_url | cut -d'/' -f2,3` else echo "Error: unable to locate a valid project url from \"$full_module_url\"." echo "Cannot establish url as one of libratbag" cd $top_src return 1 fi # Find the section (subdirs) where the tarballs are to be uploaded # The module relative path can be app/xfs, xserver, or mesa/drm for example section=`echo $module_url | cut -d'/' -f1` if [ $? -ne 0 ]; then echo "Error: unable to extract section from $module_url first field." return 1 fi return 0 } #------------------------------------------------------------------------------ # Function: process_module #------------------------------------------------------------------------------ # Code 'return 0' on success to process the next module # Code 'return 1' on error to process next module if invoked with --no-quit # process_module() { top_src=`pwd` echo "" echo "======== Processing \"$top_src/$MODULE_RPATH\"" # This is the location where the script has been invoked if [ ! -d $MODULE_RPATH ] ; then echo "Error: $MODULE_RPATH cannot be found under $top_src." return 1 fi # Change directory to be in the git module cd $MODULE_RPATH if [ $? -ne 0 ]; then echo "Error: failed to cd to $MODULE_RPATH." return 1 fi # ----- Now in the git module *root* directory ----- # # Check that this is indeed a git module if [ ! -d .git ]; then echo "Error: there is no git module here: `pwd`" return 1 fi # Change directory to be in the git build directory (could be out-of-source) # More than one can be found when distcheck has run and failed configNum=`find . -name config.status -type f | wc -l | sed 's:^ *::'` if [ $? -ne 0 ]; then echo "Error: failed to locate config.status." echo "Has the module been configured?" return 1 fi if [ x"$configNum" = x0 ]; then echo "Error: failed to locate config.status, has the module been configured?" return 1 fi if [ x"$configNum" != x1 ]; then echo "Error: more than one config.status file was found," echo " clean-up previously failed attempts at distcheck" return 1 fi status_file=`find . -name config.status -type f` if [ $? -ne 0 ]; then echo "Error: failed to locate config.status." echo "Has the module been configured?" return 1 fi build_dir=`dirname $status_file` cd $build_dir if [ $? -ne 0 ]; then echo "Error: failed to cd to $MODULE_RPATH/$build_dir." cd $top_src return 1 fi # ----- Now in the git module *build* directory ----- # # Check for uncommitted/queued changes. check_local_changes if [ $? -ne 0 ]; then cd $top_src return 1 fi # Determine what is the current branch and the remote name current_branch=`git branch | $GREP "\*" | sed -e "s/\* //"` remote_name=`git config --get branch.$current_branch.remote` remote_branch=`git config --get branch.$current_branch.merge | cut -d'/' -f3,4` remote_url_root="https://github.com/libratbag/libratbag/archive" echo "Info: working off the \"$current_branch\" branch tracking the remote \"$remote_name/$remote_branch\"." # Obtain the section get_section if [ $? -ne 0 ]; then cd $top_src return 1 fi # Run 'make dist/distcheck' to ensure the tarball matches the git module content # Important to run make dist/distcheck before looking in Makefile, may need to reconfigure echo "Info: running \"make $MAKE_DIST_CMD\" to create tarballs:" ${MAKE} $MAKEFLAGS $MAKE_DIST_CMD > /dev/null if [ $? -ne 0 ]; then echo "Error: \"$MAKE $MAKEFLAGS $MAKE_DIST_CMD\" failed." cd $top_src return 1 fi # Find out the tarname from the makefile pkg_name=`$GREP '^PACKAGE = ' Makefile | sed 's|PACKAGE = ||'` pkg_version=`$GREP '^VERSION = ' Makefile | sed 's|VERSION = ||'` tar_name="$pkg_name-$pkg_version" targz=$tar_name.tar.gz tag_name=$(echo "v$pkg_version" | sed 's|.0$||') # Now get the tarballs from github directly to compute their checksum remote_targz_url=$remote_url_root/$tag_name/$targz echo "downloading the tarbal from $remote_targz_url" curl $remote_targz_url > $targz # Obtain the top commit SHA which should be the version bump # It should not have been tagged yet (the script will do it later) local_top_commit_sha=`git rev-list --max-count=1 HEAD` if [ $? -ne 0 ]; then echo "Error: unable to obtain the local top commit id." cd $top_src return 1 fi # Check that the top commit looks like a version bump git diff --unified=0 HEAD^ | $GREP -F $pkg_version >/dev/null 2>&1 if [ $? -ne 0 ]; then # Wayland repos use m4_define([wayland_major_version], [0]) git diff --unified=0 HEAD^ | $GREP -E "(major|minor|micro)_version" >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "Error: the local top commit does not look like a version bump." echo " the diff does not contain the string \"$pkg_version\"." local_top_commit_descr=`git log --oneline --max-count=1 $local_top_commit_sha` echo " the local top commit is: \"$local_top_commit_descr\"" cd $top_src return 1 fi fi # Check that the top commit has been pushed to remote remote_top_commit_sha=`git rev-list --max-count=1 $remote_name/$remote_branch` if [ $? -ne 0 ]; then echo "Error: unable to obtain top commit from the remote repository." cd $top_src return 1 fi if [ x"$remote_top_commit_sha" != x"$local_top_commit_sha" ]; then echo "Error: the local top commit has not been pushed to the remote." local_top_commit_descr=`git log --oneline --max-count=1 $local_top_commit_sha` echo " the local top commit is: \"$local_top_commit_descr\"" cd $top_src return 1 fi # If a tag exists with the the tar name, ensure it is tagging the top commit # It may happen if the version set in configure.ac has been previously released tagged_commit_sha=`git rev-list --max-count=1 $tag_name 2>/dev/null` if [ $? -eq 0 ]; then # Check if the tag is pointing to the top commit if [ x"$tagged_commit_sha" != x"$remote_top_commit_sha" ]; then echo "Error: the \"$tag_name\" already exists." echo " this tag is not tagging the top commit." remote_top_commit_descr=`git log --oneline --max-count=1 $remote_top_commit_sha` echo " the top commit is: \"$remote_top_commit_descr\"" local_tag_commit_descr=`git log --oneline --max-count=1 $tagged_commit_sha` echo " tag \"$tag_name\" is tagging some other commit: \"$local_tag_commit_descr\"" cd $top_src return 1 else echo "Info: module already tagged with \"$tag_name\"." fi else # Tag the top commit with the tar name if [ x"$DRY_RUN" = x ]; then git tag -s -m $tag_name $tag_name if [ $? -ne 0 ]; then echo "Error: unable to tag module with \"$tag_name\"." cd $top_src return 1 else echo "Info: module tagged with \"$tag_name\"." fi else echo "Info: skipping the commit tagging in dry-run mode." fi fi # Mailing lists where to post the all [Announce] e-mails list_to="input-tools@lists.freedesktop.org" # Pushing the top commit tag to the remote repository if [ x$DRY_RUN = x ]; then echo "Info: pushing tag \"$tag_name\" to remote \"$remote_name\":" git push $remote_name $tag_name if [ $? -ne 0 ]; then echo "Error: unable to push tag \"$tag_name\" to the remote repository." echo " it is recommended you fix this manually and not run the script again" cd $top_src return 1 fi else echo "Info: skipped pushing tag \"$tag_name\" to the remote repository in dry-run mode." fi # --------- Generate the announce e-mail ------------------ # Failing to generate the announce is not considered a fatal error # Git-describe returns only "the most recent tag", it may not be the expected one # However, we only use it for the commit history which will be the same anyway. tag_previous=`git describe --abbrev=0 HEAD^ 2>/dev/null` # Git fails with rc=128 if no tags can be found prior to HEAD^ if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then echo "Warning: unable to find a previous tag." echo " perhaps a first release on this branch." echo " Please check the commit history in the announce." fi fi if [ x"$tag_previous" != x ]; then # The top commit may not have been tagged in dry-run mode. Use commit. tag_range=$tag_previous..$local_top_commit_sha else tag_range=$tag_name fi generate_announce > "$tar_name.announce" echo "Info: [ANNOUNCE] template generated in \"$tar_name.announce\" file." echo " Please pgp sign and send it." # --------- Successful completion -------------------------- cd $top_src return 0 } #------------------------------------------------------------------------------ # Function: usage #------------------------------------------------------------------------------ # Displays the script usage and exits successfully # usage() { basename="`expr "//$0" : '.*/\([^/]*\)'`" cat <<HELP Usage: $basename [options] path... Where "path" is a relative path to a git module, including '.'. Options: --dist make 'dist' instead of 'distcheck'; use with caution --distcheck Default, ignored for compatibility --dry-run Does everything except tagging and uploading tarballs --force Force overwriting an existing release --help Display this help and exit successfully --no-quit Do not quit after error; just print error message Environment variables defined by the "make" program and used by release.sh: MAKE The name of the make command [make] MAKEFLAGS: Options to pass to all \$(MAKE) invocations HELP } #------------------------------------------------------------------------------ # Script main line #------------------------------------------------------------------------------ # # Choose which make program to use (could be gmake) MAKE=${MAKE:="make"} # Choose which grep program to use (on Solaris, must be gnu grep) if [ "x$GREP" = "x" ] ; then if [ -x /usr/gnu/bin/grep ] ; then GREP=/usr/gnu/bin/grep else GREP=grep fi fi # Set the default make tarball creation command MAKE_DIST_CMD=distcheck # Process command line args while [ $# != 0 ] do case $1 in # Use 'dist' rather than 'distcheck' to create tarballs # You really only want to do this if you're releasing a module you can't # possibly build-test. Please consider carefully the wisdom of doing so. --dist) MAKE_DIST_CMD=dist ;; # Use 'distcheck' to create tarballs --distcheck) MAKE_DIST_CMD=distcheck ;; # Does everything except uploading tarball --dry-run) DRY_RUN=yes ;; # Force overwriting an existing release # Use only if nothing changed in the git repo --force) FORCE=yes ;; # Display this help and exit successfully --help) usage exit 0 ;; # Do not quit after error; just print error message --no-quit) NO_QUIT=yes ;; --*) echo "" echo "Error: unknown option: $1" echo "" usage exit 1 ;; -*) echo "" echo "Error: unknown option: $1" echo "" usage exit 1 ;; *) if [ x"${MODFILE}" != x ]; then echo "" echo "Error: specifying both modules and --modfile is not permitted" echo "" usage exit 1 fi INPUT_MODULES="${INPUT_MODULES} $1" ;; esac shift done # If no modules specified (blank cmd line) display help check_modules_specification # Read the module file and normalize input in INPUT_MODULES read_modfile # Loop through each module to release # Exit on error if --no-quit no specified process_modules # Print the epilog with final status print_epilog
cvuchener/libratbag
release.sh
Shell
mit
18,923
// change these variables var data_source_name = ""; // end changes if(a=="view"){ (function (u,c,p,a,r,q) { if (!utag.ut) utag.ut = {}; r = function (w, x, y, z) { // read cookie x = w + "="; y = document.cookie.split(';'); for (var i = 0; i < y.length; i++) { z = y[i]; while (z.charAt(0) == ' ') z = z.substring(1, z.length); if (z.indexOf(x) == 0) return z.substring(x.length, z.length); } return ""; }; q = function (x, y, z) { // set cookie if (typeof z == "number") z = new Date(z); document.cookie = x + "=" + y + ";path=/;domain=" + utag.cfg.domain + ";expires=" + (z?z.toGMTString():""); //b["cp."+x] = y; // add cookie to udo }; utag.ut.hppv = function (w,x,y,z,r,q,c) { if (!utag.ut.getPPVid) return; c = "utag_ppv"; r = function (w, x, y, z) { // read cookie x = w + "="; y = document.cookie.split(';'); for (var i = 0; i < y.length; i++) { z = y[i]; while (z.charAt(0) == ' ') z = z.substring(1, z.length); if (z.indexOf(x) == 0) return z.substring(x.length, z.length); } return ""; }; q = function (x, y, z) { // set cookie if (typeof z == "number") z = new Date(z); document.cookie = x + "=" + y + ";path=/;domain=" + utag.cfg.domain + ";expires=" + (z?z.toGMTString():""); //b["cp."+x] = y; // add cookie to udo }; w = Math.max( Math.max(document.body.scrollHeight, document.documentElement.scrollHeight), Math.max(document.body.offsetHeight, document.documentElement.offsetHeight), Math.max(document.body.clientHeight, document.documentElement.clientHeight) ), x = (window.pageYOffset || (document.documentElement.scrollTop || document.body.scrollTop)) +(window.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight)); y = Math.min(Math.round(x / w * 100), 100); z = (r(c).indexOf(',') > -1) ? r(c).split(',', 4) : []; q(c, ((y > 0) ? (((z.length > 0) ? (z[0]) : escape(utag.ut.getPPVid)) + ',' + ((y > ((z.length > 1) ? parseInt(z[1]) : (0))) ? y : ((z.length > 1) ? parseInt(z[1]) : (0))) + ',' + ((z.length > 2) ? parseInt(z[2]) : (y)) + ',' + ((x > ((z.length > 3) ? parseInt(z[3]) : (0))) ? x : ((z.length > 3) ? parseInt(z[3]) : (0)))) : '')); }; c = "utag_ppv"; p = p ? p : '-'; a = (r(c).indexOf(',') > -1) ? r(c).split(',', 4) : []; if (a.length < 4) { for (i=3; i>0; i--) { a[i] = (i < a.length) ? (a[i - 1]) : (''); } a[0] = ''; } a[0] = unescape(a[0]); q(c, escape(p)); if (!utag.ut.getPPVid) { utag.ut.getPPVid = (p) ? (p) : document.location.href; q(c, escape(utag.ut.getPPVid)); if (window.addEventListener) { window.addEventListener('load', utag.ut.hppv, false); window.addEventListener('scroll', utag.ut.hppv, false); window.addEventListener('resize', utag.ut.hppv, false); } else if (window.attachEvent) { window.attachEvent('onload', utag.ut.hppv); window.attachEvent('onscroll', utag.ut.hppv); window.attachEvent('onresize', utag.ut.hppv); } } b[u] = (p != '-') ? (a) : (a[1]); })(data_source_name); }
runfaj/inteliquant
Tealium TMS/percent_page_viewed.js
JavaScript
mit
3,974
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_20) on Mon May 02 10:23:15 CEST 2011 --> <TITLE> Uses of Class play.libs.F.Tuple (Play! API) </TITLE> <META NAME="date" CONTENT="2011-05-02"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class play.libs.F.Tuple (Play! API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?play/libs//class-useF.Tuple.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="F.Tuple.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H2> <B>Uses of Class<br>play.libs.F.Tuple</B></H2> </CENTER> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Packages that use <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><A HREF="#play.libs"><B>play.libs</B></A></TD> <TD>&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <A NAME="play.libs"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> Uses of <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A> in <A HREF="../../../play/libs/package-summary.html">play.libs</A></FONT></TH> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Subclasses of <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A> in <A HREF="../../../play/libs/package-summary.html">play.libs</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;class</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../play/libs/F.T2.html" title="class in play.libs">F.T2&lt;A,B&gt;</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../play/libs/package-summary.html">play.libs</A> that return <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;A,B&gt; <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A>&lt;A,B&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>F.</B><B><A HREF="../../../play/libs/F.html#Tuple(A, B)">Tuple</A></B>(A&nbsp;a, B&nbsp;b)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left" COLSPAN="2">Methods in <A HREF="../../../play/libs/package-summary.html">play.libs</A> that return types with arguments of type <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY=""> <TR ALIGN="right" VALIGN=""> <TD NOWRAP><FONT SIZE="-1"> <CODE>&lt;A,B&gt; <A HREF="../../../play/libs/F.Promise.html" title="class in play.libs">F.Promise</A>&lt;<A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs">F.Tuple</A>&lt;A,B&gt;&gt;</CODE></FONT></TD> </TR> </TABLE> </CODE></FONT></TD> <TD><CODE><B>F.Promise.</B><B><A HREF="../../../play/libs/F.Promise.html#wait2(play.libs.F.Promise, play.libs.F.Promise)">wait2</A></B>(<A HREF="../../../play/libs/F.Promise.html" title="class in play.libs">F.Promise</A>&lt;A&gt;&nbsp;tA, <A HREF="../../../play/libs/F.Promise.html" title="class in play.libs">F.Promise</A>&lt;B&gt;&nbsp;tB)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <P> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../play/libs/F.Tuple.html" title="class in play.libs"><FONT CLASS="NavBarFont1"><B>Class</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Use</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?play/libs//class-useF.Tuple.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="F.Tuple.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <a href="http://guillaume.bort.fr">Guillaume Bort</a> &amp; <a href="http://www.zenexity.fr">zenexity</a> - Distributed under <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2 licence</a>, without any warrantly </BODY> </HTML>
lafayette/JBTT
framework/documentation/api/play/libs/class-use/F.Tuple.html
HTML
mit
9,616
<?php /* * Go! AOP framework * * @copyright Copyright 2013, Lisachenko Alexander <lisachenko.it@gmail.com> * * This source file is subject to the license that is bundled * with this source code in the file LICENSE. */ namespace Go\Console\Command; use Go\Core\AspectKernel; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; /** * Base command for all aspect commands */ class BaseAspectCommand extends Command { /** * Stores an instance of aspect kernel * * @var null|AspectKernel */ protected $aspectKernel = null; /** * {@inheritDoc} */ protected function configure() { $this->addArgument('loader', InputArgument::REQUIRED, "Path to the aspect loader file"); } /** * {@inheritDoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $loader = $input->getArgument('loader'); $path = stream_resolve_include_path($loader); if (!is_readable($path)) { throw new \InvalidArgumentException("Invalid loader path: {$loader}"); } include_once $path; if (!class_exists(AspectKernel::class, false)) { $message = "Kernel was not initialized yet, please configure it in the {$path}"; throw new \InvalidArgumentException($message); } $this->aspectKernel = AspectKernel::getInstance(); } }
mokuben/project_one
fuel/vendor/goaop/framework/src/Console/Command/BaseAspectCommand.php
PHP
mit
1,564
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.11"/> <title>V8 API Reference Guide for node.js v7.9.0: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { init_search(); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">V8 API Reference Guide for node.js v7.9.0 </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.11 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main&#160;Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class&#160;List</span></a></li> <li><a href="classes.html"><span>Class&#160;Index</span></a></li> <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li> <li><a href="functions.html"><span>Class&#160;Members</span></a></li> </ul> </div> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1Module.html">Module</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">v8::Module Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classv8_1_1Module.html">v8::Module</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classv8_1_1Module.html#a0785fa83cd3dde1dee086e1f9d31abdc">Evaluate</a>(Local&lt; Context &gt; context)</td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>GetEmbedderData</b>() const (defined in <a class="el" href="classv8_1_1Module.html">v8::Module</a>)</td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classv8_1_1Module.html#a7938d660e0a8024cc64423aae609c719">GetModuleRequest</a>(int i) const </td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classv8_1_1Module.html#a67333933f6b82703962102f72ec81937">GetModuleRequestsLength</a>() const </td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classv8_1_1Module.html#af3f4846a04a46b7b9ab4bf7ba83e8636">Instantiate</a>(Local&lt; Context &gt; context, ResolveCallback callback, Local&lt; Value &gt; callback_data=Local&lt; Value &gt;())</td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>ResolveCallback</b> typedef (defined in <a class="el" href="classv8_1_1Module.html">v8::Module</a>)</td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>SetEmbedderData</b>(Local&lt; Value &gt; data) (defined in <a class="el" href="classv8_1_1Module.html">v8::Module</a>)</td><td class="entry"><a class="el" href="classv8_1_1Module.html">v8::Module</a></td><td class="entry"></td></tr> </table></div><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated by &#160;<a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.11 </small></address> </body> </html>
v8-dox/v8-dox.github.io
9f73df5/html/classv8_1_1Module-members.html
HTML
mit
6,330
<?php namespace MandarinMedien\MMCmfContentBundle\Form\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class HeadlineType extends AbstractType { public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'choices' => array( 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6' ) )); } public function getParent() { return ChoiceType::class; } }
Mandarin-Medien/MMCmfContentBundle
Form/Type/HeadlineType.php
PHP
mit
758
--- layout: post title: Feminism and gender equality bestof: true --- I've been thinking a lot over the last few months about equality, specifically gender equality. There's been so much talk about it in the tech-sphere that's it's been difficult to avoid. I've been thinking about how close we are to gender equality and how I can help move us toward that goal, but also about what to call it. Over the last year or so I've been asked a number of times if I'm a feminist (to which I normally respond "no"), or even had people go so far as to tell me I am one. 'Feminist' is not a label I'd willingly give myself, and increasingly it's not one I'll willingly accept being applied to me. Those that apply the feminist label to me do so because a subset of my beliefs, specifically those surrounding gender equality, are the same as their understanding of what feminism is. I believe that broadly speaking gender should not be a differentiator in most situations. That doesn't make me a feminist. All it does, if anything, is provide evidence that I'm a decent human being. I don't think that assigning labels like feminist to people is a particularly nice thing to do, and I certainly don't think it's helpful. I could just as easily pick out a subset of someone's beliefs and call them a Christian as a result, not something that most people would take kindly to. Labelling people aside, I'd like to talk about why I don't self identify as a feminist. Contrary to the term 'gender equality', 'feminist' is ambiguous, unbounded and gendered. If you were to go and ask a large number of people what they think feminism is I suspect you'll get a wide range of answers. Some might even contradict each other, which isn't surprising given the broadness of the term. 'Gender equality' is specific and unambiguous in it's meaning and interpretation, and it's bounded to one problem in society. It's not a term that can grow or change over time, gender equality is all genders being equal in society, with equal opportunity for change given to the specific problems of any gender, without focus on one. Feminism, historically, has been a movement by women, for women. It's a movement born of a time of horrific inequality, a time where basic rights were denied to half the population for no reason. Feminism started the conversation about gender equality, and for that I will be eternally grateful. We would not be where we are today without feminism. But I don't believe that a movement dominated by a single gender can keep us on the right path. A movement of female voices is unlikely to speak for the issues men face, such as suicide rates, depression and the cultural pressure to be the main provider in a household. Feminism has caused the socially acceptable roles of women to change and broaden drastically, but the roles of men have barely changed. I think it's time to move on from feminism, and go forwards with a new idea and a new movement that's more accessible to everyone. Having a movement with the root word "female" is like hanging a massive sign saying "men not welcome". And that's fine. If you want a dude-free place to talk about women's issues go for it, but it seems unreasonable to me to expect that to stand for equal rights for all genders if half the population doesn't even have a voice.
samhutchins/samhutchins.github.io
_posts/2015-06-12-feminism-and-gender-equality.md
Markdown
mit
3,316
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="description" content=""> <meta name="author" content="Oleksandr Vladymyrov"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="shortcut icon" href="img/favicon.png"> <title>FaceBook share dialog</title> <!-- Bootstrap core CSS --> <link href="bootstrap/dist/css/bootstrap.css" rel="stylesheet"> <script src="js/jquery/jquery.js"></script> <script src="bootstrap/dist/js/bootstrap.js"></script> <script src="fbsharedialog.js/fbsharedialog.js"></script> <link href="fbsharedialog.js/fbsharedialog.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body> <div id="info"></div> <div id="fb-root"></div> <ul> <li>Status: <span id="login-status">Not logged in</span> | <a href="#" id="btnLogin" class="btn btn-success">Login</a> | <a href="#" id="btnLogout" class="btn btn-danger">Log out</a> </li> <span> You'll need to log in first </span> <br/> <li><a href="#" id="btnSelect9" class="btn btn-info run disabled active" role="button">Select friend - auto</a></li> <li><a href="#" id="btnSelect1" class="btn btn-info run disabled" role="button">Select friend - touch</a></li> <li><a href="#" id="btnSelect2" class="btn btn-info run disabled" role="button">Select friend - popup</a></li> <li><a href="#" id="btnSelect3" class="btn btn-info run disabled" role="button">Select friend - dialog</a></li> <li><a href="#" id="btnSelect4" class="btn btn-info run disabled" role="button">Select friend - iframe</a></li> <li><a href="#" id="btnSelect5" class="btn btn-info run disabled" role="button">Select friend - page</a></li> </ul> <div id="results"> <p>ACTIVITY LOG</p> </div> <!-- Markup for These Days Friend Selector --> <div id="FBShareDialog"> <div class="FBShareDialog_dialog"> <a href="#" id="FBShareDialog_buttonClose" class="FBShareDialog_button"> <span class="visible-xs">Cancel</span> <span class="hidden-xs">&times;</span> </a> <a href="#" id="FBShareDialog_buttonOK" class="FBShareDialog_button visible-xs">Share</a> <div class="FBShareDialog_form"> <div class="FBShareDialog_header"> <p>Post to wall</p> </div> <div class="FBShareDialog_content"> <div class="FBShareDialog_searchContainer FBShareDialog_clearfix"> <span class="FBShareDialog_selectedNameContainer">Please make your choice</span> <input type="text" placeholder="Search friends" id="FBShareDialog_searchField"/> </div> <div class="FBShareDialog_friendsContainer"></div> <div class="FBShareDialog_Iframe hidden-xs"> <div class="FBShareDialog_Iframe_loading"> <img src="img/loading.gif" alt="Loading ..."/> <iframe id="Iframe" width="100%" height="310px" frameborder="no" seamless=""></iframe> </div> </div> </div> </div> </div> </div> <!-- Bootstrap core JavaScript ================================================== --> <!-- Placed at the end of the document so the pages load faster --> <script src="fbsharedialog.js/example.js"></script> </body> </html>
OleksandrVladymyrov/FBShareDialog
index.html
HTML
mit
3,709
#!/usr/bin/env bash coverage run manage.py test --keepdb \ && coverage html \ && coverage report
iMerica/django-react-uncool
test.sh
Shell
mit
97
<?php /* * This file is part of PHPExifTool. * * (c) 2012 Romain Neutron <imprec@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPExiftool\Driver\Tag\RealRA4; use JMS\Serializer\Annotation\ExclusionPolicy; use PHPExiftool\Driver\AbstractTag; /** * @ExclusionPolicy("all") */ class Copyright extends AbstractTag { protected $Id = 28; protected $Name = 'Copyright'; protected $FullName = 'Real::AudioV4'; protected $GroupName = 'Real-RA4'; protected $g0 = 'Real'; protected $g1 = 'Real-RA4'; protected $g2 = 'Audio'; protected $Type = 'string'; protected $Writable = false; protected $Description = 'Copyright'; protected $local_g2 = 'Author'; }
romainneutron/PHPExiftool
lib/PHPExiftool/Driver/Tag/RealRA4/Copyright.php
PHP
mit
817
<a name="eFileType"></a> ## eFileType : <code>enum</code> Enum with a `type` value, no individual property descriptions. **Kind**: global enum **Read only**: true **Properties** | Name | Type | Default | | --- | --- | --- | | NOEXIST | <code>number</code> | <code>0</code> | | FILE | <code>number</code> | <code>1</code> | | DIR | <code>number</code> | <code>2</code> | <a name="eType"></a> ## eType enum, no type, property descriptions. **Kind**: global enum **Properties** | Name | Default | Description | | --- | --- | --- | | ONE | <code>1</code> | type one | | TWO | <code>2</code> | type two | <a name="eFunction"></a> ## eFunction enum function! It has a kind of 'member' not 'function'. **Kind**: global enum <a name="eFunction2"></a> ## eFunction2 : <code>enum</code> enum function, type, properties **Kind**: global enum **Properties** | Name | Type | Description | | --- | --- | --- | | ONE | <code>number</code> | first | | TWO | <code>number</code> | second | <a name="normalFunction"></a> ## normalFunction() normal function.. **Kind**: global function
jsdoc2md/testbed
build/jsdoc/global/enum/3-dmd.md
Markdown
mit
1,098
using UnityEngine; using System.Collections; public class DialoguePlayer : MonoBehaviour { public DialogueConversation conversation = null; public TextMesh displayMesh = null; public Transform ModelTransfrom; public int lineIndex = -1; void Start() { nextLine(); } void Update() { if (Input.GetKeyDown(KeyCode.Space)) { nextLine(); } } private void nextLine() { lineIndex++; if (conversation != null && conversation.Lines != null && conversation.Lines.Count > lineIndex) { if (displayMesh != null) { displayMesh.text = conversation.Lines[lineIndex].Speaker + ": " + conversation.Lines[lineIndex].Text; } if (ModelTransfrom != null) { int childCount = ModelTransfrom.childCount; for (int i = 0; i < childCount; i ++) { DestroyImmediate(ModelTransfrom.GetChild(i).gameObject); } GameObject o = Instantiate(conversation.Lines[lineIndex].obj); o.transform.parent = ModelTransfrom; o.transform.localPosition = Vector3.zero; } } } }
289997171/UnityCustomEditorSeriesExamples
Assets/Examples/D) Custom Assets/Scripts/DialoguePlayer.cs
C#
mit
1,285
import ValidationHandler from 'src/handler/ValidationHandler.js' import { EventMapping } from 'src/helper/EventMapping.js' //import jquery from 'jquery' import jquery from 'libs/jquery-3.4.1.dev.js'; import { CharacterClassOptions } from 'src/model/page/CharacterClassOptions.js' import { ArraySet } from 'src/model/ArraySet.js' import { AttributeScores, FREEPOINTS_NAME, SCORES_NAME } from 'src/model/page/AttributeScores.js' import { ATTRIBUTES_NAME } from './AttributeScores' export var CHARACTER_UPDATE_ATTRIBS = ['success', 'character'] export var CHARACTER_DATA_ATTRIBS = ['charname', 'pos_x', 'pos_y', 'health', 'charclass', 'free_points', 'attributes'] // 2 arrays of the same length to allow looping for creating each line of the table // Fortitude, Intellect, Awareness, Arcana, Agility // TODO This does not belong in the model, refactor/dynamically generate! export const EVENTS = { SET_DETAILS: 'set-details', // For full setter calls CONFIRM_DETAILS: 'confirm-details', // For first-time setting of stats, in response to server confirmation SET_ATTRIB_SCORES: 'set-attribute-scores', //Any attrib score updates SET_CLASS_OPTIONS: 'set-class-options' // Any class option update } const INVALID_CHAR_UPDATE_DATA_ERROR = 'Character update data is invalid: ' // TODO Remove this export var CLASS_OPTIONS = [ { id: 'fighter', text: 'Fighter' }, { id: 'spellcaster', text: 'Spellcaster' } ] export const CHARACTER_JSON_NAME = 'character' export const ATTRIBUTES_JSON_NAME = 'attributes' export const CHARNAME_JSON_NAME = 'charname' export const POSITION_JSON_NAME = 'position' export const POSITION_X_JSON_NAME = 'pos_x' export const POSITION_Y_JSON_NAME = 'pos_y' export const HEALTH_JSON_NAME = 'health' export const CHARCLASS_JSON_NAME = 'charclass' export default class CharacterDetails extends EventMapping { constructor (characterClassOptions, attributeScores, minScoreValue, maxScoreValue, posX, posY, health, freePoints) { super(EVENTS) if (characterClassOptions === undefined || !characterClassOptions instanceof CharacterClassOptions) { throw new RangeError('Character class options required!') } if (attributeScores === undefined) { throw new RangeError('Attribute scores JSON required!') } if (minScoreValue === undefined) { throw new RangeError('Minimum attribute score value required!') } if (maxScoreValue === undefined) { a throw new RangeError('Maximum attribute score value required!') } if (posX === undefined || posY === undefined) { throw new RangeError('Position attributes posX and posY are required!') } if (health === undefined) { throw new RangeError('Character health value required!') } if (freePoints === undefined) { throw new RangeError('Free attribute points value required!') } // Boolean to check if us/the user has confirmed these to be set correctly this.charname = ''; this.charclass = ''; this.posX = posX; this.posY = posY; this.health = health; this.attributeClassOptions = characterClassOptions; this.defaultAttributeScores = new AttributeScores(attributeScores, minScoreValue, maxScoreValue, freePoints); this.attributeScores = new AttributeScores(attributeScores, minScoreValue, maxScoreValue, freePoints); // We cannot trust our character details until they are confirmed by the server this.detailsConfirmed = false; } isDetailsConfirmed() { return this.detailsConfirmed; } setDetailsConfirmed(detailsConfirmed) { this.detailsConfirmed = detailsConfirmed; } onceCharacterDetailsConfirmed (onConfirmedCb) { // Single-shot mapping for setting of the details to something this.once(EVENTS.CONFIRM_DETAILS, onConfirmedCb); } getAttributeNames () { let attribNames = Object.keys(this.getAttributeScores()) return attribNames } /** * Do all expected details exist? * @returns {boolean} */ characterDetailsExist () { // TODO String validation let nameGood = (this.charname !== undefined && this.charname !== null) let attributes = (this.attributeScores !== undefined && this.attributeScores !== null) let charclassGood = (this.charclass !== undefined && this.charclass !== null) let healthGood = (this.health !== undefined && this.health !== null) //TODO Validate Attributes return (nameGood && attributes && charclassGood && healthGood) }; getCharacterClassOptions () { return this.attributeClassOptions; } setCharacterClassOptions (characterClassOptions) { if (characterClassOptions !== undefined && characterClassOptions !== null && characterClassOptions !== {}) { let charClassOptions = CharacterClassOptions.fromOptionsList(characterClassOptions) this.attributeClassOptions = charClassOptions this.emit(EVENTS.SET_CLASS_OPTIONS, charClassOptions) console.info('Character class options set!') } else { throw new RangeError('Invalid character class options.') } } isCharacterClassOptionsDefined () { let charclassOptions = this.getCharacterClassOptions() return (charclassOptions !== undefined && charclassOptions.length > 0) } /** * Checks scores are valid and that all expected default keys are provided * @param JSON score name-value mappings i.e { A:1, B:2 } * @returns {boolean} whether all attributes are valid and recognised */ validateAttributeScores (scoresJson) { if (!this.getDefaultAttributeScores().size > 0) { throw new RangeError('Default attribute scores are undefined!') } scoresJson.validate() this.getDefaultAttributeScores().keys().forEach(key => { if (!scoresJson.has(key)) { throw new RangeError('Missing default attribute score key/value pair: ' + key) } }) } // Checks for the presence of data for character update // Example JSON //{"charname":"roo","pos_x":10,"pos_y":10,"health":100, // "charclass":"fighter","free_points":5, // "attributeScores": {"STR":1,"DEX":1,"CON":1,"INT":1,"WIS":1,"CHA":1}}; static validateJson (updateJSON) { console.log('CharacterDetails validating: ' + JSON.stringify(updateJSON)) if (ValidationHandler.notUndefOrNull(updateJSON)) { let characterDataExists = ValidationHandler.checkDataAttributes(updateJSON, [CHARACTER_JSON_NAME]) let characterData = updateJSON[CHARACTER_JSON_NAME] let positionData = characterData[POSITION_JSON_NAME] let coreAttribs = [ CHARNAME_JSON_NAME, POSITION_JSON_NAME, HEALTH_JSON_NAME, CHARCLASS_JSON_NAME, ATTRIBUTES_JSON_NAME ] let positionAttribs = [POSITION_X_JSON_NAME, POSITION_Y_JSON_NAME] let coreDataExists = characterDataExists && ValidationHandler.checkDataAttributes(characterData, coreAttribs) let positionExists = characterDataExists && ValidationHandler.checkDataAttributes(positionData, positionAttribs) let attributesExist = characterDataExists && AttributeScores.validateAttributesJson(characterData) if (!characterDataExists) { throw new RangeError('\'character\' data not defined') } if (!coreDataExists) { throw new RangeError('Core attributes data not defined, expected: ' + JSON.stringify(coreAttribs)) } if (!positionExists) { throw new RangeError('Position data: ' + JSON.stringify(positionData) + ' does not contain expected attribs: ' + positionAttribs) } if (!attributesExist) { throw new RangeError('\'attributes\' data not defined') } return characterDataExists && coreDataExists && positionExists && attributesExist } else { throw new RangeError('updateJSON undefined') } } updateAttributeScores (scoresJson) { let currentScoresMap = this.getAttributeScores().getScores(); if (currentScoresMap.length > 0) { console.debug('Updating scores: ' + JSON.stringify(scoreAttributes)); let updatedCount = 0; currentScoresMap.keys().forEach(attribName => { console.debug('Setting CharacterDetails: ' + attribName + ' ' + scoresJson[attribName]) this.attributeScores.setScore(attribName, scoresJson[attribName]) updatedCount++ }); console.debug(this.getAttributeScores()) if (updatedCount > 0) { this.emit(EVENTS.SET_ATTRIB_SCORES, this.getAttributeScores()) } else { console.warn('Attribute scores not updated!') } } else { console.log('No existing scores to update!'); console.trace(); } } updateAttributes (attributesJson) { let free_points = attributesJson[FREEPOINTS_NAME] this.attributeScores.setFreePoints(free_points) let scoresJson = attributesJson[SCORES_NAME] this.updateAttributeScores(scoresJson) } setFromJson (characterDetailsJson) { if (CharacterDetails.validateJson(characterDetailsJson)) { console.debug('Setting CharacterDetails from data: ' + JSON.stringify(characterDetailsJson)); let characterData = characterDetailsJson[CHARACTER_JSON_NAME]; let charname = characterData[CHARNAME_JSON_NAME]; this.setCharacterName(charname); let charclass = characterData[CHARCLASS_JSON_NAME]; this.setCharacterClass(charclass); let position = characterData[POSITION_JSON_NAME]; this.posX = position[POSITION_X_JSON_NAME]; this.posY = position[POSITION_Y_JSON_NAME]; this.health = characterData[HEALTH_JSON_NAME]; // Copy each of the stat attribs over this.setAttributesFromJson(characterData); this.emit(EVENTS.SET_DETAILS) // If this is the first time updating these details, we can confirm their validity if (!this.detailsConfirmed) this.emit(EVENTS.CONFIRM_DETAILS); return this; } else { throw new RangeError(INVALID_CHAR_UPDATE_DATA_ERROR + JSON.stringify(characterDetailsJson)) } }; getCharacterName () { return this.charname } setCharacterName (charname) { this.charname = charname } getCharacterClass () { return this.charclass } setCharacterClass (charclass) { this.charclass = charclass } getPosition () { return [this.posX, this.posY]; } getHealth() { return this.health; } /* * * @param attributeScoresJson i.e { A:1, B:2} */ setAttributeScores (attributeScores) { if (attributeScores instanceof AttributeScores) { attributeScores.validate() let existingDefaults = this.getDefaultAttributeScores(); let existingDefaultScores = existingDefaults.getScores(); // Set defaults on first set call if (existingDefaultScores.size === 0) { this.defaultAttributeScores = AttributeScores.fromJson(attributeScores.getJson()) } this.attributeScores = attributeScores this.emit(EVENTS.SET_ATTRIB_SCORES, this.getAttributeScores()) } else { throw new RangeError('Expected an instance of AttributeScores! received: ' + attributeScores) } } /** * Extracts the 'attributes' JSON living underneath the 'character' json data * returns a JSON object with 'attributes' as it's only key */ extractAttributesJson(characterDetailsJson) { let characterJson = ValidationHandler.validateAndGetAttribute(characterDetailsJson, CHARACTER_JSON_NAME); let attribsJson = ValidationHandler.validateAndGetAttribute(characterJson, ATTRIBUTES_NAME); return { [ATTRIBUTES_NAME] : attribsJson }; } /* * @param attribsJson, json data containing an attributes object keyed by it's name */ setAttributesFromJson (attribsJson) { if (AttributeScores.validateAttributesJson(attribsJson)) { this.setAttributeScores(AttributeScores.fromJson(attribsJson)); } } getDefaultAttributeScores () { return this.defaultAttributeScores } getAttributeScores () { return this.attributeScores } // Grabs Character Name, Class, and Attribute values getJson () { return { 'character': { 'charname': this.charname, 'charclass': this.charclass, 'position': { 'pos_x': this.posX, 'pos_y': this.posY }, 'health': this.health, 'attributes': this.attributeScores.getJson()['attributes'] } } } static isValidCharacterUpdateData (updateJSON) { if (ValidationHandler.notUndefOrNull(updateJSON)) { return ValidationHandler.checkDataAttributes(updateJSON, CHARACTER_UPDATE_ATTRIBS) //if (bodyValid) { //let contentValid = CharacterDetails.validateJson(updateJSON); //} } return false } } export { CharacterDetails }
TheDarrenJoseph/AberWebMUD
server/js-files/src/model/page/CharacterDetails.js
JavaScript
mit
12,092
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Wed Jun 18 10:17:06 PDT 2003 --> <TITLE> PropertySuffix (JSP 2.0 Expression Language Implementation (Version 1.0)) </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> </HEAD> <SCRIPT> function asd() { parent.document.title="PropertySuffix (JSP 2.0 Expression Language Implementation (Version 1.0))"; } </SCRIPT> <BODY BGCOLOR="white" onload="asd();"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/apache/commons/el/PrimitiveObjects.html"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../org/apache/commons/el/RelationalOperator.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PropertySuffix.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp; <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.apache.commons.el</FONT> <BR> Class PropertySuffix</H2> <PRE> java.lang.Object | +--<A HREF="../../../../org/apache/commons/el/ValueSuffix.html">org.apache.commons.el.ValueSuffix</A> | +--<A HREF="../../../../org/apache/commons/el/ArraySuffix.html">org.apache.commons.el.ArraySuffix</A> | +--<B>org.apache.commons.el.PropertySuffix</B> </PRE> <HR> <DL> <DT>public class <B>PropertySuffix</B><DT>extends <A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></DL> <P> <p>Represents an operator that obtains the value of another value's property. This is a specialization of ArraySuffix - a.b is equivalent to a["b"] <P> <P> <DL> <DT><B>Version:</B><DD>$Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: luehe $</DD> </DD> <DT><B>Author:</B><DD>Nathan Abramson - Art Technology Group</DD> , Shawn Bayern</DD> </DD> </DL> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Field Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>(package private) &nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#mName">mName</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="fields_inherited_from_class_org.apache.commons.el.ArraySuffix"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Fields inherited from class org.apache.commons.el.<A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html#mIndex">mIndex</A>, <A HREF="../../../../org/apache/commons/el/ArraySuffix.html#sNoArgs">sNoArgs</A></CODE></TD> </TR> </TABLE> &nbsp; <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#PropertySuffix(java.lang.String)">PropertySuffix</A></B>(java.lang.String&nbsp;pName)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructor</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>(package private) &nbsp;java.lang.Object</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#evaluateIndex(javax.servlet.jsp.el.VariableResolver, javax.servlet.jsp.el.FunctionMapper, org.apache.commons.el.Logger)">evaluateIndex</A></B>(javax.servlet.jsp.el.VariableResolver&nbsp;pResolver, javax.servlet.jsp.el.FunctionMapper&nbsp;functions, <A HREF="../../../../org/apache/commons/el/Logger.html">Logger</A>&nbsp;pLogger)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the value of the index</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#getExpressionString()">getExpressionString</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the expression in the expression language syntax</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#getName()">getName</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>(package private) &nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#getOperatorSymbol()">getOperatorSymbol</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the operator symbol</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../org/apache/commons/el/PropertySuffix.html#setName(java.lang.String)">setName</A></B>(java.lang.String&nbsp;pName)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_org.apache.commons.el.ArraySuffix"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Methods inherited from class org.apache.commons.el.<A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html#evaluate(java.lang.Object, javax.servlet.jsp.el.VariableResolver, javax.servlet.jsp.el.FunctionMapper, org.apache.commons.el.Logger)">evaluate</A>, <A HREF="../../../../org/apache/commons/el/ArraySuffix.html#getIndex()">getIndex</A>, <A HREF="../../../../org/apache/commons/el/ArraySuffix.html#setIndex(org.apache.commons.el.Expression)">setIndex</A></CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Methods inherited from class java.lang.Object</B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Field Detail</B></FONT></TD> </TR> </TABLE> <A NAME="mName"><!-- --></A><H3> mName</H3> <PRE> java.lang.String <B>mName</B></PRE> <DL> <DL> </DL> </DL> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TD> </TR> </TABLE> <A NAME="PropertySuffix(java.lang.String)"><!-- --></A><H3> PropertySuffix</H3> <PRE> public <B>PropertySuffix</B>(java.lang.String&nbsp;pName)</PRE> <DL> <DD>Constructor <P> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=1><FONT SIZE="+2"> <B>Method Detail</B></FONT></TD> </TR> </TABLE> <A NAME="getName()"><!-- --></A><H3> getName</H3> <PRE> public java.lang.String <B>getName</B>()</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="setName(java.lang.String)"><!-- --></A><H3> setName</H3> <PRE> public void <B>setName</B>(java.lang.String&nbsp;pName)</PRE> <DL> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="evaluateIndex(javax.servlet.jsp.el.VariableResolver, javax.servlet.jsp.el.FunctionMapper, org.apache.commons.el.Logger)"><!-- --></A><H3> evaluateIndex</H3> <PRE> java.lang.Object <B>evaluateIndex</B>(javax.servlet.jsp.el.VariableResolver&nbsp;pResolver, javax.servlet.jsp.el.FunctionMapper&nbsp;functions, <A HREF="../../../../org/apache/commons/el/Logger.html">Logger</A>&nbsp;pLogger) throws javax.servlet.jsp.el.ELException</PRE> <DL> <DD>Gets the value of the index <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html#evaluateIndex(javax.servlet.jsp.el.VariableResolver, javax.servlet.jsp.el.FunctionMapper, org.apache.commons.el.Logger)">evaluateIndex</A></CODE> in class <CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></CODE></DL> </DD> <DD><DL> <DD><CODE>javax.servlet.jsp.el.ELException</CODE></DL> </DD> </DL> <HR> <A NAME="getOperatorSymbol()"><!-- --></A><H3> getOperatorSymbol</H3> <PRE> java.lang.String <B>getOperatorSymbol</B>()</PRE> <DL> <DD>Returns the operator symbol <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html#getOperatorSymbol()">getOperatorSymbol</A></CODE> in class <CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getExpressionString()"><!-- --></A><H3> getExpressionString</H3> <PRE> public java.lang.String <B>getExpressionString</B>()</PRE> <DL> <DD>Returns the expression in the expression language syntax <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html#getExpressionString()">getExpressionString</A></CODE> in class <CODE><A HREF="../../../../org/apache/commons/el/ArraySuffix.html">ArraySuffix</A></CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_bottom"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../org/apache/commons/el/PrimitiveObjects.html"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../org/apache/commons/el/RelationalOperator.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="PropertySuffix.html" TARGET="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp; <SCRIPT> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html" TARGET=""><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> Copyright (c) 2001-2002 - Apache Software Foundation </BODY> </HTML>
kennetham/LTA-Traffic-Demo
commons-el-1.0/docs/api/org/apache/commons/el/PropertySuffix.html
HTML
mit
16,231
<?php echo form_open($this->config->item('admin_folder').'/customers/SaveCharges'); ?> <div class="row"> <div class="form-group"> <label>GST(%)</label> <?php $data = array('name'=>'servicetax', 'value'=>set_value('servicetax', $servicetax), 'class'=>'form-control'); echo form_input($data); ?> </div> </div> <div class="row"> <div class="form-group"> <label>Convenience charge(To Show in Customer App)</label> <?php $data = array('name'=>'deliverycharge', 'value'=>set_value('deliverycharge', $deliverycharge), 'class'=>'form-control'); echo form_input($data); ?> </div> </div> <div class="row"> <div class="form-group"> <label>Minimum order value</label> <?php $data = array('name'=>'minordervalue', 'value'=>set_value('minordervalue', $minordervalue), 'class'=>'form-control'); echo form_input($data); ?> </div> </div> <div class="form-actions"> <input class="btn btn-primary" type="submit" value="<?php echo lang('save');?>"/> </div> </form> <div style="display:block;clear:both;margin-top:40px"> <form class="form-inline" action="<?php echo site_url($this->config->item('admin_folder').'/customers/ImportPasscode'); ?>" method="post" enctype="multipart/form-data"> <div class="form-group"> <input type="file" name="restaurantfile" style="display:inline;"> <input type="submit" name="submit" value="Upload Passcode" class="btn btn-xs btn-primary"> </div> </form> <a href="../../../Passcode.csv" style="text-decoration:underline">(Download the passcode format)</a><br><br> <a class="btn btn-danger btn-xs" onclick="var result = confirm('Are you sure you want to delete?'); if(result) { location.href='<?php echo site_url($this->config->item('admin_folder').'/customers/PasscodeDelete'); ?>'; }">Delete passcode</a></br> </div>
virendrayadav/grazzyweb
application/views/admin/charges_form.php
PHP
mit
1,826
const watson = require('watson-developer-cloud'); const API_KEY = '1b72f2aaaf9d29cd93d4805592c8991c828f9169'; // Put API key here // Connect to Watson Alchemy Language service if (API_KEY) { var alchemy = watson.alchemy_language({ api_key: API_KEY }); } else { console.error('Could not connect to Alchemy API - No API key'); } /** * Uses the Watson Alchemy API to generate a tag-cloud for target. * target should be an object with one of the properties html, url or text. */ module.exports = target => new Promise((resolve, reject) => { if (!target || !(target.html || target.url || target.text)) { reject('Could not invoke Alchemy API - No target'); } if (!alchemy) { reject('No Alchemy connection'); } // Refer to the following link for more information: // http://www.ibm.com/watson/developercloud/alchemy-language/api/v1/?node#entities var parameters = Object.assign({ structuredEntities: 0, emotion: 1 }, target); // Make API call alchemy.entities(parameters, function (err, res) { if (!err && res && Array.isArray(res.entities)) { resolve(res.entities); } reject(err || 'No results'); }); })
lysfibe/ThePrejudiceLeague
services/alchemy.js
JavaScript
mit
1,240
<!DOCTYPE html> <!--[if IE]><![endif]--> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>제어되는 input 내의 null 값 | React</title> <meta name="viewport" content="width=device-width"> <meta property="og:title" content="제어되는 input 내의 null 값 | React"> <meta property="og:type" content="website"> <meta property="og:url" content="https://facebook.github.io/react/tips/controlled-input-null-value-ko-KR.html"> <meta property="og:image" content="https://facebook.github.io/react/img/logo_og.png"> <meta property="og:description" content="A JavaScript library for building user interfaces"> <meta property="fb:app_id" content="623268441017527"> <link rel="shortcut icon" href="/react/favicon.ico"> <link rel="alternate" type="application/rss+xml" title="React" href="https://facebook.github.io/react/feed.xml"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" /> <link rel="stylesheet" href="/react/css/syntax.css"> <link rel="stylesheet" href="/react/css/codemirror.css"> <link rel="stylesheet" href="/react/css/react.css"> <script src="//use.typekit.net/vqa1hcx.js"></script> <script>try{Typekit.load();}catch(e){}</script> <!--[if lte IE 8]> <script src="/react/js/html5shiv.min.js"></script> <script src="/react/js/es5-shim.min.js"></script> <script src="/react/js/es5-sham.min.js"></script> <![endif]--> <script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script> <script src="/react/js/codemirror.js"></script> <script src="/react/js/javascript.js"></script> <script src="/react/js/xml.js"></script> <script src="/react/js/jsx.js"></script> <script src="/react/js/react.js"></script> <script src="/react/js/react-dom.js"></script> <script src="/react/js/babel-browser.min.js"></script> <script src="/react/js/live_editor.js"></script> </head> <body> <div class="container"> <div class="nav-main"> <div class="wrap"> <a class="nav-home" href="/react/index.html"> <img class="nav-logo" src="/react/img/logo.svg" width="36" height="36"> React </a> <ul class="nav-site nav-site-internal"> <li><a href="/react/docs/getting-started.html" class="active">Docs</a></li> <li><a href="/react/support.html">Support</a></li> <li><a href="/react/downloads.html">Download</a></li> <li><a href="/react/blog/">Blog</a></li> <li> <input id="algolia-doc-search" type="text" placeholder="Search docs..." /> </li> </ul> <ul class="nav-site nav-site-external"> <li><a href="https://github.com/facebook/react">GitHub</a></li> <li><a href="https://facebook.github.io/react-native/">React Native</a></li> </ul> </div> </div> <section class="content wrap documentationContent"> <div class="nav-docs"> <!-- Docs Nav --> <div class="nav-docs-section"> <h3>Quick Start</h3> <ul> <li> <a href="/react/docs/getting-started.html">Getting Started</a> </li> <li> <a href="/react/docs/tutorial.html">Tutorial</a> </li> <li> <a href="/react/docs/thinking-in-react.html">Thinking in React</a> </li> </ul> </div> <div class="nav-docs-section"> <h3>Community Resources</h3> <ul> <li> <a href="/react/docs/conferences.html">Conferences</a> </li> <li> <a href="/react/docs/videos.html">Videos</a> </li> <li> <a href="https://github.com/facebook/react/wiki/Complementary-Tools" class="external">Complementary Tools</a> </li> <li> <a href="https://github.com/facebook/react/wiki/Examples" class="external">Examples</a> </li> </ul> </div> <div class="nav-docs-section"> <h3>Guides</h3> <ul> <li> <a href="/react/docs/why-react.html">Why React?</a> </li> <li> <a href="/react/docs/displaying-data.html">Displaying Data</a> <ul> <li> <a href="/react/docs/jsx-in-depth.html">JSX in Depth</a> </li> <li> <a href="/react/docs/jsx-spread.html">JSX Spread Attributes</a> </li> <li> <a href="/react/docs/jsx-gotchas.html">JSX Gotchas</a> </li> </ul> </li> <li> <a href="/react/docs/interactivity-and-dynamic-uis.html">Interactivity and Dynamic UIs</a> </li> <li> <a href="/react/docs/multiple-components.html">Multiple Components</a> </li> <li> <a href="/react/docs/reusable-components.html">Reusable Components</a> </li> <li> <a href="/react/docs/transferring-props.html">Transferring Props</a> </li> <li> <a href="/react/docs/forms.html">Forms</a> </li> <li> <a href="/react/docs/working-with-the-browser.html">Working With the Browser</a> <ul> <li> <a href="/react/docs/more-about-refs.html">Refs to Components</a> </li> </ul> </li> <li> <a href="/react/docs/tooling-integration.html">Tooling Integration</a> <ul> <li> <a href="/react/docs/language-tooling.html">Language Tooling</a> </li> <li> <a href="/react/docs/package-management.html">Package Management</a> </li> <li> <a href="/react/docs/environments.html">Server-side Environments</a> </li> </ul> </li> <li> <a href="/react/docs/addons.html">Add-Ons</a> <ul> <li> <a href="/react/docs/animation.html">Animation</a> </li> <li> <a href="/react/docs/two-way-binding-helpers.html">Two-Way Binding Helpers</a> </li> <li> <a href="/react/docs/test-utils.html">Test Utilities</a> </li> <li> <a href="/react/docs/clone-with-props.html">Cloning Elements</a> </li> <li> <a href="/react/docs/create-fragment.html">Keyed Fragments</a> </li> <li> <a href="/react/docs/update.html">Immutability Helpers</a> </li> <li> <a href="/react/docs/pure-render-mixin.html">PureRenderMixin</a> </li> <li> <a href="/react/docs/perf.html">Performance Tools</a> </li> <li> <a href="/react/docs/shallow-compare.html">Shallow Compare</a> </li> </ul> </li> <li> <a href="/react/docs/advanced-performance.html">Advanced Performance</a> </li> <li> <a href="/react/docs/context.html">Context</a> </li> </ul> </div> <div class="nav-docs-section"> <h3>Reference</h3> <ul> <li> <a href="/react/docs/top-level-api.html">Top-Level API</a> </li> <li> <a href="/react/docs/component-api.html">Component API</a> </li> <li> <a href="/react/docs/component-specs.html">Component Specs and Lifecycle</a> </li> <li> <a href="/react/docs/tags-and-attributes.html">Supported Tags and Attributes</a> </li> <li> <a href="/react/docs/events.html">Event System</a> </li> <li> <a href="/react/docs/dom-differences.html">DOM Differences</a> </li> <li> <a href="/react/docs/special-non-dom-attributes.html">Special Non-DOM Attributes</a> </li> <li> <a href="/react/docs/reconciliation.html">Reconciliation</a> </li> <li> <a href="/react/docs/webcomponents.html">Web Components</a> </li> <li> <a href="/react/docs/glossary.html">React (Virtual) DOM Terminology</a> </li> </ul> </div> <!-- Tips Nav --> <div class="nav-docs-section"> <h3>Tips</h3> <ul> <li> <a href="/react/tips/introduction.html">Introduction</a> </li> <li> <a href="/react/tips/inline-styles.html">Inline Styles</a> </li> <li> <a href="/react/tips/if-else-in-JSX.html">If-Else in JSX</a> </li> <li> <a href="/react/tips/self-closing-tag.html">Self-Closing Tag</a> </li> <li> <a href="/react/tips/maximum-number-of-jsx-root-nodes.html">Maximum Number of JSX Root Nodes</a> </li> <li> <a href="/react/tips/style-props-value-px.html">Shorthand for Specifying Pixel Values in style props</a> </li> <li> <a href="/react/tips/children-props-type.html">Type of the Children props</a> </li> <li> <a href="/react/tips/controlled-input-null-value.html">Value of null for Controlled Input</a> </li> <li> <a href="/react/tips/componentWillReceiveProps-not-triggered-after-mounting.html">componentWillReceiveProps Not Triggered After Mounting</a> </li> <li> <a href="/react/tips/props-in-getInitialState-as-anti-pattern.html">Props in getInitialState Is an Anti-Pattern</a> </li> <li> <a href="/react/tips/dom-event-listeners.html">DOM Event Listeners in a Component</a> </li> <li> <a href="/react/tips/initial-ajax.html">Load Initial Data via AJAX</a> </li> <li> <a href="/react/tips/false-in-jsx.html">False in JSX</a> </li> <li> <a href="/react/tips/communicate-between-components.html">Communicate Between Components</a> </li> <li> <a href="/react/tips/expose-component-functions.html">Expose Component Functions</a> </li> <li> <a href="/react/tips/children-undefined.html">this.props.children undefined</a> </li> <li> <a href="/react/tips/use-react-with-other-libraries.html">Use React with Other Libraries</a> </li> <li> <a href="/react/tips/dangerously-set-inner-html.html">Dangerously Set innerHTML</a> </li> </ul> </div> <!-- Contributing Nav --> <div class="nav-docs-section"> <h3>Contributing</h3> <ul> <li> <a href="/react/contributing/design-principles.html">Design Principles</a> </li> </ul> </div> </div> <div class="inner-content"> <h1>제어되는 input 내의 null 값</h1> <div class="subHeader"></div> <p><a href="/react/docs/forms-ko-KR.html">제어되는 컴포넌트들</a>의 <code>value</code> 속성 값을 지정하면 유저에 의해 입력값을 바꿀 수 없습니다.</p> <p><code>value</code>가 정해져 있는데도 입력값을 변경할 수 있는 문제를 겪고 있다면 실수로 <code>value</code>를 <code>undefined</code>나 <code>null</code>로 설정한 것일 수 있습니다.</p> <p>아래 짧은 예제가 있습니다; 렌더링 후, 잠시 뒤에 텍스트를 고칠 수 있는 상태가 되는 것을 확인 하실 수 있습니다.</p> <div class="highlight"><pre><code class="language-js" data-lang="js"><span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">input</span> <span class="nx">value</span><span class="o">=</span><span class="s2">&quot;hi&quot;</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">mountNode</span><span class="p">);</span> <span class="nx">setTimeout</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> <span class="nx">ReactDOM</span><span class="p">.</span><span class="nx">render</span><span class="p">(</span><span class="o">&lt;</span><span class="nx">input</span> <span class="nx">value</span><span class="o">=</span><span class="p">{</span><span class="kc">null</span><span class="p">}</span> <span class="o">/&gt;</span><span class="p">,</span> <span class="nx">mountNode</span><span class="p">);</span> <span class="p">},</span> <span class="mi">1000</span><span class="p">);</span> </code></pre></div> <div class="docs-prevnext"> <a class="docs-prev" href="/react/tips/children-props-type-ko-KR.html">&larr; Prev</a> <a class="docs-next" href="/react/tips/componentWillReceiveProps-not-triggered-after-mounting-ko-KR.html">Next &rarr;</a> </div> </div> </section> <footer class="wrap"> <div class="left"> A Facebook &amp; Instagram collaboration.<br> <a href="/react/acknowledgements.html">Acknowledgements</a> </div> <div class="right"> &copy; 2013&ndash;2016 Facebook Inc.<br> Documentation licensed under <a href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>. </div> </footer> </div> <div id="fb-root"></div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-41298772-1', 'facebook.github.io'); ga('send', 'pageview'); !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.6&appId=623268441017527"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); docsearch({ apiKey: '36221914cce388c46d0420343e0bb32e', indexName: 'react', inputSelector: '#algolia-doc-search' }); </script> </body> </html>
voorhoede/fastatic
examples/react-gh-pages/tips/controlled-input-null-value-ko-KR.html
HTML
mit
16,469
const webpack = require('webpack') const express = require('express') const path = require('path') const webpackDevMiddleware = require('webpack-dev-middleware') const webpackConfig = require('../build/webpack.config.js') const config = require('../project.config.js') const compiler = webpack(webpackConfig) const server = express() // Add conditional based on ENV server.use( webpackDevMiddleware( compiler, { stats: { colors: true, modules: false, chunks: false, }, resolve: { modules: [ 'node_modules', path.resolve(config.src) ] } } ) ) server.use(require('webpack-hot-middleware')(compiler)) server.listen(config.port, () => { console.log(`Server running on port ${config.port}`) }) module.exports = server
Ollo/shell
server/index.js
JavaScript
mit
817
<?HH use HackFastAlgos\DataStructure as DataStructure; class AdjListTest extends \PHPUnit_Framework_TestCase { public function testCanSetToWeightedList() { $adjList = new DataStructure\AdjList(); $adjList->setWeighted(); $this->assertTrue($adjList->isWeighted()); } public function testCanSetToNotWeightedList() { $adjList = new DataStructure\AdjList(DataStructure\AdjList::WEIGHTED); $adjList->setNotWeighted(); $this->assertFalse($adjList->isWeighted()); } public function testCanAddNonWeightedEdgeToAdjList() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $adjList->insertEdge(Vector{1,2}); $adjList->insertEdge(Vector{3,4}); $expected = Map{ 1 => Vector{Vector{2}}, 3 => Vector{Vector{4}}, }; $this->assertEquals($expected, $adjList->toMap()); } public function testCanAddWeightedEdgeToAdjList() { $adjList = new DataStructure\AdjList(); $adjList->setWeighted(); $adjList->insertEdge(Vector{1,2,3}); $adjList->insertEdge(Vector{3,4,5}); $expected = Map{ 1 => Vector{Vector{2,3}}, 3 => Vector{Vector{4,5}}, }; $this->assertEquals($expected, $adjList->toMap()); } public function testDoesNotExistWhenNotInAdjList() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $this->assertFalse($adjList->edgeExists(Vector{1,2})); } public function testExistsWhenInAdjList() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $adjList->insertEdge(Vector{1,2}); $this->assertTrue($adjList->edgeExists(Vector{1,2})); } public function testCannotAddWeightedEdgeToNonWeightedList() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); try { $adjList->insertEdge(Vector{1,2,3}); $this->fail(); } catch (DataStructure\AdjListEdgeIsWeightedException $e) {} } public function testCannotAddNonWeightedEdgeToWeightedList() { $adjList = new DataStructure\AdjList(); $adjList->setWeighted(); try { $adjList->insertEdge(Vector{1,2}); $this->fail(); } catch (DataStructure\AdjListEdgeIsNotWeightedException $e) {} } public function testIsWeightedReturnsTrueWhenWeighted() { $adjList = new DataStructure\AdjList(); $adjList->setWeighted(); $this->assertTrue($adjList->isWeighted()); } public function testIsWeightedReturnsFalseWhenNotWeighted() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $this->assertFalse($adjList->isWeighted()); } public function testCanImportFromMap() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $map = Map{ 1 => Vector{Vector{2,3}}, 3 => Vector{Vector{4,5}}, }; $adjList->fromMap($map); $this->assertEquals($map, $adjList->toMap()); } public function testCannotImportFromMapWhenListNotempty() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $adjList->insertEdge(Vector{1,2}); try { $map = Map{ 1 => Vector{Vector{2,3}}, 3 => Vector{Vector{4,5}}, }; $adjList->fromMap($map); $this->fail(); } catch (DataStructure\AdjListNotEmptyException $e) {} } public function testCanSortByVertex() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $adjList->insertEdge(Vector{1,2}); $adjList->insertEdge(Vector{3,4}); $adjList->insertEdge(Vector{0,3}); $adjList->insertEdge(Vector{-1,5}); $adjList->insertEdge(Vector{3,6}); $adjList->sortByVertex(); $expected = Map{ -1 => Vector{Vector{5}}, 0 => Vector{Vector{3}}, 1 => Vector{Vector{2}}, 3 => Vector{Vector{6},Vector{4}} }; $this->assertEquals($expected, $adjList->toMap()); } public function testCanSortByWeight() { $adjList = new DataStructure\AdjList(); $adjList->setWeighted(); $adjList->insertEdge(Vector{1,2,3}); $adjList->insertEdge(Vector{3,4,6}); $adjList->insertEdge(Vector{0,3,1}); $adjList->insertEdge(Vector{-1,5,-1}); $adjList->insertEdge(Vector{3,6,0}); $adjList->sortByWeights(); $expected = Map{ -1 => Vector{Vector{5,-1}}, 3 => Vector{Vector{6,0},Vector{4,6}}, 0 => Vector{Vector{3,1}}, 1 => Vector{Vector{2,3}} }; $this->assertEquals($expected, $adjList->toMap()); } public function testCannotSortByWeightWhenNotWeightedList() { $adjList = new DataStructure\AdjList(); $adjList->setNotWeighted(); $adjList->insertEdge(Vector{1,2}); try { $adjList->sortByWeights(); $this->fail(); } catch (DataStructure\AdjListNotWeightedListException $e) {} } }
cozylife/hackfastalgos
tests/datastructure/adjlist.php
PHP
mit
4,498
module Neo4j module Rails module NestedAttributes extend ActiveSupport::Concern extend TxMethods def update_nested_attributes(rel_type, attr, options) allow_destroy, reject_if = [options[:allow_destroy], options[:reject_if]] if options begin # Check if we want to destroy not found nodes (e.g. {..., :_destroy => '1' } ? destroy = attr.delete(:_destroy) found = _find_node(rel_type, attr[:id]) || Neo4j::Rails::Model.find(attr[:id]) if allow_destroy && destroy && destroy != '0' found.destroy if found else if not found _create_entity(rel_type, attr) #Create new node from scratch else #Create relationship to existing node in case it doesn't exist already _add_relationship(rel_type, found) if (not _has_relationship(rel_type, attr[:id])) found.update_attributes(attr) end end end unless reject_if?(reject_if, attr) end tx_methods :update_nested_attributes module ClassMethods def accepts_nested_attributes_for(*attr_names) options = attr_names.pop if attr_names[-1].is_a?(Hash) attr_names.each do |association_name| # Do some validation that we have defined the relationships we want to nest rel = self._decl_rels[association_name.to_sym] raise "No relationship declared with has_n or has_one with type #{association_name}" unless rel raise "Can't use accepts_nested_attributes_for(#{association_name}) since it has not defined which class it has a relationship to, use has_n(#{association_name}).to(MyOtherClass)" unless rel.target_class if rel.has_one? send(:define_method, "#{association_name}_attributes=") do |attributes| update_nested_attributes(association_name.to_sym, attributes, options) end else send(:define_method, "#{association_name}_attributes=") do |attributes| if attributes.is_a?(Array) attributes.each do |attr| update_nested_attributes(association_name.to_sym, attr, options) end else attributes.each_value do |attr| update_nested_attributes(association_name.to_sym, attr, options) end end end end end end end protected def _create_entity(rel_type, attr) clazz = self.class._decl_rels[rel_type.to_sym].target_class _add_relationship(rel_type, clazz.new(attr)) end def _add_relationship(rel_type, node) if respond_to?("#{rel_type}_rel") send("#{rel_type}=", node) elsif respond_to?("#{rel_type}_rels") has_n = send("#{rel_type}") has_n << node else raise "oops #{rel_type}" end end def _find_node(rel_type, id) return nil if id.nil? if respond_to?("#{rel_type}_rel") send("#{rel_type}") elsif respond_to?("#{rel_type}_rels") has_n = send("#{rel_type}") has_n.find { |n| n.id == id } else raise "oops #{rel_type}" end end def _has_relationship(rel_type, id) !_find_node(rel_type, id).nil? end def reject_if?(proc_or_symbol, attr) return false if proc_or_symbol.nil? if proc_or_symbol.is_a?(Symbol) meth = method(proc_or_symbol) meth.arity == 0 ? meth.call : meth.call(attr) else proc_or_symbol.call(attr) end end end end end
mneedham/neo4j-1
lib/neo4j/rails/nested_attributes.rb
Ruby
mit
3,768
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>difference</title> <link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.79.1"> <link rel="home" href="../../../../index.html" title="Chapter 1. Geometry"> <link rel="up" href="../difference.html" title="difference"> <link rel="prev" href="difference_4_with_strategy.html" title="difference (with strategy)"> <link rel="next" href="../discrete_frechet_distance.html" title="discrete_frechet_distance"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td> <td align="center"><a href="../../../../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="difference_4_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../difference.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../discrete_frechet_distance.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h5 class="title"> <a name="geometry.reference.algorithms.difference.difference_3"></a><a class="link" href="difference_3.html" title="difference">difference</a> </h5></div></div></div> <p> <a class="indexterm" name="idm45246443481856"></a> </p> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h0"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.description"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.description">Description</a> </h6> <p> Calculate the difference of two geometries </p> <p> The free function difference calculates the spatial set theoretic difference of two geometries. </p> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h1"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.synopsis"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.synopsis">Synopsis</a> </h6> <p> </p> <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Geometry1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Geometry2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Collection</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">difference</span><span class="special">(</span><span class="identifier">Geometry1</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">geometry1</span><span class="special">,</span> <span class="identifier">Geometry2</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">geometry2</span><span class="special">,</span> <span class="identifier">Collection</span> <span class="special">&amp;</span> <span class="identifier">output_collection</span><span class="special">)</span></pre> <p> </p> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h2"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.parameters"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.parameters">Parameters</a> </h6> <div class="informaltable"><table class="table"> <colgroup> <col> <col> <col> <col> </colgroup> <thead><tr> <th> <p> Type </p> </th> <th> <p> Concept </p> </th> <th> <p> Name </p> </th> <th> <p> Description </p> </th> </tr></thead> <tbody> <tr> <td> <p> Geometry1 const &amp; </p> </td> <td> <p> Any type fulfilling a Geometry Concept </p> </td> <td> <p> geometry1 </p> </td> <td> <p> A model of the specified concept </p> </td> </tr> <tr> <td> <p> Geometry2 const &amp; </p> </td> <td> <p> Any type fulfilling a Geometry Concept </p> </td> <td> <p> geometry2 </p> </td> <td> <p> A model of the specified concept </p> </td> </tr> <tr> <td> <p> Collection &amp; </p> </td> <td> <p> output collection, either a multi-geometry, or a std::vector&lt;Geometry&gt; / std::deque&lt;Geometry&gt; etc </p> </td> <td> <p> output_collection </p> </td> <td> <p> the output collection </p> </td> </tr> </tbody> </table></div> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h3"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.header"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.header">Header</a> </h6> <p> Either </p> <p> <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> </p> <p> Or </p> <p> <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">algorithms</span><span class="special">/</span><span class="identifier">difference</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> </p> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h4"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.conformance"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.conformance">Conformance</a> </h6> <p> The function difference implements function Difference from the <a href="http://www.opengeospatial.org/standards/sfa" target="_top">OGC Simple Feature Specification</a>. </p> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h5"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.behavior"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.behavior">Behavior</a> </h6> <div class="informaltable"><table class="table"> <colgroup> <col> <col> </colgroup> <thead><tr> <th> <p> Case </p> </th> <th> <p> Behavior </p> </th> </tr></thead> <tbody> <tr> <td> <p> areal (e.g. polygon) </p> </td> <td> <p> All combinations of: box, ring, polygon, multi_polygon </p> </td> </tr> <tr> <td> <p> linear (e.g. linestring) / areal (e.g. polygon) </p> </td> <td> <p> A combinations of a (multi) linestring with a (multi) polygon results in a collection of linestrings </p> </td> </tr> <tr> <td> <p> linear (e.g. linestring) </p> </td> <td> <p> All combinations of: linestring, multi_linestring; results in a collection of linestrings </p> </td> </tr> <tr> <td> <p> pointlike (e.g. point) </p> </td> <td> <p> All combinations of: point, multi_point; results in a collection of points </p> </td> </tr> <tr> <td> <p> Other geometries </p> </td> <td> <p> Not yet supported in this version </p> </td> </tr> <tr> <td> <p> Spherical </p> </td> <td> <p> Not yet supported in this version </p> </td> </tr> <tr> <td> <p> Three dimensional </p> </td> <td> <p> Not yet supported in this version </p> </td> </tr> </tbody> </table></div> <div class="note"><table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td> <th align="left">Note</th> </tr> <tr><td align="left" valign="top"><p> Check the <a class="link" href="../../concepts/concept_polygon.html" title="Polygon Concept">Polygon Concept</a> for the rules that polygon input for this algorithm should fulfill </p></td></tr> </table></div> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h6"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.example"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.example">Example</a> </h6> <p> Shows how to subtract one polygon from another polygon </p> <p> </p> <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">list</span><span class="special">&gt;</span> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> <span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">foreach</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span> <span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span> <span class="special">{</span> <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="special">&gt;</span> <span class="identifier">polygon</span><span class="special">;</span> <span class="identifier">polygon</span> <span class="identifier">green</span><span class="special">,</span> <span class="identifier">blue</span><span class="special">;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span> <span class="string">"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"</span> <span class="string">"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))"</span><span class="special">,</span> <span class="identifier">green</span><span class="special">);</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span> <span class="string">"POLYGON((4.0 -0.5 , 3.5 1.0 , 2.0 1.5 , 3.5 2.0 , 4.0 3.5 , 4.5 2.0 , 6.0 1.5 , 4.5 1.0 , 4.0 -0.5))"</span><span class="special">,</span> <span class="identifier">blue</span><span class="special">);</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;</span> <span class="identifier">output</span><span class="special">;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">difference</span><span class="special">(</span><span class="identifier">green</span><span class="special">,</span> <span class="identifier">blue</span><span class="special">,</span> <span class="identifier">output</span><span class="special">);</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"green - blue:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="identifier">BOOST_FOREACH</span><span class="special">(</span><span class="identifier">polygon</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">output</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span><span class="special">++</span> <span class="special">&lt;&lt;</span> <span class="string">": "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">area</span><span class="special">(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span> <span class="identifier">output</span><span class="special">.</span><span class="identifier">clear</span><span class="special">();</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">difference</span><span class="special">(</span><span class="identifier">blue</span><span class="special">,</span> <span class="identifier">green</span><span class="special">,</span> <span class="identifier">output</span><span class="special">);</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"blue - green:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="identifier">BOOST_FOREACH</span><span class="special">(</span><span class="identifier">polygon</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">p</span><span class="special">,</span> <span class="identifier">output</span><span class="special">)</span> <span class="special">{</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">i</span><span class="special">++</span> <span class="special">&lt;&lt;</span> <span class="string">": "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">area</span><span class="special">(</span><span class="identifier">p</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="special">}</span> <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span> <span class="special">}</span> </pre> <p> </p> <p> Output: </p> <pre class="programlisting">green - blue: 0: 0.02375 1: 0.542951 2: 0.0149697 3: 0.226855 4: 0.839424 <img src="../../../../img/algorithms/difference_a.png" alt="difference_a"> blue - green: 0: 0.525154 1: 0.015 2: 0.181136 3: 0.128798 4: 0.340083 5: 0.307778 <img src="../../../../img/algorithms/difference_b.png" alt="difference_b"> </pre> <h6> <a name="geometry.reference.algorithms.difference.difference_3.h7"></a> <span class="phrase"><a name="geometry.reference.algorithms.difference.difference_3.see_also"></a></span><a class="link" href="difference_3.html#geometry.reference.algorithms.difference.difference_3.see_also">See also</a> </h6> <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> <li class="listitem"> <a class="link" href="../sym_difference.html" title="sym_difference">sym_difference (symmetric difference)</a> </li> <li class="listitem"> <a class="link" href="../intersection.html" title="intersection">intersection</a> </li> <li class="listitem"> <a class="link" href="../union_.html" title="union_">union</a> </li> </ul></div> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright © 2009-2021 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam Wulkiewicz, Oracle and/or its affiliates<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="difference_4_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../difference.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../discrete_frechet_distance.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
davehorton/drachtio-server
deps/boost_1_77_0/libs/geometry/doc/html/geometry/reference/algorithms/difference/difference_3.html
HTML
mit
23,185
<?php // Load all application files and configurations require($_SERVER[ 'DOCUMENT_ROOT' ] . '/../includes/application_includes.php'); // Include the HTML layout class require_once(FS_TEMPLATES . 'Layout.php'); require_once(FS_TEMPLATES . 'News.php'); // Connect to the database $db = new Database(DB_HOST, DB_USER, DB_PASS, DB_NAME); // Initialize variables $requestType = $_SERVER[ 'REQUEST_METHOD' ]; // Get the stories for column 1 from the database $sql = 'select * from posts'; $sql2 = 'select * from audio'; $sermons = $db->query($sql2); // Run a simple query that will be rendered in column 2 below $sql2 = 'select id, title, url from audio'; $res = $db->query($sql2); // Generate the HTML for the top of the page Layout::pageTop('Csc206 Project'); // Page content goes here //echo $_SESSION['user'],['firstname']; ?> <div class="container top25"> <div class="col-md-8"> <section class="content"> <?php $message = ""; if ( $requestType == 'GET' ) { // Display the form if (isset($_SESSION['users'])){ showForm(); } else{$message = '<p>Not Logged in</p>';} } else if ( $requestType == 'POST' ) { // Process data that was submitted echo '<h2>This is the data that was entered</h2>'; echo '<pre>'; print_r($_POST); echo '</pre>'; // pull the fields from the POST array. $title = $_POST['title']; $url = $_POST['url']; $author = $_POST['author']; $title = htmlspecialchars($title, ENT_QUOTES); $url = htmlspecialchars($url, ENT_QUOTES); $author = htmlspecialchars($author, ENT_QUOTES); // This SQL uses double quotes for the query string. If a field is not a number (it's a string or a date) it needs // to be enclosed in single quotes. Note that right after values is a ( and a single quote. Taht single quote comes right // before the value of $title. Note also that at the end of $title is a ', ' inside of double quotes. What this will all render // That will generate this piece of SQL: values ('title text here', 'content text here', '2017-02-01 00:00:00' and so // on until the end of the sql command. $sql = "insert into audio (title, url, author) values ('" . $title . "', '" . $url . "', '" . $author . "');"; $db->query($sql); showForm(); } echo $message; ?> </section> </div> <?php layout::pageSide('Csc206 Project'); echo <<<yes <!-- Side Widget Well --> <div class="well"> <h4>Audio Sermons</h4> yes; while ($sermon = $sermons->fetch()) { // Call the method to create the layout for a post News::sermon($sermon); } echo <<<end </div> </div> </div> <!-- /.row --> <hr> end; ?> </div> <?php // Generate the page footer /** * Functions that support the createPost page */ $fields = [ 'id' => ['integer'], 'title' => ['required', 'string'], 'author' => ['required', 'string'], 'url' => ['required', 'string'], //'image' => ['string'] ]; /** * Show the form */ function showForm($data = null) { $author = $data['author']; $title = $data['title']; $url = $data['url']; echo <<<postform <form id="showAudioForm" action='createAudio.php' method="POST" class="form-horizontal"> <fieldset> <!-- Form Name --> <legend>New Audio Link</legend> <!-- Text input--> <div class="form-group"> <label class="col-md-3 control-label" for="title">Title</label> <div class="col-md-8"> <input id="title" name="title" type="text" placeholder="post title" value="$title" class="form-control input-md" required=""> </div> </div> <!-- Textarea --> <div class="form-group"> <label class="col-md-3 control-label" for="author">Author</label> <div class="col-md-8"> <textarea class="form-control" id="author" name="author">$author</textarea> </div> </div> <!-- Textarea --> <div class="form-group"> <label class="col-md-3 control-label" for="url">URL:</label> <div class="col-md-8"> <textarea class="form-control" id="url" name="url">$url</textarea> </div> </div> <!-- Button (Double) --> <div class="form-group"> <label class="col-md-3 control-label" for="submit"></label> <div class="col-md-8"> <button id="submit" name="submit" value="Submit" class="btn btn-success">Submit</button> </div> </div> </fieldset> </form> postform; Layout::pageBottom('CSC206 Project'); }
ConSeanery/CSC206_Green
public/createAudio.php
PHP
mit
5,320
.PHONY: get clean nw: nw.go go build -o nw get: go get -v ./... clean: rm -f nw
robbiev/numberwang
Makefile
Makefile
mit
86
frame_len = .1 keys = { 'DOWN': 0x42, 'LEFT': 0x44, 'RIGHT': 0x43, 'UP': 0x41, 'Q': 0x71, 'ENTER': 0x0a, } apple_domain = 1000 food_values = { 'apple': 3, } game_sizes = { 's': (25, 20), 'm': (50, 40), 'l': (80, 40), } initial_size = 4
tancredi/python-console-snake
snake/config.py
Python
mit
282
<!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_101) on Sat Jul 08 21:03:43 CEST 2017 --> <title>YarnType (jarn 1.0.0 API)</title> <meta name="date" content="2017-07-08"> <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="YarnType (jarn 1.0.0 API)"; } } catch(err) { } //--> var methods = {"i0":9,"i1":9}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </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="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/mini2Dx/yarn/types/YarnString.html" title="interface in org.mini2Dx.yarn.types"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/mini2Dx/yarn/types/YarnValue.html" title="interface in org.mini2Dx.yarn.types"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/mini2Dx/yarn/types/YarnType.html" target="_top">Frames</a></li> <li><a href="YarnType.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#enum.constant.summary">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#enum.constant.detail">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.mini2Dx.yarn.types</div> <h2 title="Enum YarnType" class="title">Enum YarnType</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>java.lang.Enum&lt;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>&gt;</li> <li> <ul class="inheritance"> <li>org.mini2Dx.yarn.types.YarnType</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>All Implemented Interfaces:</dt> <dd>java.io.Serializable, java.lang.Comparable&lt;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>&gt;</dd> </dl> <hr> <br> <pre>public enum <span class="typeNameLabel">YarnType</span> extends java.lang.Enum&lt;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>&gt;</pre> <div class="block">An enum for different Yarn value types</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== ENUM CONSTANT SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="enum.constant.summary"> <!-- --> </a> <h3>Enum Constant Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Constant Summary table, listing enum constants, and an explanation"> <caption><span>Enum Constants</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colOne" scope="col">Enum Constant and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/mini2Dx/yarn/types/YarnType.html#BOOLEAN">BOOLEAN</a></span></code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/mini2Dx/yarn/types/YarnType.html#NUMBER">NUMBER</a></span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/mini2Dx/yarn/types/YarnType.html#STRING">STRING</a></span></code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>static <a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/mini2Dx/yarn/types/YarnType.html#valueOf-java.lang.String-">valueOf</a></span>(java.lang.String&nbsp;name)</code> <div class="block">Returns the enum constant of this type with the specified name.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static <a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>[]</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/mini2Dx/yarn/types/YarnType.html#values--">values</a></span>()</code> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Enum"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Enum</h3> <code>clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf</code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>getClass, notify, notifyAll, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ ENUM CONSTANT DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="enum.constant.detail"> <!-- --> </a> <h3>Enum Constant Detail</h3> <a name="BOOLEAN"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>BOOLEAN</h4> <pre>public static final&nbsp;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a> BOOLEAN</pre> </li> </ul> <a name="NUMBER"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>NUMBER</h4> <pre>public static final&nbsp;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a> NUMBER</pre> </li> </ul> <a name="STRING"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>STRING</h4> <pre>public static final&nbsp;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a> STRING</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="values--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>values</h4> <pre>public static&nbsp;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>[]&nbsp;values()</pre> <div class="block">Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows: <pre> for (YarnType c : YarnType.values()) &nbsp; System.out.println(c); </pre></div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>an array containing the constants of this enum type, in the order they are declared</dd> </dl> </li> </ul> <a name="valueOf-java.lang.String-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>valueOf</h4> <pre>public static&nbsp;<a href="../../../../org/mini2Dx/yarn/types/YarnType.html" title="enum in org.mini2Dx.yarn.types">YarnType</a>&nbsp;valueOf(java.lang.String&nbsp;name)</pre> <div class="block">Returns the enum constant of this type with the specified name. The string must match <i>exactly</i> an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>name</code> - the name of the enum constant to be returned.</dd> <dt><span class="returnLabel">Returns:</span></dt> <dd>the enum constant with the specified name</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code>java.lang.IllegalArgumentException</code> - if this enum type has no constant with the specified name</dd> <dd><code>java.lang.NullPointerException</code> - if the argument is null</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= 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="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../index-all.html">Index</a></li> <li><a href="../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../org/mini2Dx/yarn/types/YarnString.html" title="interface in org.mini2Dx.yarn.types"><span class="typeNameLink">Prev&nbsp;Class</span></a></li> <li><a href="../../../../org/mini2Dx/yarn/types/YarnValue.html" title="interface in org.mini2Dx.yarn.types"><span class="typeNameLink">Next&nbsp;Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../index.html?org/mini2Dx/yarn/types/YarnType.html" target="_top">Frames</a></li> <li><a href="YarnType.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../allclasses-noframe.html">All&nbsp;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> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#enum.constant.summary">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li><a href="#enum.constant.detail">Enum Constants</a>&nbsp;|&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
mini2Dx/jarn
docs/javadoc/1.0.0/org/mini2Dx/yarn/types/YarnType.html
HTML
mit
13,105
package ic2.api.energy.tile; /** * Tile entities which conduct energy pulses without buffering (mostly cables) have to implement this * interface. * * See ic2/api/energy/usage.txt for an overall description of the energy net api. */ public interface IEnergyConductor extends IEnergyAcceptor, IEnergyEmitter { /** * Energy loss for the conductor in EU per block. * * @return Energy loss */ double getConductionLoss(); /** * Amount of energy the insulation will handle before shocking nearby players and mobs. * * @return Insulation energy absorption in EU */ double getInsulationEnergyAbsorption(); /** * Amount of energy the insulation will handle before it is destroyed. * Ensure that this value is greater than the insulation energy absorption + 64. * * @return Insulation-destroying energy in EU */ double getInsulationBreakdownEnergy(); /** * Amount of energy the conductor will handle before it melts. * * @return Conductor-destroying energy in EU */ double getConductorBreakdownEnergy(); /** * Remove the conductor's insulation if the insulation breakdown energy was exceeded. * * @see #getInsulationBreakdownEnergy() */ void removeInsulation(); /** * Remove the conductor if the conductor breakdown energy was exceeded. * * @see #getConductorBreakdownEnergy() */ void removeConductor(); }
AgileMods/MateriaMuto
src/api/java/ic2/api/energy/tile/IEnergyConductor.java
Java
mit
1,482
#ifndef FSL_CACHE_H #define FSL_CACHE_H #define FSL_IO_CACHE_ENTS 512 /* 16KB */ //#define FSL_IO_CACHE_ENTS (4097) #define FSL_IO_CACHE_BYTES 32 #define FSL_IO_CACHE_BITS (FSL_IO_CACHE_BYTES*8) #define byte_to_line(x) ((x)/FSL_IO_CACHE_BYTES) #define bit_to_line(x) ((x)/FSL_IO_CACHE_BITS) #define byte_to_cache_addr(x) byte_to_line(x)*FSL_IO_CACHE_BITS struct fsl_io_cache_ent { uint64_t ce_addr; /* line address */ uint64_t ce_misses; uint64_t ce_hits; uint8_t ce_data[FSL_IO_CACHE_BYTES]; }; struct fsl_io_cache { uint64_t ioc_misses; uint64_t ioc_hits; struct fsl_io_cache_ent ioc_ents[FSL_IO_CACHE_ENTS]; }; void fsl_io_cache_uninit(struct fsl_io_cache* ioc); void fsl_io_cache_init(struct fsl_io_cache* ioc); uint64_t fsl_io_cache_get(struct fsl_rt_io* io, uint64_t bit_off, int num_bits); void fsl_io_cache_drop_bytes( struct fsl_rt_io* io, uint64_t byte_off, uint64_t num_bytes); #endif
chzchzchz/fsl
src/runtime/rt-pread/cache.h
C
mit
913
package com.manuelmaly.hn; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.DataSetObserver; import android.net.Uri; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.MenuItemCompat; import android.support.v4.view.ViewPager; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.app.ActionBar; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.util.TypedValue; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLongClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.manuelmaly.hn.adapter.ArticleAdapter; import com.manuelmaly.hn.model.HNFeed; import com.manuelmaly.hn.model.HNPost; import com.manuelmaly.hn.parser.BaseHTMLParser; import com.manuelmaly.hn.server.HNCredentials; import com.manuelmaly.hn.task.CategoryChildMainTask; import com.manuelmaly.hn.task.CategoryChildTaskLoadMore; import com.manuelmaly.hn.task.HNFeedTaskLoadMore; import com.manuelmaly.hn.task.HNFeedTaskMainFeed; import com.manuelmaly.hn.task.HNVoteTask; import com.manuelmaly.hn.task.ITaskFinishedHandler; import com.manuelmaly.hn.util.FileUtil; import com.manuelmaly.hn.util.FontHelper; import org.androidannotations.annotations.AfterViews; import org.androidannotations.annotations.Background; import org.androidannotations.annotations.EActivity; import org.androidannotations.annotations.SystemService; import org.androidannotations.annotations.ViewById; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashSet; import java.util.Map; import java.util.Set; @EActivity(R.layout.category_child_activity) public class CategoryChildActivity extends BaseListActivity implements ITaskFinishedHandler<HNFeed> { public static final String EXTRA_CATID = "CATID"; @ViewById(R.id.main_list) RecyclerView mPostsList; LinearLayoutManager mLayoutManager; private boolean loading = true; int pastVisiblesItems, visibleItemCount, totalItemCount; int visibleThreshold = 5; private int previousTotal = 0; @ViewById(R.id.main_swiperefreshlayout) SwipeRefreshLayout mSwipeRefreshLayout; @SystemService LayoutInflater mInflater; HNFeed mFeed; ArticleAdapter mPostsListAdapter; Set<Integer> mAlreadyRead; String mCurrentFontSize = null; int mFontSizeTitle; int mFontSizeDetails; int mTitleColor; int mTitleReadColor; private static final int TASKCODE_LOAD_FEED = 310; private static final int TASKCODE_LOAD_MORE_POSTS = 320; private static final int TASKCODE_VOTE = 330; private static final String LIST_STATE = "CategoryChildListState"; private static final String ALREADY_READ_ARTICLES_KEY = "CATEGORYCHILD_ALREADY_READ"; private Parcelable mListState = null; boolean mShouldShowRefreshing = false; String mCatId; ActionBar mActionbar; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); /* // Make sure that we show the overflow menu icon try { ViewConfiguration config = ViewConfiguration.get(this); Field menuKeyField = ViewConfiguration.class .getDeclaredField("sHasPermanentMenuKey"); if (menuKeyField != null) { menuKeyField.setAccessible(true); menuKeyField.setBoolean(config, false); } } catch (Exception e) { // presumably, not relevant } TextView tv = (TextView) getSupportActionBar().getCustomView() .findViewById(R.id.actionbar_title); tv.setTypeface(FontHelper.getComfortaa(this, true)); */ } @AfterViews public void init() { String catid = getIntent().getStringExtra( EXTRA_CATID ); mCatId = (catid != null) ? catid : ""; //mCurrentPage = 0; mFeed = new HNFeed(new ArrayList<HNPost>(), null, ""); //mPostsListAdapter = new PostsAdapter(); mLayoutManager = new GridLayoutManager(this,1); //mLayoutManager = new LinearLayoutManager(getActivity()); //mEmptyListPlaceholder = getEmptyTextView(mRootView); //mPostsList.setEmptyView(mEmptyListPlaceholder); //mPostsList.setAdapter(mPostsListAdapter); mPostsListAdapter = new ArticleAdapter(this.getApplicationContext(), mFeed); mPostsListAdapter.setOnItemClickListener(new ArticleAdapter.OnItemClickListener() { @Override public void onItemClick(int position,View shareView) { mPostsListAdapter.setReadState(position,true); if (Settings.getHtmlViewer(CategoryChildActivity.this).equals( getString(R.string.pref_htmlviewer_browser))) { openURLInBrowser( getArticleViewURL(mFeed.getPosts().get(position)), CategoryChildActivity.this); } else { openPostInApp(mFeed.getPosts().get(position), null, CategoryChildActivity.this); } } }); //mPostsList.setHasFixedSize(true); mPostsList.setLayoutManager(mLayoutManager); mPostsList.setAdapter(mPostsListAdapter); mPostsList.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if(dy > 0) {//check for scroll down visibleItemCount = mLayoutManager.getChildCount(); totalItemCount = mLayoutManager.getItemCount(); pastVisiblesItems = mLayoutManager.findFirstVisibleItemPosition(); if (loading) { if (totalItemCount > previousTotal) { loading = false; previousTotal = totalItemCount; } } if (!loading && (totalItemCount - visibleItemCount) <= (pastVisiblesItems + visibleThreshold)) { // End has been reached CategoryChildTaskLoadMore.start(CategoryChildActivity.this, CategoryChildActivity.this, mFeed, TASKCODE_LOAD_MORE_POSTS, mCatId); setShowRefreshing(true); loading = true; } } } }); //mEmptyListPlaceholder.setTypeface(FontHelper.getComfortaa(getActivity(), true)); mTitleColor = getResources().getColor(R.color.dark_gray_post_title); mTitleReadColor = getResources().getColor(R.color.gray_post_title_read); toggleSwipeRefreshLayout(); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loading = true; previousTotal = 0; // mFeed.getPosts().clear(); startFeedLoading(); } }); loadAlreadyReadCache(); loadIntermediateFeedFromStore(); startFeedLoading(); } @Override public void onResume() { super.onResume(); boolean registeredUserChanged = mFeed.getUserAcquiredFor() != null && (!mFeed.getUserAcquiredFor().equals( Settings.getUserName(CategoryChildActivity.this))); // We want to reload the feed if a new user logged in if (HNCredentials.isInvalidated() || registeredUserChanged) { showFeed(new HNFeed(new ArrayList<HNPost>(), null, "")); startFeedLoading(); } // refresh if font size changed if (refreshFontSizes()) { mPostsListAdapter.notifyDataSetChanged(); } // restore vertical scrolling position if applicable if (mListState != null) { mPostsList.getLayoutManager().onRestoreInstanceState(mListState); } mListState = null; // User may have toggled pull-down refresh, so toggle the SwipeRefreshLayout. toggleSwipeRefreshLayout(); } private void toggleSwipeRefreshLayout() { mSwipeRefreshLayout.setEnabled(Settings.isPullDownRefresh(CategoryChildActivity.this)); } // @Override // public boolean onCreateOptionsMenu( Menu menu ) { // getMenuInflater().inflate( R.menu.menu_share_refresh, menu ); // return super.onCreateOptionsMenu( menu ); // } // // @Override // public boolean onPrepareOptionsMenu( Menu menu ) { // MenuItem refreshItem = menu.findItem( R.id.menu_refresh ); // MenuItemCompat.setActionView( refreshItem, null ); // // return super.onPrepareOptionsMenu( menu ); // } @Override public boolean onOptionsItemSelected( MenuItem item ) { switch (item.getItemId()) { case android.R.id.home: finish(); return true; case R.id.menu_refresh: return true; case R.id.menu_share: return true; default: return super.onOptionsItemSelected( item ); } } @Override public void onTaskFinished(int taskCode, TaskResultCode code, HNFeed result, Object tag) { if (taskCode == TASKCODE_LOAD_FEED) { if (code.equals(TaskResultCode.Success) && mPostsListAdapter != null) { //mCurrentPage = result.getPosts().size(); showFeed(result); } else if (!code.equals(TaskResultCode.Success)) { Toast.makeText(CategoryChildActivity.this, getString(R.string.error_unable_to_retrieve_feed), Toast.LENGTH_SHORT).show(); } } else if (taskCode == TASKCODE_LOAD_MORE_POSTS) { if (!code.equals(TaskResultCode.Success) || result == null || result.getPosts() == null || result.getPosts().size() == 0) { Toast.makeText(CategoryChildActivity.this, getString(R.string.error_unable_to_load_more), Toast.LENGTH_SHORT).show(); mFeed.setLoadedMore(true); // reached the end. } loading = true; previousTotal = 0; mFeed.appendLoadMoreFeed(result); //mCurrentPage = mFeed.getPosts().size(); mFeed.setNextPage(mFeed.getPosts().size()); mPostsListAdapter.notifyDataSetChanged(); } setShowRefreshing(false); } @Background void loadAlreadyReadCache() { if (mAlreadyRead == null) { mAlreadyRead = new HashSet<Integer>(); } SharedPreferences sharedPref = getSharedPreferences( ALREADY_READ_ARTICLES_KEY, Context.MODE_PRIVATE); Editor editor = sharedPref.edit(); Map<String, ?> read = sharedPref.getAll(); Long now = new Date().getTime(); for (Map.Entry<String, ?> entry : read.entrySet()) { Long readAt = (Long) entry.getValue(); Long diff = (now - readAt) / (24 * 60 * 60 * 1000); if (diff >= 2) { editor.remove(entry.getKey()); } else { mAlreadyRead.add(entry.getKey().hashCode()); } } editor.commit(); } @Background void markAsRead(HNPost post) { Long now = new Date().getTime(); String title = post.getTitle(); Editor editor = getSharedPreferences(ALREADY_READ_ARTICLES_KEY, Context.MODE_PRIVATE).edit(); editor.putLong(title, now); editor.commit(); mAlreadyRead.add(title.hashCode()); } private void showFeed(HNFeed feed) { loading = true; previousTotal = 0; mFeed.getPosts().clear(); //mFeed.addPosts(feed.getPosts()); mFeed.setHNFeed(feed.getPosts(), feed.getNextPageURL(), 0, // feed.getNextPage() feed.getUserAcquiredFor(), true); // feed.isLoadedMore() // if (mListState != null) { // mPostsList.getLayoutManager().onRestoreInstanceState(mListState); // } mPostsListAdapter.notifyDataSetChanged(); } private void loadIntermediateFeedFromStore() { new GetLastHNFeedTask().execute((Void) null); long start = System.currentTimeMillis(); Log.i("", "Loading intermediate feed took ms:" + (System.currentTimeMillis() - start)); } class GetLastHNFeedTask extends FileUtil.GetLastHNFeedTask { ProgressDialog progress; @Override protected void onPreExecute() { progress = new ProgressDialog(CategoryChildActivity.this); progress.setMessage("Loading"); progress.show(); } @Override protected void onPostExecute(HNFeed result) { if (progress != null && progress.isShowing()) { progress.dismiss(); } if (result != null && result.getUserAcquiredFor() != null && result.getUserAcquiredFor().equals( Settings.getUserName(App.getInstance()))) { showFeed(result); } } } private void startFeedLoading() { setShowRefreshing(true); CategoryChildMainTask.startOrReattach(this, this, TASKCODE_LOAD_FEED, mCatId, 0); } private boolean refreshFontSizes() { final String fontSize = Settings.getFontSize(this); if ((mCurrentFontSize == null) || (!mCurrentFontSize.equals(fontSize))) { mCurrentFontSize = fontSize; if (fontSize.equals(getString(R.string.pref_fontsize_small))) { mFontSizeTitle = 15; mFontSizeDetails = 11; } else if (fontSize.equals(getString(R.string.pref_fontsize_normal))) { mFontSizeTitle = 18; mFontSizeDetails = 12; } else { mFontSizeTitle = 22; mFontSizeDetails = 15; } return true; } else { return false; } } @Override protected void onRestoreInstanceState(Bundle state) { super.onRestoreInstanceState(state); mListState = state.getParcelable(LIST_STATE); } @Override public void onSaveInstanceState(Bundle state) { super.onSaveInstanceState(state); mListState = mPostsList.getLayoutManager().onSaveInstanceState(); if (mListState != null) { state.putParcelable(LIST_STATE, mListState); } } private String getArticleViewURL(HNPost post) { return ArticleReaderActivity.getArticleViewURL(post, Settings.getHtmlProvider(this), this); } public static void openURLInBrowser(String url, Activity a) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); a.startActivity(browserIntent); } public static void openPostInApp(HNPost post, String overrideHtmlProvider, Activity a) { Intent i = new Intent(a, ArticleReaderActivity_.class); i.putExtra(ArticleReaderActivity.EXTRA_HNPOST, post); if (overrideHtmlProvider != null) { i.putExtra(ArticleReaderActivity.EXTRA_HTMLPROVIDER_OVERRIDE, overrideHtmlProvider); } a.startActivity(i); } public static void shareUrl(HNPost post, Activity a){ Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Intent.EXTRA_SUBJECT, post.getTitle()); shareIntent.putExtra(Intent.EXTRA_TEXT, post.getURL()); a.startActivity(Intent.createChooser(shareIntent, a.getString(R.string.share_article_url))); } private void setShowRefreshing(boolean showRefreshing) { if (!Settings.isPullDownRefresh(CategoryChildActivity.this)) { mShouldShowRefreshing = showRefreshing; supportInvalidateOptionsMenu(); } if (mSwipeRefreshLayout.isEnabled() && (!mSwipeRefreshLayout.isRefreshing() || !showRefreshing)) { mSwipeRefreshLayout.setRefreshing(showRefreshing); } } static class PostViewHolder { TextView titleView; TextView urlView; TextView pointsView; TextView commentsCountView; LinearLayout textContainer; Button commentsButton; } }
tuyendothanh/baohiendai
app/src/main/java/com/manuelmaly/hn/CategoryChildActivity.java
Java
mit
17,715
# hello-world Learning Geihub Dr.Richard please meet Rosemary from NetOne who we want to launch the Haraka application with. Rosemary please can you introduce your Technical guys to Dr. Richard so we can start with the integration process of the Haraka app with NetOne.
cap101986/hello-world
README.md
Markdown
mit
271
import Expr from './Expr' export default class ColorByWavelengthExpr extends Expr { constructor(value, $loc) { super('colorByWavelength', $loc) this.value = value } _evaluateInternal(e) { return e.evalColorByWavelength(this) } }
mezzario/color-math
src/nodes/ColorByWavelengthExpr.js
JavaScript
mit
265
<?php namespace Clue\Tests\React\HttpProxy; use Clue\React\Block; use Clue\React\HttpProxy\ProxyConnector; use React\EventLoop\Loop; /** @group internet */ class FunctionalTest extends AbstractTestCase { public function testNonListeningSocketRejectsConnection() { $proxy = new ProxyConnector('127.0.0.1:9999'); $promise = $proxy->connect('google.com:80'); $this->setExpectedException( 'RuntimeException', 'Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED)', defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111 ); Block\await($promise, Loop::get(), 3.0); } public function testPlainGoogleDoesNotAcceptConnectMethod() { $proxy = new ProxyConnector('google.com'); $promise = $proxy->connect('google.com:80'); $this->setExpectedException( 'RuntimeException', 'Connection to tcp://google.com:80 failed because proxy refused connection with HTTP error code 405 (Method Not Allowed) (ECONNREFUSED)', defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111 ); Block\await($promise, Loop::get(), 3.0); } public function testSecureGoogleDoesNotAcceptConnectMethod() { if (defined('HHVM_VERSION')) { $this->markTestSkipped('TLS not supported on legacy HHVM'); } $proxy = new ProxyConnector('https://google.com:443'); $promise = $proxy->connect('google.com:80'); $this->setExpectedException( 'RuntimeException', 'Connection to tcp://google.com:80 failed because proxy refused connection with HTTP error code 405 (Method Not Allowed) (ECONNREFUSED)', defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111 ); Block\await($promise, Loop::get(), 3.0); } public function testSecureGoogleDoesNotAcceptPlainStream() { $proxy = new ProxyConnector('google.com:443'); $promise = $proxy->connect('google.com:80'); $this->setExpectedException( 'RuntimeException', 'Connection to tcp://google.com:80 failed because connection to proxy was lost while waiting for response (ECONNRESET)', defined('SOCKET_ECONNRESET') ? SOCKET_ECONNRESET : 104 ); Block\await($promise, Loop::get(), 3.0); } /** * @requires PHP 7 */ public function testCancelWhileConnectingShouldNotCreateGarbageCycles() { $proxy = new ProxyConnector('google.com'); gc_collect_cycles(); gc_collect_cycles(); // clear twice to avoid leftovers in PHP 7.4 with ext-xdebug and code coverage turned on $promise = $proxy->connect('google.com:80'); $promise->cancel(); unset($promise); $this->assertEquals(0, gc_collect_cycles()); } }
clue/php-http-proxy-react
tests/FunctionalTest.php
PHP
mit
2,903
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("DarkWeather.WinPhone.WindowsPhone")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("DarkWeather.WinPhone.WindowsPhone")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 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")] [assembly: ComVisible(false)]
alandixon/DarkWeather
DarkWeather/DarkWeather.WinPhone/Properties/AssemblyInfo.cs
C#
mit
1,086
package main import ( "encoding/json" "io" "log" "net/http" "sort" "strings" "google.golang.org/appengine/v2" ) // allowMethods is a comman-separated list of allowed HTTP methods, // suitable for Allow or CORS allow-methods header. var allowMethods = "GET, HEAD, OPTIONS" // ServeObject writes object o to w, with optional body and CORS headers, // based on the in-flight request r. func (s *Storage) ServeObject(w http.ResponseWriter, r *http.Request, o *Object) error { // headers h := w.Header() for k, v := range o.Meta { h.Set(k, v) } h.Set("allow", allowMethods) if o := corsMatch(&s.CORS, r.Header.Get("origin")); o != "" { h.Set("access-control-allow-origin", o) if r.Method == "OPTIONS" { h.Set("access-control-allow-methods", allowMethods) h.Set("access-control-allow-headers", r.Header.Get("access-control-request-headers")) h.Set("access-control-expose-headers", "Location, Etag, Content-Disposition") if s.CORS.MaxAge != "" { h.Set("access-control-max-age", s.CORS.MaxAge) } } } // redirect if v := o.Redirect(); v != "" && r.Method != "OPTIONS" { h.Set("location", v) w.WriteHeader(o.RedirectCode()) return nil } // body if r.Method == "GET" { _, err := io.Copy(w, o.Body) return err } return nil } // HandleChangeHook handles Object Change Notifications as described at // https://cloud.google.com/storage/docs/object-change-notification. // It removes objects from cache. func (s *Storage) HandleChangeHook(w http.ResponseWriter, r *http.Request) { // skip sync requests if v := r.Header.Get("x-goog-resource-state"); v == "sync" { return } // this is not a client request, so don't use newContext. ctx := appengine.NewContext(r) // we only care about name and the bucket body := struct{ Name, Bucket string }{} if err := json.NewDecoder(r.Body).Decode(&body); err != nil { log.Printf("[ERROR] json.Decode: %v", err.Error()) return } if err := s.PurgeCache(ctx, body.Bucket, body.Name); err != nil { log.Printf("[ERROR] s.PurgeCache(%q, %q): %v", body.Bucket, body.Name, err) w.WriteHeader(http.StatusInternalServerError) // let GCS retry } } // ValidMethod reports whether m is a supported HTTP method. func ValidMethod(m string) bool { return strings.Index(allowMethods, m) >= 0 } func corsMatch(cors *CORS, o string) string { if len(cors.Origin) == 0 { return "" } if cors.Origin[0] == "*" { return "*" } if cors.Origin[0] == o { return o } i := sort.SearchStrings(cors.Origin, o) if i < len(cors.Origin) && cors.Origin[i] == o { return o } return "" }
goadesign/goa.design
appengine/handle.go
GO
mit
2,581
#!/bin/bash echo "parsing 08_speedup" strindex() { x="${1%%$2*}" [[ $x = $1 ]] && echo -1 || echo ${#x} } declare -a files=`find /dissertation_output/08_speedup -name pge_errs.log -exec ls -d {} \;` rm -f table.txt rm -f headers2.txt printf "problem " > table2.txt for file in ${files[@]}; do if [ ! -f "table.txt" ]; then cols=`head -n 1 $file` # echo "problem $cols" echo "group problem $cols" > table.txt fi idx1=`strindex $file "config"` idx2=`strindex $file "clean"` let idx1+=7 let end=idx2-idx1-1 group=${file:idx1:end} group="$(echo -e "${group}" | tr -d '[[:space:]]')" idx1=`strindex $file "clean"` idx2=`strindex $file "pge_errs.log"` let idx1+=6 let end=idx2-idx1-1 short=${file:idx1:end} echo "$group $short" echo "$group" >> headers2.txt # contents=`tail -n +2 $file` while read -r line do echo "$group $short $line" >> table.txt done < <(tail -n +2 $file) done # headers while read -r line do echo -e "$line " | tr -d '[[:space:]]' >> table2.txt printf " " >> table2.txt done < <(cat headers2.txt | awk '!x[$0]++') echo "" >> table2.txt cp table2.txt table_tmp.txt cat table_tmp.txt | sed -e "s/000//g" | sed -e "s/.yml//g" | sed -e "s/explicit_//g" > table2.txt # exit 1 python3 parse.py >> table2.txt python3 graph.py
verdverm/pypge
experiments/post_process/08_speedup/parse.sh
Shell
mit
1,295
# PowerShell-Things I am a lazy Microsoft Windows admin. These scripts make my work life easier. Just a collection of powershell scripts to help me with day to day tasks.
nethomas/PowerShell-Things
README.md
Markdown
mit
175
td { border:solid 1px grey; padding: 20px; text-align: center; text-decoration: none; } td:hover { background: aqua; } .selected{ background: aqua; } .notSelected{ background: #f8f8f8; } body { font: 400 16px 'Muli', sans-serif; } .inner { padding: 30px; } /*Table*/ table{ margin: 10px; } body > div.container-fluid.inner > table > tbody > tr > td{ border: 4px solid #fff; width: 170px; padding: 10px; } body > div.container-fluid.inner > table > tbody > tr > td:hover{ background-color: aqua; } button{ margin-top: 20px; position: absolute; } #newNumbersBtn{ display: none; } .instructions { text-align: center; margin-top: 60px; }
ivanshen/Se7en
css/main.css
CSS
mit
709
using Newtonsoft.Json; namespace NadekoBot.Core.Common { public class CmdStrings { public string[] Usages { get; } public string Description { get; } [JsonConstructor] public CmdStrings( [JsonProperty("args")]string[] usages, [JsonProperty("desc")]string description ) { Usages = usages; Description = description; } } }
ShadowNoire/NadekoBot
NadekoBot.Core/Common/CmdStrings.cs
C#
mit
441
import React, { Component, PropTypes } from 'react'; /*** Third Party Components ***/ import Dialog from 'react-toolbox/lib/dialog'; import { Button, IconButton } from 'react-toolbox/lib/button'; import Icon from 'react-fa'; import style from './style.scss'; class NavButton extends Component { constructor(props) { super(props); this.state = { open: false }; } handleOpen = () => { this.setState({ open: true }); }; handleClose = () => { this.setState({ open: false }); }; render() { return ( <div className={`${style.root} ${this.props.className}`} > <IconButton className={style.navBars} neutral={false} onClick={this.handleOpen}> <Icon name={this.state.open ? 'times-circle-o' : 'bars'} /> </IconButton> <Dialog active={this.state.open} onOverlayClick={this.handleClose} className={style.dialog} > <Button flat label="What is this?" target="_blank" neutral={false} className={style.link} /> <Button flat label="Why?" target="_blank" neutral={false} className={style.link} /> <Button flat label="Contact" target="_blank" neutral={false} className={style.link} /> </Dialog> </div> ); } } export default NavButton;
natac13/vegan-recipe-app-redux
app/components/NavButton/NavButton.js
JavaScript
mit
1,674
import clone from "clone"; const initialState = { busy: false }; export default function(state = initialState, action) { const { type, payload } = action; switch (type) { case "BUSY": { const newState = clone(state); newState.busy = payload; const stateCopy = { ...state }; return newState; } } return state; }
holyman2k/react-starter-kit
src/app/reducers/busyReducer.js
JavaScript
mit
334
require 'fluent/test' require 'fluent/test/driver/input' require 'fluent/plugin/in_jmx'
niyonmaruz/fluent-plugin-jmx
spec/spec_helper.rb
Ruby
mit
88
# frozen_string_literal: true require "hanami/helpers/html_helper/html_builder" module Hanami module Helpers # HTML builder # # By including <tt>Hanami::Helpers::HtmlHelper</tt> it will inject one private method: <tt>html</tt>. # This is a HTML5 markup builder. # # Features: # # * Support for complex markup without the need of concatenation # * Auto closing HTML5 tags # * Custom tags # * Content tag auto escape (XSS protection) # * Support for view local variables # # Usage: # # * It knows how to close tags according to HTML5 spec (1) # * It accepts content as first argument (2) # * It accepts another builder as first argument (3) # * It accepts content as block which returns a string (4) # * It accepts content as a block with nested markup builders (5) # * It builds attributes from given hash (6) # * It combines attributes and block (7) # # @since 0.1.0 # # @see Hanami::Helpers::HtmlHelper#html # # @example Usage # # 1 # html.div # => <div></div> # html.img # => <img> # # # 2 # html.div('hello') # => <div>hello</div> # # # 3 # html.div(html.p('hello')) # => <div><p>hello</p></div> # # # 4 # html.div { 'hello' } # # => # #<div> # # hello # #</div> # # # 5 # html.div do # p 'hello' # end # # => # #<div> # # <p>hello</p> # #</div> # # # 6 # html.div('hello', id: 'el', 'data-x': 'y') # => <div id="el" data-x="y">hello</div> # # # 7 # html.div(id: 'yay') { 'hello' } # # => # #<div id="yay"> # # hello # #</div> # # # 8 # html do # li 'Hello' # li 'Hanami' # end # # => # #<li>Hello</li> # #<li>Hanami</li> # # # # @example Complex markup # # # # NOTICE THE LACK OF CONCATENATION BETWEEN div AND input BLOCKS <3 # # # # html.form(action: '/users', method: 'POST') do # div do # label 'First name', for: 'user-first-name' # input type: 'text', id: 'user-first-name', name: 'user[first_name]', value: 'L' # end # # input type: 'submit', value: 'Save changes' # end # # => # #<form action="/users" method="POST" accept-charset="utf-8"> # # <div> # # <label for="user-first-name">First name</label> # # <input type="text" id="user-first-name" name="user[first_name]" value="L"> # # </div> # # <input type="submit" value="Save changes"> # #</form> # # # # @example Custom tags # html.tag(:custom, 'Foo', id: 'next') # => <custom id="next">Foo</custom> # html.empty_tag(:xr, id: 'next') # => <xr id="next"> # # # # @example Auto escape # html.div('hello') # => <div>hello</hello> # html.div { 'hello' } # => <div>hello</hello> # html.div(html.p('hello')) # => <div><p>hello</p></hello> # html.div do # p 'hello' # end # => <div><p>hello</p></hello> # # # # html.div("<script>alert('xss')</script>") # # => "<div>&lt;script&gt;alert(&apos;xss&apos;)&lt;&#x2F;script&gt;</div>" # # html.div { "<script>alert('xss')</script>" } # # => "<div>&lt;script&gt;alert(&apos;xss&apos;)&lt;&#x2F;script&gt;</div>" # # html.div(html.p("<script>alert('xss')</script>")) # # => "<div><p>&lt;script&gt;alert(&apos;xss&apos;)&lt;&#x2F;script&gt;</p></div>" # # html.div do # p "<script>alert('xss')</script>" # end # # => "<div><p>&lt;script&gt;alert(&apos;xss&apos;)&lt;&#x2F;script&gt;</p></div>" # # # @example Basic usage # # # # THE VIEW CAN BE A SIMPLE RUBY OBJECT # # # # require 'hanami/helpers' # # class MyView # include Hanami::Helpers::HtmlHelper # # # Generates # # <aside id="sidebar"> # # <div>hello</hello> # # </aside> # def sidebar # html.aside(id: 'sidebar') do # div 'hello' # end # end # end # # # @example View context # # # # LOCAL VARIABLES FROM VIEWS ARE AVAILABLE INSIDE THE NESTED BLOCKS OF HTML BUILDER # # # # require 'hanami/view' # require 'hanami/helpers' # # Book = Struct.new(:title) # # module Books # class Show # include Hanami::View # include Hanami::Helpers::HtmlHelper # # def title_widget # html.div do # h1 book.title # end # end # end # end # # book = Book.new('The Work of Art in the Age of Mechanical Reproduction') # rendered = Books::Show.render(format: :html, book: book) # # rendered # # => <div> # # <h1>The Work of Art in the Age of Mechanical Reproduction</h1> # # </div> module HtmlHelper private # Instantiate an HTML builder # # @param blk [Proc,Hanami::Helpers::HtmlHelper::HtmlBuilder,NilClass] the optional content block # # @return [Hanami::Helpers::HtmlHelper::HtmlBuilder] the HTML builder # # @since 0.1.0 # # @see Hanami::Helpers::HtmlHelper # @see Hanami::Helpers::HtmlHelper::HtmlBuilder def html(&blk) if block_given? HtmlBuilder.new.fragment(&blk) else HtmlBuilder.new end end end end end
hanami/helpers
lib/hanami/helpers/html_helper.rb
Ruby
mit
5,702
// Too much stuff for one sketch... #include "mu.h" #include <string> #include <iostream> #define EXAMPLES_DIRECTORY "/Users/r/Projects/Mu/examples/sounds/" // #define THUMPS_AND_SCRATCHES_DIRECTORY "/Users/r/Projects/Mu/SoundSets/TAS/" // #define PLUCKED_NOTE_DIRECTORY "/Users/r/Projects/Mu/SoundSets/A/" void wait_for_input() { std::cout << "Hit return to quit: "; std::string s; std::getline(std::cin, s); } mu::MuFloat beats_per_minute() { return 100.0; } mu::MuTick beat_to_tick(mu::MuFloat beat) { mu::MuFloat tics_per_beat = 44100 * 60.0 / beats_per_minute(); return beat * tics_per_beat; } mu::MuFloat pitch_to_ratio(mu::MuFloat sample, mu::MuTick tick) { (void) tick; return mu::MuUtils::pitch_to_ratio(sample); } // ================================================================ class PitchShift { public: PitchShift() { identity_stream_ = new mu::IdentityStream(); gain_stream_ = new mu::GainStream(); resample_stream_ = new mu::ResampleStream(); gain_stream_->set_signal_source(identity_stream_); resample_stream_->set_timing_source(gain_stream_); set_shift(1.0); } ~PitchShift() { } mu::MuFloat shift() { return mu::MuUtils::ratio_to_pitch(gain_stream_->gain()); } void set_shift(mu::MuFloat semitones) { gain_stream_->set_gain(mu::MuUtils::pitch_to_ratio(semitones)); } mu::MuStream *source() { return resample_stream_->sample_source(); } void set_source(mu::MuStream *source) { resample_stream_->set_sample_source(source); } mu::MuStream *stream() { return resample_stream_; } protected: mu::IdentityStream *identity_stream_; mu::GainStream *gain_stream_; mu::ResampleStream *resample_stream_; }; // ================================================================ class Basic { public: Basic() { sequence_stream_ = new mu::SequenceStream(); } void add(mu::MuFloat t, std::string name, mu::MuFloat gain, mu::MuFloat pitch) { // leaks PitchShift objects! PitchShift *ps = new PitchShift(); ps->set_source(frs(name)); ps->set_shift(pitch); sequence_stream_->add_source(ps->stream(), beat_to_tick(t), gain); } mu::MuStream *stream() { return sequence_stream_; } mu::FileReadStream *frs(std::string name) { mu::FileReadStream *s = new mu::FileReadStream(); s->set_file_name(EXAMPLES_DIRECTORY + name); return s; } protected: mu::SequenceStream *sequence_stream_; }; // ================================================================ class ProbabilityStream: public mu::SingleSourceStream { public: ProbabilityStream() : probability_(0.5), current_p_(0.5), prev_start_(-1) { } virtual ~ProbabilityStream() { } ProbabilityStream *clone() { ProbabilityStream *c = new ProbabilityStream(); c->set_source(mu::MuUtils::clone_stream(source())); c->set_probability(probability()); return c; } mu::MuFloat probability() { return probability_; } void set_probability(mu::MuFloat probability) { probability_ = probability; } std::string get_class_name() { return "ProbabilityStream"; } void inspect_aux(int level, std::stringstream *ss) { MuStream::inspect_aux(level, ss); *ss << "probability() = " << probability() << std::endl; SingleSourceStream::inspect_aux(level, ss); } bool render(mu::MuTick buffer_start, mu::MuBuffer *buffer) { int n_frames = buffer->frames(); if (buffer_start != prev_start_ + n_frames) { // time jumped... current_p_ = (double)rand() / RAND_MAX; } prev_start_ = buffer_start; #if 1 bool ret; // printf("%p: p=%f, q=%f, r=%f\n", this, probability_, current_p_); if (probability_ <= current_p_) { ret = false; } else if (source_ == NULL) { ret = false; } else { ret = source_->render(buffer_start, buffer); } return ret; #else return source_->render(buffer_start, buffer); #endif } protected: mu::MuFloat probability_; mu::MuFloat current_p_; mu::MuTick prev_start_; }; // ================================================================ class Swish { public: Swish() { sequence_stream_ = new mu::SequenceStream(); } void add(mu::MuFloat t, std::string name, mu::MuFloat p, mu::MuFloat gain) { mu::FileReadStream *frs = new mu::FileReadStream(); frs->set_file_name(EXAMPLES_DIRECTORY + name); ProbabilityStream *ps = new ProbabilityStream(); ps->set_source(frs); ps->set_probability(p); sequence_stream_->add_source(ps, beat_to_tick(t), gain); } mu::MuStream *stream() { return sequence_stream_; } protected: mu::SequenceStream *sequence_stream_; }; // ================================================================ class RoomTone { public: RoomTone() { room_ = new mu::FileReadStream(); loop_ = new mu::LoopStream(); room_->set_file_name(EXAMPLES_DIRECTORY "room_tone.wav"); loop_->set_source(room_); loop_->set_interval(room_->duration()); loop_->set_source_end(room_->duration()); } mu::MuStream *stream() { return loop_; } protected: mu::FileReadStream *room_; mu::LoopStream *loop_; }; // class RoomTone // ================================================================ class Plucker { public: Plucker() { pluck_inst_ = new mu::PluckInst(); }; ~Plucker() {}; void pluck(mu::MuFloat t, std::string name, mu::MuFloat gain_db) { pluck_inst_->pluck(beat_to_tick(t), frs(name), gain_db); } void hammer(mu::MuFloat t, std::string name, mu::MuFloat gain_db) { pluck_inst_->hammer(beat_to_tick(t), frs(name), gain_db); } void dampen(mu::MuFloat t) { pluck_inst_->dampen(beat_to_tick(t)); } mu::MuStream *stream() { return pluck_inst_->stream(); } protected: mu::PluckInst *pluck_inst_; mu::FileReadStream *frs(std::string name) { mu::FileReadStream *s = new mu::FileReadStream(); s->set_file_name(EXAMPLES_DIRECTORY + name); return s; } }; // ================================================================ int main() { mu::PlayerRt player_rt; mu::Transport transport; Basic *basic = new Basic(); Swish *swish = new Swish(); RoomTone *room_tone = new RoomTone(); Plucker *plucker_alto = new Plucker(); Plucker *plucker_alto2 = new Plucker(); Plucker *plucker_bass = new Plucker(); mu::SumStream *mix = new mu::SumStream(); mu::LoopStream *loop = new mu::LoopStream(); printf("1 beat = %ld ticks\n", beat_to_tick(1)); #define KICK_GAIN 1.0 #define CLICK1_GAIN 0.30 #define CLICK2_GAIN 0.30 #define BUMP_GAIN 0.30 #define ALTO_GAIN_DB mu::MuUtils::ratio_to_db(0.25) #define BASS_GAIN_DB mu::MuUtils::ratio_to_db(0.35) basic->add(0.00, "thump.wav", KICK_GAIN, -24.0); basic->add(1.50, "thump.wav", KICK_GAIN, -24.0); basic->add(3.00, "thump.wav", KICK_GAIN, -24.0); basic->add(3.50, "thump.wav", KICK_GAIN/2.0, -24.0); basic->add(4.00, "thump.wav", KICK_GAIN, -24.0); basic->add(5.50, "thump.wav", KICK_GAIN, -24.0); basic->add(7.50, "thump.wav", KICK_GAIN/2.0, -24.0); swish->add(0.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(0.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(1.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(1.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(2.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(2.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(3.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(3.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(4.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(4.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(5.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(5.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(6.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(6.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(7.00, "s21.wav", 0.67, CLICK1_GAIN); swish->add(7.50, "s21.wav", 0.67, CLICK1_GAIN); swish->add(0.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(0.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(1.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(1.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(2.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(2.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(3.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(3.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(4.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(4.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(5.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(5.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(6.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(6.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(7.25, "s20.wav", 0.67, CLICK2_GAIN); swish->add(7.75, "s20.wav", 0.67, CLICK2_GAIN); swish->add(0.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(1.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(2.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(3.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(4.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(5.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(6.50, "s14.wav", 0.67, BUMP_GAIN); swish->add(7.50, "s14.wav", 0.67, BUMP_GAIN); // alto part plucker_alto->pluck(0.00, "67.wav", ALTO_GAIN_DB); plucker_alto->pluck(0.75, "67.wav", ALTO_GAIN_DB); plucker_alto->pluck(1.50, "72.wav", ALTO_GAIN_DB); plucker_alto->hammer(1.65, "74.wav", ALTO_GAIN_DB); plucker_alto->pluck(2.50, "72.wav", ALTO_GAIN_DB); plucker_alto->pluck(3.00, "72.wav", ALTO_GAIN_DB); plucker_alto->pluck(4.00, "72.wav", ALTO_GAIN_DB); plucker_alto->hammer(4.15, "74.wav", ALTO_GAIN_DB); plucker_alto->pluck(4.75, "72.wav", ALTO_GAIN_DB); plucker_alto->pluck(5.50, "74.wav", ALTO_GAIN_DB); plucker_alto->pluck(6.50, "74.wav", ALTO_GAIN_DB); plucker_alto->pluck(7.00, "74.wav", ALTO_GAIN_DB); plucker_alto->dampen(8.00); plucker_alto2->pluck(3.50, "60.wav", ALTO_GAIN_DB); plucker_alto2->dampen(5.50); // bass part plucker_bass->pluck(0.00, "31.wav", BASS_GAIN_DB); plucker_bass->pluck(1.50, "36.wav", BASS_GAIN_DB); plucker_bass->pluck(4.00, "29.wav", BASS_GAIN_DB); plucker_bass->pluck(5.50, "38.wav", BASS_GAIN_DB); plucker_bass->dampen(8.00); mix->add_source(basic->stream()); mix->add_source(swish->stream()); mix->add_source(room_tone->stream()); mix->add_source(plucker_alto->stream()); mix->add_source(plucker_alto2->stream()); mix->add_source(plucker_bass->stream()); loop->set_source(mix); loop->set_interval(beat_to_tick(8.0)); loop->set_source_end(beat_to_tick(8.0)); // printf("mix:\n%s\n", mix->inspect().c_str()); transport.set_player(&player_rt); transport.set_source(loop); transport.run(); wait_for_input(); transport.stop(); return 0; }
rdpoor/mu
examples/mu_16.cpp
C++
mit
10,718
namespace DP.Tinast.Controls { using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; using Interfaces; /// <summary> /// The oil temp, coolant temp, and intake temp indicators on the right side of the display will display the temperature levels as well as blink a warning indicator if one of the temperature levels is outside operating condition, by either being too low or too high. /// </summary> /// <seealso cref="Windows.UI.Xaml.Controls.UserControl" /> /// <seealso cref="Windows.UI.Xaml.Markup.IComponentConnector" /> /// <seealso cref="Windows.UI.Xaml.Markup.IComponentConnector2" /> public sealed partial class TemperatureControl : UserControl { /// <summary> /// The temp level property /// </summary> public static readonly DependencyProperty LevelProperty = DependencyProperty.Register("Level", typeof(int), typeof(TemperatureControl), new PropertyMetadata(default(int))); /// <summary> /// The min level property /// </summary> public static readonly DependencyProperty WarningProperty = DependencyProperty.Register("Warning", typeof(bool), typeof(TemperatureControl), new PropertyMetadata(default(bool))); /// <summary> /// The max level property /// </summary> public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(TemperatureControl), new PropertyMetadata("Temp:")); /// <summary> /// The last recorded level /// </summary> private int lastLevel = 0; /// <summary> /// The ticks. /// </summary> private ulong ticks = 0; /// <summary> /// Initializes a new instance of the <see cref="TemperatureControl"/> class. /// </summary> public TemperatureControl() { this.InitializeComponent(); TinastGlobal.Current.IndicatorTick += UpdateTimer_Tick; this.DataContext = this; this.temp.Foreground = ColorPalette.IndicatorColor; this.tempBackground.Background = ColorPalette.IndicatorBackground; this.text.Foreground = ColorPalette.IndicatorColor; this.textBackground.Background = ColorPalette.IndicatorBackground; } /// <summary> /// Gets or sets the temperature level. /// </summary> /// <value> /// The temperature level. /// </value> [DesignerCategory("TemperatureControl")] [Description("The temperature level.")] public int Level { get { return (int)this.GetValue(LevelProperty); } set { this.SetValue(LevelProperty, value); } } /// <summary> /// Gets or sets the warning level. /// </summary> /// <value> /// The warning level. /// </value> [DesignerCategory("TemperatureControl")] [Description("The warning level.")] public bool Warning { get { return (bool)this.GetValue(WarningProperty); } set { this.SetValue(WarningProperty, value); } } /// <summary> /// Gets or sets the text. /// </summary> /// <value> /// The text. /// </value> [DesignerCategory("TemperatureControl")] [Description("The text.")] public string Text { get { return (string)this.GetValue(TextProperty); } set { this.SetValue(TextProperty, value); } } /// <summary> /// Updates the timer tick. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void UpdateTimer_Tick(object sender, EventArgs e) { int level = this.Level; if (lastLevel != level) { this.textBackground.Background = this.tempBackground.Background = ColorPalette.IndicatorWarningBackground; this.text.Foreground = this.temp.Foreground = ColorPalette.NeedleColor; } else if (this.Warning && (this.ticks % 2) == 0) { this.textBackground.Background = this.tempBackground.Background = ColorPalette.IndicatorWarningBackground; this.text.Foreground = this.temp.Foreground = ColorPalette.WarningColor; } else { this.textBackground.Background = this.tempBackground.Background = ColorPalette.IndicatorBackground; this.text.Foreground = this.temp.Foreground = ColorPalette.IndicatorColor; } ++this.ticks; lastLevel = this.Level; } } }
daparker2/Tinast_Public
src/lib/Controls/TemperatureControl.xaml.cs
C#
mit
5,466
module TestApi module ApplicationHelper end end
ali-hassan/test_api
app/helpers/test_api/application_helper.rb
Ruby
mit
52
/*====================================================================* - Copyright (C) 2001 Leptonica. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *====================================================================*/ /* * spixio.c * * This does fast serialization of a pix in memory to file, * copying the raw data for maximum speed. The underlying * function serializes it to memory, and it is wrapped to be * callable from standard pixRead and pixWrite functions. * * Reading spix from file * PIX *pixReadStreamSpix() * l_int32 readHeaderSpix() * l_int32 freadHeaderSpix() * l_int32 sreadHeaderSpix() * * Writing spix to file * l_int32 pixWriteStreamSpix() * * Low-level serialization of pix to/from memory (uncompressed) * PIX *pixReadMemSpix() * l_int32 pixWriteMemSpix() * l_int32 pixSerializeToMemory() * PIX *pixDeserializeFromMemory() * */ #include <string.h> #include BLIK_OPENALPR_U_allheaders_h //original-code:"allheaders.h" #ifndef NO_CONSOLE_IO #define DEBUG_SERIALIZE 0 #endif /* ~NO_CONSOLE_IO */ /*-----------------------------------------------------------------------* * Reading spix from file * *-----------------------------------------------------------------------*/ /*! * pixReadStreamSpix() * * Input: stream * Return: pix, or null on error. * * Notes: * (1) If called from pixReadStream(), the stream is positioned * at the beginning of the file. */ PIX * pixReadStreamSpix(FILE *fp) { size_t nbytes; l_uint8 *data; PIX *pix; PROCNAME("pixReadStreamSpix"); if (!fp) return (PIX *)ERROR_PTR("stream not defined", procName, NULL); if ((data = l_binaryReadStream(fp, &nbytes)) == NULL) return (PIX *)ERROR_PTR("data not read", procName, NULL); if ((pix = pixReadMemSpix(data, nbytes)) == NULL) { FREE(data); return (PIX *)ERROR_PTR("pix not made", procName, NULL); } FREE(data); return pix; } /*! * readHeaderSpix() * * Input: filename * &width (<return>) * &height (<return>) * &bps (<return>, bits/sample) * &spp (<return>, samples/pixel) * &iscmap (<optional return>; input NULL to ignore) * Return: 0 if OK, 1 on error * * Notes: * (1) If there is a colormap, iscmap is returned as 1; else 0. */ l_int32 readHeaderSpix(const char *filename, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap) { l_int32 ret; FILE *fp; PROCNAME("readHeaderSpix"); if (!filename) return ERROR_INT("filename not defined", procName, 1); if (!pwidth || !pheight || !pbps || !pspp) return ERROR_INT("input ptr(s) not defined", procName, 1); if ((fp = fopenReadStream(filename)) == NULL) return ERROR_INT("image file not found", procName, 1); ret = freadHeaderSpix(fp, pwidth, pheight, pbps, pspp, piscmap); fclose(fp); return ret; } /*! * freadHeaderSpix() * * Input: stream * &width (<return>) * &height (<return>) * &bps (<return>, bits/sample) * &spp (<return>, samples/pixel) * &iscmap (<optional return>; input NULL to ignore) * Return: 0 if OK, 1 on error * * Notes: * (1) If there is a colormap, iscmap is returned as 1; else 0. */ l_int32 freadHeaderSpix(FILE *fp, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap) { l_int32 nbytes, ret; l_uint32 *data; PROCNAME("freadHeaderSpix"); if (!fp) return ERROR_INT("stream not defined", procName, 1); if (!pwidth || !pheight || !pbps || !pspp) return ERROR_INT("input ptr(s) not defined", procName, 1); nbytes = fnbytesInFile(fp); if (nbytes < 32) return ERROR_INT("file too small to be spix", procName, 1); if ((data = (l_uint32 *)CALLOC(6, sizeof(l_uint32))) == NULL) return ERROR_INT("CALLOC fail for data", procName, 1); if (fread(data, 4, 6, fp) != 6) return ERROR_INT("error reading data", procName, 1); ret = sreadHeaderSpix(data, pwidth, pheight, pbps, pspp, piscmap); FREE(data); return ret; } /*! * sreadHeaderSpix() * * Input: data * &width (<return>) * &height (<return>) * &bps (<return>, bits/sample) * &spp (<return>, samples/pixel) * &iscmap (<optional return>; input NULL to ignore) * Return: 0 if OK, 1 on error * * Notes: * (1) If there is a colormap, iscmap is returned as 1; else 0. */ l_int32 sreadHeaderSpix(const l_uint32 *data, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap) { char *id; l_int32 d, ncolors; PROCNAME("sreadHeaderSpix"); if (!data) return ERROR_INT("data not defined", procName, 1); if (!pwidth || !pheight || !pbps || !pspp) return ERROR_INT("input ptr(s) not defined", procName, 1); *pwidth = *pheight = *pbps = *pspp = 0; if (piscmap) *piscmap = 0; /* Check file id */ id = (char *)data; if (id[0] != 's' || id[1] != 'p' || id[2] != 'i' || id[3] != 'x') return ERROR_INT("not a valid spix file", procName, 1); *pwidth = data[1]; *pheight = data[2]; d = data[3]; if (d <= 16) { *pbps = d; *pspp = 1; } else { *pbps = 8; *pspp = d / 8; /* if the pix is 32 bpp, call it 4 samples */ } ncolors = data[5]; if (piscmap) *piscmap = (ncolors == 0) ? 0 : 1; return 0; } /*-----------------------------------------------------------------------* * Writing spix to file * *-----------------------------------------------------------------------*/ /*! * pixWriteStreamSpix() * * Input: stream * pix * Return: 0 if OK; 1 on error */ l_int32 pixWriteStreamSpix(FILE *fp, PIX *pix) { l_uint8 *data; size_t size; PROCNAME("pixWriteStreamSpix"); if (!fp) return ERROR_INT("stream not defined", procName, 1); if (!pix) return ERROR_INT("pix not defined", procName, 1); if (pixWriteMemSpix(&data, &size, pix)) return ERROR_INT("failure to write pix to memory", procName, 1); fwrite(data, 1, size, fp); FREE(data); return 0; } /*-----------------------------------------------------------------------* * Low-level serialization of pix to/from memory (uncompressed) * *-----------------------------------------------------------------------*/ /*! * pixReadMemSpix() * * Input: data (const; uncompressed) * size (of data) * Return: pix, or null on error */ PIX * pixReadMemSpix(const l_uint8 *data, size_t size) { return pixDeserializeFromMemory((l_uint32 *)data, size); } /*! * pixWriteMemSpix() * * Input: &data (<return> data of serialized, uncompressed pix) * &size (<return> size of returned data) * pix (all depths; colormap OK) * Return: 0 if OK, 1 on error */ l_int32 pixWriteMemSpix(l_uint8 **pdata, size_t *psize, PIX *pix) { return pixSerializeToMemory(pix, (l_uint32 **)pdata, psize); } /*! * pixSerializeToMemory() * * Input: pixs (all depths, colormap OK) * &data (<return> serialized data in memory) * &nbytes (<return> number of bytes in data string) * Return: 0 if OK, 1 on error * * Notes: * (1) This does a fast serialization of the principal elements * of the pix, as follows: * "spix" (4 bytes) -- ID for file type * w (4 bytes) * h (4 bytes) * d (4 bytes) * wpl (4 bytes) * ncolors (4 bytes) -- in colormap; 0 if there is no colormap * cdata (4 * ncolors) -- size of serialized colormap array * rdatasize (4 bytes) -- size of serialized raster data * = 4 * wpl * h * rdata (rdatasize) */ l_int32 pixSerializeToMemory(PIX *pixs, l_uint32 **pdata, size_t *pnbytes) { char *id; l_int32 w, h, d, wpl, rdatasize, ncolors, nbytes, index; l_uint8 *cdata; /* data in colormap array (4 bytes/color table entry) */ l_uint32 *data; l_uint32 *rdata; /* data in pix raster */ PIXCMAP *cmap; PROCNAME("pixSerializeToMemory"); if (!pdata || !pnbytes) return ERROR_INT("&data and &nbytes not both defined", procName, 1); *pdata = NULL; *pnbytes = 0; if (!pixs) return ERROR_INT("pixs not defined", procName, 1); pixGetDimensions(pixs, &w, &h, &d); wpl = pixGetWpl(pixs); rdata = pixGetData(pixs); rdatasize = 4 * wpl * h; ncolors = 0; cdata = NULL; if ((cmap = pixGetColormap(pixs)) != NULL) pixcmapSerializeToMemory(cmap, 4, &ncolors, &cdata); nbytes = 24 + 4 * ncolors + 4 + rdatasize; if ((data = (l_uint32 *)CALLOC(nbytes / 4, sizeof(l_uint32))) == NULL) return ERROR_INT("data not made", procName, 1); *pdata = data; *pnbytes = nbytes; id = (char *)data; id[0] = 's'; id[1] = 'p'; id[2] = 'i'; id[3] = 'x'; data[1] = w; data[2] = h; data[3] = d; data[4] = wpl; data[5] = ncolors; if (ncolors > 0) memcpy((char *)(data + 6), (char *)cdata, 4 * ncolors); index = 6 + ncolors; data[index] = rdatasize; memcpy((char *)(data + index + 1), (char *)rdata, rdatasize); #if DEBUG_SERIALIZE fprintf(stderr, "Serialize: " "raster size = %d, ncolors in cmap = %d, total bytes = %d\n", rdatasize, ncolors, nbytes); #endif /* DEBUG_SERIALIZE */ FREE(cdata); return 0; } /*! * pixDeserializeFromMemory() * * Input: data (serialized data in memory) * nbytes (number of bytes in data string) * Return: pix, or NULL on error * * Notes: * (1) See pixSerializeToMemory() for the binary format. */ PIX * pixDeserializeFromMemory(const l_uint32 *data, size_t nbytes) { char *id; l_int32 w, h, d, imdatasize, ncolors; l_uint32 *imdata; /* data in pix raster */ PIX *pixd; PIXCMAP *cmap; PROCNAME("pixDeserializeFromMemory"); if (!data) return (PIX *)ERROR_PTR("data not defined", procName, NULL); if (nbytes < 28) return (PIX *)ERROR_PTR("invalid data", procName, NULL); id = (char *)data; if (id[0] != 's' || id[1] != 'p' || id[2] != 'i' || id[3] != 'x') return (PIX *)ERROR_PTR("invalid id string", procName, NULL); w = data[1]; h = data[2]; d = data[3]; if ((pixd = pixCreate(w, h, d)) == NULL) return (PIX *)ERROR_PTR("pix not made", procName, NULL); ncolors = data[5]; if (ncolors > 0) { cmap = pixcmapDeserializeFromMemory((l_uint8 *)(&data[6]), 4, ncolors); if (!cmap) return (PIX *)ERROR_PTR("cmap not made", procName, NULL); pixSetColormap(pixd, cmap); } imdata = pixGetData(pixd); imdatasize = nbytes - 24 - 4 * ncolors - 4; if (imdatasize != data[6 + ncolors]) L_ERROR("imdatasize is inconsistent with nbytes\n", procName); memcpy((char *)imdata, (char *)(data + 7 + ncolors), imdatasize); #if DEBUG_SERIALIZE fprintf(stderr, "Deserialize: " "raster size = %d, ncolors in cmap = %d, total bytes = %lu\n", imdatasize, ncolors, nbytes); #endif /* DEBUG_SERIALIZE */ return pixd; }
BonexGu/Blik2D-SDK
Blik2D/addon/openalpr-2.3.0_for_blik/openalpr-windows-2.2.0/tesseract-ocr/dependencies/liblept/src/spixio.c
C
mit
13,532
var mongoose = require('mongoose'); var Schema = mongoose.Schema; var ObjectId = Schema.Types.ObjectId; /** * Connect Mongodb */ mongoose.connect('mongodb://localhost/speedyfx'); /** * Schemas */ var UserSchema = new Schema({ uid: { type: String, required: true, trim: true, index: { unique: true, dropDups: true} }, pwd: { type: String, required: true, select: false }, nick: { type: String, required: true, trim: true }, email: { type: String, required: true, trim: true }, gender: { type: String, enum: ['male', 'female'] }, image: String, status: String, address: String, phone: String }); var ContactSchema = new Schema({ uid: { type: String, required: true, index: true }, cid: { type: String, required: true, index: true }, alias: { type: String, 'default': '' }, black: { type: Boolean, required: true, 'default': false } }); var MessageSchema = new Schema({ uid: { type: String, required: true, index: true }, mid: { type: String, required: true, index: true }, msg: { type: String, required: true }, time: { type: String, required: true, 'default': Date.now } }); /** * Models */ var User = module.exports.User = mongoose.model('user', UserSchema); var Contact = module.exports.Contact = mongoose.model('contact', ContactSchema); var Message = module.exports.Message = mongoose.model('message', MessageSchema); /** * Create query condition expression */ module.exports.Q = function Q(fields, params) { var r = {}; for (var i in fields) { // required condition if (fields[i]) { if (params[i] === undefined) return null; else r[i] = params[i]; } // optional condition else { if (params[i] != undefined) r[i] = params[i]; } } return r; }; /** * Create selection filter expression */ module.exports.F = function F(def, params) { if (params.filter) return params.filter.replace(/,/g, ' '); else return def; }; /** * Create update setter expression */ module.exports.S = function S(fields, params) { var r = {}; for (var i in fields) { // required fields if (fields[i]) { if (params[i] === undefined) return null; else r[i] = params[i]; } // optional fields else { if (params[i] != undefined) r[i] = params[i]; } } return { $set: r }; }; /** * Extract field from query result and make array */ module.exports.asArray = function asArray(doc, field) { var r = []; doc.forEach(function (obj, index, array) { if (obj[field] != undefined) r.push(obj[field]); }); return r; }; module.exports.toArray = function toArray(doc) { var r = []; doc.forEach(function (obj, index, array) { r.push(obj.toObject()); }); return r; };
johnsmith17th/SpeedyFx
lib/dataaccess/handler/mongo/model.js
JavaScript
mit
2,917
from distutils.core import setup import sslserver setup(name="django-sslserver", version=sslserver.__version__, author="Ted Dziuba", author_email="tjdziuba@gmail.com", description="An SSL-enabled development server for Django", url="https://github.com/teddziuba/django-sslserver", packages=["sslserver", "sslserver.management", "sslserver.management.commands"], package_dir={"sslserver": "sslserver"}, package_data={"sslserver": ["certs/development.crt", "certs/development.key", "certs/server.csr"]}, install_requires=["setuptools", "Django >= 1.4"], license="MIT" )
mapennell/django-sslserver
setup.py
Python
mit
759
# encoding: utf-8 module Pulo class Water #def self.bulk_modulus #BulkModulus.new(2.15*10**9) #end #def self.expansion_coefficient # Dimensionless.n(0.000088) #end #def self.enthalpy_of_vaporization # 40680 #end def self.standard_density Density.kilograms_per_cubic_meter(1000) end #def self.density(temperature,pressure) # tmp=temperature.is_a?(Temperature) ? temperature.value : temperature # pres=pressure.is_a?(Pressure) ? pressure.value : pressure # Density.new(999.8 / (1 + Water.expansion_coefficient * tmp) / (1 - (pres - 1105) / Water.bulk_modulus.value)) #end #def self.boiling_point(pressure) # pres=pressure.is_a?(Pressure) ? pressure.value : pressure # k=GAS_CONSTANT/Water.enthalpy_of_vaporization # Temperature.new(1/((1/Temperature.new(100).kelvin)-k*Math.log(pres/Atmosphere.standard_pressure.value)),:kelvin) #end #def self.melting_point(pressure) # pres=pressure.is_a?(Pressure) ? pressure.value : pressure # Temperature.new(Math::E**(Math.log(Temperature.new(0).kelvin)+((-1.56*10**-6)/6030)*(pres-Atmosphere.standard_pressure.value)),:kelvin) #end end end
AndyFlem/pulo
lib/pulo/material/water.rb
Ruby
mit
1,182
package cronapi.odata.server; import cronapi.ErrorResponse; import cronapi.RestClient; import cronapi.database.TransactionManager; import javax.persistence.EntityManagerFactory; import javax.persistence.FlushModeType; import org.apache.olingo.odata2.api.ODataService; import org.apache.olingo.odata2.api.edm.EdmEntitySet; import org.apache.olingo.odata2.api.edm.EdmEntityType; import org.apache.olingo.odata2.api.edm.provider.EdmProvider; import org.apache.olingo.odata2.api.processor.ODataSingleProcessor; import org.apache.olingo.odata2.api.uri.UriInfo; import org.apache.olingo.odata2.jpa.processor.api.ODataJPAContext; import org.apache.olingo.odata2.jpa.processor.api.ODataJPAServiceFactory; import org.apache.olingo.odata2.jpa.processor.api.exception.ODataJPARuntimeException; public class JPAODataServiceFactory extends ODataJPAServiceFactory { private final EntityManagerFactory entityManagerFactory; private final String namespace; private int order; public JPAODataServiceFactory(EntityManagerFactory entityManagerFactory, String namespace, int order) { this.entityManagerFactory = entityManagerFactory; this.namespace = namespace; this.order = order; } @Override public ODataJPAContext initializeODataJPAContext() throws ODataJPARuntimeException { ODataJPAContext context = getODataJPAContext(); context.setEntityManagerFactory(entityManagerFactory); context.setPersistenceUnitName(namespace); TransactionManager.addNamespace(namespace, context.getEntityManager()); context.getEntityManager().setFlushMode(FlushModeType.COMMIT); context.setJPAEdmExtension(new DatasourceExtension(context, order)); context.setoDataJPAQueryExtensionEntityListener(new QueryExtensionEntityListener()); return context; } @Override public ODataService createODataSingleProcessorService(EdmProvider provider, ODataSingleProcessor processor) { return super.createODataSingleProcessorService(provider, processor); } @Override public Exception handleException(Throwable throwable, UriInfo info) { String id = null; try { final EdmEntitySet oDataEntitySet = info.getTargetEntitySet(); final EdmEntityType entityType = oDataEntitySet.getEntityType(); id = entityType.getName(); } catch (Exception e) { //Abafa } String msg = ErrorResponse.getExceptionMessage(throwable, RestClient.getRestClient() != null ? RestClient.getRestClient().getMethod() : "GET", id); return new RuntimeException(msg, throwable); } }
technecloud/cronapi-java
src/main/java/cronapi/odata/server/JPAODataServiceFactory.java
Java
mit
2,529
FROM kbase/kbase:sdkbase2.latest MAINTAINER KBase Developer [Dylan Chivian (DCChivian@lbl.gov)] # ----------------------------------------- # In this section, you can install any system dependencies required # to run your App. For instance, you could place an apt-get update or # install line here, a git checkout to download code, or run any other # installation scripts. # RUN apt-get update # ----------------------------------------- COPY ./ /kb/module RUN mkdir -p /kb/module/work RUN chmod -R a+rw /kb/module WORKDIR /kb/module RUN make all # Install Gblocks # WORKDIR /kb/module RUN \ curl http://molevol.cmima.csic.es/castresana/Gblocks/Gblocks_Linux64_0.91b.tar.Z > Gblocks_Linux64_0.91b.tar.Z && \ tar xfz Gblocks_Linux64_0.91b.tar.Z && \ chmod 555 Gblocks_0.91b/Gblocks && \ cp Gblocks_0.91b/Gblocks ./ #ln -s Gblocks_0.91b/Gblocks Gblocks ENTRYPOINT [ "./scripts/entrypoint.sh" ] CMD [ ]
dcchivian/kb_gblocks
Dockerfile
Dockerfile
mit
930
<?php namespace Bricks\SiteBundle\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use DoctrineExtensions\Taggable\Taggable; use Gedmo\Mapping\Annotation as Gedmo; use Eko\FeedBundle\Item\Writer\RoutedItemInterface; use Bricks\SiteBundle\Model\Resource; /** * Bricks\SiteBundle\Entity\ExternalResource * * @ORM\Entity(repositoryClass="Bricks\SiteBundle\Entity\ExternalResourceRepository") * @ORM\Table(name="external_resource") * * @Gedmo\Loggable(logEntryClass="Bricks\SiteBundle\Entity\ExternalResourceLogEntry") */ class ExternalResource implements RoutedItemInterface, Taggable, Resource { private $tags; /** * @var integer $id * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var text $title * * @Gedmo\Versioned * @ORM\Column(type="text") */ private $title; /** * @var text $description * * @Gedmo\Versioned * @ORM\Column(type="text", nullable=true) */ private $description; /** * @Gedmo\Slug(fields={"title"}) * @ORM\Column(length=128, unique=true) */ private $slug; /** * @var boolean $published * * @Gedmo\Versioned * @ORM\Column(type="boolean", nullable=true) */ private $published; /** * @var datetime $published_at * * @ORM\Column(name="published_at", type="datetime", nullable=true) */ private $publishedAt; /** * @var text $url * * @Gedmo\Versioned * @ORM\Column(type="text", name="url", nullable=true) */ private $url; /** * The owner of the resource (eg. a user that submits a link to his own blog) * * @var object $user * * @ORM\ManyToOne(targetEntity="Bricks\UserBundle\Entity\User", inversedBy="externalResources") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true) */ private $user; /** * The user who reported * * @var object $user * * @ORM\ManyToOne(targetEntity="Bricks\UserBundle\Entity\User") * @ORM\JoinColumn(name="reporter_id", referencedColumnName="id", nullable=true) */ private $reporter; /** * @var datetime $updated_at * * @Gedmo\Timestampable(on="update") * @ORM\Column(type="datetime", nullable=true) */ private $updated_at; /** * @var datetime $created_at * * @Gedmo\Timestampable(on="create") * @ORM\Column(type="datetime", nullable=true) */ private $created_at; /************************************************************************************************** * custom functions **************************************************************************************************/ /** * return if the object is new by checking the field 'id' */ public function isNew() { return !$this->getId(); } /** * Set published * * @param boolean $published * @return Brick */ public function setPublished($published) { $this->published = $published; if ($published == true && $this->getPublishedAt() == null) { $this->setPublishedAt(new \Datetime()); } return $this; } /** * this method returns entity item title */ public function getFeedItemTitle() { return $this->getTitle(); } /** * this method returns entity item description (or content) */ public function getFeedItemDescription() { return "A new external resource has been published on SymfonyBricks.com: \"{$this->getTitle()}\""; } /** * this method returns entity item publication date */ public function getFeedItemPubDate() { return $this->getPublishedAt(); } /** * this method returns the name of the route */ public function getFeedItemRouteName() { return 'external_resource_show'; } /** * this method must return an array with the parameters that are required for the route */ public function getFeedItemRouteParameters() { return array( 'slug' => $this->getSlug() ); } /** * this method returns the anchor that will be appended to the router-generated url. Note: can be an empty string */ public function getFeedItemUrlAnchor() { return ''; } public function getTags() { $this->tags = $this->tags ?: new ArrayCollection(); return $this->tags; } public function getTaggableType() { return 'external_resource_tag'; } public function getTaggableId() { return $this->getId(); } /** * Return resource type * * @return mixed */ public function getResourceType() { return self::TYPE_EXTERNAL_RESOURCE; } /************************************************************************************************** * getters and setters **************************************************************************************************/ /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set title * * @param string $title * @return ExternalResource */ public function setTitle($title) { $this->title = $title; return $this; } /** * Get title * * @return string */ public function getTitle() { return $this->title; } /** * Set description * * @param string $description * @return ExternalResource */ public function setDescription($description) { $this->description = $description; return $this; } /** * Get description * * @return string */ public function getDescription() { return $this->description; } /** * Set slug * * @param string $slug * @return ExternalResource */ public function setSlug($slug) { $this->slug = $slug; return $this; } /** * Get slug * * @return string */ public function getSlug() { return $this->slug; } /** * Get published * * @return boolean */ public function getPublished() { return $this->published; } /** * Set publishedAt * * @param \DateTime $publishedAt * @return ExternalResource */ public function setPublishedAt($publishedAt) { $this->publishedAt = $publishedAt; return $this; } /** * Get publishedAt * * @return \DateTime */ public function getPublishedAt() { return $this->publishedAt; } /** * Set url * * @param string $url * @return ExternalResource */ public function setUrl($url) { $this->url = $url; return $this; } /** * Get url * * @return string */ public function getUrl() { return $this->url; } /** * Set updated_at * * @param \DateTime $updatedAt * @return ExternalResource */ public function setUpdatedAt($updatedAt) { $this->updated_at = $updatedAt; return $this; } /** * Get updated_at * * @return \DateTime */ public function getUpdatedAt() { return $this->updated_at; } /** * Set created_at * * @param \DateTime $createdAt * @return ExternalResource */ public function setCreatedAt($createdAt) { $this->created_at = $createdAt; return $this; } /** * Get created_at * * @return \DateTime */ public function getCreatedAt() { return $this->created_at; } /** * Set user * * @param \Bricks\UserBundle\Entity\User $user * @return ExternalResource */ public function setUser(\Bricks\UserBundle\Entity\User $user = null) { $this->user = $user; return $this; } /** * Get user * * @return \Bricks\UserBundle\Entity\User */ public function getUser() { return $this->user; } /** * Set reporter * * @param \Bricks\UserBundle\Entity\User $reporter * @return ExternalResource */ public function setReporter(\Bricks\UserBundle\Entity\User $reporter = null) { $this->reporter = $reporter; return $this; } /** * Get reporter * * @return \Bricks\UserBundle\Entity\User */ public function getReporter() { return $this->reporter; } }
inmarelibero/SymfonyBricks
src/Bricks/SiteBundle/Entity/ExternalResource.php
PHP
mit
8,954
body { background: url(img/brickwall.png) repeat 0 0; } header { margin-bottom: 2em; } header a { width: 100%; height: auto; margin: 45px auto 0; display: block; } #userss { border:3px solid black; position:absolute; background:url(img/witewall_3.png) repeat 0 0; top:10%; left:60%; width:30%; height:50%; } #userss { position:absolute; top:15%; left:60%; width:30%; height:45%; overflow:auto; } #chat { position:absolute; top:10%; left:5%; width:50%; height:50%; overflow:auto; } #notif { color:grey; position:absolute; top:70%; left:5%; width:50%; height:20%; } #inputform { padding:10px; } #chatt { position:absolute; top:80%; left:5%; width:40%; } #sendchat { color: black; font: "Courier New", Courier, monospace; background-color: #38ACEC; position:absolute; top:80%; left:45%; width:120px; }
aravindkk/Single-room-chat-application
style.css
CSS
mit
1,036
import 'rxjs/add/operator/combineLatest'; import 'rxjs/add/operator/take'; import 'rxjs/add/operator/skip'; import 'rxjs/add/operator/withLatestFrom'; import 'rxjs/add/operator/concat'; import 'rxjs/add/operator/share'; export default function(...observables) { return source => { const published = source.share(); return published .combineLatest(...observables) .take(1) .concat(published.skip(1).withLatestFrom(...observables)); }; }
kelly-shen/canigraduate.uchicago.edu
vue-frontend/src/lib/with-latest-from-blocking.js
JavaScript
mit
467
<!--========== START COMPONENT TEAM PRODUCT LIST ==========--> <div class="component-team-product-list"> <div class="product-list-wrapper"> <div class="title-primary"> <p class="left-title"> <span class="left-top-title">anteposuerit </span> <span class="left-bottom-title">ullamcorper</span> </p> <h2>Our Team</h2> <p class="right-title"> <span class="cube"></span> blandit praesent </p> </div> <div class="filter"> <div class="select-view"> <a href="team-style-list-department.php" title="Team List Department"><span class="fa fa-align-justify"></span></a> <a href="team-style-list.php" title="Team List" class="active"><span class="fa fa-th-list"></span></a> <a href="team-style-grid.php" title="Team Grid"><span class="fa fa-th-large"></span></a> </div> <div class="clearfix"></div> </div> <div class="content"> <div class="row" data-elegant-height="> .item .contain-details"> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-1.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> Dean J. Nelson <span class="speciality-min">Graphic Designer</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Graphic Designer</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p> <p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl.</p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-11.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> William N. Gardner <span class="speciality-min">Developer</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Developer</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera goica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-2.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> Shirley A. Morris <span class="speciality-min">Manager</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Manager</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit. <br> Praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-4.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> Kay G. Cardenas <span class="speciality-min">Biological-physical anthropologist</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Biological-physical anthropologist</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit. </p> <p> Praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-9.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> Stephen C. Reeves <span class="speciality-min">Stephen C. Reeves</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Stephen C. Reeves</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. <br> Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-5.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> William N. Gardner <span class="speciality-min">Developer</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Developer</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera goicagoica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> <div class="item"> <div class="col-sm-3"> <div class="contain-image"> <img src="assets/image/team-image-12.jpg" alt="team-image" width="280" height="260"/> <div class="clearfix"></div> </div> </div> <div class="col-sm-9"> <div class="contain-details"> <h3 class="name"> Shirley A. Morris <span class="speciality-min">Manager</span> </h3> <ul class="social-media"> <li><a href="#"><span class="fa fa-facebook-square"></a></span></li> <li><a href="#"><span class="fa fa-twitter"</a></span></li> <li><a href="#"><span class="fa fa-dribbble"></a></span></li> <li><a href="#"><span class="fa fa-google-plus"></a></span></li> <li><a href="#"><span class="fa fa-instagram"></a></span></li> <li><a href="#"><span class="fa fa-vine"></a></span></li> </ul> <div class="speciality"> <div class="name-section">Speciality:</div> <div class="details"> <p>Manager</p> </div> <div class="clearfix"></div> </div> <div class="description"> <div class="name-section">Description:</div> <div class="details"> <p> Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit. <br/> Praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. </p> </div> </div> <div class="final-border"><span></span></div> <div class="clearfix"></div> </div> </div> <div class="clearfix"></div> </div> </div> </div> </div> <div class="clearfix"></div> </div> <!--========== END COMPONENT TEAM PRODUCT LIST ==========-->
easy-development/meith-html-template
php-version/parts/team/team-style-list.php
PHP
mit
16,270
(function ($, window) { $.fn.twitterify = function (options) { return this.each(function () { new window.twitterify.Twitterifier(this, options) .init() .load(); }); }; }(jQuery, window));
bradgignac/jquery-twitterify
lib/jquery.twitterify.js
JavaScript
mit
224
using System; using System.Collections.Generic; namespace NetSpec { public sealed class ExampleGroup { internal ExampleGroup parent; internal ExampleHooks hooks = new ExampleHooks(); internal HooksPhase phase = HooksPhase.nothingExecuted; private string internalDescription { get; } private FilterFlags flags { get; } private bool isInternalRootExampleGroup { get; } private List<ExampleGroup> childGroups = new List<ExampleGroup>(); private List<Example> childExamples = new List<Example>(); internal ExampleGroup(string description, FilterFlags flags, bool isInternalRootExampleGroup = false) { this.internalDescription = description; this.flags = flags; this.isInternalRootExampleGroup = isInternalRootExampleGroup; } public override string ToString() { return internalDescription; } public List<Example> examples { get { var examples = childExamples; foreach (var group in childGroups) { examples.AddRange(group.examples); } return examples; } } internal string name { get { if (parent != null) { if (parent.name == null) { return ToString(); } return $"{name}, {ToString()}"; } else { return isInternalRootExampleGroup ? null : ToString(); } } } internal FilterFlags filterFlags { get { var aggregateFlags = flags; walkUp(group => { foreach (var pair in group.flags) { aggregateFlags[pair.Key] = pair.Value; } }); return aggregateFlags; } } internal List<Action<ExampleMetadata>> befores { get { var closures = new List<Action<ExampleMetadata>>(); closures.AddRange(hooks.befores.Reversed()); walkUp(group => { closures.AddRange(group.hooks.befores.Reversed()); }); return closures; } } internal List<Action<ExampleMetadata>> afters { get { var closures = hooks.afters; walkUp(group => { closures.AddRange(group.hooks.afters); }); return closures; } } internal void walkDownExamples(Action<Example> callback) { foreach (var example in childExamples) { callback(example); } foreach (var group in childGroups) { group.walkDownExamples(callback); } } internal void appendExampleGroup(ExampleGroup group) { group.parent = this; childGroups.Add(group); } internal void appendExample(Example example) { example.group = this; childExamples.Add(example); } private void walkUp(Action<ExampleGroup> callback) { var group = this; var parent = group.parent; while (parent != null) { callback(parent); group = parent; parent = group.parent; } } } }
petester42/NetSpec
src/netspec/ExampleGroup.cs
C#
mit
3,897
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("Com0Com.CSharp.Examples")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Com0Com.CSharp.Examples")] [assembly: AssemblyCopyright("Copyright © 2016")] [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("c3329bae-4fbd-4f26-852c-e8c10bf5b2ca")] // 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")]
rdelhommer/MainPower.Com0com.Redirector
examples/Com0Com.CSharp.Examples/Properties/AssemblyInfo.cs
C#
mit
1,422
module Sastrawi module Morphology module Disambiguator class DisambiguatorPrefixRule31b def disambiguate(word) contains = /^peny([aiueo])(.*)$/.match(word) if contains matches = contains.captures return "s#{matches[0]}#{matches[1]}" end end end end end end
meisyal/sastrawi-ruby
lib/sastrawi/morphology/disambiguator/disambiguator_prefix_rule31b.rb
Ruby
mit
353
#ifndef _CVECTOR_H_ #define _CVECTOR_H_ ////////////////////////////////////////////////////////////////////////////////// // INCLUDES / LIBS /////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// #pragma comment ( lib, "d3dx9.lib" ) #include <D3DX9.h> #include "cVectorManagerC.h" #include "cVectorDataC.h" ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // DEFINES /////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// #ifndef DARKSDK_COMPILE #define DARKSDK __declspec ( dllexport ) #define DBPRO_GLOBAL #else #define DARKSDK static #define DBPRO_GLOBAL static #endif #define SAFE_DELETE( p ) { if ( p ) { delete ( p ); ( p ) = NULL; } } #define SAFE_RELEASE( p ) { if ( p ) { ( p )->Release ( ); ( p ) = NULL; } } #define SAFE_DELETE_ARRAY( p ) { if ( p ) { delete [ ] ( p ); ( p ) = NULL; } } #define SDK_BOOL int #define SDK_TRUE 1 #define SDK_FALSE 0 #define SDK_FLOAT DWORD #define SDK_LPSTR DWORD #define SDK_RETFLOAT(f) *(DWORD*)&f #define SDK_RETSTR DWORD pDestStr, ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// // INTERNAL FUNCTIONS //////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// #ifdef DARKSDK_COMPILE void Constructor3DMaths ( HINSTANCE hSetup ); void Destructor3DMaths ( void ); void SetErrorHandler3DMaths ( LPVOID pErrorHandlerPtr ); void PassCoreData3DMaths ( LPVOID pGlobPtr ); void RefreshD3D3DMaths ( int iMode ); #endif DARKSDK void Constructor ( HINSTANCE hSetup ); DARKSDK void Destructor ( void ); DARKSDK void SetErrorHandler ( LPVOID pErrorHandlerPtr ); DARKSDK void PassCoreData ( LPVOID pGlobPtr ); DARKSDK void RefreshD3D ( int iMode ); DARKSDK D3DXVECTOR2 GetVector2 ( int iID ); DARKSDK D3DXVECTOR3 GetVector3 ( int iID ); DARKSDK D3DXVECTOR4 GetVector4 ( int iID ); DARKSDK D3DXMATRIX GetMatrix ( int iID ); DARKSDK int GetExist ( int iID ); DARKSDK bool CheckTypeIsValid ( int iID, int iType ); /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// // COMMAND FUNCTIONS ////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// DARKSDK SDK_BOOL MakeVector2 ( int iID ); DARKSDK SDK_BOOL DeleteVector2 ( int iID ); DARKSDK void SetVector2 ( int iID, float fX, float fY ); DARKSDK void CopyVector2 ( int iSource, int iDestination ); DARKSDK void AddVector2 ( int iResult, int iA, int iB ); DARKSDK void SubtractVector2 ( int iResult, int iA, int iB ); DARKSDK void MultiplyVector2 ( int iID, float fValue ); DARKSDK void DivideVector2 ( int iID, float fValue ); DARKSDK SDK_BOOL IsEqualVector2 ( int iA, int iB ); DARKSDK SDK_BOOL IsNotEqualVector2 ( int iA, int iB ); DARKSDK SDK_FLOAT GetXVector2 ( int iID ); DARKSDK SDK_FLOAT GetYVector2 ( int iID ); DARKSDK void GetBaryCentricCoordinatesVector2 ( int iResult, int iA, int iB, int iC, float f, float g ); DARKSDK void CatmullRomVector2 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK SDK_FLOAT GetCCWVector2 ( int iA, int iB ); DARKSDK SDK_FLOAT DotProductVector2 ( int iA, int iB ); DARKSDK void HermiteVector2 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK SDK_FLOAT GetLengthVector2 ( int iID ); DARKSDK SDK_FLOAT GetLengthSquaredVector2 ( int iID ); DARKSDK void LinearInterpolationVector2 ( int iResult, int iA, int iB, float s ); DARKSDK void MaximizeVector2 ( int iResult, int iA, int iB ); DARKSDK void MinimizeVector2 ( int iResult, int iA, int iB ); DARKSDK void NormalizeVector2 ( int iResult, int iSource ); DARKSDK void ScaleVector2 ( int iResult, int iSource, float s ); DARKSDK void TransformVectorCoordinates2 ( int iResult, int iSource, int iMatrix ); DARKSDK SDK_BOOL MakeVector3 ( int iID ); DARKSDK SDK_BOOL DeleteVector3 ( int iID ); DARKSDK void SetVector3 ( int iID, float fX, float fY, float fZ ); DARKSDK void CopyVector3 ( int iSource, int iDestination ); DARKSDK void AddVector3 ( int iResult, int iA, int iB ); DARKSDK void SubtractVector3 ( int iResult, int iA, int iB ); DARKSDK void MultiplyVector3 ( int iID, float fValue ); DARKSDK void DivideVector3 ( int iID, float fValue ); DARKSDK SDK_BOOL IsEqualVector3 ( int iA, int iB ); DARKSDK SDK_BOOL IsNotEqualVector3 ( int iA, int iB ); DARKSDK void GetBaryCentricCoordinatesVector3 ( int iResult, int iA, int iB, int iC, float f, float g ); DARKSDK void CatmullRomVector3 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK void CrossProductVector3 ( int iResult, int iA, int iB ); DARKSDK void HermiteVector3 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK void LinearInterpolationVector3 ( int iResult, int iA, int iB, float s ); DARKSDK void MaximizeVector3 ( int iResult, int iA, int iB ); DARKSDK void MinimizeVector3 ( int iResult, int iA, int iB ); DARKSDK void NormalizeVector3 ( int iResult, int iSource ); DARKSDK void ScaleVector3 ( int iResult, int iSource, float s ); DARKSDK SDK_FLOAT DotProductVector3 ( int iA, int iB ); DARKSDK SDK_FLOAT GetLengthVector3 ( int iID ); DARKSDK SDK_FLOAT GetLengthSquaredVector3 ( int iID ); DARKSDK void ProjectVector3 ( int iResult, int iSource, int iProjectionMatrix, int iViewMatrix, int iWorldMatrix ); DARKSDK void TransformVectorCoordinates3 ( int iResult, int iSource, int iMatrix ); DARKSDK void TransformVectorNormalCoordinates3 ( int iResult, int iSource, int iMatrix ); DARKSDK SDK_FLOAT GetXVector3 ( int iID ); DARKSDK SDK_FLOAT GetYVector3 ( int iID ); DARKSDK SDK_FLOAT GetZVector3 ( int iID ); DARKSDK SDK_BOOL MakeVector4 ( int iID ); DARKSDK SDK_BOOL DeleteVector4 ( int iID ); DARKSDK void SetVector4 ( int iID, float fX, float fY, float fZ, float fW ); DARKSDK void CopyVector4 ( int iSource, int iDestination ); DARKSDK void AddVector4 ( int iResult, int iA, int iB ); DARKSDK void SubtractVector4 ( int iResult, int iA, int iB ); DARKSDK void MultiplyVector4 ( int iID, float fValue ); DARKSDK void DivideVector4 ( int iID, float fValue ); DARKSDK SDK_BOOL IsEqualVector4 ( int iA, int iB ); DARKSDK SDK_BOOL IsNotEqualVector4 ( int iA, int iB ); DARKSDK SDK_FLOAT GetXVector4 ( int iID ); DARKSDK SDK_FLOAT GetYVector4 ( int iID ); DARKSDK SDK_FLOAT GetZVector4 ( int iID ); DARKSDK SDK_FLOAT GetWVector4 ( int iID ); DARKSDK void GetBaryCentricCoordinatesVector4 ( int iResult, int iA, int iB, int iC, float f, float g ); DARKSDK void CatmullRomVector4 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK void HermiteVector4 ( int iResult, int iA, int iB, int iC, int iD, float s ); DARKSDK SDK_FLOAT GetLengthVector4 ( int iID ); DARKSDK SDK_FLOAT GetLengthSquaredVector4 ( int iID ); DARKSDK void LinearInterpolationVector4 ( int iResult, int iA, int iB, float s ); DARKSDK void MaximizeVector4 ( int iResult, int iA, int iB ); DARKSDK void MinimizeVector4 ( int iResult, int iA, int iB ); DARKSDK void NormalizeVector4 ( int iResult, int iSource ); DARKSDK void ScaleVector4 ( int iResult, int iSource, float s ); DARKSDK void TransformVector4 ( int iResult, int iSource, int iMatrix ); DARKSDK SDK_BOOL MakeMatrix ( int iID ); DARKSDK SDK_BOOL DeleteMatrix ( int iID ); DARKSDK SDK_BOOL Matrix4Exist ( int iID ); DARKSDK void CopyMatrix ( int iSource, int iDestination ); DARKSDK void AddMatrix ( int iResult, int iA, int iB ); DARKSDK void SubtractMatrix ( int iResult, int iA, int iB ); DARKSDK void MultiplyMatrix ( int iResult, int iA, int iB ); DARKSDK void MultiplyMatrix ( int iID, float fValue ); DARKSDK void DivideMatrix ( int iID, float fValue ); DARKSDK SDK_BOOL IsEqualMatrix ( int iA, int iB ); DARKSDK SDK_BOOL IsNotEqualMatrix ( int iA, int iB ); DARKSDK void SetIdentityMatrix ( int iID ); DARKSDK SDK_FLOAT InverseMatrix ( int iResult, int iSource ); DARKSDK SDK_BOOL IsIdentityMatrix ( int iID ); DARKSDK void BuildLookAtRHMatrix ( int iResult, int iVectorEye, int iVectorAt, int iVectorUp ); DARKSDK void BuildLookAtLHMatrix ( int iResult, int iVectorEye, int iVectorAt, int iVectorUp ); DARKSDK void BuildOrthoRHMatrix ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); DARKSDK void BuildOrthoLHMatrix ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); DARKSDK void BuildPerspectiveRHMatrix ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); DARKSDK void BuildPerspectiveLHMatrix ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); DARKSDK void BuildPerspectiveFovRHMatrix ( int iResult, float fFOV, float fAspect, float fZNear, float fZFar ); DARKSDK void BuildPerspectiveFovLHMatrix ( int iResult, float fFOV, float fAspect, float fZNear, float fZFar ); DARKSDK void BuildReflectionMatrix ( int iResult, float a, float b, float c, float d ); DARKSDK void BuildRotationAxisMatrix ( int iResult, int iVectorAxis, float fAngle ); DARKSDK void RotateXMatrix ( int iID, float fAngle ); DARKSDK void RotateYMatrix ( int iID, float fAngle ); DARKSDK void RotateZMatrix ( int iID, float fAngle ); DARKSDK void RotateYawPitchRollMatrix ( int iID, float fYaw, float fPitch, float fRoll ); DARKSDK void ScaleMatrix ( int iID, float fX, float fY, float fZ ); DARKSDK void TranslateMatrix ( int iID, float fX, float fY, float fZ ); DARKSDK void TransposeMatrix ( int iResult, int iSource ); DARKSDK void GetWorldMatrix ( int iID ); DARKSDK void GetViewMatrix ( int iID ); DARKSDK void GetProjectionMatrix ( int iID ); DARKSDK void SetProjectionMatrix ( int iID ); #ifdef DARKSDK_COMPILE bool dbMakeVector2 ( int iID ); bool dbDeleteVector2 ( int iID ); void dbSetVector2 ( int iID, float fX, float fY ); void dbCopyVector2 ( int iSource, int iDestination ); void dbAddVector2 ( int iResult, int iA, int iB ); void dbSubtractVector2 ( int iResult, int iA, int iB ); void dbMultiplyVector2 ( int iID, float fValue ); void dbDivideVector2 ( int iID, float fValue ); bool dbIsEqualVector2 ( int iA, int iB ); bool dbIsNotEqualVector2 ( int iA, int iB ); float dbXVector2 ( int iID ); float dbYVector2 ( int iID ); void dbBCCVector2 ( int iResult, int iA, int iB, int iC, float f, float g ); void dbCatmullRomVector2 ( int iResult, int iA, int iB, int iC, int iD, float s ); float dbCCWVector2 ( int iA, int iB ); float dbDotProductVector2 ( int iA, int iB ); void dbHermiteVector2 ( int iResult, int iA, int iB, int iC, int iD, float s ); float dbLengthVector2 ( int iID ); float dbSquaredLengthVector2 ( int iID ); void dbLinearInterpolateVector2 ( int iResult, int iA, int iB, float s ); void dbMaximizeVector2 ( int iResult, int iA, int iB ); void dbMinimizeVector2 ( int iResult, int iA, int iB ); void dbNormalizeVector2 ( int iResult, int iSource ); void dbScaleVector2 ( int iResult, int iSource, float s ); void dbTransformCoordsVector2 ( int iResult, int iSource, int iMatrix ); bool dbMakeVector3 ( int iID ); bool dbDeleteVector3 ( int iID ); void dbSetVector3 ( int iID, float fX, float fY, float fZ ); void dbCopyVector3 ( int iSource, int iDestination ); void dbAddVector3 ( int iResult, int iA, int iB ); void dbSubtractVector3 ( int iResult, int iA, int iB ); void dbMultiplyVector3 ( int iID, float fValue ); void dbDivideVector3 ( int iID, float fValue ); bool dbIsEqualVector3 ( int iA, int iB ); bool dbIsNotEqualVector3 ( int iA, int iB ); void dbBCCVector3 ( int iResult, int iA, int iB, int iC, float f, float g ); void dbCatmullRomVector3 ( int iResult, int iA, int iB, int iC, int iD, float s ); void dbCrossProductVector3 ( int iResult, int iA, int iB ); void dbHermiteVector3 ( int iResult, int iA, int iB, int iC, int iD, float s ); void dbLinearInterpolateVector3 ( int iResult, int iA, int iB, float s ); void dbMaximizeVector3 ( int iResult, int iA, int iB ); void dbMinimizeVector3 ( int iResult, int iA, int iB ); void dbNormalizeVector3 ( int iResult, int iSource ); void dbScaleVector3 ( int iResult, int iSource, float s ); float dbDotProductVector3 ( int iA, int iB ); float dbLengthVector3 ( int iID ); float dbSquaredLengthVector3 ( int iID ); void dbProjectVector3 ( int iResult, int iSource, int iProjectionMatrix, int iViewMatrix, int iWorldMatrix ); void dbTransformCoordsVector3 ( int iResult, int iSource, int iMatrix ); void dbTransformNormalsVector3 ( int iResult, int iSource, int iMatrix ); float dbXVector3 ( int iID ); float dbYVector3 ( int iID ); float dbZVector3 ( int iID ); bool dbMakeVector4 ( int iID ); bool dbDeleteVector4 ( int iID ); void dbSetVector4 ( int iID, float fX, float fY, float fZ, float fW ); void dbCopyVector4 ( int iSource, int iDestination ); void dbAddVector4 ( int iResult, int iA, int iB ); void dbSubtractVector4 ( int iResult, int iA, int iB ); void dbMultiplyVector4 ( int iID, float fValue ); void dbDivideVector4 ( int iID, float fValue ); bool dbIsEqualVector4 ( int iA, int iB ); bool dbIsNotEqualVector4 ( int iA, int iB ); float dbXVector4 ( int iID ); float dbYVector4 ( int iID ); float dbZVector4 ( int iID ); float dbWVector4 ( int iID ); void dbBCCVector4 ( int iResult, int iA, int iB, int iC, float f, float g ); void dbCatmullRomVector4 ( int iResult, int iA, int iB, int iC, int iD, float s ); void dbHermiteVector4 ( int iResult, int iA, int iB, int iC, int iD, float s ); float dbLengthVector4 ( int iID ); float dbSquaredLengthVector4 ( int iID ); void dbLinearInterpolateVector4 ( int iResult, int iA, int iB, float s ); void dbMaximizeVector4 ( int iResult, int iA, int iB ); void dbMinimizeVector4 ( int iResult, int iA, int iB ); void dbNormalizeVector4 ( int iResult, int iSource ); void dbScaleVector4 ( int iResult, int iSource, float s ); void dbTransformVector4 ( int iResult, int iSource, int iMatrix ); bool dbMakeMatrix4 ( int iID ); bool dbDeleteMatrix4 ( int iID ); void dbCopyMatrix4 ( int iSource, int iDestination ); void dbAddMatrix4 ( int iResult, int iA, int iB ); void dbSubtractMatrix4 ( int iResult, int iA, int iB ); void dbMultiplyMatrix4 ( int iResult, int iA, int iB ); void dbMultiplyMatrix4 ( int iID, float fValue ); void dbDivideMatrix4 ( int iID, float fValue ); bool dbIsEqualMatrix4 ( int iA, int iB ); bool dbIsNotEqualMatrix4 ( int iA, int iB ); void dbSetIdentityMatrix4 ( int iID ); float dbInverseMatrix4 ( int iResult, int iSource ); bool dbIsIdentityMatrix4 ( int iID ); void dbBuildLookAtRHMatrix4 ( int iResult, int iVectorEye, int iVectorAt, int iVectorUp ); void dbBuildLookAtLHMatrix4 ( int iResult, int iVectorEye, int iVectorAt, int iVectorUp ); void dbBuildOrthoRHMatrix4 ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); void dbBuildOrthoLHMatrix4 ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); void dbBuildPerspectiveRHMatrix4 ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); void dbBuildPerspectiveLHMatrix4 ( int iResult, float fWidth, float fHeight, float fZNear, float fZFar ); void dbBuildFovRHMatrix4 ( int iResult, float fFOV, float fAspect, float fZNear, float fZFar ); void dbBuildFovLHMatrix4 ( int iResult, float fFOV, float fAspect, float fZNear, float fZFar ); void dbBuildReflectionMatrix4 ( int iResult, float a, float b, float c, float d ); void dbBuildRotationAxisMatrix4 ( int iResult, int iVectorAxis, float fAngle ); void dbRotateXMatrix4 ( int iID, float fAngle ); void dbRotateYMatrix4 ( int iID, float fAngle ); void dbRotateZMatrix4 ( int iID, float fAngle ); void dbRotateYPRMatrix4 ( int iID, float fYaw, float fPitch, float fRoll ); void dbScaleMatrix4 ( int iID, float fX, float fY, float fZ ); void dbTranslateMatrix4 ( int iID, float fX, float fY, float fZ ); void dbTransposeMatrix4 ( int iResult, int iSource ); void dbWorldMatrix4 ( int iID ); void dbViewMatrix4 ( int iID ); void dbProjectionMatrix4 ( int iID ); D3DXVECTOR2 dbGetVector2 ( int iID ); D3DXVECTOR3 dbGetVector3 ( int iID ); D3DXVECTOR4 dbGetVector4 ( int iID ); D3DXMATRIX dbGetMatrix ( int iID ); int dbGet3DMathsExist ( int iID ); #endif /////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////// #endif _CVECTOR_H_
LeeBamberTGC/Dark-Basic-Pro
Dark Basic Public Shared/Dark Basic Pro SDK/Shared/Vectors/cVectorC.h
C
mit
18,803
/* * Generated by class-dump 3.3.4 (64 bit). * * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard. */ #import <SAObjects/SASettingGetBool.h> @interface SASettingGetDoNotDisturb : SASettingGetBool { } + (id)getDoNotDisturbWithDictionary:(id)arg1 context:(id)arg2; + (id)getDoNotDisturb; - (_Bool)requiresResponse; - (id)encodedClassName; - (id)groupIdentifier; @end
matthewsot/CocoaSharp
Headers/PrivateFrameworks/SAObjects/SASettingGetDoNotDisturb.h
C
mit
409
<template name="mysoPage"> <h1>My Love</h1> </template>
andrewlintz/LifeMngr
client/views/320_love/myso/myso.html
HTML
mit
56
// Generated by xsd compiler for ios/objective-c // DO NOT CHANGE! #import <Foundation/Foundation.h> #import "PicoClassSchema.h" #import "PicoPropertySchema.h" #import "PicoConstants.h" #import "PicoBindable.h" #import "Finding_BaseFindingServiceRequest.h" @class Finding_ProductId; @class Finding_ItemFilter; /** Returns items based on a product base on ISBN, UPC, EAN, or ePID (eBay Product Reference ID). @ingroup FindingServicePortType */ @interface Finding_FindItemsByProductRequest : Finding_BaseFindingServiceRequest { @private Finding_ProductId *_productId; NSMutableArray *_itemFilter; NSMutableArray *_outputSelector; } /** Input ISBN, UPC, EAN, or ReferenceID (ePID) to specify the type of product for which you want to search. <br><br> For example, to search using an ISBN, specify productID.type=ISBN and set productID.value to an ISBN value. To search using an eBay Product Reference ID, set <b class="con">productId.type</b> to "ReferenceID" and set <b class="con">productId.value</b> to an ePID value (also known as an Bay Product Reference ID). If you do not know the ePID value for a product, use <b class="con">FindProducts</b> in the eBay Shopping API to retrieve the desired ePID. type : class Finding_ProductId */ @property (nonatomic, strong) Finding_ProductId *productId; /** Reduce the number of items returned by a find request using item filters. Use <b class="con">itemFilter</b> to specify name/value pairs. You can include multiple item filters in a single request. entry type : class Finding_ItemFilter */ @property (nonatomic, strong) NSMutableArray *itemFilter; /** Defines what data to return, in addition to the default set of data, in a response. <br><br> If you don't specify this field, eBay returns a default set of item fields. Use outputSelector to include more information in the response. The additional data is grouped into discrete nodes. You can specify multiple nodes by including this field multiple times, as needed, in the request. <br><br> If you specify this field, the additional fields returned can affect the call's response time (performance), including in the case with feedback data. entry type : string constant in Finding_OutputSelectorType.h */ @property (nonatomic, strong) NSMutableArray *outputSelector; @end
maxep/PicoKit
Examples/eBayDemoApp/eBayDemoApp/com/ebay/marketplace/search/v1/services/Finding_FindItemsByProductRequest.h
C
mit
2,356
""" Dump Mapper This script acts as a map/function over the pages in a set of MediaWiki database dump files. This script allows the algorithm for processing a set of pages to be spread across the available processor cores of a system for faster analysis. This script can also be imported as a module to expose the `map()` function that returns an iterator over output rather than printing to stdout. Examples: dump_map revision_meta /dumps/enwiki-20110115-pages-meta-history* > ~/data/revision_meta.tsv """ import sys, logging, re, types, argparse, os, subprocess, importlib from multiprocessing import Process, Queue, Lock, cpu_count, Value from Queue import Empty from .iterator import Iterator class FileTypeError(Exception):pass class Processor(Process): """ A processor for managing the reading of dump files from a queue and the application of a a function for each 'page'. """ def __init__(self, input, processPage, output, callback, logger, noop): """ Constructor :Parameters: input : `multiprocessing.Queue` a queue paths to dump files to process processPage : function a function to apply to each page of a dump file output : `multiprocessing.Queue` a queue to send processing output to callback : function a function to run upon completion logger : `logging.Logger` a logger object to send logging events to """ self.input = input self.processPage = processPage self.output = output self.callback = callback self.logger = logger self.noop = noop Process.__init__(self) def run(self): try: while True: foo = self.input.qsize() fn = self.input.get(block=False) self.logger.info("Processing dump file %s." % fn) dump = Iterator(openDumpFile(fn)) for page in dump.readPages(): self.logger.debug("Processing page %s:%s." % (page.getId(), page.getTitle())) try: if self.noop: self.processPage(dump, page) else: for out in self.processPage(dump, page): self.output.put(out) except Exception as e: self.logger.error( "Failed to process page %s:%s - %s" % ( page.getId(), page.getTitle(), e ) ) except Empty: self.logger.info("Nothing left to do. Shutting down thread.") finally: self.callback() def map(dumps, processPage, threads=cpu_count()-1, outputBuffer=100): """ Maps a function across all of the pages in a set of dump files and returns an (order not guaranteed) iterator over the output. Increasing the `outputBuffer` size will allow more mapplications to happen before the output is read, but will consume memory to do so. Big output buffers are benefitial when the resulting iterator from this map will be read in bursts. The `processPage` function must return an iterable object (such as a generator). If your processPage function does not need to produce output, make it return an empty iterable upon completion (like an empty list). :Parameters: dumps : list a list of paths to dump files to process processPage : function a function to run on every page of a set of dump files threads : int the number of individual processing threads to spool up outputBuffer : int the maximum number of output values to buffer. """ input = dumpFiles(dumps) output = Queue(maxsize=outputBuffer) running = Value('i', 0) threads = max(1, min(int(threads), input.qsize())) def dec(): running.value -= 1 for i in range(0, threads): running.value += 1 Processor( input, processPage, output, dec, logging.getLogger("Process %s" % i), False ).start() #output while processes are running while running.value > 0: try: yield output.get(timeout=.25) except Empty: pass #finish yielding output buffer try: while True: yield output.get(block=False) except Empty: pass EXTENSIONS = { 'xml': "cat", 'bz2': "bzcat", '7z': "7zr e -so", 'lzma':"lzcat" } """ A map from file extension to the command to run to extract the data to standard out. """ EXT_RE = re.compile(r'\.([^\.]+)$') """ A regular expression for extracting the final extension of a file. """ def dumpFile(path): """ Verifies that a file exists at a given path and that the file has a known extension type. :Parameters: path : `str` the path to a dump file """ path = os.path.expanduser(path) if not os.path.isfile(path): raise FileTypeError("Can't find file %s" % path) match = EXT_RE.search(path) if match == None: raise FileTypeError("No extension found for %s." % path) elif match.groups()[0] not in EXTENSIONS: raise FileTypeError("File type %r is not supported." % path) else: return path def dumpFiles(paths): """ Produces a `multiprocessing.Queue` containing path for each value in `paths` to be used by the `Processor`s. :Parameters: paths : iterable the paths to add to the processing queue """ q = Queue() for path in paths: q.put(dumpFile(path)) return q def openDumpFile(path): """ Turns a path to a dump file into a file-like object of (decompressed) XML data. :Parameters: path : `str` the path to the dump file to read """ match = EXT_RE.search(path) ext = match.groups()[0] p = subprocess.Popen( "%s %s" % (EXTENSIONS[ext], path), shell=True, stdout=subprocess.PIPE, stderr=open(os.devnull, "w") ) #sys.stderr.write("\n%s %s\n" % (EXTENSIONS[ext], path)) #sys.stderr.write(p.stdout.read(1000)) #return False return p.stdout def encode(v): """ Encodes an output value as a string intended to be read by eval() """ if type(v) == types.FloatType: return str(int(v)) elif v == None: return "\\N" else: return repr(v) def main(): parser = argparse.ArgumentParser( description='Maps a function across pages of MediaWiki dump files' ) parser.add_argument( '-o', '--out', metavar="<path>", type=lambda path:open(path, "w"), help='the path to an output file to write putput to (defaults to stdout)', default=sys.stdout ) parser.add_argument( '-t', '--threads', metavar="", type=int, help='the number of threads to start (defaults to # of cores -1)', default=cpu_count()-1 ) parser.add_argument( 'processor', type=lambda path: importlib.import_module(path, path), help='the class path to the module that contains the process() function be passed each page' ) parser.add_argument( 'dump', type=dumpFile, help='the XML dump file(s) to process', nargs="+" ) parser.add_argument( '--debug', action="store_true", default=False ) args = parser.parse_args() LOGGING_STREAM = sys.stderr if args.debug: level = logging.DEBUG else: level = logging.INFO logging.basicConfig( level=level, stream=LOGGING_STREAM, format='%(name)s: %(asctime)s %(levelname)-8s %(message)s', datefmt='%b-%d %H:%M:%S' ) logging.info("Starting dump processor with %s threads." % min(args.threads, len(args.dump))) for row in map(args.dump, args.processor.process, threads=args.threads): print('\t'.join(encode(v) for v in row)) if __name__ == "__main__": main()
maribelacosta/wikiwho
wmf/dump/map.py
Python
mit
7,155
/* * Copyright (c) 2015-2021, Antonio Gabriel Muñoz Conejo <antoniogmc at gmail dot com> * Distributed under the terms of the MIT License */ package com.github.tonivade.claudb.command.server; import static com.github.tonivade.resp.protocol.RedisToken.array; import static com.github.tonivade.resp.protocol.RedisToken.integer; import static com.github.tonivade.resp.protocol.RedisToken.string; import static com.github.tonivade.resp.protocol.SafeString.safeString; import static com.github.tonivade.claudb.data.DatabaseValue.entry; import static com.github.tonivade.claudb.data.DatabaseValue.hash; import static com.github.tonivade.claudb.data.DatabaseValue.set; import org.junit.Rule; import org.junit.Test; import com.github.tonivade.claudb.command.CommandRule; import com.github.tonivade.claudb.command.CommandUnderTest; @CommandUnderTest(RoleCommand.class) public class RoleCommandTest { @Rule public final CommandRule rule = new CommandRule(this); @Test public void executeWithoutSlaves() { rule.execute() .assertThat(array(string("master"), integer(0), array())); } @Test public void executeWithSlaves() { rule.withAdminData("slaves", set(safeString("a:1"), safeString("b:2"))) .execute() .assertThat(array(string("master"), integer(0), array(array(string("a"), string("1"), string("0")), array(string("b"), string("2"), string("0"))))); } @Test public void executeSlave() { rule.getServerState().setMaster(false); rule.withAdminData("master", hash(entry(safeString("host"), safeString("localhost")), entry(safeString("port"), safeString("7081")), entry(safeString("state"), safeString("connected")))) .execute() .assertThat(array(string("slave"), string("localhost"), integer(7081), string("connected"), integer(0))); } }
tonivade/tiny-db
src/test/java/com/github/tonivade/claudb/command/server/RoleCommandTest.java
Java
mit
1,964
#include "mdns.h" #include "commonservices.h" #include "mem.h" #include "c_types.h" #include "user_interface.h" #include "ets_sys.h" #include "osapi.h" #include "espconn.h" #include "mystuff.h" #include "ip_addr.h" #define MDNS_BRD 0xfb0000e0 static char * MDNSNames[MAX_MDNS_NAMES]; static struct espconn *pMDNSServer; static uint8_t igmp_bound[4]; static char MyLocalName[MAX_MDNS_PATH+7]; static int nr_services = 0; static char * MDNSServices[MAX_MDNS_SERVICES]; static char * MDNSServiceTexts[MAX_MDNS_SERVICES]; static uint16_t MDNSServicePorts[MAX_MDNS_SERVICES]; static char MDNSSearchName[MAX_MDNS_PATH]; void ICACHE_FLASH_ATTR AddMDNSService( const char * ServiceName, const char * Text, int port ) { int i; for( i = 0; i < MAX_MDNS_SERVICES; i++ ) { if( !MDNSServices[i] ) { MDNSServices[i] = strdupcaselower( ServiceName ); MDNSServiceTexts[i] = strdup( Text ); MDNSServicePorts[i] = port; nr_services++; break; } } } void ICACHE_FLASH_ATTR AddMDNSName( const char * ToDup ) { int i; for( i = 1; i < MAX_MDNS_NAMES; i++ ) { if( !MDNSNames[i] ) { if( i == 0 ) { int sl = ets_strlen( ToDup ); ets_memcpy( MyLocalName, ToDup, sl ); ets_memcpy( MyLocalName + sl, ".local", 7 ); } MDNSNames[i] = strdupcaselower( ToDup ); break; } } } void ICACHE_FLASH_ATTR ClearMDNSNames() { int i; for( i = 0; i < MAX_MDNS_NAMES; i++ ) { if( MDNSNames[i] ) { os_zfree( MDNSNames[i] ); MDNSNames[i] = 0; } } for( i = 0; i < MAX_MDNS_SERVICES; i++ ) { if( MDNSServices[i] ) { os_zfree( MDNSServices[i] ); MDNSServices[i] = 0; os_zfree( MDNSServiceTexts[i] ); MDNSServiceTexts[i] = 0; MDNSServicePorts[i] = 0; } } nr_services = 0; ets_memset( MyLocalName, 0, sizeof( MyLocalName ) ); MDNSNames[0] = strdupcaselower( &SETTINGS.DeviceName[0] ); } uint8_t * ICACHE_FLASH_ATTR ParseMDNSPath( uint8_t * dat, char * topop, int * len ) { int l; int j; *len = 0; do { l = *(dat++); if( l == 0 ) { *topop = 0; return dat; } if( *len + l >= MAX_MDNS_PATH ) return 0; //If not our first time through, add a '.' if( *len != 0 ) { *(topop++) = '.'; (*len)++; } for( j = 0; j < l; j++ ) { if( dat[j] >= 'A' && dat[j] <= 'Z' ) topop[j] = dat[j] - 'A' + 'a'; else topop[j] = dat[j]; } topop += l; dat += l; *topop = 0; //Null terminate. *len += l; } while( 1 ); } uint8_t * ICACHE_FLASH_ATTR SendPathSegment( uint8_t * dat, const char * path ) { char c; int i; do { const char * pathstart = path; int this_seg_length = 0; while( c = *(path++) ) { if( c == '.' ) break; this_seg_length++; } if( !this_seg_length ) return dat; *(dat++) = this_seg_length; for( i = 0; i < this_seg_length; i++ ) { *(dat++) = *(pathstart++); } } while( c != 0 ); return dat; } uint8_t * ICACHE_FLASH_ATTR TackTemp( uint8_t * obptr ) { *(obptr++) = ets_strlen( MDNSNames[0] ); ets_memcpy( obptr, MDNSNames[0], ets_strlen( MDNSNames[0] ) ); obptr+=ets_strlen( MDNSNames[0] ); *(obptr++) = 0xc0; *(obptr++) = 0x0c; //continue the name. return obptr; } static void ICACHE_FLASH_ATTR SendOurARecord( uint8_t * namestartptr, int xactionid, int stlen ) { //Found match with us. //Send a response. uint8_t outbuff[MAX_MDNS_PATH+32]; uint8_t * obptr = outbuff; uint16_t * obb = (uint16_t*)outbuff; *(obb++) = xactionid; *(obb++) = HTONS(0x8400); //Authortative response. *(obb++) = 0; *(obb++) = HTONS(1); //1 answer. *(obb++) = 0; *(obb++) = 0; obptr = (uint8_t*)obb; ets_memcpy( obptr, namestartptr, stlen+1 ); //Hack: Copy the name in. obptr += stlen+1; *(obptr++) = 0; *(obptr++) = 0x00; *(obptr++) = 0x01; //A record *(obptr++) = 0x80; *(obptr++) = 0x01; //Flush cache + in ptr. *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 120; //very short. (120 seconds) *(obptr++) = 0x00; *(obptr++) = 0x04; //Size 4 (IP) ets_memcpy( obptr, pMDNSServer->proto.udp->local_ip, 4 ); obptr+=4; uint32_t md = MDNS_BRD; ets_memcpy( pMDNSServer->proto.udp->remote_ip, &md, 4 ); espconn_sent( pMDNSServer, outbuff, obptr - outbuff ); } static void ICACHE_FLASH_ATTR SendAvailableServices( uint8_t * namestartptr, int xactionid, int stlen ) { int i; if( nr_services == 0 ) return; uint8_t outbuff[(MAX_MDNS_PATH+14)*MAX_MDNS_SERVICES+32]; uint8_t * obptr = outbuff; uint16_t * obb = (uint16_t*)outbuff; *(obb++) = xactionid; *(obb++) = HTONS(0x8400); //Authortative response. *(obb++) = 0; *(obb++) = HTONS(nr_services); //Answers *(obb++) = 0; *(obb++) = 0; obptr = (uint8_t*)obb; for( i = 0; i < nr_services; i++ ) { char localservicename[MAX_MDNS_PATH+8]; ets_memcpy( obptr, namestartptr, stlen+1 ); //Hack: Copy the name in. obptr += stlen+1; *(obptr++) = 0; *(obptr++) = 0x00; *(obptr++) = 0x0c; //PTR record *(obptr++) = 0x00; *(obptr++) = 0x01; //Don't flush cache + ptr *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 0xf0; //4 minute TTL. int sl = ets_strlen( MDNSServices[i] ); ets_memcpy( localservicename, MDNSServices[i], sl ); ets_memcpy( localservicename+sl, ".local", 7 ); *(obptr++) = 0x00; *(obptr++) = sl+8; obptr = SendPathSegment( obptr, localservicename ); *(obptr++) = 0x00; } //Send to broadcast. uint32_t md = MDNS_BRD; ets_memcpy( pMDNSServer->proto.udp->remote_ip, &md, 4 ); espconn_sent( pMDNSServer, outbuff, obptr - outbuff ); } static void ICACHE_FLASH_ATTR SendSpecificService( int sid, uint8_t*namestartptr, int xactionid, int stlen, int is_prefix ) { uint8_t outbuff[256]; uint8_t * obptr = outbuff; uint16_t * obb = (uint16_t*)outbuff; const char *sn = MDNSServices[sid]; const char *st = MDNSServiceTexts[sid]; int stl = ets_strlen( st ); int sp = MDNSServicePorts[sid]; *(obb++) = xactionid; *(obb++) = HTONS(0x8400); //We are authoratative. And this is a response. *(obb++) = 0; *(obb++) = HTONS(sp?4:3); //4 answers. (or 3 if we don't have a port) *(obb++) = 0; *(obb++) = 0; if( !sn || !st ) return; obptr = (uint8_t*)obb; // ets_memcpy( obptr, namestartptr, stlen+1 ); //Hack: Copy the name in. // obptr += stlen+1; obptr = SendPathSegment( obptr, sn ); obptr = SendPathSegment( obptr, "local" ); *(obptr++) = 0; *(obptr++) = 0x00; *(obptr++) = 0x0c; //PTR record *(obptr++) = 0x00; *(obptr++) = 0x01; //No Flush cache + in ptr. *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 100; //very short. (100 seconds) if( !is_prefix ) { *(obptr++) = 0x00; *(obptr++) = ets_strlen( MDNSNames[0] ) + 3; //Service... obptr = TackTemp( obptr ); } else { *(obptr++) = 0x00; *(obptr++) = 2; *(obptr++) = 0xc0; *(obptr++) = 0x0c; //continue the name. } if( !is_prefix ) { obptr = TackTemp( obptr ); } else { *(obptr++) = 0xc0; *(obptr++) = 0x0c; //continue the name. } *(obptr++) = 0x00; *(obptr++) = 0x10; //TXT record *(obptr++) = 0x80; *(obptr++) = 0x01; //Flush cache + in ptr. *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 100; //very short. (100 seconds) *(obptr++) = 0x00; *(obptr++) = stl + 1; //Service... *(obptr++) = stl; //Service length ets_memcpy( obptr, st, stl ); obptr += stl; //Service record if( sp ) { int localnamelen = ets_strlen( MyLocalName ); if( !is_prefix ) { obptr = TackTemp( obptr ); } else { *(obptr++) = 0xc0; *(obptr++) = 0x0c; //continue the name. } //obptr = TackTemp( obptr ); //*(obptr++) = 0xc0; *(obptr++) = 0x2f; //continue the name. *(obptr++) = 0x00; *(obptr++) = 0x21; //SRV record *(obptr++) = 0x80; *(obptr++) = 0x01; //Don't Flush cache + in ptr. *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 100; //very short. (100 seconds) *(obptr++) = 0x00; *(obptr++) = localnamelen + 7 + 1; //Service? *(obptr++) = 0x00; *(obptr++) = 0x00; //Priority *(obptr++) = 0x00; *(obptr++) = 0x00; //Weight *(obptr++) = sp>>8; *(obptr++) = sp&0xff; //Port# obptr = SendPathSegment( obptr, MyLocalName ); *(obptr++) = 0; } //A Record obptr = SendPathSegment( obptr, MyLocalName ); *(obptr++) = 0; *(obptr++) = 0x00; *(obptr++) = 0x01; //A record *(obptr++) = 0x80; *(obptr++) = 0x01; //Flush cache + in ptr. *(obptr++) = 0x00; *(obptr++) = 0x00; //TTL *(obptr++) = 0x00; *(obptr++) = 30; //very short. (30 seconds) *(obptr++) = 0x00; *(obptr++) = 0x04; //Size 4 (IP) ets_memcpy( obptr, pMDNSServer->proto.udp->local_ip, 4 ); obptr+=4; //Send to broadcast. uint32_t md = MDNS_BRD; ets_memcpy( pMDNSServer->proto.udp->remote_ip, &md, 4 ); espconn_sent( pMDNSServer, outbuff, obptr - outbuff ); } static void ICACHE_FLASH_ATTR got_mdns_packet(void *arg, char *pusrdata, unsigned short len) { int i, j, stlen; char path[MAX_MDNS_PATH]; remot_info * ri = 0; espconn_get_connection_info( pMDNSServer, &ri, 0); ets_memcpy( pMDNSServer->proto.udp->remote_ip, ri->remote_ip, 4 ); pMDNSServer->proto.udp->remote_port = ri->remote_port; uint16_t * psr = (uint16_t*)pusrdata; uint16_t xactionid = HTONS( psr[0] ); uint16_t flags = HTONS( psr[1] ); uint16_t questions = HTONS( psr[2] ); uint16_t answers = HTONS( psr[3] ); uint8_t * dataptr = (uint8_t*)pusrdata + 12; uint8_t * dataend = dataptr + len; if( flags & 0x8000 ) { //Response //Unused; MDNS does not fit the browse model we want to use. } else { //Query for( i = 0; i < questions; i++ ) { uint8_t * namestartptr = dataptr; //Work our way through. dataptr = ParseMDNSPath( dataptr, path, &stlen ); if( dataend - dataptr < 10 ) return; if( !dataptr ) { return; } int pathlen = ets_strlen( path ); if( pathlen < 6 ) { continue; } if( strcmp( path + pathlen - 6, ".local" ) != 0 ) { continue; } uint16_t record_type = ( dataptr[0] << 8 ) | dataptr[1]; uint16_t record_class = ( dataptr[2] << 8 ) | dataptr[3]; const char * path_first_dot = path; const char * cpp = path; while( *cpp && *cpp != '.' ) cpp++; int dotlen = 0; if( *cpp == '.' ) { path_first_dot = cpp+1; dotlen = path_first_dot - path - 1; } else path_first_dot = 0; int found = 0; for( i = 0; i < MAX_MDNS_NAMES; i++ ) { //Handle [hostname].local, or [hostname].[service].local if( MDNSNames[i] && dotlen && ets_strncmp( MDNSNames[i], path, dotlen ) == 0 && dotlen == ets_strlen( MDNSNames[i] )) { found = 1; if( record_type == 0x0001 ) //A Name Lookup. SendOurARecord( namestartptr, xactionid, stlen ); else SendSpecificService( i, namestartptr, xactionid, stlen, 1 ); } } if( !found ) //Not a specific entry lookup... { //Is this a browse? if( ets_strcmp( path, "_services._dns-sd._udp.local" ) == 0 ) { SendAvailableServices( namestartptr, xactionid, stlen ); } else { //A specific service? for( i = 0; i < MAX_MDNS_SERVICES; i++ ) { const char * srv = MDNSServices[i]; if( !srv ) continue; int sl = ets_strlen( srv ); if( strncmp( path, srv, sl ) == 0 ) { SendSpecificService( i, namestartptr, xactionid, stlen, 0 ); } } } } } } } void ICACHE_FLASH_ATTR SetupMDNS() { MDNSNames[0] = strdupcaselower( &SETTINGS.DeviceName[0] ); pMDNSServer = (struct espconn *)os_zalloc(sizeof(struct espconn)); ets_memset( pMDNSServer, 0, sizeof( struct espconn ) ); pMDNSServer->type = ESPCONN_UDP; pMDNSServer->proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp)); pMDNSServer->proto.udp->local_port = 5353; espconn_regist_recvcb(pMDNSServer, got_mdns_packet); espconn_create( pMDNSServer ); } int ICACHE_FLASH_ATTR JoinGropMDNS() { uint32_t ip = GetCurrentIP(); if( ip ) { struct ip_addr grpip; grpip.addr = MDNS_BRD; printf( "IGMP Joining: %08x %08x\n", ip, grpip.addr ); ets_memcpy( igmp_bound, &grpip.addr, 4 ); espconn_igmp_join( (ip_addr_t *)&ip, &grpip); return 0; } return 1; }
jonshouse1/esp8266ws2812i2s_JA
common/mdns.c
C
mit
11,981
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AdminAutobody Modals</title> <!-- Tell the browser to be responsive to screen width --> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <!-- Bootstrap 3.3.6 --> <link rel="stylesheet" href="../../bootstrap/css/bootstrap.min.css"> <!-- Font Awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"> <!-- Ionicons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> <!-- Theme style --> <link rel="stylesheet" href="../../dist/css/AdminLTE.min.css"> <!-- AdminLTE Skins. Choose a skin from the css/skins folder instead of downloading all of them to reduce the load. --> <link rel="stylesheet" href="../../dist/css/skins/_all-skins.min.css"> <!-- 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.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> <style> .example-modal .modal { position: relative; top: auto; bottom: auto; right: auto; left: auto; display: block; z-index: 1; } .example-modal .modal { background: transparent !important; } </style> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <header class="main-header"> <!-- Logo --> <a href="../../index2.html" class="logo"> <!-- mini logo for sidebar mini 50x50 pixels --> <span class="logo-mini"><b>A</b>LT</span> <!-- logo for regular state and mobile devices --> <span class="logo-lg"><b>Admin</b>LTE</span> </a> <!-- Header Navbar: style can be found in header.less --> <nav class="navbar navbar-static-top"> <!-- Sidebar toggle button--> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <div class="navbar-custom-menu"> <ul class="nav navbar-nav"> <!-- Messages: style can be found in dropdown.less--> <li class="dropdown messages-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-envelope-o"></i> <span class="label label-success">4</span> </a> <ul class="dropdown-menu"> <li class="header">You have 4 messages</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li><!-- start message --> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> </div> <h4> Support Team <small><i class="fa fa-clock-o"></i> 5 mins</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <!-- end message --> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> AdminLTE Design Team <small><i class="fa fa-clock-o"></i> 2 hours</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Developers <small><i class="fa fa-clock-o"></i> Today</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user3-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Sales Department <small><i class="fa fa-clock-o"></i> Yesterday</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> <li> <a href="#"> <div class="pull-left"> <img src="../../dist/img/user4-128x128.jpg" class="img-circle" alt="User Image"> </div> <h4> Reviewers <small><i class="fa fa-clock-o"></i> 2 days</small> </h4> <p>Why not buy a new awesome theme?</p> </a> </li> </ul> </li> <li class="footer"><a href="#">See All Messages</a></li> </ul> </li> <!-- Notifications: style can be found in dropdown.less --> <li class="dropdown notifications-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-bell-o"></i> <span class="label label-warning">10</span> </a> <ul class="dropdown-menu"> <li class="header">You have 10 notifications</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li> <a href="#"> <i class="fa fa-users text-aqua"></i> 5 new members joined today </a> </li> <li> <a href="#"> <i class="fa fa-warning text-yellow"></i> Very long description here that may not fit into the page and may cause design problems </a> </li> <li> <a href="#"> <i class="fa fa-users text-red"></i> 5 new members joined </a> </li> <li> <a href="#"> <i class="fa fa-shopping-cart text-green"></i> 25 sales made </a> </li> <li> <a href="#"> <i class="fa fa-user text-red"></i> You changed your username </a> </li> </ul> </li> <li class="footer"><a href="#">View all</a></li> </ul> </li> <!-- Tasks: style can be found in dropdown.less --> <li class="dropdown tasks-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-flag-o"></i> <span class="label label-danger">9</span> </a> <ul class="dropdown-menu"> <li class="header">You have 9 tasks</li> <li> <!-- inner menu: contains the actual data --> <ul class="menu"> <li><!-- Task item --> <a href="#"> <h3> Design some buttons <small class="pull-right">20%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">20% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Create a nice theme <small class="pull-right">40%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">40% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Some task I need to do <small class="pull-right">60%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">60% Complete</span> </div> </div> </a> </li> <!-- end task item --> <li><!-- Task item --> <a href="#"> <h3> Make beautiful transitions <small class="pull-right">80%</small> </h3> <div class="progress xs"> <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"> <span class="sr-only">80% Complete</span> </div> </div> </a> </li> <!-- end task item --> </ul> </li> <li class="footer"> <a href="#">View all tasks</a> </li> </ul> </li> <!-- User Account: style can be found in dropdown.less --> <li class="dropdown user user-menu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <img src="../../dist/img/user2-160x160.jpg" class="user-image" alt="User Image"> <span class="hidden-xs">Alexander Pierce</span> </a> <ul class="dropdown-menu"> <!-- User image --> <li class="user-header"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> <p> Alexander Pierce - Web Developer <small>Member since Nov. 2012</small> </p> </li> <!-- Menu Body --> <li class="user-body"> <div class="row"> <div class="col-xs-4 text-center"> <a href="#">Followers</a> </div> <div class="col-xs-4 text-center"> <a href="#">Sales</a> </div> <div class="col-xs-4 text-center"> <a href="#">Friends</a> </div> </div> <!-- /.row --> </li> <!-- Menu Footer--> <li class="user-footer"> <div class="pull-left"> <a href="#" class="btn btn-default btn-flat">Profile</a> </div> <div class="pull-right"> <a href="#" class="btn btn-default btn-flat">Sign out</a> </div> </li> </ul> </li> </ul> </div> </nav> </header> <!-- Left side column. contains the logo and sidebar --> <aside class="main-sidebar"> <!-- sidebar: style can be found in sidebar.less --> <section class="sidebar"> <!-- Sidebar user panel --> <div class="user-panel"> <div class="pull-left image"> <img src="../../dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> </div> <div class="pull-left info"> <p>Alexander Pierce</p> <a href="#"><i class="fa fa-circle text-success"></i> Online</a> </div> </div> <!-- search form --> <form action="#" method="get" class="sidebar-form"> <div class="input-group"> <input type="text" name="q" class="form-control" placeholder="Search..."> <span class="input-group-btn"> <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i> </button> </span> </div> </form> <!-- /.search form --> <!-- sidebar menu: : style can be found in sidebar.less --> <ul class="sidebar-menu"> <li class="header">MAIN NAVIGATION</li> <li class="treeview"> <a href="#"> <i class="fa fa-dashboard"></i> <span>Dashboard</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../../index.html"><i class="fa fa-circle-o"></i> Dashboard v1</a></li> <li><a href="../../index2.html"><i class="fa fa-circle-o"></i> Dashboard v2</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-files-o"></i> <span>Layout Options</span> <span class="pull-right-container"> <span class="label label-primary pull-right">4</span> </span> </a> <ul class="treeview-menu"> <li><a href="../layout/top-nav.html"><i class="fa fa-circle-o"></i> Top Navigation</a></li> <li><a href="../layout/boxed.html"><i class="fa fa-circle-o"></i> Boxed</a></li> <li><a href="../layout/fixed.html"><i class="fa fa-circle-o"></i> Fixed</a></li> <li><a href="../layout/collapsed-sidebar.html"><i class="fa fa-circle-o"></i> Collapsed Sidebar</a></li> </ul> </li> <li> <a href="../widgets.html"> <i class="fa fa-th"></i> <span>Widgets</span> <span class="pull-right-container"> <small class="label pull-right bg-green">new</small> </span> </a> </li> <li class="treeview"> <a href="#"> <i class="fa fa-pie-chart"></i> <span>Charts</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../charts/chartjs.html"><i class="fa fa-circle-o"></i> ChartJS</a></li> <li><a href="../charts/morris.html"><i class="fa fa-circle-o"></i> Morris</a></li> <li><a href="../charts/flot.html"><i class="fa fa-circle-o"></i> Flot</a></li> <li><a href="../charts/inline.html"><i class="fa fa-circle-o"></i> Inline charts</a></li> </ul> </li> <li class="treeview active"> <a href="#"> <i class="fa fa-laptop"></i> <span>UI Elements</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="general.html"><i class="fa fa-circle-o"></i> General</a></li> <li><a href="icons.html"><i class="fa fa-circle-o"></i> Icons</a></li> <li><a href="buttons.html"><i class="fa fa-circle-o"></i> Buttons</a></li> <li><a href="sliders.html"><i class="fa fa-circle-o"></i> Sliders</a></li> <li><a href="timeline.html"><i class="fa fa-circle-o"></i> Timeline</a></li> <li class="active"><a href="modals.html"><i class="fa fa-circle-o"></i> Modals</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-edit"></i> <span>Forms</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../forms/general.html"><i class="fa fa-circle-o"></i> General Elements</a></li> <li><a href="../forms/advanced.html"><i class="fa fa-circle-o"></i> Advanced Elements</a></li> <li><a href="../forms/editors.html"><i class="fa fa-circle-o"></i> Editors</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-table"></i> <span>Tables</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../tables/simple.html"><i class="fa fa-circle-o"></i> Simple tables</a></li> <li><a href="../tables/data.html"><i class="fa fa-circle-o"></i> Data tables</a></li> </ul> </li> <li> <a href="../calendar.html"> <i class="fa fa-calendar"></i> <span>Calendar</span> <span class="pull-right-container"> <small class="label pull-right bg-red">3</small> <small class="label pull-right bg-blue">17</small> </span> </a> </li> <li> <a href="../mailbox/mailbox.html"> <i class="fa fa-envelope"></i> <span>Mailbox</span> <span class="pull-right-container"> <small class="label pull-right bg-yellow">12</small> <small class="label pull-right bg-green">16</small> <small class="label pull-right bg-red">5</small> </span> </a> </li> <li class="treeview"> <a href="#"> <i class="fa fa-folder"></i> <span>Examples</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="../examples/invoice.html"><i class="fa fa-circle-o"></i> Invoice</a></li> <li><a href="../examples/profile.html"><i class="fa fa-circle-o"></i> Profile</a></li> <li><a href="../examples/login.html"><i class="fa fa-circle-o"></i> Login</a></li> <li><a href="../examples/register.html"><i class="fa fa-circle-o"></i> Register</a></li> <li><a href="../examples/lockscreen.html"><i class="fa fa-circle-o"></i> Lockscreen</a></li> <li><a href="../examples/404.html"><i class="fa fa-circle-o"></i> 404 Error</a></li> <li><a href="../examples/500.html"><i class="fa fa-circle-o"></i> 500 Error</a></li> <li><a href="../examples/blank.html"><i class="fa fa-circle-o"></i> Blank Page</a></li> <li><a href="../examples/pace.html"><i class="fa fa-circle-o"></i> Pace Page</a></li> </ul> </li> <li class="treeview"> <a href="#"> <i class="fa fa-share"></i> <span>Multilevel</span> <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li> <li> <a href="#"><i class="fa fa-circle-o"></i> Level One <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level Two</a></li> <li> <a href="#"><i class="fa fa-circle-o"></i> Level Two <span class="pull-right-container"> <i class="fa fa-angle-left pull-right"></i> </span> </a> <ul class="treeview-menu"> <li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li> <li><a href="#"><i class="fa fa-circle-o"></i> Level Three</a></li> </ul> </li> </ul> </li> <li><a href="#"><i class="fa fa-circle-o"></i> Level One</a></li> </ul> </li> <li><a href="../../documentation/index.html"><i class="fa fa-book"></i> <span>Documentation</span></a></li> <li class="header">LABELS</li> <li><a href="#"><i class="fa fa-circle-o text-red"></i> <span>Important</span></a></li> <li><a href="#"><i class="fa fa-circle-o text-yellow"></i> <span>Warning</span></a></li> <li><a href="#"><i class="fa fa-circle-o text-aqua"></i> <span>Information</span></a></li> </ul> </section> <!-- /.sidebar --> </aside> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Modals <small>new</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li><a href="#">UI</a></li> <li class="active">Modals</li> </ol> </section> <!-- Main content --> <section class="content"> <div class="callout callout-info"> <h4>Reminder!</h4> Instructions for how to use modals are available on the <a href="http://getbootstrap.com/javascript/#modals">Bootstrap documentation</a> </div> <div class="example-modal"> <div class="modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Default Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> <div class="example-modal"> <div class="modal modal-primary"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Primary Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-outline">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> <div class="example-modal"> <div class="modal modal-info"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Info Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-outline">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> <div class="example-modal"> <div class="modal modal-warning"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Warning Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-outline">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> <div class="example-modal"> <div class="modal modal-success"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Success Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-outline">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> <div class="example-modal"> <div class="modal modal-danger"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span></button> <h4 class="modal-title">Danger Modal</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-outline pull-left" data-dismiss="modal">Close</button> <button type="button" class="btn btn-outline">Save changes</button> </div> </div> <!-- /.modal-content --> </div> <!-- /.modal-dialog --> </div> <!-- /.modal --> </div> <!-- /.example-modal --> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <footer class="main-footer"> <div class="pull-right hidden-xs"> <b>Version</b> 2.3.8 </div> <strong>Copyright &copy; 2014-2016 <a href="http://almsaeedstudio.com">Almsaeed Studio</a>.</strong> All rights reserved. </footer> <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Create the tabs --> <ul class="nav nav-tabs nav-justified control-sidebar-tabs"> <li><a href="#control-sidebar-home-tab" data-toggle="tab"><i class="fa fa-home"></i></a></li> <li><a href="#control-sidebar-settings-tab" data-toggle="tab"><i class="fa fa-gears"></i></a></li> </ul> <!-- Tab panes --> <div class="tab-content"> <!-- Home tab content --> <div class="tab-pane" id="control-sidebar-home-tab"> <h3 class="control-sidebar-heading">Recent Activity</h3> <ul class="control-sidebar-menu"> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-birthday-cake bg-red"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Langdon's Birthday</h4> <p>Will be 23 on April 24th</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-user bg-yellow"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Frodo Updated His Profile</h4> <p>New phone +1(800)555-1234</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-envelope-o bg-light-blue"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Nora Joined Mailing List</h4> <p>nora@example.com</p> </div> </a> </li> <li> <a href="javascript:void(0)"> <i class="menu-icon fa fa-file-code-o bg-green"></i> <div class="menu-info"> <h4 class="control-sidebar-subheading">Cron Job 254 Executed</h4> <p>Execution time 5 seconds</p> </div> </a> </li> </ul> <!-- /.control-sidebar-menu --> <h3 class="control-sidebar-heading">Tasks Progress</h3> <ul class="control-sidebar-menu"> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Custom Template Design <span class="label label-danger pull-right">70%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-danger" style="width: 70%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Update Resume <span class="label label-success pull-right">95%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-success" style="width: 95%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Laravel Integration <span class="label label-warning pull-right">50%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-warning" style="width: 50%"></div> </div> </a> </li> <li> <a href="javascript:void(0)"> <h4 class="control-sidebar-subheading"> Back End Framework <span class="label label-primary pull-right">68%</span> </h4> <div class="progress progress-xxs"> <div class="progress-bar progress-bar-primary" style="width: 68%"></div> </div> </a> </li> </ul> <!-- /.control-sidebar-menu --> </div> <!-- /.tab-pane --> <!-- Stats tab content --> <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div> <!-- /.tab-pane --> <!-- Settings tab content --> <div class="tab-pane" id="control-sidebar-settings-tab"> <form method="post"> <h3 class="control-sidebar-heading">General Settings</h3> <div class="form-group"> <label class="control-sidebar-subheading"> Report panel usage <input type="checkbox" class="pull-right" checked> </label> <p> Some information about this general settings option </p> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Allow mail redirect <input type="checkbox" class="pull-right" checked> </label> <p> Other sets of options are available </p> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Expose author name in posts <input type="checkbox" class="pull-right" checked> </label> <p> Allow the user to show his name in blog posts </p> </div> <!-- /.form-group --> <h3 class="control-sidebar-heading">Chat Settings</h3> <div class="form-group"> <label class="control-sidebar-subheading"> Show me as online <input type="checkbox" class="pull-right" checked> </label> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Turn off notifications <input type="checkbox" class="pull-right"> </label> </div> <!-- /.form-group --> <div class="form-group"> <label class="control-sidebar-subheading"> Delete chat history <a href="javascript:void(0)" class="text-red pull-right"><i class="fa fa-trash-o"></i></a> </label> </div> <!-- /.form-group --> </form> </div> <!-- /.tab-pane --> </div> </aside> <!-- /.control-sidebar --> <!-- Add the sidebar's background. This div must be placed immediately after the control sidebar --> <div class="control-sidebar-bg"></div> </div> <!-- ./wrapper --> <!-- jQuery 2.2.3 --> <script src="../../plugins/jQuery/jquery-2.2.3.min.js"></script> <!-- Bootstrap 3.3.6 --> <script src="../../bootstrap/js/bootstrap.min.js"></script> <!-- FastClick --> <script src="../../plugins/fastclick/fastclick.js"></script> <!-- AdminLTE App --> <script src="../../dist/js/app.min.js"></script> <!-- AdminLTE for demo purposes --> <script src="../../dist/js/demo.js"></script> </body> </html>
takahashi56/auto-repair
bower_components/AdminLTE/pages/UI/modals.html
HTML
mit
35,891
// // ARNLiveBlurView.h // ARNLiveBlurView // // Created by Airin on 2014/05/22. // Copyright (c) 2014 Airin. All rights reserved. // #import <UIKit/UIKit.h> @class ARNLiveBlurView; typedef void (^ARNObservingScrollViewBlock) (ARNLiveBlurView *blurredView, UIScrollView *observingView); @interface ARNLiveBlurView : UIView @property (nonatomic, assign) CGFloat blurRadius; @property (nonatomic, assign) CGFloat saturationDelta; @property (nonatomic, copy) UIColor *tintColor; @property (nonatomic, weak) UIView *viewToBlur; - (void)updateBlur; - (void)setObservingScrollView:(UIScrollView *)observingScrollView observingBlock:(ARNObservingScrollViewBlock)observingBlock; @end
xxxAIRINxxx/ARNLiveBlurView
ARNLiveBlurView/ARNLiveBlurView.h
C
mit
691
#include "../h/PaqueteDatagrama.h" #include "../h/SocketDatagrama.h" #include "../h/header.h" #include <iostream> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> using namespace std; int main( int argc, char *argv[] ) { if(argc != 3) { cout << "Forma de uso: " << argv[0] << " [DIR_IP] " << "[PORT]" << endl; exit(0); } SocketDatagrama s(7780); struct pck_votos msg; struct pck_votos res; bzero((char *)&msg, sizeof(pck_votos)); bzero((char *)&res, sizeof(pck_votos)); strcpy(msg.CURP,"000000000000000002"); strcpy(msg.celular,"0000000002"); strcpy(msg.partido,"PRD"); PaqueteDatagrama mensaje((char *)&msg, sizeof(pck_votos),argv[1], atoi(argv[2])); PaqueteDatagrama respuesta(sizeof(pck_votos)); s.envia( mensaje ); s.recibe( respuesta ); memcpy( (char *)&res, respuesta.obtieneDatos(), sizeof(res) ); cout << "in: " << res.CURP << ", " << sizeof(res) << " bytes" << endl; cout << "in: " << res.celular << ", " << sizeof(res) << " bytes" << endl; exit(0); }
DSD-TELCEL-ESCOM/INE-Votation-Distributed-System
sqlite/src/cliente.cpp
C++
mit
1,180
from __future__ import absolute_import from __future__ import unicode_literals import collections import jsonschema DEFAULT_GENERATE_CONFIG_FILENAME = 'generate_config.yaml' GENERATE_OPTIONS_SCHEMA = { 'type': 'object', 'required': ['repo', 'database'], 'properties': { 'skip_default_metrics': {'type': 'boolean'}, 'tempdir_location': {'type': ['string', 'null']}, 'metric_package_names': {'type': 'array', 'items': {'type': 'string'}}, 'repo': {'type': 'string'}, 'database': {'type': 'string'}, }, } class GenerateOptions(collections.namedtuple( 'GenerateOptions', [ 'skip_default_metrics', 'tempdir_location', 'metric_package_names', 'repo', 'database', ], )): @classmethod def from_yaml(cls, yaml_dict): jsonschema.validate(yaml_dict, GENERATE_OPTIONS_SCHEMA) return cls( skip_default_metrics=yaml_dict.get('skip_default_metrics', False), tempdir_location=yaml_dict.get('tempdir_location', None), metric_package_names=yaml_dict.get('metric_package_names', []), repo=yaml_dict['repo'], database=yaml_dict['database'], ) def to_yaml(self): ret = {'repo': self.repo, 'database': self.database} if self.skip_default_metrics is True: ret['skip_default_metrics'] = True if self.metric_package_names: ret['metric_package_names'] = list(self.metric_package_names) if self.tempdir_location: ret['tempdir_location'] = self.tempdir_location return ret
ucarion/git-code-debt
git_code_debt/generate_config.py
Python
mit
1,667
* PySeq version: * Python version: * Operating System: ### Description Describe what you were trying to get done. Tell us what happened, what went wrong, and what you expected to happen. ### What I Did ``` Paste the command(s) you ran and the output. If there was a crash, please include the traceback here. ```
tintoy/seqlog
.github/ISSUE_TEMPLATE.md
Markdown
mit
316
# Sequel Pro dump # Version 254 # http://code.google.com/p/sequel-pro # # Host: localhost (MySQL 5.0.67) # Database: reznap_development # Generation Time: 2009-01-02 19:18:43 +0200 # ************************************************************ # Dump of table categories # ------------------------------------------------------------ DROP TABLE IF EXISTS `categories`; CREATE TABLE `categories` ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL, `description` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; INSERT INTO `categories` (`id`,`name`,`description`) VALUES (1,'info',''), (2,'stuff',''); # Dump of table categories_pages # ------------------------------------------------------------ DROP TABLE IF EXISTS `categories_pages`; CREATE TABLE `categories_pages` ( `id` int(11) NOT NULL auto_increment, `category_id` int(11) NOT NULL, `page_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `category_id` (`category_id`), KEY `page_id` (`page_id`) ) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; INSERT INTO `categories_pages` (`id`,`category_id`,`page_id`) VALUES (1,1,2), (2,2,2), (3,1,1); # Dump of table comments # ------------------------------------------------------------ DROP TABLE IF EXISTS `comments`; CREATE TABLE `comments` ( `id` int(11) NOT NULL auto_increment, `name` varchar(64) NOT NULL, `email` varchar(255) NOT NULL, `url` varchar(255) NOT NULL, `body` text NOT NULL, `page_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `page_id` (`page_id`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; INSERT INTO `comments` (`id`,`name`,`email`,`url`,`body`,`page_id`) VALUES (1,'jim','','','fuck this is cool',2), (2,'peter','ithinkicanfly@petrelli.com','','you suck! you really suck!!',2); # Dump of table pages # ------------------------------------------------------------ DROP TABLE IF EXISTS `pages`; CREATE TABLE `pages` ( `id` int(11) NOT NULL auto_increment, `title` varchar(64) NOT NULL, `body` text NOT NULL, `created_at` int(11) default NULL, `modified_at` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=42 DEFAULT CHARSET=utf8; INSERT INTO `pages` (`id`,`title`,`body`,`created_at`,`modified_at`) VALUES (1,'home page','wiiee, this is the HOME page, thingy... kinda... lol!',NULL,NULL), (2,'another page :P','this is yet another page-thingy, this is cool... hehe :D :P',NULL,NULL), (3,'my page','my page is awesome, so awesome :$',NULL,NULL), (4,'iphone','omg omg omg omg O M G ! ! ! !',NULL,NULL), (10,'title','body',NULL,NULL), (11,'anything else','...maybe not...',NULL,NULL);
jimeh/zynapse
db/zynapse_development.sql
SQL
mit
2,695
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.14"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>Quark Engine: Member List</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/searchdata.js"></script> <script type="text/javascript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="quark.ico"/></td> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">Quark Engine &#160;<span id="projectnumber">1.0</span> </div> <div id="projectbrief">The best power IR engine in the universe!</div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.14 --> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ var searchBox = new SearchBox("searchBox", "search",false,'Search'); /* @license-end */ </script> <script type="text/javascript" src="menudata.js"></script> <script type="text/javascript" src="menu.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(function() { initMenu('',true,false,'search.php','Search'); $(document).ready(function() { init_search(); }); }); /* @license-end */</script> <div id="main-nav"></div> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('classqe_1_1core_1_1_quark_behaviour.html','');}); /* @license-end */ </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> </div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="headertitle"> <div class="title">qe::core::QuarkBehaviour Member List</div> </div> </div><!--header--> <div class="contents"> <p>This is the complete list of members for <a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a>, including all inherited members.</p> <table class="directory"> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a951f176fa27d8ac017e1521fcd96d817">Awake</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>Behaviour</b>() (defined in <a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html#a3ec40ead88558d693df6885805742eb2">Component</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html">qe::core::Component</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>CoreObject</b>() (defined in <a class="el" href="classqe_1_1core_1_1_core_object.html">qe::core::CoreObject</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_core_object.html">qe::core::CoreObject</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">explicit</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#ad0686a1d4fb57d8122e99ba9dcf62f73">FixedUpdate</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html#aa87b71db048779e92685ff43e9bd5aa2">get_enable</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html#a8c0bd768bc514ff1c3eff66bace30d4c">get_name</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html">qe::core::Object</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html#a0031525e4c3d36b580d701c2b7b26ae0">get_quark_object</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html">qe::core::Component</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a3267017f1384558acdf6a033e907cc3b">LateUpdate</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html#a3c1f3e432fcdf10b5367ef6bae16af64">Object</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html">qe::core::Object</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a3e375427f20257014e00492a34cbaa2e">OnAnimatorIK</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a246d280658227d078bea10aa1d3fc2b1">OnAnimatorMove</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a249af625f0f5af4513a2d367f582b4ce">OnApplicationFocus</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a1912df90eb5098b0c4ccbf9e5dd83efe">OnApplicationPause</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#ae5c1ca3360fb05ed2d17272a41478008">OnApplicationQuit</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#aae1df164af9a59d3fb031ec26d863f77">OnAudioFlterRead</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0678661408a610f04c1b6c8f4dcd659f">OnBecameInvisible</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a1050b425723bd63e213d418bf7bb86eb">OnBecameVisible</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a313546e2cd8322b86e5149f0cb9afb25">OnCollisionEnter</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#ab7b614fe3f844c30dbfc04a60dbb2783">OnCollisionExit</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#afd5730d04a61404257de049e6536fa77">OnCollisionStay</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a89a2129c7d8e5304aba64eebf74e3be5">OnConnectedToServer</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a7e4b83ca344b320608cba4b53892d484">OnControllerColliderHit</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0bc780e3c6d60570fdfdd3e11a6359e1">OnDestroy</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#aa5d41dbfa7e9e4fa5a8d208b24b19fdf">OnDisable</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a5902260ce84bbde84695a86f8efcbdc6">OnDisconnectedFromServer</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#ac1c0882d2cf64e36f2f5e7cdf1ebb143">OnEnable</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0c7878a599a02af6ad5d7f09a046ba8f">OnFailedToConnect</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#afac788674c2970cdd6c47b44175d69b5">OnFailedToConnectToMasterServer</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a4f7e2a1af3e2bdcbd6353a19bf5bf896">OnGUI</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#aa6841f1c0bf1b78cc6d13d42eef13674">OnMouseDown</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a8f661daacaa2bb7d8fab95ca4818f316">OnMouseDrag</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a92376f41cc88f9b048550f129f0d008a">OnMouseEnter</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a7ef7a49f800385ec7cb51d8e355cf039">OnMouseExit</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0d0bbfce143199301d026d1f66f589e8">OnMouseOver</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#ac4f6d9fd055ecf648e549799b14c1882">OnMouseUp</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a222fb62b5956d3f5bf794ed55e7475c4">OnParticleCollision</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a2efc0d50255b38ce954ed9f3c3c1a8f2">OnParticleTrigger</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a6576e9c4a662e161898cd7d0f79da672">OnPlayerConnected</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a8ea0a58e6907b3f08e2311ddeb9381d7">OnPlayerDisconnected</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a92bb5b1ccf134f5331cfbd5acb5050e4">OnPostRender</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#adf63c293fcb9496df68a08124a649911">OnPreCull</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0751e63f7d69f7b16bdbc1c8dbdd2e51">OnPreRender</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a2d6ed312df8125db85ecea67f9a8584b">OnRenderImage</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a087fddd6241cd65eb59a4773e589d4ed">OnRenderObject</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a2c38380b745d4995deb2efd689eceef8">OnTransformChildrenChanged</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a3f419ff09fa59e532f68e7a864f716c2">OnTransformParentChanged</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a1af8df5e88547adc1e870d50ae4d3a5d">OnTriggerEnter</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a386c1115e006e8451eb3d7fc07166632">OnTriggerExit</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a96895d9c18810681aa4889f6e80318cc">OnTriggerStay</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#aeb4c1b1ddea0da2fcfa102e40f12a544">OnWillRenderObject</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>QuarkBehaviour</b>() (defined in <a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">explicit</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a190fae0aaad4cba435e6b1760f411890">Reset</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html#af0253bb2536333fd7ceeab31c7367250">set_enable</a>(bool enable)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html#a67e5924ea1df5a63be0b89b161448bec">set_name</a>(const std::string &amp;name)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html">qe::core::Object</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html#af77d7112fc5a783fe31e06a76fbc653e">set_name</a>(const char *name)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html">qe::core::Object</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html#a4e3d3469b13b9e389bc8a2cd47a54ea4">set_quark_object</a>(QuarkObject *quark_object)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html">qe::core::Component</a></td><td class="entry"></td></tr> <tr><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a943ba4e2ba0b394a0d85ca358f121c7f">Start</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html#a0c4da4b2fdc2f43f78d58d034afd35d7">Update</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"><span class="mlabel">virtual</span></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>~Behaviour</b>() (defined in <a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_behaviour.html">qe::core::Behaviour</a></td><td class="entry"></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html#a569d42ddf0d454a7ae511a91c8cb76d6">~Component</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_component.html">qe::core::Component</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>~CoreObject</b>() (defined in <a class="el" href="classqe_1_1core_1_1_core_object.html">qe::core::CoreObject</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_core_object.html">qe::core::CoreObject</a></td><td class="entry"><span class="mlabel">inline</span></td></tr> <tr class="even"><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html#a10c18fb644a856e51157fd035925f83f">~Object</a>()</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_object.html">qe::core::Object</a></td><td class="entry"></td></tr> <tr bgcolor="#f0f0f0"><td class="entry"><b>~QuarkBehaviour</b>() (defined in <a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a>)</td><td class="entry"><a class="el" href="classqe_1_1core_1_1_quark_behaviour.html">qe::core::QuarkBehaviour</a></td><td class="entry"></td></tr> </table></div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="footer">Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li> </ul> </div> </body> </html>
EricChenC/quark_engine
media/doc/html/classqe_1_1core_1_1_quark_behaviour-members.html
HTML
mit
24,928
package org.squiddev.cctweaks.api; import net.minecraft.util.BlockPos; import net.minecraft.world.IBlockAccess; import javax.annotation.Nonnull; /** * Helper interface for blocks that provide a position */ public interface IWorldPosition { /** * Get the world the block lies in * * @return The block's world */ IBlockAccess getBlockAccess(); /** * Get the position of the block * * @return The position of the block */ @Nonnull BlockPos getPosition(); }
SquidDev-CC/CC-Tweaks
src/api/java/org/squiddev/cctweaks/api/IWorldPosition.java
Java
mit
481
// Copyright (c) 2019 Philipp Weber // Use of this source code is governed by the MIT license // which can be found in the repositorys LICENSE file. /* Package hibpgo provides access to the "Have I been Pwned?" API from Troy Hunt (https://haveibeenpwned.com). It supports all the RESTful service endpoints and parameters of API version 2. */ package hibpgo
phlipse/hibpgo
doc.go
GO
mit
358
# Tidbits :bulb: A website to collect tidbits of knowledge from experience. View it here: http://jake.burgy.me/tidbits/ Powered by [Jekyll](https://jekyllrb.com/) and [GitHub Pages](https://pages.github.com/). ## Source To view the source, [switch to the `gh-pages` branch](https://github.com/qJake/tidbits/tree/gh-pages). ## License Uses the MIT License. See the [LICENSE](license) file for more information.
qJake/tidbits
README.md
Markdown
mit
417
'use strict'; /** * Module dependencies */ var flipflopsPolicy = require('../policies/flipflops.server.policy'), flipflops = require('../controllers/flipflops.server.controller'); module.exports = function(app) { // Flipflops Routes app.route('/api/flipflops').all(flipflopsPolicy.isAllowed) .get(flipflops.list) .post(flipflops.create); app.route('/api/flipflops/:flipflopId').all(flipflopsPolicy.isAllowed) .get(flipflops.read) .put(flipflops.update) .delete(flipflops.delete); app.route('/api/topic').all(flipflopsPolicy.isAllowed) .get(flipflops.fetchTopic); app.route('/api/topic/:topicId').all(flipflopsPolicy.isAllowed) .put(flipflops.updateTopic); app.route('/api/upload').all(flipflopsPolicy.isAllowed) .post(flipflops.upload); app.route('/api/judge').all(flipflopsPolicy.isAllowed) .get(flipflops.judge); app.route('/api/judge/:flipflopId').all(flipflopsPolicy.isAllowed) .put(flipflops.update); // Finish by binding the Flipflop middleware app.param('flipflopId', flipflops.flipflopByID); app.param('topicId', flipflops.topicByID); };
tonymullen/flipflop
modules/flipflops/server/routes/flipflops.server.routes.js
JavaScript
mit
1,121
<?php /* Plugin Name: Trusona Plugin URI: https://wordpress.org/plugins/trusona/ Description: Login to your WordPress with Trusona’s FREE #NoPasswords plugin. This plugin requires the Trusona app. View details for installation instructions. Version: 1.5.5 Author: Trusona Author URI: https://trusona.com License: MIT */ defined('ABSPATH') or die(); require_once plugin_dir_path( __FILE__ ) . 'includes/trusona-functions.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/jwt-functions.php'; class TrusonaOpenID { const PLUGIN_ID_PREFIX = 'trusona_openid_'; const SCOPES = 'openid email'; const SUBJECT_KEY = 'sub'; const LOGIN_URL = 'https://idp.trusona.com/authorizations/openid'; const USERINFO_URL = 'https://idp.trusona.com/openid/userinfo'; const REGISTRATION_URL = 'https://idp.trusona.com/openid/clients'; const TOKEN_URL = 'https://idp.trusona.com/openid/token'; /* config parameters on admin page. */ public static $PUBLIC_PARAMETERS = array('trusona_enabled' => 'Enable Trusona', 'disable_wp_form' => 'Disable Default Form', 'self_service_onboarding' => 'Self-Service Onboarding', 'only_trusona' => 'Require #NoPasswords for Enabled Users'); public static $INTERNAL_PARAMETERS = array('login_url' => 'Login URL', 'token_url' => 'Token Validation URL', 'userinfo_url' => 'Userinfo URL', 'client_id' => 'Client ID', 'client_secret' => 'Client Secret Key'); public static $PARAMETERS; // assigned in the constructor; public static $ERR_MES = array( 1 => 'Cannot get authorization response', 2 => 'Cannot get token response', 3 => 'Cannot get user claims', 4 => 'Cannot get valid token', 5 => 'Cannot get user key', 6 => 'User is not currently paired with Trusona.', 7 => 'Cannot get dynamic registration to complete', 8 => 'Unknown error', 9 => 'You haven’t been authorized to access this WordPress site. Contact the admin for access', 10 => 'Cannot validate ID Token' ); public function __construct() { ob_start(); add_action('validate_registration_action', array($this, 'validate_registration')); do_action('validate_registration_action'); add_action('wp_logout', array($this, 'trusona_openid_logout')); add_action('login_footer', array($this, 'login_footer')); add_action('login_form', array(&$this, 'login_form')); add_action('login_enqueue_scripts', array(&$this, 'add_trusona_jquery')); add_action('login_enqueue_scripts', array(&$this, 'add_trusona_css')); if (is_admin()) { add_action('wp_ajax_nopriv_trusona_openid-callback', array($this, 'callback')); add_action('wp_ajax_trusona_openid-callback', array($this, 'callback')); add_action('admin_notices', array($this, 'activation_email_notice_info')); add_action('admin_menu', array($this, 'admin_menu')); add_action('admin_init', array($this, 'admin_init')); add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'filter_plugin_actions')); register_deactivation_hook(__FILE__, array($this, 'deactivate_trusona')); register_activation_hook(__FILE__, array($this, 'activate_defaults')); register_uninstall_hook(__FILE__, 'trusona_wp_uninstall'); } self::$PARAMETERS = array_merge(self::$INTERNAL_PARAMETERS, self::$PUBLIC_PARAMETERS); foreach (self::$PARAMETERS as $key => $val) { $this->$key = get_option(self::PLUGIN_ID_PREFIX . $key); } $this->redirect_url = admin_url('admin-ajax.php?action=trusona_openid-callback'); } public function add_trusona_jquery() { if (!wp_script_is('jquery-core')) { wp_enqueue_script('jquery-core'); } } public function add_trusona_css() { wp_enqueue_style(self::PLUGIN_ID_PREFIX . '0', 'https://static.trusona.net/web-sdk/css/trusona.css?' . time()); wp_enqueue_style(self::PLUGIN_ID_PREFIX . '1', plugins_url('css/trusona-openid.css?'. time(), __FILE__)); } public function activation_email_notice_info() { $user = wp_get_current_user(); $when = (int)get_option(self::PLUGIN_ID_PREFIX . 'activation'); if ($user instanceof WP_User && time() < ($when + 15)) { // show notice for 15 seconds after activation $notice = ''; $notice .= '<div class="notice notice-info is-dismissible">'; $notice .= '<p>Please add <span style="font-weight:bold;">' . $user->user_email . '</span>'; $notice .= '&nbsp;to your Trusona app to complete setup.'; $notice .= '</p></div>'; echo $notice; } } public function activate_defaults() { if ($this->is_not_registered()) { $this->remote_registration(); } if ($this->is_registered()) { update_option(self::PLUGIN_ID_PREFIX . 'userinfo_url', self::USERINFO_URL); update_option(self::PLUGIN_ID_PREFIX . 'login_url', self::LOGIN_URL); update_option(self::PLUGIN_ID_PREFIX . 'token_url', self::TOKEN_URL); update_option(self::PLUGIN_ID_PREFIX . 'self_service_onboarding', false); update_option(self::PLUGIN_ID_PREFIX . 'disable_wp_form', false); update_option(self::PLUGIN_ID_PREFIX . 'trusona_enabled', true); update_option(self::PLUGIN_ID_PREFIX . 'activation', time()); } } private function is_not_registered() { return !get_option(self::PLUGIN_ID_PREFIX . 'client_id', false) || !get_option(self::PLUGIN_ID_PREFIX . 'client_secret', false); } private function is_registered() { return !$this->is_not_registered(); } public function validate_registration() { if ($this->is_registered()) { $local_hash = compute_site_hash(); $stored_hash = get_option(self::PLUGIN_ID_PREFIX . 'site_hash', false); if ($stored_hash === null) { $this->remote_registration(); } elseif (strcmp($local_hash, $stored_hash) !== 0) { $this->update_registration(); } } } private function site_name() { $site_name = get_bloginfo('name'); return (!isset($site_name) || trim($site_name) == '' ? 'blog-with-no-name' : trim($site_name)); } private function remote_registration() { $body = array('redirect_uris' => array(home_url()), 'client_name' => $this->site_name()); $user_agent = 'WordPress ' . get_bloginfo('version') . '; ' . home_url(); $headers = array('content-type' => 'application/json', 'user-agent' => $user_agent); // reference - https://openid.net/specs/openid-connect-registration-1_0.html $response = wp_safe_remote_post( self::REGISTRATION_URL, array('headers' => $headers, 'body' => json_encode($body)) ); if (is_array($response) && intval($response['response']['code']) == 201) { $this->debug_log("Trusona IDP registration completed successfully"); $body = json_decode($response['body'], true); $hash = compute_site_hash(); $this->client_secret = $body['client_secret']; $this->client_id = $body['client_id']; update_option(self::PLUGIN_ID_PREFIX . 'client_secret', $this->client_secret); update_option(self::PLUGIN_ID_PREFIX . 'client_id', $this->client_id); update_option(self::PLUGIN_ID_PREFIX . 'site_hash', $hash); } else { $this->debug_log("Trusona IDP registration failed"); } } private function update_registration() { $client_id = get_option(self::PLUGIN_ID_PREFIX . 'client_id', null); $client_secret = get_option(self::PLUGIN_ID_PREFIX . 'client_secret', null); $user_agent = 'WordPress ' . get_bloginfo('version') . '; ' . home_url(); $body = array('redirect_uris' => array(home_url()), 'client_secret' => $client_secret); $headers = array('content-type' => 'application/json', 'user-agent' => $user_agent); $patch_url = self::REGISTRATION_URL . '/' . $client_id; $response = $this->safe_remote_patch($patch_url, array('headers' => $headers, 'body' => json_encode($body))); if (is_array($response) && intval($response['response']['code']) == 200) { $this->debug_log("Trusona IDP update completed successfully"); } else { $this->debug_log("Trusona IDP update failed"); } } private function safe_remote_patch($url, $args = array()) { $args['reject_unsafe_urls'] = true; $args['method'] = 'PATCH'; return wp_remote_request($url, $args); } public function deactivate_trusona() { delete_option(self::PLUGIN_ID_PREFIX . 'userinfo_url'); delete_option(self::PLUGIN_ID_PREFIX . 'self_service_onboarding'); delete_option(self::PLUGIN_ID_PREFIX . 'disable_wp_form'); delete_option(self::PLUGIN_ID_PREFIX . 'trusona_enabled'); delete_option(self::PLUGIN_ID_PREFIX . 'login_url'); delete_option(self::PLUGIN_ID_PREFIX . 'token_url'); delete_option(self::PLUGIN_ID_PREFIX . 'activation'); delete_option(self::PLUGIN_ID_PREFIX . 'client_id'); delete_option(self::PLUGIN_ID_PREFIX . 'client_secret'); } public function callback() { if (!isset($_GET['code'], $_GET['state'], $_GET['nonce'])) { $this->error_redirect(1); return; } elseif (isset($_GET['error'])) { $this->error_redirect(8); return; } $token_result = wp_remote_post( $this->token_url, array('body' => array( 'code' => $_GET['code'], 'state' => $_GET['state'], 'nonce' => $_GET['nonce'], 'client_id' => $this->client_id, 'client_secret' => $this->client_secret, 'redirect_uri' => $this->redirect_url, 'grant_type' => 'authorization_code' )) ); if (is_wp_error($token_result)) { $this->error_redirect(2); return; } $token_response = json_decode($token_result['body'], true); $authenticated = false; $secret = get_option(self::PLUGIN_ID_PREFIX . 'client_secret', null); $access_token = $token_response['access_token']; $id_token = $token_response['id_token']; if(isset($id_token)) { if(!is_valid_jwt($id_token, $secret)) { $this->error_redirect(10); return; } } if (isset($token_response['token_type'], $access_token)) { $authorization = "{$token_response['token_type']} {$access_token}"; $headers = array('Authorization' => $authorization); $get_response = wp_remote_get($this->userinfo_url, array('headers' => $headers)); $user_claim = is_array($get_response) ? json_decode($get_response['body'], true) : null; if (is_wp_error($get_response) || !isset($user_claim)) { $this->error_redirect(3); return; } } elseif (isset($id_token)) { $jwt_arr = explode('.', $id_token); $user_claim = json_decode(base64_decode($jwt_arr[1]), true); } else { $this->error_redirect(4); return; } if (is_array($user_claim['emails'])) { $users = array(); foreach ($user_claim['emails'] as $email) { $user = get_user_by('email', strtolower($email)); if (isset($user) && $user instanceof WP_User && intval($user->ID) > 0) { $users[] = $user; } } if (count($users) > 0) { list($is_admin, $user) = $this->has_admin($users); $subject = $user_claim[self::SUBJECT_KEY]; wp_set_auth_cookie($user->ID, false); update_user_meta($user->ID, self::PLUGIN_ID_PREFIX . 'subject_id', $subject); update_user_meta($user->ID, self::PLUGIN_ID_PREFIX . 'enabled', true); update_user_meta($user->ID, self::PLUGIN_ID_PREFIX . 'paired', true); if ($is_admin) { wp_safe_redirect(admin_url()); exit; } else { wp_safe_redirect(home_url()); exit; } } } if (!$authenticated) { $self_service = get_option(self::PLUGIN_ID_PREFIX . 'self_service_onboarding', false); if($self_service) { $email = strtolower(wp_slash(array_shift($user_claim['emails']))); $password = hash('whirlpool', base64_encode(random_bytes(1024)) . $email . time()); $value = wp_create_user($email, $password, $email); if(is_wp_error($value)) { $this->debug_log("failed at creating self-service account"); $this->error_redirect(9); } else { $this->debug_log("successfully created self-service account"); wp_set_auth_cookie($value, false, false); update_user_meta($value, self::PLUGIN_ID_PREFIX . 'enabled', true); update_user_meta($value, self::PLUGIN_ID_PREFIX . 'paired', true); wp_safe_redirect(home_url()); exit; } } else { $this->error_redirect(9); } } } public function admin_init() { register_setting('trusona_options_group', 'trusona_keys'); add_settings_section('setting_section_id', 'Trusona WordPress Settings', null, 'trusona-admin-settings'); } public function admin_menu() { add_options_page('Trusona', 'Trusona', 'manage_options', 'trusona-admin-settings', array($this, 'create_admin_menu')); if (isset($_POST['option_page']) && $_POST['option_page'] === 'trusona_options_group') { $checked = (bool)(isset($_POST['trusona_keys']['disable_wp_form'])); update_option(self::PLUGIN_ID_PREFIX . 'disable_wp_form', $checked); $checked = (bool)(isset($_POST['trusona_keys']['self_service_onboarding'])); update_option(self::PLUGIN_ID_PREFIX . 'self_service_onboarding', $checked); } } public function print_bool_field($key) { $value = $this->$key ? 'value="1" checked="checked"' : 'value="0"'; echo '<input type="checkbox" id="' . $key . '" name="trusona_keys[' . $key . ']" ' . $value . ' >'; } public function create_admin_menu() { echo '<div class="wrap">'; screen_icon(); echo '<table class="form-table"><tbody>'; echo '<form method="post" action="options.php">'; settings_fields('trusona_options_group'); do_settings_sections('trusona-admin-settings'); echo '<tr><td style="vertical-align: top;" width="2em">'; $this->print_bool_field('disable_wp_form'); echo '</td><td>Trusona ONLY Mode <br/><br/>'; echo '<span style="font-size: smaller;">'; echo '<span style="color: red; font-weight: bolder;">WARNING!</span>&nbsp;'; echo 'By checking this box, you disable the ability to toggle between <span style="font-weight: bolder;">Login with Trusona</span> and username and passwords.<br/>'; echo 'You should make this selection ONLY if you have access to the WP server independent of the login page, as otherwise you <br/>are blocking all other options to login.'; echo '</span></td></tr>'; echo '<tr><td style="vertical-align: top;" width="2em">'; $this->print_bool_field('self_service_onboarding'); echo '</td><td>Self-Service Account Creation<br/><br/>'; echo '<span style="font-size: smaller;">'; echo '<span style="color: red; font-weight: bolder;">WARNING!</span>&nbsp;'; echo 'By checking this box, you allow the Trusona plugin to create basic (subscriber) accounts for your WordPress site if an <br/>'; echo 'account is not found for that Trusona user - thus allowing for a true <span style="font-weight: bolder;">#NoPasswords</span> experience!<br/>'; echo '</span></td></tr>'; echo '<tr><td colspan="2">'; submit_button(); echo '</td></tr>'; echo '<tr><td style="color: #c0c0c0; font-size: smaller;" colspan="2">PHP ' . phpversion(); echo '<br/>WordPress ' . get_bloginfo('version') . '</td></tr>'; echo '</form></tbody></table></div>'; } public function filter_plugin_actions($links) { $settings_link = '<a href="options-general.php?page=trusona-admin-settings">Settings</a>'; array_unshift($links, $settings_link); // before other links return $links; } private function has_admin($users) { $regular_user = null; foreach ($users as $user) { if (in_array('administrator', $user->roles)) { return array(true, $user); } else { if (is_null($regular_user)) { $regular_user = $user; } } } return array(false, $regular_user); } private function error_redirect($errno, $authed_user_id = null) { $url = wp_login_url() . '?trusona-openid-error=' . $errno; if (isset($authed_user_id)) { $url .= '&authed_user_id=' . $authed_user_id; } wp_safe_redirect($url); exit; } /** * logout method - called from wp_logout action */ public function trusona_openid_logout() { wp_clear_auth_cookie(); wp_safe_redirect(admin_url('index.php')); exit; } private function build_openid_url($redirect_url) { return $this->login_url . '?state=' . hash('ripemd160', random_bytes(2048)) . '&nonce=' . hash('ripemd160', random_bytes(2048)) . '&scope=' . urlencode(self::SCOPES) . '&response_type=code&client_id=' . urlencode($this->client_id) . '&redirect_uri=' . urlencode($redirect_url); } public function login_form() { if ($this->trusona_enabled) { $url = $this->build_openid_url($this->redirect_url); $this->disable_wp_form = apply_filters('trusona_login_form_disable_wp_form', $this->disable_wp_form); if ($this->disable_wp_form) { $html = ob_get_clean(); $x = strpos($html, '<form name="loginform" '); if ($x > 0) { $html = substr($html, 0, $x) . trusona_custom_login($url, false); } ob_start(); } else { $html = trusona_custom_login($url, true); } echo $html; } } public function login_footer() { if ($this->trusona_enabled) { $this->disable_wp_form = apply_filters('trusona_login_footer_disable_wp_form', $this->disable_wp_form); if ($this->disable_wp_form) { $html = ob_get_clean(); $html = $this->remove_block($html, '<p class="forgetmenot">', '</form>'); $html = $this->remove_block($html, '<p id="nav">', '</p>'); ob_start(); echo $html; } } } private function remove_block($html, $selector, $end) { $x = strpos($html, $selector); $y = strpos($html, $end, $x); if ($x > 0 && $y > 0) { $html = substr_replace($html, null, $x, ($y + strlen($end)) - $x); } return $html; } private function debug_log($message) { if (WP_DEBUG) { error_log($message); } } } new TrusonaOpenID(); function trusona_wp_uninstall() { foreach (TrusonaOpenID::$PARAMETERS as $key => $val) { if (WP_DEBUG) { error_log("deleting " . TrusonaOpenID::PLUGIN_ID_PREFIX . $key); } delete_option(TrusonaOpenID::PLUGIN_ID_PREFIX . $key); } $users = get_users(array('meta_key' => TrusonaOpenID::PLUGIN_ID_PREFIX . 'enabled')); foreach ($users as $user) { delete_user_meta($user->ID, TrusonaOpenID::PLUGIN_ID_PREFIX . 'subject_id'); delete_user_meta($user->ID, TrusonaOpenID::PLUGIN_ID_PREFIX . 'enabled'); delete_user_meta($user->ID, TrusonaOpenID::PLUGIN_ID_PREFIX . 'paired'); } } ?>
trusona/wp-trusona
trusona-openid.php
PHP
mit
21,499
package com.toyshop.www.views; import com.toyshop.data.entity.Product; public class ProductView { private Product product=new Product(); public Product getProduct() { return product; } }
icoolno1/toyshop
toyshop/src/com/toyshop/www/views/ProductView.java
Java
mit
211