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
|
|---|---|---|---|---|---|
class AddStatusToRegistration < ActiveRecord::Migration
def up
ids = Registration.select([:id, :approved]).find_all { |r| r.approved }.map(&:id)
remove_column :registrations, :approved
add_column :registrations, :status, :string, default: 'pending'
add_index :registrations, :status
Registration.reset_column_information
Registration.update_all(status: 'approved')
%w(pending waitlisted).each do |status|
ids = PublicSignup.where(status: status).map {|p| p.registration.id}
Registration.update_all({status: status}, id: ids)
end
# later remove status from PublicSignup
end
def down
ids = Registration.select([:id, :status]).find_all { |r| r.status == 'approved' }.map(&:id)
remove_column :registrations, :status
add_column :registrations, :approved, :boolean, default: false
Registration.reset_column_information
Registration.update_all({approved: true}, id: ids)
end
class Registration < ActiveRecord::Base
belongs_to :public_signup
end
class PublicSignup < ActiveRecord::Base
has_one :registration
end
end
|
mike-park/haidb
|
db/migrate/20140402140657_add_status_to_registration.rb
|
Ruby
|
mit
| 1,103
|
import Loader from '../../src/loader';
describe('loader', function () {
let loader, configRan;
beforeAll(() => {
window.pmAnimatedBannersConfig = () => {
configRan = true;
};
loader = new Loader();
});
it('should call pmAnimatedBannersConfig', () => {
expect(configRan).toEqual(true);
});
});
|
partnermarketing/pm-animated-banners
|
tests/unit/loader.test.js
|
JavaScript
|
mit
| 332
|
using UnityEngine;
using System.Collections;
public class ShapesUpdater : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
|
rbakx/UnityRobot_FHICT
|
Unity/RobotMaster/Assets/scripts/Shapes & Mapping/Shapes/ShapesUpdater.cs
|
C#
|
mit
| 227
|
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("XExpression")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XExpression")]
[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("678373fd-8ca5-4968-a661-42f39482d49d")]
// 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")]
|
b-slavov/Telerik-Software-Academy
|
01.C# Part 1/Exam-Preparation-3rd-Tasks/XExpression/Properties/AssemblyInfo.cs
|
C#
|
mit
| 1,398
|
package entitydifferentiation;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import es.um.nosql.s13e.NoSQLSchema.Attribute;
import es.um.nosql.s13e.NoSQLSchema.EntityType;
import es.um.nosql.s13e.NoSQLSchema.StructuralVariation;
import es.um.nosql.s13e.NoSQLSchema.NoSQLSchema;
import es.um.nosql.s13e.NoSQLSchema.NoSQLSchemaFactory;
import es.um.nosql.s13e.NoSQLSchema.PrimitiveType;
public class Test2
{
NoSQLSchema schema;
@Before
public void setUp() throws Exception
{
NoSQLSchemaFactory factory = NoSQLSchemaFactory.eINSTANCE;
EntityType persons = factory.createEntityType(); persons.setName("Persons"); persons.setRoot(true);
StructuralVariation ev1 = factory.createStructuralVariation(); ev1.setVariationId(1);
Attribute attrP1 = factory.createAttribute(); attrP1.setName("_id");
PrimitiveType pTypeP1 = factory.createPrimitiveType(); pTypeP1.setName("ObjectId"); attrP1.setType(pTypeP1);
Attribute attrP2 = factory.createAttribute(); attrP2.setName("name");
PrimitiveType pTypeP2 = factory.createPrimitiveType(); pTypeP2.setName("String"); attrP2.setType(pTypeP2);
Attribute attrP3 = factory.createAttribute(); attrP3.setName("surname");
PrimitiveType pTypeP3 = factory.createPrimitiveType(); pTypeP3.setName("String"); attrP3.setType(pTypeP3);
Attribute attrP4 = factory.createAttribute(); attrP4.setName("age");
PrimitiveType pTypeP4 = factory.createPrimitiveType(); pTypeP4.setName("Number"); attrP4.setType(pTypeP4);
Attribute attrP5 = factory.createAttribute(); attrP5.setName("isEmployed");
PrimitiveType pTypeP5 = factory.createPrimitiveType(); pTypeP5.setName("Boolean"); attrP5.setType(pTypeP5);
Attribute attrP6 = factory.createAttribute(); attrP6.setName("isMarried");
PrimitiveType pTypeP6 = factory.createPrimitiveType(); pTypeP6.setName("Boolean"); attrP6.setType(pTypeP6);
Attribute attrP7 = factory.createAttribute(); attrP7.setName("status");
PrimitiveType pTypeP7 = factory.createPrimitiveType(); pTypeP7.setName("String"); attrP7.setType(pTypeP7);
ev1.getProperties().add(attrP1); ev1.getProperties().add(attrP2); ev1.getProperties().add(attrP3); ev1.getProperties().add(attrP4);
ev1.getProperties().add(attrP5); ev1.getProperties().add(attrP6); ev1.getProperties().add(attrP7);
persons.getVariations().add(ev1);
schema = factory.createNoSQLSchema(); schema.setName("test2");
schema.getEntities().add(persons);
}
@After
public void tearDown() throws Exception
{
}
@Test
public void test()
{
fail("Not yet implemented");
}
}
|
catedrasaes-umu/NoSQLDataEngineering
|
projects/es.um.nosql.s13e.entitydifferentiation/test/entitydifferentiation/Test2.java
|
Java
|
mit
| 2,641
|
<!-- HTML header for doxygen 1.8.6-->
<!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.12"/>
<title>OpenCV: Member List</title>
<link href="../../opencv.ico" rel="shortcut icon" type="image/x-icon" />
<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/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
//<![CDATA[
MathJax.Hub.Config(
{
TeX: {
Macros: {
matTT: [ "\\[ \\left|\\begin{array}{ccc} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{array}\\right| \\]", 9],
fork: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ \\end{array} \\right.", 4],
forkthree: ["\\left\\{ \\begin{array}{l l} #1 & \\mbox{#2}\\\\ #3 & \\mbox{#4}\\\\ #5 & \\mbox{#6}\\\\ \\end{array} \\right.", 6],
vecthree: ["\\begin{bmatrix} #1\\\\ #2\\\\ #3 \\end{bmatrix}", 3],
vecthreethree: ["\\begin{bmatrix} #1 & #2 & #3\\\\ #4 & #5 & #6\\\\ #7 & #8 & #9 \\end{bmatrix}", 9],
hdotsfor: ["\\dots", 1],
mathbbm: ["\\mathbb{#1}", 1],
bordermatrix: ["\\matrix{#1}", 1]
}
}
}
);
//]]>
</script><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<!--#include virtual="/google-search.html"-->
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../opencv-logo-small.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">OpenCV
 <span id="projectnumber">3.2.0</span>
</div>
<div id="projectbrief">Open Source Computer Vision</div>
</td>
</tr>
</tbody>
</table>
</div>
<script type="text/javascript">
//<![CDATA[
function getLabelName(innerHTML) {
var str = innerHTML.toLowerCase();
// Replace all '+' with 'p'
str = str.split('+').join('p');
// Replace all ' ' with '_'
str = str.split(' ').join('_');
// Replace all '#' with 'sharp'
str = str.split('#').join('sharp');
// Replace other special characters with 'ascii' + code
for (var i = 0; i < str.length; i++) {
var charCode = str.charCodeAt(i);
if (!(charCode == 95 || (charCode > 96 && charCode < 123) || (charCode > 47 && charCode < 58)))
str = str.substr(0, i) + 'ascii' + charCode + str.substr(i + 1);
}
return str;
}
function addToggle() {
var $getDiv = $('div.newInnerHTML').last();
var buttonName = $getDiv.html();
var label = getLabelName(buttonName.trim());
$getDiv.attr("title", label);
$getDiv.hide();
$getDiv = $getDiv.next();
$getDiv.attr("class", "toggleable_div label_" + label);
$getDiv.hide();
}
//]]>
</script>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></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="../../d2/d75/namespacecv.html">cv</a></li><li class="navelem"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">FileNodeIterator</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">cv::FileNodeIterator Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a213590d07fed11f1a2a588400e05b8f8">container</a></td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#ad83667c1a044b9638d02c57e165e41bb">cvStartWriteRawData_Base64</a>(::CvFileStorage *fs, const char *name, int len, const char *dt)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#aa048945804bcbd368db919ce3ef775e5">FileNodeIterator</a>()</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a60b85a8659ece30ebf09721bdd16885c">FileNodeIterator</a>(const CvFileStorage *fs, const CvFileNode *node, size_t ofs=0)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a0e43453413ee5ee52b51c4061733aeb1">FileNodeIterator</a>(const FileNodeIterator &it)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#ac674a613a4ed775ae15b55a7aa17c061">fs</a></td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a1e00cee62e8034030ff99abf2b902487">operator!=</a>(const FileNodeIterator &it1, const FileNodeIterator &it2)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a73e4a0844474b25bf254b08c7e4978d6">operator*</a>() const</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a6a06cf1a5b94057476a925f3f758c490">operator++</a>()</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a4daed1197209314a7a9bada1cb21af53">operator++</a>(int)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a77b08ee6b326b9d83ed01de4b30930d2">operator+=</a>(int ofs)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a4ec58573be20ff741b7f4d21bc223635">operator-</a>(const FileNodeIterator &it1, const FileNodeIterator &it2)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a527f6537606d4bd66626a54c814bd610">operator--</a>()</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a6a1d757fdad6bb3ccca73f9f767b90c3">operator--</a>(int)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a6910b1f94c1d9a2f4030fd6deab0b4f4">operator-=</a>(int ofs)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#adc777a683bdadcf17534f4c2c1b1a21c">operator-></a>() const</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#ada726685b67ed5fa4432cc30fb854d34">operator<</a>(const FileNodeIterator &it1, const FileNodeIterator &it2)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a52f26a2fbe666de1926f67be05ee9dee">operator==</a>(const FileNodeIterator &it1, const FileNodeIterator &it2)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a0e9987928ef46a3fe99b3fe02b659dd4">operator>></a>(FileNodeIterator &it, _Tp &value)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a1b91e417a7103145b4997e086aec99df">operator>></a>(FileNodeIterator &it, std::vector< _Tp > &vec)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"><span class="mlabel">related</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#ab8b976a97cc6496a51857ef518027ed0">reader</a></td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a64ef557e066e7a877ee7e376cd0ecd49">readRaw</a>(const String &fmt, uchar *vec, size_t maxCount=(size_t) INT_MAX)</td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html#a5cba97d39d41f0e52d64b677ad392143">remaining</a></td><td class="entry"><a class="el" href="../../d7/d4e/classcv_1_1FileNodeIterator.html">cv::FileNodeIterator</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
<!-- HTML footer for doxygen 1.8.6-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Dec 23 2016 13:00:27 for OpenCV by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="../../doxygen.png" alt="doxygen"/>
</a> 1.8.12
</small></address>
<script type="text/javascript">
//<![CDATA[
function addButton(label, buttonName) {
var b = document.createElement("BUTTON");
b.innerHTML = buttonName;
b.setAttribute('class', 'toggleable_button label_' + label);
b.onclick = function() {
$('.toggleable_button').css({
border: '2px outset',
'border-radius': '4px'
});
$('.toggleable_button.label_' + label).css({
border: '2px inset',
'border-radius': '4px'
});
$('.toggleable_div').css('display', 'none');
$('.toggleable_div.label_' + label).css('display', 'block');
};
b.style.border = '2px outset';
b.style.borderRadius = '4px';
b.style.margin = '2px';
return b;
}
function buttonsToAdd($elements, $heading, $type) {
if ($elements.length === 0) {
$elements = $("" + $type + ":contains(" + $heading.html() + ")").parent().prev("div.newInnerHTML");
}
var arr = jQuery.makeArray($elements);
var seen = {};
arr.forEach(function(e) {
var txt = e.innerHTML;
if (!seen[txt]) {
$button = addButton(e.title, txt);
if (Object.keys(seen).length == 0) {
var linebreak1 = document.createElement("br");
var linebreak2 = document.createElement("br");
($heading).append(linebreak1);
($heading).append(linebreak2);
}
($heading).append($button);
seen[txt] = true;
}
});
return;
}
$("h2").each(function() {
$heading = $(this);
$smallerHeadings = $(this).nextUntil("h2").filter("h3").add($(this).nextUntil("h2").find("h3"));
if ($smallerHeadings.length) {
$smallerHeadings.each(function() {
var $elements = $(this).nextUntil("h3").filter("div.newInnerHTML");
buttonsToAdd($elements, $(this), "h3");
});
} else {
var $elements = $(this).nextUntil("h2").filter("div.newInnerHTML");
buttonsToAdd($elements, $heading, "h2");
}
});
$(".toggleable_button").first().click();
var $clickDefault = $('.toggleable_button.label_python').first();
if ($clickDefault.length) {
$clickDefault.click();
}
$clickDefault = $('.toggleable_button.label_cpp').first();
if ($clickDefault.length) {
$clickDefault.click();
}
//]]>
</script>
</body>
</html>
|
lucasbrsa/OpenCV-3.2
|
docs/3.2/d2/d6d/classcv_1_1FileNodeIterator-members.html
|
HTML
|
mit
| 15,632
|
FactlinkUI::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
config.eager_load = false
# Show full error reports and disable caching
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.raise_delivery_errors = false
# Use SQL instead of Active Record's schema dumper when creating the test database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
# Configure static asset server for tests with Cache-Control for performance
config.serve_static_files = true
config.static_cache_control = "public, max-age=3600"
# Do not compress assets
config.assets.debug = false
config.roadie.enabled = false
end
|
Factlink/factlink-core
|
config/environments/test.rb
|
Ruby
|
mit
| 1,762
|
<!DOCTYPE html>
<html ng-app="waitStaffApp">
<head>
<title>WaitStaff Calculator</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<header>
<h1 class="text-center border-bottom">WaitStaff Calculator</h1>
</header>
<div class="row">
<div class="col-md-12">
<nav>
<ul>
<li><a href="#/">Home</a></li>
<li><a href="#/newMeal">New Meal</a></li>
<li><a href="#/myEarnings">My Earnings</a></li>
</ul>
</nav>
<div class="center-content" ng-view></div>
</div>
</div>
</div>
<script type="text/javascript" src="angular.js"></script>
<script type="text/javascript" src="angular-messages.js"></script>
<script type="text/javascript" src="angular-route.js"></script>
<script type="text/javascript" src="app.js"></script>
<script type="text/javascript" src="myEarningsService.js"></script>
<script type="text/ng-template" id="number-error-messages">
<p ng-message="number">Enter a number</p>
<p ng-message="required">Number is required.</p>
</script>
</body>
</html>
|
MasoodGit/ngWaitStaffCalculator
|
index.html
|
HTML
|
mit
| 1,202
|
#include <iostream>
#define GLM_FORCE_RADIANS
#include <glm/gtc/type_ptr.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include "DebugRenderer.hpp"
DebugRenderer::DebugRenderer():
debug_shader(),
line_shader(),
line({0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, {0}, {3}),
quad(
{
-0.5, -0.5, 0.0,
0.0, 0.0,
-0.5, 0.5, 0.0,
0.0, 1.0,
0.5, -0.5, 0.0,
1.0, 0.0,
0.5, 0.5, 0.0,
1.0, 1.0,
},
{0, 3, 1, 0, 2, 3}, {3, 2})
{
}
void DebugRenderer::draw_lines(const std::vector<std::pair<glm::vec3, glm::vec3>>& lines, const glm::mat4& vp_mat, const glm::vec3& color) {
line_shader();
line_shader.set_color(color);
line_shader.set_MVP(vp_mat);
line.bind();
for(const auto& line: lines) {
line_shader.set_from(std::get<0>(line));
line_shader.set_to(std::get<1>(line));
glDrawArrays(GL_POINTS, 0, 1);
line_shader.set_from(std::get<1>(line));
line_shader.set_to(std::get<0>(line));
glDrawArrays(GL_POINTS, 0, 1);
}
line.unbind();
line_shader.stop();
}
void DebugRenderer::draw_line(const glm::vec3& from, const glm::vec3& to, const glm::mat4& vp_mat, const glm::vec3& color) {
//Optimization opportunity: No need to rebind shader every line
//Also, vertex_buffer binding might be reusable between line and point
line_shader();
line_shader.set_color(color);
line_shader.set_MVP(vp_mat);
line_shader.set_from(from);
line_shader.set_to(to);
line.bind();
glDrawArrays(GL_POINTS, 0, 1);
line_shader.set_from(to);
line_shader.set_to(from);
glDrawArrays(GL_POINTS, 0, 1);
line.unbind();
line_shader.stop();
}
void DebugRenderer::draw_points(const std::vector<glm::vec3>& points, const glm::mat4& vp_mat) {
debug_shader();
debug_shader.set_color({1,1,1});
debug_shader.set_MVP(vp_mat);
line.bind();
for(const auto& pos: points) {
debug_shader.set_pos(pos);
glDrawArrays(GL_POINTS, 0, 1);
}
line.unbind();
debug_shader.stop();
}
void DebugRenderer::draw_point(const glm::vec3& pos, const glm::mat4& vp_mat) {
debug_shader();
debug_shader.set_color({1,1,1});
debug_shader.set_MVP(vp_mat);
debug_shader.set_pos(pos);
line.bind();
glDrawArrays(GL_POINTS, 0, 1);
line.unbind();
debug_shader.stop();
}
void DebugRenderer::render_fbo(const GLuint fbo_tex) {
fbo_shader.use_shader();
quad.bind();
fbo_shader.set_framebuffer_sampler(0);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, fbo_tex);
quad.render_elements(GL_TRIANGLES, 6);
quad.unbind();
fbo_shader.stop();
}
// Eeeugh
void DebugRenderer::draw_aabb(const AABB& aabb, const glm::mat4& vp_mat) {
glm::vec3 white = glm::vec3({1, 1, 1});
std::vector<std::pair<glm::vec3, glm::vec3>> cube = {
std::make_pair(aabb.cube[0], aabb.cube[1]),
std::make_pair(aabb.cube[0], aabb.cube[2]),
std::make_pair(aabb.cube[0], aabb.cube[4]),
std::make_pair(aabb.cube[1], aabb.cube[3]),
std::make_pair(aabb.cube[1], aabb.cube[5]),
std::make_pair(aabb.cube[2], aabb.cube[3]),
std::make_pair(aabb.cube[2], aabb.cube[6]),
std::make_pair(aabb.cube[3], aabb.cube[7]),
std::make_pair(aabb.cube[4], aabb.cube[5]),
std::make_pair(aabb.cube[4], aabb.cube[6]),
std::make_pair(aabb.cube[5], aabb.cube[7]),
std::make_pair(aabb.cube[6], aabb.cube[7])
};
draw_lines(cube, vp_mat, white);
}
void DebugRenderer::draw_octree_node(const Octree::Node& node, const glm::mat4& vp_mat) {
using namespace std;
const auto& h = node.half_size;
std::vector<std::pair<glm::vec3, glm::vec3>> cube = {
make_pair(glm::vec3{h.x, h.y, h.z}, glm::vec3{-h.x, h.y, h.z}),
make_pair(glm::vec3{h.x, h.y, h.z}, glm::vec3{ h.x, -h.y, h.z}),
make_pair(glm::vec3{h.x, h.y, h.z}, glm::vec3{ h.x, h.y, -h.z}),
make_pair(glm::vec3{h.x, -h.y, h.z}, glm::vec3{-h.x, -h.y, h.z}),
make_pair(glm::vec3{h.x, -h.y, h.z}, glm::vec3{ h.x, -h.y, -h.z}),
make_pair(glm::vec3{-h.x, -h.y, h.z}, glm::vec3{-h.x, h.y, h.z}),
make_pair(glm::vec3{-h.x, -h.y, h.z}, glm::vec3{-h.x, -h.y, -h.z}),
make_pair(glm::vec3{-h.x, h.y, h.z}, glm::vec3{-h.x, h.y, -h.z}),
make_pair(glm::vec3{-h.x, h.y, -h.z}, glm::vec3{h.x, h.y, -h.z}),
make_pair(glm::vec3{-h.x, h.y, -h.z}, glm::vec3{-h.x, -h.y, -h.z}),
make_pair(glm::vec3{h.x, -h.y, -h.z}, glm::vec3{-h.x, -h.y, -h.z}),
make_pair(glm::vec3{h.x, -h.y, -h.z}, glm::vec3{h.x, h.y, -h.z}),
};
glm::vec3 white = glm::vec3({1, 1, 1});
const auto& vp_mat2 = glm::translate(vp_mat, node.pos);
draw_lines(cube, vp_mat2, white);
if(node.point != nullptr) {
draw_point(*node.point, vp_mat);
}
if(node.children != nullptr) {
for(const auto& child: *node.children) {
if(child.entity_id != -1 || child.children != nullptr) {
draw_octree_node(child, vp_mat);
}
}
}
}
void DebugRenderer::draw_octree(const Octree& octree, const glm::mat4& vp_mat) {
draw_octree_node(octree.root, vp_mat);
}
|
Jrende/Hondo
|
src/gfx/DebugRenderer.cpp
|
C++
|
mit
| 4,961
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>stream_socket_service::receive</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../../index.html" title="Asio">
<link rel="up" href="../stream_socket_service.html" title="stream_socket_service">
<link rel="prev" href="protocol_type.html" title="stream_socket_service::protocol_type">
<link rel="next" href="remote_endpoint.html" title="stream_socket_service::remote_endpoint">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="asio C++ library" width="250" height="60" src="../../../asio.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="protocol_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../stream_socket_service.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="remote_endpoint.html"><img src="../../../next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="asio.reference.stream_socket_service.receive"></a><a class="link" href="receive.html" title="stream_socket_service::receive">stream_socket_service::receive</a>
</h4></div></div></div>
<p>
<a class="indexterm" name="idp161246352"></a>
Receive some data from the peer.
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span>
<span class="keyword">typename</span> <a class="link" href="../MutableBufferSequence.html" title="Mutable buffer sequence requirements">MutableBufferSequence</a><span class="special">></span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">receive</span><span class="special">(</span>
<span class="identifier">implementation_type</span> <span class="special">&</span> <span class="identifier">impl</span><span class="special">,</span>
<span class="keyword">const</span> <span class="identifier">MutableBufferSequence</span> <span class="special">&</span> <span class="identifier">buffers</span><span class="special">,</span>
<span class="identifier">socket_base</span><span class="special">::</span><span class="identifier">message_flags</span> <span class="identifier">flags</span><span class="special">,</span>
<span class="identifier">asio</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&</span> <span class="identifier">ec</span><span class="special">);</span>
</pre>
</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 © 2003-2014 Christopher M. Kohlhoff<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="protocol_type.html"><img src="../../../prev.png" alt="Prev"></a><a accesskey="u" href="../stream_socket_service.html"><img src="../../../up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../home.png" alt="Home"></a><a accesskey="n" href="remote_endpoint.html"><img src="../../../next.png" alt="Next"></a>
</div>
</body>
</html>
|
dhh1128/intent
|
old/src/external/asio-1.10.2/doc/asio/reference/stream_socket_service/receive.html
|
HTML
|
mit
| 3,747
|
//package codechicken.enderstorage.command.help;
//
//import codechicken.enderstorage.api.EnderStoragePlugin;
//import codechicken.enderstorage.manager.EnderStorageManager;
//import codechicken.lib.command.help.IHelpPage;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map.Entry;
//
///**
// * Created by covers1624 on 18/01/2017.
// */
//public class ValidStorageHelp implements IHelpPage {
//
// @Override
// public String getName() {
// return "validStorage";
// }
//
// @Override
// public String getDesc() {
// return "Displays the valid key words for systems managed by EnderStorage.";
// }
//
// @Override
// public List<String> getHelp() {
// List<String> list = new ArrayList<>();
// list.add("This directly references what plugins are installed to EnderStorage");
// list.add("\"*\" is a valid keyword and essentially means All Plugins.");
// list.add("Valid keywords:");
// for (Entry<String, EnderStoragePlugin> entry : EnderStorageManager.getPlugins().entrySet()) {
// list.add(" " + entry.getKey());
// }
// return list;
// }
//}
|
TheCBProject/EnderStorage
|
src/main/java/codechicken/enderstorage/command/help/ValidStorageHelp.java
|
Java
|
mit
| 1,175
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013 Dogecoin Developers
// Copyright (c) 2014 Surge Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "protocol.h"
#include "util.h"
#include "netbase.h"
#ifndef WIN32
# include <arpa/inet.h>
#endif
static const char* ppszTypeName[] =
{
"ERROR",
"tx",
"block",
};
CMessageHeader::CMessageHeader()
{
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
memset(pchCommand, 0, sizeof(pchCommand));
pchCommand[1] = 1;
nMessageSize = -1;
nChecksum = 0;
}
CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn)
{
memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart));
strncpy(pchCommand, pszCommand, COMMAND_SIZE);
nMessageSize = nMessageSizeIn;
nChecksum = 0;
}
std::string CMessageHeader::GetCommand() const
{
if (pchCommand[COMMAND_SIZE-1] == 0)
return std::string(pchCommand, pchCommand + strlen(pchCommand));
else
return std::string(pchCommand, pchCommand + COMMAND_SIZE);
}
bool CMessageHeader::IsValid() const
{
// Check start string
if (memcmp(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)) != 0)
return false;
// Check the command string for errors
for (const char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++)
{
if (*p1 == 0)
{
// Must be all zeros after the first zero
for (; p1 < pchCommand + COMMAND_SIZE; p1++)
if (*p1 != 0)
return false;
}
else if (*p1 < ' ' || *p1 > 0x7E)
return false;
}
// Message size
if (nMessageSize > MAX_SIZE)
{
printf("CMessageHeader::IsValid() : (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand().c_str(), nMessageSize);
return false;
}
return true;
}
CAddress::CAddress() : CService()
{
Init();
}
CAddress::CAddress(CService ipIn, uint64 nServicesIn) : CService(ipIn)
{
Init();
nServices = nServicesIn;
}
void CAddress::Init()
{
nServices = NODE_NETWORK;
nTime = 100000000;
nLastTry = 0;
}
CInv::CInv()
{
type = 0;
hash = 0;
}
CInv::CInv(int typeIn, const uint256& hashIn)
{
type = typeIn;
hash = hashIn;
}
CInv::CInv(const std::string& strType, const uint256& hashIn)
{
unsigned int i;
for (i = 1; i < ARRAYLEN(ppszTypeName); i++)
{
if (strType == ppszTypeName[i])
{
type = i;
break;
}
}
if (i == ARRAYLEN(ppszTypeName))
throw std::out_of_range(strprintf("CInv::CInv(string, uint256) : unknown type '%s'", strType.c_str()));
hash = hashIn;
}
bool operator<(const CInv& a, const CInv& b)
{
return (a.type < b.type || (a.type == b.type && a.hash < b.hash));
}
bool CInv::IsKnownType() const
{
return (type >= 1 && type < (int)ARRAYLEN(ppszTypeName));
}
const char* CInv::GetCommand() const
{
if (!IsKnownType())
throw std::out_of_range(strprintf("CInv::GetCommand() : type=%d unknown type", type));
return ppszTypeName[type];
}
std::string CInv::ToString() const
{
return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,20).c_str());
}
void CInv::print() const
{
printf("CInv(%s)\n", ToString().c_str());
}
|
surgecoin/Surge
|
src/protocol.cpp
|
C++
|
mit
| 3,533
|
<?php
/**
* Singleton Factory
*
* @package RedLove
* @subpackage PHP
* @category Classes
* @author Joshua Logsdon <joshua@joshualogsdon.com>
* @author Various from CodeIgniter to Internet
* @copyright Copyright (c) 2015, Joshua Logsdon (http://joshualogsdon.com/)
* @license http://opensource.org/licenses/MIT MIT License
* @link https://github.com/logsdon/redlove
* @link http://redlove.org
* @version 0.0.0
*
* Resources:
* http://stackoverflow.com/questions/130878/global-or-singleton-for-database-connection
*
* Usage:
*
require_once('Singleton_factory.php');
$obj = Singleton_factory::get_instance()->get_obj();
var_dump($obj);
var_dump(Singleton_factory::get_instance()->public_property);
*
*/
class Singleton_factory
{
// --------------------------------------------------------------------
// Public properties
// --------------------------------------------------------------------
/**
* Test public property
*
* @var string
*/
public $public_property = 'my-public-property';
// --------------------------------------------------------------------
// Private properties
// --------------------------------------------------------------------
/**
* Static class instance
*
* @var object
*/
private static $instance;
/**
* Secondary object
*
* @var object
*/
private $obj;
// --------------------------------------------------------------------
// Public methods
// --------------------------------------------------------------------
/**
* Class constructor
*
* @param mixed $params An array of parameters or list of arguments
*/
public function __construct ( $params = array() )
{
}
/**
* Get single instance
*
* @return object Singleton
*/
public static function get_instance ()
{
// Create single instance if it doesn't exist
if ( ! self::$instance )
{
self::$instance = new Singleton_factory();
}
return self::$instance;
}
/**
* Get single instance
*
* @return object Singleton
*/
public function get_obj ()
{
// Create single instance if it doesn't exist
if ( ! $this->obj )
{
$this->obj = new Singleton_factory_obj();
}
return $this->obj;
}
}
class Singleton_factory_obj
{
}
|
logsdon/redlove
|
php/classes/Singleton_factory.php
|
PHP
|
mit
| 2,206
|
(function() {
'use strict';
angular
.module('app')
.filter('sample', sample);
function sample() {
return sampleFilter;
////////////////
function sampleFilter(params) {
return params;
}
}
})();
|
chandantrue/AngularApp
|
client/app/components/filters/sample.filter.js
|
JavaScript
|
mit
| 289
|
/*!
@Name: layer's style
@Author: 贤心
@Blog: sentsin.com
*/
* html {
background-image: url(about:blank);
background-attachment: fixed;
}
html #layui_layer_skinlayercss {
display: none;
position: absolute;
width: 1989px;
}
/* common */
.layui-layer-shade, .layui-layer {
position: fixed;
_position: absolute;
pointer-events: auto;
}
.layui-layer-shade {
top: 0;
left: 0;
width: 100%;
height: 100%;
_height: expression(document.body.offsetHeight+"px");
}
.layui-layer {
-webkit-overflow-scrolling: touch;
}
.layui-layer {
top: 150px;
left: 0;
margin: 0;
padding: 0;
background-color: #fff;
-webkit-background-clip: content;
box-shadow: 1px 1px 50px rgba(0, 0, 0, .3);
}
.layui-layer-close {
position: absolute;
}
.layui-layer-content {
position: relative;
}
.layui-layer-border {
border: 1px solid #B2B2B2;
border: 1px solid rgba(0, 0, 0, .3);
box-shadow: 1px 1px 5px rgba(0, 0, 0, .2);
}
.layui-layer-moves {
position: absolute;
border: 3px solid #666;
border: 3px solid rgba(0, 0, 0, .5);
cursor: move;
background-color: #fff;
background-color: rgba(255, 255, 255, .3);
filter: alpha(opacity=50);
}
.layui-layer-load {
background: url(default/loading-0.gif) #fff center center no-repeat;
}
.layui-layer-ico {
background: url(default/icon.png) no-repeat;
}
.layui-layer-dialog .layui-layer-ico,
.layui-layer-setwin a,
.layui-layer-btn a {
display: inline-block;
*display: inline;
*zoom: 1;
vertical-align: top;
}
/* 动画 */
.layui-layer {
border-radius: 2px;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: .3s;
animation-duration: .3s;
}
@-webkit-keyframes bounceIn { /* 默认 */
0% {
opacity: 0;
-webkit-transform: scale(.5);
transform: scale(.5)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1)
}
}
@keyframes bounceIn {
0% {
opacity: 0;
-webkit-transform: scale(.5);
-ms-transform: scale(.5);
transform: scale(.5)
}
100% {
opacity: 1;
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
.layer-anim {
-webkit-animation-name: bounceIn;
animation-name: bounceIn
}
@-webkit-keyframes bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.03);
transform: scale(1.03)
}
0% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes bounceOut {
100% {
opacity: 0;
-webkit-transform: scale(.7);
-ms-transform: scale(.7);
transform: scale(.7)
}
30% {
-webkit-transform: scale(1.03);
-ms-transform: scale(1.03);
transform: scale(1.03)
}
0% {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1)
}
}
.layer-anim-close {
-webkit-animation-name: bounceOut;
animation-name: bounceOut;
-webkit-animation-duration: .2s;
animation-duration: .2s;
}
@-webkit-keyframes zoomInDown {
0% {
opacity: 0;
-webkit-transform: scale(.1) translateY(-2000px);
transform: scale(.1) translateY(-2000px);
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out
}
60% {
opacity: 1;
-webkit-transform: scale(.475) translateY(60px);
transform: scale(.475) translateY(60px);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out
}
}
@keyframes zoomInDown {
0% {
opacity: 0;
-webkit-transform: scale(.1) translateY(-2000px);
-ms-transform: scale(.1) translateY(-2000px);
transform: scale(.1) translateY(-2000px);
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out
}
60% {
opacity: 1;
-webkit-transform: scale(.475) translateY(60px);
-ms-transform: scale(.475) translateY(60px);
transform: scale(.475) translateY(60px);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out
}
}
.layer-anim-01 {
-webkit-animation-name: zoomInDown;
animation-name: zoomInDown
}
@-webkit-keyframes fadeInUpBig {
0% {
opacity: 0;
-webkit-transform: translateY(2000px);
transform: translateY(2000px)
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0)
}
}
@keyframes fadeInUpBig {
0% {
opacity: 0;
-webkit-transform: translateY(2000px);
-ms-transform: translateY(2000px);
transform: translateY(2000px)
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0)
}
}
.layer-anim-02 {
-webkit-animation-name: fadeInUpBig;
animation-name: fadeInUpBig
}
@-webkit-keyframes zoomInLeft {
0% {
opacity: 0;
-webkit-transform: scale(.1) translateX(-2000px);
transform: scale(.1) translateX(-2000px);
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out
}
60% {
opacity: 1;
-webkit-transform: scale(.475) translateX(48px);
transform: scale(.475) translateX(48px);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out
}
}
@keyframes zoomInLeft {
0% {
opacity: 0;
-webkit-transform: scale(.1) translateX(-2000px);
-ms-transform: scale(.1) translateX(-2000px);
transform: scale(.1) translateX(-2000px);
-webkit-animation-timing-function: ease-in-out;
animation-timing-function: ease-in-out
}
60% {
opacity: 1;
-webkit-transform: scale(.475) translateX(48px);
-ms-transform: scale(.475) translateX(48px);
transform: scale(.475) translateX(48px);
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out
}
}
.layer-anim-03 {
-webkit-animation-name: zoomInLeft;
animation-name: zoomInLeft
}
@-webkit-keyframes rollIn {
0% {
opacity: 0;
-webkit-transform: translateX(-100%) rotate(-120deg);
transform: translateX(-100%) rotate(-120deg)
}
100% {
opacity: 1;
-webkit-transform: translateX(0px) rotate(0deg);
transform: translateX(0px) rotate(0deg)
}
}
@keyframes rollIn {
0% {
opacity: 0;
-webkit-transform: translateX(-100%) rotate(-120deg);
-ms-transform: translateX(-100%) rotate(-120deg);
transform: translateX(-100%) rotate(-120deg)
}
100% {
opacity: 1;
-webkit-transform: translateX(0px) rotate(0deg);
-ms-transform: translateX(0px) rotate(0deg);
transform: translateX(0px) rotate(0deg)
}
}
.layer-anim-04 {
-webkit-animation-name: rollIn;
animation-name: rollIn
}
@keyframes fadeIn {
0% {
opacity: 0
}
100% {
opacity: 1
}
}
.layer-anim-05 {
-webkit-animation-name: fadeIn;
animation-name: fadeIn
}
@-webkit-keyframes shake {
0%, 100% {
-webkit-transform: translateX(0);
transform: translateX(0)
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translateX(-10px);
transform: translateX(-10px)
}
20%, 40%, 60%, 80% {
-webkit-transform: translateX(10px);
transform: translateX(10px)
}
}
@keyframes shake {
0%, 100% {
-webkit-transform: translateX(0);
-ms-transform: translateX(0);
transform: translateX(0)
}
10%, 30%, 50%, 70%, 90% {
-webkit-transform: translateX(-10px);
-ms-transform: translateX(-10px);
transform: translateX(-10px)
}
20%, 40%, 60%, 80% {
-webkit-transform: translateX(10px);
-ms-transform: translateX(10px);
transform: translateX(10px)
}
}
.layer-anim-06 {
-webkit-animation-name: shake;
animation-name: shake
}
@-webkit-keyframes fadeIn {
0% {
opacity: 0
}
100% {
opacity: 1
}
}
/* 标题栏 */
.layui-layer-title {
padding: 0 80px 0 20px;
height: 42px;
line-height: 42px;
border-bottom: 1px solid #eee;
font-size: 14px;
color: #333;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background-color: #F8F8F8;
border-radius: 2px 2px 0 0;
}
.layui-layer-setwin {
position: absolute;
right: 15px;
*right: 0;
top: 15px;
font-size: 0;
line-height: initial;
}
.layui-layer-setwin a {
position: relative;
width: 16px;
height: 16px;
margin-left: 10px;
font-size: 12px;
_overflow: hidden;
}
.layui-layer-setwin .layui-layer-min cite {
position: absolute;
width: 14px;
height: 2px;
left: 0;
top: 50%;
margin-top: -1px;
background-color: #2E2D3C;
cursor: pointer;
_overflow: hidden;
}
.layui-layer-setwin .layui-layer-min:hover cite {
background-color: #2D93CA;
}
.layui-layer-setwin .layui-layer-max {
background-position: -32px -40px;
}
.layui-layer-setwin .layui-layer-max:hover {
background-position: -16px -40px;
}
.layui-layer-setwin .layui-layer-maxmin {
background-position: -65px -40px;
}
.layui-layer-setwin .layui-layer-maxmin:hover {
background-position: -49px -40px;
}
.layui-layer-setwin .layui-layer-close1 {
background-position: 0 -40px;
cursor: pointer;
}
.layui-layer-setwin .layui-layer-close1:hover {
opacity: 0.7;
}
.layui-layer-setwin .layui-layer-close2 {
position: absolute;
right: -28px;
top: -28px;
width: 30px;
height: 30px;
margin-left: 0;
background-position: -149px -31px;
*right: -18px;
_display: none;
}
.layui-layer-setwin .layui-layer-close2:hover {
background-position: -180px -31px;
}
/* 按钮栏 */
.layui-layer-btn {
text-align: right;
padding: 0 10px 12px;
pointer-events: auto;
}
.layui-layer-btn a {
height: 28px;
line-height: 28px;
margin: 0 6px;
padding: 0 15px;
border: 1px #dedede solid;
background-color: #f1f1f1;
color: #333;
border-radius: 2px;
font-weight: 400;
cursor: pointer;
text-decoration: none;
}
.layui-layer-btn a:hover {
opacity: 0.9;
text-decoration: none;
}
.layui-layer-btn a:active {
opacity: 0.7;
}
.layui-layer-btn .layui-layer-btn0 {
border-color: #4898d5;
background-color: #2e8ded;
color: #fff;
}
/* 定制化 */
.layui-layer-dialog {
min-width: 260px;
}
.layui-layer-dialog .layui-layer-content {
position: relative;
padding: 20px;
line-height: 24px;
word-break: break-all;
overflow: hidden;
font-size: 14px;
overflow-x: hidden;
overflow-y: auto;
}
.layui-layer-dialog .layui-layer-content .layui-layer-ico {
position: absolute;
top: 16px;
left: 15px;
_left: -40px;
width: 30px;
height: 30px;
}
.layui-layer-ico1 {
background-position: -30px 0
}
.layui-layer-ico2 {
background-position: -60px 0;
}
.layui-layer-ico3 {
background-position: -90px 0;
}
.layui-layer-ico4 {
background-position: -120px 0;
}
.layui-layer-ico5 {
background-position: -150px 0;
}
.layui-layer-ico6 {
background-position: -180px 0;
}
.layui-layer-rim {
border: 6px solid #8D8D8D;
border: 6px solid rgba(0, 0, 0, .3);
border-radius: 5px;
box-shadow: none;
}
.layui-layer-msg {
min-width: 180px;
border: 1px solid #D3D4D3;
box-shadow: none;
}
.layui-layer-hui {
min-width: 100px;
background-color: #000;
filter: alpha(opacity=60);
background-color: rgba(0, 0, 0, 0.6);
color: #fff;
border: none;
}
.layui-layer-hui .layui-layer-content {
padding: 12px 25px;
text-align: center;
}
.layui-layer-dialog .layui-layer-padding {
padding: 20px 20px 20px 55px;
text-align: left;
}
.layui-layer-page .layui-layer-content {
position: relative;
overflow: auto;
}
.layui-layer-page .layui-layer-btn, .layui-layer-iframe .layui-layer-btn {
padding-top: 10px;
}
.layui-layer-nobg {
background: none;
}
.layui-layer-iframe .layui-layer-content {
overflow: hidden;
}
.layui-layer-iframe iframe {
display: block;
width: 100%;
}
.layui-layer-loading {
border-radius: 100%;
background: none;
box-shadow: none;
border: none;
}
.layui-layer-loading .layui-layer-content {
width: 60px;
height: 24px;
background: url(default/loading-0.gif) no-repeat;
}
.layui-layer-loading .layui-layer-loading1 {
width: 37px;
height: 37px;
background: url(default/loading-1.gif) no-repeat;
}
.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16 {
width: 32px;
height: 32px;
background: url(default/loading-2.gif) no-repeat;
}
.layui-layer-tips {
background: none;
box-shadow: none;
border: none;
}
.layui-layer-tips .layui-layer-content {
position: relative;
line-height: 22px;
min-width: 12px;
padding: 5px 10px;
font-size: 12px;
_float: left;
border-radius: 3px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, .3);
background-color: #FF9900;
color: #fff;
}
.layui-layer-tips .layui-layer-close {
right: -2px;
top: -1px;
}
.layui-layer-tips i.layui-layer-TipsG {
position: absolute;
width: 0;
height: 0;
border-width: 8px;
border-color: transparent;
border-style: dashed;
*overflow: hidden;
}
.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB {
left: 5px;
border-right-style: solid;
border-right-color: #FF9900;
}
.layui-layer-tips i.layui-layer-TipsT {
bottom: -8px;
}
.layui-layer-tips i.layui-layer-TipsB {
top: -8px;
}
.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL {
top: 1px;
border-bottom-style: solid;
border-bottom-color: #FF9900;
}
.layui-layer-tips i.layui-layer-TipsR {
left: -8px;
}
.layui-layer-tips i.layui-layer-TipsL {
right: -8px;
}
/* skin */
.layui-layer-lan[type="dialog"] {
min-width: 280px;
}
.layui-layer-lan .layui-layer-title {
background: #4476A7;
color: #fff;
border: none;
}
.layui-layer-lan .layui-layer-btn {
padding: 10px;
text-align: right;
border-top: 1px solid #E9E7E7
}
.layui-layer-lan .layui-layer-btn a {
background: #BBB5B5;
border: none;
}
.layui-layer-lan .layui-layer-btn .layui-layer-btn1 {
background: #C9C5C5;
}
.layui-layer-molv .layui-layer-title {
background: #009f95;
color: #fff;
border: none;
}
.layui-layer-molv .layui-layer-btn a {
background: #009f95;
}
.layui-layer-molv .layui-layer-btn .layui-layer-btn1 {
background: #92B8B1;
}
/**
@Name: layer拓展样式
*/
.layui-layer-iconext {
background: url(default/icon-ext.png) no-repeat;
}
/* prompt模式 */
.layui-layer-prompt .layui-layer-input {
display: block;
width: 220px;
height: 30px;
margin: 0 auto;
line-height: 30px;
padding: 0 5px;
border: 1px solid #ccc;
box-shadow: 1px 1px 5px rgba(0, 0, 0, .1) inset;
color: #333;
}
.layui-layer-prompt textarea.layui-layer-input {
width: 300px;
height: 100px;
line-height: 20px;
}
/* tab模式 */
.layui-layer-tab {
box-shadow: 1px 1px 50px rgba(0, 0, 0, .4);
}
.layui-layer-tab .layui-layer-title {
padding-left: 0;
border-bottom: 1px solid #ccc;
background-color: #eee;
overflow: visible;
}
.layui-layer-tab .layui-layer-title span {
position: relative;
float: left;
min-width: 80px;
max-width: 260px;
padding: 0 20px;
text-align: center;
cursor: default;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.layui-layer-tab .layui-layer-title span.layui-layer-tabnow {
height: 43px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
background-color: #fff;
z-index: 10;
}
.layui-layer-tab .layui-layer-title span:first-child {
border-left: none;
}
.layui-layer-tabmain {
line-height: 24px;
clear: both;
}
.layui-layer-tabmain .layui-layer-tabli {
display: none;
}
.layui-layer-tabmain .layui-layer-tabli.xubox_tab_layer {
display: block;
}
.xubox_tabclose {
position: absolute;
right: 10px;
top: 5px;
cursor: pointer;
}
/* photo模式 */
.layui-layer-photos {
-webkit-animation-duration: 1s;
animation-duration: 1s;
}
.layui-layer-photos .layui-layer-content {
overflow: hidden;
text-align: center;
}
.layui-layer-photos .layui-layer-phimg img {
position: relative;
width: 100%;
display: inline-block;
*display: inline;
*zoom: 1;
vertical-align: top;
}
.layui-layer-imguide, .layui-layer-imgbar {
display: none;
}
.layui-layer-imgprev, .layui-layer-imgnext {
position: absolute;
top: 50%;
width: 27px;
_width: 44px;
height: 44px;
margin-top: -22px;
outline: none;
blr: expression(this.onFocus=this.blur());
}
.layui-layer-imgprev {
left: 10px;
background-position: -5px -5px;
_background-position: -70px -5px;
}
.layui-layer-imgprev:hover {
background-position: -33px -5px;
_background-position: -120px -5px;
}
.layui-layer-imgnext {
right: 10px;
_right: 8px;
background-position: -5px -50px;
_background-position: -70px -50px;
}
.layui-layer-imgnext:hover {
background-position: -33px -50px;
_background-position: -120px -50px;
}
.layui-layer-imgbar {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 32px;
line-height: 32px;
background-color: rgba(0, 0, 0, .8);
background-color: #000 \9;
filter: Alpha(opacity=80);
color: #fff;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 0;
}
.layui-layer-imgtit { /*position:absolute; left:20px;*/
}
.layui-layer-imgtit * {
display: inline-block;
*display: inline;
*zoom: 1;
vertical-align: top;
font-size: 12px;
}
.layui-layer-imgtit a {
max-width: 65%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
color: #fff;
}
.layui-layer-imgtit a:hover {
color: #fff;
text-decoration: underline;
}
.layui-layer-imgtit em {
padding-left: 10px;
font-style: normal;
}
|
TCL-MIG-FE/velocity-startkit
|
resources/src/plugins/layer/skin/layer.css
|
CSS
|
mit
| 18,674
|
import { NgZone } from '@angular/core';
import { Menu, MenuItem, MenuItemConstructorOptions, PopupOptions, remote } from 'electron';
import { Observable, Subject } from 'rxjs';
let uniqueId = 0;
interface MenuItemWithId extends MenuItem {
id?: string;
}
export class NativeMenuRef {
readonly id: string = `native-menu-${uniqueId++}`;
private readonly _menu: Menu;
private _clickedMenuItem: MenuItemWithId | null = null;
private readonly _afterClosed = new Subject<MenuItemWithId | null>();
constructor(
template: MenuItemConstructorOptions[],
options: PopupOptions,
private ngZone: NgZone,
) {
this._menu = remote.Menu.buildFromTemplate(
this._templateWithCallback(template),
);
options.callback = () => {
this.ngZone.run(() => {
this._afterClosed.next(this._clickedMenuItem);
});
};
this._menu.popup(options);
}
close(): void {
this._menu.closePopup();
}
afterClosed(): Observable<MenuItemWithId | null> {
return this._afterClosed.asObservable();
}
private _templateWithCallback(
template: MenuItemConstructorOptions[],
): MenuItemConstructorOptions[] {
const cloned = [...template];
cloned.forEach((item) => {
if (item.type === 'submenu' && item.submenu) {
item.submenu = this._templateWithCallback(
item.submenu as MenuItemConstructorOptions[],
);
}
const ref = this;
item.click = (menuItem) => {
ref._clickedMenuItem = menuItem;
};
});
return cloned;
}
}
|
seokju-na/geeks-diary
|
src/browser/ui/menu/native-menu-ref.ts
|
TypeScript
|
mit
| 1,738
|
import * as React from "react";
import styled from "styled-components";
import { Themer } from "@patternplate/component-utility";
import { Icon, symbols } from "./icon";
function DemoIcon(props) {
return (
<StyledDemoIcon title={props.title}>
<Icon symbol={props.symbol} />
</StyledDemoIcon>
);
}
export default function IconDemo() {
return (
<Themer spacing={true}>
<StyledIconDemo>
{symbols.map(symbol => (
<DemoIcon key={symbol} symbol={symbol} title={symbol} />
))}
</StyledIconDemo>
</Themer>
);
}
const TITLE = props => props.title;
const StyledDemoIcon = styled.div`
display: flex;
align-items: center;
justify-content: center;
position: relative;
margin: 10px;
color: ${props => props.theme.colors.color};
&::after {
content: '${TITLE}';
display: block;
font-family: sans-serif;
margin-left: 10px;
}
`;
const StyledIconDemo = styled.div`
display: flex;
flex-wrap: wrap;
color: ${props => props.theme.colors.color};
`;
|
sinnerschrader/patternplate
|
components/next-generation/icon/src/icon.demo.tsx
|
TypeScript
|
mit
| 1,037
|
# 4Minitz FAQ - Frequently Asked Questions
### 4Minitz is a cumbersome name - what does it mean?
The 4Minitz webapp is simply "for the minutes". ;-)
(Some people also told us that setting up the server was done in only *four minutes*).
### What does the "red warning message" mean?
See first chapter of the [user doc](user/usermanual.md). This message warns you that your client lost connection to the server. Either the server is down or your internet connection is weak. All changes made from now on are lost if you close your browser window before the connection is re-established and offline syncing could finish.
### Topics, Info Items, Action Items, Details? I don't get it...
4Minitz offers the following hierarchy to structure your meeting minutes:
```
Topic
|
+-- Info Item
+-- Detail (Markdown)
+-- Action Item
+-- Detail (Markdown)
```
* **Topics:** are the agenda points that have to be discussed. Topics can be automatically recurring at every meeting. And can be skipped once. They are usually created before the actual meeting and sent via agenda mail.
* **Info Items:** Are usually created during topic discussion. Info items inform the outside world about what was discussed for a specific topic. Labels (e.g., #Decision) allow classification of info items. If one line of text is not enough add details.
* **Action Items:** Are created during topic discussion. Action items document WHO-WHAT-WHEN if something has to be done to drive a topic forward. Action items keep their parent topic alive until they are all done. If one line of text is not enough add details.
* **Details:** You can add as many detail nodes to an action/info item as needed. Even in future meetings. Inside details you may use Markdown syntax to add some layout to your details text.
### Markdown? Never heard of it!
Markdown is a text-only syntax that allows to add layout like headings, bullet list, numbered lists, bold, italic, underline and strike through.
You may use markdown syntax in details below info items and action items.
For a complete reference of layout commands see [Markdown Reference](https://guides.github.com/features/mastering-markdown/).
### I accidentally deleted an Info Item, Action Item, Topic, Meeting Minutes, or Meeting Series. How can I un-delete it?
Unfortunately this is not possible. That why we implemented a security question in front of any destructive action.
### When is a TOPIC automatically propagated to the next meeting?
A topic is automatically propagated to the next meeting if one of the following conditions is met:
1. the topic is **not "checked"** as "done for this meeting" - or
1. the topic is **marked as "recurring"** with the blue circle icon - or
1. the topic has at least one **open action item** which is not checked as done.
### When is an ACTION ITEM automatically propagated to the next meeting?
An action item is propagated to the next meeting as long as it is **not checked as done**
### When is an INFORMATION ITEM automatically propagated to the next meeting?
An information item normally is a "one shot item" that is sent as part of the meeting minutes to all invited people. So it sticks to the meeting minutes where it was created and does not show up the next time. But you can "pin" an information item to its topic - this will propagate it to all future meetings as long as
1. You keep the info item pinned - and
1. The parent topic is also propagated to the next meeting (see question above "When is a topic automatically propagated to the next meeting?").
This means: A pinned information item *does not* force its topic to propagate. And: If the topic does not propagate, child info items will also not propagate.
### How can I become the moderator of a meeting series?
Two ways:
1. You create the meeting series. Now you will be moderator of this meeting series
1. Someone else is moderator of the meeting series. A moderator can promote other users to be also moderators.
### How can I invite other people to a meeting series?
If you are a moderator of the meeting series, open the "Meeting Series Properties Editor" via the "top-right cog icon. Select the section "Invited Users". Enter the first letters of the username, then select the to-be-invited users. Finally click the "Save" button to persist your changes.
### How can I leave a meeting series?
**If you are a moderator**: You cannot remove yourself from the series alone. This is to ensure that there are no orphaned meeting series without any moderators. You, as a moderator, can leave the meeting series the following way: First make someone else to the moderator. Then ask this person to remove your user from the series. This can be done with the "Meeting Series Editor".
The only other chance is that you delete the Meeting Series
**If you are not moderator**: Log in to 4Minitz. On the list of your visible meeting series click on the meeting series. On the meeting series view click the button "Leave Meeting Series".
### How can I add further labels to a meeting series or change existing labels text or color?
Open the meeting series, then click the "cog icon" to open the meeting series properties editor. Then open the section "Labels". Here you can add, remove and edit labels. During edit you can change the label text and the label color.
**Important: Changes to an existing label (even deleting it!) will change all past meeting minutes that used this label.**
### Is there a fast way to create a label during a minute?
If you enter an action item or info item subject with a "#string" (with preceding space!) in it, this string will be added as new label to the meeting series and is available in all future meeting series. The color code will be gray.
For example enter the following text to an action item or info item subject: **"This is my new item #Important"**. From now on you will have the "Important" label in you label selection list.
Power users may add an additional color code by providing an RGB hex color code like so: **"This is my new item #Important#ff0000"**
### My meeting minute is finalized but contains some error. How can I fix it? Is it possible to do an "un-finalize"?
Only the latest meeting minutes can be unfinalized if they are finalized. Open the meeting minutes and click the "pen icon" to unfinalize the meeting minutes.
It is not possible to un-finalize a meeting minute, if a newer meeting already has been created. If you have created such a newer meeting but there are no important changes to these newest minutes, you can delete the newest minutes and afterward you can un-finalize the previous meeting minutes.
### How can I send the agenda or meeting minutes to a person that has no 4Minitz account
Simply enter the persons mail address to the "Additional Participants" field of the meeting minutes.
You can mix real names and mail addresses here. Our algorithm grabs everything
that looks like a mail address from this field. For example if you enter:
**Additional Participants:** ```Max Mustermann (max@mustermann.com), john@doe.com, Erika Mustermann```
to the
additional participants field, then the agenda an meeting minutes are sent to
the regular invited users and to these additional mail addresses:
```max@mustermann.com``` and ```john@doe.com```
### How can I send an action item to a person that has no 4Minitz account
Simply enter the persons mail address to the "Responsible" field.
It will be available in the type ahead drop down box in the future meetings.
### Can I see who un-finalized and the re-finalized a meeting minutes?
Yes. Inside the meeting minute hover over this (example) text:
`Version 3. Finalized on 2017-01-11 09:09:54 by user1` and you'll see
the finalize history:

### How do I change my user long name, mail address or password?
If you have a standard user account click on your username in the menu and choose "Edit Profile" or "Change Password".
If you do not see these menu entries you are probably logged in as LDAP / ActiveDirectory user. In this case your user data is hosted on the domain controller or dictionary server. Ask your admin how to change your data.
### How can I unsubscribe from 4Minitz?
For LDAP / Active Directory users this is not possible.
For "Standard" users currently this procedure has to be taken:
1. Click "Leave Meeting" for all active meeting series where you are invited. Otherwise you will get future meeting minutes.
1. Ask your admin to go to the "Admin Tasks" menu, search for your username and click the "In/Active" toggle. When your account is inactive, you will not be able to login and other users will not be able to select your user as participant for new meetings or responsible for action items. Nevertheless your user will still be in the database to render past meeting minutes correctly.
### How can I download a meeting minutes file to my local disk?
If you want to keep meeting minutes as files on your local drive (backups anyone?) then you might want to download a file with the meeting minutes. On a minutes view click the "download" button top right to download a file. If you do not see the download button, ask your admin to enable this feature (`docGeneration`).
### Why have action items sometimes different background colour?
The background color of action items is calculated from the due date.
* green/teal: future due date
* yellow: due date is today
* red: due date is in the past
### I'm curious! Can I have some server statistics?
Yes, open the about dialog and click on the 4Minitz logo. This
will show / hide the current server statistics and show how many
users, meeting series, minutes and attachments the server stores.
|
RobNeXX/4minitz
|
doc/faq.md
|
Markdown
|
mit
| 9,850
|
<?php
/*
* This file is part of the lyMediaManagerPlugin package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* lyMediaValidatorFolder folder validator class.
*
* @package lyMediaManagerPlugin
* @subpackage validator
* @copyright Copyright (C) 2010 Massimo Giagnoni.
* @license http://www.symfony-project.org/license MIT
* @version SVN: $Id: lyMediaValidatorFolder.class.php 29999 2010-06-26 01:33:51Z mgiagnoni $
*/
class lyMediaValidatorFolder extends sfValidatorBase
{
public function configure($options = array(), $messages = array())
{
$this->addMessage('folder_exists', 'Can\'t create "%name%". A folder with the same name exists in "%parent%"');
}
protected function doClean($values)
{
$my_id = 0;
if($values['parent_id'])
{
$parent = Doctrine::getTable('lyMediaFolder')
->find($values['parent_id']);
}
else
{
$my_id = $values['id'];
$object = Doctrine::getTable('lyMediaFolder')
->find($my_id);
$parent = $object->getNode()->getParent();
}
if(!$parent || !$parent->getNode()->isValidNode())
{
throw new sfValidatorError($this, 'invalid');
}
if($children = $parent->getNode()->getChildren())
{
foreach($children as $c)
{
if($values['name'] == $c->getName() && $c->getId() != $my_id)
{
throw new sfValidatorError($this, 'folder_exists', array('name' => $values['name'], 'parent' => $parent->getName()));
}
}
}
return $values;
}
}
|
pycmam/lyMediaManagerPlugin
|
lib/validator/lyMediaValidatorFolder.class.php
|
PHP
|
mit
| 1,625
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image/x-icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="../css/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="../css/fonts.css">
<link rel="stylesheet" type="text/css" href="../css/sweetalert.css">
<link rel="stylesheet" type="text/css" href="../css/game.css">
<title>C.A.S.E.O.</title>
</head>
<body>
<div class="center-align-container">
<canvas id="myCanvas" class="myCanvas"></canvas>
</div>
<div class="center-align-container" style="font-size:1.4em;margin-top:0;padding-top:0">
<a href="../menu.html" style="color:rgba(150, 146, 130, 0.7)"><i class="fa fa-bars fa-3x" aria-hidden="true"></i></a>
<span> </span>
<a id="LOCK_BTN" style="color:rgba(150, 146, 130, 0.7);cursor:pointer"><i class="fa fa-lock fa-3x" aria-hidden="true"></i></a>
<span> </span>
<a id="UNDO_BTN" style="color:rgba(150, 146, 130, 0.7);cursor:pointer"><i class="fa fa-times fa-3x" aria-hidden="true"></i></a>
<span> </span>
<a id="BOOKMARK_BTN" style="color:rgba(150, 146, 130, 0.7);cursor:pointer"><i class="fa fa-bookmark-o fa-3x" aria-hidden="true"></i></a>
<span> </span>
<a onclick="ReloadPage()" style="color:#DB7093;cursor:pointer"><i class="fa fa-repeat fa-3x" aria-hidden="true"></i></a>
</div>
<script src="../js/jquery-3.2.1.min.js"></script>
<script src="../js/sweetalert.min.js"></script>
<script src="../js/js.cookie.js"></script>
<script src="../js/utils.js"></script>
<script src="../js/board.js"></script>
<script>
$(document).ready(function() {
let R = 3;
let C = 3;
let row_data = [[0, 0, 2], [1, 1, 1], [1, 1, 1], [0, 0, 2]];
let col_data = [[0, 1, 0, 0], [2, 1, 1, 0], [0, 1, 1, 0]];
let win_h = $(window).height();
let win_w = $(window).width();
let FONT = "Courier, monospace";
let fh = 2;
let font_dim = MeasureText("A", true, FONT, fh);
let char_h = font_dim[1];
let char_w = font_dim[0];
let req_h = R * 5 * char_h + (R+1) * char_h + 80;
let req_w = C * 11 * char_w + (C+1) * char_w + 80;
while (req_h < win_h && req_w < win_w) {
++fh;
font_dim = MeasureText("A", true, FONT, fh);
char_h = font_dim[1];
char_w = font_dim[0];
req_h = R * 5 * char_h + (R+1) * char_h + 80;
req_w = C * 11 * char_w + (C+1) * char_w + 80;
}
var _b = new board(R, C, "myCanvas", FONT, fh-1);
_b.RestoreBookmark(row_data, col_data);
function getMousePos(canvas, evt) {
let rect = canvas.getBoundingClientRect();
return {
x: (evt.clientX-rect.left) / (rect.right-rect.left) * canvas.width,
y: (evt.clientY-rect.top) / (rect.bottom-rect.top) * canvas.height
};
}
var canvas = document.getElementById("myCanvas");
var _ctx = canvas.getContext("2d");
_ctx.strokeStyle = "#E6E6FA";
_ctx.lineWidth = Math.floor(fh*1.33);
var _drawing = false;
var _mousePos = { x : -1, y : -1 };
var _lastPos = _mousePos;
$('body').on('contextmenu', '#myCanvas', function(e) {
// Disable default right-click - it is used for creating helper walls
return false;
});
canvas.addEventListener("mousedown", function (e) {
_ctx.beginPath();
_drawing = true;
_lastPos = getMousePos(canvas, e);
_ctx.lineJoin = _ctx.lineCap = 'round';
}, false);
canvas.addEventListener("mouseup", function (e) {
if (_drawing) {
_ctx.closePath();
_mousePos = getMousePos(canvas, e);
if (e.which && e.which == 3)
_b.AddHelperWall(_mousePos.x, _mousePos.y);
else
_b.Clicked(_mousePos.x, _mousePos.y);
_lastPos = _mousePos;
_drawing = false;
}
}, false);
canvas.addEventListener("mousemove", function (e) {
_mousePos = getMousePos(canvas, e);
}, false);
canvas.addEventListener("mouseout", function (e) {
var mouseEvent = new MouseEvent("mouseup", {});
canvas.dispatchEvent(mouseEvent);
}, false);
function renderCanvas() {
if (_drawing) {
if (_lastPos.x > 0 && _lastPos.y > 0 &&
_mousePos.x > 0 && _mousePos.y > 0) {
_ctx.moveTo(_lastPos.x, _lastPos.y);
_ctx.lineTo(_mousePos.x, _mousePos.y);
_ctx.stroke();
}
_lastPos = _mousePos;
_b.LogDragClick(_mousePos.x, _mousePos.y);
}
}
(function drawLoop () {
requestAnimFrame(drawLoop);
renderCanvas();
})();
// TOUCH EVENTS
// Prevent scrolling when touching the canvas
canvas.addEventListener("touchstart", function (e) {
e.preventDefault();
var touch = e.touches[0];
var mouseEvent = new MouseEvent("mousedown", {
clientX: touch.clientX,
clientY: touch.clientY
});
canvas.dispatchEvent(mouseEvent);
}, false);
canvas.addEventListener("touchend", function (e) {
var mouseEvent = new MouseEvent("mouseup", {});
canvas.dispatchEvent(mouseEvent);
}, false);
canvas.addEventListener("touchmove", function (e) {
e.preventDefault();
var touch = e.touches[0];
var mouseEvent = new MouseEvent("mousemove", {
clientX: touch.clientX,
clientY: touch.clientY
});
canvas.dispatchEvent(mouseEvent);
}, false);
$("#LOCK_BTN").click(function() {
_b.ToggleLock();
});
$("#UNDO_BTN").click(function() {
_b.RestoreLockedState();
});
$("#BOOKMARK_BTN").click(function() {
_b.Bookmark();
});
});
</script>
</body>
</html>
|
grunfeld/grunfeld.github.io
|
levels/t4.html
|
HTML
|
mit
| 6,024
|
Ext.define('Signout.controller.Home', {
extend: 'Ext.app.Controller',
refs:[{
ref: 'infoform',
selector: 'homecard > * > form'
}],
models:['SliInfo'],
stores:['SliInfos'],
init: function(){
var id = tokobj.ssid;
var me = this;
this.control({
'homecard > * > form': {
render: function(){me.loadSliInfoForm(id)}
}
});
},
loadSliInfoForm: function(id){
var me = this;
this.getSliInfosStore().load({
url: '/ncssm/resources/slis/'+id,
method: 'GET',
callback: function(record){
me.getInfoform().getForm().loadRecord(record[0]);
}
});
}
});
|
jiangts/ncssm-signout
|
signout/sli/app/controller/Home.js
|
JavaScript
|
mit
| 753
|
var levState={
////////////Game made by Huanmeng Zhai/////////////////////////
//start state called 'start'
create: function(){
var platforms;
var player;
var cursors;
var monsterGroup;
var monster;
var stars;
var diamonds;
var score = 0;
var scoreText;
var button;
var mytime=0;
var total=0;
//add background
game.add.sprite(0, 0, 'sky');
//add game titile
//game.add.text(270,250,'Running Man',{font: '40px Normal'});
//add start button
game.add.button(game.world.centerX-130,310,'startbutton',clickStart);
function clickStart(){
game.state.start('main');
}
},
};
//mainstate called 'main'
var mainState = {
preload:function(){
game.load.image('sky','assets/sky.png');
game.load.image('ground','assets/platform.png');
game.load.image('star', 'assets/star.png');
game.load.image('diamond','assets/diamond.png');
game.load.spritesheet('dude','assets/dude.png',32,48);
game.load.spritesheet('badguy','assets/baddie.png',32,32);
game.load.audio('deadS',['assets/dead.mp3','assets/dead.ogg']);
game.load.audio('coinS',['assets/coin.mp3','assets/coin.ogg']);
game.load.audio('gamemusic','assets/gamemusic.wav');
},
create: function () {
//set world bounds
//game.physics.setBoundsToWorld(true,false,false,true,false);
game.world.setBounds(-50,0,1400,600);
//start physics
game.physics.startSystem(Phaser.Physics.ARCADE);
//add background
game.add.sprite(0, 0, 'sky');
//releaseLedge();
//add music
deadSound = game.add.audio('deadS');
coinMusic = game.add.audio('coinS');
//game music
music = game.add.audio('gamemusic',1,true);
music.play('',0,1,true);
//create a group
platforms = game.add.group();
platforms.enableBody = true;
//platforms.physicsBodyType = Phaser.Physics.ARCADE;
platforms.createMultiple(8,'ground');
////////
//platforms.setAll('body.velocity.x',-200);
//platforms.setAll('body.immovable',true);
//platforms.setAll('checkWorldBounds',true);
//platforms.setAll('outOfBoundsKill',true);
//first ledge show
this.timer = game.time.events.add(0,addfirstledge);
this.timer = game.time.events.add(1000,addSecondLedge);
//loop the ledge
//random a number for the timer
//**********maybe i created a function and return the i value then it will work
function randNumber(){
i = Math.floor((Math.random() * (1+3000-1999)) + 1999);
return i;
}
//***********need to change here so the ledge can appear in different time
this.timer = this.game.time.events.loop(1600,addLS,this);
//this.Startimer = this.game.time.events.loop(randNumber(),addstar,this);
//this.Startimer.start();
//add the first ledge
function addfirstledge(){
var ledge1 = platforms.getFirstDead();
//var ledge2 = platforms.getFirstExists(false);
ledge1.reset(200,game.world.height - 200);
//ledge2.reset(600,game.world.height - 200);
//200
//add velocity to the ledge
ledge1.body.velocity.x = -200;
ledge1.body.immovable = true;
//kill the ledge when it's no longer visible
ledge1.checkWorldBounds = true;
ledge1.outOfBoundsKill = true;
}
//add second ledge
function addSecondLedge(){
var ledge2 = platforms.getFirstDead();
//var ledge2 = platforms.getFirstExists(false);
ledge2.reset(600,game.world.height - 200);
//ledge2.reset(600,game.world.height - 200);
//200
//add velocity to the ledge
ledge2.body.velocity.x = -200;
ledge2.body.immovable = true;
//kill the ledge when it's no longer visible
ledge2.checkWorldBounds = true;
ledge2.outOfBoundsKill = true;
}
function addLedge(){
var ledgeX = this.game.rnd.integerInRange(800,1400);
var ledge = platforms.getFirstDead();
//var ledge = platforms.create(200+x*48,y*50,'ground');
ledge.reset(ledgeX,game.world.height - 200);
//add velocity to the ledge
ledge.body.velocity.x = -200;
//ledge.body.position.x = -200;
ledge.body.immovable = true;
//kill the ledge when it's no longer visible
ledge.checkWorldBounds = true;
ledge.outOfBoundsKill = true;
}
/*
//tried another version
function addLedge(){
var ledge = platforms.getFirstDead();
ledge.reset((Math.random()+800),game.world.height - 200);
//add velocity to the ledge
ledge.body.velocity.x = -200;
ledge.body.immovable = true;
//kill the ledge when it's no longer visible
ledge.checkWorldBounds = true;
ledge.outOfBoundsKill = true;
}
*/
//player add(height - 250 will be one the ledge)
player = game.add.sprite(32,game.world.height - 400,'dude');
//enable physics on player
game.physics.arcade.enable(player);
player.body.bounce.y = 0.2;
player.body.gravity.y = 500;
//player.body.collideWorldBounds = true;
//left and right image
player.animations.add('left',[0,1,2,3],10,true);
player.animations.add('right',[5,6,7,8],10,true);
//add monster
//monsterGroup = game.add.sprite(32,)
monsterGroup = game.add.group();
monsterGroup.enableBody = true;
monsterGroup.createMultiple(10,'badguy');
//adding the stars
stars = game.add.group();
stars.enableBody = true;
function addstar(){
var starNum = this.game.rnd.integerInRange(2,8);
var starX = this.game.rnd.integerInRange(800,1400);
var starY = this.game.rnd.integerInRange(game.world.height - 220,game.world.height - 350);
for(var i = 1;i < starNum; i++){
//var star = stars.create(i*50+650,game.world.height - 220,'star');
var star = stars.create(i*50+starX,starY,'star');
star.body.velocity.x = -200;
star.body.immoveable = true;
star.checkWorldBounds = true;
star.outOfBoundsKill = true;
}
}
//diamond group
diamonds = game.add.group();
diamonds.enableBody = true;
diamonds.createMultiple(5,'diamond');
function addLS(){
addLedge();
//releaseLedge();
addstar();
pickOne();
}
//this is function to deciced 1-5 monster,6-8 nothing,9-10 items
function pickOne(){
gamenumber = this.game.rnd.integerInRange(1,10);
//monster come owow
//alert(gamenumber);
if(gamenumber == 1,2,3){
var monsterX = this.game.rnd.integerInRange(800,1400);
monster = monsterGroup.getFirstDead();
monster.reset(monsterX,game.world.height - 300);
//player.body.collideWorldBounds = true;
//left and right image
monster.body.bounce.y = 0.2;
monster.body.gravity.y = 500;
monster.animations.add('left',[0,1],10,true);
monster.body.velocity.x = -50;
monster.animations.play('left');
monster.body.immoveable = true;
monster.checkWorldBounds = true;
monster.outOfBoundsKill = true;
}
//item
if(gamenumber == 9){
var diamondX = this.game.rnd.integerInRange(800,1400);
diamond = diamonds.getFirstDead();
diamond.reset(diamondX,game.world.height - 300)
game.physics.arcade.enable(diamond);
diamond.body.gravity.y= 500;
diamond.checkWorldBounds = true;
diamond.outOfBoundsKill = true;
}
}
// The score
scoreText = game.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000' });
cursors = game.input.keyboard.createCursorKeys();
},
update:function() {
// If the bird is out of the world (too high or too low), call the 'restartGame' function
if (player.inWorld == false){
deadSound.play();
music.stop();
game.state.start("end");
}
/*
if(total< 200&& game.time.now>mytime){
releaseLedge();
}
*/
//keep player on the ledge
//game.physics.arcade.collide(player,platforms);
game.physics.arcade.collide(player,platforms);
game.physics.arcade.collide(stars,platforms);
game.physics.arcade.overlap(player,stars,collectStar,null,this);
//monster physic
game.physics.arcade.collide(monsterGroup,platforms);
//game.physics.arcade.collide(monsterGroup,platforms,monsterFall,null,this);
game.physics.arcade.collide(player,monsterGroup,killplayer,null,this);
//diamond
game.physics.arcade.collide(diamonds,platforms);
game.physics.arcade.overlap(player,diamonds,diamondCollect);
//player x velocity
player.body.velocity.x = 0;
if(cursors.left.isDown){
//move to the left
player.body.velocity.x=-150;
player.animations.play('left');
}
if(cursors.right.isDown){
//move to the right
player.body.velocity.x = 200;
player.animations.play('right');
}
//jump if on the ground
if(cursors.up.isDown && player.body.touching.down){
player.body.velocity.y = -400;
}
if(score > 1000){
platforms.setAll('body.velocity.x',-300);
//alert(1)
}
if(score > 2000){
platforms.setAll('body.velocity.x',-400);
}
//when player and coins overlap,call this
function collectStar (player, star) {
//play coin music
coinMusic.play();
// Removes the star from the screen
star.kill();
// Add and update the score
score += 10;
scoreText.text = 'Score: ' + score;
}
/*
function checkCol(monster,platforms){
if(game.physics.arcade.collide(monster,platforms)==false){
monster.body.velocity.x=0;
}
}*/
function killplayer(player,monster){
//alert(monster.body.touching.up);
if(monster.body.touching.up){
monster.kill();
score += 25;
scoreText.text = 'Score: ' + score;
}
else{
deadSound.play();
music.stop();
game.state.start("end")
}
}
/*
function monsterFall(monsterGroup,platforms){
alert(monster.isTouchingGround())
if(monster.isTouchingGround()){
//alert(monster.body.touching.down);
monster.body.velocity.x=0;
monster.body.collideWorldBounds = false;
monster.animations.stop('left')
}
}
*/
function diamondCollect(player,diamonds){
//play music
coinMusic.play();
//remove diamond
diamonds.kill();
//add score
score += 100;
scoreText.text = 'Score: ' + score;
}
},
};
/*
function releaseLedge(){
//random altitude
//var altitude = game.rnd.integerInRange(0,game.world.bounds);
ledge = game.add.sprite((Math.random()*800),400,'star');
//ledge.body.velocity.x = -200;
tweenLedge = game.add.tween(ledge);
tweenLedge.to({ x:game.width-(1600 + ledge.x)},20000,Phaser.Easing.Linear.None,true);
tweenLedge.start();
total++;
mytime= game.time.now+100;
}
*/
//gameover state called 'end'
var endState ={
preload: function(){
game.load.image('sky','assets/sky.png');
//*********image too large need to small it find how
game.load.image('retry','assets/retry.png');
game.load.audio('deadM','assets/deadmusic.wav');
},
create: function(){
//add background
game.add.sprite(0, 0, 'sky');
//add retry button
button=game.add.button(300,310,'retry',clickAction);
//show game over
game.add.text(230,250,'Game Over',{font: '70px Normal'});
//show the score you get
game.add.text(250, 300, scoreText.text, { font: '60px Arial'});
//add sound
deadMusic = game.add.audio('deadM');
deadMusic.play();
function clickAction (){
score = 0
deadMusic.stop();
game.state.start('main');
}
}
};
game.state.add('start',startState);
game.state.add('main',mainState);
game.state.add('end',endState);
game.state.start('start');
};
|
nickchulani99/ITE-445
|
final/alien copy 6/js/lev.js
|
JavaScript
|
mit
| 10,889
|
package controllers
import akka.actor.ActorSystem
import io.flow.location.v0.models
import io.flow.location.v0.models.json._
import io.flow.reference.{Countries, data}
import io.flow.reference.v0.models.Country
import play.api.libs.json._
import play.api.mvc._
import scala.concurrent.Future
@javax.inject.Singleton
class CountryDefaults @javax.inject.Inject() (
override val controllerComponents: ControllerComponents,
helpers: Helpers,
system: ActorSystem,
) extends BaseController {
private[this] implicit val ec = system.dispatchers.lookup("controller-context")
private[this] val DefaultCurrency = "usd" // Remove once every country has one defined
private[this] val DefaultLanguage = "en" // Remove once every country has at least one language in reference data
def get(
country: Option[String],
ip: Option[String]
) = Action.async { _ =>
helpers.getLocations(country = country, ip = ip).map {
case Left(_) => data.Countries.all
case Right(locations) => locations.flatMap(_.country).flatMap(Countries.find)
}.map { countries =>
Ok(
Json.toJson(
countries.map { c =>
countryDefaults(c)
}
)
)
}
}
def getByCountry(
country: String
) = Action.async { _ =>
Future.successful (
Countries.find(country) match {
case None => NotFound
case Some(c) => {
Ok(Json.toJson(countryDefaults(c)))
}
}
)
}
private[this] def countryDefaults(c: Country) = models.CountryDefaults(
country = c.iso31663,
currency = c.defaultCurrency.getOrElse(DefaultCurrency),
language = c.languages.headOption.getOrElse(DefaultLanguage)
)
}
|
flowcommerce/location
|
api/app/controllers/CountryDefaults.scala
|
Scala
|
mit
| 1,708
|
ccio-summer-school-beer
=======================
open source beer recipe for the beers made for the EHI CCIO summer school
For an optimum mash tun experience, why not build yourself a self-filtering mash tun with my Instructable at http://www.instructables.com/id/Simple-Self-filter-Mash-Tun-for-All-grain-Beer/
|
open-health-hub/ccio-summer-school-beer
|
README.md
|
Markdown
|
mit
| 314
|
require 'spec_helper.rb'
describe "Tasks Panel", :feature => :taskEdit, :helper => :taskEdit do
before(:all) {load_umple_and_switch_to_tasks_panel}
context "Simple task manipulations:" do
it "begins task creation and ends it" do
page.execute_script("document.querySelector('#buttonCreateTask').click()") if page.has_no_selector?("#taskArea", visible: true)
wait_for_loading
expect(page).to have_selector("#taskArea", visible: true)
find(:xpath, "//*[@id=\"buttonCancelTask\"]").click
expect(page).to have_no_selector("#taskArea", visible: true)
end
it "creates a task with an invalid name" do
load_umple_and_switch_to_tasks_panel
page.execute_script("document.querySelector('#buttonCreateTask').click()") if page.has_no_selector?("#taskArea", visible: true)
wait_for_loading
expect(page).to have_selector("#taskArea", visible: true)
find("#taskName").send_keys("///")
find("textarea#instructions").send_keys("lorem ipsum")
find(:xpath, "//*[@id=\"taskArea\"]/div[2]/a[1]").click
alert = page.driver.browser.switch_to.alert
text = alert.text
expect(text).to eq("Task Name can only contain letters(case insensitive), underscores, dots, and digits!")
alert.accept
end
end
context "Creates a new task with valid name" do
taskName=""
before(:all) {taskName= load_umple_and_switch_to_tasks_panel_and_creates_new_task
}
it "and changes instructions" do
find("textarea#instructions").native.clear
find("textarea#instructions").send_keys("some text")
#saves changes made to the instructions
find(:xpath, "//*[@id=\"taskArea\"]/div[2]/a[1]").click
sleep 1
#closes the task area
find(:xpath, "//*[@id=\"taskArea\"]/div[2]/a[4]").click
page.driver.browser.switch_to.alert.accept
end
it "and reloads the task" do
#loads the task
load_umple_and_switch_to_tasks_panel
find("#buttonLoadTask").click
wait_for_loading
find("#inputLoadTaskName").send_keys("#{taskName}")
find(:xpath, "//*[@id=\"buttonSubmitLoadTask\"]/a").click
wait_for_loading
#ensures the task area has appeared
expect(page).to have_selector("#taskArea", visible: true)
expect(find("#instructionsHTML p")["innerHTML"]).to eq("some text")
#hide instructions
find("#buttonHideInstructions").click
wait_for_loading
expect(find("#taskArea")).to have_no_selector("#instructionsHTML", visible: true)
#ReShow Instructions
find("#buttonReshowInstructions").native.click
wait_for_loading
expect(find("#instructionsHTML p")["innerHTML"]).to eq("some text")
input_model_text("class Student{}")
#Discard the task submission edits
find(:xpath, "//*[@id=\"taskArea\"]/div[2]/a[5]").click
alert = page.driver.browser.switch_to.alert
text = alert.text
expect(text).to eq("Are you sure to cancel this task response?")
alert.accept
expect(page).to have_no_selector("#taskArea", visible: true)
expect(evaluate_script("Page.getUmpleCode()")).to eq("//$?[End_of_model]$?")
end
end
end
|
umple/umple
|
umpleonline/testsuite/spec/tasks_panel_test_spec.rb
|
Ruby
|
mit
| 3,633
|
<?php
/**
* Message translations.
*
* This file is automatically generated by 'yiic message' command.
* It contains the localizable messages extracted from source code.
* You may modify this file by translating the extracted messages.
*
* Each array element represents the translation (value) of a message (key).
* If the value is empty, the message is considered as not translated.
* Messages that no longer need translation will have their translations
* enclosed between a pair of '@@' marks.
*
* Message string can be used with plural forms format. Check i18n section
* of the guide for details.
*
* NOTE, this file must be saved in UTF-8 encoding.
*/
return array (
'Do you want to handle this task?' => '',
'I do it!' => '',
);
|
thebighub/travaux
|
messages/nl/widgets_views_test.php
|
PHP
|
mit
| 776
|
# Migrating to v1.1.0
## General
- Kadabra has been bumped to `v0.3.1`. Minimum requirements are now Elixir
v1.4 / OTP 19.2
- Pushes are now synchronous by default for all services. For async
functionality, pass an `:on_response` callback as an option with `push/2`.
- `{:ok, notif}`/`{:error, reason, notif}` response tuples have been replaced
with a `:reponse` key on the notification.
## APNS
- `APNS.Config.config/1` has been renamed to `APNS.Config.new/1`
- `[%APNS.Notification{}, ...]` is now returned instead of
`%{ok: [...], error: [...]}` on synchronous APNS pushes.
- `:use_2197` config option has been replaced with `:port`. APNS servers still
only accept `443` and `2197`, but other ports may be useful for test servers.
* `:reconnect` is now false by default
- `push/3` removed in favor of `push/2` with options
## FCM
- `FCM.NotificationResponse` has been dropped in favor of returning
`FCM.Notification` structs with updated response keys. The old
`NotificationResponse` keys`:ok`, `:remove`,
`:update` and `:retry` can be similarly accessed on `Notification` with the
helper functions `success?/1`, `remove?/1`, `update?/1` and `retry?/1`.
- `push/3` removed in favor of `push/2` with options
## ADM
- `ADM.Config.config/1` has been renamed to `ADM.Config.new/1`
- `push/3` removed in favor of `push/2` with options
|
codedge-llc/pigeon
|
docs/Migrating to v1-1-0.md
|
Markdown
|
mit
| 1,355
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Una modelo nos enseña a saber si una mujer tiene implantes | La Red Semanario</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="keywords" content="sexy,senos,implantes" />
<meta name="description" content="Hay ciertas preguntas en la vida que merecen dedicarles un poco de nuestro tiempo para encontrar su respuesta. De vez en cuando nos cuestionamos cosas como: Cuál es nuestro propósito en la vida, si e">
<meta property="og:type" content="article">
<meta property="og:title" content="Una modelo nos enseña a saber si una mujer tiene implantes">
<meta property="og:url" content="https://laredsemanario.com/2016/05/Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes/index.html">
<meta property="og:site_name" content="La Red Semanario">
<meta property="og:description" content="Hay ciertas preguntas en la vida que merecen dedicarles un poco de nuestro tiempo para encontrar su respuesta. De vez en cuando nos cuestionamos cosas como: Cuál es nuestro propósito en la vida, si e">
<meta property="og:image" content="https://laredsemanario.com/images/implantes-senos-1.png">
<meta property="og:updated_time" content="2016-05-06T14:21:51.732Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Una modelo nos enseña a saber si una mujer tiene implantes">
<meta name="twitter:description" content="Hay ciertas preguntas en la vida que merecen dedicarles un poco de nuestro tiempo para encontrar su respuesta. De vez en cuando nos cuestionamos cosas como: Cuál es nuestro propósito en la vida, si e">
<meta name="twitter:image" content="https://laredsemanario.com/images/implantes-senos-1.png">
<meta name="twitter:creator" content="@3171117842">
<meta property="fb:app_id" content="956176474392711">
<link rel="icon" href="/favicon.ico" />
<link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/vendor/titillium-web/styles.css">
<link rel="stylesheet" href="/vendor/source-code-pro/styles.css">
<link rel="stylesheet" href="/css/style.css">
<script src="/vendor/jquery/2.0.3/jquery.min.js"></script>
<link rel="stylesheet" href="/vendor/fancybox/jquery.fancybox.css">
<link rel="stylesheet" href="/vendor/scrollLoading/style.css">
<script type="text/javascript">
(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-62238178-1', 'auto');
ga('send', 'pageview');
</script>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-4967243132865960",
enable_page_level_ads: true
});
</script>
</head>
<body>
<div id="wrap">
<header id="header">
<div id="header-outer" class="outer">
<div class="container">
<div class="container-inner">
<div id="header-title">
<h1 class="logo-wrap">
<a href="/" class="logo"></a>
</h1>
<div id="ads">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- header-lared -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4967243132865960"
data-ad-slot="2438400321"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
</div>
<div id="header-inner" class="nav-container">
<a id="main-nav-toggle" class="nav-icon fa fa-bars"></a>
<div class="nav-container-inner">
<ul id="main-nav">
<li class="main-nav-list-item" >
<a class="main-nav-list-link" href="/">Inicio</a>
</li>
</ul>
<nav id="sub-nav">
<div id="search-form-wrap">
<form class="search-form">
<input type="text" class="ins-search-input search-form-input" placeholder="Buscar" />
<button type="submit" class="search-form-submit"></button>
</form>
<div class="ins-search">
<div class="ins-search-mask"></div>
<div class="ins-search-container">
<div class="ins-input-wrapper">
<input type="text" class="ins-search-input" placeholder="Escribe algo..." />
<span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
</div>
<div class="ins-section-wrapper">
<div class="ins-section-container"></div>
</div>
</div>
</div>
<script>
(function (window) {
var INSIGHT_CONFIG = {
TRANSLATION: {
POSTS: 'Entradas',
PAGES: 'Pages',
CATEGORIES: 'Categorias',
TAGS: 'Etiquetas',
UNTITLED: '(Sin titulo)',
},
ROOT_URL: '/',
CONTENT_URL: '/content.json',
};
window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>
</div>
</nav>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="container">
<div class="main-body container-inner">
<div class="main-body-inner">
<section id="main">
<div class="main-body-header">
<h1 class="header">
<a class="page-title-link" href="/categories/Internacional/">Internacional</a>
</h1>
</div>
<div class="main-body-content">
<article id="post-Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes" class="article article-single article-type-post" itemscope itemprop="blogPost">
<header class="article-header" itemprop="headline">
<h1 class="article-title" itemprop="name">
Una modelo nos enseña a saber si una mujer tiene implantes
</h1>
</header>
<div class="article-subtitle" itemprop="description">
<a href="/2016/05/Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes/" class="article-date">
<time datetime="2016-05-06T14:12:21.000Z" itemprop="datePublished">2016-05-06</time>
</a>
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/implantes/">implantes</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/senos/">senos</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/sexy/">sexy</a></li></ul>
</div>
<div class="article-entry" itemprop="articleBody">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- articulos -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4967243132865960"
data-ad-slot="5586146720"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p><img src="/images/implantes-senos-1.png" alt=""></p>
<p>Hay ciertas preguntas en la vida que merecen dedicarles un poco de nuestro tiempo para encontrar su respuesta. De vez en cuando nos cuestionamos cosas como: Cuál es nuestro propósito en la vida, si encontraremos el amor o <strong>si la chica que acabamos de ver pasar por la calle tenía implantes de senos</strong>.</p>
<p><img src="/images/implantes-senos-3.gif" alt=""></p>
<p>Algunas veces es demasiado obvio cuando una chica se hace una cirugía para resaltar sus atributos, pero hay otras en las que el trabajo está tan bien hecho, que es casi imposible darnos cuenta a simple vista. Por eso, hoy <strong>una modelo nos va a enseñar un método práctico para responder a esa gran incógnita</strong>.</p>
<p><img src="/images/modelo-implantes-1.jpg" alt=""></p>
<p><strong>Wichooda Cheycom</strong>, originaria de Tailandia, es la chica que nos va a mostrar una técnica infalible para saber si una chica se operó el busto, con tan sólo la luz de un celular. En el video que mostraremos a continuación, podremos ver cómo es que <strong>unos implantes de silicona brillan en la oscuridad si encienden la luz de un teléfono</strong>.</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/n2iJwmEywC0" frameborder="0" allowfullscreen></iframe>
<p>Obviamente, el video se hizo totalmente viral en toda internet, y es que no todos los días nos damos cuenta de que los senos falsos tienen esa cualidad tan curiosa. Pero bueno, ahora que ya saben cómo detectar este tipo de cosas, <strong>usen este conocimiento con extrema precaución</strong>; más que nada por respeto a quienes han decidido hacerse alguna cirugía de aumento.</p>
<p><strong><em>Vía dailymail</em></strong></p>
<h6 itemprop="author" itemscope itemtype="https://schema.org/Person">
<span itemprop="name">La Red Semanario</span>
</h6>
<footer class="article-footer">
<a data-url="https://laredsemanario.com/2016/05/Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes/" data-id="cio2yy4st005e6nkn64nh9je4" class="article-share-link"><i class="fa fa-share"></i>Compartir</a>
<script>
(function ($) {
$('body').on('click', function() {
$('.article-share-box.on').removeClass('on');
}).on('click', '.article-share-link', function(e) {
e.stopPropagation();
var $this = $(this),
url = $this.attr('data-url'),
encodedUrl = encodeURIComponent(url),
id = 'article-share-box-' + $this.attr('data-id'),
offset = $this.offset(),
box;
if ($('#' + id).length) {
box = $('#' + id);
if (box.hasClass('on')){
box.removeClass('on');
return;
}
} else {
var html = [
'<div id="' + id + '" class="article-share-box">',
'<input class="article-share-input" value="' + url + '">',
'<div class="article-share-links">',
'<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
'<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
'<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="article-share-pinterest" target="_blank" title="Pinterest"></a>',
'<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="article-share-google" target="_blank" title="Google+"></a>',
'</div>',
'</div>'
].join('');
box = $(html);
$('body').append(box);
}
$('.article-share-box.on').hide();
box.css({
top: offset.top + 25,
left: offset.left
}).addClass('on');
}).on('click', '.article-share-box', function (e) {
e.stopPropagation();
}).on('click', '.article-share-box-input', function () {
$(this).select();
}).on('click', '.article-share-box-link', function (e) {
e.preventDefault();
e.stopPropagation();
window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
});
})(jQuery);
</script>
</footer>
</div>
</article>
<section id="comments">
<div id="disqus_thread">
<noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</section>
</div>
</section>
<aside id="sidebar">
<a class="sidebar-toggle" title="Expand Sidebar"><i class="toggle icon"></i></a>
<div class="sidebar-top">
<p>seguir:</p>
<ul class="social-links">
<li>
<a class="social-tooltip" title="twitter" href="https://twitter.com/RedSemanario" target="_blank">
<i class="icon fa fa-twitter"></i>
</a>
</li>
<li>
<a class="social-tooltip" title="facebook" href="https://www.facebook.com/laredsemanario" target="_blank">
<i class="icon fa fa-facebook"></i>
</a>
</li>
<li>
<a class="social-tooltip" title="google-plus" href="https://google.com/+Laredsemanariocom" target="_blank">
<i class="icon fa fa-google-plus"></i>
</a>
</li>
<li>
<a class="social-tooltip" title="youtube" href="https://www.youtube.com/channel/UCnaA5qW5xL0WHoABQQRRTSw" target="_blank">
<i class="icon fa fa-youtube"></i>
</a>
</li>
<li>
<a class="social-tooltip" title="rss" href="http://feeds.feedburner.com/laredsemanario/huQt" target="_blank">
<i class="icon fa fa-rss"></i>
</a>
</li>
</ul>
</div>
<nav id="article-nav">
<a href="/2016/05/PRI-quita-registro-a-sus-3-narcocandidatos/" id="article-nav-newer" class="article-nav-link-wrap">
<strong class="article-nav-caption">más nuevo</strong>
<p class="article-nav-title">
PRI quita registro a sus 3 “narcocandidatos”; Beltrones debe comparecer ante PGR: PRD
</p>
<i class="icon fa fa-chevron-right" id="icon-chevron-right"></i>
</a>
<a href="/2016/05/Emiten-orden-de-aprehension-contra-Gerardo-Ortiz-por-el-video-Fuiste-Mia/" id="article-nav-older" class="article-nav-link-wrap">
<strong class="article-nav-caption">antiguo</strong>
<p class="article-nav-title">Emiten orden de aprehensión contra Gerardo Ortiz por el video de Fuiste Mía</p>
<i class="icon fa fa-chevron-left" id="icon-chevron-left"></i>
</a>
</nav>
<div class="widgets-container">
<div class="widget-wrap">
<h3 class="widget-title">recientes</h3>
<div class="widget">
<ul id="recent-post" class="">
<li>
<div class="item-thumbnail">
<a href="/2016/05/Detienen-a-Leopoldo-Duarte-acusado-de-abuso-sexual-en-el-Colegio-Matatena/" class="thumbnail">
<span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462977034/pederasta_montesori_2_wunyo5.jpg)" alt="Detienen a Leopoldo Duarte, acusado de abuso sexual en el Colegio Matatena" class="thumbnail-image"></span>
</a>
</div>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Nacional/">Nacional</a></p>
<p class="item-title"><a href="/2016/05/Detienen-a-Leopoldo-Duarte-acusado-de-abuso-sexual-en-el-Colegio-Matatena/" class="title">Detienen a Leopoldo Duarte, acusado de abuso sexual en el Colegio Matatena</a></p>
<p class="item-date"><time datetime="2016-05-11T14:29:50.000Z" itemprop="datePublished">2016-05-11</time></p>
</div>
</li>
<li>
<div class="item-thumbnail">
<a href="/2016/05/Telescopio-espacial-Kepler-descubre-1284-nuevos-planetas-fuera-del-sistema-solar/" class="thumbnail">
<span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462976759/NASA-nuevos-planetas-e1462972761598_jyf4qz.jpg)" alt="Telescopio espacial Kepler descubre 1284 nuevos planetas fuera del sistema solar" class="thumbnail-image"></span>
</a>
</div>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Ciencia/">Ciencia</a></p>
<p class="item-title"><a href="/2016/05/Telescopio-espacial-Kepler-descubre-1284-nuevos-planetas-fuera-del-sistema-solar/" class="title">Telescopio espacial Kepler descubre 1284 nuevos planetas fuera del sistema solar</a></p>
<p class="item-date"><time datetime="2016-05-11T14:24:56.000Z" itemprop="datePublished">2016-05-11</time></p>
</div>
</li>
<li>
<div class="item-thumbnail">
<a href="/2016/05/Billy-Alvarez-dejaria-Cruz-Azul/" class="thumbnail">
<span style="background-image:url(https://res.cloudinary.com/pidmx/image/upload/v1462976365/billy-alvarez-cruz-azul_vz32jv.jpg)" alt="Billy Álvarez dejaría Cruz Azul" class="thumbnail-image"></span>
</a>
</div>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Deportes/">Deportes</a></p>
<p class="item-title"><a href="/2016/05/Billy-Alvarez-dejaria-Cruz-Azul/" class="title">Billy Álvarez dejaría Cruz Azul</a></p>
<p class="item-date"><time datetime="2016-05-11T14:14:24.000Z" itemprop="datePublished">2016-05-11</time></p>
</div>
</li>
<li>
<div class="item-thumbnail">
<a href="/2016/05/Por-ser-desproporcionadas-El-Bronco-cancelara-10-mil-becas-estudiantiles/" class="thumbnail">
<span style="background-image:url(/images/bronco-gobernador.jpg)" alt="Por ser desproporcionadas, El Bronco cancelará 10 mil becas estudiantiles" class="thumbnail-image"></span>
</a>
</div>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Politica/">Politica</a></p>
<p class="item-title"><a href="/2016/05/Por-ser-desproporcionadas-El-Bronco-cancelara-10-mil-becas-estudiantiles/" class="title">Por ser desproporcionadas, El Bronco cancelará 10 mil becas estudiantiles</a></p>
<p class="item-date"><time datetime="2016-05-11T14:08:06.000Z" itemprop="datePublished">2016-05-11</time></p>
</div>
</li>
<li>
<div class="item-thumbnail">
<a href="/2016/05/Los-11-mandamientos-de-la-Iglesia-de-Satan-son-mucho-mas-sensatos-de-lo-que-imaginarias/" class="thumbnail">
<span style="background-image:url(/images/934606971.jpg)" alt="Los 11 mandamientos de la Iglesia de Satán son mucho más sensatos de lo que imaginarías" class="thumbnail-image"></span>
</a>
</div>
<div class="item-inner">
<p class="item-category"><a class="article-category-link" href="/categories/Cultura/">Cultura</a></p>
<p class="item-title"><a href="/2016/05/Los-11-mandamientos-de-la-Iglesia-de-Satan-son-mucho-mas-sensatos-de-lo-que-imaginarias/" class="title">Los 11 mandamientos de la Iglesia de Satán son mucho más sensatos de lo que imaginarías</a></p>
<p class="item-date"><time datetime="2016-05-10T14:05:56.000Z" itemprop="datePublished">2016-05-10</time></p>
</div>
</li>
</ul>
</div>
</div>
</div>
</aside>
</div>
</div>
</div>
<footer id="footer">
<div class="container">
<div class="container-inner">
<a id="back-to-top" href="javascript:;"><i class="icon fa fa-angle-up"></i></a>
<div class="credit">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Primera página - 1 (www.laredsemanario.com) -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-4967243132865960"
data-ad-slot="4621813528"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>© 2014 - 2016 La Red Semanario</p>
</div>
</div>
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "WebSite",
"name" : "La Red Semanario",
"alternateName" : "La Red",
"url" : "https://www.laredsemanario.com"
}
</script>
</div>
</footer>
<script>
var disqus_shortname = 'laredsemanario';
var disqus_url = 'https://laredsemanario.com/2016/05/Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes/';
(function() {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<script src="/vendor/fancybox/jquery.fancybox.pack.js"></script>
<script src="/vendor/scrollLoading/jquery.scrollLoading.js"></script>
<script src="/vendor/scrollLoading/main.js"></script>
<!-- Custom Scripts -->
<script src="/js/main.js"></script>
</div>
</body>
</html>
|
reneisrael/reneisrael.github.io
|
2016/05/Una-modelo-nos-ensena-a-saber-si-una-mujer-tiene-implantes/index.html
|
HTML
|
mit
| 23,967
|
//
// WQTest1VC.h
// WQRoute
//
// Created by 青秀斌 on 17/1/21.
// Copyright © 2017年 woqugame. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WQTest1VC : BSViewController
@end
|
jayla25349/WQRoute
|
Example/WQRoute/UI/WQTest1VC.h
|
C
|
mit
| 202
|
<?php
namespace Skewd\Amqp\Connection;
use Icecave\Isolator\IsolatorTrait;
use InvalidArgumentException;
/**
* A connector for connecting to one AMQP server within a cluster.
*/
final class ClusterConnector implements Connector
{
/**
* Create a cluster connector.
*
* @param Connector $connector The initial connectors to add.
* @param Connector ...$connectors Additional connectors to add.
*
* @return ClusterConnector
*/
public static function create(Connector $connector, Connector ...$connectors)
{
return new self(func_get_args());
}
/**
* Connect to an AMQP server.
*
* The list of internal connectors is tried in random order until one
* successfully connects. If none of the attempts are successful, the
* exception from the last attempt is re-thrown.
*
* @return Connection The AMQP connection.
* @throws ConnectionException If the connection could not be established.
*/
public function connect()
{
$connectors = $this->connectors;
$this->isolator()->shuffle($connectors);
$exception = null;
foreach ($connectors as $connector) {
try {
return $connector->connect();
} catch (ConnectionException $e) {
$exception = $e;
}
}
throw $exception;
}
/**
* Please note that this code is not part of the public API. It may be
* changed or removed at any time without notice.
*
* @access private
*
* This constructor is public so that it may be used by auto-wiring
* dependency injection containers. If you are explicitly constructing an
* instance please use one of the static factory methods listed below.
*
* @see ClusterConnector::create()
*
* @param array<Connector> $connectors
*/
public function __construct(array $connectors)
{
if (!$connectors) {
throw new InvalidArgumentException(
'At least one connector must be provided.'
);
}
foreach ($connectors as $connector) {
if (!$connector instanceof Connector) {
throw new InvalidArgumentException(
'Connectors must be instances of ' . Connector::class . '.'
);
}
}
$this->connectors = $connectors;
}
use IsolatorTrait;
private $connectors;
}
|
koden-km/skewd
|
src/Amqp/Connection/ClusterConnector.php
|
PHP
|
mit
| 2,501
|
'use strict';
module.exports = {
db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://localhost/pw',
facebook: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
google: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
};
|
jollyburnz/pw-meanjs
|
config/env/production.js
|
JavaScript
|
mit
| 650
|
using System;
using System.Diagnostics;
using System.Dynamic;
using System.Threading;
using L4p.Common.DumpToLogs;
using L4p.Common.Helpers;
using L4p.Common.Wcf;
namespace L4p.Common.PubSub.client.Io
{
interface IAgentWriter : IHaveDump
{
string AgentUri { get; }
TimeSpan NonActiveSpan { get; }
void Publish(comm.PublishMsg msg);
void FilterTopicMsgs(comm.TopicFilterMsg msg);
void Heartbeat(comm.HeartbeatMsg msg);
void Close();
}
class AgentWriter
: WcfProxy<comm.IAgentAsyncWriter>, IAgentWriter
{
#region counters
class Counters
{
public int PublishMsgSent;
public int FilterTopicMsgSent;
public int HeartbeatMsgSent;
}
#endregion
#region members
private readonly Counters _counters;
private readonly string _agentUri;
private readonly int _sequentialId;
private readonly IMessangerEngine _messanger;
private readonly Stopwatch _tmFromLastMsg;
#endregion
#region construction
public static IAgentWriter New(int sequentialId, string agentUri, IMessangerEngine messanger)
{
return
new AgentWriter(sequentialId, agentUri, messanger);
}
private AgentWriter(int sequentialId, string agentUri, IMessangerEngine messanger)
: base(agentUri)
{
_counters = new Counters();
_agentUri = agentUri;
_sequentialId = sequentialId;
_messanger = messanger;
_tmFromLastMsg = Stopwatch.StartNew();
}
#endregion
#region private
private void start_io(comm.IoMsg msg, Action startIo)
{
try
{
startIo();
}
catch (Exception ex)
{
_messanger.IoFailed(this, msg, ex, "start_io");
}
}
private void end_io(comm.IoMsg msg, Action endIo)
{
try
{
endIo();
}
catch (Exception ex)
{
_messanger.IoFailed(this, msg, ex, "end_io");
}
}
private void make_io(comm.IoMsg msg,
Action<AsyncCallback> io, Action<IAsyncResult> onComplete)
{
Validate.NotNull(msg);
msg.AgentUri = _agentUri;
AsyncCallback cb = ar =>
end_io(msg, () => onComplete(ar));
start_io(msg, () => io(cb));
_tmFromLastMsg.Restart();
}
#endregion
#region interface
string IAgentWriter.AgentUri
{
get { return _agentUri; }
}
TimeSpan IAgentWriter.NonActiveSpan
{
get { return _tmFromLastMsg.Elapsed; }
}
void IAgentWriter.Publish(comm.PublishMsg msg)
{
Interlocked.Increment(ref _counters.PublishMsgSent);
make_io(msg,
cb => Channel.BeginPublish(msg, cb, null),
ar => Channel.EndPublish(ar));
}
void IAgentWriter.FilterTopicMsgs(comm.TopicFilterMsg msg)
{
Interlocked.Increment(ref _counters.FilterTopicMsgSent);
make_io(msg,
cb => Channel.BeginFilterTopicMsgs(msg, cb, null),
ar => Channel.EndFilterTopicMsgs(ar));
}
void IAgentWriter.Heartbeat(comm.HeartbeatMsg msg)
{
Interlocked.Increment(ref _counters.HeartbeatMsgSent);
make_io(msg,
cb => Channel.BeginHeartbeat(cb, null),
ar => Channel.EndHeartbeat(ar));
}
void IAgentWriter.Close()
{
IWcfProxy self = this;
self.Close();
}
ExpandoObject IHaveDump.Dump(dynamic root)
{
if (root == null)
root = new ExpandoObject();
root.SequentialId = _sequentialId;
root.AgentUri = _agentUri;
root.NonActiveSpan = _tmFromLastMsg.Elapsed;
root.Counters = _counters;
return root;
}
#endregion
}
}
|
Ubinary/L4p
|
L4p.Common/PubSub/client/Io/AgentWriter.cs
|
C#
|
mit
| 4,249
|
[data-control=chat]{top:0;bottom:0;}
[data-control=chat] > header{width:100%}
[data-control=chat] > article div > ul > li{list-style:none}
[data-control=chat] > article div[data-control=users]{position:fixed}
[data-control=chat] textarea{height:54px;resize:none}
[data-control=chat] footer{background-color:#d8d8d8;bottom:0;z-index:10;width:100%;padding-bottom:2em}
body{background-color:#d8d8d8}
section.landing-margin{padding-top:2em !important;padding-bottom:2em !important}
input#room-name{text-align:center}
div.create-room{margin-top:3em;margin-bottom:3em}
|
Josebaseba/HereAndNow
|
assets/css/hereandnow.css
|
CSS
|
mit
| 564
|
// Copyright 2006 The RE2 Authors. All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Format a regular expression structure as a string.
// Tested by parse_test.cc
#include "util/util.h"
#include BOSS_OPENALPR_U_re2__regexp_h //original-code:"re2/regexp.h"
#include BOSS_OPENALPR_U_re2__walker_M_inl_h //original-code:"re2/walker-inl.h"
namespace re2 {
enum {
PrecAtom,
PrecUnary,
PrecConcat,
PrecAlternate,
PrecEmpty,
PrecParen,
PrecToplevel,
};
// Helper function. See description below.
static void AppendCCRange(string* t, Rune lo, Rune hi);
// Walker to generate string in s_.
// The arg pointers are actually integers giving the
// context precedence.
// The child_args are always NULL.
class ToStringWalker : public Regexp::Walker<int> {
public:
explicit ToStringWalker(string* t) : t_(t) {}
virtual int PreVisit(Regexp* re, int parent_arg, bool* stop);
virtual int PostVisit(Regexp* re, int parent_arg, int pre_arg,
int* child_args, int nchild_args);
virtual int ShortVisit(Regexp* re, int parent_arg) {
return 0;
}
private:
string* t_; // The string the walker appends to.
DISALLOW_COPY_AND_ASSIGN(ToStringWalker);
};
string Regexp::ToString() {
string t;
ToStringWalker w(&t);
w.WalkExponential(this, PrecToplevel, 100000);
if (w.stopped_early())
t += " [truncated]";
return t;
}
#define ToString DontCallToString // Avoid accidental recursion.
// Visits re before children are processed.
// Appends ( if needed and passes new precedence to children.
int ToStringWalker::PreVisit(Regexp* re, int parent_arg, bool* stop) {
int prec = parent_arg;
int nprec = PrecAtom;
switch (re->op()) {
case kRegexpNoMatch:
case kRegexpEmptyMatch:
case kRegexpLiteral:
case kRegexpAnyChar:
case kRegexpAnyByte:
case kRegexpBeginLine:
case kRegexpEndLine:
case kRegexpBeginText:
case kRegexpEndText:
case kRegexpWordBoundary:
case kRegexpNoWordBoundary:
case kRegexpCharClass:
case kRegexpHaveMatch:
nprec = PrecAtom;
break;
case kRegexpConcat:
case kRegexpLiteralString:
if (prec < PrecConcat)
t_->append("(?:");
nprec = PrecConcat;
break;
case kRegexpAlternate:
if (prec < PrecAlternate)
t_->append("(?:");
nprec = PrecAlternate;
break;
case kRegexpCapture:
t_->append("(");
if (re->name()) {
t_->append("?P<");
t_->append(*re->name());
t_->append(">");
}
nprec = PrecParen;
break;
case kRegexpStar:
case kRegexpPlus:
case kRegexpQuest:
case kRegexpRepeat:
if (prec < PrecUnary)
t_->append("(?:");
// The subprecedence here is PrecAtom instead of PrecUnary
// because PCRE treats two unary ops in a row as a parse error.
nprec = PrecAtom;
break;
}
return nprec;
}
static void AppendLiteral(string *t, Rune r, bool foldcase) {
if (r != 0 && r < 0x80 && strchr("(){}[]*+?|.^$\\", r)) {
t->append(1, '\\');
t->append(1, r);
} else if (foldcase && 'a' <= r && r <= 'z') {
if ('a' <= r && r <= 'z')
r += 'A' - 'a';
t->append(1, '[');
t->append(1, r);
t->append(1, r + 'a' - 'A');
t->append(1, ']');
} else {
AppendCCRange(t, r, r);
}
}
// Visits re after children are processed.
// For childless regexps, all the work is done here.
// For regexps with children, append any unary suffixes or ).
int ToStringWalker::PostVisit(Regexp* re, int parent_arg, int pre_arg,
int* child_args, int nchild_args) {
int prec = parent_arg;
switch (re->op()) {
case kRegexpNoMatch:
// There's no simple symbol for "no match", but
// [^0-Runemax] excludes everything.
t_->append("[^\\x00-\\x{10ffff}]");
break;
case kRegexpEmptyMatch:
// Append (?:) to make empty string visible,
// unless this is already being parenthesized.
if (prec < PrecEmpty)
t_->append("(?:)");
break;
case kRegexpLiteral:
AppendLiteral(t_, re->rune(), re->parse_flags() & Regexp::FoldCase);
break;
case kRegexpLiteralString:
for (int i = 0; i < re->nrunes(); i++)
AppendLiteral(t_, re->runes()[i], re->parse_flags() & Regexp::FoldCase);
if (prec < PrecConcat)
t_->append(")");
break;
case kRegexpConcat:
if (prec < PrecConcat)
t_->append(")");
break;
case kRegexpAlternate:
// Clumsy but workable: the children all appended |
// at the end of their strings, so just remove the last one.
if ((*t_)[t_->size()-1] == '|')
t_->erase(t_->size()-1);
else
LOG(DFATAL) << "Bad final char: " << t_;
if (prec < PrecAlternate)
t_->append(")");
break;
case kRegexpStar:
t_->append("*");
if (re->parse_flags() & Regexp::NonGreedy)
t_->append("?");
if (prec < PrecUnary)
t_->append(")");
break;
case kRegexpPlus:
t_->append("+");
if (re->parse_flags() & Regexp::NonGreedy)
t_->append("?");
if (prec < PrecUnary)
t_->append(")");
break;
case kRegexpQuest:
t_->append("?");
if (re->parse_flags() & Regexp::NonGreedy)
t_->append("?");
if (prec < PrecUnary)
t_->append(")");
break;
case kRegexpRepeat:
if (re->max() == -1)
t_->append(StringPrintf("{%d,}", re->min()));
else if (re->min() == re->max())
t_->append(StringPrintf("{%d}", re->min()));
else
t_->append(StringPrintf("{%d,%d}", re->min(), re->max()));
if (re->parse_flags() & Regexp::NonGreedy)
t_->append("?");
if (prec < PrecUnary)
t_->append(")");
break;
case kRegexpAnyChar:
t_->append(".");
break;
case kRegexpAnyByte:
t_->append("\\C");
break;
case kRegexpBeginLine:
t_->append("^");
break;
case kRegexpEndLine:
t_->append("$");
break;
case kRegexpBeginText:
t_->append("(?-m:^)");
break;
case kRegexpEndText:
if (re->parse_flags() & Regexp::WasDollar)
t_->append("(?-m:$)");
else
t_->append("\\z");
break;
case kRegexpWordBoundary:
t_->append("\\b");
break;
case kRegexpNoWordBoundary:
t_->append("\\B");
break;
case kRegexpCharClass: {
if (re->cc()->size() == 0) {
t_->append("[^\\x00-\\x{10ffff}]");
break;
}
t_->append("[");
// Heuristic: show class as negated if it contains the
// non-character 0xFFFE.
CharClass* cc = re->cc();
if (cc->Contains(0xFFFE)) {
cc = cc->Negate();
t_->append("^");
}
for (CharClass::iterator i = cc->begin(); i != cc->end(); ++i)
AppendCCRange(t_, i->lo, i->hi);
if (cc != re->cc())
cc->Delete();
t_->append("]");
break;
}
case kRegexpCapture:
t_->append(")");
break;
case kRegexpHaveMatch:
// There's no syntax accepted by the parser to generate
// this node (it is generated by RE2::Set) so make something
// up that is readable but won't compile.
t_->append("(?HaveMatch:%d)", re->match_id());
break;
}
// If the parent is an alternation, append the | for it.
if (prec == PrecAlternate)
t_->append("|");
return 0;
}
// Appends a rune for use in a character class to the string t.
static void AppendCCChar(string* t, Rune r) {
if (0x20 <= r && r <= 0x7E) {
if (strchr("[]^-\\", r))
t->append("\\");
t->append(1, r);
return;
}
switch (r) {
default:
break;
case '\r':
t->append("\\r");
return;
case '\t':
t->append("\\t");
return;
case '\n':
t->append("\\n");
return;
case '\f':
t->append("\\f");
return;
}
if (r < 0x100) {
StringAppendF(t, "\\x%02x", static_cast<int>(r));
return;
}
StringAppendF(t, "\\x{%x}", static_cast<int>(r));
}
static void AppendCCRange(string* t, Rune lo, Rune hi) {
if (lo > hi)
return;
AppendCCChar(t, lo);
if (lo < hi) {
t->append("-");
AppendCCChar(t, hi);
}
}
} // namespace re2
|
koobonil/Boss2D
|
Boss2D/addon/openalpr-2.3.0_for_boss/src/openalpr/support/re2/tostring.cc
|
C++
|
mit
| 8,364
|
/* library based on jeelabs RTClib [original library at https://github.com/jcw/rtclib ] altered to support Microchip MCP7940M RTC, used in Arduino
based embedded environments. To use this library, add #include <MCP7940.h> to the top of your program.*/
class DateTime { //DateTime class constructs the variable to store RTC Date and Time, and is a direct copy from the original RTClib.
public:
DateTime(long t =0);
DateTime(uint16_t year, uint8_t month, uint8_t day, uint8_t hour=0, uint8_t min=0, uint8_t sec=0, uint8_t dow=1);
DateTime(const char* date, const char* time);
uint16_t year() const {return 2000+yOff;}
uint8_t month() const {return m;}
uint8_t day() const {return d;}
uint8_t hour() const {return hh;}
uint8_t minute() const {return mm;}
uint8_t second() const {return ss;}
uint8_t DayOfWeek() const {return dow;}
long get() const;
// protected:
uint8_t yOff, m, d, hh, mm, ss,dow;
};
class RTC_MCP7940{ //RTC functions, based off original library. Some functions are designed specifically for use in the
public: //3 Channel Data Logger.
static void begin(); //initialize Wire library
static void adjust(const DateTime& dt); //change date and time
static DateTime now(); //get current time and date from RTC registers
//static uint8_t isrunning(); //check to make sure clock is ticking
static void configure(uint8_t value); //configure alarm enables and MFP output
static bool isset(); //check whether clock has been set
static void setAlarm(DateTime value); //configure alarm settings register
static void clearAlarm(); //clear alarm settings register
//static uint8_t ordinalDate(uint8_t toDay, uint8_t toMonth); //convert date and month to ordinal (julian) date
//static unsigned long get(){return now().get();}
static uint8_t bcd2bin (uint8_t val) { return val - 6 * (val >> 4);} //bcd to bin conv (RTC to MCU)
static uint8_t bin2bcd (uint8_t val) { return val + 6 * (val / 10);} //bin to bcd conv (MCU to RTC)
};
|
sanu-openmaker/RTC_MCP7940
|
MCP7940.h
|
C
|
mit
| 2,183
|
<?php include('slice-slice/top.php'); ?>
<?php session_start(); ?>
<html>
<head><title>原料購買紀錄</title></head>
<body>
<br><br>
<p align = "center">
<?php
$con = mysql_connect("140.135.113.38","final","3fueeSMfZqmBcWFW");
mysql_query("SET NAMES 'UTF8'");
if (!$con) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rbq_123456", $con);
$result = mysql_query("select * from goods");
echo "<table border='1'>
<tr>
<th>原料</th>
<th>購買日期</th>
<th>購買人</th>
<th>向誰購買</th>
</tr>";
while($row = mysql_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['goodsnumber'] . "</td>";
echo "<td>" . $row['goodsname'] . "</td>";
echo "<td>" . $row['amount'] . "</td>";
echo "<td>" . $row['price'] . "</td>";
echo "<td>" . $row['purchase_price'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
</p>
<br>
<p align = "center">請輸入原料詳細資料</p>
<form action="50insert.php" method="post"><p align = "center">
<br>
原料名稱:<input type="text" name="mn">
<br><br>
購買價錢:<input type="int" name="pp">
<br><br>
購買日期:<input type="date" name="pt">
<br><br>
購買者:<input type="text" name="pb">
<br><br>
購買來源:<input type="text" name="pf">
<br><br>
<input type='submit' value='送出表單'><br></p>
</form>
<br><br>
</body>
</html>
|
loxoli/mis_ea_sys
|
pages/input_material.php
|
PHP
|
mit
| 1,956
|
/**
* @ngdoc module
* @name material.components.progressLinear
* @description Linear Progress module!
*/
angular.module('material.components.progressLinear', [
'material.core'
])
.directive('mdProgressLinear', MdProgressLinearDirective);
/**
* @ngdoc directive
* @name mdProgressLinear
* @module material.components.progressLinear
* @restrict E
*
* @description
* The linear progress directive is used to make loading content
* in your app as delightful and painless as possible by minimizing
* the amount of visual change a user sees before they can view
* and interact with content.
*
* Each operation should only be represented by one activity indicator
* For example: one refresh operation should not display both a
* refresh bar and an activity circle.
*
* For operations where the percentage of the operation completed
* can be determined, use a determinate indicator. They give users
* a quick sense of how long an operation will take.
*
* For operations where the user is asked to wait a moment while
* something finishes up, and it’s not necessary to expose what's
* happening behind the scenes and how long it will take, use an
* indeterminate indicator.
*
* @param {string} md-mode Select from one of four modes: determinate, indeterminate, buffer or query.
*
* Note: if the `md-mode` value is set as undefined or specified as 1 of the four (4) valid modes, then `indeterminate`
* will be auto-applied as the mode.
*
* Note: if not configured, the `md-mode="indeterminate"` will be auto injected as an attribute. If `value=""` is also specified, however,
* then `md-mode="determinate"` would be auto-injected instead.
* @param {number=} value In determinate and buffer modes, this number represents the percentage of the primary progress bar. Default: 0
* @param {number=} md-buffer-value In the buffer mode, this number represents the percentage of the secondary progress bar. Default: 0
* @param {boolean=} ng-disabled Determines whether to disable the progress element.
*
* @usage
* <hljs lang="html">
* <md-progress-linear md-mode="determinate" value="..."></md-progress-linear>
*
* <md-progress-linear md-mode="determinate" ng-value="..."></md-progress-linear>
*
* <md-progress-linear md-mode="indeterminate"></md-progress-linear>
*
* <md-progress-linear md-mode="buffer" value="..." md-buffer-value="..."></md-progress-linear>
*
* <md-progress-linear md-mode="query"></md-progress-linear>
* </hljs>
*/
function MdProgressLinearDirective($mdTheming, $mdUtil, $log) {
var MODE_DETERMINATE = "determinate";
var MODE_INDETERMINATE = "indeterminate";
var MODE_BUFFER = "buffer";
var MODE_QUERY = "query";
var DISABLED_CLASS = "_md-progress-linear-disabled";
return {
restrict: 'E',
template: '<div class="_md-container">' +
'<div class="_md-dashed"></div>' +
'<div class="_md-bar _md-bar1"></div>' +
'<div class="_md-bar _md-bar2"></div>' +
'</div>',
compile: compile
};
function compile(tElement, tAttrs, transclude) {
tElement.attr('aria-valuemin', 0);
tElement.attr('aria-valuemax', 100);
tElement.attr('role', 'progressbar');
return postLink;
}
function postLink(scope, element, attr) {
$mdTheming(element);
var lastMode;
var isDisabled = attr.hasOwnProperty('disabled');
var toVendorCSS = $mdUtil.dom.animator.toCss;
var bar1 = angular.element(element[0].querySelector('._md-bar1'));
var bar2 = angular.element(element[0].querySelector('._md-bar2'));
var container = angular.element(element[0].querySelector('._md-container'));
element
.attr('md-mode', mode())
.toggleClass(DISABLED_CLASS, isDisabled);
validateMode();
watchAttributes();
/**
* Watch the value, md-buffer-value, and md-mode attributes
*/
function watchAttributes() {
attr.$observe('value', function(value) {
var percentValue = clamp(value);
element.attr('aria-valuenow', percentValue);
if (mode() != MODE_QUERY) animateIndicator(bar2, percentValue);
});
attr.$observe('mdBufferValue', function(value) {
animateIndicator(bar1, clamp(value));
});
attr.$observe('disabled', function(value) {
if (value === true || value === false) {
isDisabled = !!value;
} else {
isDisabled = angular.isDefined(value);
}
element.toggleClass(DISABLED_CLASS, isDisabled);
container.toggleClass(lastMode, !isDisabled);
});
attr.$observe('mdMode', function(mode) {
if (lastMode) container.removeClass( lastMode );
switch( mode ) {
case MODE_QUERY:
case MODE_BUFFER:
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
container.addClass( lastMode = "_md-mode-" + mode );
break;
default:
container.addClass( lastMode = "_md-mode-" + MODE_INDETERMINATE );
break;
}
});
}
/**
* Auto-defaults the mode to either `determinate` or `indeterminate` mode; if not specified
*/
function validateMode() {
if ( angular.isUndefined(attr.mdMode) ) {
var hasValue = angular.isDefined(attr.value);
var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE;
var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element";
//$log.debug( $mdUtil.supplant(info, [mode]) );
element.attr("md-mode", mode);
attr.mdMode = mode;
}
}
/**
* Is the md-mode a valid option?
*/
function mode() {
var value = (attr.mdMode || "").trim();
if ( value ) {
switch(value) {
case MODE_DETERMINATE:
case MODE_INDETERMINATE:
case MODE_BUFFER:
case MODE_QUERY:
break;
default:
value = MODE_INDETERMINATE;
break;
}
}
return value;
}
/**
* Manually set CSS to animate the Determinate indicator based on the specified
* percentage value (0-100).
*/
function animateIndicator(target, value) {
if ( isDisabled || !mode() ) return;
var to = $mdUtil.supplant("translateX({0}%) scale({1},1)", [ (value-100)/2, value/100 ]);
var styles = toVendorCSS({ transform : to });
angular.element(target).css( styles );
}
}
/**
* Clamps the value to be between 0 and 100.
* @param {number} value The value to clamp.
* @returns {number}
*/
function clamp(value) {
return Math.max(0, Math.min(value || 0, 100));
}
}
|
HipsterZipster/material
|
src/components/progressLinear/progress-linear.js
|
JavaScript
|
mit
| 6,622
|
--------------------------------------------------------------------------------
-- Quanty input file generated using Crispy. If you use this file please cite
-- the following reference: http://dx.doi.org/10.5281/zenodo.1008184.
--
-- elements: 3d
-- symmetry: D4h
-- experiment: XAS
-- edge: L2,3 (2p)
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Set the verbosity of the calculation. For increased verbosity use the values
-- 0x00FF or 0xFFFF.
--------------------------------------------------------------------------------
Verbosity($Verbosity)
--------------------------------------------------------------------------------
-- Define the parameters of the calculation.
--------------------------------------------------------------------------------
Temperature = $Temperature -- Temperature (Kelvin).
NPsis = $NPsis -- Number of states to consider in the spectra calculation.
NPsisAuto = $NPsisAuto -- Determine the number of state automatically.
NConfigurations = $NConfigurations -- Number of configurations.
Emin = $XEmin -- Minimum value of the energy range (eV).
Emax = $XEmax -- Maximum value of the energy range (eV).
NPoints = $XNPoints -- Number of points of the spectra.
ZeroShift = $XZeroShift -- Shift that brings the edge or line energy to approximately zero (eV).
ExperimentalShift = $XExperimentalShift -- Experimental edge or line energy (eV).
Gaussian = $XGaussian -- Gaussian FWHM (eV).
Lorentzian = $XLorentzian -- Lorentzian FWHM (eV).
Gamma = $XGamma -- Lorentzian FWHM used in the spectra calculation (eV).
WaveVector = $XWaveVector -- Wave vector.
Ev = $XFirstPolarization -- Vertical polarization.
Eh = $XSecondPolarization -- Horizontal polarization.
SpectraToCalculate = $SpectraToCalculate -- Types of spectra to calculate.
DenseBorder = $DenseBorder -- Number of determinants where we switch from dense methods to sparse methods.
ShiftSpectra = $ShiftSpectra -- If enabled, shift the spectra in the experimental energy range.
Prefix = "$Prefix" -- File name prefix.
--------------------------------------------------------------------------------
-- Toggle the Hamiltonian terms.
--------------------------------------------------------------------------------
AtomicTerm = $AtomicTerm
CrystalFieldTerm = $CrystalFieldTerm
LmctLigandsHybridizationTerm = $LmctLigandsHybridizationTerm
MlctLigandsHybridizationTerm = $MlctLigandsHybridizationTerm
MagneticFieldTerm = $MagneticFieldTerm
ExchangeFieldTerm = $ExchangeFieldTerm
--------------------------------------------------------------------------------
-- Define the number of electrons, shells, etc.
--------------------------------------------------------------------------------
NBosons = 0
NFermions = 16
NElectrons_2p = 6
NElectrons_3d = $NElectrons_3d
IndexDn_2p = {0, 2, 4}
IndexUp_2p = {1, 3, 5}
IndexDn_3d = {6, 8, 10, 12, 14}
IndexUp_3d = {7, 9, 11, 13, 15}
if LmctLigandsHybridizationTerm then
NFermions = 26
NElectrons_L1 = 10
IndexDn_L1 = {16, 18, 20, 22, 24}
IndexUp_L1 = {17, 19, 21, 23, 25}
end
if MlctLigandsHybridizationTerm then
NFermions = 26
NElectrons_L2 = 0
IndexDn_L2 = {16, 18, 20, 22, 24}
IndexUp_L2 = {17, 19, 21, 23, 25}
end
if LmctLigandsHybridizationTerm and MlctLigandsHybridizationTerm then
return
end
--------------------------------------------------------------------------------
-- Initialize the Hamiltonians.
--------------------------------------------------------------------------------
H_i = 0
H_f = 0
--------------------------------------------------------------------------------
-- Define the atomic term.
--------------------------------------------------------------------------------
N_2p = NewOperator("Number", NFermions, IndexUp_2p, IndexUp_2p, {1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_2p, IndexDn_2p, {1, 1, 1})
N_3d = NewOperator("Number", NFermions, IndexUp_3d, IndexUp_3d, {1, 1, 1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_3d, IndexDn_3d, {1, 1, 1, 1, 1})
if AtomicTerm then
F0_3d_3d = NewOperator("U", NFermions, IndexUp_3d, IndexDn_3d, {1, 0, 0})
F2_3d_3d = NewOperator("U", NFermions, IndexUp_3d, IndexDn_3d, {0, 1, 0})
F4_3d_3d = NewOperator("U", NFermions, IndexUp_3d, IndexDn_3d, {0, 0, 1})
F0_2p_3d = NewOperator("U", NFermions, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {1, 0}, {0, 0})
F2_2p_3d = NewOperator("U", NFermions, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0, 1}, {0, 0})
G1_2p_3d = NewOperator("U", NFermions, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0, 0}, {1, 0})
G3_2p_3d = NewOperator("U", NFermions, IndexUp_2p, IndexDn_2p, IndexUp_3d, IndexDn_3d, {0, 0}, {0, 1})
U_3d_3d_i = $U(3d,3d)_i_value
F2_3d_3d_i = $F2(3d,3d)_i_value * $F2(3d,3d)_i_scaleFactor
F4_3d_3d_i = $F4(3d,3d)_i_value * $F4(3d,3d)_i_scaleFactor
F0_3d_3d_i = U_3d_3d_i + 2 / 63 * F2_3d_3d_i + 2 / 63 * F4_3d_3d_i
U_3d_3d_f = $U(3d,3d)_f_value
F2_3d_3d_f = $F2(3d,3d)_f_value * $F2(3d,3d)_f_scaleFactor
F4_3d_3d_f = $F4(3d,3d)_f_value * $F4(3d,3d)_f_scaleFactor
F0_3d_3d_f = U_3d_3d_f + 2 / 63 * F2_3d_3d_f + 2 / 63 * F4_3d_3d_f
U_2p_3d_f = $U(2p,3d)_f_value
F2_2p_3d_f = $F2(2p,3d)_f_value * $F2(2p,3d)_f_scaleFactor
G1_2p_3d_f = $G1(2p,3d)_f_value * $G1(2p,3d)_f_scaleFactor
G3_2p_3d_f = $G3(2p,3d)_f_value * $G3(2p,3d)_f_scaleFactor
F0_2p_3d_f = U_2p_3d_f + 1 / 15 * G1_2p_3d_f + 3 / 70 * G3_2p_3d_f
H_i = H_i + Chop(
F0_3d_3d_i * F0_3d_3d
+ F2_3d_3d_i * F2_3d_3d
+ F4_3d_3d_i * F4_3d_3d)
H_f = H_f + Chop(
F0_3d_3d_f * F0_3d_3d
+ F2_3d_3d_f * F2_3d_3d
+ F4_3d_3d_f * F4_3d_3d
+ F0_2p_3d_f * F0_2p_3d
+ F2_2p_3d_f * F2_2p_3d
+ G1_2p_3d_f * G1_2p_3d
+ G3_2p_3d_f * G3_2p_3d)
ldots_3d = NewOperator("ldots", NFermions, IndexUp_3d, IndexDn_3d)
ldots_2p = NewOperator("ldots", NFermions, IndexUp_2p, IndexDn_2p)
zeta_3d_i = $zeta(3d)_i_value * $zeta(3d)_i_scaleFactor
zeta_3d_f = $zeta(3d)_f_value * $zeta(3d)_f_scaleFactor
zeta_2p_f = $zeta(2p)_f_value * $zeta(2p)_f_scaleFactor
H_i = H_i + Chop(
zeta_3d_i * ldots_3d)
H_f = H_f + Chop(
zeta_3d_f * ldots_3d
+ zeta_2p_f * ldots_2p)
end
--------------------------------------------------------------------------------
-- Define the crystal field term.
--------------------------------------------------------------------------------
if CrystalFieldTerm then
-- PotentialExpandedOnClm("D4h", 2, {Ea1g, Eb1g, Eb2g, Eeg})
-- Dq_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, { 6, 6, -4, -4}))
-- Ds_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {-2, 2, 2, -1}))
-- Dt_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {-6, -1, -1, 4}))
Akm = {{4, 0, 21}, {4, -4, 1.5 * sqrt(70)}, {4, 4, 1.5 * sqrt(70)}}
Dq_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, Akm)
Akm = {{2, 0, -7}}
Ds_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, Akm)
Akm = {{4, 0, -21}}
Dt_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, Akm)
Dq_3d_i = $10Dq(3d)_i_value / 10.0
Ds_3d_i = $Ds(3d)_i_value
Dt_3d_i = $Dt(3d)_i_value
io.write("Diagonal values of the initial crystal field Hamiltonian:\n")
io.write("================\n")
io.write("Irrep. E\n")
io.write("================\n")
io.write(string.format("a1g %8.3f\n", 6 * Dq_3d_i - 2 * Ds_3d_i - 6 * Dt_3d_i ))
io.write(string.format("b1g %8.3f\n", 6 * Dq_3d_i + 2 * Ds_3d_i - Dt_3d_i ))
io.write(string.format("b2g %8.3f\n", -4 * Dq_3d_i + 2 * Ds_3d_i - Dt_3d_i ))
io.write(string.format("eg %8.3f\n", -4 * Dq_3d_i - Ds_3d_i + 4 * Dt_3d_i))
io.write("================\n")
io.write("\n")
Dq_3d_f = $10Dq(3d)_f_value / 10.0
Ds_3d_f = $Ds(3d)_f_value
Dt_3d_f = $Dt(3d)_f_value
H_i = H_i + Chop(
Dq_3d_i * Dq_3d
+ Ds_3d_i * Ds_3d
+ Dt_3d_i * Dt_3d)
H_f = H_f + Chop(
Dq_3d_f * Dq_3d
+ Ds_3d_f * Ds_3d
+ Dt_3d_f * Dt_3d)
end
--------------------------------------------------------------------------------
-- Define the 3d-ligands hybridization term (LMCT).
--------------------------------------------------------------------------------
if LmctLigandsHybridizationTerm then
N_L1 = NewOperator("Number", NFermions, IndexUp_L1, IndexUp_L1, {1, 1, 1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_L1, IndexDn_L1, {1, 1, 1, 1, 1})
Delta_3d_L1_i = $Delta(3d,L1)_i_value
E_3d_i = (10 * Delta_3d_L1_i - NElectrons_3d * (19 + NElectrons_3d) * U_3d_3d_i / 2) / (10 + NElectrons_3d)
E_L1_i = NElectrons_3d * ((1 + NElectrons_3d) * U_3d_3d_i / 2 - Delta_3d_L1_i) / (10 + NElectrons_3d)
Delta_3d_L1_f = $Delta(3d,L1)_f_value
E_3d_f = (10 * Delta_3d_L1_f - NElectrons_3d * (31 + NElectrons_3d) * U_3d_3d_f / 2 - 90 * U_2p_3d_f) / (16 + NElectrons_3d)
E_2p_f = (10 * Delta_3d_L1_f + (1 + NElectrons_3d) * (NElectrons_3d * U_3d_3d_f / 2 - (10 + NElectrons_3d) * U_2p_3d_f)) / (16 + NElectrons_3d)
E_L1_f = ((1 + NElectrons_3d) * (NElectrons_3d * U_3d_3d_f / 2 + 6 * U_2p_3d_f) - (6 + NElectrons_3d) * Delta_3d_L1_f) / (16 + NElectrons_3d)
H_i = H_i + Chop(
E_3d_i * N_3d
+ E_L1_i * N_L1)
H_f = H_f + Chop(
E_3d_f * N_3d
+ E_2p_f * N_2p
+ E_L1_f * N_L1)
Dq_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, { 6, 6, -4, -4}))
Ds_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {-2, 2, 2, -1}))
Dt_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {-6, -1, -1, 4}))
Va1g_3d_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {1, 0, 0, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {1, 0, 0, 0}))
Vb1g_3d_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 1, 0, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {0, 1, 0, 0}))
Vb2g_3d_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 0, 1, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {0, 0, 1, 0}))
Veg_3d_L1 = NewOperator("CF", NFermions, IndexUp_L1, IndexDn_L1, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 0, 0, 1}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L1, IndexDn_L1, PotentialExpandedOnClm("D4h", 2, {0, 0, 0, 1}))
Dq_L1_i = $10Dq(L1)_i_value / 10.0
Ds_L1_i = $Ds(L1)_i_value
Dt_L1_i = $Dt(L1)_i_value
Va1g_3d_L1_i = $Va1g(3d,L1)_i_value
Vb1g_3d_L1_i = $Vb1g(3d,L1)_i_value
Vb2g_3d_L1_i = $Vb2g(3d,L1)_i_value
Veg_3d_L1_i = $Veg(3d,L1)_i_value
Dq_L1_f = $10Dq(L1)_f_value / 10.0
Ds_L1_f = $Ds(L1)_f_value
Dt_L1_f = $Dt(L1)_f_value
Va1g_3d_L1_f = $Va1g(3d,L1)_f_value
Vb1g_3d_L1_f = $Vb1g(3d,L1)_f_value
Vb2g_3d_L1_f = $Vb2g(3d,L1)_f_value
Veg_3d_L1_f = $Veg(3d,L1)_f_value
H_i = H_i + Chop(
Dq_L1_i * Dq_L1
+ Ds_L1_i * Ds_L1
+ Dt_L1_i * Dt_L1
+ Va1g_3d_L1_i * Va1g_3d_L1
+ Vb1g_3d_L1_i * Vb1g_3d_L1
+ Vb2g_3d_L1_i * Vb2g_3d_L1
+ Veg_3d_L1_i * Veg_3d_L1)
H_f = H_f + Chop(
Dq_L1_f * Dq_L1
+ Ds_L1_f * Ds_L1
+ Dt_L1_f * Dt_L1
+ Va1g_3d_L1_f * Va1g_3d_L1
+ Vb1g_3d_L1_f * Vb1g_3d_L1
+ Vb2g_3d_L1_f * Vb2g_3d_L1
+ Veg_3d_L1_f * Veg_3d_L1)
end
--------------------------------------------------------------------------------
-- Define the 3d-ligands hybridization term (MLCT).
--------------------------------------------------------------------------------
if MlctLigandsHybridizationTerm then
N_L2 = NewOperator("Number", NFermions, IndexUp_L2, IndexUp_L2, {1, 1, 1, 1, 1})
+ NewOperator("Number", NFermions, IndexDn_L2, IndexDn_L2, {1, 1, 1, 1, 1})
Delta_3d_L2_i = $Delta(3d,L2)_i_value
E_3d_i = U_3d_3d_i * (-NElectrons_3d + 1) / 2
E_L2_i = Delta_3d_L2_i + U_3d_3d_i * NElectrons_3d / 2 - U_3d_3d_i / 2
Delta_3d_L2_f = $Delta(3d,L2)_f_value
E_3d_f = -(U_3d_3d_f * NElectrons_3d^2 + 11 * U_3d_3d_f * NElectrons_3d + 60 * U_2p_3d_f) / (2 * NElectrons_3d + 12)
E_2p_f = NElectrons_3d * (U_3d_3d_f * NElectrons_3d + U_3d_3d_f - 2 * U_2p_3d_f * NElectrons_3d - 2 * U_2p_3d_f) / (2 * (NElectrons_3d + 6))
E_L2_f = (2 * Delta_3d_L2_f * NElectrons_3d + 12 * Delta_3d_L2_f + U_3d_3d_f * NElectrons_3d^2 - U_3d_3d_f * NElectrons_3d - 12 * U_3d_3d_f + 12 * U_2p_3d_f * NElectrons_3d + 12 * U_2p_3d_f) / (2 * (NElectrons_3d + 6))
H_i = H_i + Chop(
E_3d_i * N_3d
+ E_L2_i * N_L2)
H_f = H_f + Chop(
E_3d_f * N_3d
+ E_2p_f * N_2p
+ E_L2_f * N_L2)
Dq_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, { 6, 6, -4, -4}))
Ds_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {-2, 2, 2, -1}))
Dt_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {-6, -1, -1, 4}))
Va1g_3d_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {1, 0, 0, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {1, 0, 0, 0}))
Vb1g_3d_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 1, 0, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {0, 1, 0, 0}))
Vb2g_3d_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 0, 1, 0}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {0, 0, 1, 0}))
Veg_3d_L2 = NewOperator("CF", NFermions, IndexUp_L2, IndexDn_L2, IndexUp_3d, IndexDn_3d, PotentialExpandedOnClm("D4h", 2, {0, 0, 0, 1}))
+ NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_L2, IndexDn_L2, PotentialExpandedOnClm("D4h", 2, {0, 0, 0, 1}))
Dq_L2_i = $10Dq(L2)_i_value / 10.0
Ds_L2_i = $Ds(L2)_i_value
Dt_L2_i = $Dt(L2)_i_value
Va1g_3d_L2_i = $Va1g(3d,L2)_i_value
Vb1g_3d_L2_i = $Vb1g(3d,L2)_i_value
Vb2g_3d_L2_i = $Vb2g(3d,L2)_i_value
Veg_3d_L2_i = $Veg(3d,L2)_i_value
Dq_L2_f = $10Dq(L2)_f_value / 10.0
Ds_L2_f = $Ds(L2)_f_value
Dt_L2_f = $Dt(L2)_f_value
Va1g_3d_L2_f = $Va1g(3d,L2)_f_value
Vb1g_3d_L2_f = $Vb1g(3d,L2)_f_value
Vb2g_3d_L2_f = $Vb2g(3d,L2)_f_value
Veg_3d_L2_f = $Veg(3d,L2)_f_value
H_i = H_i + Chop(
Dq_L2_i * Dq_L2
+ Ds_L2_i * Ds_L2
+ Dt_L2_i * Dt_L2
+ Va1g_3d_L2_i * Va1g_3d_L2
+ Vb1g_3d_L2_i * Vb1g_3d_L2
+ Vb2g_3d_L2_i * Vb2g_3d_L2
+ Veg_3d_L2_i * Veg_3d_L2)
H_f = H_f + Chop(
Dq_L2_f * Dq_L2
+ Ds_L2_f * Ds_L2
+ Dt_L2_f * Dt_L2
+ Va1g_3d_L2_f * Va1g_3d_L2
+ Vb1g_3d_L2_f * Vb1g_3d_L2
+ Vb2g_3d_L2_f * Vb2g_3d_L2
+ Veg_3d_L2_f * Veg_3d_L2)
end
--------------------------------------------------------------------------------
-- Define the magnetic field and exchange field terms.
--------------------------------------------------------------------------------
Sx_3d = NewOperator("Sx", NFermions, IndexUp_3d, IndexDn_3d)
Sy_3d = NewOperator("Sy", NFermions, IndexUp_3d, IndexDn_3d)
Sz_3d = NewOperator("Sz", NFermions, IndexUp_3d, IndexDn_3d)
Ssqr_3d = NewOperator("Ssqr", NFermions, IndexUp_3d, IndexDn_3d)
Splus_3d = NewOperator("Splus", NFermions, IndexUp_3d, IndexDn_3d)
Smin_3d = NewOperator("Smin", NFermions, IndexUp_3d, IndexDn_3d)
Lx_3d = NewOperator("Lx", NFermions, IndexUp_3d, IndexDn_3d)
Ly_3d = NewOperator("Ly", NFermions, IndexUp_3d, IndexDn_3d)
Lz_3d = NewOperator("Lz", NFermions, IndexUp_3d, IndexDn_3d)
Lsqr_3d = NewOperator("Lsqr", NFermions, IndexUp_3d, IndexDn_3d)
Lplus_3d = NewOperator("Lplus", NFermions, IndexUp_3d, IndexDn_3d)
Lmin_3d = NewOperator("Lmin", NFermions, IndexUp_3d, IndexDn_3d)
Jx_3d = NewOperator("Jx", NFermions, IndexUp_3d, IndexDn_3d)
Jy_3d = NewOperator("Jy", NFermions, IndexUp_3d, IndexDn_3d)
Jz_3d = NewOperator("Jz", NFermions, IndexUp_3d, IndexDn_3d)
Jsqr_3d = NewOperator("Jsqr", NFermions, IndexUp_3d, IndexDn_3d)
Jplus_3d = NewOperator("Jplus", NFermions, IndexUp_3d, IndexDn_3d)
Jmin_3d = NewOperator("Jmin", NFermions, IndexUp_3d, IndexDn_3d)
Tx_3d = NewOperator("Tx", NFermions, IndexUp_3d, IndexDn_3d)
Ty_3d = NewOperator("Ty", NFermions, IndexUp_3d, IndexDn_3d)
Tz_3d = NewOperator("Tz", NFermions, IndexUp_3d, IndexDn_3d)
Sx = Sx_3d
Sy = Sy_3d
Sz = Sz_3d
Lx = Lx_3d
Ly = Ly_3d
Lz = Lz_3d
Jx = Jx_3d
Jy = Jy_3d
Jz = Jz_3d
Tx = Tx_3d
Ty = Ty_3d
Tz = Tz_3d
Ssqr = Sx * Sx + Sy * Sy + Sz * Sz
Lsqr = Lx * Lx + Ly * Ly + Lz * Lz
Jsqr = Jx * Jx + Jy * Jy + Jz * Jz
if MagneticFieldTerm then
-- The values are in eV, and not Tesla. To convert from Tesla to eV multiply
-- the value with EnergyUnits.Tesla.value.
Bx_i = $Bx_i_value
By_i = $By_i_value
Bz_i = $Bz_i_value
Bx_f = $Bx_f_value
By_f = $By_f_value
Bz_f = $Bz_f_value
H_i = H_i + Chop(
Bx_i * (2 * Sx + Lx)
+ By_i * (2 * Sy + Ly)
+ Bz_i * (2 * Sz + Lz))
H_f = H_f + Chop(
Bx_f * (2 * Sx + Lx)
+ By_f * (2 * Sy + Ly)
+ Bz_f * (2 * Sz + Lz))
end
if ExchangeFieldTerm then
Hx_i = $Hx_i_value
Hy_i = $Hy_i_value
Hz_i = $Hz_i_value
Hx_f = $Hx_f_value
Hy_f = $Hy_f_value
Hz_f = $Hz_f_value
H_i = H_i + Chop(
Hx_i * Sx
+ Hy_i * Sy
+ Hz_i * Sz)
H_f = H_f + Chop(
Hx_f * Sx
+ Hy_f * Sy
+ Hz_f * Sz)
end
--------------------------------------------------------------------------------
-- Define the restrictions and set the number of initial states.
--------------------------------------------------------------------------------
InitialRestrictions = {NFermions, NBosons, {"111111 0000000000", NElectrons_2p, NElectrons_2p},
{"000000 1111111111", NElectrons_3d, NElectrons_3d}}
FinalRestrictions = {NFermions, NBosons, {"111111 0000000000", NElectrons_2p - 1, NElectrons_2p - 1},
{"000000 1111111111", NElectrons_3d + 1, NElectrons_3d + 1}}
CalculationRestrictions = nil
if LmctLigandsHybridizationTerm then
InitialRestrictions = {NFermions, NBosons, {"111111 0000000000 0000000000", NElectrons_2p, NElectrons_2p},
{"000000 1111111111 0000000000", NElectrons_3d, NElectrons_3d},
{"000000 0000000000 1111111111", NElectrons_L1, NElectrons_L1}}
FinalRestrictions = {NFermions, NBosons, {"111111 0000000000 0000000000", NElectrons_2p - 1, NElectrons_2p - 1},
{"000000 1111111111 0000000000", NElectrons_3d + 1, NElectrons_3d + 1},
{"000000 0000000000 1111111111", NElectrons_L1, NElectrons_L1}}
CalculationRestrictions = {NFermions, NBosons, {"000000 0000000000 1111111111", NElectrons_L1 - (NConfigurations - 1), NElectrons_L1}}
end
if MlctLigandsHybridizationTerm then
InitialRestrictions = {NFermions, NBosons, {"111111 0000000000 0000000000", NElectrons_2p, NElectrons_2p},
{"000000 1111111111 0000000000", NElectrons_3d, NElectrons_3d},
{"000000 0000000000 1111111111", NElectrons_L2, NElectrons_L2}}
FinalRestrictions = {NFermions, NBosons, {"111111 0000000000 0000000000", NElectrons_2p - 1, NElectrons_2p - 1},
{"000000 1111111111 0000000000", NElectrons_3d + 1, NElectrons_3d + 1},
{"000000 0000000000 1111111111", NElectrons_L2, NElectrons_L2}}
CalculationRestrictions = {NFermions, NBosons, {"000000 0000000000 1111111111", NElectrons_L2, NElectrons_L2 + (NConfigurations - 1)}}
end
--------------------------------------------------------------------------------
-- Define some helper functions.
--------------------------------------------------------------------------------
function MatrixToOperator(Matrix, StartIndex)
-- Transform a matrix to an operator.
local Operator = 0
for i = 1, #Matrix do
for j = 1, #Matrix do
local Weight = Matrix[i][j]
Operator = Operator + NewOperator("Number", #Matrix + StartIndex, i + StartIndex - 1, j + StartIndex - 1) * Weight
end
end
Operator.Chop()
return Operator
end
function ValueInTable(Value, Table)
-- Check if a value is in a table.
for _, v in ipairs(Table) do
if Value == v then
return true
end
end
return false
end
function GetSpectrum(G, Ids, dZ, NOperators, NPsis)
-- Extract the spectrum corresponding to the operators identified using the
-- Ids argument. The returned spectrum is a weighted sum, where the weights
-- are the Boltzmann probabilities.
--
-- @param G userdata: Spectrum object as returned by the functions defined in Quanty, i.e. one spectrum
-- for each operator and each wavefunction.
-- @param Ids table: Indexes of the operators that are considered in the returned spectrum.
-- @param dZ table: Boltzmann prefactors for each of the spectrum in the spectra object.
-- @param NOperators number: Number of transition operators.
-- @param NPsis number: Number of wavefunctions.
if not (type(Ids) == "table") then
Ids = {Ids}
end
local Id = 1
local dZs = {}
for i = 1, NOperators do
for _ = 1, NPsis do
if ValueInTable(i, Ids) then
table.insert(dZs, dZ[Id])
else
table.insert(dZs, 0)
end
Id = Id + 1
end
end
return Spectra.Sum(G, dZs)
end
function SaveSpectrum(G, Filename, Gaussian, Lorentzian, Pcl)
if Pcl == nil then
Pcl = 1
end
G = -1 / math.pi / Pcl * G
G.Broaden(Gaussian, Lorentzian)
G.Print({{"file", Filename .. ".spec"}})
end
function CalculateT(Basis, Eps, K)
-- Calculate the transition operator in the basis of tesseral harmonics for
-- an arbitrary polarization and wave-vector (for quadrupole operators).
--
-- @param Basis table: Operators forming the basis.
-- @param Eps table: Cartesian components of the polarization vector.
-- @param K table: Cartesian components of the wave-vector.
if #Basis == 3 then
-- The basis for the dipolar operators must be in the order x, y, z.
T = Eps[1] * Basis[1]
+ Eps[2] * Basis[2]
+ Eps[3] * Basis[3]
elseif #Basis == 5 then
-- The basis for the quadrupolar operators must be in the order xy, xz, yz, x2y2, z2.
T = (Eps[1] * K[2] + Eps[2] * K[1]) / math.sqrt(3) * Basis[1]
+ (Eps[1] * K[3] + Eps[3] * K[1]) / math.sqrt(3) * Basis[2]
+ (Eps[2] * K[3] + Eps[3] * K[2]) / math.sqrt(3) * Basis[3]
+ (Eps[1] * K[1] - Eps[2] * K[2]) / math.sqrt(3) * Basis[4]
+ (Eps[3] * K[3]) * Basis[5]
end
return Chop(T)
end
function DotProduct(a, b)
return Chop(a[1] * b[1] + a[2] * b[2] + a[3] * b[3])
end
function WavefunctionsAndBoltzmannFactors(H, NPsis, NPsisAuto, Temperature, Threshold, StartRestrictions, CalculationRestrictions)
-- Calculate the wavefunctions and Boltzmann factors of a Hamiltonian.
--
-- @param H userdata: Hamiltonian for which to calculate the wavefunctions.
-- @param NPsis number: The number of wavefunctions.
-- @param NPsisAuto boolean: Determine automatically the number of wavefunctions that are populated at the specified
-- temperature and within the threshold.
-- @param Temperature number: The temperature in eV.
-- @param Threshold number: Threshold used to determine the number of wavefunction in the automatic procedure.
-- @param StartRestrictions table: Occupancy restrictions at the start of the calculation.
-- @param CalculationRestrictions table: Occupancy restrictions used during the calculation.
-- @return table: The calculated wavefunctions.
-- @return table: The calculated Boltzmann factors.
if Threshold == nil then
Threshold = 1e-8
end
local dZ = {}
local Z = 0
local Psis
if NPsisAuto == true and NPsis ~= 1 then
NPsis = 4
local NPsisIncrement = 8
local NPsisIsConverged = false
while not NPsisIsConverged do
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
if E_gs == nil then
E_gs = Psis[1] * H * Psis[1]
end
Z = 0
for i, Psi in ipairs(Psis) do
local E = Psi * H * Psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
if dZ[i] / Z < Threshold then
i = i - 1
NPsisIsConverged = true
NPsis = i
Psis = {unpack(Psis, 1, i)}
dZ = {unpack(dZ, 1, i)}
break
end
end
if NPsisIsConverged then
break
else
NPsis = NPsis + NPsisIncrement
end
end
else
if CalculationRestrictions == nil then
Psis = Eigensystem(H, StartRestrictions, NPsis)
else
Psis = Eigensystem(H, StartRestrictions, NPsis, {{"restrictions", CalculationRestrictions}})
end
if not (type(Psis) == "table") then
Psis = {Psis}
end
local E_gs = Psis[1] * H * Psis[1]
Z = 0
for i, psi in ipairs(Psis) do
local E = psi * H * psi
if math.abs(E - E_gs) < Threshold ^ 2 then
dZ[i] = 1
else
dZ[i] = math.exp(-(E - E_gs) / Temperature)
end
Z = Z + dZ[i]
end
end
-- Normalize the Boltzmann factors to unity.
for i in ipairs(dZ) do
dZ[i] = dZ[i] / Z
end
return Psis, dZ
end
function PrintHamiltonianAnalysis(Psis, Operators, dZ, Header, Footer)
io.write(Header)
for i, Psi in ipairs(Psis) do
io.write(string.format("%5d", i))
for j, Operator in ipairs(Operators) do
if j == 1 then
io.write(string.format("%12.6f", Complex.Re(Psi * Operator * Psi)))
elseif Operator == "dZ" then
io.write(string.format("%12.2e", dZ[i]))
else
io.write(string.format("%10.4f", Complex.Re(Psi * Operator * Psi)))
end
end
io.write("\n")
end
io.write(Footer)
end
function CalculateEnergyDifference(H1, H1Restrictions, H2, H2Restrictions)
-- Calculate the energy difference between the lowest eigenstates of the two
-- Hamiltonians.
--
-- @param H1 userdata: The first Hamiltonian.
-- @param H1Restrictions table: Restrictions of the occupation numbers for H1.
-- @param H2 userdata: The second Hamiltonian.
-- @param H2Restrictions table: Restrictions of the occupation numbers for H2.
local E1 = 0.0
local E2 = 0.0
if H1 ~= nil and H1Restrictions ~= nil then
Psis1, _ = WavefunctionsAndBoltzmannFactors(H1, 1, false, 0, nil, H1Restrictions, nil)
E1 = Psis1[1] * H1 * Psis1[1]
end
if H2 ~= nil and H2Restrictions ~= nil then
Psis2, _ = WavefunctionsAndBoltzmannFactors(H2, 1, false, 0, nil, H2Restrictions, nil)
E2 = Psis2[1] * H2 * Psis2[1]
end
return E1 - E2
end
--------------------------------------------------------------------------------
-- Analyze the initial Hamiltonian.
--------------------------------------------------------------------------------
Temperature = Temperature * EnergyUnits.Kelvin.value
Sk = DotProduct(WaveVector, {Sx, Sy, Sz})
Lk = DotProduct(WaveVector, {Lx, Ly, Lz})
Jk = DotProduct(WaveVector, {Jx, Jy, Jz})
Tk = DotProduct(WaveVector, {Tx, Ty, Tz})
Operators = {H_i, Ssqr, Lsqr, Jsqr, Sk, Lk, Jk, Tk, ldots_3d, N_2p, N_3d, "dZ"}
Header = "Analysis of the %s Hamiltonian:\n"
Header = Header .. "=================================================================================================================================\n"
Header = Header .. "State E <S^2> <L^2> <J^2> <Sk> <Lk> <Jk> <Tk> <l.s> <N_2p> <N_3d> dZ\n"
Header = Header .. "=================================================================================================================================\n"
Footer = "=================================================================================================================================\n"
if LmctLigandsHybridizationTerm then
Operators = {H_i, Ssqr, Lsqr, Jsqr, Sk, Lk, Jk, Tk, ldots_3d, N_2p, N_3d, N_L1, "dZ"}
Header = "Analysis of the %s Hamiltonian:\n"
Header = Header .. "===========================================================================================================================================\n"
Header = Header .. "State E <S^2> <L^2> <J^2> <Sk> <Lk> <Jk> <Tk> <l.s> <N_2p> <N_3d> <N_L1> dZ\n"
Header = Header .. "===========================================================================================================================================\n"
Footer = "===========================================================================================================================================\n"
end
if MlctLigandsHybridizationTerm then
Operators = {H_i, Ssqr, Lsqr, Jsqr, Sk, Lk, Jk, Tk, ldots_3d, N_2p, N_3d, N_L2, "dZ"}
Header = "Analysis of the %s Hamiltonian:\n"
Header = Header .. "===========================================================================================================================================\n"
Header = Header .. "State E <S^2> <L^2> <J^2> <Sk> <Lk> <Jk> <Tk> <l.s> <N_2p> <N_3d> <N_L2> dZ\n"
Header = Header .. "===========================================================================================================================================\n"
Footer = "===========================================================================================================================================\n"
end
local Psis_i, dZ_i = WavefunctionsAndBoltzmannFactors(H_i, NPsis, NPsisAuto, Temperature, nil, InitialRestrictions, CalculationRestrictions)
PrintHamiltonianAnalysis(Psis_i, Operators, dZ_i, string.format(Header, "initial"), Footer)
-- Stop the calculation if no spectra need to be calculated.
if next(SpectraToCalculate) == nil then
return
end
--------------------------------------------------------------------------------
-- Calculate and save the spectra.
--------------------------------------------------------------------------------
local t = math.sqrt(1 / 2)
Tx_2p_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, {{1, -1, t}, {1, 1, -t}})
Ty_2p_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, {{1, -1, t * I}, {1, 1, t * I}})
Tz_2p_3d = NewOperator("CF", NFermions, IndexUp_3d, IndexDn_3d, IndexUp_2p, IndexDn_2p, {{1, 0, 1}})
Er = {t * (Eh[1] - I * Ev[1]),
t * (Eh[2] - I * Ev[2]),
t * (Eh[3] - I * Ev[3])}
El = {-t * (Eh[1] + I * Ev[1]),
-t * (Eh[2] + I * Ev[2]),
-t * (Eh[3] + I * Ev[3])}
local T = {Tx_2p_3d, Ty_2p_3d, Tz_2p_3d}
Tv_2p_3d = CalculateT(T, Ev)
Th_2p_3d = CalculateT(T, Eh)
Tr_2p_3d = CalculateT(T, Er)
Tl_2p_3d = CalculateT(T, El)
Tk_2p_3d = CalculateT(T, WaveVector)
-- Initialize a table with the available spectra and the required operators.
SpectraAndOperators = {
["Isotropic Absorption"] = {Tk_2p_3d, Tr_2p_3d, Tl_2p_3d},
["Absorption"] = {Tk_2p_3d,},
["Circular Dichroic"] = {Tr_2p_3d, Tl_2p_3d},
["Linear Dichroic"] = {Tv_2p_3d, Th_2p_3d},
}
-- Create an unordered set with the required operators.
local T_2p_3d = {}
for Spectrum, Operators in pairs(SpectraAndOperators) do
if ValueInTable(Spectrum, SpectraToCalculate) then
for _, Operator in pairs(Operators) do
T_2p_3d[Operator] = true
end
end
end
-- Give the operators table the form required by Quanty's functions.
local T = {}
for Operator, _ in pairs(T_2p_3d) do
table.insert(T, Operator)
end
T_2p_3d = T
if ShiftSpectra then
Emin = Emin - (ZeroShift + ExperimentalShift)
Emax = Emax - (ZeroShift + ExperimentalShift)
end
if CalculationRestrictions == nil then
G_2p_3d = CreateSpectra(H_f, T_2p_3d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"DenseBorder", DenseBorder}})
else
G_2p_3d = CreateSpectra(H_f, T_2p_3d, Psis_i, {{"Emin", Emin}, {"Emax", Emax}, {"NE", NPoints}, {"Gamma", Gamma}, {"Restrictions", CalculationRestrictions}, {"DenseBorder", DenseBorder}})
end
if ShiftSpectra then
G_2p_3d.Shift(ZeroShift + ExperimentalShift)
end
-- Create a list with the Boltzmann probabilities for a given operator and wavefunction.
local dZ_2p_3d = {}
for _ in ipairs(T_2p_3d) do
for j in ipairs(Psis_i) do
table.insert(dZ_2p_3d, dZ_i[j])
end
end
local Ids = {}
for k, v in pairs(T_2p_3d) do
Ids[v] = k
end
-- Subtract the broadening used in the spectra calculations from the Lorentzian table.
for i, _ in ipairs(Lorentzian) do
-- The FWHM is the second value in each pair.
Lorentzian[i][2] = Lorentzian[i][2] - Gamma
end
Pcl_2p_3d = 2
for Spectrum, Operators in pairs(SpectraAndOperators) do
if ValueInTable(Spectrum, SpectraToCalculate) then
-- Find the indices of the spectrum's operators in the table used during the
-- calculation (this is unsorted).
SpectrumIds = {}
for _, Operator in pairs(Operators) do
table.insert(SpectrumIds, Ids[Operator])
end
if Spectrum == "Isotropic Absorption" then
Giso = GetSpectrum(G_2p_3d, SpectrumIds, dZ_2p_3d, #T_2p_3d, #Psis_i)
Giso = Giso / 3
SaveSpectrum(Giso, Prefix .. "_iso", Gaussian, Lorentzian, Pcl_2p_3d)
end
if Spectrum == "Absorption" then
Gk = GetSpectrum(G_2p_3d, SpectrumIds, dZ_2p_3d, #T_2p_3d, #Psis_i)
SaveSpectrum(Gk, Prefix .. "_k", Gaussian, Lorentzian, Pcl_2p_3d)
end
if Spectrum == "Circular Dichroic" then
Gr = GetSpectrum(G_2p_3d, SpectrumIds[1], dZ_2p_3d, #T_2p_3d, #Psis_i)
Gl = GetSpectrum(G_2p_3d, SpectrumIds[2], dZ_2p_3d, #T_2p_3d, #Psis_i)
SaveSpectrum(Gr, Prefix .. "_r", Gaussian, Lorentzian, Pcl_2p_3d)
SaveSpectrum(Gl, Prefix .. "_l", Gaussian, Lorentzian, Pcl_2p_3d)
SaveSpectrum(Gr - Gl, Prefix .. "_cd", Gaussian, Lorentzian)
end
if Spectrum == "Linear Dichroic" then
Gv = GetSpectrum(G_2p_3d, SpectrumIds[1], dZ_2p_3d, #T_2p_3d, #Psis_i)
Gh = GetSpectrum(G_2p_3d, SpectrumIds[2], dZ_2p_3d, #T_2p_3d, #Psis_i)
SaveSpectrum(Gv, Prefix .. "_v", Gaussian, Lorentzian, Pcl_2p_3d)
SaveSpectrum(Gh, Prefix .. "_h", Gaussian, Lorentzian, Pcl_2p_3d)
SaveSpectrum(Gv - Gh, Prefix .. "_ld", Gaussian, Lorentzian)
end
end
end
|
mretegan/crispy
|
crispy/quanty/templates/3d_D4h_XAS_2p.lua
|
Lua
|
mit
| 36,930
|
//
// AccessRecordCell.h
// SkyNet
//
// Created by 魏乔森 on 2017/10/16.
// Copyright © 2017年 xrg. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "VillageApplyModel.h"
@interface AccessRecordCell : UITableViewCell
+ (instancetype)cellWithTableView:(UITableView *)tableView;
@property (nonatomic, strong)VillageApplyModel *model;
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *addressLabel;
@property (strong, nonatomic) IBOutlet UILabel *stateLabel;
@end
|
CQTWProgramme/cqtw
|
SkyNet/Class/Home/AccessControl/View/AccessRecordCell.h
|
C
|
mit
| 537
|
# learning-colloborating-using-github
Repository is created to learn collaboration in GitHub
|
sachi059/learning-colloborating-using-github
|
README.md
|
Markdown
|
mit
| 93
|
// ==UserScript==
// @include http://reference.bahai.org/en/t/*
// ==/UserScript==
/*globals WritingsMap, SpecialWritingsMap, MissingWritingsMap*/
var WritingsMap = {
// 'b/ESW': "Epistle to the Son of the Wolf",
'b/GDM': "Gems of Divine Mysteries", // "Gems of Divine Mysteries (Javáhiru’l-Asrár)"
'b/GWB': "Gleanings from the Writings of Bahá'u'lláh", // "Gleanings From the Writings of Bahá'u'lláh"
'b/HW': "Hidden Words", // "The Hidden Words of Bahá'u'lláh"
'b/KA': "Kitáb-i-Aqdas", // "The Kitáb-i-Aqdas"
'b/KI': "Kitáb-i-Íqán", // "The Kitáb-i-Íqán"
'b/PM': "Prayers and Meditations", // "Prayers and Meditations by Bahá'u'lláh"
'b/PB': "Proclamation of Bahá'u'lláh", // "Proclamation of Bahá’u’lláh"
'b/SVFV': "Seven Valleys and the Four Valleys", // "The Seven Valleys and the Four Valleys"
'b/SLH': "Summons of the Lord of Hosts", // "The Summons of the Lord of Hosts"
'b/TU': "Tabernacle of Unity", // "The Tabernacle of Unity"
// 'b/TB': "Tablets of Bahá’u’lláh Revealed After the Kitáb-i-Aqdas", // "Tablets of Bahá’u’lláh Revealed After the Kitáb-i-Aqdas"
'tb/SWB': "Selections from the Writings of the Báb", // "Selections From the Writings of the Báb"
'ab/ABL': "`Abdu'l-Bahá in London", // '': "‘Abdu’l-Bahá in London"
'c/BWF': "Bahá'í World Faith", // "Bahá’í World Faith—Selected Writings of Bahá’u’lláh and ‘Abdu’l-Bahá (‘Abdu’l-Bahá’s Section Only)"
// 'c/FWU': "Foundations of World Unity",
// 'ab/MF': "Memorials of the Faithful",
// 'ab/PT': "Paris Talks",
'ab/PUP': "Promulgation of Universal Peace", // "The Promulgation of Universal Peace"
'ab/SDC': "Secret of Divine Civilization", // "The Secret of Divine Civilization"
'ab/SAB': "Selections from the Writings of 'Abdu'l-Bahá", // "Selections from the Writings of ‘Abdu’l-Bahá"
// 'ab/SAQ': "Some Answered Questions",
// 'ab/TAF': "Tablet to August Forel",
'ab/TAB': "Tablets of 'Abdu'l-Bahá", // "Tablets of ‘Abdu’l-Bahá"
// 'ab/TDP': "Tablets of the Divine Plan",
'ab/TN': "Traveler's Narrative", // "A Traveler's Narrative"
'ab/WT': "Will and Testament of 'Abdu'l-Bahá", // "The Will and Testament of ‘Abdu’l-Bahá"
'se/ADJ': "Advent of Divine Justice", // "The Advent of Divine Justice"
'se/ARO': "Arohanui", // "Arohanui: Letters to New Zealand"
// 'se/BA': "Bahá'í Administration",
// 'se/CF': "Citadel of Faith",
// 'se/DND': "Dawn of a New Day",
// 'se/DG': "Directives from the Guardian",
// 'se/GPB': "God Passes By",
'se/HE': "High Endeavours", // "High Endeavours: Messages to Alaska"
// 'se/LANZ': "Letters from the Guardian to Australia and New Zealand",
'se/LDG1': "Light of Divine Guidance (vol1)", // "The Light of Divine Guidance (Volume I)"
'se/LDG2': "Light of Divine Guidance (vol2)", // "The Light of Divine Guidance (Volume II)"
// 'se/MA': "Messages to America",
'se/MC': "Messages to Canada",
'se/MBW': "Messages to the Bahá'í World", // "Messages to the Bahá'í World: 1950-1957"
'se/PDC': "Promised Day is Come", // "The Promised Day is Come"
'se/UD': "Unfolding Destiny",
'se/WOB': "World Order of Bahá'u'lláh", // "The World Order of Bahá'u'lláh"
'uhj/PWP': "Promise of World Peace", // "The Promise of World Peace"
// 'bic/COL': "Century of Light",
// 'bic/OCF': "One Common Faith",
'bic/PRH': "Prosperity of Humankind",
'bic/SB': "Bahá'u'lláh (statement)",
'c/BP': "Bahá'í Prayers", // "Bahá'í Prayers: A selection of prayers revealed by Bahá'u'lláh, the Báb, and ‘Abdu’l-Baha.",
'c/BE': "Bahá'í Education", // "Compilation on Bahá'í Education",
'c/CP': "Peace (compilation)", // "Compilation on Peace"
'c/SCH': "Scholarship (compilation)", // "Compilation on Scholarship"
'c/CW': "Women (compilation)", // "Compilation on Women"
'c/HC': "Huqúqu'lláh—The Right of God", // "Huqúqu’lláh—The Right of God"
// 'c/JWTA': "Japan Will Turn Ablaze!",
'je/BNE': "Bahá'u'lláh and the New Era",
'bwc/BK': "Bahíyyih Khánum (compilation)",
'nz/DB': "Dawn-Breakers" // , // "The Dawn Breakers"
},
// Indicates missing for Baha'u'llah, the Bab,
SpecialWritingsMap = {
Bahai9 : {},
Bahaipedia: {'b/GWB': 'Gleanings from the Writings of Bahá’u’lláh', 'ab/ABL': '‘Abdu’l-Bahá in London'},
Wikipedia: {'ab/WT': 'Will_and_Testament_of_`Abdu\'l-Bahá',
'se/BA': 'Bahá\'í_Administration_(book)', 'se/DND': 'Dawn of a New Day (book)',
'se/LDG1': 'Light of Divine Guidance', 'se/LDG2': 'Light of Divine Guidance',
'uhj/PWP': 'The Promise of World Peace',
'bwc/BK': 'Bahíyyih Khánum (book)',
'nz/DB': 'The Dawn-Breakers'
},
Bahaiworks: {'b/GWB': 'Gleanings from the Writings of Bahá’u’lláh', 'ab/ABL': '‘Abdu’l-Bahá in London',
'nz/DB': 'The Dawn-Breakers'
}
},
MissingWritingsMap = {
Bahai9: ['bic/SB'],
Bahaipedia: ['b/PM', 'b/PB', 'b/SVFV',
'ab/ABL', 'c/BWF', 'ab/MF', 'ab/TAB', 'ab/TN',
'se/ARO', 'se/CF', 'se/DND', 'se/DG', 'se/HE', 'se/LANZ', 'se/LDG1', 'se/LDG2', 'se/MA', 'se/MC', 'se/MBW', 'se/PDC', 'se/UD',
'uhj/PWP', 'bic/COL', 'bic/OCF', 'bic/PRH', 'bic/SB', 'c/BP', 'c/BE', 'c/CP', 'c/SCH', 'c/CW', 'c/HC', 'c/JWTA', 'bwc/BK'
],
Wikipedia: ['b/PM', 'b/PB', 'b/SVFV',
'ab/ABL', 'ab/MF', 'ab/PUP', 'ab/SAB', 'ab/TAF', 'ab/TAB', 'ab/TN',
'se/ARO', 'se/CF', 'se/DND', 'se/DG', 'se/HE', 'se/LANZ', 'se/LDG1', 'se/LDG2', 'se/MA', 'se/MC', 'se/MBW', 'se/UD',
'bic/COL', 'bic/OCF', 'bic/PRH', 'bic/SB', 'c/BP', 'c/BE', 'c/CP', 'c/SCH', 'c/CW', 'c/HC', 'c/JWTA', 'bwc/BK'
],
Bahaiworks: ['b/PB',
'ab/ABL', 'c/BWF', 'ab/MF', 'ab/PT', 'ab/MF', 'ab/SAB', 'ab/TAF', 'ab/TAB', 'ab/TDP', 'ab/TN', 'ab/WT',
'se/ARO', 'se/BA', 'se/CF', 'se/DND', 'se/DG', 'se/GPB', 'se/HE',
'se/LANZ', 'se/LDG1', 'se/LDG2', 'se/MA', 'se/MC', 'se/MBW', 'se/PDC', 'se/UD', 'se/WOB',
'uhj/PWP', 'bic/COL', 'bic/OCF', 'bic/PRH', 'bic/SB', 'c/BP', 'c/BE', 'c/CP', 'c/SCH', 'c/CW', 'c/HC', 'c/JWTA', 'je/BNE', 'bwc/BK'
]
};
|
brettz9/bahai-reference-library-wiki-overlay
|
opera/includes/Writings-map.js
|
JavaScript
|
mit
| 6,269
|
//
// ViewController.h
// CulveDisplay
//
// Created by 王源果 on 14/12/15.
// Copyright (c) 2014年 g4idrijs. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
g4idrijs/culve-display
|
CulveDisplay/ViewController.h
|
C
|
mit
| 221
|
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#pragma once
#include <algorithm>
#include <string>
#include <vector>
#include "db/dbformat.h"
#include "rocksdb/env.h"
#include "rocksdb/iterator.h"
#include "rocksdb/slice.h"
#include "util/mutexlock.h"
#include "util/random.h"
namespace rocksdb {
class SequentialFile;
class SequentialFileReader;
namespace test {
// Store in *dst a random string of length "len" and return a Slice that
// references the generated data.
extern Slice RandomString(Random* rnd, int len, std::string* dst);
extern std::string RandomHumanReadableString(Random* rnd, int len);
// Return a random key with the specified length that may contain interesting
// characters (e.g. \x00, \xff, etc.).
extern std::string RandomKey(Random* rnd, int len);
// Store in *dst a string of length "len" that will compress to
// "N*compressed_fraction" bytes and return a Slice that references
// the generated data.
extern Slice CompressibleString(Random* rnd, double compressed_fraction,
int len, std::string* dst);
// A wrapper that allows injection of errors.
class ErrorEnv : public EnvWrapper {
public:
bool writable_file_error_;
int num_writable_file_errors_;
ErrorEnv() : EnvWrapper(Env::Default()),
writable_file_error_(false),
num_writable_file_errors_(0) { }
virtual Status NewWritableFile(const std::string& fname,
unique_ptr<WritableFile>* result,
const EnvOptions& soptions) override {
result->reset();
if (writable_file_error_) {
++num_writable_file_errors_;
return Status::IOError(fname, "fake error");
}
return target()->NewWritableFile(fname, result, soptions);
}
};
// An internal comparator that just forward comparing results from the
// user comparator in it. Can be used to test entities that have no dependency
// on internal key structure but consumes InternalKeyComparator, like
// BlockBasedTable.
class PlainInternalKeyComparator : public InternalKeyComparator {
public:
explicit PlainInternalKeyComparator(const Comparator* c)
: InternalKeyComparator(c) {}
virtual ~PlainInternalKeyComparator() {}
virtual int Compare(const Slice& a, const Slice& b) const override {
return user_comparator()->Compare(a, b);
}
virtual void FindShortestSeparator(std::string* start,
const Slice& limit) const override {
user_comparator()->FindShortestSeparator(start, limit);
}
virtual void FindShortSuccessor(std::string* key) const override {
user_comparator()->FindShortSuccessor(key);
}
};
// A test comparator which compare two strings in this way:
// (1) first compare prefix of 8 bytes in alphabet order,
// (2) if two strings share the same prefix, sort the other part of the string
// in the reverse alphabet order.
// This helps simulate the case of compounded key of [entity][timestamp] and
// latest timestamp first.
class SimpleSuffixReverseComparator : public Comparator {
public:
SimpleSuffixReverseComparator() {}
virtual const char* Name() const override {
return "SimpleSuffixReverseComparator";
}
virtual int Compare(const Slice& a, const Slice& b) const override {
Slice prefix_a = Slice(a.data(), 8);
Slice prefix_b = Slice(b.data(), 8);
int prefix_comp = prefix_a.compare(prefix_b);
if (prefix_comp != 0) {
return prefix_comp;
} else {
Slice suffix_a = Slice(a.data() + 8, a.size() - 8);
Slice suffix_b = Slice(b.data() + 8, b.size() - 8);
return -(suffix_a.compare(suffix_b));
}
}
virtual void FindShortestSeparator(std::string* start,
const Slice& limit) const override {}
virtual void FindShortSuccessor(std::string* key) const override {}
};
// Returns a user key comparator that can be used for comparing two uint64_t
// slices. Instead of comparing slices byte-wise, it compares all the 8 bytes
// at once. Assumes same endian-ness is used though the database's lifetime.
// Symantics of comparison would differ from Bytewise comparator in little
// endian machines.
extern const Comparator* Uint64Comparator();
// Iterator over a vector of keys/values
class VectorIterator : public Iterator {
public:
explicit VectorIterator(const std::vector<std::string>& keys)
: keys_(keys), current_(keys.size()) {
std::sort(keys_.begin(), keys_.end());
values_.resize(keys.size());
}
VectorIterator(const std::vector<std::string>& keys,
const std::vector<std::string>& values)
: keys_(keys), values_(values), current_(keys.size()) {
assert(keys_.size() == values_.size());
}
virtual bool Valid() const override { return current_ < keys_.size(); }
virtual void SeekToFirst() override { current_ = 0; }
virtual void SeekToLast() override { current_ = keys_.size() - 1; }
virtual void Seek(const Slice& target) override {
current_ = std::lower_bound(keys_.begin(), keys_.end(), target.ToString()) -
keys_.begin();
}
virtual void Next() override { current_++; }
virtual void Prev() override { current_--; }
virtual Slice key() const override { return Slice(keys_[current_]); }
virtual Slice value() const override { return Slice(values_[current_]); }
virtual Status status() const override { return Status::OK(); }
private:
std::vector<std::string> keys_;
std::vector<std::string> values_;
size_t current_;
};
extern WritableFileWriter* GetWritableFileWriter(WritableFile* wf);
extern RandomAccessFileReader* GetRandomAccessFileReader(RandomAccessFile* raf);
extern SequentialFileReader* GetSequentialFileReader(SequentialFile* se);
class StringSink: public WritableFile {
public:
std::string contents_;
explicit StringSink(Slice* reader_contents = nullptr) :
WritableFile(),
contents_(""),
reader_contents_(reader_contents),
last_flush_(0) {
if (reader_contents_ != nullptr) {
*reader_contents_ = Slice(contents_.data(), 0);
}
}
const std::string& contents() const { return contents_; }
virtual Status Close() override { return Status::OK(); }
virtual Status Flush() override {
if (reader_contents_ != nullptr) {
assert(reader_contents_->size() <= last_flush_);
size_t offset = last_flush_ - reader_contents_->size();
*reader_contents_ = Slice(
contents_.data() + offset,
contents_.size() - offset);
last_flush_ = contents_.size();
}
return Status::OK();
}
virtual Status Sync() override { return Status::OK(); }
virtual Status Append(const Slice& slice) override {
contents_.append(slice.data(), slice.size());
return Status::OK();
}
void Drop(size_t bytes) {
if (reader_contents_ != nullptr) {
contents_.resize(contents_.size() - bytes);
*reader_contents_ = Slice(
reader_contents_->data(), reader_contents_->size() - bytes);
last_flush_ = contents_.size();
}
}
private:
Slice* reader_contents_;
size_t last_flush_;
};
class StringSource: public RandomAccessFile {
public:
explicit StringSource(const Slice& contents, uint64_t uniq_id = 0,
bool mmap = false)
: contents_(contents.data(), contents.size()),
uniq_id_(uniq_id),
mmap_(mmap) {}
virtual ~StringSource() { }
uint64_t Size() const { return contents_.size(); }
virtual Status Read(uint64_t offset, size_t n, Slice* result,
char* scratch) const override {
if (offset > contents_.size()) {
return Status::InvalidArgument("invalid Read offset");
}
if (offset + n > contents_.size()) {
n = contents_.size() - offset;
}
if (!mmap_) {
memcpy(scratch, &contents_[offset], n);
*result = Slice(scratch, n);
} else {
*result = Slice(&contents_[offset], n);
}
return Status::OK();
}
virtual size_t GetUniqueId(char* id, size_t max_size) const override {
if (max_size < 20) {
return 0;
}
char* rid = id;
rid = EncodeVarint64(rid, uniq_id_);
rid = EncodeVarint64(rid, 0);
return static_cast<size_t>(rid-id);
}
private:
std::string contents_;
uint64_t uniq_id_;
bool mmap_;
};
class NullLogger : public Logger {
public:
using Logger::Logv;
virtual void Logv(const char* format, va_list ap) override {}
virtual size_t GetLogFileSize() const override { return 0; }
};
// Corrupts key by changing the type
extern void CorruptKeyType(InternalKey* ikey);
class SleepingBackgroundTask {
public:
SleepingBackgroundTask()
: bg_cv_(&mutex_), should_sleep_(true), done_with_sleep_(false) {}
void DoSleep() {
MutexLock l(&mutex_);
while (should_sleep_) {
bg_cv_.Wait();
}
done_with_sleep_ = true;
bg_cv_.SignalAll();
}
void WakeUp() {
MutexLock l(&mutex_);
should_sleep_ = false;
bg_cv_.SignalAll();
}
void WaitUntilDone() {
MutexLock l(&mutex_);
while (!done_with_sleep_) {
bg_cv_.Wait();
}
}
bool WokenUp() {
MutexLock l(&mutex_);
return should_sleep_ == false;
}
void Reset() {
MutexLock l(&mutex_);
should_sleep_ = true;
done_with_sleep_ = false;
}
static void DoSleepTask(void* arg) {
reinterpret_cast<SleepingBackgroundTask*>(arg)->DoSleep();
}
private:
port::Mutex mutex_;
port::CondVar bg_cv_; // Signalled when background work finishes
bool should_sleep_;
bool done_with_sleep_;
};
} // namespace test
} // namespace rocksdb
|
guileen/ferrydb
|
extern/rocksdb/util/testutil.h
|
C
|
mit
| 10,017
|
/// <reference path="../typings/main.d.ts"/>
import {Request, Response} from "express";
var express = require('express');
var util = require('util');
var router = express.Router();
/* GET home page. */
router.get('/', function(req: Request, res: Response, next: Function) {
res.render('index', { title: 'Express' });
});
module.exports = router;
|
rafaelumlei/vscode_node_gulp_express_typescript_boilerplate
|
routes/index.ts
|
TypeScript
|
mit
| 349
|
import { CollectionHubFixture } from "Apps/__tests__/Fixtures/Collections"
import { useTracking } from "Artsy/Analytics/useTracking"
import { ArrowButton } from "Components/Carousel"
import { mount } from "enzyme"
import "jest-styled-components"
import React from "react"
import {
FeaturedCollectionEntity,
FeaturedCollectionsRails,
FeaturedImage,
StyledLink,
} from "../index"
jest.mock("Artsy/Analytics/useTracking")
jest.mock("found", () => ({
Link: ({ children, ...props }) => <div {...props}>{children}</div>,
RouterContext: jest.requireActual("found").RouterContext,
}))
describe("FeaturedCollectionsRails", () => {
let props
const trackEvent = jest.fn()
beforeEach(() => {
props = {
collectionGroup: CollectionHubFixture.linkedCollections[1],
}
;(useTracking as jest.Mock).mockImplementation(() => {
return {
trackEvent,
}
})
})
const memberData = () => {
return {
description:
"<p>From SpongeBob SquarePants to Snoopy, many beloved childhood cartoons have made an impact on the history of art.</p>",
price_guidance: 60,
slug: "art-inspired-by-cartoons",
thumbnail: "http://files.artsy.net/images/cartoons_thumbnail.png",
title: "Art Inspired by Cartoons",
}
}
it("Renders expected fields", () => {
const component = mount(<FeaturedCollectionsRails {...props} />)
expect(component.text()).toMatch("Featured Collections")
expect(component.text()).toMatch("Art Inspired by Cartoons")
expect(component.text()).toMatch("Street Art: Celebrity Portraits")
expect(component.text()).toMatch("Street Art: Superheroes and Villains")
})
describe("Tracking", () => {
it("Tracks arrow click", () => {
props.collectionGroup.members = [
memberData(),
memberData(),
memberData(),
memberData(),
memberData(),
]
const component = mount(<FeaturedCollectionsRails {...props} />)
component
.find(ArrowButton)
.at(1)
.simulate("click")
expect(trackEvent).toBeCalledWith({
action_type: "Click",
context_page: "Collection",
context_module: "FeaturedCollectionsRail",
context_page_owner_type: "Collection",
type: "Button",
subject: "clicked next button",
})
})
})
})
describe("FeaturedCollectionEntity", () => {
let props
const trackEvent = jest.fn()
const memberDataWithoutPriceGuidance = () => {
return {
description:
"<p>From SpongeBob SquarePants to Snoopy, many beloved childhood cartoons have made an impact on the history of art.</p>",
price_guidance: null,
slug: "art-inspired-by-cartoons",
thumbnail: "http://files.artsy.net/images/cartoons_thumbnail.png",
title: "Art Inspired by Cartoons",
}
}
beforeEach(() => {
props = {
collectionGroup: CollectionHubFixture.linkedCollections[1],
}
;(useTracking as jest.Mock).mockImplementation(() => {
return {
trackEvent,
}
})
})
it("Renders expected fields for FeaturedCollectionEntity", () => {
const component = mount(<FeaturedCollectionsRails {...props} />)
const firstEntity = component.find(FeaturedCollectionEntity).at(0)
expect(firstEntity.text()).toMatch("From SpongeBob SquarePants to Snoopy")
expect(firstEntity.text()).toMatch("From $60")
const featuredImage = component.find(FeaturedImage).at(0)
expect(featuredImage.getElement().props.src).toContain(
"cartoons_thumbnail.png&width=500&height=500&quality=80"
)
})
it("Does not renders price guidance for FeaturedCollectionEntity when it is null", () => {
props.collectionGroup.members = [memberDataWithoutPriceGuidance()]
const component = mount(<FeaturedCollectionsRails {...props} />)
const firstEntity = component.find(FeaturedCollectionEntity).at(0)
expect(firstEntity.text()).not.toContain("From $")
})
it("Tracks collection entity click", () => {
const { members } = props.collectionGroup
const component = mount(
<FeaturedCollectionEntity member={members[0]} itemNumber={0} />
)
component
.find(StyledLink)
.at(0)
.simulate("click")
expect(trackEvent).toBeCalledWith({
action_type: "Click",
context_page: "Collection",
context_module: "FeaturedCollectionsRail",
context_page_owner_type: "Collection",
type: "thumbnail",
destination_path: "undefined/collection/art-inspired-by-cartoons",
item_number: 0,
})
})
})
|
artsy/reaction-force
|
src/Apps/Collect/Routes/Collection/Components/CollectionsHubRails/FeaturedCollectionsRails/__tests__/FeaturedCollectionsRails.test.tsx
|
TypeScript
|
mit
| 4,582
|
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [{
"@type": "ListItem",
"position": 1,
"item": {
"@id": "{{ site.url }}",
"name": "Articles"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@id": "{{ page.url | absolute_url }}",
"name": "{{ page.title | strip_html }}"
}
}
]
}
</script>
|
NSHipster/nshipster.com
|
_includes/json-ld/breadcrumblist.html
|
HTML
|
mit
| 462
|
describe('ModeloConsultaDeTs', function() {
var ModeloConsultaDeTs;
beforeEach(module('ApiConsumator'))
beforeEach(inject(function($injector) {
ModeloConsultaDeTs = $injector.get('ModeloConsultaDeTs')
}))
describe('criação', function() {
it('deve ter as propriedades default preenchidas corretamente', function() {
var _m = new ModeloConsultaDeTs();
expect(_m.Ttype).toBe('')
expect(_m.Ttext).toBe('')
})
it('deve ter as propriedades default sobrescritas corretamente', function() {
var _objPassado = {
Ttype: '1',
Ttext: '999',
outraInfo: true
}
var _m = new ModeloConsultaDeTs(_objPassado);
expect(_m.Ttype).toBe(_objPassado.Ttype)
expect(_m.Ttext).toBe(_objPassado.Ttext)
expect(_m.outraInfo).toBe(_objPassado.outraInfo)
})
})
describe('typePreenchido', function() {
it('deve retornar false, porque a instância é vazia - sem type', function() {
var _m = new ModeloConsultaDeTs();
expect(_m.typePreenchido()).toBe(false)
})
it('deve retornar false, porque a instância é vazia - type é string vazia', function() {
var _m = new ModeloConsultaDeTs({Ttype: ''});
expect(_m.typePreenchido()).toBe(false)
})
it('deve retornar false, porque a instância é vazia - com type preenchido', function() {
var _m = new ModeloConsultaDeTs({Ttype: 'yo!'});
expect(_m.typePreenchido()).toBe(true)
})
})
describe('textPreenchido', function() {
it('deve retornar false, porque a instância é vazia - sem type', function() {
var _m = new ModeloConsultaDeTs();
expect(_m.textPreenchido()).toBe(false)
})
it('deve retornar false, porque a instância é vazia - type é string vazia', function() {
var _m = new ModeloConsultaDeTs({Ttext: ''});
expect(_m.textPreenchido()).toBe(false)
})
it('deve retornar false, porque a instância é vazia - com type preenchido', function() {
var _m = new ModeloConsultaDeTs({Ttext: 'yo!'});
expect(_m.textPreenchido()).toBe(true)
})
})
describe('estaValido', function() {
it('deve retornar false, porque o método typePreenchido recebeu false', function() {
var _m = new ModeloConsultaDeTs();
expect(_m.estaValido()).toBe(false)
})
it('deve retornar false, porque o método textPreenchido recebeu false', function() {
var _m = new ModeloConsultaDeTs();
expect(_m.estaValido()).toBe(false)
})
it('deve retornar true, pois ambos os métodos typePreenchido e textPreenchido retornaram true', function() {
var _m = new ModeloConsultaDeTs({Ttype: 'yo!', Ttext: 'yo2!'});
expect(_m.estaValido()).toBe(true)
})
})
})
|
Katreque/ApiConsumator
|
test/unit/models/treturner_model_test.js
|
JavaScript
|
mit
| 3,100
|
package com.ziroom.godeye.transfer.disruptor;
import com.lmax.disruptor.RingBuffer;
import com.lmax.disruptor.dsl.Disruptor;
import com.ziroom.godeye.entity.trace.Span;
import com.ziroom.godeye.transfer.Transfer;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicBoolean;
public class DisruptorTransfer implements Transfer {
private static final int DEFAULT_BUFFER_SIZE = 1024 * 1024;
private final AtomicBoolean ready = new AtomicBoolean(false);
private Disruptor<SpanEvent> disruptor;
private SpanEventProducer producer;
public DisruptorTransfer(final SpanEventHandler spanEventHandler) {
this(spanEventHandler, DEFAULT_BUFFER_SIZE);
}
public DisruptorTransfer(final SpanEventHandler spanEventHandler, final int buffSize) {
final ThreadFactory threadFactory = Executors.defaultThreadFactory();
final SpanEventFactory factory = new SpanEventFactory();
final int bufferSize = buffSize;// RingBuffer 大小,必须是 2 的 N 次方;
disruptor = new Disruptor<>(factory, bufferSize, threadFactory);
disruptor.handleEventsWith(spanEventHandler);// disruptor.handleEventsWith(new SpanEventHandler("http://localhost:9080/upload"));
disruptor.start();// Start the Disruptor, starts all threads running
final RingBuffer<SpanEvent> ringBuffer = disruptor.getRingBuffer();
producer = new SpanEventProducer(ringBuffer);
}
public boolean isReady() {
return ready.get();
}
public boolean isServiceReady(final String serviceName) {
return ready.get();
}
public void start() throws Exception {
// do nothing
}
public void cancel() {
disruptor.shutdown();
}
public void asyncSend(final Span span) {
producer.onData(span);
}
}
|
junzixiehui/godeye
|
godeye-client/src/main/java/com/ziroom/godeye/transfer/disruptor/DisruptorTransfer.java
|
Java
|
mit
| 1,796
|
public class HistoryBufferEntry {
public float v;
public boolean isInRange;
}
|
fi-content2-games-platform/FIcontent.Gaming.Enabler.UnusualDatabaseEventDetection
|
src/HistoryBufferEntry.java
|
Java
|
mit
| 80
|
var express = require('express');
var router = express.Router();
// use session auth to secure the angular app files
router.use('/', function (req, res, next) { // request will be intercepted
console.log("token is " + req.session.token)
if (req.path !== '/login' && !req.session.token) {
return res.redirect('/login?returnUrl=' + encodeURIComponent('/app' + req.path));
}
next();
});
// make JWT token available to angular app
router.get('/token', function (req, res) {
res.send(req.session.token);
});
// serve angular app files from the '/app' route
router.use('/', express.static('app'));
module.exports = router;
|
YifanTerryYang/MortgagePlatformWebserver
|
controllers/app.controller.js
|
JavaScript
|
mit
| 655
|
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
coffee: {
compile:{
files: {
'app/js/quote.js' : 'app/coffee/quote.coffee',
'app/js/util.js' : 'app/coffee/util.coffee',
}
}
},
<<<<<<< HEAD
=======
copy: {
main: {
expand: true,
cwd: 'bower_components/',
src: '**/*.js',
dest: 'app/js/vendor'
},
},
>>>>>>> ba20389... popup directive refined a lot.
watch: {
grunt: { files: ['Gruntfile.js'] },
coffee: {
files: 'app/coffee/**/*.coffee',
tasks: ['coffee'],
options: {
livereload: true,
}
},
markup: {
files: ['*.php', '**/*.php'],
options: {
livereload: true,
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-coffee');
<<<<<<< HEAD
=======
grunt.loadNpmTasks('grunt-contrib-copy');
>>>>>>> ba20389... popup directive refined a lot.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('build', ['coffee', 'copy']);
grunt.registerTask('default', ['watch']);
//grunt.registerTask('default', ['copy', 'uglify', 'concat', 'watch']);
}
|
marketingpartnersau/niaquote
|
Gruntfile.js
|
JavaScript
|
mit
| 1,165
|
/**
* @external {Project} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Project
*/
/**
* @external {Schema} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Schema
*/
/**
* @external {Column} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Column
*/
/**
* @external {Changes} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Changes
*/
/**
* @external {Change} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Change
*/
/**
* @external {DataInfo} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-DataInfo
*/
/**
* @external {Item} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-Item
*/
/**
* @external {ValidationResult} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ValidationResult
*/
/**
* @external {ProjectCreateChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ProjectCreateChange
*/
/**
* @external {ProjectTagChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ProjectTagChange
*/
/**
* @external {SchemaCreateChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-SchemaCreateChange
*/
/**
* @external {SchemaRemoveChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-SchemaRemoveChange
*/
/**
* @external {SchemaRenameChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-SchemaRenameChange
*/
/**
* @external {ColumnCreateChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ColumnCreateChange
*/
/**
* @external {ColumnRemoveChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ColumnRemoveChange
*/
/**
* @external {ColumnRenameChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ColumnRenameChange
*/
/**
* @external {ColumnTypechangeChange} https://doc.esdoc.org/github.com/schema-mapper/spec/typedef/index.html#static-typedef-ColumnTypechangeChange
*/
"use strict";
|
schema-mapper/validator
|
lib/typedefs.js
|
JavaScript
|
mit
| 2,366
|
## Overview
This repository contains my latest resume
## Credit
This project is based on [prat0318/json_resume](https://github.com/prat0318/json_resume)
##Installation
$ gem install json_resume
### Conversion
* Syntax
`json_resume convert --template templates/default_html.mustache --out=html_pdf Xuefeng_Zhu_Resume.json`
```
json_resume convert [--template=/path/to/custom/template]
[--out=html|html_pdf|tex|tex_pdf|md]
[--locale=es|en|pt]
[--theme=default|classic] <json_input>
<json_input> can be /path/to/json OR "{'json':'string'}" OR http://raw.json
```
* Default (HTML) version
```
$ json_resume convert prateek_cv.json
```
A directory `resume/` will be generated in cwd, which can be put hosted on /var/www or on github pages. ([Sample](http://prat0318.github.io/json_resume/html_version/resume_with_icons/))
* HTML\* version
`html` version without icons can be generated by giving `icons` as `false` : ([Sample](http://prat0318.github.io/json_resume/html_version/resume_without_icons/))
```
"settings": {
"icons" : false
},
```
* PDF version from HTML ([Sample](http://prat0318.github.io/json_resume/html_version/resume_with_icons/resume.pdf))
```
$ json_resume convert --out=html_pdf prateek_cv.json
```
* LaTeX version ([Sample](https://www.writelatex.com/read/ynhgbrnmtrbw))
```
$ json_resume convert --out=tex prateek_cv.json
```
LaTex also includes a ``classic`` theme. Usage: ``--theme=classic`` ([Sample](https://www.writelatex.com/read/xscbhfpxwkqh)).
* PDF version from LaTeX ([Sample](https://www.writelatex.com/read/ynhgbrnmtrbw))
```
$ json_resume convert --out=tex_pdf prateek_cv.json
```
* Markdown version ([Sample](https://gist.github.com/prat0318/9c6e36fdcfd6a854f1f9))
```
$ json_resume convert --out=md prateek_cv.json
```
|
Xuefeng-Zhu/My_Resume
|
README.md
|
Markdown
|
mit
| 1,895
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>RepoView: overbox-base-repo</title>
<link href="layout/repostyle.css" type="text/css" rel="stylesheet" />
<meta content="noindex,follow" name="robots" />
</head>
<body>
<div class="levbar">
<p class="pagetitle">applications/system</p>
<ul class="levbarlist">
<li>
<a href="applications.system.group.html" class="nlink" title="Back to package listing">« Back to group</a>
</li>
</ul>
</div>
<div class="main">
<p class="nav">Jump to letter: [
<span class="letterlist">
<a href="letter_c.group.html" class="nlink">C</a><a href="letter_e.group.html" class="nlink">E</a><a href="letter_j.group.html" class="nlink">J</a><a href="letter_r.group.html" class="nlink">R</a><a href="letter_v.group.html" class="nlink">V</a>
</span>]
</p>
<h2>vboxadditions-download - VirtualBox guest additions downloader and installer</h2>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<th>Website:</th>
<td><a href="http://www.virtualbox.org/">http://www.virtualbox.org/</a></td>
</tr>
<tr>
<th>License:</th>
<td>GPL2</td>
</tr>
<tr>
<th>Vendor:</th>
<td>Oracle</td>
</tr>
</table>
<dl>
<dt>Description:</dt>
<dd><pre>Downloads and installs the VirtualBox guest additions.
Installation is done in a first-boot-service.
So you can quickly update to the newest kernel in your kickstart file before
the guest additions are installed.
A shutdown is performed afterwards!</pre></dd>
</dl>
<h3>Packages</h3>
<table cellpadding="0" cellspacing="10" border="0">
<tr>
<td valign="top"><a href="../vboxadditions-download-4.1.0-1.noarch.rpm" class="inpage">vboxadditions-download-4.1.0-1.noarch</a>
[<span style="white-space: nowrap">2 KiB</span>]</td>
<td valign="top">
<strong>Changelog</strong>
by <span>https://github.com/AncientLeGrey - 4.1.0-1 (2011-08-07)</span>:
<pre style="margin: 0pt 0pt 5pt 5pt">- Update to version 4.1.0</pre>
</td>
</tr><tr>
<td valign="top"><a href="../vboxadditions-download-4.0.8-1.noarch.rpm" class="inpage">vboxadditions-download-4.0.8-1.noarch</a>
[<span style="white-space: nowrap">2 KiB</span>]</td>
<td valign="top">
<em>(no changelog entry)</em>
</td>
</tr>
</table>
<p class="footernote">
Listing created by
<a href="https://fedorahosted.org/repoview/" class="repoview">Repoview-0.6.5-1.el5</a>
</p>
</div>
</body>
</html>
|
AncientLeGrey/overbox-base-repo
|
noarch/repoview/vboxadditions-download.html
|
HTML
|
mit
| 2,973
|
#include "cnffilemodel.h"
using namespace Model;
CnfFileModel::CnfFileModel()
{
}
unsigned long long CnfFileModel::getNumVariables()
{
return numVariables;
}
void CnfFileModel::setNumVariables(unsigned long long numVariables)
{
this->numVariables = numVariables;
}
unsigned long long CnfFileModel::getNumClauses()
{
return numClauses;
}
void CnfFileModel::setNumClauses(unsigned long long numClauses)
{
this->numClauses = numClauses;
}
void CnfFileModel::debugOutput()
{
}
|
tasmanianfox/sat-cnf-converter
|
src/Model/cnffilemodel.cpp
|
C++
|
mit
| 529
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>aInstaller - updating...</title>
<link rel="stylesheet" type="text/css" href="./app/icons.less">
<link rel="stylesheet" href="./app/index.less">
</head>
<body>
<div id="loading">
<h4 class="title afont ashadow absolute-center">
updating ainstaller
</h4>
<div class="spinner absolute-center">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div>
</body>
</html>
|
ainstaller/aInstaller
|
app/update.html
|
HTML
|
mit
| 528
|
<!--
> Muaz Khan - github.com/muaz-khan
> MIT License - www.webrtc-experiment.com/licence
> Documentation - www.RTCMultiConnection.org
-->
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebRTC Remote Stream Forwarding ® Muaz Khan</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="author" type="text/html" href="https://plus.google.com/+MuazKhan">
<meta name="author" content="Muaz Khan">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="//cdn.webrtc-experiment.com/style.css">
<style>
audio,
video {
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
-webkit-transition: all 1s ease;
transition: all 1s ease;
vertical-align: top;
width: 40%;
}
input {
border: 1px solid #d9d9d9;
border-radius: 1px;
font-size: 2em;
margin: .2em;
width: 30%;
}
.setup {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
font-size: 102%;
height: 47px;
margin-left: -9px;
margin-top: 8px;
position: absolute;
}
p {
padding: 1em;
}
li {
border-bottom: 1px solid rgb(189, 189, 189);
border-left: 1px solid rgb(189, 189, 189);
padding: .5em;
}
</style>
<script>
document.createElement('article');
document.createElement('footer');
</script>
<script src="//cdn.webrtc-experiment.com/RTCMultiConnection.js">
</script>
<script src="//cdn.webrtc-experiment.com/firebase.js">
</script>
</head>
<body>
<article>
<header style="text-align: center;">
<h1>
<a href="https://www.webrtc-experiment.com/">WebRTC</a> <a href="https://github.com/muaz-khan/WebRTC-Experiment/issues/2#issuecomment-33593799">remote media stream forwarding</a> using <a href="http://www.rtcmulticonnection.org/docs/">RTCMultiConnection.js</a>
</h1>
<p>
<a href="https://www.webrtc-experiment.com/">HOME</a>
<span> © </span>
<a href="http://www.MuazKhan.com/" target="_blank">Muaz Khan</a> .
<a href="http://twitter.com/WebRTCWeb" target="_blank" title="Twitter profile for WebRTC Experiments">@WebRTCWeb</a> .
<a href="https://github.com/muaz-khan?tab=repositories" target="_blank" title="Github Profile">Github</a> .
<a href="https://github.com/muaz-khan/WebRTC-Experiment/issues?state=open" target="_blank">Latest issues</a> .
<a href="https://github.com/muaz-khan/WebRTC-Experiment/commits/master" target="_blank">What's New?</a>
</p>
</header>
<div class="github-stargazers"></div>
<blockquote class="inner" style="text-align: center;">
Chrome is <a href="https://code.google.com/p/webrtc/issues/detail?id=2192#c15">still not supporting</a> remote audio forwarding. It will forward only remote
<strong>video</strong> stream. There is another demo: <a href="https://github.com/muaz-khan/WebRTC-Scalable-Broadcast">WebRTC Scalable Broadcast</a> which can broadcast video/screen over unlimited users!
</blockquote>
<section class="experiment">
<div id="videos-container"></div>
<table>
<tr>
<td>
<button id="open-main-session">open main session</button>
</td>
<td>
<button id="forward-main-session" disabled>forward main session</button>
</td>
</tr>
<tr>
<td>
<button id="join-main-session">join main session</button>
</td>
<td>
<button id="join-forwarded-session">join forwarded session</button>
</td>
</tr>
</table>
<h2>How to use?</h2>
<ol>
<li>
Click "open main session" button from 1st computer.
</li>
<li>
Click "join main session" button from 2nd computer.
</li>
<li>
Click "forward main session" button from the same 2nd computer.
</li>
<li>
Click "join forwarded session" button from 3rd computer.
</li>
</ol>
<script>
// http://www.rtcmulticonnection.org/docs/constructor/
var mainConnection = new RTCMultiConnection();
// http://www.rtcmulticonnection.org/docs/session/
mainConnection.session = {
video: true
};
// http://www.rtcmulticonnection.org/docs/direction/
mainConnection.direction = 'one-way';
mainConnection.onNewSession = function(session) {
mainConnection.sdpConstraints.mandatory = {
OfferToReceiveVideo: true
};
mainConnection.join(session);
};
// http://www.rtcmulticonnection.org/docs/constructor/
var dummyConnection = new RTCMultiConnection('dummy-connection');
dummyConnection.onNewSession = function(session) {
dummyConnection.sdpConstraints.mandatory = {
OfferToReceiveVideo: true
};
dummyConnection.join(session);
};
// http://www.rtcmulticonnection.org/docs/direction/
dummyConnection.direction = 'one-way';
// http://www.rtcmulticonnection.org/docs/dontCaptureUserMedia/
dummyConnection.dontCaptureUserMedia = true;
var videosContainer = document.getElementById('videos-container');
// http://www.rtcmulticonnection.org/docs/onstream/
mainConnection.onstream = function(e) {
dummyConnection.attachStreams.push(e.stream);
videosContainer.appendChild(e.mediaElement);
document.querySelector('#forward-main-session').disabled = false;
};
// http://www.rtcmulticonnection.org/docs/onstream/
dummyConnection.onstream = function(e) {
document.querySelector('h1').innerHTML = 'Wow, got forwarded stream!';
videosContainer.appendChild(e.mediaElement);
};
document.querySelector('#join-main-session').onclick = function() {
this.disabled = true;
// http://www.rtcmulticonnection.org/docs/connect/
mainConnection.connect();
};
document.querySelector('#join-forwarded-session').onclick = function() {
this.disabled = true;
// http://www.rtcmulticonnection.org/docs/connect/
dummyConnection.connect();
};
document.querySelector('#open-main-session').onclick = function() {
this.disabled = true;
mainConnection.sdpConstraints.mandatory = {
OfferToReceiveVideo: false
};
// http://www.rtcmulticonnection.org/docs/open/
mainConnection.open();
};
document.querySelector('#forward-main-session').onclick = function() {
this.disabled = true;
dummyConnection.sdpConstraints.mandatory = {
OfferToReceiveVideo: false
};
// http://www.rtcmulticonnection.org/docs/open/
dummyConnection.open();
};
</script>
</section>
<section class="experiment">
<h2 class="header" id="feedback">Feedback</h2>
<div>
<textarea id="message" style="border: 1px solid rgb(189, 189, 189); height: 8em; margin: .2em; outline: none; resize: vertical; width: 98%;" placeholder="Have any message? Suggestions or something went wrong?"></textarea>
</div>
<button id="send-message" style="font-size: 1em;">Send Message</button>
<small style="margin-left: 1em;">Enter your email too; if you want "direct" reply!</small>
</section>
<section class="experiment own-widgets latest-commits">
<h2 class="header" id="updates" style="color: red; padding-bottom: .1em;"><a href="https://github.com/muaz-khan/WebRTC-Experiment/commits/master" target="_blank">Latest Updates</a>
</h2>
<div id="github-commits"></div>
</section>
</article>
<a href="https://github.com/muaz-khan/WebRTC-Experiment" class="fork-left"></a>
<footer>
<p>
<a href="https://www.webrtc-experiment.com/">WebRTC Experiments</a> © <a href="https://plus.google.com/+MuazKhan" rel="author" target="_blank">Muaz Khan</a>
<a href="mailto:muazkh@gmail.com" target="_blank">muazkh@gmail.com</a>
</p>
</footer>
<!-- commits.js is useless for you! -->
<script src="//cdn.webrtc-experiment.com/commits.js" async>
</script>
</body>
</html>
|
garyfeng/WebRTC-Experiment
|
RTCMultiConnection/demos/remote-stream-forwarding.html
|
HTML
|
mit
| 9,771
|
# Is there a Caps game?
## What's it all about?
Simple: you want to know if there's a Washington Capitals game, so you visit this app. It tells you.
## What a great idea!
Yup, I only wish it were mine. I took this idea wholesale from Mark Paschal and his [Is there a Giants game?](http://isthereagiantsga.me/)
## Tell us how to use the app, please
No problem. If you visit [the site](http://isthereacapsga.me/), you get an answer to the $64,000 question, "Is there a Caps game today?" If you want to know about other days, that's easy too. Visit `/tomorrow` to find out if there's a game tomorrow. (You can also check today more explicitly at `/today`).
If you want to get fancier, you can check whether there's a game on a specific day of the current week. Just enter visit `/dayname`. Note that this check always looks *forward*. So if it's Friday, and you check `/friday`, the app will check if there's a game *next* Friday.
Finally, you can get even fancier and see if there's a game on a specific date. Just enter the date you want to check in YYYYMMDD format. Example `/20110920`.
## I can haz API?
Yes, soon, I promise. It will be a simple JSON response, so it shouldn't take very long.
## License?
tl;dr MIT license. Do what you like with it.
See LICENSE for details.
## How do I complain or make a suggestion?
Post an [issue](https://github.com/telemachus/isthereacapsgame/issues). If you don't have a Github account and you're a geek, you should get one. If you're a Caps fan and not a geek, just let me know [on Twitter](https://twitter.com/#!/telemachus).
|
bruceadams/isthereacapsgame
|
README.md
|
Markdown
|
mit
| 1,584
|
# Install
gem install gem-init
# Usage
mkdir my_awesome_gem
cd my_awesome_gem
gem init my_awesome_gem
If the gem already exists on [rubygems.org](http://rubygems.org) it will stop and let you know. Use the ``-s`` option to skip the check.
|
mwhuss/gem-init
|
README.md
|
Markdown
|
mit
| 264
|
---
layout: default
---
<div class="container">
<div class="article">
<h2 class="article-title">{{ page.title }}</h2>
<div class="article-meta">{{ page.date | date: "%Y年%m月%d日" }}</div>
<div class="article-body">
{{ content }}
</div>
<div class="article-footer">
<a href="/archives/index.html">記事一覧へ</a>
</div>
</div>
</div>
|
pipboy3000/count0.org
|
src/_layouts/post.html
|
HTML
|
mit
| 382
|
#include "conversion.h"
using namespace uva;
QString uva::Conversion::getVerdictName(Submission::Verdict verdict)
{
typedef Submission::Verdict Verdict;
switch(verdict)
{
case Verdict::SUBMISSION_ERROR:
return "Submission Error";
case Verdict::CANNOT_BE_JUDGED:
return "Can not be judged";
case Verdict::COMPILE_ERROR:
return "Compile Error";
case Verdict::RESTRICTED_FUNCTION:
return "Restricted Function";
case Verdict::RUNTIME_ERROR:
return "Runtime Error";
case Verdict::OUTPUT_LIMIT:
return "Output Limit Exceeded";
case Verdict::TIME_LIMIT:
return "Time Limit Exceeded";
case Verdict::MEMORY_LIMIT:
return "Memory Limit Exceeded";
case Verdict::WRONG_ANSWER:
return "Wrong Answer";
case Verdict::PRESENTATION_ERROR:
return "Presentation Error";
case Verdict::ACCEPTED:
return "Accepted";
default:
return "-In Queue-";
}
}
QString uva::Conversion::getLanguageName(Submission::Language language)
{
typedef Submission::Language Language;
switch(language)
{
case Language::C:
return "Ansi C";
case Language::JAVA:
return "Java";
case Language::CPP:
return "C++";
case Language::PASCAL:
return "Pascal";
case Language::CPP11:
return "C++11";
default:
return "Other";
}
}
QString Conversion::getRuntime(int runtime)
{
double time = static_cast<double>(runtime) / 1000.0;
return QString::number(time, 'f', 3) + "sec";
}
QString Conversion::getMemory(qint64 memory)
{
int index = 0;
double mem = static_cast<double>(memory);
while(mem > 1024.0)
{
mem /= 1024.0;
index++;
}
QString val = QString::number(mem, 'f', 2);
switch(index)
{
case 0:
return val + "B";
case 1:
return val + "KB";
case 2:
return val + "MB";
case 3:
return val + "GB";
case 4:
return val + "TB";
default:
return val + "ARE YOU MAD!!!";
}
}
QString Conversion::getSubmissionTime(quint64 unixTime)
{
QDateTime unix = QDateTime::fromTime_t(unixTime);
QDateTime current = QDateTime::currentDateTime();
return getTimeSpan(current, unix) + " ago";
}
QString Conversion::getTimeSpan(QDateTime first, QDateTime second)
{
/*
This function returns string like "2 years 5 days" or "1 hour 2 mins" or "5 secs".
*/
QString out = "";
bool space = false;
qint64 daysTo = abs(first.daysTo(second));
qint64 secsTo = abs(first.secsTo(second));
if (daysTo >= 1)
{
qint64 year = (qint64)(daysTo / 365);
qint64 month = (qint64)((daysTo - year * 365) / 30);
qint64 day = (qint64)(daysTo - year * 365 - month * 30);
if (year > 0)
{
space = true;
out += QString::number(year);
if (year > 1) out += " years";
else out += " year";
}
if (month > 0)
{
if (space) out += " ";
space = true;
out += QString::number(month);
if (month > 1) out += " months";
else out += " month";
}
//add day when total day is less than 30
if (daysTo < 30)
{
if (day > 0)
{
if (space) out += " ";
space = true;
out += QString::number(day);
if (day > 1) out += " days";
else out += " day";
}
}
}
else //add hours and minutes when total day is less than 1
{
qint64 hour = (qint64)(secsTo / 3600);
qint64 minute = (qint64)((secsTo - hour * 3600) / 60);
if (hour > 0)
{
if (space) out += " ";
space = true;
out += QString::number(hour);
if (hour > 1) out += " hours";
else out += " hour";
}
if (minute > 0)
{
if (space) out += " ";
space = true;
out += QString::number(minute);
if (minute > 1) out += " mins";
else out += " min";
}
//add seconds when total secs is less than 60
if (secsTo < 60)
{
if (space) out += " ";
space = true;
out += QString::number(secsTo);
if (secsTo > 1) out += " secs";
else out += " sec";
}
}
return out;
}
|
jgcoded/UVA-Arena-Qt
|
src/commons/conversion.cpp
|
C++
|
mit
| 4,052
|
using System;
using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
namespace Xamarin.Forms.Portable3.Droid
{
[Activity(Label = "Xamarin.Forms.Portable3", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
}
}
|
takuya-takeuchi/Demo
|
Xamarin.Forms.Portable3/Xamarin.Forms.Portable3/Xamarin.Forms.Portable3.Droid/MainActivity.cs
|
C#
|
mit
| 686
|
#Unused
def fail():
for t in [TypeA, TypeB]:
x = TypeA()
run_test(x)
#OK by name
def OK1(seq):
for _ in seq:
do_something()
print("Hi")
#OK counting
def OK2(seq):
i = 3
for x in seq:
i += 1
return i
#OK check emptiness
def OK3(seq):
for thing in seq:
return "Not empty"
return "empty"
#OK iteration over range
def OK4(n):
r = range(n)
for i in r:
print("x")
#OK named as unused
def OK5(seq):
for unused_x in seq:
print("x")
#ODASA-3794
def OK6(seq):
for thing in seq:
if sum(1 for s in STATUSES
if thing <= s < thing + 100) >= quorum:
return True
#OK -- Implicitly using count
def OK7(seq):
for x in seq:
queue.add(None)
def OK8(seq):
for x in seq:
output.append("</item>")
#Likewise with parameters
def OK7(seq, queue):
for x in seq:
queue.add(None)
def OK8(seq, output):
for x in seq:
output.append("</item>")
#Not OK -- Use a constant, but also a variable
def fail2(sequence):
for x in sequence:
for y in sequence:
do_something(x+1)
def fail3(sequence):
for x in sequence:
do_something(x+1)
for y in sequence:
do_something(x+1)
def fail4(coll, sequence):
while coll:
x = coll.pop()
for s in sequence:
do_something(x+1)
#OK See ODASA-4153 and ODASA-4533
def fail5(t):
x, y = t
return x
class OK9(object):
cls_attr = 0
def __init__(self):
self.attr = self.cls_attr
__all__ = [ 'hello' ]
__all__.extend(foo())
maybe_defined_in_all = 17
#ODASA-5895
def rand_list():
return [ random.random() for i in range(100) ]
def kwargs_is_a_use(seq):
for arg in seq:
func(**arg)
#A deletion is a use, but this is almost certainly an error
def cleanup(sessions):
for sess in sessions:
# Original code had some comment about deleting sessions
del sess
# For SuspiciousUnusedLoopIterationVariable.ql
# ok
for x in list(range(100)):
print('hi')
# ok
for y in list(list(range(100))):
print('hi')
|
github/codeql
|
python/ql/test/query-tests/Variables/unused/test.py
|
Python
|
mit
| 2,148
|
{% extends "base.html" %}
{% load cms_tags %}
{% block title %}{{ block.super }}{% endblock %}
{% block main %}
<section>
{% placeholder "content" %}
</section>
{% endblock main %}
{% block bodyclasses %}{{ block.super }} full{% endblock %}
{% block sidebar %}
{% endblock %}
|
frinat/fribourg-natation.ch
|
frinat/frontend/templates/full.html
|
HTML
|
mit
| 284
|
module MapEditor3
class FrameTimer
attr_accessor :duration
attr_reader :reset
def initialize(t)
setup(t)
end
def setup(t)
@duration = t
reset
end
def done?
@time <= 0
end
def rate
@time / @duration.to_f
end
def rate_inv
1.0 - rate
end
def reset
@time = @duration
end
def update
if @time > 0
@time -= 1
end
end
end
end
|
Archeia/Kread-Ex-Scripts
|
IceDragon2000/lib/map_editor3/frame_timer.rb
|
Ruby
|
mit
| 455
|
from __future__ import division
import random
import matrix
from tile import Tile
class Island(object):
def __init__(self, width=300, height=300):
self.radius = None
self.shore_noise = None
self.rect_shore = None
self.shore_lines = None
self.peak = None
self.spokes = None
self.tiles = [[None] * width for _ in range(height)]
def cells_to_tiles(self, *cells):
"""
Apply a Cell(x, y, z) into an Island tile height.
"""
for x, y, z in cells:
self.tiles[x][y] = Tile(x, y, z)
def flood_fill(self, start=None):
"""
Sets all None tiles to Tile(x, y, -1) within the island shore.
"""
if self.peak:
center_x, center_y = self.peak.x, self.peak.y
elif start:
center_x, center_y = start.x, start.y
else:
raise ValueError('Must define peak or start cell for flood fill.')
print('Flood filling')
seen = set()
start = (center_x, center_y)
stack = [start]
while True:
adjacent = False # Has no adjacent unvisited pixels
for dx, dy in [(1, 0), (-1, 0), (0, 1), (0, -1)]: # Check 4 neighbours
x, y = start[0] + dx, start[1] + dy
if (x, y) in seen:
continue
else:
if self.tiles[x][y] is None:
adjacent = True
stack.append((x, y))
self.tiles[x][y] = Tile(x, y, -1) # Set height -1
seen.add((x, y))
if not adjacent:
stack.pop()
if not stack:
break
else:
start = stack[-1]
def normalize(self):
max_height = 1
for row in self.tiles:
for tile in row:
if tile is not None:
if tile.height > max_height:
max_height = tile.height
for row in self.tiles:
for tile in row:
if tile is not None:
if tile.height > 0: # Ignore negative tiles
tile.height = float(tile.height) / max_height
elif tile.height < 0:
tile.height = -1
def height_fill(self):
attempt = 0
last_empty_count = 0
while self.has_empty:
empties = self.empties()
empty_count = len(empties)
print('Island has {} empty tiles'.format(empty_count))
if empty_count == last_empty_count:
attempt += 1
last_empty_count = empty_count
if attempt > 10: break;
random.shuffle(empties)
while empties:
i, j = empties.pop()
tile = self.tiles[i][j]
if tile and tile.height == -1:
averages = []
for span in range(1, 5):
ring_total = 0
neighbour_count = 0
ring_avg = 0
for x, y in matrix.find_neighbours_2D(self.tiles, (i, j), span):
try:
value = self.tiles[x][y].height
# print('value: {}'.format(value))
except (IndexError, AttributeError):
continue
if value in [-1,]:
continue
ring_total += value
neighbour_count += 1
if ring_total:
ring_avg = ring_total/neighbour_count
# averages.append(ring_avg * 9 / span ** 0.9) # Further away == less impact
averages.append(ring_avg) # Further away == less impact
if averages:
# print(averages)
overall = sum(averages)/len(averages)
# print('overall: {}'.format(overall))
tile.height = overall
@property
def has_empty(self):
return any(True if tile.height == -1 else False
for row in self.tiles for tile in row if tile is not None)
def empties(self):
empty_cells = []
for i in range(len(self.tiles)):
for j in range(len(self.tiles[0])):
if self.tiles[i][j] is not None and self.tiles[i][j].height == -1:
empty_cells.append((i, j))
return empty_cells
|
supermitch/Island-Gen
|
island.py
|
Python
|
mit
| 4,697
|
class Asset < ActiveRecord::Base
belongs_to :uploadable, :polymorphic => true
attr_accessible :attachment, :description, :uploadable_id, :uploadable_type, :uploadable
acts_as_list
def scope_condition
"assets.uploadable_id = #{uploadable_id} and assets.uploadable_type='#{uploadable_type}'"
end
def validate
unless attachment.errors.empty?
errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file."
false
end
end
end
|
kerglis/keg_engine
|
app/models/asset.rb
|
Ruby
|
mit
| 542
|
jQuery.sap.registerModulePath("oui5lib", "webapp");
var oui5lib = {};
oui5lib.namespace = function(string) {
var object = this;
var levels = string.split(".");
for (var i = 0, l = levels.length; i < l; i++) {
if (typeof object[levels[i]] === "undefined") {
object[levels[i]] = {};
}
object = object[levels[i]];
}
return object;
};
const xhr = new XMLHttpRequest();
xhr.open("GET", "oui5lib.json", false);
xhr.onload = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200 || xhr.status === 0) {
try {
const configData = JSON.parse(xhr.responseText);
oui5lib.config = configData;
} catch (e) {
throw new Error("Not valid JSON");
}
}
}
};
xhr.send();
|
cahein/oui5lib
|
webapp/test/spec/helpers/setup.js
|
JavaScript
|
mit
| 826
|
'use strict';
moduloPrioridad.controller('PrioridadPListController', ['$scope', '$routeParams', '$location', 'serverService', 'prioridadService', '$uibModal',
function ($scope, $routeParams, $location, serverService, prioridadService, $uibModal) {
$scope.fields = prioridadService.getFields();
$scope.obtitle = prioridadService.getObTitle();
$scope.icon = prioridadService.getIcon();
$scope.ob = prioridadService.getTitle();
$scope.title = "Listado de " + $scope.obtitle;
$scope.op = "plist";
$scope.numpage = serverService.checkDefault(1, $routeParams.page);
$scope.rpp = serverService.checkDefault(10, $routeParams.rpp);
$scope.neighbourhood = serverService.getGlobalNeighbourhood();
$scope.order = "";
$scope.ordervalue = "";
$scope.filter = "id";
$scope.filteroperator = "like";
$scope.filtervalue = "";
$scope.filterParams = serverService.checkNull($routeParams.filter)
$scope.orderParams = serverService.checkNull($routeParams.order)
$scope.sfilterParams = serverService.checkNull($routeParams.sfilter)
$scope.filterExpression = serverService.getFilterExpression($routeParams.filter, $routeParams.sfilter);
$scope.status = null;
$scope.debugging = serverService.debugging();
$scope.url = $scope.ob + '/' + $scope.op;
function getDataFromServer() {
serverService.promise_getCount($scope.ob, $scope.filterExpression).then(function (response) {
if (response.status == 200) {
$scope.registers = response.data.message;
$scope.pages = serverService.calculatePages($scope.rpp, $scope.registers);
if ($scope.numpage > $scope.pages) {
$scope.numpage = $scope.pages;
}
return serverService.promise_getPage($scope.ob, $scope.rpp, $scope.numpage, $scope.filterExpression, $routeParams.order);
} else {
$scope.status = "Error en la recepción de datos del servidor1";
}
}).then(function (response) {
if (response.status == 200) {
$scope.page = response.data.message;
$scope.status = "";
} else {
$scope.status = "Error en la recepción de datos del servidor2";
}
}).catch(function (data) {
$scope.status = "Error en la recepción de datos del servidor3";
});
}
$scope.pop = function (id, foreignObjectName, foreignContollerName, foreignViewName) {
var modalInstance = $uibModal.open({
templateUrl: 'js/' + foreignObjectName + '/' + foreignViewName + '.html',
controller: foreignContollerName,
size: 'lg',
resolve: {
id: function () {
return id;
}
}
}).result.then(function (modalResult) {
if (modalResult) {
getDataFromServer();
}
});
};
getDataFromServer();
}]);
|
Samyfos/Facturacion-Samuel
|
public_html/js/prioridad/plist.js
|
JavaScript
|
mit
| 3,275
|
PYTHON=`which python3.3`
build: deps statics
statics: venv
venv/bin/python manage.py collectstatic --noinput
deps: venv
venv/bin/pip install -r requirements.txt
venv:
virtualenv venv --python ${PYTHON}
clean:
rm -rf venv
rm -rf public
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
|
oinopion/membr
|
Makefile
|
Makefile
|
mit
| 312
|
//
// WtDemoWebViewController.h
// WtCore_Example
//
// Created by wtfan on 2017/9/1.
// Copyright © 2017年 JaonFanwt. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WtDemoWebViewController : UIViewController
@property (nonatomic, assign) BOOL useThunder;
@end
|
JaonFanwt/WtCore
|
Example/WtCore/Classes/ViewControllers/WtDemoWebViewController.h
|
C
|
mit
| 282
|
#![allow(dead_code)]
//! A first person camera.
use input::{ Button, GenericEvent };
use vecmath::traits::{ Float, Radians };
use Camera;
bitflags!(pub struct Keys: u8 {
const MOVE_FORWARD = 0b00000001;
const MOVE_BACKWARD = 0b00000010;
const STRAFE_LEFT = 0b00000100;
const STRAFE_RIGHT = 0b00001000;
const FLY_UP = 0b00010000;
const FLY_DOWN = 0b00100000;
});
/// First person camera settings.
pub struct FirstPersonSettings<T=f32> {
/// Which button to press to move forward.
pub move_forward_button: Button,
/// Which button to press to move backward.
pub move_backward_button: Button,
/// Which button to press to strafe left.
pub strafe_left_button: Button,
/// Which button to press to strafe right.
pub strafe_right_button: Button,
/// Which button to press to fly up.
pub fly_up_button: Button,
/// Which button to press to fly down.
pub fly_down_button: Button,
/// Which button to press to move faster.
pub move_faster_button: Button,
/// The horizontal movement speed.
///
/// This is measured in units per second.
pub speed_horizontal: T,
/// The vertical movement speed.
///
/// This is measured in units per second.
pub speed_vertical: T,
/// The horizontal mouse sensitivity.
///
/// This is a multiplier applied to horizontal mouse movements.
pub mouse_sensitivity_horizontal: T,
/// The vertical mouse sensitivity.
///
/// This is a multiplier applied to vertical mouse movements.
pub mouse_sensitivity_vertical: T,
}
impl<T> FirstPersonSettings<T>
where T: Float
{
/// Creates new first person camera settings with wasd defaults.
pub fn keyboard_wasd() -> FirstPersonSettings<T> {
use input::Button::Keyboard;
use input::Key;
FirstPersonSettings {
move_forward_button: Keyboard(Key::W),
move_backward_button: Keyboard(Key::S),
strafe_left_button: Keyboard(Key::A),
strafe_right_button: Keyboard(Key::D),
fly_up_button: Keyboard(Key::Space),
fly_down_button: Keyboard(Key::LShift),
move_faster_button: Keyboard(Key::LCtrl),
speed_horizontal: T::one(),
speed_vertical: T::one(),
mouse_sensitivity_horizontal: T::one(),
mouse_sensitivity_vertical: T::one(),
}
}
/// Creates a new first person camera settings with esdf defaults.
pub fn keyboard_esdf() -> FirstPersonSettings<T> {
use input::Button::Keyboard;
use input::Key;
FirstPersonSettings {
move_forward_button: Keyboard(Key::E),
move_backward_button: Keyboard(Key::D),
strafe_left_button: Keyboard(Key::S),
strafe_right_button: Keyboard(Key::F),
fly_up_button: Keyboard(Key::Space),
fly_down_button: Keyboard(Key::Z),
move_faster_button: Keyboard(Key::LShift),
speed_horizontal: T::one(),
speed_vertical: T::one(),
mouse_sensitivity_horizontal: T::one(),
mouse_sensitivity_vertical: T::one(),
}
}
/// Creates new first person camera settings with zqsd defaults (azerty keyboard layout).
pub fn keyboard_zqsd() -> FirstPersonSettings<T> {
use input::Button::Keyboard;
use input::Key;
FirstPersonSettings {
move_forward_button: Keyboard(Key::Z),
move_backward_button: Keyboard(Key::S),
strafe_left_button: Keyboard(Key::Q),
strafe_right_button: Keyboard(Key::D),
fly_up_button: Keyboard(Key::Space),
fly_down_button: Keyboard(Key::LShift),
move_faster_button: Keyboard(Key::LCtrl),
speed_horizontal: T::one(),
speed_vertical: T::one(),
mouse_sensitivity_horizontal: T::one(),
mouse_sensitivity_vertical: T::one(),
}
}
}
/// Models a flying first person camera.
pub struct FirstPerson<T=f32> {
/// The first person camera settings.
pub settings: FirstPersonSettings<T>,
/// The yaw angle (in radians).
pub yaw: T,
/// The pitch angle (in radians).
pub pitch: T,
/// The direction we are heading.
pub direction: [T; 3],
/// The position of the camera.
pub position: [T; 3],
/// The velocity we are moving in the direction.
pub velocity: T,
/// The keys that are pressed.
keys: Keys,
}
impl<T> FirstPerson<T>
where T: Float
{
/// Creates a new first person camera.
pub fn new(
position: [T; 3],
settings: FirstPersonSettings<T>
) -> FirstPerson<T> {
let _0: T = T::zero();
FirstPerson {
settings: settings,
yaw: _0,
pitch: _0,
keys: Keys::empty(),
direction: [_0, _0, _0],
position: position,
velocity: T::one(),
}
}
/// Computes camera.
pub fn camera(&self, dt: f64) -> Camera<T> {
let dt = T::from_f64(dt);
let dh = dt * self.velocity * self.settings.speed_horizontal;
let (dx, dy, dz) = (self.direction[0], self.direction[1], self.direction[2]);
let (s, c) = (self.yaw.sin(), self.yaw.cos());
let mut camera = Camera::new([
self.position[0] + (s * dx - c * dz) * dh,
self.position[1] + dy * dt * self.settings.speed_vertical,
self.position[2] + (s * dz + c * dx) * dh
]);
camera.set_yaw_pitch(self.yaw, self.pitch);
camera
}
/// Handles game event and updates camera.
pub fn event<E>(&mut self, e: &E) where E: GenericEvent {
e.update(|args| {
let cam = self.camera(args.dt);
self.position = cam.position;
});
let &mut FirstPerson {
ref mut yaw,
ref mut pitch,
ref mut keys,
ref mut direction,
ref mut velocity,
ref settings,
..
} = self;
let pi: T = Radians::_180();
let _0 = T::zero();
let _1 = T::one();
let _2 = _1 + _1;
let _3 = _2 + _1;
let _4 = _3 + _1;
let _360 = T::from_isize(360);
let sqrt2 = _2.sqrt();
e.mouse_relative(|dx, dy| {
let dx = T::from_f64(dx) * settings.mouse_sensitivity_horizontal;
let dy = T::from_f64(dy) * settings.mouse_sensitivity_vertical;
*yaw = (*yaw - dx / _360 * pi / _4) % (_2 * pi);
*pitch = *pitch + dy / _360 * pi / _4;
*pitch = (*pitch).min(pi / _2).max(-pi / _2);
});
e.press(|button| {
let (dx, dy, dz) = (direction[0], direction[1], direction[2]);
let sgn = |x: T| if x == _0 { _0 } else { x.signum() };
let mut set = |k, x: T, y: T, z: T| {
let (x, z) = (sgn(x), sgn(z));
let (x, z) = if x != _0 && z != _0 {
(x / sqrt2, z / sqrt2)
} else {
(x, z)
};
*direction = [x, y, z];
keys.insert(k);
};
match button {
x if x == settings.move_forward_button =>
set(MOVE_FORWARD, -_1, dy, dz),
x if x == settings.move_backward_button =>
set(MOVE_BACKWARD, _1, dy, dz),
x if x == settings.strafe_left_button =>
set(STRAFE_LEFT, dx, dy, _1),
x if x == settings.strafe_right_button =>
set(STRAFE_RIGHT, dx, dy, -_1),
x if x == settings.fly_up_button =>
set(FLY_UP, dx, _1, dz),
x if x == settings.fly_down_button =>
set(FLY_DOWN, dx, -_1, dz),
x if x == settings.move_faster_button => *velocity = _2,
_ => {}
}
});
e.release(|button| {
let (dx, dy, dz) = (direction[0], direction[1], direction[2]);
let sgn = |x: T| if x == _0 { _0 } else { x.signum() };
let mut set = |x: T, y: T, z: T| {
let (x, z) = (sgn(x), sgn(z));
let (x, z) = if x != _0 && z != _0 {
(x / sqrt2, z / sqrt2)
} else {
(x, z)
};
*direction = [x, y, z];
};
let mut release = |key, rev_key, rev_val| {
keys.remove(key);
if keys.contains(rev_key) { rev_val } else { _0 }
};
match button {
x if x == settings.move_forward_button =>
set(release(MOVE_FORWARD, MOVE_BACKWARD, _1), dy, dz),
x if x == settings.move_backward_button =>
set(release(MOVE_BACKWARD, MOVE_FORWARD, -_1), dy, dz),
x if x == settings.strafe_left_button =>
set(dx, dy, release(STRAFE_LEFT, STRAFE_RIGHT, -_1)),
x if x == settings.strafe_right_button =>
set(dx, dy, release(STRAFE_RIGHT, STRAFE_LEFT, _1)),
x if x == settings.fly_up_button =>
set(dx, release(FLY_UP, FLY_DOWN, -_1), dz),
x if x == settings.fly_down_button =>
set(dx, release(FLY_DOWN, FLY_UP, _1), dz),
x if x == settings.move_faster_button => *velocity = _1,
_ => {}
}
});
}
}
|
elrnv/camera_controllers
|
src/first_person.rs
|
Rust
|
mit
| 9,586
|
"use strict";
exports.__esModule = true;
exports.default = void 0;
var _assert = _interopRequireDefault(require("assert"));
var t = _interopRequireWildcard(require("@babel/types"));
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var ImportBuilder = function () {
function ImportBuilder(importedSource, scope, file) {
this._statements = [];
this._resultName = null;
this._scope = null;
this._file = null;
this._scope = scope;
this._file = file;
this._importedSource = importedSource;
}
var _proto = ImportBuilder.prototype;
_proto.done = function done() {
return {
statements: this._statements,
resultName: this._resultName
};
};
_proto.import = function _import() {
this._statements.push(t.importDeclaration([], t.stringLiteral(this._importedSource)));
return this;
};
_proto.require = function require() {
this._statements.push(t.expressionStatement(t.callExpression(t.identifier("require"), [t.stringLiteral(this._importedSource)])));
return this;
};
_proto.namespace = function namespace(name) {
if (name === void 0) {
name = "namespace";
}
name = this._scope.generateUidIdentifier(name);
var statement = this._statements[this._statements.length - 1];
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importNamespaceSpecifier(name)];
this._resultName = t.cloneNode(name);
return this;
};
_proto.default = function _default(name) {
name = this._scope.generateUidIdentifier(name);
var statement = this._statements[this._statements.length - 1];
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importDefaultSpecifier(name)];
this._resultName = t.cloneNode(name);
return this;
};
_proto.named = function named(name, importName) {
if (importName === "default") return this.default(name);
name = this._scope.generateUidIdentifier(name);
var statement = this._statements[this._statements.length - 1];
(0, _assert.default)(statement.type === "ImportDeclaration");
(0, _assert.default)(statement.specifiers.length === 0);
statement.specifiers = [t.importSpecifier(name, t.identifier(importName))];
this._resultName = t.cloneNode(name);
return this;
};
_proto.var = function _var(name) {
name = this._scope.generateUidIdentifier(name);
var statement = this._statements[this._statements.length - 1];
if (statement.type !== "ExpressionStatement") {
(0, _assert.default)(this._resultName);
statement = t.expressionStatement(this._resultName);
this._statements.push(statement);
}
this._statements[this._statements.length - 1] = t.variableDeclaration("var", [t.variableDeclarator(name, statement.expression)]);
this._resultName = t.cloneNode(name);
return this;
};
_proto.defaultInterop = function defaultInterop() {
return this._interop(this._file.addHelper("interopRequireDefault"));
};
_proto.wildcardInterop = function wildcardInterop() {
return this._interop(this._file.addHelper("interopRequireWildcard"));
};
_proto._interop = function _interop(callee) {
var statement = this._statements[this._statements.length - 1];
if (statement.type === "ExpressionStatement") {
statement.expression = t.callExpression(callee, [statement.expression]);
} else if (statement.type === "VariableDeclaration") {
(0, _assert.default)(statement.declarations.length === 1);
statement.declarations[0].init = t.callExpression(callee, [statement.declarations[0].init]);
} else {
_assert.default.fail("Unexpected type.");
}
return this;
};
_proto.prop = function prop(name) {
var statement = this._statements[this._statements.length - 1];
if (statement.type === "ExpressionStatement") {
statement.expression = t.memberExpression(statement.expression, t.identifier(name));
} else if (statement.type === "VariableDeclaration") {
(0, _assert.default)(statement.declarations.length === 1);
statement.declarations[0].init = t.memberExpression(statement.declarations[0].init, t.identifier(name));
} else {
_assert.default.fail("Unexpected type:" + statement.type);
}
return this;
};
_proto.read = function read(name) {
this._resultName = t.memberExpression(this._resultName, t.identifier(name));
};
return ImportBuilder;
}();
exports.default = ImportBuilder;
|
ocadni/citychrone
|
.build/bundle/programs/server/npm/node_modules/meteor/babel-compiler/node_modules/@babel/helper-module-imports/lib/import-builder.js
|
JavaScript
|
mit
| 5,143
|
<section data-ng-controller="ProjectsController" data-ng-init="findOne()">
<div class="page-header">
<h1>Edit Project Proposal</h1>
</div>
<div class="col-md-12">
<form name="projectForm" class="form-horizontal" data-ng-submit="update(projectForm.$valid)" novalidate>
<fieldset>
<div class="form-group" ng-class="{ 'has-error' : submitted && projectForm.title.$invalid}">
<label class="control-label" for="title">Title</label>
<div class="controls">
<input name="title" type="text" data-ng-model="project.title" id="title" class="form-control" placeholder="Title" required>
</div>
<div ng-show="submitted && projectForm.title.$invalid" class="help-block">
<p ng-show="projectForm.title.$error.required" class="text-danger">Title is required</p>
</div>
</div>
<div class="form-group" ng-class="{ 'has-error' : submitted && projectForm.content.$invalid}">
<label class="control-label" for="content">Content</label>
<div class="controls">
<textarea name="content" data-ng-model="project.content" id="content" class="form-control" cols="30" rows="10" placeholder="Content" required></textarea>
</div>
<div ng-show="submitted && projectForm.content.$invalid" class="help-block">
<p ng-show="projectForm.content.$error.required" class="text-danger">Content is required</p>
</div>
</div>
<div class="form-group">
<input type="submit" value="Update" class="btn btn-default">
</div>
<div data-ng-show="error" class="text-danger">
<strong data-ng-bind="error"></strong>
</div>
</fieldset>
</form>
</div>
</section>
|
keegansanford/Colab
|
public/modules/projects/views/edit-project.client.view.html
|
HTML
|
mit
| 1,636
|
from __future__ import absolute_import, unicode_literals
from builtins import str
import os
import pytest
import io
from glob import glob
from psd_tools import PSDImage
from psd2svg import psd2svg
FIXTURES = [
p for p in glob(
os.path.join(os.path.dirname(__file__), 'fixtures', '*.psd'))
]
@pytest.mark.parametrize('psd_file', FIXTURES)
def test_convert(tmpdir, psd_file):
psd2svg(psd_file, tmpdir.dirname)
@pytest.mark.parametrize('psd_file', FIXTURES[0:1])
def test_input_io(tmpdir, psd_file):
with open(psd_file, "rb") as f:
assert isinstance(psd2svg(f), str)
@pytest.mark.parametrize('psd_file', FIXTURES[0:1])
def test_input_psd(tmpdir, psd_file):
psd = PSDImage.open(psd_file)
psd2svg(psd)
@pytest.mark.parametrize('psd_file', FIXTURES[2:3])
def test_input_layer(tmpdir, psd_file):
psd = PSDImage.open(psd_file)
assert psd2svg(psd[0]).startswith("<")
@pytest.mark.parametrize('psd_file', FIXTURES[0:1])
def test_output_io(tmpdir, psd_file):
with io.StringIO() as f:
assert f == psd2svg(psd_file, f)
|
kyamagu/psd2svg
|
tests/test_convert.py
|
Python
|
mit
| 1,077
|
2.1.1 / 2020-05-01
==================
* upgrade async to ~3
* replace mongo/should with tape
* add `useUnifiedTopology` flag for DB connection
* fix iterator.eachLimit
* fix findOneAndUpdate test
2.1.0 / 2019-01-06
==================
* rename removeOne/All to deleteOneAll
* add findOneAndReplace and findOneAndDelete collection methods
2.0.2 / 2018-12-31
==================
* use createIndexes to streamline collection opening
2.0.1 / 2018-12-31
==================
* remove unsupported geoNear function
2.0.0 / 2018-12-25
==================
* upgrade dependencies
* upgrade monggodb driver to ~3
* add `replaceOne`
* replace `findAndModify` with `findOneAndUpdate`
* remove deprecated: `remove`, `save`, `update`
1.10.0 / 2018-03-11
===================
* add basic support for `collection.bulkWrite`
1.9.0 / 2018-03-03
==================
* add memo util and use it for collection and database open
1.8.1 / 2018-02-02
==================
* fix: allow `close()` for collections that were not open
1.8.0 / 2018-01-15
==================
* add modern CRUD methods to collection
* update code to ES6
1.7.2 / 2017-09-30
==================
* allow query as a parameter for findAndModify
1.7.1 / 2017-07-16
==================
* pass query in addition to id to the update() method
1.7.0 / 2017-03-26
==================
* add aggreate() method to collection
1.6.2 / 2017-02-19
==================
* transfer repo to pirxpilot
* update node version in travis config
1.6.1 / 2016-07-13
==================
* update dependencies
1.6.0 / 2016-04-18
==================
* add fluent iteration API for collections
1.5.0 / 2016-04-17
==================
* add database.drop and collection.drop
1.4.0 / 2016-04-14
==================
* add collection.eachLimit functions
1.3.2 / 2015-07-28
==================
* optimize objectID creation
* fix collection.find - get results before closing the cursor
1.3.1 / 2015-07-27
==================
* close MongoDB cursors in find and forEach
1.3.0 / 2015-06-07
==================
* expose mniam.objectID, deprecate db.objectID and collection.objectID
1.2.0 / 2015-06-07
==================
* update mongodb driver to 2.x
* update async ~0 -> ~1
* update mocha and should to the latest version
1.1.0 / 2014-11-16
==================
* add collection.batchSize
1.0.0 / 2014-05-25
==================
* travis: test on node 0.10
* use 'should' in tests
* simplify Makefile
* relax debug version dependency
0.3.0 / 2013-09-14
==================
* Use debug module
* Use MongoClient connect
0.2.0 / 2013-08-29
==================
* Update dependencies
* Add dependency status badge to Readme
* Add nmp version badge from badge.fury.io
0.0.2 / 2012-12-17
==================
* MongoDB driver updates - write concern option
0.0.1 / 2012-12-17
==================
* Add basic collection tests
* Add db.collection API
* Implement database and collection objects
* Initial commit
|
code42day/mniam
|
History.md
|
Markdown
|
mit
| 2,993
|
# -
易工分系统
|
DeathPluto/-
|
README.md
|
Markdown
|
mit
| 20
|
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("Cake.WebDeploy")]
// 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("05f26737-e1c8-47b0-a750-0651894925d2")]
|
cgourlay/Cake.WebDeploy
|
src/WebDeploy/Properties/AssemblyInfo.cs
|
C#
|
mit
| 724
|
<?php
require_once 'app/config/session.php';
require_once 'app/config/class.owner.php';
$auth_owner = new OWNER();
$id_owner = $_SESSION['user_session'];
$stmt = $auth_owner->runQuery("SELECT * FROM tbl_owner WHERE id_owner=:id_owner");
$stmt->execute(array(":id_owner"=>$id_owner));
$ownerRow=$stmt->fetch(PDO::FETCH_ASSOC);
//for editing form. get data from table
if (isset($_GET['edit_idrenter']) && !empty($_GET['edit_idrenter'])) {
$irenter = $_GET['edit_idrenter'];
$stmt_edit = $auth_owner->runQuery("SELECT * FROM tbl_renter WHERE id_renter =:irenter");
$stmt_edit->execute(array('irenter'=>$irenter));
$edit_row = $stmt_edit->fetch(PDO::FETCH_ASSOC);
}
else {
$auth_owner->redirect('owner-renter.php');
}
//Selectbox
$ops = '';
$stmt = $auth_owner->runQuery("SELECT
room.id_room,
room.room_name
FROM
tbl_owner AS own
LEFT JOIN tbl_rooms AS room ON own.id_owner = room.id_owner
WHERE
own.id_owner='$ownerRow[id_owner]'");
$stmt->execute();
while ($row=$stmt->fetch(PDO::FETCH_ASSOC)) {
$ops .= "<option value='" . $row['id_room'] . "'>" . $row['room_name'] . "</option>";
}
if (isset($_POST['btn-update-renter'])) {
$fname = $_POST['fullname'];
$gender = $_POST['gender'];
$father = $_POST['father'];
$mother = $_POST['mother'];
$phone = $_POST['phone'];
$address = $_POST['address'];
$irole = $_POST['id_role'];
$iowner = $_POST['id_owner'];
$iroom = $_POST['id_room'];
if ($fname == "") {
$error[] = "Provide Fullname!";
}
elseif ($gender == "") {
$error[] = "Provide Gender!";
}
elseif ($father == "") {
$error[] = "Provide Father!";
}
elseif ($mother == "") {
$error = "Provide Mother!";
}
elseif ($phone == "") {
$error[] = "Provide Phone!";
}
elseif (strlen($phone) > 14) {
$error[] = "Sorry, Phone not valid!";
}
elseif ($address == "") {
$error[] = "Provide Address";
}
elseif ($iroom == "") {
$error[] = "Provide Room Name!";
}
else {
try {
if ($auth_owner->updateRenter($fname, $gender, $father, $mother, $phone, $address, $irole, $iowner, $iroom, $irenter)) {
$auth_owner->redirect('owner-renter.php');
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
//Menampilkan view
include 'app/view/header.php';
include 'app/view/owner/menu-owner.php';
include 'app/view/owner/renter-owner-edit.php';
include 'app/view/footer.php';
?>
|
oimtrust/paykoos
|
owner-renter-edit.php
|
PHP
|
mit
| 2,490
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <iWorkImport/TSDImageFill.h>
@class TSPData, TSUColor;
// Not exported
@interface TSDMutableImageFill : TSDImageFill
{
}
- (void)setScale:(double)arg1;
@property(nonatomic) struct CGSize fillSize; // @dynamic fillSize;
@property(retain, nonatomic) TSPData *imageData; // @dynamic imageData;
@property(nonatomic) int technique; // @dynamic technique;
@property(copy, nonatomic) TSUColor *tintColor; // @dynamic tintColor;
- (id)copyWithZone:(struct _NSZone *)arg1;
@end
|
matthewsot/CocoaSharp
|
Headers/PrivateFrameworks/iWorkImport/TSDMutableImageFill.h
|
C
|
mit
| 624
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <HomeSharing/HSRequest.h>
@interface HSBulkRemovePlaylistRequest : HSRequest
{
}
+ (id)requestWithDatabaseID:(unsigned int)arg1 sessionID:(unsigned int)arg2 containerID:(unsigned int)arg3;
- (id)_bodyDataForSessionID:(unsigned int)arg1 containerID:(unsigned int)arg2;
- (id)initWithDatabaseID:(unsigned int)arg1 sessionID:(unsigned int)arg2 containerID:(unsigned int)arg3;
@end
|
matthewsot/CocoaSharp
|
Headers/PrivateFrameworks/HomeSharing/HSBulkRemovePlaylistRequest.h
|
C
|
mit
| 532
|
<?php
namespace JeroenDesloovere\Bundle\GeolocationBundle\DependencyInjection;
/*
* This file is part of the Geolocation bundle.
*
* (c) Jeroen Desloovere <info@jeroendesloovere.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class JeroenDesloovereGeolocationExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.yml');
}
}
|
jeroendesloovere/geolocation-bundle
|
DependencyInjection/JeroenDesloovereGeolocationExtension.php
|
PHP
|
mit
| 1,108
|
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2019.07.02 at 03:35:23 PM MSK
//
package ru.gov.zakupki.oos.signincoming.soap.messages;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import ru.gov.zakupki.oos.signincoming._1.UnplannedCheck;
import ru.gov.zakupki.oos.signincoming._1.UnplannedCheckCancel;
/**
* <p>Java class for receiveRvpRequestType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="receiveRvpRequestType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <choice>
* <element name="unplannedCheck" type="{http://zakupki.gov.ru/oos/signIncoming/1}unplannedCheck"/>
* <element name="unplannedCheckCancel" type="{http://zakupki.gov.ru/oos/signIncoming/1}unplannedCheckCancel"/>
* </choice>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "receiveRvpRequestType", propOrder = {
"unplannedCheck",
"unplannedCheckCancel"
})
public class ReceiveRvpRequestType {
protected UnplannedCheck unplannedCheck;
protected UnplannedCheckCancel unplannedCheckCancel;
/**
* Gets the value of the unplannedCheck property.
*
* @return
* possible object is
* {@link UnplannedCheck }
*
*/
public UnplannedCheck getUnplannedCheck() {
return unplannedCheck;
}
/**
* Sets the value of the unplannedCheck property.
*
* @param value
* allowed object is
* {@link UnplannedCheck }
*
*/
public void setUnplannedCheck(UnplannedCheck value) {
this.unplannedCheck = value;
}
/**
* Gets the value of the unplannedCheckCancel property.
*
* @return
* possible object is
* {@link UnplannedCheckCancel }
*
*/
public UnplannedCheckCancel getUnplannedCheckCancel() {
return unplannedCheckCancel;
}
/**
* Sets the value of the unplannedCheckCancel property.
*
* @param value
* allowed object is
* {@link UnplannedCheckCancel }
*
*/
public void setUnplannedCheckCancel(UnplannedCheckCancel value) {
this.unplannedCheckCancel = value;
}
}
|
simokhov/schemas44
|
src/main/java/ru/gov/zakupki/oos/signincoming/soap/messages/ReceiveRvpRequestType.java
|
Java
|
mit
| 2,772
|
<?php
namespace <%= namespace %>;
use <%= adminHelperNs %>\AdminHelper\Helper\AdminEditHelper;
class <%= interfaceName %>EditHelper extends AdminEditHelper
{
protected static $model = '\<%= modelClass %>';
}
|
yetione/generator-bitrix-tools
|
generators/entity/templates/admininterface/edithelper.php
|
PHP
|
mit
| 216
|
# -*- coding: utf-8 -*-
require 'comma/sanitized_extractor'
module Comma
class SanitizedDataExtractor < SanitizedExtractor
def multicolumn(method, &block)
Comma::MulticolumnExtractor.new(@instance, method, @globals, &block).extract_values.each do |result|
@results << result
end
end
class ExtractValueFromInstance
def initialize(instance)
@instance = instance
end
def extract(sym, &block)
yield_block_with_value(extract_value(sym), &block)
end
private
def yield_block_with_value(value, &block)
block ? yield(value) : value
end
def extract_value(method)
extraction_object.send(method)
end
def extraction_object
@instance
end
end
class ExtractValueFromAssociationOfInstance < ExtractValueFromInstance
def initialize(instance, association_name)
super(instance)
@association_name = association_name
end
private
def extraction_object
@instance.send(@association_name) || null_association
end
def null_association
@null_association ||= Class.new(Class.const_defined?(:BasicObject) ? ::BasicObject : ::Object) do
def method_missing(symbol, *args, &block)
nil
end
end.new
end
end
def method_missing(sym, *args, &block)
if args.blank?
@results << ExtractValueFromInstance.new(@instance).extract(sym, &block)
end
args.each do |arg|
case arg
when Hash
arg.each do |k, v|
@results << ExtractValueFromAssociationOfInstance.new(@instance, sym).extract(k, &block)
end
when Symbol
@results << ExtractValueFromAssociationOfInstance.new(@instance, sym).extract(arg, &block)
when String
@results << ExtractValueFromInstance.new(@instance).extract(sym, &block)
else
raise "Unknown data symbol #{arg.inspect}"
end
end
end
def __static_column__(header = nil, &block)
@results << (block ? yield(@instance) : nil)
end
end
end
|
chargify/comma
|
lib/comma/sanitized_data_extractor.rb
|
Ruby
|
mit
| 2,150
|
package main
import (
"github.com/gin-gonic/gin"
"github.com/loopfz/scecret/auth"
"github.com/loopfz/scecret/models"
)
type ListCardsIn struct {
IDScenario int64 `path:"scenario, required"`
}
func ListCards(c *gin.Context, in *ListCardsIn) ([]*models.Card, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
return models.ListCards(db, sc)
}
type GetCardIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
}
func GetCard(c *gin.Context, in *GetCardIn) (*models.Card, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
return models.LoadCardFromID(db, sc, in.IDCard)
}
type UpdateCardIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
Number uint `json:"number" binding:"required"`
Description string `json:"description" binding:"required"`
Front *models.CardFace `json:"front" binding:"required"`
Back *models.CardFace `json:"back" binding:"required"`
}
func UpdateCard(c *gin.Context, in *UpdateCardIn) (*models.Card, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return nil, err
}
err = card.Update(db, in.Number, in.Description, in.Front, in.Back)
if err != nil {
return nil, err
}
return card, nil
}
type NewCardIconIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
IDIcon int64 `json:"id_icon" binding:"required"`
FrontBack bool `json:"front_back" binding:"required"`
X uint `json:"x" binding:"required"`
Y uint `json:"y" binding:"required"`
SizeX uint `json:"size_x" binding:"required"`
SizeY uint `json:"size_y" binding:"required"`
Annotation string `json:"annotation" binding:"required"`
AnnotationType int `json:"annotation_type" binding:"required"`
}
func NewCardIcon(c *gin.Context, in *NewCardIconIn) (*models.CardIcon, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return nil, err
}
ico, err := models.LoadIconFromID(db, sc, in.IDIcon)
if err != nil {
return nil, err
}
return card.CreateCardIcon(db, ico, in.FrontBack, in.X, in.Y, in.SizeX, in.SizeY,
in.Annotation, in.AnnotationType, nil, nil)
}
type ListCardIconsIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
}
func ListCardIcons(c *gin.Context, in *ListCardIconsIn) ([]*models.CardIcon, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return nil, err
}
return card.ListCardIcons(db, nil, nil)
}
type GetCardIconIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
IDCardIcon int64 `path:"icon, required"`
}
func GetCardIcon(c *gin.Context, in *GetCardIconIn) (*models.CardIcon, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return nil, err
}
return card.LoadCardIconFromID(db, in.IDCardIcon)
}
type UpdateCardIconIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
IDCardIcon int64 `path:"icon, required"`
IDIcon int64 `json:"id_icon" binding:"required"`
FrontBack bool `json:"front_back" binding:"required"`
X uint `json:"x" binding:"required"`
Y uint `json:"y" binding:"required"`
SizeX uint `json:"size_x" binding:"required"`
SizeY uint `json:"size_y" binding:"required"`
Annotation string `json:"annotation" binding:"required"`
AnnotationType int `json:"annotation_type" binding:"required"`
}
func UpdateCardIcon(c *gin.Context, in *UpdateCardIconIn) (*models.CardIcon, error) {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return nil, err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return nil, err
}
ico, err := models.LoadIconFromID(db, sc, in.IDIcon)
if err != nil {
return nil, err
}
ci, err := card.LoadCardIconFromID(db, in.IDCardIcon)
if err != nil {
return nil, err
}
err = ci.Update(db, ico, in.FrontBack, in.X, in.Y, in.SizeX, in.SizeY,
in.Annotation, in.AnnotationType)
if err != nil {
return nil, err
}
return ci, nil
}
type DeleteCardIconIn struct {
IDScenario int64 `path:"scenario, required"`
IDCard int64 `path:"card, required"`
IDCardIcon int64 `path:"icon, required"`
}
func DeleteCardIcon(c *gin.Context, in *DeleteCardIconIn) error {
sc, err := auth.RetrieveTokenScenario(db, c, in.IDScenario)
if err != nil {
return err
}
card, err := models.LoadCardFromID(db, sc, in.IDCard)
if err != nil {
return err
}
ci, err := card.LoadCardIconFromID(db, in.IDCardIcon)
if err != nil {
return err
}
return ci.Delete(db)
}
|
loopfz/scecret
|
api/card.go
|
GO
|
mit
| 5,398
|
Permission.create(section: 'ticketing', resource: 'admin', action: 'login')
Permission.create(section: 'ticketing', resource: 'queue', action: 'read')
Permission.create(section: 'ticketing', resource: 'queue', action: 'create')
Permission.create(section: 'ticketing', resource: 'queue', action: 'update')
Permission.create(section: 'ticketing', resource: 'queue', action: 'destroy')
Permission.create(section: 'ticketing', resource: 'case', action: 'read')
Permission.create(section: 'ticketing', resource: 'case', action: 'create')
Permission.create(section: 'ticketing', resource: 'case', action: 'update')
Permission.create(section: 'ticketing', resource: 'case', action: 'destroy')
Permission.create(section: 'ticketing', resource: 'case', action: 'reassign')
|
sumitbirla/rhombus_ticketing
|
db/seeds.rb
|
Ruby
|
mit
| 765
|
namespace MiniUML.Model.ViewModels
{
using MiniUML.Model.Events;
using MiniUML.Model.ViewModels.Shapes;
/// <summary>
/// Shape size adjustment operations
/// supported by the <seealso cref="IShapeParent"/> interface.
/// </summary>
public enum SameSize
{
/// <summary>
/// Adjust shapes to have the same width.
/// </summary>
SameWidth,
/// <summary>
/// Adjust shapes to have the same height.
/// </summary>
SameHeight,
/// <summary>
/// Adjust shapes to have the same width and height.
/// </summary>
SameWidthandHeight
}
/// <summary>
/// Shape alignment options for shape alignment operations
/// supported by the <seealso cref="IShapeParent"/> interface.
/// </summary>
public enum AlignShapes
{
/// <summary>
/// Align shapes at a left X minimum coordinate.
/// </summary>
Left,
/// <summary>
/// Align shapes at a top Y minimum coordinate.
/// </summary>
Top,
/// <summary>
/// Align shapes at a right X maximum coordinate.
/// </summary>
Right,
/// <summary>
/// Align shapes at a bottom Y maximum coordinate.
/// </summary>
Bottom,
/// <summary>
/// Align shapes centered around an Y coordinate.
/// </summary>
CenteredHorizontal,
/// <summary>
/// Align shapes centered around an X coordinate.
/// </summary>
CenteredVertical
}
/// <summary>
/// Define whether shapes should be destributed horizontally or vertically.
/// </summary>
public enum Destribute
{
/// <summary>
/// Destribute shapes horizontally.
/// </summary>
Horizontally,
/// <summary>
/// Destribute shapes vertically.
/// </summary>
Vertically,
}
/// <summary>
/// Declare interface that allows shapes to
/// call parent methodes to execute operations
/// on them selfs (in the context of their parent element).
///
/// Parent => Canvas
/// Child => Shape
/// --> The interface linkes ShapeViewModels to their CanvasViewModel.
/// </summary>
public interface IShapeParent
{
/// <summary>
/// Brings the shape into front of the canvas view
/// (moves shape on top of virtual Z-axis)
/// </summary>
/// <param name="obj"></param>
void BringToFront(ShapeViewModelBase obj);
/// <summary>
/// Brings the shape into the back of the canvas view
/// (moves shape to the bottom of virtual Z-axis)
/// </summary>
/// <param name="obj"></param>
void SendToBack(ShapeViewModelBase obj);
/// <summary>
/// Removes the corresponding shape from the
/// collection of shapes displayed on the canvas.
/// </summary>
/// <param name="obj"></param>
void Remove(ShapeViewModelBase obj);
/// <summary>
/// Resizes the currently selected shapes (if any) by the width or height
/// requested by the <paramref name="e"/> parameter.
/// </summary>
/// <param name="e"></param>
void ResizeSelectedShapes(DragDeltaThumbEvent e);
/// <summary>
/// Align all selected shapes (if any) to a given shape <paramref name="shape"/>.
/// The actual alignment operation performed is defined by the <paramref name="alignmentOption"/> parameter.
/// </summary>
/// <param name="shape"></param>
/// <param name="alignmentOption"></param>
void AlignShapes(ShapeSizeViewModelBase shape, AlignShapes alignmentOption);
/// <summary>
/// Adjusts width, height, or both, of all selected shapes (if any)
/// such that they are sized equally to the given <paramref name="shape"/>.
/// </summary>
/// <param name="shape"></param>
/// <param name="option"></param>
void AdjustShapesToSameSize(ShapeSizeViewModelBase shape, SameSize option);
/// <summary>
/// Destribute all selected shapes (if any) over X or Y space evenly.
/// </summary>
/// <param name="distibOption"></param>
void DistributeShapes(Destribute distibOption);
}
}
|
Dirkster99/Edi
|
MiniUML/MiniUML.Model/ViewModels/IShapeParent.cs
|
C#
|
mit
| 4,418
|
import { FC, createElement as h } from 'react';
import { PageProps } from '@not-govuk/app-composer';
import { Page } from '@hods/components';
import './app.scss';
export const PageWrap: FC<PageProps> = ({ routes, children }) => {
const compare = (a, b) => (
a.href > b.href
? 1
: -1
);
const navigation = routes
.map(e => ({
href: e.href,
text: e.title
}))
.sort(compare);
return (
<Page
footerNavigation={navigation}
navigation={navigation}
title="My new service"
>
{children}
</Page>
);
};
export default PageWrap;
|
eliothill/home-office-digital-patterns
|
lib/plop-pack/skel/app/src/common/page-wrap.tsx
|
TypeScript
|
mit
| 603
|
using UnityEngine;
using System.Collections;
public class BookOfBasics : BookFinished {
public Animator Door;
public override void Finished()
{
Door.SetBool("Open", true);
}
}
|
noplisu/BookLearning
|
Assets/Scripts/BookOfBasics.cs
|
C#
|
mit
| 206
|
require 'gon'
require 'fogbugz'
class ApplicationController < ActionController::Base
include Gitlab::CurrentSettings
include GitlabRoutingHelper
include PageLayoutHelper
PER_PAGE = 20
before_action :authenticate_user_from_token!
before_action :authenticate_user!
before_action :validate_user_service_ticket!
before_action :reject_blocked!
before_action :check_password_expiration
before_action :check_2fa_requirement
before_action :ldap_security_check
before_action :default_headers
before_action :add_gon_variables
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :require_email, unless: :devise_controller?
protect_from_forgery with: :exception
helper_method :abilities, :can?, :current_application_settings
helper_method :import_sources_enabled?, :github_import_enabled?, :github_import_configured?, :gitlab_import_enabled?, :gitlab_import_configured?, :bitbucket_import_enabled?, :bitbucket_import_configured?, :gitorious_import_enabled?, :google_code_import_enabled?, :fogbugz_import_enabled?, :git_import_enabled?
rescue_from Encoding::CompatibilityError do |exception|
log_exception(exception)
render "errors/encoding", layout: "errors", status: 500
end
rescue_from ActiveRecord::RecordNotFound do |exception|
log_exception(exception)
render_404
end
def redirect_back_or_default(default: root_path, options: {})
redirect_to request.referer.present? ? :back : default, options
end
protected
# From https://github.com/plataformatec/devise/wiki/How-To:-Simple-Token-Authentication-Example
# https://gist.github.com/josevalim/fb706b1e933ef01e4fb6
def authenticate_user_from_token!
user_token = if params[:authenticity_token].presence
params[:authenticity_token].presence
elsif params[:private_token].presence
params[:private_token].presence
end
user = user_token && User.find_by_authentication_token(user_token.to_s)
if user
# Notice we are passing store false, so the user is not
# actually stored in the session and a token is needed
# for every request. If you want the token to work as a
# sign in token, you can simply remove store: false.
sign_in user, store: false
end
end
def authenticate_user!(*args)
if redirect_to_home_page_url?
redirect_to current_application_settings.home_page_url and return
end
super(*args)
end
def log_exception(exception)
application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace
application_trace.map!{ |t| " #{t}\n" }
logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}"
end
def reject_blocked!
if current_user && current_user.blocked?
sign_out current_user
flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
redirect_to new_user_session_path
end
end
def after_sign_in_path_for(resource)
if resource.is_a?(User) && resource.respond_to?(:blocked?) && resource.blocked?
sign_out resource
flash[:alert] = "Your account is blocked. Retry when an admin has unblocked it."
new_user_session_path
else
stored_location_for(:redirect) || stored_location_for(resource) || root_path
end
end
def after_sign_out_path_for(resource)
current_application_settings.after_sign_out_path || new_user_session_path
end
def abilities
Ability.abilities
end
def can?(object, action, subject)
abilities.allowed?(object, action, subject)
end
def project
unless @project
namespace = params[:namespace_id]
id = params[:project_id] || params[:id]
# Redirect from
# localhost/group/project.git
# to
# localhost/group/project
#
if id =~ /\.git\Z/
redirect_to request.original_url.gsub(/\.git\Z/, '') and return
end
project_path = "#{namespace}/#{id}"
@project = Project.find_with_namespace(project_path)
if @project and can?(current_user, :read_project, @project)
if @project.path_with_namespace != project_path
redirect_to request.original_url.gsub(project_path, @project.path_with_namespace) and return
end
@project
elsif current_user.nil?
@project = nil
authenticate_user!
else
@project = nil
render_404 and return
end
end
@project
end
def repository
@repository ||= project.repository
end
def authorize_project!(action)
return access_denied! unless can?(current_user, action, project)
end
def access_denied!
render "errors/access_denied", layout: "errors", status: 404
end
def git_not_found!
render html: "errors/git_not_found", layout: "errors", status: 404
end
def method_missing(method_sym, *arguments, &block)
if method_sym.to_s =~ /\Aauthorize_(.*)!\z/
authorize_project!($1.to_sym)
else
super
end
end
def render_403
head :forbidden
end
def render_404
render file: Rails.root.join("public", "404"), layout: false, status: "404"
end
def require_non_empty_project
redirect_to @project if @project.empty_repo?
end
def no_cache_headers
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
def default_headers
headers['X-Frame-Options'] = 'DENY'
headers['X-XSS-Protection'] = '1; mode=block'
headers['X-UA-Compatible'] = 'IE=edge'
headers['X-Content-Type-Options'] = 'nosniff'
# Enabling HSTS for non-standard ports would send clients to the wrong port
if Gitlab.config.gitlab.https and Gitlab.config.gitlab.port == 443
headers['Strict-Transport-Security'] = 'max-age=31536000'
end
end
def add_gon_variables
gon.api_version = API::API.version
gon.default_avatar_url = URI::join(Gitlab.config.gitlab.url, ActionController::Base.helpers.image_path('no_avatar.png')).to_s
gon.default_issues_tracker = Project.new.default_issue_tracker.to_param
gon.max_file_size = current_application_settings.max_attachment_size
gon.relative_url_root = Gitlab.config.gitlab.relative_url_root
gon.user_color_scheme = Gitlab::ColorSchemes.for_user(current_user).css_class
if current_user
gon.current_user_id = current_user.id
gon.api_token = current_user.private_token
end
end
def validate_user_service_ticket!
return unless signed_in? && session[:service_tickets]
valid = session[:service_tickets].all? do |provider, ticket|
Gitlab::OAuth::Session.valid?(provider, ticket)
end
unless valid
session[:service_tickets] = nil
sign_out current_user
redirect_to new_user_session_path
end
end
def check_password_expiration
if current_user && current_user.password_expires_at && current_user.password_expires_at < Time.now && !current_user.ldap_user?
redirect_to new_profile_password_path and return
end
end
def check_2fa_requirement
if two_factor_authentication_required? && current_user && !current_user.two_factor_enabled && !skip_two_factor?
redirect_to new_profile_two_factor_auth_path
end
end
def ldap_security_check
if current_user && current_user.requires_ldap_check?
unless Gitlab::LDAP::Access.allowed?(current_user)
sign_out current_user
flash[:alert] = "Access denied for your LDAP account."
redirect_to new_user_session_path
end
end
end
def event_filter
filters = cookies['event_filter'].split(',') if cookies['event_filter'].present?
@event_filter ||= EventFilter.new(filters)
end
def gitlab_ldap_access(&block)
Gitlab::LDAP::Access.open { |access| block.call(access) }
end
# JSON for infinite scroll via Pager object
def pager_json(partial, count)
html = render_to_string(
partial,
layout: false,
formats: [:html]
)
render json: {
html: html,
count: count
}
end
def view_to_html_string(partial)
render_to_string(
partial,
layout: false,
formats: [:html]
)
end
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:username, :email, :password, :login, :remember_me, :otp_attempt) }
end
def hexdigest(string)
Digest::SHA1.hexdigest string
end
def require_email
if current_user && current_user.temp_oauth_email?
redirect_to profile_path, notice: 'Please complete your profile with email address' and return
end
end
def set_filters_params
params[:sort] ||= 'created_desc'
params[:scope] = 'all' if params[:scope].blank?
params[:state] = 'opened' if params[:state].blank?
@sort = params[:sort]
@filter_params = params.dup
if @project
@filter_params[:project_id] = @project.id
elsif @group
@filter_params[:group_id] = @group.id
else
# TODO: this filter ignore issues/mr created in public or
# internal repos where you are not a member. Enable this filter
# or improve current implementation to filter only issues you
# created or assigned or mentioned
#@filter_params[:authorized_only] = true
end
@filter_params
end
def get_issues_collection
set_filters_params
@issuable_finder = IssuesFinder.new(current_user, @filter_params)
@issuable_finder.execute
end
def get_merge_requests_collection
set_filters_params
@issuable_finder = MergeRequestsFinder.new(current_user, @filter_params)
@issuable_finder.execute
end
def import_sources_enabled?
!current_application_settings.import_sources.empty?
end
def github_import_enabled?
current_application_settings.import_sources.include?('github')
end
def github_import_configured?
Gitlab::OAuth::Provider.enabled?(:github)
end
def gitlab_import_enabled?
request.host != 'gitlab.com' && current_application_settings.import_sources.include?('gitlab')
end
def gitlab_import_configured?
Gitlab::OAuth::Provider.enabled?(:gitlab)
end
def bitbucket_import_enabled?
current_application_settings.import_sources.include?('bitbucket')
end
def bitbucket_import_configured?
Gitlab::OAuth::Provider.enabled?(:bitbucket) && Gitlab::BitbucketImport.public_key.present?
end
def gitorious_import_enabled?
current_application_settings.import_sources.include?('gitorious')
end
def google_code_import_enabled?
current_application_settings.import_sources.include?('google_code')
end
def fogbugz_import_enabled?
current_application_settings.import_sources.include?('fogbugz')
end
def git_import_enabled?
current_application_settings.import_sources.include?('git')
end
def two_factor_authentication_required?
current_application_settings.require_two_factor_authentication
end
def two_factor_grace_period
current_application_settings.two_factor_grace_period
end
def two_factor_grace_period_expired?
date = current_user.otp_grace_period_started_at
date && (date + two_factor_grace_period.hours) < Time.current
end
def skip_two_factor?
session[:skip_tfa] && session[:skip_tfa] > Time.current
end
def redirect_to_home_page_url?
# If user is not signed-in and tries to access root_path - redirect him to landing page
# Don't redirect to the default URL to prevent endless redirections
return false unless current_application_settings.home_page_url.present?
home_page_url = current_application_settings.home_page_url.chomp('/')
root_urls = [Gitlab.config.gitlab['url'].chomp('/'), root_url.chomp('/')]
return false if root_urls.include?(home_page_url)
current_user.nil? && root_path == request.path
end
end
|
koreamic/gitlabhq
|
app/controllers/application_controller.rb
|
Ruby
|
mit
| 11,970
|
<?php
class Home extends CI_Controller {
function __construct()
{
parent::__construct();
//$this->load->model('');
$this->load->model('doctor_model');
$this->load->model('appointment_model');
$this->load->helper(array('form', 'url','array'));
$this->load->helper('date');
$this->load->library('form_validation');
}
public function index(){
// $data['doctor'] = $this->doctor_model->get_doctors();
$data = array(
'title' => 'Welcome to D2 Hospital');
$this->load->view('header',$data);
$this->load->view('home.php',$data);
$this->load->view('footer',$data);
}
}
|
milind-okay/HMS
|
application/controllers/home.php
|
PHP
|
mit
| 816
|
---
layout: page
title: Omega Serenity Chemical Executive Retreat
date: 2016-05-24
author: Andrea Fuentes
tags: weekly links, java
status: published
summary: Morbi augue augue, consectetur eget pulvinar quis, blandit.
banner: images/banner/people.jpg
booking:
startDate: 06/14/2016
endDate: 06/18/2016
ctyhocn: BMIWEHX
groupCode: OSCER
published: true
---
Cras et massa ultrices, mollis ante id, porttitor arcu. Cras eget sapien nibh. Ut in congue velit. Donec at pretium nisi. In condimentum odio non dui maximus interdum. Donec fringilla turpis ut sem ullamcorper, ut facilisis ligula pellentesque. Aliquam luctus at dui eu fermentum. Quisque posuere risus consequat nisi fringilla rutrum. Pellentesque metus nibh, laoreet ut sem nec, laoreet hendrerit orci. Fusce urna risus, mattis eu luctus at, auctor at ex. Curabitur mattis velit id lectus auctor blandit. Vestibulum vitae imperdiet nulla. Sed mauris purus, rhoncus scelerisque tincidunt sit amet, rutrum et lectus.
Cras sit amet vulputate neque. In molestie porta eros non pellentesque. Praesent eleifend dictum neque, vitae vehicula diam cursus vel. Cras condimentum consequat leo, quis varius elit eleifend vitae. Cras suscipit ex sed mi gravida eleifend. Cras facilisis varius aliquam. Integer cursus eu est id ultrices. Etiam ut condimentum tortor. Sed diam nulla, commodo ut arcu nec, finibus scelerisque eros. Curabitur ligula erat, vulputate sit amet justo id, malesuada sagittis enim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum lacus tellus, hendrerit at massa vitae, semper dictum nisi. Quisque egestas velit et lectus ultricies, vitae ullamcorper orci dapibus. Donec malesuada non purus id euismod.
* Proin aliquam nibh id risus hendrerit aliquet
* Nullam auctor mi vitae pretium sagittis
* Nulla commodo nisi ac augue pretium, ut vulputate mauris tincidunt
* Mauris tincidunt velit sit amet libero sagittis consectetur.
Nulla consectetur ultrices mollis. Phasellus vel dolor vel turpis posuere egestas in ut turpis. Phasellus ac scelerisque lectus. Proin id magna placerat, vulputate sapien vel, viverra ligula. Aenean fringilla viverra elit, et ullamcorper purus laoreet in. Praesent urna velit, convallis ultricies enim vel, dictum fringilla mauris. Sed lacinia bibendum sapien eu efficitur.
|
KlishGroup/prose-pogs
|
pogs/B/BMIWEHX/OSCER/index.md
|
Markdown
|
mit
| 2,335
|
---
layout: page
title: Zone Holdings Dinner
date: 2016-05-24
author: Joshua Frost
tags: weekly links, java
status: published
summary: Mauris venenatis lorem quis sapien auctor, nec tincidunt sem venenatis.
banner: images/banner/leisure-04.jpg
booking:
startDate: 02/22/2017
endDate: 02/24/2017
ctyhocn: PBIVCHX
groupCode: ZHD
published: true
---
Interdum et malesuada fames ac ante ipsum primis in faucibus. Aliquam dui nunc, porttitor sed leo blandit, venenatis bibendum dolor. Donec sed efficitur ipsum. Nam pretium eleifend lacus a pretium. Pellentesque tincidunt ut tortor ac rhoncus. Maecenas aliquam est dolor, eu imperdiet mi ultricies nec. Praesent lobortis tristique diam, eu pharetra metus rutrum tempor. Phasellus sit amet ligula enim. Ut a varius ante, a gravida mi. Integer semper egestas bibendum. Maecenas ac orci tortor.
Nunc sit amet venenatis risus. Suspendisse eu scelerisque arcu. Integer vulputate consequat diam nec auctor. Pellentesque ut ornare sapien. Integer semper dolor sed nunc lobortis gravida. Sed eu ipsum eros. Ut non dictum tortor. Nam porttitor, odio quis aliquam porttitor, orci enim faucibus lectus, at aliquet lorem arcu sit amet felis. Vestibulum et purus ac enim euismod euismod. Fusce vestibulum nisl eget molestie commodo. Mauris eu nibh dignissim, molestie erat ac, suscipit nibh. Fusce ultrices id sem sed porta. Nulla laoreet nisi neque, a tincidunt odio finibus a.
* Duis semper nunc eget ipsum tincidunt, non tristique orci tempus
* Maecenas at risus at turpis viverra porta vel eu odio
* Ut vel tellus nec mauris interdum finibus vel vel lectus
* Vestibulum eu mauris facilisis, aliquam purus vitae, accumsan lectus
* Aliquam nec ex hendrerit, tincidunt nunc in, iaculis dolor.
Maecenas tempor, leo id venenatis efficitur, ligula nunc bibendum orci, sit amet dapibus orci dui eget felis. Etiam nisl mi, imperdiet ut turpis id, consequat sagittis neque. Vestibulum tempor quis tortor non posuere. Aenean molestie odio vel neque ullamcorper, nec efficitur risus fringilla. Fusce euismod mi id vehicula mattis. Sed in viverra massa, nec molestie quam. Duis efficitur interdum finibus. Sed efficitur lorem ac blandit malesuada. Sed sed orci felis. Maecenas finibus leo nisi. Quisque cursus convallis varius.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Maecenas dui neque, placerat at vulputate nec, pellentesque vel urna. Duis est neque, porttitor nec dolor quis, rutrum fringilla dui. Phasellus nibh tortor, convallis vitae ullamcorper at, lobortis sed diam. Fusce vel lorem id orci porta tempus quis eget quam. Etiam quis mauris ac risus convallis accumsan quis in metus. Aliquam varius sollicitudin nunc porta ultricies. Maecenas mollis mauris et urna malesuada, ac sodales velit gravida. Maecenas nec sapien auctor, venenatis purus fermentum, lobortis velit. Nulla erat mauris, fringilla quis lobortis scelerisque, fringilla id risus. Pellentesque non mi nibh.
|
KlishGroup/prose-pogs
|
pogs/P/PBIVCHX/ZHD/index.md
|
Markdown
|
mit
| 2,968
|
package com.davan.alarmcontroller.http.services;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import java.io.File;
import java.io.IOException;
/**
* Created by davandev on 2017-04-13.
*/
public class LocalMediaFilePlayer {
private static final String TAG = LocalMediaFilePlayer.class.getSimpleName();
private float maxVolumeLevel = 15;
public LocalMediaFilePlayer(Context context)
{
Log.d(TAG, "Create MediaPlayer");
AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
maxVolumeLevel = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
Log.i(TAG,"MaxVolumeLevel["+maxVolumeLevel+"]");
}
private final BroadcastReceiver mMessageReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
String message = intent.getStringExtra("message");
playMedia(context, message);
}
};
private void playMedia(Context context, String message)
{
Log.i(TAG, "Received play request");
try {
float volume = -1;
if (message.contains("&vol="))
{
String[] res = message.split("&vol=");
message = res[0];
volume = Integer.parseInt(res[1])/maxVolumeLevel;
Log.d(TAG, "New volume:" + volume);
}
File mediaFile = new File(message);
if (!mediaFile.exists())
{
Log.w(TAG,"File :" + mediaFile.getAbsolutePath() +" does not exist");
return;
}
Uri myUri = Uri.fromFile(mediaFile);
MediaPlayer mediaPlayer = new android.media.MediaPlayer();
if (volume != -1)
{
mediaPlayer.setVolume(volume,volume);
}
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
mediaPlayer.setDataSource(context, myUri);
mediaPlayer.prepare();
mediaPlayer.start();
}
catch(IOException e)
{
Log.w(TAG,"Failed to play media:" + e.getMessage());
}
}
/*
* Register to received tts requests
*/
public void registerForEvents(Context context)
{
LocalBroadcastManager.getInstance(context).registerReceiver(
mMessageReceiver, new IntentFilter("play-event"));
}
/*
* Unregister to received tts requests
*/
public void unregisterForEvents(Context context)
{
LocalBroadcastManager.getInstance(context).unregisterReceiver(
mMessageReceiver);
}
}
|
davandev/AlarmController
|
app/src/main/java/com/davan/alarmcontroller/http/services/LocalMediaFilePlayer.java
|
Java
|
mit
| 2,964
|
'use strict'
const server = require('./lib/server')
const base = require('../webpack.config')
module.exports = function(env) {
let config = base(env)
// Setup the webpack dev server to include our API endpoints
config.devServer.before = server
return config
}
|
vigetlabs/microcosm
|
examples/chatbot/webpack.config.js
|
JavaScript
|
mit
| 272
|
module Elliptic
# elliptic integrals of 1st/2nd/3rd kind
export E, F, K, Pi
# jacobi elliptic functions
export Jacobi
# matlab compatible
export ellipj, ellipke
include("jacobi.jl")
include("slatec.jl")
function E(phi::Float64, m::Float64)
if isnan(phi) || isnan(m) return NaN end
if m < 0. || m > 1. throw(DomainError(m, "argument m not in [0,1]")) end
if abs(phi) > pi/2
phi2 = phi + pi/2
return 2*fld(phi2,pi)*E(m) - _E(cos(mod(phi2,pi)), m)
end
_E(sin(phi), m)
end
function _E(sinphi::Float64, m::Float64)
sinphi2 = sinphi^2
cosphi2 = 1. - sinphi2
y = 1. - m*sinphi2
drf,ierr1 = SLATEC.DRF(cosphi2, y, 1.)
drd,ierr2 = SLATEC.DRD(cosphi2, y, 1.)
if ierr1 == ierr2 == 0
return sinphi*(drf - m*sinphi2*drd/3)
elseif ierr1 == ierr2 == 2
# 2 - (1+m)*sinphi2 < tol
return sinphi
end
NaN
end
E(phi::Real, m::Real) = E(Float64(phi), Float64(m))
"""
`ellipke(m::Real)`
returns `(K(m), E(m))` for scalar `0 ≤ m ≤ 1`
"""
function ellipke(m::Float64)
if m < 1.
y = 1. - m
drf,ierr1 = SLATEC.DRF(0., y, 1.)
drd,ierr2 = SLATEC.DRD(0., y, 1.)
@assert ierr1 == 0 && ierr2 == 0
return drf, drf - m*drd/3
elseif m == 1.
return Inf, 1.
elseif isnan(m)
return NaN, NaN
else
throw(DomainError(m, "argument m not <= 1"))
end
end
ellipke(x::Real) = ellipke(Float64(x))
E(m::Float64) = ellipke(m)[2]
E(x::Float32) = Float32(E(Float64(x)))
E(x::Real) = E(Float64(x))
# assumes 0 ≤ m ≤ 1
function rawF(sinphi::Float64, m::Float64)
if abs(sinphi) == 1. && m == 1. return sign(sinphi)*Inf end
sinphi2 = sinphi^2
drf,ierr = SLATEC.DRF(1. - sinphi2, 1. - m*sinphi2, 1.)
@assert ierr == 0
sinphi*drf
end
function F(phi::Float64, m::Float64)
if isnan(phi) || isnan(m) return NaN end
if m < 0. || m > 1. throw(DomainError(m, "argument m not in [0,1]")) end
if abs(phi) > pi/2
# Abramowitz & Stegun (17.4.3)
phi2 = phi + pi/2
return 2*fld(phi2,pi)*K(m) - rawF(cos(mod(phi2,pi)), m)
end
rawF(sin(phi), m)
end
F(phi::Real, m::Real) = F(Float64(phi), Float64(m))
function K(m::Float64)
if m < 1.
drf,ierr = SLATEC.DRF(0., 1. - m, 1.)
@assert ierr == 0
return drf
elseif m == 1.
return Inf
elseif isnan(m)
return NaN
else
throw(DomainError(m, "argument m not <= 1"))
end
end
K(x::Float32) = Float32(K(Float64(x)))
K(x::Real) = K(Float64(x))
function Pi(n::Float64, phi::Float64, m::Float64)
if isnan(n) || isnan(phi) || isnan(m) return NaN end
if m < 0. || m > 1. throw(DomainError(m, "argument m not in [0,1]")) end
sinphi = sin(phi)
sinphi2 = sinphi^2
cosphi2 = 1. - sinphi2
y = 1. - m*sinphi2
drf,ierr1 = SLATEC.DRF(cosphi2, y, 1.)
drj,ierr2 = SLATEC.DRJ(cosphi2, y, 1., 1. - n*sinphi2)
if ierr1 == 0 && ierr2 == 0
return sinphi*(drf + n*sinphi2*drj/3)
elseif ierr1 == 2 && ierr2 == 2
# 2 - (1+m)*sinphi2 < tol
return Inf
elseif ierr1 == 0 && ierr2 == 2
# 1 - n*sinphi2 < tol
return Inf
end
NaN
end
Pi(n::Real, phi::Real, m::Real) = Pi(Float64(n), Float64(phi), Float64(m))
Π = Pi
function ellipj(u::Float64, m::Float64, tol::Float64)
phi = Jacobi.am(u, m, tol)
s = sin(phi)
c = cos(phi)
d = sqrt(1. - m*s^2)
s, c, d
end
ellipj(u::Float64, m::Float64) = ellipj(u, m, eps(Float64))
ellipj(u::Real, m::Real) = ellipj(Float64(u), Float64(m))
end # module
|
nolta/Elliptic.jl
|
src/Elliptic.jl
|
Julia
|
mit
| 3,567
|
module Poseidon
module Protocol
class ResponseBuffer
def initialize(response)
@s = response
@pos = 0
end
def int8
byte = @s.slice(@pos, 1).unpack("C").first
@pos += 1
byte
end
def int16
short = @s.slice(@pos, 2).unpack("s>").first
@pos += 2
short
end
def int32
int = @s.slice(@pos, 4).unpack("l>").first
@pos += 4
int
end
def int64
long = @s.slice(@pos, 8).unpack("q>").first
@pos += 8
long
end
def string
len = int16
string = @s.slice(@pos, len)
@pos += len
string
end
def read(bytes)
data = @s.slice(@pos, bytes)
@pos += bytes
data
end
def peek(bytes)
@s.slice(@pos, bytes)
end
def bytes
n = int32
if n == -1
return nil
else
read(n)
end
end
def bytes_remaining
@s.bytesize - @pos
end
def eof?
@pos == @s.bytesize
end
def to_s
@s
end
end
end
end
|
SponsorPay/poseidon
|
lib/poseidon/protocol/response_buffer.rb
|
Ruby
|
mit
| 1,166
|
app.controller('GroupListCtlr', [
'$scope',
'$http',
'ToastFactory',
function($scope, $http, toast) {
$scope.pageSize = 20;
$scope.currentPage = 0;
$scope.getGroups = function() {
$http.get('/api/management/groups')
.success(function(data, status, headers, config) {
if (data.success) $scope.groups = data.result;
else toast.error(data.error);
})
.error(function(data, status, headers, config) {
toast.error(data);
})
;
};
$scope.delete = function(group) {
swal({
title: 'Confirm group deletion',
text: 'You are about to delete group \"' + group + '\". Continue?',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#DD6B55',
confirmButtonText: 'Confirm',
closeOnConfirm: true
}, function(){
toast.show('Deleting group \"' + group + '\" ...');
$http.delete('/api/management/groups/' + group)
.success(function(data, status, headers, config) {
if (data.success) {
toast.success('Group \"' + group + '\" deleted successfully!');
$scope.getGroups();
} else toast.error(data.error);
})
.error(function(data, status, headers, config) {
toast.error(data);
})
;
});
};
}
]);
|
stanier/coyot.io
|
src/scripts/controllers/management/group/list.js
|
JavaScript
|
mit
| 1,705
|
# Meteor Video Chat
This extension allows you to implement user-to-user video calling in React, Angular and Blaze.
This package now uses [RTCFly](https://github.com/rtcfly/rtcfly)
[Example with React](https://meteorvideochat.herokuapp.com)
[Click here for the React example source code.](https://github.com/elmarti/meteor-video-chat-example)
[Example with Blaze](https://blazevideochat.herokuapp.com)
[Click here for the Blaze example source code.](https://github.com/elmarti/blaze-video-chat)
[](http://waffle.io/elmarti/meteor-video-chat)
[](https://travis-ci.org/elmarti/meteor-video-chat)
[](https://codeclimate.com/github/elmarti/meteor-video-chat/maintainability)
## A note on previous versions
Meteor Video Chat used to use `Meteor.VideoCallServices`, however we have moved to a more modular system, opting for ES6 imports like so:
`import { VideoCallServices } from 'meteor/elmarti:video-chat';`
Old style code will be supported for the forseeable future, but we suggest moving over to the new format.
## Usage with asteroid
The Meteor Video Chat client can be used by first running `npm install meteor-video-chat`, and then using the following mixin import
```
import { AsteroidVideoChatMixin } from 'meteor-video-chat';
```
After including this as an Asteroid mixin, as per the Asteroid page, you can access it like so:
```
Asteroid.VideoCallServices;
```
## init
Here you can set the [RTCConfiguration](https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration). If you are testing outside of a LAN, you'll need to procure some [STUN & TURN](https://gist.github.com/yetithefoot/7592580) servers.
```
VideoCallServices.init({'iceServers': [{
'urls': 'stun:stun.example.org'
}]
});
```
#### Calling a user
To call a user, use the following method.
```
VideoCallServices.call(ICallParams);
```
These are the parameters that can be used:
```
interface ICallParams {
id:string; //ID of the callee
localElement: IHTMLMediaElement; //local HTMLElement
remoteElement: IHTMLMediaElement; //remote HTMLElement
video:boolean; //Do you want to show video?
audio:boolean; //Do you want to show audio?
}
```
#### Deciding who can connect to whom
The follow method can be overridden on the server side to implement some kind of filtering. Returning `false` will cancel the call, and `true` will allow it to go ahead.
```
VideoCallServices.checkConnect = function(caller, target){
return *can caller and target call each other"
};
```
#### Answering a call
The first step is to handle the onReceiveCall callback and then to accept the call. The answerCall method accepts the ICallParams interfaces, just like the "call" method above
```
VideoCallServices.onReceiveCall = (userId) => {
VideoCallServices.answerCall(ICallParams);
};
```
#### Muting local or remote videos
```
VideoCallServices.toggleLocalAudio();
VideoCallServices.toggleRemoteAudio();
```
#### Application state
The following values are stored in a reactive var
```
localMuted:boolean,
remoteMuted:boolean,
ringing:boolean,
inProgress:boolean
```
#### Getting the state
```
VideoCallServices.getState("localMuted");
```
#### Accessing the video (HTMLMediaElement) elements
```
const localVideo = VideoCallServices.getLocalVideo();
const remoteVideo = VideoCallServices.getRemoteVideo();
```
#### Ending call
Simply call
```
VideoCallServices.endCall();
```
#### Other events
The following method is invoked when the callee accepts the call.
```
VideoCallServices.onTargetAccept = () => {
}
```
The following method is invoked when either user ends the call
```
VideoCallServices.onTerminateCall = () => {
}
```
The following method invoked when the RTCPeerConnection instance has been created, making it possible to consitently mutate it or add a data channel
```
VideoCallServices.onPeerConnectionCreated = () => {
}
```
The following method is invoked on the caller browser when the callee rejects the call
```
VideoCallServices.onCallRejected = () => {
}
```
The following method is invoked on both the client and server whenever an error is caught.
User is only passed on the server
```
VideoCallServices.setOnError(callback);
```
The onError section can also be used for handling errors thrown when obtaining the user media (Webcam/audio).
[See here for more info](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia#Exceptions), or checkout the example.
This project is sponsored by the following:
[](https://www.browserstack.com/)
[](https://sentry.io/)
|
elmarti/meteor-video-chat
|
README.md
|
Markdown
|
mit
| 5,052
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.