code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
#include "Font.h"
#include "FontFamily.h"
#include "DWriteTypeConverter.h"
namespace MS { namespace Internal { namespace Text { namespace TextInterface
{
enum
{
Flags_VersionInitialized = 0x0001,
Flags_IsSymbolFontInitialized = 0x0002,
Flags_IsSymbolFontValue = 0x0004,
};
/// <SecurityNote>
/// Critical - Receives a native pointer and stores it internally.
/// This whole object is wrapped around the passed in pointer
/// So this ctor assumes safety of the passed in pointer.
/// </SecurityNote>
//[SecurityCritical] tagged in header file
Font::Font(
IDWriteFont* font
)
{
_font = gcnew NativeIUnknownWrapper<IDWriteFont>(font);
_version = System::Double::MinValue;
_flags = 0;
}
FontFace^ Font::AddFontFaceToCache()
{
FontFace^ fontFace = CreateFontFace();
FontFace^ bumpedFontFace = nullptr;
// NB: if the cache is busy, we simply return the new FontFace
// without bothering to cache it.
if (System::Threading::Interlocked::Increment(_mutex) == 1)
{
if (nullptr == _fontFaceCache)
{
_fontFaceCache = gcnew array<FontFaceCacheEntry>(_fontFaceCacheSize);
}
// Default to a slot that is not the MRU.
_fontFaceCacheMRU = (_fontFaceCacheMRU + 1) % _fontFaceCacheSize;
// Look for an empty slot.
for (int i=0; i < _fontFaceCacheSize; i++)
{
if (_fontFaceCache[i].font == nullptr)
{
_fontFaceCacheMRU = i;
break;
}
}
// Keep a reference to any discarded entry, clean it up after releasing
// the mutex.
bumpedFontFace = _fontFaceCache[_fontFaceCacheMRU].fontFace;
// Record the new entry.
_fontFaceCache[_fontFaceCacheMRU].font = this;
_fontFaceCache[_fontFaceCacheMRU].fontFace = fontFace;
fontFace->AddRef();
}
System::Threading::Interlocked::Decrement(_mutex);
// If the cache was full and we replaced an unreferenced entry, release it now.
if (bumpedFontFace != nullptr)
{
bumpedFontFace->Release();
}
return fontFace;
}
FontFace^ Font::LookupFontFaceSlow()
{
FontFace^ fontFace = nullptr;
for (int i=0; i < _fontFaceCacheSize; i++)
{
if (_fontFaceCache[i].font == this)
{
fontFace = _fontFaceCache[i].fontFace;
fontFace->AddRef();
_fontFaceCacheMRU = i;
break;
}
}
return fontFace;
}
void Font::ResetFontFaceCache()
{
array<FontFaceCacheEntry>^ fontFaceCache = nullptr;
// NB: If the cache is busy, we do nothing.
if (System::Threading::Interlocked::Increment(_mutex) == 1)
{
fontFaceCache = _fontFaceCache;
_fontFaceCache = nullptr;
}
System::Threading::Interlocked::Decrement(_mutex);
if (fontFaceCache != nullptr)
{
for (int i=0; i < _fontFaceCacheSize; i++)
{
if (fontFaceCache[i].fontFace != nullptr)
{
fontFaceCache[i].fontFace->Release();
}
}
}
}
FontFace^ Font::GetFontFace()
{
FontFace^ fontFace = nullptr;
if (System::Threading::Interlocked::Increment(_mutex) == 1)
{
if (_fontFaceCache != nullptr)
{
FontFaceCacheEntry entry;
// Try the fast path first -- is caller accessing exactly the mru entry?
if ((entry = _fontFaceCache[_fontFaceCacheMRU]).font == this)
{
entry.fontFace->AddRef();
fontFace = entry.fontFace;
}
else
{
// No luck, do a search through the cache.
fontFace = LookupFontFaceSlow();
}
}
}
System::Threading::Interlocked::Decrement(_mutex);
// If the cache was busy or did not contain this Font, create a new FontFace.
if (nullptr == fontFace)
{
fontFace = AddFontFaceToCache();
}
return fontFace;
}
/// <SecurityNote>
/// Critical - Exposes the critical member _font.
/// </SecurityNote>
[SecurityCritical]
System::IntPtr Font::DWriteFontAddRef::get()
{
_font->Value->AddRef();
return (System::IntPtr)_font->Value;
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontFamily^ Font::Family::get()
{
IDWriteFontFamily* dwriteFontFamily;
HRESULT hr = _font->Value->GetFontFamily(
&dwriteFontFamily
);
System::GC::KeepAlive(_font);
ConvertHresultToException(hr, "FontFamily^ Font::Family::get");
return gcnew FontFamily(dwriteFontFamily);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontWeight Font::Weight::get()
{
DWRITE_FONT_WEIGHT dwriteFontWeight = _font->Value->GetWeight();
System::GC::KeepAlive(_font);
return DWriteTypeConverter::Convert(dwriteFontWeight);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontStretch Font::Stretch::get()
{
DWRITE_FONT_STRETCH dwriteFontStretch = _font->Value->GetStretch();
System::GC::KeepAlive(_font);
return DWriteTypeConverter::Convert(dwriteFontStretch);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontStyle Font::Style::get()
{
DWRITE_FONT_STYLE dwriteFontStyle = _font->Value->GetStyle();
System::GC::KeepAlive(_font);
return DWriteTypeConverter::Convert(dwriteFontStyle);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) bool Font::IsSymbolFont::get()
{
if ((_flags & Flags_IsSymbolFontInitialized) != Flags_IsSymbolFontInitialized)
{
BOOL isSymbolFont = _font->Value->IsSymbolFont();
System::GC::KeepAlive(_font);
_flags |= Flags_IsSymbolFontInitialized;
if (isSymbolFont)
{
_flags |= Flags_IsSymbolFontValue;
}
}
return ((_flags & Flags_IsSymbolFontValue) == Flags_IsSymbolFontValue);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer and calls
/// Security Critical LocalizedStrings ctor.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) LocalizedStrings^ Font::FaceNames::get()
{
IDWriteLocalizedStrings* dwriteLocalizedStrings;
HRESULT hr = _font->Value->GetFaceNames(
&dwriteLocalizedStrings
);
System::GC::KeepAlive(_font);
ConvertHresultToException(hr, "LocalizedStrings^ Font::FaceNames::get");
return gcnew LocalizedStrings(dwriteLocalizedStrings);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) bool Font::GetInformationalStrings(
InformationalStringID informationalStringID,
[System::Runtime::InteropServices::Out] LocalizedStrings^% informationalStrings
)
{
IDWriteLocalizedStrings* dwriteInformationalStrings;
BOOL exists = FALSE;
HRESULT hr = _font->Value->GetInformationalStrings(
DWriteTypeConverter::Convert(informationalStringID),
&dwriteInformationalStrings,
&exists
);
System::GC::KeepAlive(_font);
ConvertHresultToException(hr, "bool Font::GetInformationalStrings");
informationalStrings = gcnew LocalizedStrings(dwriteInformationalStrings);
return (!!exists);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontSimulations Font::SimulationFlags::get()
{
DWRITE_FONT_SIMULATIONS dwriteFontSimulations = _font->Value->GetSimulations();
System::GC::KeepAlive(_font);
return DWriteTypeConverter::Convert(dwriteFontSimulations);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontMetrics^ Font::Metrics::get()
{
if (_fontMetrics == nullptr)
{
DWRITE_FONT_METRICS fontMetrics;
_font->Value->GetMetrics(
&fontMetrics
);
System::GC::KeepAlive(_font);
_fontMetrics = DWriteTypeConverter::Convert(fontMetrics);
}
return _fontMetrics;
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) bool Font::HasCharacter(
UINT32 unicodeValue
)
{
BOOL exists = FALSE;
HRESULT hr = _font->Value->HasCharacter(
unicodeValue,
&exists
);
System::GC::KeepAlive(_font);
ConvertHresultToException(hr, "bool Font::HasCharacter");
return (!!exists);
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer and calls
/// security critical FontFace ctor.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontFace^ Font::CreateFontFace()
{
IDWriteFontFace* dwriteFontFace;
HRESULT hr = _font->Value->CreateFontFace(
&dwriteFontFace
);
System::GC::KeepAlive(_font);
ConvertHresultToException(hr, "FontFace^ Font::CreateFontFace");
return gcnew FontFace(dwriteFontFace);
}
double Font::Version::get()
{
if ((_flags & Flags_VersionInitialized) != Flags_VersionInitialized)
{
LocalizedStrings^ versionNumbers;
double version = 0.0;
if (GetInformationalStrings(InformationalStringID::VersionStrings, versionNumbers))
{
String^ versionString = versionNumbers->GetString(0);
// The following logic assumes that the version string is always formatted in this way: "Version X.XX"
if(versionString->Length > 1)
{
versionString = versionString->Substring(versionString->LastIndexOf(' ') + 1);
if (!System::Double::TryParse(versionString, System::Globalization::NumberStyles::Float, System::Globalization::CultureInfo::InvariantCulture, version))
{
version = 0.0;
}
}
}
_flags |= Flags_VersionInitialized;
_version = version;
}
return _version;
}
/// <SecurityNote>
/// Critical - Uses security critical _font pointer.
/// Safe - It does not expose the pointer it uses.
/// </SecurityNote>
[SecuritySafeCritical]
__declspec(noinline) FontMetrics^ Font::DisplayMetrics(FLOAT emSize, FLOAT pixelsPerDip)
{
DWRITE_FONT_METRICS fontMetrics;
IDWriteFontFace* fontFace = NULL;
HRESULT hr = _font->Value->CreateFontFace(&fontFace);
ConvertHresultToException(hr, "FontMetrics^ Font::DisplayMetrics");
DWRITE_MATRIX transform = Factory::GetIdentityTransform();
hr = fontFace->GetGdiCompatibleMetrics(
emSize,
pixelsPerDip,
&transform,
&fontMetrics
);
if (fontFace != NULL)
{
fontFace->Release();
}
ConvertHresultToException(hr, "FontMetrics^ Font::DisplayMetrics");
System::GC::KeepAlive(_font);
return DWriteTypeConverter::Convert(fontMetrics);
}
}}}}//MS::Internal::Text::TextInterface
| mind0n/hive | Cache/Libs/net46/wpf/src/Core/cpp/dwritewrapper/font.cpp | C++ | mit | 14,109 |
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<!-- Refrence
https://silviomoreto.github.io/bootstrap-select/examples/
Bootstrap-select example
https://codepen.io/Rio517/pen/NPLbpP/
-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/css/bootstrap-select.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/bootstrap-select.min.js"></script>
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.12.2/js/i18n/defaults-*.min.js"></script>-->
<!-- BEGIN PAGE BREADCRUMBS -->
<ul class="page-breadcrumb breadcrumb">
<li>
<a href="<?php echo base_url(); ?>contracts"> قائمة العقود </a>
<i class="fa fa-circle"></i>
</li>
<li>
<span> <?= $title ?> </span>
</li>
</ul>
<!-- END PAGE BREADCRUMBS -->
<?php echo form_open_multipart('contracts/create'); date_default_timezone_set('Asia/Riyadh'); ?>
<div class="row">
<div class="well content">
<div class="col-md-12">
<h1 class="text-center"><?= $title; ?></h1>
<div class="form-group">
<label> المالك </label>
<select style="height:50px;" name="owner" class="form-control" id="select">
<option></option>
<?php foreach($owners as $owner) : ?>
<option value="<?php echo $owner['ow_name']; ?>"><?php echo $owner['ow_name']; ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label> اسم المستأجر </label>
<input type="text" class="form-control" value="<?php echo set_value('co_rental'); ?>" name="co_rental" placeholder=" المستأجر ">
</div>
<div class="form-group">
<label>الجوال</label>
<input type="text" class="form-control" value="<?php echo set_value('co_mobile'); ?>" name="co_mobile" placeholder="الجوال">
</div>
<div class="form-group">
<label> شقة رقم </label>
<input type="text" class="form-control" value="<?php echo set_value('co_flat'); ?>" name="co_flat" placeholder="رقم الشقة">
</div>
<div class="form-group">
<label>تاريخ بداية العقد</label>
<input type="date" class="form-control" value="<?php echo set_value('co_start'); ?>" name="co_start" placeholder="بداية العقد">
</div>
<div class="form-group">
<label>تاريخ نهاية العقد</label>
<input type="date" class="form-control" value="<?php echo set_value('co_end'); ?>" name="co_end" placeholder="نهاية العقد">
</div>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary btn-block1 ">حفظ</button>
</div>
</div>
</div>
</form>
<script>
CKEDITOR.replace( 'editor1' );
</script> | ecoder36/daralsahab | application/views/aqar/form.php | PHP | mit | 3,108 |
<!DOCTYPE html>
<html>
<head>
<link href="/_dependencies/normalize.min.css" rel="stylesheet" type="text/css" />
<link href="/_dependencies/foundation.min.css" rel="stylesheet" type="text/css" />
<script src="/_dependencies/modernizr.min.js"></script>
<script src="/_dependencies/jquery.min.js"></script>
<script src="/_dependencies/foundation.min.js"></script>
<link rel="stylesheet" href="/style.css" />
<meta charset="utf-8">
<meta name="viewport" content="minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no" />
<title>Snowtooth Ski Resort</title>
</head>
<body>
<h1>Snowtooth Mountain</h1>
<main>
<header>
<section id="related">
<h2>Related Links</h2>
<ul class="row">
<li class="small-4 columns"><a href="#">Our Sites</a></li>
<li class="small-4 columns"><a href="#">Account</a></li>
<li class="small-4 columns"><a href="#">Cart</a></li>
</ul>
<div class="row logo">
<img class="small-offset-1 small-2 medium-offset-4 medium-2" src="http://www.moonhighway.com/class/assets/snowtooth/snowflake-logo.png" alt="">
<span class="small-9 medium-6">Snowtooth</span>
</div>
<div class="img-get-some row">
<img class="small-12 columns" data-interchange="[/img/get-some-sm.jpg, (default)],
[/img/get-some-sm.jpg, (small)],
[/img/get-some-md.jpg, (medium)],
[/img/get-some-lg.jpg, (large)]" />
</div>
</section>
</header>
<nav class="row">
<h2>Site Navigation</h2>
<div class="small-12 medium-6 large-3 columns">
<a href="#">The Resort</a>
</div>
<div class="small-12 medium-6 large-3 columns">
<a href="#">Rentals</a>
</div>
<div class="small-12 medium-6 large-3 columns">
<a href="#">The Mountain</a>
</div>
<div class="small-12 medium-6 large-3 columns">
<a href="#">Contact</a>
</div>
</nav>
<section id="main-image">
<h2>Get Some</h2>
</section>
<section id="calendar" class="row">
<h1>Events Calendar</h1>
<section id="learn" class="small-12 medium-6 large-3 columns">
<a class="th small-4 large-12 columns" href="#">
<img src="/img/lessons.png" alt="children skiing">
</a>
<h1 class="small-8 large-12 columns">Learn</h1>
<p class="small-8 large-12 columns">jan 24 - feb 10</p>
<p class="small-8 large-12 columns">Our learn to ride packages provide everything you need to master the mountain.</p>
</section>
<section id="music" class="small-12 medium-6 large-3 columns">
<a class="th small-4 large-12 columns" href="#">
<img src="/img/band.png" alt="A bluegrass band playing music">
</a>
<h1 class="small-8 large-12 columns">Music</h1>
<p class="small-8 large-12 columns">feb 12 & feb 14</p>
<p class="small-8 large-12 columns">Join us in welcoming Sierra bluegrass sensation Green Sky for two nights in February.</p>
</section>
<section id="play" class="small-12 medium-6 large-3 columns">
<a class="th small-4 large-12 columns" href="#">
<img src="/img/kids.png" alt="children skiing">
</a>
<h1 class="small-8 large-12 columns">Play</h1>
<p class="small-8 large-12 columns">mar 2 - apr 30</p>
<p class="small-8 large-12 columns">Kids ride free every Monday-Thursday this spring. Join us for a full day of fun.</p>
</section>
<section id="stay" class="small-12 medium-6 large-3 columns">
<a class="th small-4 large-12 columns" href="#">
<img src="/img/hotel.png" alt="a snowey hotel">
</a>
<h1 class="small-8 large-12 columns">Stay</h1>
<p class="small-8 large-12 columns">apr 21 - may 30</p>
<p class="small-8 large-12 columns">Save up to 40% with advance booking. Mountain views, hot spas, and luxury linens.</p>
</section>
</section>
<section id="quotes" class="row">
<blockquote class="small-offset-2 small-8 small-offset-2">
High speed lifts and no lines. Nice.
<cite>Charley C</cite>
</blockquote>
<blockquote class="small-offset-2 small-8 small-offset-2">
I really like the all day lessons for kids. That way my husband and I get to go skiing
<cite>Mary Mom</cite>
</blockquote>
</section>
<footer>
<h2>Legal Information</h2>
<p>© 2015, Snowtooth Holdings, LLC</p>
</footer>
</main>
<script src="/main.js"></script>
</body>
</html> | MoonHighway/node-js-kickoff | lab-snowtooth-express/public/index.html | HTML | mit | 5,050 |
package integration;
import com.cookingfox.lapasse.annotation.HandleCommand;
import com.cookingfox.lapasse.annotation.HandleEvent;
import com.cookingfox.lapasse.api.command.Command;
import com.cookingfox.lapasse.api.state.State;
import com.cookingfox.lapasse.compiler.LaPasseAnnotationProcessor;
import com.squareup.javapoet.AnnotationSpec;
import com.squareup.javapoet.ClassName;
import com.squareup.javapoet.MethodSpec;
import com.squareup.javapoet.ParameterizedTypeName;
import fixtures.example.command.IncrementCount;
import fixtures.example.event.CountIncremented;
import fixtures.example.state.CountState;
import fixtures.example2.command.ExampleCommand;
import fixtures.example2.event.ExampleEvent;
import fixtures.example2.state.ExampleState;
import org.junit.Test;
import rx.Observable;
import javax.lang.model.element.Modifier;
import java.util.Collection;
import java.util.concurrent.Callable;
import static com.cookingfox.lapasse.compiler.LaPasseAnnotationProcessor.VAR_COMMAND;
import static com.cookingfox.lapasse.compiler.LaPasseAnnotationProcessor.VAR_STATE;
import static integration.IntegrationTestHelper.*;
/**
* Integration tests for {@link LaPasseAnnotationProcessor} and {@link HandleCommand} processor
* errors.
*/
public class HandleCommandErrorTest {
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD NOT ACCESSIBLE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_not_accessible() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addModifiers(Modifier.PRIVATE)
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Method is not accessible");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD ALSO HAS EVENT ANNOTATION
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_also_has_event_annotation() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addAnnotation(HandleEvent.class)
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(CountIncremented.class)
.build();
assertCompileFails(createSource(method),
"Annotated handler method can not have both a command and an event annotation");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER THROWS
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_throws() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addException(Exception.class)
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Handler methods are not allowed to declare a `throws` clause.");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD PARAMS INVALID NUMBER
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_params_invalid_number() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.addParameter(String.class, "foo")
.returns(CountIncremented.class)
.build();
assertCompileFails(createSource(method),
"Method parameters are invalid (expected State and Command");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD PARAMS BOTH INVALID TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_params_both_invalid_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(String.class, "foo")
.addParameter(Object.class, "bar")
.build();
assertCompileFails(createSource(method),
"Method parameters are invalid (expected State and Command");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD PARAMS COMMAND AND INVALID TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_params_command_and_invalid_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(IncrementCount.class, VAR_COMMAND)
.addParameter(String.class, "foo")
.build();
assertCompileFails(createSource(method),
"Method parameters are invalid (expected State and Command");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER METHOD PARAMS STATE AND INVALID TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_method_params_state_and_invalid_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(String.class, "foo")
.build();
assertCompileFails(createSource(method),
"Method parameters are invalid (expected State and Command");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAM STATE BASE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_param_state_base_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(State.class, VAR_STATE)
.build();
assertCompileFails(createSource(method),
"State parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAMS STATE BASE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_params_state_base_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(State.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"State parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAMS STATE BASE TYPE DIFFERENT ORDER
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_params_state_base_type_different_order() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(IncrementCount.class, VAR_COMMAND)
.addParameter(State.class, VAR_STATE)
.build();
assertCompileFails(createSource(method),
"State parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAM COMMAND BASE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_param_command_base_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(Command.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Command parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAMS COMMAND BASE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_params_command_base_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(Command.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Command parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER INVALID METHOD PARAMS COMMAND BASE TYPE DIFFERENT ORDER
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_invalid_method_params_command_base_type_different_order() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(Command.class, VAR_COMMAND)
.addParameter(CountState.class, VAR_STATE)
.build();
assertCompileFails(createSource(method),
"Command parameter cannot be the base type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE NOT DECLARED
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_not_declared() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ClassName.bestGuess("FooBarBaz"))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(Boolean.class)
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID COLLECTION TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid_collection_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ParameterizedTypeName.get(Collection.class, String.class))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID CALLABLE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid_callable_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ParameterizedTypeName.get(Callable.class, String.class))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID OBSERVABLE TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid_observable_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ParameterizedTypeName.get(Observable.class, String.class))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID CALLABLE COLLECTION TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid_callable_collection_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ParameterizedTypeName.get(ClassName.get(Callable.class),
ParameterizedTypeName.get(Collection.class, String.class)))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER RETURN TYPE INVALID OBSERVABLE COLLECTION TYPE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_return_type_invalid_observable_collection_type() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(ParameterizedTypeName.get(ClassName.get(Observable.class),
ParameterizedTypeName.get(Collection.class, String.class)))
.build();
assertCompileFails(createSource(method),
"Command handler has an invalid return type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER NO METHOD OR ANNOTATION PARAMS
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_no_method_or_annotation_params() throws Exception {
MethodSpec method = createHandleCommandMethod()
.build();
assertCompileFails(createSource(method),
"Could not determine command type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER STATE NOT DETERMINABLE
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_state_not_determinable() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Can not determine target state");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER COMMAND NOT DETERMINABLE ONLY STATE METHOD PARAM
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_command_not_determinable_only_state_method_param() throws Exception {
MethodSpec method = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.build();
assertCompileFails(createSource(method),
"Could not determine command type");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER CONFLICT ANNOTATION METHOD COMMAND PARAM
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_conflict_annotation_method_command_param() throws Exception {
AnnotationSpec annotation = AnnotationSpec.builder(HandleCommand.class)
.addMember(VAR_COMMAND, "$T.class", ExampleCommand.class)
.build();
MethodSpec method = createHandlerMethod(annotation)
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Annotation parameter for command");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLER CONFLICT ANNOTATION METHOD STATE PARAM
//----------------------------------------------------------------------------------------------
@Test
public void command_handler_conflict_annotation_method_state_param() throws Exception {
AnnotationSpec annotation = AnnotationSpec.builder(HandleCommand.class)
.addMember(VAR_STATE, "$T.class", ExampleState.class)
.build();
MethodSpec method = createHandlerMethod(annotation)
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.build();
assertCompileFails(createSource(method),
"Annotation parameter for state");
}
//----------------------------------------------------------------------------------------------
// COMMAND HANDLERS TARGET STATE CONFLICT
//----------------------------------------------------------------------------------------------
@Test
public void command_handlers_target_state_conflict() throws Exception {
MethodSpec method1 = createHandleCommandMethod()
.addParameter(CountState.class, VAR_STATE)
.addParameter(IncrementCount.class, VAR_COMMAND)
.returns(CountIncremented.class)
.build();
MethodSpec method2 = createHandleCommandMethod()
.addParameter(ExampleState.class, VAR_STATE)
.addParameter(ExampleCommand.class, VAR_COMMAND)
.returns(ExampleEvent.class)
.build();
assertCompileFails(createSource(method1, method2),
"Mapped command handler does not match expected concrete State");
}
}
| cookingfox/lapasse-java | lapasse-compiler/src/test/java/integration/HandleCommandErrorTest.java | Java | mit | 20,354 |
/* ** GENEREATED FILE - DO NOT MODIFY ** */
package com.wilutions.mslib.msforms;
import com.wilutions.com.*;
/**
* OLE_COLOR.
*
*/
@SuppressWarnings("all")
public class OLE_COLOR {
static boolean __typelib__loaded = __TypeLib.load();
private Integer value;
public OLE_COLOR() {}
public OLE_COLOR(Integer v) { this.value = value; }
public Integer getValue() { return value; }
public void setValue(Integer v) { value = v;}
}
| wolfgangimig/joa | java/joa/src-gen/com/wilutions/mslib/msforms/OLE_COLOR.java | Java | mit | 457 |
require 'spec'
require 'spec/autorun'
require File.dirname(__FILE__) + '/../lib/vraptor-scaffold'
def build_attributes
[Attribute.new("name", "string"), Attribute.new("flag", "boolean")]
end
def mock_config_file
file = YAML.load_file File.join( File.dirname(__FILE__), "resources", "vraptor-scaffold.properties")
Configuration.stub!(:config).and_return(file)
end
| rodolfoliviero/vraptor-scaffold | spec/spec_helper.rb | Ruby | mit | 371 |
FROM php:5.6-apache
# Install missing PHP extensions
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev \
libxslt1-dev \
libxml2-dev \
zlib1g-dev \
libicu-dev \
g++ \
git \
&& docker-php-ext-install mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-install mbstring \
&& docker-php-ext-install pdo_mysql \
&& docker-php-ext-install xsl \
&& docker-php-ext-configure intl && docker-php-ext-install intl \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pecl install apcu-beta && echo extension=apcu.so > $PHP_INI_DIR/conf.d/apcu.ini
# Apache configuration
RUN a2enmod rewrite
COPY docker/apache/vhost.conf /etc/apache2/sites-enabled/default.conf
COPY docker/php/app.ini $PHP_INI_DIR/conf.d/
# Download Composer
RUN curl -sS https://getcomposer.org/installer | php \
&& mv composer.phar /usr/bin/composer
# Add the application
ADD . /app
WORKDIR /app
# Run installation
#RUN composer install --no-iteraction --optimize-autoloader
| mareg/legacy-summercamp-2015 | Dockerfile | Dockerfile | mit | 1,225 |
/**
* Created by lsc on 2014/11/29.
*/
define(['backbone'],function(Backbone){
return Backbone.Model.extend({
initialize:function(opt){
this.set({
name:opt.name,
url:opt.url,
isChecked:opt.isChecked
});
}
});
}); | skyujilong/diagnosisDemo | public/js/model/head-menu.js | JavaScript | mit | 310 |
# frozen_string_literal: true
require 'saml2/base'
require 'saml2/namespaces'
module SAML2
class NameID < Base
module Format
EMAIL_ADDRESS = "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
ENTITY = "urn:oasis:names:tc:SAML:2.0:nameid-format:entity"
KERBEROS = "urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos" # name[/instance]@REALM
PERSISTENT = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" # opaque, pseudo-random, unique per SP-IdP pair
TRANSIENT = "urn:oasis:names:tc:SAML:2.0:nameid-format:transient" # opaque, will likely change
UNSPECIFIED = "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"
WINDOWS_DOMAIN_QUALIFIED_NAME = "urn:oasis:names:tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName" # [DomainName\]UserName
X509_SUBJECT_NAME = "urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName"
end
class Policy < Base
# @return [Boolean, nil]
attr_writer :allow_create
attr_writer :format, :sp_name_qualifier
# @param allow_create optional [Boolean]
# @param format optional [String]
# @param sp_name_qualifier optional [String]
def initialize(allow_create = nil, format = nil, sp_name_qualifier = nil)
@allow_create = allow_create if allow_create
@format = format if format
@sp_name_qualifier = sp_name_qualifier if sp_name_qualifier
end
# @return [Boolean, nil]
def allow_create?
if xml && !instance_variable_defined?(:@allow_create)
@allow_create = xml['AllowCreate']&.== 'true'
end
@allow_create
end
# @see Format
# @return [String, nil]
def format
if xml && !instance_variable_defined?(:@format)
@format = xml['Format']
end
@format
end
# @return [String, nil]
def sp_name_qualifier
if xml && !instance_variable_defined?(:@sp_name_qualifier)
@sp_name_qualifier = xml['SPNameQualifier']
end
@sp_name_qualifier
end
# @param rhs [Policy]
# @return [Boolean]
def ==(rhs)
allow_create? == rhs.allow_create? &&
format == rhs.format &&
sp_name_qualifier == rhs.sp_name_qualifier
end
# (see Base#build)
def build(builder)
builder['samlp'].NameIDPolicy do |name_id_policy|
name_id_policy.parent['Format'] = format if format
name_id_policy.parent['SPNameQualifier'] = sp_name_qualifier if sp_name_qualifier
name_id_policy.parent['AllowCreate'] = allow_create? unless allow_create?.nil?
end
end
end
# @return [String]
attr_accessor :id
# @return [String, nil]
attr_accessor :format, :name_qualifier, :sp_name_qualifier
# (see Base#from_xml)
def from_xml(node)
self.id = node.content.strip
self.format = node['Format']
self.name_qualifier = node['NameQualifier']
self.sp_name_qualifier = node['SPNameQualifier']
end
# @param id [String]
# @param format optional [String]
# @param name_qualifier optional [String]
# @param sp_name_qualifier optional [String]
def initialize(id = nil, format = nil, name_qualifier: nil, sp_name_qualifier: nil)
@id, @format, @name_qualifier, @sp_name_qualifier =
id, format, name_qualifier, sp_name_qualifier
end
# @param rhs [NameID]
# @return [Boolean]
def ==(rhs)
id == rhs.id &&
format == rhs.format &&
name_qualifier == rhs.name_qualifier &&
sp_name_qualifier == rhs.sp_name_qualifier
end
# (see Base#build)
def build(builder, element: nil)
args = {}
args['Format'] = format if format
args['NameQualifier'] = name_qualifier if name_qualifier
args['SPNameQualifier'] = sp_name_qualifier if sp_name_qualifier
builder['saml'].__send__(element || 'NameID', id, args)
end
end
end
| instructure/ruby-saml2 | lib/saml2/name_id.rb | Ruby | mit | 4,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from time import sleep
from gator import db
from gator.models import News
import cookielib, json, urllib2
class SocialNetwork():
cookie = cookielib.CookieJar()
headers = [('User-agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36'),
('Accept', 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8')]
def json(self, link):
try:
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie))
opener.addheaders = self.headers
if isinstance(link, unicode):
link = link.encode('utf-8')
socket = opener.open(link)
content = socket.read()
socket.close()
return json.loads(content)
except:
return None
def run(self):
i = 1
while i:
if i % 256 == 0: self.__update(9)
elif i % 128 == 0: self.__update(8)
elif i % 64 == 0: self.__update(7)
elif i % 32 == 0: self.__update(6)
elif i % 16 == 0: self.__update(5)
elif i % 8 == 0: self.__update(4)
elif i % 4 == 0: self.__update(3)
elif i % 2 == 0: self.__update(2)
else: self.__update(1)
i += 1
sleep(self.check_interval)
def update(self, start, end):
news = News.objects(created_at__gt=end,
created_at__lte=start,
shares__social_network__ne=self.name).first()
if not news:
news = News.objects(created_at__gt=end,
created_at__lte=start).order_by('shares__update').first()
if news:
count = self.get(news.link)
try:
social_network = news.shares.get(social_network=self.name)
if count > social_network.count:
social_network.change = count - social_network.count
social_network.count = count
social_network.update = datetime.now()
social_network.save()
except db.DoesNotExist:
news.shares.create(social_network=self.name,
count = count,
update = datetime.now(),
change = count)
news.save()
def __update(self, lvl):
if lvl == 1: start = datetime.now()
else: start = datetime.now() - timedelta(hours=2**(lvl-1))
end = datetime.now() - timedelta(hours=2**lvl)
self.update(start, end)
| cuteredcat/gator | shares/__init__.py | Python | mit | 2,773 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Phaser Source: src/pixi/renderers/webgl/shaders/ComplexPrimitiveShader.js</title>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/default.css">
<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">
<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">
</head>
<body>
<div class="container-fluid">
<div class="navbar navbar-fixed-top navbar-inverse">
<div style="position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050"><a href="http://phaser.io"><img src="img/phaser.png" border="0" /></a></div>
<div class="navbar-inner">
<a class="brand" href="index.html">Phaser API</a>
<ul class="nav">
<li class="dropdown">
<a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="Phaser.html">Phaser</a>
</li>
<li class="class-depth-0">
<a href="PIXI.html">PIXI</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="classes.list.html" class="dropdown-toggle" data-toggle="dropdown">Classes<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="EarCut.html">EarCut</a>
</li>
<li class="class-depth-0">
<a href="Event.html">Event</a>
</li>
<li class="class-depth-0">
<a href="EventTarget.html">EventTarget</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Animation.html">Animation</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationManager.html">AnimationManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AnimationParser.html">AnimationParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArraySet.html">ArraySet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ArrayUtils.html">ArrayUtils</a>
</li>
<li class="class-depth-1">
<a href="Phaser.AudioSprite.html">AudioSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapData.html">BitmapData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Bullet.html">Bullet</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Button.html">Button</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Cache.html">Cache</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Camera.html">Camera</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Canvas.html">Canvas</a>
</li>
<li class="class-depth-1">
<a href="Phaser.CanvasPool.html">CanvasPool</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Angle.html">Angle</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Animation.html">Animation</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.AutoCull.html">AutoCull</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Bounds.html">Bounds</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.BringToTop.html">BringToTop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Core.html">Core</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Crop.html">Crop</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Delta.html">Delta</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Destroy.html">Destroy</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Health.html">Health</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InCamera.html">InCamera</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InputEnabled.html">InputEnabled</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.InWorld.html">InWorld</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LifeSpan.html">LifeSpan</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.LoadTexture.html">LoadTexture</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Overlap.html">Overlap</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Reset.html">Reset</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Component.Smoothed.html">Smoothed</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Create.html">Create</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Creature.html">Creature</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DeviceButton.html">DeviceButton</a>
</li>
<li class="class-depth-1">
<a href="Phaser.DOM.html">DOM</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Easing.html">Easing</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Back.html">Back</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Bounce.html">Bounce</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Circular.html">Circular</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Cubic.html">Cubic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Elastic.html">Elastic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Exponential.html">Exponential</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Linear.html">Linear</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quadratic.html">Quadratic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quartic.html">Quartic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Quintic.html">Quintic</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Events.html">Events</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Filter.html">Filter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexGrid.html">FlexGrid</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FlexLayer.html">FlexLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Frame.html">Frame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.FrameData.html">FrameData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Game.html">Game</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectCreator.html">GameObjectCreator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.GameObjectFactory.html">GameObjectFactory</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Gamepad.html">Gamepad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Group.html">Group</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Hermite.html">Hermite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Image.html">Image</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ImageCollection.html">ImageCollection</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Input.html">Input</a>
</li>
<li class="class-depth-1">
<a href="Phaser.InputHandler.html">InputHandler</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Key.html">Key</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Keyboard.html">Keyboard</a>
</li>
<li class="class-depth-1">
<a href="Phaser.KeyCode.html">KeyCode</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Line.html">Line</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LinkedList.html">LinkedList</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Loader.html">Loader</a>
</li>
<li class="class-depth-1">
<a href="Phaser.LoaderParser.html">LoaderParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Math.html">Math</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Mouse.html">Mouse</a>
</li>
<li class="class-depth-1">
<a href="Phaser.MSPointer.html">MSPointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Net.html">Net</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particle.html">Particle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Particles.html">Particles</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Particles.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Path.html">Path</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PathFollower.html">PathFollower</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PathPoint.html">PathPoint</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Physics.html">Physics</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Arcade.html">Arcade</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.Ninja.html">Ninja</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.AABB.html">AABB</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Circle.html">Circle</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.Ninja.Tile.html">Tile</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Physics.P2.html">P2</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Body.html">Body</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Material.html">Material</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a>
</li>
<li class="class-depth-3">
<a href="Phaser.Physics.P2.Spring.html">Spring</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Plugin.html">Plugin</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Plugin.PathManager.html">PathManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PluginManager.html">PluginManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Pointer.html">Pointer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.PointerMode.html">PointerMode</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.QuadTree.html">QuadTree</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RetroFont.html">RetroFont</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="Phaser.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.ScaleManager.html">ScaleManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Signal.html">Signal</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SignalBinding.html">SignalBinding</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SinglePad.html">SinglePad</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sound.html">Sound</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SoundManager.html">SoundManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="Phaser.State.html">State</a>
</li>
<li class="class-depth-1">
<a href="Phaser.StateManager.html">StateManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tile.html">Tile</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tilemap.html">Tilemap</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapLayer.html">TilemapLayer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TilemapParser.html">TilemapParser</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tileset.html">Tileset</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TileSprite.html">TileSprite</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Time.html">Time</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Timer.html">Timer</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TimerEvent.html">TimerEvent</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Touch.html">Touch</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Tween.html">Tween</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenData.html">TweenData</a>
</li>
<li class="class-depth-1">
<a href="Phaser.TweenManager.html">TweenManager</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Utils.html">Utils</a>
</li>
<li class="class-depth-2">
<a href="Phaser.Utils.Debug.html">Debug</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Video.html">Video</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Weapon.html">Weapon</a>
</li>
<li class="class-depth-1">
<a href="Phaser.World.html">World</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasBuffer.html">CanvasBuffer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasGraphics.html">CanvasGraphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasRenderer.html">CanvasRenderer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasTinter.html">CanvasTinter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObject.html">DisplayObject</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterTexture.html">FilterTexture</a>
</li>
<li class="class-depth-2">
<a href="PIXI.Phaser.GraphicsData.html">Phaser.GraphicsData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PIXI.html">PIXI</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiFastShader.html">PixiFastShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiShader.html">PixiShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.StripShader.html">StripShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Texture.html">Texture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b
class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-0">
<a href="global.html#ANGLE_DOWN">ANGLE_DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_LEFT">ANGLE_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_EAST">ANGLE_NORTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_NORTH_WEST">ANGLE_NORTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_RIGHT">ANGLE_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_EAST">ANGLE_SOUTH_EAST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_SOUTH_WEST">ANGLE_SOUTH_WEST</a>
</li>
<li class="class-depth-0">
<a href="global.html#ANGLE_UP">ANGLE_UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#arc">arc</a>
</li>
<li class="class-depth-0">
<a href="global.html#AUTO">AUTO</a>
</li>
<li class="class-depth-0">
<a href="global.html#beginFill">beginFill</a>
</li>
<li class="class-depth-0">
<a href="global.html#bezierCurveTo">bezierCurveTo</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPDATA">BITMAPDATA</a>
</li>
<li class="class-depth-0">
<a href="global.html#BITMAPTEXT">BITMAPTEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#blendModes">blendModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_CENTER">BOTTOM_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_LEFT">BOTTOM_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BOTTOM_RIGHT">BOTTOM_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#BUTTON">BUTTON</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS">CANVAS</a>
</li>
<li class="class-depth-0">
<a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CENTER">CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#CIRCLE">CIRCLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#clear">clear</a>
</li>
<li class="class-depth-0">
<a href="global.html#CREATURE">CREATURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#destroyCachedSprite">destroyCachedSprite</a>
</li>
<li class="class-depth-0">
<a href="global.html#displayList">displayList</a>
</li>
<li class="class-depth-0">
<a href="global.html#DOWN">DOWN</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawCircle">drawCircle</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawEllipse">drawEllipse</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawPolygon">drawPolygon</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawRect">drawRect</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawRoundedRect">drawRoundedRect</a>
</li>
<li class="class-depth-0">
<a href="global.html#drawShape">drawShape</a>
</li>
<li class="class-depth-0">
<a href="global.html#ELLIPSE">ELLIPSE</a>
</li>
<li class="class-depth-0">
<a href="global.html#emit">emit</a>
</li>
<li class="class-depth-0">
<a href="global.html#EMITTER">EMITTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#endFill">endFill</a>
</li>
<li class="class-depth-0">
<a href="global.html#GAMES">GAMES</a>
</li>
<li class="class-depth-0">
<a href="global.html#generateTexture">generateTexture</a>
</li>
<li class="class-depth-0">
<a href="global.html#getBounds">getBounds</a>
</li>
<li class="class-depth-0">
<a href="global.html#getLocalBounds">getLocalBounds</a>
</li>
<li class="class-depth-0">
<a href="global.html#GRAPHICS">GRAPHICS</a>
</li>
<li class="class-depth-0">
<a href="global.html#GROUP">GROUP</a>
</li>
<li class="class-depth-0">
<a href="global.html#HEADLESS">HEADLESS</a>
</li>
<li class="class-depth-0">
<a href="global.html#HORIZONTAL">HORIZONTAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#IMAGE">IMAGE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LANDSCAPE">LANDSCAPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT">LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_BOTTOM">LEFT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_CENTER">LEFT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#LEFT_TOP">LEFT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#LINE">LINE</a>
</li>
<li class="class-depth-0">
<a href="global.html#lineStyle">lineStyle</a>
</li>
<li class="class-depth-0">
<a href="global.html#lineTo">lineTo</a>
</li>
<li class="class-depth-0">
<a href="global.html#listeners">listeners</a>
</li>
<li class="class-depth-0">
<a href="global.html#MATRIX">MATRIX</a>
</li>
<li class="class-depth-0">
<a href="global.html#mixin">mixin</a>
</li>
<li class="class-depth-0">
<a href="global.html#moveTo">moveTo</a>
</li>
<li class="class-depth-0">
<a href="global.html#NONE">NONE</a>
</li>
<li class="class-depth-0">
<a href="global.html#off">off</a>
</li>
<li class="class-depth-0">
<a href="global.html#on">on</a>
</li>
<li class="class-depth-0">
<a href="global.html#once">once</a>
</li>
<li class="class-depth-0">
<a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a>
</li>
<li class="class-depth-2">
<a href="global.html#Phaser.Path#numPointsreturn%257Bnumber%257DThetotalnumberofPathPointsinthisPath.">Phaser.Path#numPoints
return {number} The total number of PathPoints in this Path.</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINT">POINT</a>
</li>
<li class="class-depth-0">
<a href="global.html#POINTER">POINTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#POLYGON">POLYGON</a>
</li>
<li class="class-depth-0">
<a href="global.html#PORTRAIT">PORTRAIT</a>
</li>
<li class="class-depth-0">
<a href="global.html#quadraticCurveTo">quadraticCurveTo</a>
</li>
<li class="class-depth-0">
<a href="global.html#RECTANGLE">RECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#removeAllListeners">removeAllListeners</a>
</li>
<li class="class-depth-0">
<a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a>
</li>
<li class="class-depth-0">
<a href="global.html#RETROFONT">RETROFONT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT">RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_BOTTOM">RIGHT_BOTTOM</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_CENTER">RIGHT_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#RIGHT_TOP">RIGHT_TOP</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROPE">ROPE</a>
</li>
<li class="class-depth-0">
<a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a>
</li>
<li class="class-depth-0">
<a href="global.html#scaleModes">scaleModes</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITE">SPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#SPRITEBATCH">SPRITEBATCH</a>
</li>
<li class="class-depth-0">
<a href="global.html#stopImmediatePropagation">stopImmediatePropagation</a>
</li>
<li class="class-depth-0">
<a href="global.html#stopPropagation">stopPropagation</a>
</li>
<li class="class-depth-0">
<a href="global.html#TEXT">TEXT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAP">TILEMAP</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TILESPRITE">TILESPRITE</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_CENTER">TOP_CENTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_LEFT">TOP_LEFT</a>
</li>
<li class="class-depth-0">
<a href="global.html#TOP_RIGHT">TOP_RIGHT</a>
</li>
<li class="class-depth-0">
<a href="global.html#UP">UP</a>
</li>
<li class="class-depth-0">
<a href="global.html#updateLocalBounds">updateLocalBounds</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERSION">VERSION</a>
</li>
<li class="class-depth-0">
<a href="global.html#VERTICAL">VERTICAL</a>
</li>
<li class="class-depth-0">
<a href="global.html#VIDEO">VIDEO</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL">WEBGL</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a>
</li>
<li class="class-depth-0">
<a href="global.html#WEBGL_MULTI">WEBGL_MULTI</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li>
<li class="class-depth-1"><a href="Phaser.Group.html">Group</a></li>
<li class="class-depth-1"><a href="Phaser.World.html">World</a></li>
<li class="class-depth-1"><a href="Phaser.Loader.html">Loader</a></li>
<li class="class-depth-1"><a href="Phaser.Cache.html">Cache</a></li>
<li class="class-depth-1"><a href="Phaser.Time.html">Time</a></li>
<li class="class-depth-1"><a href="Phaser.Camera.html">Camera</a></li>
<li class="class-depth-1"><a href="Phaser.StateManager.html">State Manager</a></li>
<li class="class-depth-1"><a href="Phaser.TweenManager.html">Tween Manager</a></li>
<li class="class-depth-1"><a href="Phaser.SoundManager.html">Sound Manager</a></li>
<li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li>
<li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.GameObjectFactory.html">Factory (game.add)</a></li>
<li class="class-depth-1"><a href="Phaser.GameObjectCreator.html">Creator (game.make)</a></li>
<li class="class-depth-1"><a href="Phaser.Sprite.html">Sprite</a></li>
<li class="class-depth-1"><a href="Phaser.Image.html">Image</a></li>
<li class="class-depth-1"><a href="Phaser.Sound.html">Sound</a></li>
<li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li>
<li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li>
<li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li>
<li class="class-depth-1"><a href="Phaser.Text.html">Text</a></li>
<li class="class-depth-1"><a href="Phaser.Tween.html">Tween</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapText.html">BitmapText</a></li>
<li class="class-depth-1"><a href="Phaser.Tilemap.html">Tilemap</a></li>
<li class="class-depth-1"><a href="Phaser.BitmapData.html">BitmapData</a></li>
<li class="class-depth-1"><a href="Phaser.RetroFont.html">RetroFont</a></li>
<li class="class-depth-1"><a href="Phaser.Button.html">Button</a></li>
<li class="class-depth-1"><a href="Phaser.Animation.html">Animation</a></li>
<li class="class-depth-1"><a href="Phaser.Graphics.html">Graphics</a></li>
<li class="class-depth-1"><a href="Phaser.RenderTexture.html">RenderTexture</a></li>
<li class="class-depth-1"><a href="Phaser.TileSprite.html">TileSprite</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Geometry<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Circle.html">Circle</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li>
<li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Physics<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.Physics.Arcade.html">Arcade Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Arcade.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Weapon.html">Weapon</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li>
<li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li>
<li class="class-depth-1"><a href="Phaser.DeviceButton.html">Device Button</a></li>
<li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li>
<li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li>
<li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li>
<li class="class-depth-1"><a href="Phaser.KeyCode.html">Key Codes</a></li>
<li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://phaser.io/examples">Phaser Examples</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li>
<li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li>
<li class="class-depth-1"><a href="http://phaser.io/learn">Tutorials</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/newsletter">Newsletter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/slack">Slack</a></li>
<li class="class-depth-1"><a href="http://phaser.io/community/donate">Donate</a></li>
<li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div id="main">
<h1 class="page-title">Source: src/pixi/renderers/webgl/shaders/ComplexPrimitiveShader.js</h1>
<section>
<article>
<pre class="sunlight-highlight-javascript linenums">/**
* @author Mat Groves http://matgroves.com/ @Doormat23
*/
/**
* @class ComplexPrimitiveShader
* @constructor
* @param gl {WebGLContext} the current WebGL drawing context
*/
PIXI.ComplexPrimitiveShader = function(gl)
{
/**
* @property _UID
* @type Number
* @private
*/
this._UID = Phaser._UID++;
/**
* @property gl
* @type WebGLContext
*/
this.gl = gl;
/**
* The WebGL program.
* @property program
* @type Any
*/
this.program = null;
/**
* The fragment shader.
* @property fragmentSrc
* @type Array
*/
this.fragmentSrc = [
'precision mediump float;',
'varying vec4 vColor;',
'void main(void) {',
' gl_FragColor = vColor;',
'}'
];
/**
* The vertex shader.
* @property vertexSrc
* @type Array
*/
this.vertexSrc = [
'attribute vec2 aVertexPosition;',
//'attribute vec4 aColor;',
'uniform mat3 translationMatrix;',
'uniform vec2 projectionVector;',
'uniform vec2 offsetVector;',
'uniform vec3 tint;',
'uniform float alpha;',
'uniform vec3 color;',
'uniform float flipY;',
'varying vec4 vColor;',
'void main(void) {',
' vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);',
' v -= offsetVector.xyx;',
' gl_Position = vec4( v.x / projectionVector.x -1.0, (v.y / projectionVector.y * -flipY) + flipY , 0.0, 1.0);',
' vColor = vec4(color * alpha * tint, alpha);',//" * vec4(tint * alpha, alpha);',
'}'
];
this.init();
};
PIXI.ComplexPrimitiveShader.prototype.constructor = PIXI.ComplexPrimitiveShader;
/**
* Initialises the shader.
*
* @method init
*/
PIXI.ComplexPrimitiveShader.prototype.init = function()
{
var gl = this.gl;
var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc);
gl.useProgram(program);
// get and store the uniforms for the shader
this.projectionVector = gl.getUniformLocation(program, 'projectionVector');
this.offsetVector = gl.getUniformLocation(program, 'offsetVector');
this.tintColor = gl.getUniformLocation(program, 'tint');
this.color = gl.getUniformLocation(program, 'color');
this.flipY = gl.getUniformLocation(program, 'flipY');
// get and store the attributes
this.aVertexPosition = gl.getAttribLocation(program, 'aVertexPosition');
// this.colorAttribute = gl.getAttribLocation(program, 'aColor');
this.attributes = [this.aVertexPosition, this.colorAttribute];
this.translationMatrix = gl.getUniformLocation(program, 'translationMatrix');
this.alpha = gl.getUniformLocation(program, 'alpha');
this.program = program;
};
/**
* Destroys the shader.
*
* @method destroy
*/
PIXI.ComplexPrimitiveShader.prototype.destroy = function()
{
this.gl.deleteProgram( this.program );
this.uniforms = null;
this.gl = null;
this.attribute = null;
};
</pre>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2016 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a>
on Tue Dec 06 2016 23:48:52 GMT+0000 (GMT Standard Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>.
</span>
</footer>
</div>
<br clear="both">
</div>
</div>
<script src="scripts/sunlight.js"></script>
<script src="scripts/sunlight.javascript.js"></script>
<script src="scripts/sunlight-plugin.doclinks.js"></script>
<script src="scripts/sunlight-plugin.linenumbers.js"></script>
<script src="scripts/sunlight-plugin.menu.js"></script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/jquery.scrollTo.js"></script>
<script src="scripts/jquery.localScroll.js"></script>
<script src="scripts/bootstrap-dropdown.js"></script>
<script src="scripts/toc.js"></script>
<script> Sunlight.highlightAll({lineNumbers:true, showMenu: true, enableDoclinks :true}); </script>
<script>
$( function () {
$( "#toc" ).toc( {
anchorName : function(i, heading, prefix) {
return $(heading).attr("id") || ( prefix + i );
},
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
</script>
</body>
</html>
| dreamsxin/phaser | v2-community/docs/src_pixi_renderers_webgl_shaders_ComplexPrimitiveShader.js.html | HTML | mit | 45,895 |
package com.github.kostyasha.yad.credentials;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.impl.BaseStandardCredentials;
import com.google.common.base.Throwables;
import hudson.Extension;
import org.apache.commons.io.FileUtils;
import org.jenkinsci.plugins.docker.commons.credentials.DockerServerCredentials;
import org.kohsuke.stapler.DataBoundConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.io.File;
import java.io.IOException;
import static java.util.Objects.nonNull;
/**
* {@link DockerServerCredentials} has final fields that blocks extensibility (as usual in jenkins).
*
* @author Kanstantsin Shautsou
*/
public class DockerDaemonFileCredentials extends BaseStandardCredentials implements DockerDaemonCerts {
private static final long serialVersionUID = 1L;
public static final Logger LOG = LoggerFactory.getLogger(DockerDaemonFileCredentials.class);
private String dockerCertPath;
private transient DockerServerCredentials credentials = null;
@DataBoundConstructor
public DockerDaemonFileCredentials(@CheckForNull CredentialsScope scope, @CheckForNull String id,
@CheckForNull String description,
@Nonnull String dockerCertPath) {
super(scope, id, description);
this.dockerCertPath = dockerCertPath;
}
public String getClientKey() {
resolveCredentialsOnSlave();
return credentials.getClientKey();
}
public String getClientCertificate() {
resolveCredentialsOnSlave();
return credentials.getClientCertificate();
}
public String getServerCaCertificate() {
resolveCredentialsOnSlave();
return credentials.getServerCaCertificate();
}
private void resolveCredentialsOnSlave() {
if (nonNull(credentials)) {
return;
}
File credDir = new File(dockerCertPath);
if (!credDir.isDirectory()) {
throw new IllegalStateException(dockerCertPath + " isn't directory!");
}
try {
String caPem = FileUtils.readFileToString(new File(credDir, "ca.pem"));
String keyPem = FileUtils.readFileToString(new File(credDir, "key.pem"));
String certPem = FileUtils.readFileToString(new File(credDir, "cert.pem"));
this.credentials = new DockerServerCredentials(null, "remote-docker", null, caPem, keyPem, certPem);
} catch (IOException ex) {
LOG.error("", ex);
Throwables.propagate(ex);
}
}
@Extension
public static class DescriptorImpl extends BaseStandardCredentialsDescriptor {
@Nonnull
public String getDisplayName() {
return "Docker Host Certificate Authentication (remote)";
}
}
}
| KostyaSha/yet-another-docker-plugin | yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/credentials/DockerDaemonFileCredentials.java | Java | mit | 2,950 |
module Rainbow
class Color
attr_reader :color, :location
# color - Fixnum
# location - Fixnum (0-100)
def initialize(color, location)
@color = color
@location = location
assert_location!
end
def r
ChunkyPNG::Color.r(color)
end
def g
ChunkyPNG::Color.g(color)
end
def b
ChunkyPNG::Color.b(color)
end
private
def assert_location!
raise ArgumentError, 'location must be between 0 and 100' if location < 0 || location > 100
end
end
end
| ungsophy/rainbow | lib/rainbow/color.rb | Ruby | mit | 555 |
//
// SortTableViewController.h
// Delightful
//
// Created by on 10/19/14.
// Copyright (c) 2014-2016 DelightfulDev. All rights reserved.
//
#import <UIKit/UIKit.h>
extern NSString *const dateUploadedDescSortKey;
extern NSString *const dateUploadedAscSortKey;
extern NSString *const dateTakenDescSortKey;
extern NSString *const dateTakenAscSortKey;
extern NSString *const nameDescSortKey;
extern NSString *const nameAscSortKey;
extern NSString *const countDescSortKey;
extern NSString *const countAscSortKey;
extern NSString *const dateLastPhotoAddedDescSortKey;
extern NSString *const dateLastPhotoAddedAscSortKey;
@protocol SortingDelegate <NSObject>
@optional
- (void)sortTableViewController:(id)sortTableViewController didSelectSort:(NSString *)sort;
@end
@interface SortTableViewController : UITableViewController
@property (nonatomic, weak) id<SortingDelegate>sortingDelegate;
@property (nonatomic) Class resourceClass;
@property (nonatomic, strong) NSString *selectedSort;
@end
| delightfulapp/delightful | PhotoBox/Controllers/SortTableViewController.h | C | mit | 1,005 |
<?php
/**
* Authors: Alex Gusev <[email protected]>
* Since: 2018
*/
namespace Test\Praxigento\Accounting\Api\Web\Account\Asset\Get;
use Praxigento\Accounting\Api\Web\Account\Asset\Get\Request as AnObject;
include_once(__DIR__ . '/../../../../../phpunit_bootstrap.php');
class RequestTest
extends \Praxigento\Core\Test\BaseCase\Unit
{
public function test_convert()
{
/* create object & convert it to 'JSON'-array */
$obj = new AnObject();
$data = new \Praxigento\Accounting\Api\Web\Account\Asset\Get\Request\Data();
$data->setCustomerId(1);
$obj->setData($data);
/** @var \Magento\Framework\Webapi\ServiceOutputProcessor $output */
$output = $this->manObj->get(\Magento\Framework\Webapi\ServiceOutputProcessor::class);
$json = $output->convertValue($obj, AnObject::class);
/* convert 'JSON'-array to object */
/** @var \Magento\Framework\Webapi\ServiceInputProcessor $input */
$input = $this->manObj->get(\Magento\Framework\Webapi\ServiceInputProcessor::class);
$data = $input->convertValue($json, AnObject::class);
$this->assertNotNull($data);
}
} | praxigento/mobi_mod_mage2_accounting | test/unit/Api/Web/Account/Asset/Get/RequestTest.php | PHP | mit | 1,179 |
<?php
/**
* TipoAju
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* @package sf_sandbox
* @subpackage model
* @author Your name here
* @version SVN: $Id: Builder.php 6820 2009-11-30 17:27:49Z jwage $
*/
class TipoAju extends BaseTipoAju
{
}
| luelher/gesser | lib/model/doctrine/TipoAju.class.php | PHP | mit | 288 |
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Search — php-common 1.1.6 documentation</title>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="top" title="php-common 1.1.6 documentation" href="index.html"/>
<script src="_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search">
<a href="index.html" class="icon icon-home"> php-common
</a>
<div class="version">
1
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="#" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="overview.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="requests.html">Requests</a></li>
<li class="toctree-l1"><a class="reference internal" href="routes.html">Routes</a></li>
<li class="toctree-l1"><a class="reference internal" href="exceptions.html">Exceptions</a></li>
<li class="toctree-l1"><a class="reference internal" href="flows.html">Flows</a></li>
<li class="toctree-l1"><a class="reference internal" href="integrations.html">Integrations</a></li>
<li class="toctree-l1"><a class="reference internal" href="help.html">Need Help?</a></li>
<li class="toctree-l1"><a class="reference internal" href="license.html">License</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">php-common</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> »</li>
<li></li>
<li class="wy-breadcrumbs-aside">
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<noscript>
<div id="fallback" class="admonition warning">
<p class="last">
Please activate JavaScript to enable the search
functionality.
</p>
</div>
</noscript>
<div id="search-results">
</div>
</div>
</div>
<footer>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2015, Sam Pratt.
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'./',
VERSION:'1.1.6',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/searchtools.js"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
<script type="text/javascript">
jQuery(function() { Search.loadIndex("searchindex.js"); });
</script>
<script type="text/javascript" id="searchindexloader"></script>
</body>
</html> | expressly/php-common | docs/build/html/search.html | HTML | mit | 4,790 |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Class: AssetsController</title>
<link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />
<script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>
</head>
<body id="top" class="class">
<div id="metadata">
<div id="home-metadata">
<div id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./index.html#classes">Classes</a>
<a href="./index.html#methods">Methods</a>
</h3>
</div>
</div>
<div id="file-metadata">
<div id="file-list-section" class="section">
<h3 class="section-header">In Files</h3>
<div class="section-body">
<ul>
<li><a href="./app/controllers/assets_controller_rb.html?TB_iframe=true&height=550&width=785"
class="thickbox" title="app/controllers/assets_controller.rb">app/controllers/assets_controller.rb</a></li>
</ul>
</div>
</div>
</div>
<div id="class-metadata">
<!-- Parent Class -->
<div id="parent-class-section" class="section">
<h3 class="section-header">Parent</h3>
<p class="link"><a href="ApplicationController.html">ApplicationController</a></p>
</div>
<!-- Method Quickref -->
<div id="method-list-section" class="section">
<h3 class="section-header">Methods</h3>
<ul class="link-list">
<li><a href="#method-i-create">#create</a></li>
<li><a href="#method-i-destroy">#destroy</a></li>
<li><a href="#method-i-edit">#edit</a></li>
<li><a href="#method-i-get">#get</a></li>
<li><a href="#method-i-index">#index</a></li>
<li><a href="#method-i-new">#new</a></li>
<li><a href="#method-i-show">#show</a></li>
<li><a href="#method-i-update">#update</a></li>
</ul>
</div>
</div>
<div id="project-metadata">
<div id="fileindex-section" class="section project-section">
<h3 class="section-header">Files</h3>
<ul>
<li class="file"><a href="./doc/README_FOR_APP.html">README_FOR_APP</a></li>
</ul>
</div>
<div id="classindex-section" class="section project-section">
<h3 class="section-header">Class/Module Index
<span class="search-toggle"><img src="./images/find.png"
height="16" width="16" alt="[+]"
title="show/hide quicksearch" /></span></h3>
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
<fieldset>
<legend>Quicksearch</legend>
<input type="text" name="quicksearch" value=""
class="quicksearch-field" />
</fieldset>
</form>
<ul class="link-list">
<li><a href="./ErrorMessagesHelper.html">ErrorMessagesHelper</a></li>
<li><a href="./ErrorMessagesHelper/FormBuilderAdditions.html">ErrorMessagesHelper::FormBuilderAdditions</a></li>
<li><a href="./AccessKey.html">AccessKey</a></li>
<li><a href="./AccessKeysController.html">AccessKeysController</a></li>
<li><a href="./AccessKeysHelper.html">AccessKeysHelper</a></li>
<li><a href="./ApplicationController.html">ApplicationController</a></li>
<li><a href="./ApplicationHelper.html">ApplicationHelper</a></li>
<li><a href="./Asset.html">Asset</a></li>
<li><a href="./AssetsController.html">AssetsController</a></li>
<li><a href="./AssetsHelper.html">AssetsHelper</a></li>
<li><a href="./Folder.html">Folder</a></li>
<li><a href="./FoldersController.html">FoldersController</a></li>
<li><a href="./FoldersHelper.html">FoldersHelper</a></li>
<li><a href="./HomeController.html">HomeController</a></li>
<li><a href="./HomeHelper.html">HomeHelper</a></li>
<li><a href="./Invite.html">Invite</a></li>
<li><a href="./InvitesController.html">InvitesController</a></li>
<li><a href="./InvitesHelper.html">InvitesHelper</a></li>
<li><a href="./KeySessionsController.html">KeySessionsController</a></li>
<li><a href="./KeySessionsHelper.html">KeySessionsHelper</a></li>
<li><a href="./KeyedFolder.html">KeyedFolder</a></li>
<li><a href="./KeyedFoldersController.html">KeyedFoldersController</a></li>
<li><a href="./KeyedFoldersHelper.html">KeyedFoldersHelper</a></li>
<li><a href="./LayoutHelper.html">LayoutHelper</a></li>
<li><a href="./NotInvitedValidator.html">NotInvitedValidator</a></li>
<li><a href="./NotMemberValidator.html">NotMemberValidator</a></li>
<li><a href="./PublicFolder.html">PublicFolder</a></li>
<li><a href="./PublicFolderHelper.html">PublicFolderHelper</a></li>
<li><a href="./PublicFoldersController.html">PublicFoldersController</a></li>
<li><a href="./SharedFolder.html">SharedFolder</a></li>
<li><a href="./SharedFoldersController.html">SharedFoldersController</a></li>
<li><a href="./SharedFoldersHelper.html">SharedFoldersHelper</a></li>
<li><a href="./User.html">User</a></li>
<li><a href="./UserMailer.html">UserMailer</a></li>
</ul>
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
</div>
</div>
</div>
<div id="documentation">
<h1 class="class">AssetsController</h1>
<div id="description" class="description">
</div><!-- description -->
<div id="5Buntitled-5D" class="documentation-section">
<!-- Methods -->
<div id="public-instance-method-details" class="method-section section">
<h3 class="section-header">Public Instance Methods</h3>
<div id="create-method" class="method-detail ">
<a name="method-i-create"></a>
<div class="method-heading">
<span class="method-name">create</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="create-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 19</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">build</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:asset</span>])
<span class="ruby-identifier">respond_to</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">format</span><span class="ruby-operator">|</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">save</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">folder</span>
<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">folder</span>.<span class="ruby-identifier">updated_at</span> = <span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">updated_at</span>
<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">folder</span>.<span class="ruby-identifier">save</span>
<span class="ruby-keyword">end</span>
<span class="ruby-comment">#flash[:notice] = "Successfully created asset."</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">></span> {<span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">truncate_helper</span>(<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">file_name</span>, <span class="ruby-value">:length</span> =<span class="ruby-operator">></span> <span class="ruby-value">50</span>), <span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-string">'success'</span>, <span class="ruby-value">:msg</span> =<span class="ruby-operator">></span> <span class="ruby-string">'OK'</span>}, <span class="ruby-value">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-string">'text/html'</span> }
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">xml</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:xml</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@asset</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">></span> <span class="ruby-value">:created</span>, <span class="ruby-value">:location</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@asset</span> }
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">redirect_to</span>(<span class="ruby-identifier">root_url</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">></span> <span class="ruby-string">"Successfully uploaded file(s)."</span>)}
<span class="ruby-keyword">else</span>
<span class="ruby-comment">#render :action => 'new'</span>
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">json</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:json</span> =<span class="ruby-operator">></span> { <span class="ruby-value">:name</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">truncate_helper</span>(<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">file_name</span>, <span class="ruby-value">:length</span> =<span class="ruby-operator">></span> <span class="ruby-value">50</span>), <span class="ruby-value">:result</span> =<span class="ruby-operator">></span> <span class="ruby-string">'error'</span>, <span class="ruby-value">:msg</span> =<span class="ruby-operator">></span> <span class="ruby-node">"Error: #{@asset.errors.full_messages.join(',')}"</span>}, <span class="ruby-value">:content_type</span> =<span class="ruby-operator">></span> <span class="ruby-string">'text/html'</span> }
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">xml</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:xml</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@asset</span>, <span class="ruby-value">:status</span> =<span class="ruby-operator">></span> <span class="ruby-value">:created</span>, <span class="ruby-value">:location</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@asset</span> }
<span class="ruby-identifier">format</span>.<span class="ruby-identifier">html</span> { <span class="ruby-identifier">render</span> <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-string">'new'</span> }
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- create-source -->
</div>
</div><!-- create-method -->
<div id="destroy-method" class="method-detail ">
<a name="method-i-destroy"></a>
<div class="method-heading">
<span class="method-name">destroy</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="destroy-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 54</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">destroy</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-ivar">@parent_folder</span> = <span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">folder</span> <span class="ruby-comment">#grabbing the parent folder before deleting the record</span>
<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">destroy</span>
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:notice</span>] = <span class="ruby-string">"Successfully deleted the file."</span>
<span class="ruby-comment">#redirect to a relevant path depending on the parent folder</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@parent_folder</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">folder_path</span>(<span class="ruby-ivar">@parent_folder</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">root_url</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- destroy-source -->
</div>
</div><!-- destroy-method -->
<div id="edit-method" class="method-detail ">
<a name="method-i-edit"></a>
<div class="method-heading">
<span class="method-name">edit</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="edit-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 41</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">edit</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">end</span></pre>
</div><!-- edit-source -->
</div>
</div><!-- edit-method -->
<div id="get-method" class="method-detail ">
<a name="method-i-get"></a>
<div class="method-heading">
<span class="method-name">get</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="get-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">current_user</span>
<span class="ruby-comment"># Get file if the current user owns it</span>
<span class="ruby-identifier">asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-comment"># Or get the file if it is public</span>
<span class="ruby-identifier">asset</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Asset</span>.<span class="ruby-identifier">public_find_by_id</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-comment"># Or get the file if it is shared with the current user </span>
<span class="ruby-identifier">asset</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Asset</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>]) <span class="ruby-keyword">if</span> <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">has_share_access?</span>(<span class="ruby-constant">Asset</span>.<span class="ruby-identifier">find_by_id</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>]).<span class="ruby-identifier">folder</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">asset</span> = <span class="ruby-constant">Asset</span>.<span class="ruby-identifier">public_find_by_id</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">asset</span>
<span class="ruby-comment">#data = open(URI.parse(URI.encode(asset.uploaded_file.path)).to_s)</span>
<span class="ruby-comment">#send_data data, :filename => asset.uploaded_file_file_name</span>
<span class="ruby-identifier">send_file</span> <span class="ruby-identifier">asset</span>.<span class="ruby-identifier">uploaded_file</span>.<span class="ruby-identifier">path</span>, <span class="ruby-value">:type</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">asset</span>.<span class="ruby-identifier">uploaded_file_content_type</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">flash</span>[<span class="ruby-value">:error</span>] = <span class="ruby-string">"You can't access files that don't belong to you!"</span>
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@parent_folder</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">folders_path</span>(<span class="ruby-ivar">@parent_folder</span>)
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">redirect_to</span> <span class="ruby-identifier">root_url</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- get-source -->
</div>
</div><!-- get-method -->
<div id="index-method" class="method-detail ">
<a name="method-i-index"></a>
<div class="method-heading">
<span class="method-name">index</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="index-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 3</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">index</span>
<span class="ruby-ivar">@assets</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- index-source -->
</div>
</div><!-- index-method -->
<div id="new-method" class="method-detail ">
<a name="method-i-new"></a>
<div class="method-heading">
<span class="method-name">new</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 11</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">new</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">build</span>
<span class="ruby-keyword">if</span> <span class="ruby-identifier">params</span>[<span class="ruby-value">:folder_id</span>]
<span class="ruby-ivar">@current_folder</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">folders</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:folder_id</span>])
<span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">folder_id</span> = <span class="ruby-ivar">@current_folder</span>.<span class="ruby-identifier">id</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- new-source -->
</div>
</div><!-- new-method -->
<div id="show-method" class="method-detail ">
<a name="method-i-show"></a>
<div class="method-heading">
<span class="method-name">show</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="show-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 7</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">show</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">end</span></pre>
</div><!-- show-source -->
</div>
</div><!-- show-method -->
<div id="update-method" class="method-detail ">
<a name="method-i-update"></a>
<div class="method-heading">
<span class="method-name">update</span><span
class="method-args">()</span>
<span class="method-click-advice">click to toggle source</span>
</div>
<div class="method-description">
<div class="method-source-code" id="update-source">
<pre>
<span class="ruby-comment"># File app/controllers/assets_controller.rb, line 45</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">update</span>
<span class="ruby-ivar">@asset</span> = <span class="ruby-identifier">current_user</span>.<span class="ruby-identifier">assets</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:id</span>])
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@asset</span>.<span class="ruby-identifier">update_attributes</span>(<span class="ruby-identifier">params</span>[<span class="ruby-value">:asset</span>])
<span class="ruby-identifier">redirect_to</span> <span class="ruby-ivar">@asset</span>, <span class="ruby-value">:notice</span> =<span class="ruby-operator">></span> <span class="ruby-string">"Successfully updated asset."</span>
<span class="ruby-keyword">else</span>
<span class="ruby-identifier">render</span> <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-string">'edit'</span>
<span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
</div><!-- update-source -->
</div>
</div><!-- update-method -->
</div><!-- public-instance-method-details -->
</div><!-- 5Buntitled-5D -->
</div><!-- documentation -->
<div id="validator-badges">
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
Rdoc Generator</a> 2</small>.</p>
</div>
</body>
</html>
| rlyon/filebucket | doc/app/AssetsController.html | HTML | mit | 26,594 |
---
layout: page
title: Coast Price Holdings Conference
date: 2016-05-24
author: Harold Wall
tags: weekly links, java
status: published
summary: Fusce interdum at sem et viverra. Aenean.
banner: images/banner/leisure-01.jpg
booking:
startDate: 04/24/2018
endDate: 04/26/2018
ctyhocn: MTPTXHX
groupCode: CPHC
published: true
---
Curabitur vel interdum ex. Sed tincidunt dignissim ex, nec aliquam nisi aliquam ut. Nulla efficitur auctor nisl, eu luctus justo consectetur vel. In blandit metus eu nisi ultrices ornare. Nunc nec tortor bibendum, volutpat nisi at, tincidunt eros. Donec quis iaculis arcu. Quisque eu fermentum ex. Donec lacus nibh, vestibulum eget felis convallis, luctus ultricies eros. Nam molestie scelerisque sapien vel pharetra. Etiam hendrerit iaculis justo, ut cursus nulla efficitur vel. Suspendisse potenti.
Morbi at dui in urna finibus rhoncus. In hac habitasse platea dictumst. Integer faucibus, diam sed imperdiet mollis, nunc nisl convallis justo, ac semper tortor lectus eget arcu. Praesent sagittis nunc dictum mollis maximus. Nunc viverra faucibus dolor. Morbi mauris lacus, mattis vel tristique eget, convallis iaculis enim. Nunc ut aliquet arcu, sit amet vestibulum metus. Donec iaculis magna nec turpis eleifend facilisis. Nullam mollis, nulla et varius posuere, ex ex tincidunt enim, a sollicitudin quam odio et nibh.
* Vestibulum non nibh at turpis bibendum consectetur non at urna
* Vivamus vitae lacus in magna viverra molestie
* Aliquam imperdiet lectus eu suscipit scelerisque
* Nullam non ante consectetur, hendrerit libero eu, pulvinar purus
* Phasellus tincidunt lorem eleifend justo tristique porta.
Morbi placerat orci leo, quis feugiat purus imperdiet vitae. In magna eros, hendrerit ut mi a, pretium condimentum lectus. Nulla in venenatis leo. Pellentesque consequat eros ac tincidunt aliquam. Etiam magna nisl, vulputate eget elit in, ultricies dapibus massa. Mauris sit amet eros eu est ornare maximus. In lacinia tristique tincidunt. Morbi ac turpis fermentum, finibus massa nec, convallis eros. Vivamus ut felis eu orci rhoncus varius eu sit amet sem. Vestibulum lectus libero, luctus et libero vel, interdum imperdiet justo.
| KlishGroup/prose-pogs | pogs/M/MTPTXHX/CPHC/index.md | Markdown | mit | 2,184 |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>success</title>
<link rel="stylesheet" href={{url_for('static',filename='styles.css')}} >
</head>
<body>
<h4>you made it</h4>
</body>
</html>
| authman/Python201609 | Wright_Will/Assignments/login_and _registration/templates/success.html | HTML | mit | 250 |
namespace Personal.Bondora.Utility
{
public enum LogSource
{
Service,
Utility,
Web
}
} | Dmitri-Trofimov/Personal.Bondora | Personal.Bondora.Utility/LogSource.cs | C# | mit | 125 |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CodeFighter.Data
{
public class ScenarioData
{
[Key]
public int Id { get; set; }
public Guid ScenarioGUID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public ICollection<ScenarioShipData> Ships { get; set; }
public ICollection<ScenarioFeatureData> Features { get; set; }
public int RoundLimit { get; set; }
}
}
| ArenaDave/CodeFighter | CodeFighter/CodeFighter.Data/ScenarioData.cs | C# | mit | 604 |
package gobay
import "testing"
func TestSetNotificationPreferencesTemplate(t *testing.T) {
tmpl := SetNotificationPreferencesTemplate()
o := NewSetNotificationPreferencesRequest()
data, err := compileGoString("TestSetNotificationPreferencesTemplate", tmpl, o, nil)
if err != nil {
t.Errorf("failed to compile SetNotificationPreferencesTemplate %v", err)
}
if data == "" {
t.Errorf("failed to compite SetNotificationPreferencesTemplate %v", data)
}
}
| jasonknight/gobay | template_set_notification_preferences_request_test.go | GO | mit | 463 |
DO $$
BEGIN
BEGIN
ALTER TABLE cd_dojos ADD COLUMN online_sessions smallint NOT NULL DEFAULT 0;
EXCEPTION
WHEN duplicate_column THEN RAISE NOTICE 'column online_sessions already exists in cd_dojos.';
END;
END;
$$
| CoderDojo/cp-dojos-service | scripts/database/pg/migrations/027.do.add-online-sessions.sql | SQL | mit | 268 |
using NoteEditor.Common;
using NoteEditor.Model;
using System;
using System.IO;
using System.Linq;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
namespace NoteEditor.Presenter
{
public class MusicSelectorPresenter : MonoBehaviour
{
[SerializeField]
InputField directoryPathInputField;
[SerializeField]
GameObject fileItemPrefab;
[SerializeField]
GameObject fileItemContainer;
[SerializeField]
Transform fileItemContainerTransform;
[SerializeField]
Button redoButton;
[SerializeField]
Button undoButton;
[SerializeField]
Button loadButton;
[SerializeField]
MusicLoader musicLoader;
void Start()
{
ChangeLocationCommandManager.CanUndo.SubscribeToInteractable(undoButton);
ChangeLocationCommandManager.CanRedo.SubscribeToInteractable(redoButton);
undoButton.OnClickAsObservable().Subscribe(_ => ChangeLocationCommandManager.Undo());
redoButton.OnClickAsObservable().Subscribe(_ => ChangeLocationCommandManager.Redo());
Settings.WorkSpacePath
.Subscribe(workSpacePath => directoryPathInputField.text = Path.Combine(workSpacePath, "Musics"));
directoryPathInputField.OnValueChangedAsObservable()
.Subscribe(path => MusicSelector.DirectoryPath.Value = path);
MusicSelector.DirectoryPath
.Subscribe(path => directoryPathInputField.text = path);
var isUndoRedoAction = false;
MusicSelector.DirectoryPath
.Where(path => Directory.Exists(path))
.Buffer(2, 1)
.Where(_ => isUndoRedoAction ? (isUndoRedoAction = false) : true)
.Select(b => new { prev = b[0], current = b[1] })
.Subscribe(path => ChangeLocationCommandManager.Do(new Command(
() => { },
() => { isUndoRedoAction = true; MusicSelector.DirectoryPath.Value = path.prev; },
() => { isUndoRedoAction = true; MusicSelector.DirectoryPath.Value = path.current; })));
Observable.Timer(TimeSpan.FromMilliseconds(300), TimeSpan.Zero)
.Where(_ => Directory.Exists(MusicSelector.DirectoryPath.Value))
.Select(_ => new DirectoryInfo(MusicSelector.DirectoryPath.Value))
.Select(directoryInfo =>
directoryInfo.GetDirectories().Select(directory => new FileItemInfo(true, directory.FullName))
.Concat(directoryInfo.GetFiles().Select(file => new FileItemInfo(false, file.FullName)))
.ToList())
.Where(x => !x.Select(item => item.fullName)
.SequenceEqual(MusicSelector.FilePathList.Value.Select(item => item.fullName)))
.Subscribe(filePathList => MusicSelector.FilePathList.Value = filePathList);
MusicSelector.FilePathList.AsObservable()
.Do(_ => Enumerable.Range(0, fileItemContainerTransform.childCount)
.Select(i => fileItemContainerTransform.GetChild(i))
.ToList()
.ForEach(child => DestroyObject(child.gameObject)))
.SelectMany(fileItemList => fileItemList)
.Select(fileItemInfo => new { fileItemInfo, obj = Instantiate(fileItemPrefab) as GameObject })
.Do(elm => elm.obj.transform.SetParent(fileItemContainer.transform))
.Subscribe(elm => elm.obj.GetComponent<FileListItem>().SetInfo(elm.fileItemInfo));
loadButton.OnClickAsObservable()
.Select(_ => MusicSelector.SelectedFileName.Value)
.Where(fileName => !string.IsNullOrEmpty(fileName))
.Subscribe(fileName => musicLoader.Load(fileName));
if (!Directory.Exists(MusicSelector.DirectoryPath.Value))
{
Directory.CreateDirectory(MusicSelector.DirectoryPath.Value);
}
}
}
}
| setchi/NotesEditor | Assets/Scripts/Presenter/MusicSelector/MusicSelectorPresenter.cs | C# | mit | 4,088 |
class FlightFinderPage < HomePage
element :flight_finder_page_locator, {css: "img[src='/images/masts/mast_flightfinder.gif']"}
element :passengers, {name: "passCount"}
element :type, {name: 'tripType'}
element :departing_from, {name: 'fromPort'}
element :depart_month, {name: 'fromMonth'}
element :depart_day, {name: 'fromDay'}
element :arriving_from, {name: 'toPort'}
element :returning_month, {name: 'toMonth'}
element :returning_day, {name: 'toDay'}
element :service_class, {name: 'servClass'}
element :trip_type, {name: 'tripType'}
element :find_flights, {name: 'findFlights'}
element :out_flight, {name: 'outFlight'}
element :in_flight, {name: 'inFlight'}
element :reserve_flights, {name: 'reserveFlights'}
element :airline, {name: 'airline'}
element :airline, {name: 'airline'}
element :airline, {name: 'airline'}
element :first_name_0, {name: 'passFirst0'}
element :first_name_1, {name: 'passFirst1'}
element :last_name_0, {name: 'passLast0'}
element :last_name_1, {name: 'passLast1'}
element :cc_number, {name: 'creditnumber'}
element :buy_flight, {name: 'buyFlights'}
element :booked_itinerary_message, {xpath: "//font[2]"}
def initialize(page_driver)
@driver = page_driver
end
def is_current_page?
flight_finder_page_locator.displayed?
end
def get_traveler_info(info)
traveler_info = {
trip_type: "Round Trip",
passengers: "2",
departing_from: "London",
depart_month: "September",
depart_day: "1",
arriving_from: "Paris",
returning_month: "September",
returning_day: "5",
service_class: "Economy class",
airline: "Pangea Airlines",
first_name: Faker::Name.first_name,
last_name: Faker::Name.last_name,
cc_number: Faker::Business.credit_card_number
}
traveler_info.update(info)
traveler_info
end
def book_my_flight(traveler_info={})
user_info = self.get_traveler_info(traveler_info)
self.type.click
self.select_from_dropdown_by_text(self.passengers, user_info[:passengers])
self.select_from_dropdown_by_text(self.departing_from, user_info[:departing_from])
self.select_from_dropdown_by_text(self.depart_month, user_info[:depart_month])
self.select_from_dropdown_by_text(self.depart_day, user_info[:depart_day])
self.select_from_dropdown_by_text(self.arriving_from, user_info[:arriving_from])
self.select_from_dropdown_by_text(self.returning_month, user_info[:returning_month])
self.select_from_dropdown_by_text(self.returning_day, user_info[:returning_day])
self.service_class.click
self.select_from_dropdown_by_text(self.airline, user_info[:airline])
self.find_flights.click
self.out_flight.click
self.in_flight.click
self.reserve_flights.click
self.first_name_0.clear
self.first_name_0.send_keys(user_info[:first_name])
self.first_name_1.clear
self.first_name_1.send_keys(user_info[:first_name])
self.last_name_0.clear
self.last_name_0.send_keys(user_info[:last_name])
self.last_name_1.clear
self.last_name_1.send_keys(user_info[:last_name])
self.cc_number.clear
self.cc_number.send_keys(user_info[:cc_number])
self.buy_flight.click
self.booked_itinerary_message.text
end
end | mishraaditi2209/first_screen_assignments | features/lib/pages/flight_finder_page.rb | Ruby | mit | 3,297 |
## 服务提供者(Acast\\Server)
[返回主页](../Readme.md)
### 新建服务
> static function Server::create(string \$app, int \$listen, ?array \$ssl) void
事实上,每一个服务提供者是对一个Workerman的Worker实例的封装。和Acast框架的所有其他组件一样,它位于`\Acast`命名空间下。
`$listen`为服务监听的端口。根据服务类型的不同,服务所使用的协议也不同。`Acast\Http`主要提供HTTP协议,而`Acast\Socket`提供各种基于TCP长连接的协议,包括WebSocket。
如果需要提供HTTPS或WSS服务,`$ssl`格式应满足以下示例中格式(详见[这里](http://php.net/manual/en/context.ssl.php)),否则为空:
```php
Server::create('demo', 443, [
'local_cert' => '/path/to/cert',
'local_pk' => '/path/to/private/key',
'verify_peer' => false
]);
```
注意,如果使用了SSL,PHP必须安装有`openssl`扩展。
### 获取服务
> static function Server::app(string \$app) Server
我们可以用静态方法`app()`来获取到已注册的服务,从而为其注册事件、路由等。
返回值为对应服务提供者实例。
### 添加路由
> function Server::route(string \$name) void
成员函数`route()`可以用来为当前服务绑定路由实例。
路由的使用方法参见[路由](Router.md)这一章。
### 注册事件
> function Server::event(string \$event, callable \$callback) void
Acast服务提供者的事件是对Workerman事件的一个封装,要求用户传递事件类型及回调函数,并交由Workerman处理。调用回调函数时会传递对应Worker实例。
其中,onWorkerStart回调会在当前服务的每个进程启动时被调用,同理,onWorkerStop回调是在每个进程正常终止时被调用。
在Acast\Socket下,支持onStart,onStop和onMessage回调,其中onWorkerStart和onWorkerStop回调分别在连接建立和连接关闭时被调用,而onMessage回调用于确定请求方法和路由。其示例如下:
```php
Server::app('Demo')->event('Message', function ($connection, $data, &$path, &$method) {
$path = $data['path'];
$method = $data['method'];
return $data['data'];
});
```
### Worker配置
> function Server::workerConfig(array \$config) void
你可以方便地在服务提供者中配置Worker。如名称、进程数等。如下所示:
```php
Server::app('Demo')->workerConfig([
'name' => 'Demo',
'count' => 4
]);
```
也可以获取Worker实例的属性
> function Server::getWorkerProperty(string \$name) mixed
详细配置项见Workerman文档。
### 启动服务
> static function Server::start(?callable \$callback = null) void
在全局的初始化工作后调用此静态方法,用于启动、停止、重启服务等。
命令行参数会被处理,如果与`Acast\Console`中注册的函数相匹配,则调用对应函数,然后结束运行。
`$callback`回调将会在Worker即将被启动之前被调用。
否则,调用`Worker::runAll()`方法,交由Workerman处理命令行参数。
| CismonX/Acast | readme/Server.md | Markdown | mit | 3,060 |
package PLATFORM::DNSSERVER;
use Data::Dumper;
%PLATFORM::DNSSERVER::CMDS = (
'dns-domain-update'=>\&PLATFORM::DNSSERVER::dns_domain_update,
'dns-domain-delete'=>\&PLATFORM::DNSSERVER::dns_delete,
'dns-wildcard-reserve'=>\&PLATFORM::DNSSERVER::dns_wildcard_reserve,
'dns-user-delete'=>\&PLATFORM::DNSSERVER::dns_delete
);
sub new {
my ($CLASS) = @_;
my ($self) = {};
bless $self, $CLASS;
return($self);
}
sub register_cmds {
my ($self,$CMDSREF) = @_;
foreach my $cmd (keys %PLATFORM::DNSSERVER::CMDS) {
print ref($self)." registered $cmd\n";
$CMDSREF->{ $cmd } = $PLATFORM::DNSSERVER::CMDS{$cmd};
}
return();
}
################
#mysql> desc dns_records;
#+-------------+---------------------+------+-----+---------+----------------+
#| Field | Type | Null | Key | Default | Extra |
#+-------------+---------------------+------+-----+---------+----------------+
#| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
#| zone | varchar(64) | NO | MUL | | |
#| host | varchar(20) | NO | | | |
#| type | varchar(10) | NO | | | |
#| data | text | NO | | NULL | |
#| ttl | int(10) unsigned | NO | | 0 | |
#| mx_priority | tinyint(3) unsigned | NO | | 0 | |
#| refresh | int(10) unsigned | NO | | 0 | |
#| retry | int(10) unsigned | NO | | 0 | |
#| expire | int(10) unsigned | NO | | 0 | |
#| serial | bigint(20) | NO | | 0 | |
#| resp_person | varchar(100) | NO | | | |
#| primary_ns | tinytext | NO | | NULL | |
#| MID | int(10) unsigned | NO | | 0 | |
#| USERNAME | varchar(20) | NO | | | |
#| CLUSTER | varchar(10) | NO | | | |
#+-------------+---------------------+------+-----+---------+----------------+
#16 rows in set (0.07 sec)
sub dnsdump {
my ($CFG,$IN) = @_;
my %OUT = ();
return(\%OUT);
}
sub dns_delete {
my ($CFG,$IN) = @_;
my $dbh = $CFG->{'*dbh'};
my $pstmt = undef;
if ($IN->{'USERNAME'} ne '') {
$pstmt = "delete from dns_records where USERNAME=".$dbh->quote($IN->{'USERNAME'});
if ($IN->{'_cmd'} eq 'dns-domain-delete') { $pstmt .= " and DOMAIN=".$dbh->quote($IN->{'DOMAIN'}); }
print $pstmt."\n";
$dbh->do($pstmt);
}
if ($IN->{'MID'}>0) {
$pstmt = "delete from dns_records where MID=".int($IN->{'MID'});
if ($IN->{'_cmd'} eq 'dns-domain-delete') { $pstmt .= " and DOMAIN=".$dbh->quote($IN->{'DOMAIN'}); }
print $pstmt."\n";
$dbh->do($pstmt);
}
if ($IN->{'_cmd'} eq 'dns-domain-delete') {
return({ 'err'=>0, msg=>sprintf("deleted domain %s",$IN->{'DOMAIN'}) });
}
else {
return({ 'err'=>0, msg=>sprintf("deleted user %s",$IN->{'USERNAME'}) });
}
}
##
##
##
sub dns_wildcard_reserve {
my ($CFG,$IN) = @_;
my $OUT = undef;
my $dbh = $CFG->{'*dbh'};
my $pstmt = undef;
if (not defined $IN->{'DOMAIN'}) { $IN->{'DOMAIN'} = ''; }
$dbh->do("start transaction");
my $HOSTDOMAIN = sprintf("%s.%s",$IN->{'host'},$IN->{'zone'});
$pstmt = "delete from dns_records where DOMAIN=".$dbh->quote($IN->{'DOMAIN'})." and MID=".int($IN->{'MID'})." and host='\@' and zone=".$dbh->quote($HOSTDOMAIN);
print $pstmt."\n";
$dbh->do($pstmt);
## Add an SOA record.
$pstmt = &DBINFO_insert($dbh,'dns_records',{
'zone'=>$HOSTDOMAIN,
'host'=>'@',
'ttl'=>3600,
'serial'=>time(),refresh=>28800, retry=>3600, expire=>6048000, minimum=>3600,
'resp_person'=>sprintf("%s.",$CFG->{'WILDCARD_RNAME'}), 'data'=>sprintf("%s.",$CFG->{'WILDCARD_SOA'}),
'type'=>'SOA',
'MID'=>$IN->{'MID'},
'USERNAME'=>sprintf("%s",$IN->{'USERNAME'}),
'CLUSTER'=>sprintf("%s",$IN->{'CLUSTER'}),
'DOMAIN'=>sprintf("%s",$IN->{'DOMAIN'}),
},sql=>1,verb=>'insert');
print $pstmt."\n";
$dbh->do($pstmt);
## now add an "A" record.
$pstmt = &DBINFO_insert($dbh,'dns_records',{
'zone'=>$HOSTDOMAIN,
'host'=>'@',
'ttl'=>3600,
'type'=>'A',
'data'=>$IN->{'ipv4'},
'MID'=>$IN->{'MID'},
'USERNAME'=>sprintf("%s",$IN->{'USERNAME'}),
'CLUSTER'=>sprintf("%s",$IN->{'CLUSTER'}),
'DOMAIN'=>sprintf("%s",$IN->{'DOMAIN'}),
},sql=>1,verb=>'insert');
print $pstmt."\n";
$dbh->do($pstmt);
$dbh->do("commit");
return({ 'err'=>0, msg=>sprintf("domain %s.%s is %s",$IN->{'host'},$IN->{'zone'},$IN->{'ipv4'})});
}
##
##
##
sub dns_domain_update {
my ($CFG,$IN) = @_;
my ($ref) = $IN->{'%DOMAIN'};
my $OUT = undef;
my $USERNAME = $ref->{'USERNAME'};
my $domain = $ref->{'DOMAIN'} ;
open F, ">/tmp/$domain.dump";
print F Dumper($ref);
close F;
$domain = lc($domain);
$domain =~ s/[^a-z0-9\.\-]+//g;
next unless $domain;
my $whynot = undef;
my $dotdomain = ".$domain";
foreach my $verbotenregex (@BADNAMES) {
if ($dotdomain =~ /$verbotenregex/) { $whynot = $verbotenregex; }
}
## NOTE: the VIP is always what the IP should be for a valid www or m_ based on the cluster, it might be overwritten later by (for example) an ssl, etc.
if ($domain eq 'paypal.zoovy.com') {
die("this should have been blocked [earlier] - check your filters");
}
# Read old db
my @FILE = ();
my @SQL = ();
# Generate new db
## we need to have sslgmt in the header so when it updates, we'll bump the live date on the domain.
push(@FILE, "; $ref->{'DOMAIN'} user=$ref->{'USERNAME'} cluster=$ref->{'CLUSTER'}");
push(@FILE, "\$TTL $ref->{'TTL'};");
push(@FILE, "\$ORIGIN $ref->{'DOMAIN'}.");
## SQL ttl, zone will be added at the end of loop to all records.
my $SOA_NS = $ref->{'%SOA'}->{'NS'};
my $SOA_RNAME = $ref->{'%SOA'}->{'RNAME'};
my $SERIAL = $ref->{'%SOA'}->{'SERIAL'};
push(@FILE, "\@ IN SOA $SOA_NS. $SOA_RNAME. ( $SERIAL 28800 3600 6048000 3600 )");
push @SQL, { type=>'SOA', serial=>$SERIAL, data=>"$SOA_NS.", resp_person=>"$SOA_RNAME.", refresh=>28800, retry=>3600, expire=>6048000, minimum=>3600 };
foreach my $NS_SERVER (@{$ref->{'@NS'}}) {
push(@FILE, "\@ IN NS $NS_SERVER.");
push @SQL, { type=>'NS', host=>'@', data=>"$NS_SERVER." };
}
my @HOSTNAMES = keys %{$ref->{'%HOSTS'}};
if (defined $ref->{'%HOSTS'}->{'WWW'}) {
unshift @HOSTNAMES, '@'; ## this is domain.com .. it will be mapped to www.
}
foreach my $HOSTNAME (@HOSTNAMES) {
## www, m, app, secure.
my $HOSTINFO = $ref->{'%HOSTS'}->{$HOSTNAME};
if ($HOSTNAME eq '@') { $HOSTINFO = $ref->{'%HOSTS'}->{'WWW'}; }
if (not defined $HOSTINFO->{'HOSTTYPE'}) {
warn "UNKNOWN TYPE IN HOSTINFO FOR:$HOSTNAME --" . Dumper($HOSTINFO);
$HOSTINFO->{'HOSTTYPE'} = 'UNKNOWN';
}
elsif ($HOSTINFO->{'HOSTTYPE'} eq 'CUSTOM') {
## this will be overridden by a custom record. don't do anything
}
if (defined $HOSTINFO->{'HOSTTYPE'}) {
push @FILE, "; $HOSTNAME: $HOSTINFO->{'HOSTTYPE'}";
push(@FILE, "$HOSTNAME IN A $HOSTINFO->{'IP4'}");
my %HOST = ( host=>lc("$HOSTNAME"), type=>'A', data=>$HOSTINFO->{'IP4'} );
$HOST{'HOSTTYPE'} = $HOSTINFO->{'HOSTTYPE'};
if (
(defined $HOSTINFO->{'SSL_CERT'}) && ($HOSTINFO->{'SSL_CERT'} ne '') &&
(defined $HOSTINFO->{'SSL_KEY'}) && ($HOSTINFO->{'SSL_KEY'} ne '')
) {
## this would be a good place
$HOST{'SSL_CERT'} = $HOSTINFO->{'SSL_CERT'};
$HOST{'SSL_KEY'} = $HOSTINFO->{'SSL_KEY'};
};
push @SQL, \%HOST;
if (not defined $HOSTINFO->{'IP4'}) {
$OUT = { err=>2000, errmsg=>"No IP4 address for HOSTNAME:$HOSTINFO->{'HOSTNAME'}" };
}
}
}
##
## BEGIN: EMAIL
##
my @MXSERVERS = ();
push @FILE, "; EMAIL_TYPE: $ref->{'%EMAIL'}->{'TYPE'}";
if ($ref->{'%EMAIL'}->{'TYPE'} eq 'NONE') {
}
elsif ($ref->{'%EMAIL'}->{'TYPE'} eq 'GOOGLE') {
# ip4:66.240.244.192/27 include:_spf.google.com ~all
push @FILE, "; GOOGLE APPS:";
push @FILE, "mail IN CNAME ghs.google.com.";
push @SQL, { 'host'=>'mail', 'type'=>'cname', 'data'=>'ghs.google.com.' };
push @FILE, "calendar IN CNAME ghs.google.com.";
push @SQL, { 'host'=>'calendar', 'type'=>'cname', 'data'=>'ghs.google.com.' };
push @FILE, "docs IN CNAME ghs.google.com.";
push @SQL, { 'host'=>'docs', 'type'=>'cname', 'data'=>'ghs.google.com.' };
push @FILE, "\@\tIN\tTXT \"v=spf1 include:_spf.google.com include:_spf.zoovymail.com ~all\"";
push @SQL, { host=>'@', type=>'txt', data=>qq|v=spf1 include:_spf.google.com include:_spf.zoovymail.com ~all| };
push @MXSERVERS, 'ASPMX.L.GOOGLE.COM';
push @MXSERVERS, 'ALT1.ASPMX.L.GOOGLE.COM';
push @MXSERVERS, 'ALT2.ASPMX.L.GOOGLE.COM';
push @MXSERVERS, 'ASPMX2.GOOGLEMAIL.COM';
push @MXSERVERS, 'ASPMX3.GOOGLEMAIL.COM';
push @MXSERVERS, 'ASPMX4.GOOGLEMAIL.COM';
push @MXSERVERS, 'ASPMX5.GOOGLEMAIL.COM';
}
elsif ($ref->{'%EMAIL'}->{'TYPE'} eq 'FUSEMAIL') {
push @FILE, "\@\tIN\tTXT \"v=spf1 include:fusemail.net include:mailanyone.net include:_spf.zoovymail.com ~all\"";
push @SQL, { 'type'=>'txt', data=>qq|v=spf1 include:fusemail.net include:mailanyone.net include:_spf.zoovymail.com ~all| };
push @MXSERVERS, 'mx.mailanyone.net';
push @MXSERVERS, 'mx2.mailanyone.net';
push @MXSERVERS, 'mx3.mailanyone.net';
## 4/4/11 - webmail3.mailanyone.net goes to version 3 of the webmail interface, apparently
#@ www.mailanyone.net still points at version 2 (yay!) which is deprecated /no longer supported.
push @FILE, 'webmail IN CNAME webmail3.mailanyone.net.';
push @SQL, { host=>'webmail', type=>'CNAME', data=>'webmail3.mailanyone.net.' };
push @FILE, 'smtp IN CNAME smtp.mailanyone.net.';
push @SQL, { host=>'smtp', type=>'CNAME', data=>'smtp.mailanyone.net.' };
push @FILE, 'imap IN CNAME imap.mailanyone.net.';
push @SQL, { host=>'imap', type=>'CNAME', data=>'imap.mailanyone.net.' };
push @FILE, 'pop IN CNAME pop.mailanyone.net.';
push @SQL, { host=>'pop', type=>'CNAME', data=>'pop.mailanyone.net.' };
push @FILE, 'ftp IN CNAME ftp.mailanyone.net.';
push @SQL, { host=>'ftp', type=>'CNAME', data=>'ftp.mailanyone.net.' };
}
elsif ($ref->{'%EMAIL'}->{'TYPE'} eq 'MX') {
foreach my $MXPOS ('MX1','MX2','MX3') {
my $MXSERVER = $ref->{'%EMAIL'}->{$MXPOS};
if ((not defined $MXSERVER) || ($MXSERVER eq '')) {
if ($MXPOS eq 'MX1') {
push @FILE, "; [WARN] No $MXPOS server specified";
}
next;
}
$MXSERVER=lc($MXSERVER);
$MXSERVER =~ s/\.$//g; # strip trailing periods (we'll re-add them later)
if ($MXSERVER =~ /^[0-9\.]+$/) {
# No IP addresses
push @FILE, "; [WARN] $MXPOS ($MXSERVER) cannot be an ip address.";
$MXSERVER = undef;
}
else {
my ($mxname,$mxaliases,$mxaddrtype,$mxlength,@addrs) = gethostbyname($MXSERVER);
if ($mxname eq '' || $#addrs < 0) {
# No answer = invalid
push @FILE, "; [WARN] $MXPOS ($MXSERVER) is lame (not functional).";
$MXSERVER = undef;
}
}
if (defined $MXSERVER) {
push @MXSERVERS, $MXSERVER;
}
else {
push @FILE, "; [WARN] Invalid $MXPOS for $domain";
}
}
if ($MXSERVERS[0] =~ /secureserver\.net/) {
push @FILE, 'webmail IN CNAME email.secureserver.net.';
push @SQL, { host=>'webmail', type=>'CNAME', data=>'email.secureserver.net.' };
push @FILE, 'mail IN CNAME pop.secureserver.net.';
push @SQL, { host=>'mail', type=>'CNAME', data=>'pop.secureserver.net.' };
push @FILE, 'pop IN CNAME pop.secureserver.net.';
push @SQL, { host=>'pop', type=>'CNAME', data=>'pop.secureserver.net.' };
push @FILE, 'imap IN CNAME imap.secureserver.net.';
push @SQL, { host=>'imap', type=>'CNAME', data=>'imap.secureserver.net.' };
push @FILE, 'email IN CNAME email.secureserver.net.';
push @SQL, { host=>'email', type=>'CNAME', data=>'email.secureserver.net.' };
}
elsif ($MXSERVERS[0] =~ /mxmail\.register\.com/) {
push(@FILE, 'mail IN CNAME webmail.register.com.');
push @SQL, { 'host'=>'mail', type=>'CNAME', data=>'webmail.register.com.' };
}
#elsif ($MXSERVERS[0] =~ /^[\d]+\.[\d]+\.[\d]+\.[\d]+/) {
# push @FILE, "mail IN CNAME $MXSERVERS[0].";
# push @SQL, { 'host'=>'mail', type=>'CNAME', data=>$MXSERVERS[0] };
# $MXSERVERS[0] = "mail.$domain";
# }
}
else {
# $ref->{'%EMAIL'}->{'TYPE'} is not defined correctly
push @FILE, "; [WARN] Invalid EMAIL_TYPE:$ref->{'%EMAIL'}->{'TYPE'}";
# @MXSERVERS = ('10 undef.zoovy.com');
}
if (@MXSERVERS) {
my $mx_priority = 0;
for my $mx (@MXSERVERS) {
## $mx =~ s/\.$//g; # strip trailing dots at the end of mx server name.
push @FILE, "\@ IN MX $mx_priority $mx.";
push @SQL, { 'host'=>'@', 'type'=>'mx', 'mx_priority'=>($mx_priority+=10), data=>"$mx." };
}
}
if (ref($ref->{'@CUSTOM'}) eq 'ARRAY') {
push @FILE, sprintf('; (%d) CUSTOM RECORDS: ',scalar(@{$ref->{'@CUSTOM'}}));
foreach my $row (@{$ref->{'@CUSTOM'}}) {
push @FILE, sprintf("%s\t%s\t%s",$row->{'host'},$row->{'type'},$row->{'data'});
if ($row->{'type'} eq 'MX') {
($row->{'mx_priority'},$row->{'data'}) = split(/[\s\t]+/,$row->{'data'});
}
push @SQL, $row;
}
}
##
## END OF EMAIL
##
#if (defined $custom{$domain}) {
# push @FILE, "; BEGIN Custom appends from $CUSTOM_CONF";
# foreach my $customline (@{$custom{$domain}}) {
# push @FILE, $customline;
# }
# push @FILE, "; END Custom";
# }
## check to see if we have an alt "www" vip assigned in custom.conf
if ($ref->{'DKIM_PUBKEY'} =~ /[\n\r]+/) {
push @FILE, "; [WARN] DKIM records should NOT have hard returns in them at this point. (removing DKIM)";
$ref->{'DKIM_PUBKEY'} = '';
}
if ($ref->{'%EMAIL'}->{'TYPE'} eq 'NONE') {
if ($ref->{'DKIM_PUBKEY'} eq '') {
push @FILE, "; [WARN] DKIM was ignored because EMAIL_TYPE is NONE";
}
}
elsif ($ref->{'DKIM_PUBKEY'} ne '') {
## _domainkeys.domain.com
push @FILE, qq~\$ORIGIN s1._domainkey.${domain}.~;
if ($ref->{'DKIM_PUBKEY'} ne '') {
push @FILE, qq~\@\tIN\tTXT \"k=rsa; p=$ref->{'DKIM_PUBKEY'}\"~;
}
# push @SQL, { host=>"s1", zone=>"_domainkey.$domain", type=>'txt', data=>"k=rsa; p=$ref->{'DKIM_PUBKEY'}" };
push @SQL, { host=>"s1._domainkey", type=>'txt', data=>"k=rsa; p=$ref->{'DKIM_PUBKEY'}" };
}
#if ($ref->{'NEWSLETTER_ENABLE'}) {
# ## newsletter.domain.com
# push @FILE, qq~\$ORIGIN newsletter.${domain}.~;
# push @FILE, qq~\@\tIN\tTXT \"v=spf1 ip4:66.240.244.192/27 ip4:208.74.184.0/24 -all\"~;
# push @FILE, qq~\@\tIN\tMX 5 mail.zoovy.com.~;
# ## _domainkeys.newsletter.domain.com
# if ($ref->{'DKIM_PUBKEY'} ne '') {
# push @FILE, qq~\$ORIGIN s1._domainkey.newsletter.${domain}.~;
# push @FILE, qq~\@\tIN\tTXT \"k=rsa; p=$ref->{'DKIM_PUBKEY'}\"~;
# }
# }
#if (1) {
# ## CONFIG RECORD
push @FILE, qq~\$ORIGIN config.${domain}.~;
push @FILE, qq~\@\tIN\tTXT \"app=zoovy user=$USERNAME cluster=$ref->{'CLUSTER'} prt=$ref->{'PRT'} v=$ref->{'MODIFIED_GMT'}\"~;
push @SQL, { host=>'config', type=>'txt', data=>"app=zoovy user=$USERNAME cluster=$ref->{'CLUSTER'} prt=$ref->{'PRT'} v=$ref->{'MODIFIED_GMT'}" };
# }
foreach my $sql (@SQL) {
if (not defined $sql->{'zone'}) { $sql->{'zone'} = $domain; }
if (not defined $sql->{'ttl'}) { $sql->{'ttl'} = $ref->{'TTL'}; }
if (not defined $sql->{'host'}) {
warn "NO HOST -- type:$sql->{'type'} data:$sql->{'data'}\n";
$sql->{'host'} = '@';
}
$sql->{'MID'} = int($ref->{'MID'});
$sql->{'USERNAME'} = sprintf("%s",$ref->{'USERNAME'});
$sql->{'CLUSTER'} = sprintf("%s",$ref->{'CLUSTER'});
}
##
if (not defined $OUT) {
## got an error, don't do anything!
open F, ">/tmp/$domain.db";
for (@FILE) { print F "$_\n"; }
print F "\n; SQL:\n";
foreach my $line (split(/\n/,Dumper(\@SQL))) {
print F "; $line\n";
}
close F;
$OUT = { 'err'=>0, 'msg'=>"wrote /tmp/$domain.db" };
}
if ($OUT->{'err'} == 0) {
my $dbh = $CFG->{'*dbh'};
$dbh->do("start transaction");
my $pstmt = "delete from dns_records where MID=".int($ref->{'MID'})." and zone=".$dbh->quote($domain);
$dbh->do($pstmt);
foreach my $sql (@SQL) {
my ($pstmt) = &DBINFO_insert($dbh,'dns_records',$sql,verb=>'insert',sql=>1);
print $pstmt."\n";
$dbh->do($pstmt);
}
#my $pstmt = "delete from dns_records where MID=".int($ref->{'MID'})." and zone=".$dbh->quote($domain)." and serial!=".int($SERIAL);
#$dbh->do($pstmt);
$dbh->do("commit");
}
return($OUT);
}
##
## takes an arrayref, turns it into
## ('1','2','3')
##
sub DBINFO_makeset {
my ($dbh, $arref) = @_;
my $set = '';
foreach my $x (@{$arref}) {
$set .= $dbh->quote($x).',';
}
if ($set ne '') {
chop($set);
$set = "($set)";
}
return($set);
}
##
## does a simple insert statement to a table, from a hash
## parameters: a dbh reference, TABLE NAME, hashref (key=>value)
## options:
## key=>causes us to do a select count(*) and then switch to update mode
## see notes in the code for specific behaviors for scalar, arrayref, hashref
## debug=>(bitise)
## 1 - output to stderr
## 2 - do not apply statements.
## update=>0|1|2 (default is 1)
## 0 = force an insert
## 2 = force an update
## sql=>1
## returns an sql statement, turns off STDERR print
## returns:
## pstmt or undef if error (if it was applied to database)
##
sub DBINFO_insert {
my ($dbh,$TABLE,$kvpairs,%options) = @_;
if (defined $options{'sql'}) {
$options{'debug'} |= 2;
$options{'debug'} = $options{'debug'} & (0xFF-1);
}
if (not defined $options{'debug'}) { $options{'debug'}=0; }
if (not defined $dbh) { $options{'debug'} = $options{'debug'} | 2; }
if ($options{'debug'}&1) {
# use Data::Dumper;
# print STDERR Dumper($TABLE,$kvpairs,%options);
}
my $mode = 0; # insert, 1=update, -1 skip action, 0 = figure it out, 2 = force insert
if (defined $options{'verb'}) {
$mode = -1;
if ($options{'verb'} eq 'auto') { $mode = 0; }
if ($options{'verb'} eq 'update') { $mode = 1; }
if ($options{'verb'} eq 'insert') { $mode = 2; }
if ($mode == -1) {
warn "DBINFO::insert unknown verb=$options{'verb'} (should be auto|update|insert)\n";
}
}
elsif ((defined $options{'update'}) && ($options{'update'}==2)) {
## pass in update=>2 to force us to generate an update statement
## (do this when we're sure the record already exists)
$mode = 1;
}
if (($mode == 0) && (defined $options{'key'})) {
my $pstmt = '';
if ( (ref($options{'key'}) eq 'SCALAR') || (ref($options{'key'}) eq '') ) {
## simple: key=scalarkey (value looked up in $kvpairs)
$pstmt = "select count(*) from $TABLE where ".$options{'key'}.'='.$dbh->quote($kvpairs->{$options{'key'}});
}
elsif (ref($options{'key'}) eq 'ARRAY') {
## more complex: key=[kvkey1,kvkey2,kvkey3] (values looked up in $kvpairs)
foreach my $k (@{$options{'key'}}) {
if ($pstmt ne '') { $pstmt .= " and "; }
$pstmt .= $k.'='.$dbh->quote($kvpairs->{$k});
}
$pstmt = "select count(*) from $TABLE where $pstmt";
}
elsif (ref($options{'key'}) eq 'HASH') {
## ultra complex: key={ key1=>value1, key2=>value2 }
foreach my $k (keys %{$options{'key'}}) {
if ($pstmt ne '') { $pstmt .= " and "; }
$pstmt .= $k.'='.$dbh->quote($options{'key'}->{$k});
}
$pstmt = "select count(*) from $TABLE where $pstmt";
}
my $sth = $dbh->prepare($pstmt);
$sth->execute();
my ($exists) = $sth->fetchrow();
$sth->finish();
if ($exists>0) {
$mode = 1; # update
}
else {
$mode = 2; # insert
}
if ((defined $options{'update'}) && ($options{'update'}==0) && ($mode==1)) {
## if we are told not to do updates, and we're supposed to do an update then don't do anything.
$mode = -1;
}
}
if ($mode == 0) { $mode = 2; }
# convert any "auto" to automatic insert (since our function name is DBINFO::insert)
my $pstmt = '';
if ($mode==2) {
## insert statement
my $tmp = '';
if (defined $options{'on_insert'}) {
## on_insert is a hash of key values which are ONLY transmittined on insert e.g. CREATED_GMT
foreach my $k (keys %{$options{'on_insert'}}) {
$kvpairs->{$k} = $options{'on_insert'}->{$k};
}
}
foreach my $k (keys %{$kvpairs}) {
if ($pstmt) { $tmp .= ','; $pstmt .= ','; }
if (substr($k,0,1) eq '*') { ## RAW
$pstmt .= substr($k,1);
$tmp .= $kvpairs->{$k};
}
else {
$pstmt .= $k;
$tmp .= $dbh->quote($kvpairs->{$k});
}
}
$pstmt = 'insert '.($options{'delayed'}?'DELAYED':'').' into '.$TABLE.' ('.$pstmt.') values ('.$tmp.')';
}
elsif (($mode==1) && (defined $options{'key'})) {
## update statement
foreach my $k (keys %{$kvpairs}) {
if (substr($k,0,1) eq '*') { ## RAW
$pstmt .= (($pstmt)?',':'').substr($k,1).'='.$kvpairs->{$k};
}
else {
$pstmt .= (($pstmt)?',':'').$k.'='.$dbh->quote($kvpairs->{$k});
}
}
if (ref($options{'key'}) eq 'SCALAR') {
$pstmt = 'update '.($options{'delayed'}?'DELAYED':'')." $TABLE set ".$pstmt." where ".$options{'key'}.'='.$dbh->quote($kvpairs->{$options{'key'}});
}
elsif (ref($options{'key'}) eq 'ARRAY') {
## more complex: key=[kvkey1,kvkey2,kvkey3] (values looked up in $kvpairs)
$pstmt = 'update '.($options{'delayed'}?'DELAYED':'')." $TABLE set $pstmt where ";
my $count = 0;
foreach my $k (@{$options{'key'}}) {
if ($count++) { $pstmt .= " and "; }
$pstmt .= $k.'='.$dbh->quote($kvpairs->{$k});
}
}
elsif (ref($options{'key'}) eq 'HASH') {
## ultra complex: key={ key1=>value1, key2=>value2 }
$pstmt = 'update '.($options{'delayed'}?'DELAYED':'')." $TABLE set $pstmt where ";
my $count = 0;
foreach my $k (keys %{$options{'key'}}) {
if ($count++) { $pstmt .= " and "; }
$pstmt .= $k.'='.$dbh->quote($options{'key'}->{$k});
}
}
}
else {
warn "DBINFO::insert NO KEY SPECIFIED BUT \$mode==$mode";
}
if ($options{'debug'}&1) {
print STDERR "PSTMT: ".$pstmt."\n";
}
if (not $options{'debug'}&2) {
my $rv = $dbh->do($pstmt);
if (not $rv) {
my ($package,$file,$line,$sub,$args) = caller(0);
print STDERR "CALLER[0]: $package,$file,$line,$sub,$args\n";
}
}
return($pstmt);
}
1; | CommerceRack/backend | lib/PLATFORM/DNSSERVER.pm | Perl | mit | 22,236 |
module ApplicationHelper
def css_by_flash_key(key)
return 'info' if key == :notice
return 'danger' if key == :error
return key.to_s
end
def cancel_submit_link_btn(back_url = request.referrer)
link_to 'Cancel', back_url, class: 'btn btn-default'
end
end
| ktei/moment2 | app/helpers/application_helper.rb | Ruby | mit | 278 |
# lojavirtual
Projeto para a disciplina de tópicos especiais
| paulitolinhares/lojavirtual | README.md | Markdown | mit | 62 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>functions-in-zfc: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0 / functions-in-zfc - 8.7.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
functions-in-zfc
<small>
8.7.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-01-29 07:47:20 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-01-29 07:47:20 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.04.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.04.2 Official 4.04.2 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/functions-in-zfc"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/FunctionsInZFC"]
depends: [
"ocaml"
"coq" {>= "8.7" & < "8.8~"}
]
tags: [
"keyword: set theory"
"keyword: Zermelo-Fraenkel"
"keyword: functions"
"category: Mathematics/Logic/Set theory"
"date: April 2001"
]
authors: [ "Carlos Simpson <[email protected]>" ]
bug-reports: "https://github.com/coq-contribs/functions-in-zfc/issues"
dev-repo: "git+https://github.com/coq-contribs/functions-in-zfc.git"
synopsis: "Functions in classical ZFC"
description: """
This mostly repeats Guillaume Alexandre's contribution `zf',
but in classical logic and with a different proof style. We start with a
simple axiomatization of some flavor of ZFC (for example Werner's
implementation of ZFC should provide a model).
We develop some very basic things like pairs, functions, and a little
bit about natural numbers, following the standard classical path."""
flags: light-uninstall
url {
src:
"https://github.com/coq-contribs/functions-in-zfc/archive/v8.7.0.tar.gz"
checksum: "md5=3a5319b8b3971c063202173ec5f75bf3"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-functions-in-zfc.8.7.0 coq.8.5.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0).
The following dependencies couldn't be met:
- coq-functions-in-zfc -> coq >= 8.7 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-functions-in-zfc.8.7.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| coq-bench/coq-bench.github.io | clean/Linux-x86_64-4.04.2-2.0.5/released/8.5.0/functions-in-zfc/8.7.0.html | HTML | mit | 7,398 |
# Install script for directory: /home/carlo-vd/SVN/LDV_14cpp7/Projekt/3rdparty/hermes
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
IF(BUILD_TYPE)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "Debug")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
IF(COMPONENT)
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
ELSE(COMPONENT)
SET(CMAKE_INSTALL_COMPONENT)
ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
# Install shared libraries without execute permission?
IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
SET(CMAKE_INSTALL_SO_NO_EXE "1")
ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
| jdsika/TUM_AdvancedCourseCPP | Projekt/build/3rdparty/hermes/cmake_install.cmake | CMake | mit | 1,182 |
/**
* Copyright (C) 2012
* Ekaterina Potapova
* Automation and Control Institute
* Vienna University of Technology
* Gusshausstraße 25-29
* 1040 Vienna, Austria
* potapova(at)acin.tuwien.ac.at
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/
*/
#include "v4r/attention_segmentation/connectedComponents.h"
namespace v4r
{
ConnectedComponent::ConnectedComponent()
{
points.clear();
saliency_values.clear();
average_saliency = 0;
}
void extractConnectedComponents(cv::Mat map, std::vector<ConnectedComponent> &connected_components, float th)
{
assert(map.type() == CV_32FC1);
assert((th >= 0) && (th <= 1));
cv::Mat map_copy;
map.copyTo(map_copy);
for(int i = 0; i < map_copy.rows; ++i)
{
for(int j = 0; j < map_copy.cols; ++j)
{
if(map_copy.at<float>(i,j) > th)
{
ConnectedComponent new_component;
new_component.points.push_back(cv::Point(j,i));
new_component.saliency_values.push_back(map_copy.at<float>(i,j));
new_component.average_saliency = map_copy.at<float>(i,j);
map_copy.at<float>(i,j) = 0;
std::vector<cv::Point> queue;
queue.push_back(cv::Point(j,i));
while(queue.size())
{
cv::Point cur_point = queue.back();
queue.pop_back();
for(int p = 0; p < 8; ++p)
{
int new_x = cur_point.x + dx8[p];
int new_y = cur_point.y + dy8[p];
if((new_x < 0) || (new_y < 0) || (new_x >= map_copy.cols) || (new_y >= map_copy.rows))
continue;
if(map_copy.at<float>(new_y,new_x) > th)
{
new_component.points.push_back(cv::Point(new_x,new_y));
new_component.saliency_values.push_back(map_copy.at<float>(new_y,new_x));
new_component.average_saliency += map_copy.at<float>(new_y,new_x);
map_copy.at<float>(new_y,new_x) = 0;
queue.push_back(cv::Point(new_x,new_y));
}
}
}
new_component.average_saliency /= new_component.points.size();
if(new_component.average_saliency > th)
{
connected_components.push_back(new_component);
}
}
}
}
}
void extractConnectedComponents(cv::Mat map, std::vector<ConnectedComponent> &connected_components, cv::Point attention_point, float th)
{
assert(map.type() == CV_32FC1);
assert((th >= 0) && (th <= 1));
cv::Mat map_copy;
map.copyTo(map_copy);
int i = attention_point.y;
int j = attention_point.x;
if(map_copy.at<float>(i,j) > th)
{
ConnectedComponent new_component;
new_component.points.push_back(cv::Point(j,i));
new_component.saliency_values.push_back(map_copy.at<float>(i,j));
new_component.average_saliency = map_copy.at<float>(i,j);
map_copy.at<float>(i,j) = 0;
std::vector<cv::Point> queue;
queue.push_back(cv::Point(j,i));
while(queue.size())
{
cv::Point cur_point = queue.back();
queue.pop_back();
for(int p = 0; p < 8; ++p)
{
int new_x = cur_point.x + dx8[p];
int new_y = cur_point.y + dy8[p];
if((new_x < 0) || (new_y < 0) || (new_x >= map_copy.cols) || (new_y >= map_copy.rows))
continue;
if(map_copy.at<float>(new_y,new_x) > th)
{
new_component.points.push_back(cv::Point(new_x,new_y));
new_component.saliency_values.push_back(map_copy.at<float>(new_y,new_x));
new_component.average_saliency += map_copy.at<float>(new_y,new_x);
map_copy.at<float>(new_y,new_x) = 0;
queue.push_back(cv::Point(new_x,new_y));
}
}
}
new_component.average_saliency /= new_component.points.size();
if(new_component.average_saliency > th)
{
connected_components.push_back(new_component);
}
}
}
/*void extractConnectedComponents2(cv::Mat map, std::vector<ConnectedComponent> &connected_components, float th)
{
assert(map.type() == CV_32FC1);
assert((th >= 0) && (th <= 1));
cv::Mat map_copy;
map.copyTo(map_copy);
double maxVal=0;
cv::Point maxLoc;
cv::minMaxLoc(map,0,&maxVal,0,&maxLoc);
while(maxVal > 0)
{
//if(count>20)
cv::Point maxLoc_new;
winnerToImgCoords(maxLoc_new,maxLoc,mapLevel);
centers.push_back(maxLoc_new);
//count = 1;
float maxValTh = (1-th)*maxVal;
std::list<cv::Point> points;
points.push_back(maxLoc);
cv::Mat used = cv::Mat_<uchar>::zeros(map.rows,map.cols);
used.at<uchar>(maxLoc.y,maxLoc.x) = 1;
map.at<float>(maxLoc.y,maxLoc.x) = 0;
while(points.size())
{
cv::Point p = points.front();
points.pop_front();
if(((p.x+1) < map.cols) && (!used.at<uchar>(p.y,p.x+1)) && (map.at<float>(p.y,p.x+1)>maxValTh))
{
points.push_back(cv::Point(p.x+1,p.y));
used.at<uchar>(p.y,p.x+1) = 1;
map.at<float>(p.y,p.x+1) = 0;
//count++;
}
if(((p.x-1) >= 0) && (!used.at<uchar>(p.y,p.x-1)) && (map.at<float>(p.y,p.x-1)>maxValTh))
{
points.push_back(cv::Point(p.x-1,p.y));
used.at<uchar>(p.y,p.x-1) = 1;
map.at<float>(p.y,p.x-1) = 0;
//count++;
}
if(((p.y+1) < map.rows) && (!used.at<uchar>(p.y+1,p.x)) && (map.at<float>(p.y+1,p.x)>maxValTh))
{
points.push_back(cv::Point(p.x,p.y+1));
used.at<uchar>(p.y+1,p.x) = 1;
map.at<float>(p.y+1,p.x) = 0;
//count++;
}
if(((p.y-1) >= 0) && (!used.at<uchar>(p.y-1,p.x)) && (map.at<float>(p.y-1,p.x)>maxValTh))
{
points.push_back(cv::Point(p.x,p.y-1));
used.at<uchar>(p.y-1,p.x) = 1;
map.at<float>(p.y-1,p.x) = 0;
//count++;
}
}
cv::minMaxLoc(map,0,&maxVal,0,&maxLoc);
//cv::imshow("map",map);
//cv::waitKey();
}
}*/
void drawConnectedComponent(ConnectedComponent component, cv::Mat &image, cv::Scalar color)
{
int nchannels = image.channels();
for(unsigned j = 0; j < component.points.size(); ++j)
{
int x = component.points.at(j).x;
int y = component.points.at(j).y;
for(int i = 0; i < nchannels; ++i)
{
image.at<uchar>(y,nchannels*x+i) = color(i);
}
}
}
void drawConnectedComponents(std::vector<ConnectedComponent> components, cv::Mat &image, cv::Scalar color)
{
for(unsigned int i = 0; i < components.size(); ++i)
{
drawConnectedComponent(components.at(i),image,color);
}
}
} //namespace v4r
| ThoMut/v4r | modules/attention_segmentation/src/connectedComponents.cpp | C++ | mit | 6,854 |
//
// Copyright (c) articy Software GmbH & Co. KG. All rights reserved.
//
#pragma once
#include "ArticyPins.h"
#include "ArticyFlowObject.h"
#include "ArticyOutputPinsProvider.generated.h"
UINTERFACE()
class ARTICYRUNTIME_API UArticyOutputPinsProvider : public UArticyFlowObject { GENERATED_BODY() };
/**
* All objects that have a property called 'OutputPins' (which is an array of UArticyInputPin*)
* implement this interface.
*/
class ARTICYRUNTIME_API IArticyOutputPinsProvider : public IArticyFlowObject
{
GENERATED_BODY()
public:
void Explore(UArticyFlowPlayer* Player, TArray<FArticyBranch>& OutBranches, const uint32& Depth) override;
const TArray<UArticyOutputPin*>* GetOutputPinsPtr() const;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Articy")
TArray<UArticyOutputPin*> GetOutputPins() const;
TArray<UArticyOutputPin*> GetOutputPins_Implementation() const;
};
| ArticySoftware/ArticyImporterForUnreal | Source/ArticyRuntime/Public/Interfaces/ArticyOutputPinsProvider.h | C | mit | 912 |
<?php
namespace Bootstrap;
use Illuminate\Routing\UrlGenerator as IlluminateUrlGenerator;
class UrlGenerator extends IlluminateUrlGenerator
{
protected $cdnRoot = '';
public function setCdnRoot($cdnRoot)
{
$this->cdnRoot = $cdnRoot;
}
public function asset($path, $secure = null)
{
$secure = $secure ?: $this->request->secure();
if ($this->cdnRoot) {
return $this->assetFrom($this->cdnRoot, $path, $secure);
}
return parent::asset($path, $secure);
}
}
| feryardiant/laravel-project | bootstrap/cms/UrlGenerator.php | PHP | mit | 539 |
<!DOCTYPE html>
<html class="pl">
<head>
<title>Pattern Lab</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" href="/assets/../components/css/pattern-scaffolding.css?1493209668" media="all" />
<link rel="stylesheet" href="/assets/style.css?1493209668" media="all" />
<!-- Begin Pattern Lab (Required for Pattern Lab to run properly) -->
<!-- never cache patterns -->
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
<link rel="stylesheet" href="../../styleguide/css/styleguide.min.css?1493209668" media="all">
<link rel="stylesheet" href="../../styleguide/css/prism-typeahead.min.css?1493209668" media="all" />
<!-- End Pattern Lab -->
</head>
<body class="b-body">
<main>
<!-- for js not found errors (only in styleguide)-->
<div class="visually-hidden">
<div id="tabs" class="tabs"></div>
</div>
<header class="o-header">
<div class="o-header__logo">
<div class="m-logo">
<div class="m-logo__svg-wrapper">
<a class="m-logo__link" href="#">
<svg class="m-logo__svg"><use xlink:href="/assets/svg/svg-art.svg#caterme-logo"></use></svg>
<div class="m-logo__hidden-text">Home</div>
</a>
</div>
</div>
</div>
<div class="o-header__menu-main">
<ul class="m-menu-main">
<li class="m-menu-main__item">
<a href="#" class="m-menu-main__link">Link 1</a>
</li>
<li class="m-menu-main__item">
<a href="#" class="m-menu-main__link">Link 2</a>
</li>
<li class="m-menu-main__item">
<a href="#" class="m-menu-main__link">Link 3</a>
</li>
<li class="m-menu-main__item is-active">
<a href="#" class="m-menu-main__link">Link 4</a>
</li>
</ul>
</div>
</header>
<!--DO NOT REMOVE-->
<script type="text/json" id="sg-pattern-data-footer" class="sg-pattern-data">
{"cssEnabled":false,"lineage":[],"lineageR":[],"patternBreadcrumb":{"patternType":"organisms","patternSubtype":"site"},"patternDesc":"","patternExtension":"twig","patternName":"header","patternPartial":"organisms-header","patternState":"","extraOutput":[]}
</script>
<script>
/*!
* scriptLoader - v0.1
*
* Copyright (c) 2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
*/
var scriptLoader = {
run: function(js,cb,target) {
var s = document.getElementById(target+'-'+cb);
for (var i = 0; i < js.length; i++) {
var src = (typeof js[i] != 'string') ? js[i].src : js[i];
var c = document.createElement('script');
c.src = '../../'+src+'?'+cb;
if (typeof js[i] != 'string') {
if (js[i].dep !== undefined) {
c.onload = function(dep,cb,target) {
return function() {
scriptLoader.run(dep,cb,target);
}
}(js[i].dep,cb,target);
}
}
s.parentNode.insertBefore(c,s);
}
}
}
</script>
<script id="pl-js-polyfill-insert-1493209668">
(function() {
if (self != top) {
var cb = '1493209668';
var js = [];
if (typeof document !== 'undefined' && !('classList' in document.documentElement)) {
js.push('styleguide/bower_components/classList.min.js');
}
scriptLoader.run(js,cb,'pl-js-polyfill-insert');
}
})();
</script>
<script id="pl-js-insert-1493209668">
(function() {
if (self != top) {
var cb = '1493209668';
var js = [ { 'src': 'styleguide/bower_components/jwerty.min.js', 'dep': [ 'styleguide/js/patternlab-pattern.min.js' ] } ];
scriptLoader.run(js,cb,'pl-js-insert');
}
})();
</script>
<!-- ToDo: Review Paths to all js -->
<!-- may need to change these below based on path -->
<!-- <script src="../../../../../../../core/assets/vendor/domready/ready.min.js"></script> -->
<!-- <script src="../../../../../../../core/misc/drupal.js"></script> -->
<script src="https://code.jquery.com/jquery-2.2.4.js"
integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.4.1/velocity.js"></script>
<script src="/assets/js/scripts.js"></script>
</main>
</body>
</html>
| AlexKomm/alexkomm.github.io | public/patterns/03-organisms-site-00-header-header/03-organisms-site-00-header-header.html | HTML | mit | 4,577 |
# [NDS] Mega Man ZX - Tradução PT-BR
Este é um projeto de tradução do jogo Mega Man ZX, de Nintendo DS, para português do Brasil. O projeto iniciou-se com base na versão americana do jogo, e posteriormente foi migrado para a versão japonesa para fins de Undub.
Mega Man ZX é o primeiro jogo da sexta saga da franquia Mega Man. Lançado em 2006, é a continuação direta de Mega Man Zero 4. Pela primeira vez na franquia, o jogo oferece a opção de selecionar um protagonista masculino (Vent) ou feminino (Aile), antes de começar a jogar. Alguns diálogos variam em função do personagem escolhido, dando uma certa variedade no jogo.
# Informações
Nome do jogo: Mega Man ZX / Rock Man ZX
Versão: Americana / Japonesa
Plataforma: Nintendo DS
Desenvolvedora: Inticreates
Distribuidora: Capcom
Gênero: Aventura / Plataforma / Metroidvania
Jogadores: 1
# Enredo
Cerca de dois séculos depois dos acontecimentos de Mega Man Zero, no ano 25XX, humanos e replóides agora vivem em harmonia, sem mais lutas e guerras entre si. A harmoniosidade entre ambos é tão grande, que mal se nota a diferença entre um humano e um replóide agora. Mas mesmo após o ocorrido há dois séculos, resquícios do passado continuam sendo encontrados. Antigas ruínas são constantemente escavadas e arqueólogos encontram artefatos estranhos, contendo registros das batalhas, histórias e vida de antigos guerreiros, como X, Zero, Harpuia, etc. Estes artefatos foram batizados de "Biometais".
No entanto, após um bom tempo de paz, repentinamente alguns replóides, e até mesmo humanos, começam a agir de forma estranha. Ficam violentos, agressivos, atacam quem estiver em sua frente: Os Mavericks haviam ressurgido. O restante dos humanos e os replóides inafetados tiveram uma única saída: construíram um tipo de “cidade fortaleza”, chamada de Innerpeace, para prevenir a entrada dos Mavericks, que ficam nas fronteiras do lado de fora.
Vent e Aile são dois jovens que trabalham Girouette Expresso, uma transportadora que circula por toda a Innerpeace. Porém, certa vez eles se vêem obrigados a ir às fronteiras para cumprir seu trabalho, e é nessa hora que eles são atacados por Mavericks.
Enquanto Vent/Aile junto com Giro transportam um Biometal, eles caem em um buraco e vê algumas pessoas sendo atacadas por um Mecanilóide cobra. O Biometal, ao ver Vent / Aile em apuros, decide emprestar seu poder, para que possa enfrentar os perigos.
Com isso, Vent / Aile decidem usar seus novos poderes para descobrir a razão por trás do ressurgimento dos Mavericks. Mal sabem eles que acabarão descobrindo uma conspiração maior por trás dos panos, onde até mesmo os principais idealizadores da paz estão envolvidos.
# Sobre a tradução
Havia conhecido a nova saga ZX da franquia Mega Man alguns anos atrás, mas por falta de tempo (e torcer um pouco o nariz com os novos protagonistas e novo rumo da história), não havia jogado nenhum dos dois jogos por muito tempo.
No entanto, levando em consideração que no passado eu também havia traduzido os quatro jogos da saga Mega Man Zero de Gameboy Advance, alguns anos atrás eu havia tentato iniciar um projeto para traduzir os jogos da saga Mega Man ZX para português, começando pelo desenvolvimento de uma ferramenta para extrair e reinserir textos dinamicamente. Mas a falta de tempo, misturado com a falta de paciência para terminar a ferramenta e corrigir seus bugs, acabou mantendo o projeto parado.
Mas após eu ter zerado pela primeira vez ambos os jogos da franquia alguns meses atrás, decidi tocar o projeto pra frente, terminando o desenvolvimento e teste da ferramenta, e iniciando a tradução em seguida. Decidi pôr todos os arquivos e descobertas na nuvem, aqui no Github, e aqui estão: a ferramenta de dumper/inserter, as imagens deste tópico, arquivos contendo informações da rom, e é claro, os scripts traduzidos.
Com a ajuda de vários colegas romhackers, conseguimos várias façanhas neste projeto. Uma delas foi o "undub" do jogo original, onde ao conseguirmos adaptar a tradução original, oriunda da versão americana do jogo, para a versão original japonesa, conseguimos manter o áudio original das missões principais do jogo.
A versão mais recente do projeto, lançada em setembro de 2016, conta com todos os textos traduzidos, e cerca de 80% dos gráficos editados. Futuramente, serão editados o restante dos gráficos, bem como as legendas nos poucos vídeos que o jogo possui.
# Status da Tradução
Textos: 100%
Acentos: 100%
Gráficos: 80%
Vídeos: 0%
Ferramenta Dumper / Inserter de textos: 100%
# Informações Adicionais
Acesse a Wiki deste repositório.
| leomontenegro6/megaman-zx-traducao-ptbr | README.md | Markdown | mit | 4,702 |
module Adjacent
export prevFloat, nextFloat, prevprevFloat, nextnextFloat,
nextAwayFromZero, nextnextAwayFromZero,
nextNearerToZero, nextnextNearerToZero
# exact for |x| > 8.900295434028806e-308
nextNearerToZero(x::Float64) = (x-1.1102230246251568e-16*x)-5.0e-324 # do not simplify
nextAwayFromZero(x::Float64) = (x+1.1102230246251568e-16*x)+5.0e-324 # do not simplify
nextnextNearerToZero(x::Float64) = nextNearerToZero(nextNearerToZero(x)) # changing the multiplier does not work
nextnextAwayFromZero(x::Float64) = nextAwayFromZero(nextAwayFromZero(x))
# exact for |x| > 4.814825f-35
nextNearerToZero(x::Float32) = (x-5.960465f-8*x)-1.435f-42 # do not simplify
nextAwayFromZero(x::Float32) = (x+5.960465f-8*x)+1.435f-42 # do not simplify
nextnextNearerToZero(x::Float64) = nextNearerToZero(nextNearerToZero(x)) # changing the multiplier does not work
nextnextAwayFromZero(x::Float64) = nextAwayFromZero(nextAwayFromZero(x))
# the multiplicative formulation for Float16 is exact for |x| > Float16(0.25)
# which is quite coarse, we do not use that here
nextNearerToZero(x::Float16) = (x < 0) ? nextfloat(x) : prevfloat(x)
nextAwayFromZero(x::Float16) = (x < 0) ? prevfloat(x) : nextfloat(x)
nextFloat(x::Float16) = nextfloat(x)
prevFloat(x::Float16) = prevfloat(x)
nextFloat{T<:AbstractFloat}(x::T) = signbit(x) ? nextNearerToZero(x) : nextAwayFromZero(x)
prevFloat{T<:AbstractFloat}(x::T) = signbit(x) ? nextAwayFromZero(x) : nextNearerToZero(x)
nextnextFloat{T<:AbstractFloat}(x::T) = signbit(x) ? nextnextNearerToZero(x) : nextnextAwayFromZero(x)
prevprevFloat{T<:AbstractFloat}(x::T) = signbit(x) ? nextnextAwayFromZero(x) : nextnextNearerToZero(x)
end # module
| J-Sarnoff/FloatFloat.jl | src/module/Adjacent.jl/src/Adjacent.jl | Julia | mit | 1,711 |
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the LGPL. For more information, see
* <http://www.phpdoctrine.org>.
*/
/**
* Doctrine_Query_Cache_TestCase
*
* @package Doctrine
* @author Konsta Vesterinen <[email protected]>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.org
* @since 1.0
* @version $Revision$
*/
class Doctrine_Query_Cache_TestCase extends Doctrine_UnitTestCase
{
public function testQueryCacheAddsQueryIntoCache()
{
$cache = new Doctrine_Cache_Array();
$q = new Doctrine_Query();
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p')->where('u.name = ?', 'walhala')
->useQueryCache($cache);
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 0);
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 0);
}
public function testQueryCacheWorksWithGlobalConfiguration()
{
$cache = new Doctrine_Cache_Array();
Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_QUERY_CACHE, $cache);
$q = new Doctrine_Query();
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p');
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
}
public function testResultSetCacheAddsResultSetsIntoCache()
{
$q = new Doctrine_Query();
$cache = new Doctrine_Cache_Array();
$q->useCache($cache)->select('u.name')->from('User u');
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
}
public function testResultSetCacheSupportsQueriesWithJoins()
{
$q = new Doctrine_Query();
$cache = new Doctrine_Cache_Array();
$q->useCache($cache);
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p');
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
$coll = $q->execute();
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 8);
}
public function testResultSetCacheSupportsPreparedStatements()
{
$q = new Doctrine_Query();
$cache = new Doctrine_Cache_Array();
$q->useCache($cache);
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p')
->where('u.id = ?');
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 1);
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 1);
}
public function testUseCacheSupportsBooleanTrueAsParameter()
{
$q = new Doctrine_Query();
$cache = new Doctrine_Cache_Array();
$this->conn->setAttribute(Doctrine::ATTR_CACHE, $cache);
$q->useCache(true);
$q->select('u.name')->from('User u')->leftJoin('u.Phonenumber p')
->where('u.id = ?');
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 1);
$coll = $q->execute(array(5));
$this->assertEqual($cache->count(), 1);
$this->assertEqual(count($coll), 1);
$this->conn->setAttribute(Doctrine::ATTR_CACHE, null);
}
}
| nbonamy/doctrine-0.10.4 | tests/Query/CacheTestCase.php | PHP | mit | 4,820 |
---
layout: page
title: Red Archive Llc. Executive Retreat
date: 2016-05-24
author: Kathy Spencer
tags: weekly links, java
status: published
summary: In sed quam rhoncus nulla maximus lobortis in.
banner: images/banner/wedding.jpg
booking:
startDate: 09/29/2019
endDate: 10/02/2019
ctyhocn: AMADUHX
groupCode: RALER
published: true
---
Nulla a interdum nibh, quis interdum nisl. Praesent ut dolor id ex commodo hendrerit ut in justo. Nulla et nulla vitae orci lacinia pellentesque. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris in arcu eu nulla maximus dignissim. Fusce et est quis urna mollis vulputate. Donec pretium sagittis convallis. Integer rutrum lectus sed tortor elementum, eget euismod tortor dignissim. Etiam facilisis erat vel lorem commodo maximus. Aenean at neque luctus, venenatis metus non, fringilla nisl. Ut a orci finibus, vehicula dui bibendum, tristique mauris. Morbi non volutpat quam. Etiam venenatis fringilla mauris at condimentum. Integer varius nulla nec urna condimentum convallis. Donec rhoncus ultrices purus quis sodales.
Donec eget interdum eros. Sed sed fermentum odio. Quisque at dictum lectus. Sed consequat venenatis eros, quis cursus odio viverra nec. Maecenas vulputate sollicitudin libero, sit amet pulvinar sapien pulvinar sed. In orci mi, egestas et maximus eget, ornare ac mauris. Nunc suscipit ullamcorper venenatis. Maecenas placerat nisl quam, a hendrerit est tincidunt at.
* Praesent rutrum metus eleifend, placerat mauris sed, consequat enim
* Fusce venenatis quam id nulla feugiat, dignissim sagittis lorem finibus
* Morbi accumsan dolor id orci malesuada molestie
* Cras et purus vitae turpis auctor gravida
* Suspendisse pharetra lacus eget dui sodales, quis mollis leo placerat.
Duis ornare quam a purus convallis finibus. In vitae tortor ante. Nulla eleifend facilisis leo eu dictum. Nulla vel sollicitudin augue, id facilisis lacus. Sed accumsan, risus convallis bibendum imperdiet, felis lectus aliquet mi, id dictum sapien dolor id libero. Nam tempus posuere orci eu placerat. Nunc auctor dolor massa, non vehicula odio venenatis gravida. Mauris magna nisi, ultricies eget sapien at, pulvinar rhoncus neque. Nullam condimentum convallis est. Fusce congue interdum pretium. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Interdum et malesuada fames ac ante ipsum primis in faucibus. Etiam et molestie orci, sit amet pharetra felis. Aenean non urna in urna fringilla tempus sed vel leo. Duis vel sapien hendrerit sem consequat rhoncus a sit amet augue. In sollicitudin suscipit nisi a feugiat.
Donec vehicula euismod elementum. Praesent lectus sapien, tristique mattis tellus in, fringilla gravida neque. Donec justo diam, blandit ac arcu et, convallis blandit nibh. Aenean tempor, est in eleifend vestibulum, turpis lectus euismod tellus, in consectetur erat odio tempus ipsum. Suspendisse sit amet interdum ante, sit amet sagittis dui. Curabitur non dolor rutrum, commodo ipsum sit amet, ornare tortor. Phasellus sit amet gravida orci. Etiam pellentesque dictum ornare. Curabitur eget justo quis dui aliquam porttitor a ut sem. Proin tortor urna, malesuada sed mollis ac, gravida ut elit. Proin elementum, neque eget varius blandit, lorem ipsum aliquam augue, ut sodales eros justo vitae arcu. Cras id lorem eu nisi sollicitudin cursus. Pellentesque venenatis ligula vel risus lobortis tristique. Nulla facilisi.
| KlishGroup/prose-pogs | pogs/A/AMADUHX/RALER/index.md | Markdown | mit | 3,468 |
---
layout: page
title: Gillespie Systems Seminar
date: 2016-05-24
author: Barbara Fields
tags: weekly links, java
status: published
summary: Aliquam eu massa vel neque pretium mollis vitae at mi.
banner: images/banner/leisure-05.jpg
booking:
startDate: 03/10/2017
endDate: 03/13/2017
ctyhocn: LEXGTHX
groupCode: GSS
published: true
---
In dictum tortor at nisi molestie faucibus. Sed vel lectus eget magna sodales aliquam. Praesent metus nulla, condimentum vitae orci eu, scelerisque efficitur metus. Curabitur at imperdiet est, scelerisque sollicitudin nulla. Vivamus a justo at lectus venenatis fermentum. Vivamus finibus est aliquam, ultrices odio vitae, luctus ante. Praesent tempor, quam quis volutpat imperdiet, mauris tellus hendrerit lectus, ac consectetur sem augue in justo. Vivamus eu mi varius, convallis leo eget, commodo orci. Etiam sollicitudin est vitae elit cursus viverra. Ut non ultrices est. Aenean mauris eros, interdum sodales viverra nec, rutrum eleifend sem. Suspendisse sollicitudin varius magna, sed mattis tortor fermentum eu. In sed nibh vitae nulla lobortis mattis.
Mauris porta suscipit nunc, vitae finibus arcu pretium laoreet. Proin hendrerit commodo rutrum. Donec eu lectus porta mi consectetur bibendum vitae et quam. Sed nec arcu a ante aliquam pulvinar. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Suspendisse at mattis massa. Maecenas pretium est elit, ac pretium nibh pellentesque in. Quisque eget orci in magna euismod congue. Pellentesque non sapien nulla. Aliquam nec arcu eros. Donec purus massa, ultrices non sollicitudin vel, vulputate vel tellus. Ut congue libero vel sodales tincidunt. Vestibulum tortor libero, ultricies vel consectetur condimentum, mattis quis est. Nullam finibus dapibus augue, at varius ante bibendum id.
* Duis quis turpis laoreet, luctus est quis, lacinia libero.
Phasellus consectetur quam a volutpat fermentum. Curabitur eget lacus rhoncus, ultrices purus sed, accumsan elit. Integer eget erat vitae dui luctus accumsan et sit amet velit. Proin tempor velit a elit blandit malesuada. Nam feugiat at lacus vitae sollicitudin. Praesent in orci a risus condimentum bibendum. Duis ullamcorper dui sem, venenatis blandit mi suscipit et. Aliquam vehicula vitae dolor ac posuere. Quisque semper lacus eget dolor pellentesque, non convallis leo suscipit. Duis finibus lorem vel eros venenatis, non hendrerit velit dictum. Duis imperdiet elementum consequat. Morbi nisl arcu, consequat id dolor sed, ultricies sodales nulla. Maecenas molestie enim nec tempus imperdiet. Proin rhoncus velit in purus tincidunt, sed faucibus urna porta. Nulla vitae nisl non nisl pulvinar pretium eget non diam.
| KlishGroup/prose-pogs | pogs/L/LEXGTHX/GSS/index.md | Markdown | mit | 2,716 |
package mod.flatcoloredblocks.block;
import java.util.List;
import java.util.Set;
import com.sun.istack.internal.NotNull;
import mod.flatcoloredblocks.FlatColoredBlocks;
import mod.flatcoloredblocks.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
public class ItemBlockFlatColored extends ItemBlock
{
public BlockFlatColored getColoredBlock()
{
return (BlockFlatColored) block;
}
public IBlockState getStateFromStack(
@NotNull final ItemStack stack )
{
return ModUtil.getStateFromMeta( getBlock(), stack.getItemDamage() );
}
private String getColorPrefix(
final Set<EnumFlatColorAttributes> which )
{
if ( which.contains( EnumFlatColorAttributes.dark ) )
{
return "flatcoloredblocks.dark";
}
if ( which.contains( EnumFlatColorAttributes.light ) )
{
return "flatcoloredblocks.light";
}
return "flatcoloredblocks.";
}
private String getColorHueName(
final Set<EnumFlatColorAttributes> characteristics )
{
for ( final EnumFlatColorAttributes c : characteristics )
{
if ( !c.isModifier )
{
return c.name();
}
}
return EnumFlatColorAttributes.black.name();
}
public ItemBlockFlatColored(
final Block block )
{
super( block );
setHasSubtypes( true );
}
@Override
public int getMetadata(
final int damage )
{
return damage; // override and return damage instead of 0
}
@Override
public String getItemStackDisplayName(
@NotNull final ItemStack stack )
{
final IBlockState state = getStateFromStack( stack );
final int shadeNum = getColoredBlock().getShadeNumber( state );
final Set<EnumFlatColorAttributes> colorChars = getColoredBlock().getFlatColorAttributes( state );
final String type = getTypeLocalization();
final String prefix = getColorPrefix( colorChars );
final String hue = getColorHueName( colorChars );
return type + ModUtil.translateToLocal( prefix + hue + ".name" ) + " " + ModUtil.translateToLocal( "flatcoloredblocks.Shade.name" ) + shadeNum;
}
private String getTypeLocalization()
{
switch ( getColoredBlock().getType() )
{
case GLOWING:
return ModUtil.translateToLocal( "flatcoloredblocks.Glowing.name" ) + " ";
case TRANSPARENT:
return ModUtil.translateToLocal( "flatcoloredblocks.Transparent.name" ) + " ";
default:
return "";
}
}
@Override
public void addInformation(
@NotNull final ItemStack stack,
final World worldIn,
final List<String> tooltip,
final ITooltipFlag advanced )
{
final IBlockState state = getStateFromStack( stack );
final BlockFlatColored blk = getColoredBlock();
final int hsv = blk.hsvFromState( state );
final int rgb = ConversionHSV2RGB.toRGB( hsv );
if ( FlatColoredBlocks.instance.config.showRGB )
{
addColor( ColorFormat.RGB, rgb, tooltip );
}
if ( FlatColoredBlocks.instance.config.showHEX )
{
addColor( ColorFormat.HEX, rgb, tooltip );
}
if ( FlatColoredBlocks.instance.config.showHSV )
{
addColor( ColorFormat.HSV, hsv, tooltip );
}
if ( FlatColoredBlocks.instance.config.showLight && blk.lightValue > 0 )
{
final StringBuilder sb = new StringBuilder();
sb.append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.lightvalue" ) ).append( ' ' );
sb.append( blk.lightValue ).append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.lightValueUnit" ) );
tooltip.add( sb.toString() );
}
if ( FlatColoredBlocks.instance.config.showOpacity && blk.opacity < 100 )
{
final StringBuilder sb = new StringBuilder();
sb.append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.opacity" ) ).append( ' ' );
sb.append( blk.opacity ).append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.percent" ) );
tooltip.add( sb.toString() );
}
super.addInformation( stack, worldIn, tooltip, advanced );
}
public static enum ColorFormat
{
HEX, RGB, HSV
};
private void addColor(
final ColorFormat Format,
final int value,
final List<String> tooltip )
{
final int r_h = value >> 16 & 0xff;
final int g_s = value >> 8 & 0xff;
final int b_v = value & 0xff;
final StringBuilder sb = new StringBuilder();
if ( Format == ColorFormat.HEX )
{
sb.append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.hex" ) ).append( ' ' );
sb.append( "#" ).append( hexPad( Integer.toString( r_h, 16 ) ) ).append( hexPad( Integer.toString( g_s, 16 ) ) ).append( hexPad( Integer.toString( b_v, 16 ) ) );
}
else if ( Format == ColorFormat.RGB )
{
sb.append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.rgb" ) ).append( ' ' );
sb.append( TextFormatting.RED ).append( r_h ).append( ' ' );
sb.append( TextFormatting.GREEN ).append( g_s ).append( ' ' );
sb.append( TextFormatting.BLUE ).append( b_v );
}
else
{
sb.append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.hsv" ) ).append( ' ' );
sb.append( 360 * r_h / 255 ).append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.deg" ) + ' ' );
sb.append( 100 * g_s / 255 ).append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.percent" ) + ' ' );
sb.append( 100 * b_v / 255 ).append( ModUtil.translateToLocal( "flatcoloredblocks.tooltips.percent" ) );
}
tooltip.add( sb.toString() );
}
public static String hexPad(
String string )
{
if ( string.length() == 0 )
return "00";
if ( string.length() == 1 )
return "0" + string;
return string;
}
public int getColorFromItemStack(
@NotNull final ItemStack stack,
final int renderPass )
{
final IBlockState state = getStateFromStack( stack );
return getColoredBlock().colorFromState( state );
}
}
| AlgorithmX2/FlatColoredBlocks | src/main/java/mod/flatcoloredblocks/block/ItemBlockFlatColored.java | Java | mit | 5,844 |
# templater.py - template expansion for output
#
# Copyright 2005, 2006 Matt Mackall <[email protected]>
#
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
from i18n import _
import re, sys, os
from mercurial import util
def parsestring(s, quoted=True):
'''parse a string using simple c-like syntax.
string must be in quotes if quoted is True.'''
if quoted:
if len(s) < 2 or s[0] != s[-1]:
raise SyntaxError(_('unmatched quotes'))
return s[1:-1].decode('string_escape')
return s.decode('string_escape')
class templater(object):
'''template expansion engine.
template expansion works like this. a map file contains key=value
pairs. if value is quoted, it is treated as string. otherwise, it
is treated as name of template file.
templater is asked to expand a key in map. it looks up key, and
looks for strings like this: {foo}. it expands {foo} by looking up
foo in map, and substituting it. expansion is recursive: it stops
when there is no more {foo} to replace.
expansion also allows formatting and filtering.
format uses key to expand each item in list. syntax is
{key%format}.
filter uses function to transform value. syntax is
{key|filter1|filter2|...}.'''
template_re = re.compile(r"(?:(?:#(?=[\w\|%]+#))|(?:{(?=[\w\|%]+})))"
r"(\w+)(?:(?:%(\w+))|((?:\|\w+)*))[#}]")
def __init__(self, mapfile, filters={}, defaults={}, cache={}):
'''set up template engine.
mapfile is name of file to read map definitions from.
filters is dict of functions. each transforms a value into another.
defaults is dict of default map definitions.'''
self.mapfile = mapfile or 'template'
self.cache = cache.copy()
self.map = {}
self.base = (mapfile and os.path.dirname(mapfile)) or ''
self.filters = filters
self.defaults = defaults
if not mapfile:
return
if not os.path.exists(mapfile):
raise util.Abort(_('style not found: %s') % mapfile)
i = 0
for l in file(mapfile):
l = l.strip()
i += 1
if not l or l[0] in '#;': continue
m = re.match(r'([a-zA-Z_][a-zA-Z0-9_]*)\s*=\s*(.+)$', l)
if m:
key, val = m.groups()
if val[0] in "'\"":
try:
self.cache[key] = parsestring(val)
except SyntaxError, inst:
raise SyntaxError('%s:%s: %s' %
(mapfile, i, inst.args[0]))
else:
self.map[key] = os.path.join(self.base, val)
else:
raise SyntaxError(_("%s:%s: parse error") % (mapfile, i))
def __contains__(self, key):
return key in self.cache or key in self.map
def __call__(self, t, **map):
'''perform expansion.
t is name of map element to expand.
map is added elements to use during expansion.'''
if not t in self.cache:
try:
self.cache[t] = file(self.map[t]).read()
except IOError, inst:
raise IOError(inst.args[0], _('template file %s: %s') %
(self.map[t], inst.args[1]))
tmpl = self.cache[t]
while tmpl:
m = self.template_re.search(tmpl)
if not m:
yield tmpl
break
start, end = m.span(0)
key, format, fl = m.groups()
if start:
yield tmpl[:start]
tmpl = tmpl[end:]
if key in map:
v = map[key]
else:
v = self.defaults.get(key, "")
if callable(v):
v = v(**map)
if format:
if not hasattr(v, '__iter__'):
raise SyntaxError(_("Error expanding '%s%s'")
% (key, format))
lm = map.copy()
for i in v:
lm.update(i)
yield self(format, **lm)
else:
if fl:
for f in fl.split("|")[1:]:
v = self.filters[f](v)
yield v
def templatepath(name=None):
'''return location of template file or directory (if no name).
returns None if not found.'''
# executable version (py2exe) doesn't support __file__
if hasattr(sys, 'frozen'):
module = sys.executable
else:
module = __file__
for f in 'templates', '../templates':
fl = f.split('/')
if name: fl.append(name)
p = os.path.join(os.path.dirname(module), *fl)
if (name and os.path.exists(p)) or os.path.isdir(p):
return os.path.normpath(p)
def stringify(thing):
'''turn nested template iterator into string.'''
if hasattr(thing, '__iter__'):
return "".join([stringify(t) for t in thing if t is not None])
return str(thing)
| carlgao/lenga | images/lenny64-peon/usr/share/python-support/mercurial-common/mercurial/templater.py | Python | mit | 5,186 |
var SAMLChrome = angular.module('SAMLChrome', [])
.directive('prettyPrint', function ($parse) {
return {
restrict: 'E',
replace: true,
transclude: false,
scope: { data: '=data' },
link: function (scope, element, attrs) {
let data = scope.data;
if (data === true) {
data = '<i>true</i>';
} else if (data === false) {
data = '<i>false</i>';
} else if (data === undefined) {
data = '<i>undefined</i>';
} else if (data === null) {
data = '<i>null</i>';
} else if (typeof data !== 'number') {
data = $('<div>').text(data).html();
}
let $el = $('<div></div>');
$el.html(data);
element.replaceWith($el);
}
};
})
.directive('resizableColumns', function ($parse) {
return {
link: function (scope, element, attrs) {
const options = {minWidth: 5};
if ($(element).data('resizable-columns-sync')) {
var $target = $($(element).data('resizable-columns-sync'));
$(element).on('column:resize', function(event, resizable, $leftColumn, $rightColumn, widthLeft, widthRight)
{
var leftColumnIndex = resizable.$table.find('.rc-column-resizing').parent().find('td, th').index($leftColumn);
var $targetFirstRow = $target.find('tr:first');
$($targetFirstRow.find('td, th').get(leftColumnIndex)).css('width', widthLeft + '%');
$($targetFirstRow.find('td, th').get(leftColumnIndex + 1)).css('width', widthRight + '%');
$target.data('resizableColumns').syncHandleWidths();
$target.data('resizableColumns').saveColumnWidths();
});
}
$(element).resizableColumns(options);
}
};
})
.directive('scrollToNew', function ($parse) {
return function(scope, element, attrs) {
if (scope.showIncomingRequests && scope.$last) {
const $container = $(element).parents('.data-container').first();
const $parent = $(element).parent();
$container.scrollTop($parent.height());
}
};
});
| milton-lai/saml-chrome-panel | unpacked/panel/assets/javascripts/app.js | JavaScript | mit | 1,945 |
import { Component, OnInit } from '@angular/core';
import { GameService, MATERIALS, Material } from '../game';
import { ItemCardComponent } from '../item_card';
import { FormatterPipe } from '../app.service';
interface OrderList {
buy: { [name: string]: number };
sell: { [name: string]: number };
}
@Component({
selector: 'purchasing',
styles: [ require('./purchasing.scss') ],
template: require('./purchasing.html'),
directives: [ ItemCardComponent ],
pipes: [ FormatterPipe ]
})
export class PurchasingComponent implements OnInit {
gameService: GameService;
cards: Material[] = [];
cardObj: { [name: string]: Material };
order: { [name: string]: number } = {};
orderList: OrderList = { buy: {}, sell: {} };
orderPrice: number = 0;
buyPrice: number = 0;
sellPrice: number = 0;
inventory: { [name: string]: number } = {};
headerMargins: string = '';
constructor(gameService: GameService) {
// constructor() {
this.gameService = gameService;
// this.cards = MATERIALS;
// for (let card of this.cards) {
// this.order[card.name] = 0;
// this.cardObj[card.name] = card;
// }
this.cardObj = MATERIALS;
for (let name in this.cardObj) {
this.cards.push(this.cardObj[name]);
this.order[name] = 0;
this.orderList.buy[name] = 0;
this.orderList.sell[name] = 0;
}
// console.log(MATERIALS);
this.inventory = this.gameService.inventory;
}
changeQuantity(name: string, pos: boolean = true) {
console.log(this.order[name]);
console.log(this.gameService.inventory[name]);
if (pos) {
if ((this.orderPrice + this.cardObj[name].buyPrice) > this.gameService.money) {
return;
}
} else {
// if (this.gameService.inventory[name] === 0) {
// return;
// }
if (this.order[name] <= (this.gameService.inventory[name]) * -1) {
return;
}
}
let add = (pos ? 1 : -1);
this.order[name] += add;
// this.orderList[pos ? 'buy' : 'sell'][name]++;
// console.log(this.orderList);
let buyKey = pos ? 'buy' : 'sell';
let sellKey = pos ? 'sell' : 'buy';
if (this.orderList[sellKey][name] !== 0) {
this.orderList[sellKey][name]--;
} else {
this.orderList[buyKey][name]++;
}
this.updatePrices();
// this.orderPrice += (this.cardObj[name].buyPrice * add);
}
private updatePrices() {
console.log(this.orderList);
let buyPrice = 0;
let sellPrice = 0;
for (let name in this.cardObj) {
buyPrice += (this.orderList.buy[name] * this.cardObj[name].buyPrice);
sellPrice += (this.orderList.sell[name] * this.cardObj[name].sellPrice);
}
console.log('sell:', sellPrice);
console.log('buy:', buyPrice);
this.buyPrice = buyPrice;
this.sellPrice = sellPrice;
this.orderPrice = sellPrice - buyPrice;
}
isPos(val: number): boolean {
return val > 0;
}
completePurchase(): void {
let inventory = this.gameService.inventory;
var keys = Object.keys(this.order).filter((k) => this.order[k] !== 0);
console.log('order', this.order);
console.log('keys', keys);
for (let name of keys) {
let count = this.order[name];
if (this.gameService.add(name, count, true)) {
this.order[name] = 0;
this.orderList.buy[name] = 0;
this.orderList.sell[name] = 0;
// this.orderPrice = 0;
// this.buyPrice = 0;
// this.sellPrice = 0;
}
}
this.updatePrices();
// this.gameService.money -= this.orderPrice;
}
ngOnInit() {
}
} | ninja4826/the_factory | src/app/purchasing/purchasing.component.ts | TypeScript | mit | 3,628 |
# coding: utf-8
from __future__ import absolute_import
import functools
import re
from flask.ext import login
from flask.ext import wtf
from flask.ext.oauthlib import client as oauth
from google.appengine.ext import ndb
import flask
import unidecode
import wtforms
import cache
import config
import model
import task
import util
from main import app
_signals = flask.signals.Namespace()
###############################################################################
# Flask Login
###############################################################################
login_manager = login.LoginManager()
class AnonymousUser(login.AnonymousUserMixin):
id = 0
admin = False
name = 'Anonymous'
user_db = None
def key(self):
return None
def has_permission(self, permission):
return False
login_manager.anonymous_user = AnonymousUser
class FlaskUser(AnonymousUser):
def __init__(self, user_db):
self.user_db = user_db
self.id = user_db.key.id()
self.name = user_db.name
self.admin = user_db.admin
def key(self):
return self.user_db.key.urlsafe()
def get_id(self):
return self.user_db.key.urlsafe()
def is_authenticated(self):
return True
def is_active(self):
return self.user_db.active
def is_anonymous(self):
return False
def has_permission(self, permission):
return self.user_db.has_permission(permission)
@login_manager.user_loader
def load_user(key):
user_db = ndb.Key(urlsafe=key).get()
if user_db:
return FlaskUser(user_db)
return None
login_manager.init_app(app)
def current_user_id():
return login.current_user.id
def current_user_key():
return login.current_user.user_db.key if login.current_user.user_db else None
def current_user_db():
return login.current_user.user_db
def is_logged_in():
return login.current_user.id != 0
###############################################################################
# Decorators
###############################################################################
def login_required(f):
decorator_order_guard(f, 'auth.login_required')
@functools.wraps(f)
def decorated_function(*args, **kwargs):
if is_logged_in():
return f(*args, **kwargs)
if flask.request.path.startswith('/api/'):
return flask.abort(401)
return flask.redirect(flask.url_for('signin', next=flask.request.url))
return decorated_function
def admin_required(f):
decorator_order_guard(f, 'auth.admin_required')
@functools.wraps(f)
def decorated_function(*args, **kwargs):
if is_logged_in() and current_user_db().admin:
return f(*args, **kwargs)
if not is_logged_in() and flask.request.path.startswith('/api/'):
return flask.abort(401)
if not is_logged_in():
return flask.redirect(flask.url_for('signin', next=flask.request.url))
return flask.abort(403)
return decorated_function
permission_registered = _signals.signal('permission-registered')
def permission_required(permission=None, methods=None):
def permission_decorator(f):
decorator_order_guard(f, 'auth.permission_required')
# default to decorated function name as permission
perm = permission or f.func_name
meths = [m.upper() for m in methods] if methods else None
permission_registered.send(f, permission=perm)
@functools.wraps(f)
def decorated_function(*args, **kwargs):
if meths and flask.request.method.upper() not in meths:
return f(*args, **kwargs)
if is_logged_in() and current_user_db().has_permission(perm):
return f(*args, **kwargs)
if not is_logged_in():
if flask.request.path.startswith('/api/'):
return flask.abort(401)
return flask.redirect(flask.url_for('signin', next=flask.request.url))
return flask.abort(403)
return decorated_function
return permission_decorator
###############################################################################
# Sign in stuff
###############################################################################
class SignInForm(wtf.Form):
email = wtforms.StringField(
'Email',
[wtforms.validators.required()],
filters=[util.email_filter],
)
password = wtforms.StringField(
'Password',
[wtforms.validators.required()],
)
remember = wtforms.BooleanField(
'Keep me signed in',
[wtforms.validators.optional()],
)
recaptcha = wtf.RecaptchaField()
next_url = wtforms.HiddenField()
@app.route('/signin/', methods=['GET', 'POST'])
def signin():
next_url = util.get_next_url()
form = None
if config.CONFIG_DB.has_email_authentication:
form = form_with_recaptcha(SignInForm())
save_request_params()
if form.validate_on_submit():
result = get_user_db_from_email(
form.email.data, form.password.data)
if result:
cache.reset_auth_attempt()
return signin_user_db(result)
if result is None:
form.email.errors.append('Email or Password do not match')
if result is False:
return flask.redirect(flask.url_for('welcome'))
if not form.errors:
form.next_url.data = next_url
if form and form.errors:
cache.bump_auth_attempt()
return flask.render_template(
'auth/auth.html',
title='Sign in',
html_class='auth',
next_url=next_url,
form=form,
form_type='signin' if config.CONFIG_DB.has_email_authentication else '',
**urls_for_oauth(next_url)
)
###############################################################################
# Sign up stuff
###############################################################################
class SignUpForm(wtf.Form):
email = wtforms.StringField(
'Email',
[wtforms.validators.required(), wtforms.validators.email()],
filters=[util.email_filter],
)
recaptcha = wtf.RecaptchaField()
@app.route('/signup/', methods=['GET', 'POST'])
def signup():
next_url = util.get_next_url()
form = None
if config.CONFIG_DB.has_email_authentication:
form = form_with_recaptcha(SignUpForm())
save_request_params()
if form.validate_on_submit():
user_db = model.User.get_by('email', form.email.data)
if user_db:
form.email.errors.append('This email is already taken.')
if not form.errors:
user_db = create_user_db(
None,
util.create_name_from_email(form.email.data),
form.email.data,
form.email.data,
)
user_db.put()
task.activate_user_notification(user_db)
cache.bump_auth_attempt()
return flask.redirect(flask.url_for('welcome'))
if form and form.errors:
cache.bump_auth_attempt()
title = 'Sign up' if config.CONFIG_DB.has_email_authentication else 'Sign in'
return flask.render_template(
'auth/auth.html',
title=title,
html_class='auth',
next_url=next_url,
form=form,
**urls_for_oauth(next_url)
)
###############################################################################
# Sign out stuff
###############################################################################
@app.route('/signout/')
def signout():
login.logout_user()
return flask.redirect(util.param('next') or flask.url_for('signin'))
###############################################################################
# Helpers
###############################################################################
def url_for_signin(service_name, next_url):
return flask.url_for('signin_%s' % service_name, next=next_url)
def urls_for_oauth(next_url):
return {
'bitbucket_signin_url': url_for_signin('bitbucket', next_url),
'dropbox_signin_url': url_for_signin('dropbox', next_url),
'facebook_signin_url': url_for_signin('facebook', next_url),
'github_signin_url': url_for_signin('github', next_url),
'google_signin_url': url_for_signin('google', next_url),
'gae_signin_url': url_for_signin('gae', next_url),
'instagram_signin_url': url_for_signin('instagram', next_url),
'linkedin_signin_url': url_for_signin('linkedin', next_url),
'microsoft_signin_url': url_for_signin('microsoft', next_url),
'reddit_signin_url': url_for_signin('reddit', next_url),
'twitter_signin_url': url_for_signin('twitter', next_url),
'vk_signin_url': url_for_signin('vk', next_url),
'yahoo_signin_url': url_for_signin('yahoo', next_url),
}
def create_oauth_app(service_config, name):
upper_name = name.upper()
app.config[upper_name] = service_config
service_oauth = oauth.OAuth()
service_app = service_oauth.remote_app(name, app_key=upper_name)
service_oauth.init_app(app)
return service_app
def decorator_order_guard(f, decorator_name):
if f in app.view_functions.values():
raise SyntaxError(
'Do not use %s above app.route decorators as it would not be checked. '
'Instead move the line below the app.route lines.' % decorator_name
)
def save_request_params():
flask.session['auth-params'] = {
'next': util.get_next_url(),
'remember': util.param('remember', bool),
}
def signin_oauth(oauth_app, scheme=None):
try:
flask.session.pop('oauth_token', None)
save_request_params()
return oauth_app.authorize(callback=flask.url_for(
'%s_authorized' % oauth_app.name, _external=True, _scheme=scheme
))
except oauth.OAuthException:
flask.flash(
'Something went wrong with sign in. Please try again.',
category='danger',
)
return flask.redirect(flask.url_for('signin', next=util.get_next_url()))
def form_with_recaptcha(form):
should_have_recaptcha = cache.get_auth_attempt() >= config.RECAPTCHA_LIMIT
if not (should_have_recaptcha and config.CONFIG_DB.has_recaptcha):
del form.recaptcha
return form
###############################################################################
# User related stuff
###############################################################################
def create_user_db(auth_id, name, username, email='', verified=False, **props):
email = email.lower() if email else ''
if verified and email:
user_dbs, cursors = model.User.get_dbs(
email=email, verified=True, limit=2)
if len(user_dbs) == 1:
user_db = user_dbs[0]
user_db.auth_ids.append(auth_id)
user_db.put()
task.new_user_notification(user_db)
return user_db
if isinstance(username, str):
username = username.decode('utf-8')
username = unidecode.unidecode(username.split('@')[0].lower()).strip()
username = re.sub(r'[\W_]+', '.', username)
new_username = username
n = 1
while not model.User.is_username_available(new_username):
new_username = '%s%d' % (username, n)
n += 1
user_db = model.User(
name=name,
email=email,
username=new_username,
auth_ids=[auth_id] if auth_id else [],
verified=verified,
token=util.uuid(),
**props
)
user_db.put()
task.new_user_notification(user_db)
return user_db
@ndb.toplevel
def signin_user_db(user_db):
if not user_db:
return flask.redirect(flask.url_for('signin'))
flask_user_db = FlaskUser(user_db)
auth_params = flask.session.get('auth-params', {
'next': flask.url_for('welcome'),
'remember': False,
})
flask.session.pop('auth-params', None)
if login.login_user(flask_user_db, remember=auth_params['remember']):
user_db.put_async()
return flask.redirect(util.get_next_url(auth_params['next']))
flask.flash('Sorry, but you could not sign in.', category='danger')
return flask.redirect(flask.url_for('signin'))
def get_user_db_from_email(email, password):
user_dbs, cursors = model.User.get_dbs(email=email, active=True, limit=2)
if not user_dbs:
return None
if len(user_dbs) > 1:
flask.flash('''We are sorry but it looks like there is a conflict with
your account. Our support team is already informed and we will get
back to you as soon as possible.''', category='danger')
task.email_conflict_notification(email)
return False
user_db = user_dbs[0]
if user_db.password_hash == util.password_hash(user_db, password):
return user_db
return None
| sbarnabas/gowhere | main/auth/auth.py | Python | mit | 13,032 |
<!doctype html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.4/css/bootstrap.min.css" />
<link rel="stylesheet" href="styles/test.css">
<link rel="stylesheet" href="styles/iconfont.css">
</head>
<body>
<nav class="navbar navbar-fixed-top">
<div class="container">
<section class="col-md-7">
<h2><a href="javascript:void(0);">李世林={"描述":"前端工程师"}</a></h2>
</section>
<section class="col-md-5 nav-contact" id="navContact" style="display:none;">
<ul>
<li><i class="icon iconfont phone"></i>: 13428793245</li>
<li><i class="icon iconfont qq">󰇇</i>: 374723872</li>
</ul>
</section>
</div>
</nav>
<header>
<article class="container">
<section class="col-md-7">
<h5>这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介这是我的简介</h5>
<p>这是我的简介这是我的简介这是我的简介这是我的简介</p>
</section>
<address class="col-md-5">
<ul>
<li><i class="icon iconfont phone"></i>: 13428793245</li>
<li><i class="icon iconfont qq">󰇇</i>: 374723872</li>
<li><i class="icon iconfont github">󰇊</i>: <a href="http://silenjs.github.com">silenjs</a></li>
</ul>
</address>
</article>
</header>
<div class="content">
<main class="container ">
<article class="row">
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我提供</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我不提供</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
</article>
<article class="row">
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我做过</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我没做过</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
</article>
<article class="row">
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我想做</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我不想做</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
</article>
<article class="row">
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我需要</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
<section class="col-md-6 main-sec">
<div class="main-sec-title">
<h3>我不需要</h3>
</div>
<div class="main-sec-content">
<p>这里是技能这里是技能这里是技能这里是技能这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
<p>这里是技能</p>
</div>
</section>
</article>
</main>
</div>
<footer>
© Copyright 2015 By40!
</footer>
</body>
</html> | silenjs/hunter | app/test.html | HTML | mit | 8,016 |
<?php
include_once 'includes/dbConnect.php';
include_once 'includes/functions.php';
session_start();
// Set permission restrictions here
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gentallela Alela! | </title>
<?php include("includes/genericCSS.php"); ?>
<!-- iCheck -->
<link href="vendors/iCheck/skins/flat/green.css" rel="stylesheet">
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<?php include("includes/navPanel.php"); ?>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>E-commerce :: Product Page</h3>
</div>
<div class="title_right">
<div class="col-md-5 col-sm-5 col-xs-12 form-group pull-right top_search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button">Go!</button>
</span>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>E-commerce page design</h2>
<ul class="nav navbar-right panel_toolbox">
<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Settings 1</a>
</li>
<li><a href="#">Settings 2</a>
</li>
</ul>
</li>
<li><a class="close-link"><i class="fa fa-close"></i></a>
</li>
</ul>
<div class="clearfix"></div>
</div>
<div class="x_content">
<div class="col-md-7 col-sm-7 col-xs-12">
<div class="product-image">
<img src="images/prod1.jpg" alt="..." />
</div>
<div class="product_gallery">
<a>
<img src="images/prod2.jpg" alt="..." />
</a>
<a>
<img src="images/prod3.jpg" alt="..." />
</a>
<a>
<img src="images/prod4.jpg" alt="..." />
</a>
<a>
<img src="images/prod5.jpg" alt="..." />
</a>
</div>
</div>
<div class="col-md-5 col-sm-5 col-xs-12" style="border:0px solid #e5e5e5;">
<h3 class="prod_title">LOWA Men’s Renegade GTX Mid Hiking Boots Review</h3>
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terr.</p>
<br />
<div class="">
<h2>Available Colors</h2>
<ul class="list-inline prod_color">
<li>
<p>Green</p>
<div class="color bg-green"></div>
</li>
<li>
<p>Blue</p>
<div class="color bg-blue"></div>
</li>
<li>
<p>Red</p>
<div class="color bg-red"></div>
</li>
<li>
<p>Orange</p>
<div class="color bg-orange"></div>
</li>
</ul>
</div>
<br />
<div class="">
<h2>Size <small>Please select one</small></h2>
<ul class="list-inline prod_size">
<li>
<button type="button" class="btn btn-default btn-xs">Small</button>
</li>
<li>
<button type="button" class="btn btn-default btn-xs">Medium</button>
</li>
<li>
<button type="button" class="btn btn-default btn-xs">Large</button>
</li>
<li>
<button type="button" class="btn btn-default btn-xs">Xtra-Large</button>
</li>
</ul>
</div>
<br />
<div class="">
<div class="product_price">
<h1 class="price">Ksh80.00</h1>
<span class="price-tax">Ex Tax: Ksh80.00</span>
<br>
</div>
</div>
<div class="">
<button type="button" class="btn btn-default btn-lg">Add to Cart</button>
<button type="button" class="btn btn-default btn-lg">Add to Wishlist</button>
</div>
<div class="product_social">
<ul class="list-inline">
<li><a href="#"><i class="fa fa-facebook-square"></i></a>
</li>
<li><a href="#"><i class="fa fa-twitter-square"></i></a>
</li>
<li><a href="#"><i class="fa fa-envelope-square"></i></a>
</li>
<li><a href="#"><i class="fa fa-rss-square"></i></a>
</li>
</ul>
</div>
</div>
<div class="col-md-12">
<div class="" role="tabpanel" data-example-id="togglable-tabs">
<ul id="myTab" class="nav nav-tabs bar_tabs" role="tablist">
<li role="presentation" class="active"><a href="#tab_content1" id="home-tab" role="tab" data-toggle="tab" aria-expanded="true">Home</a>
</li>
<li role="presentation" class=""><a href="#tab_content2" role="tab" id="profile-tab" data-toggle="tab" aria-expanded="false">Profile</a>
</li>
<li role="presentation" class=""><a href="#tab_content3" role="tab" id="profile-tab2" data-toggle="tab" aria-expanded="false">Profile</a>
</li>
</ul>
<div id="myTabContent" class="tab-content">
<div role="tabpanel" class="tab-pane fade active in" id="tab_content1" aria-labelledby="home-tab">
<p>Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher
synth. Cosby sweater eu banh mi, qui irure terr.</p>
</div>
<div role="tabpanel" class="tab-pane fade" id="tab_content2" aria-labelledby="profile-tab">
<p>Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo
booth letterpress, commodo enim craft beer mlkshk aliquip</p>
</div>
<div role="tabpanel" class="tab-pane fade" id="tab_content3" aria-labelledby="profile-tab">
<p>xxFood truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui
photo booth letterpress, commodo enim craft beer mlkshk </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<?php include("includes/footer.php"); ?>
</div>
</div>
<?php include("includes/genericJS.php"); ?>
<!-- Custom Theme Scripts -->
<script src="js/custom.min.js"></script>
</body>
</html>
| YamiND/daxueSIS | web/e_commerce.php | PHP | mit | 9,917 |
# SocialBeer
Social network for beers fans: Meet more beers. Share your preferences. Become the Legendary Beer Master!
| luisholanda/hackathon_ambev | README.md | Markdown | mit | 119 |
require 'minitest/autorun'
require './lib/amazon_athena/commands/show_columns'
describe AmazonAthena::Commands::ShowColumns do
before do
@cmd = AmazonAthena::Commands::ShowColumns.new("mydb.mytable")
end
it "provides a db statement" do
assert_equal "SHOW COLUMNS IN mydb.mytable;", @cmd.statement
end
it "executes a query" do
results = MiniTest::Mock.new
results.expect(:map, nil)
conn = MiniTest::Mock.new
conn.expect(:query, results, ["SHOW COLUMNS IN mydb.mytable;"])
@cmd.run(conn)
end
end
| pengwynn/athena-cli | test/lib/amazon_athena/commands/show_columns_test.rb | Ruby | mit | 540 |
require 'rubygems'
PATH = File.expand_path(File.dirname(__FILE__))
require PATH + '/db.rb'
require PATH + '/webservice.rb'
require PATH + '/user.rb'
require PATH + '/repo.rb'
require PATH + '/github.rb'
require PATH + '/stats.rb'
require PATH + '/achievements.rb'
record_limit = 20
#lifetime = 604800 # 1 week in seconds
lifetime = 172800 # 2 days in seconds
update_threshold = Time.now.utc - lifetime
db = Database.new().connect()
gh = Github.new(db)
user = User.new(db)
repo = Repo.new(db)
coll_user = user.get_coll
#coll_user.find({'gh_login' => 'yaph'}).each do |u|
coll_user.find({'updated_at' => {'$lt' => update_threshold}, 'notfound' => {'$exists' => false} }, :sort => 'updated_at').limit(record_limit).each do |u|
puts 'Fetch Github info for user %s' % u['gh_login']
gh_user = gh.get_user(u['gh_login'])
if gh_user.nil?
# if Github returned no user data set user to notfound so update process is not blocked
user.notfound(u)
next
end
puts 'Updating user %s' % u['gh_login']
user.update(u, gh_user)
gh_repos = gh.get_user_repos(u)
if !gh_repos.empty?
user_repo_names = {}
gh_repos.each do |r|
puts 'Updating repo %s' % r['name']
repo.update_user_repo(u, r)
user_repo_names[r['name']] = 1
end
# remove repos deleted on Github
repo.get_user_repos(u).each do |r|
if not user_repo_names.has_key?(r['name'])
puts 'Removed repo %s' % r['name'] if repo.delete_user_repo(u, r)
end
end
u['stats'] = Stats.new.get(gh_repos)
u = Achievements.new.set_user_achievements(u)
gh.update_stats(u)
end
end
| yaph/coderstats | update.rb | Ruby | mit | 1,610 |
require 'openregister'
class SchoolsController < ApplicationController
def show
@school = OpenRegisterHelper.school params[:id]
if @school
address = @school._address
point = address.try(:point)
if point && point.size > 0
@lon, @lat = eval(point)
end
@records = [@school].push(*OpenRegisterHelper.record_fields_from_list([@school]))
@by_registry = @records.group_by { |record| record._register.registry }
end
end
end
| openregister/school-demo | app/controllers/schools_controller.rb | Ruby | mit | 479 |
namespace BarcodeFabric.Core
{
public class AlphanumericApplicationIdentifier : ApplicationIdentifier
{
public AlphanumericApplicationIdentifier(string identifier, string description, int min, int max) : base(identifier, description, min, max)
{
}
public AlphanumericApplicationIdentifier(bool hasVariable, string identifier, string description, int min, int max) : base(hasVariable, identifier, description, min, max)
{
}
#region Overrides of ApplicationIdentifier
public override DataFormatType DataFormat { get; protected set; } = DataFormatType.Alphanumeric;
public override object Parse()
{
// TODO: Validate with regex
return ElementData;
}
#endregion
}
} | joacar/BarcodeFabric | src/BarcodeFabric.Core/ApplicationIdentifiers/AlphanumericApplicationIdentifier.cs | C# | mit | 797 |
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include "sam.h"
typedef struct __linkbuf_t {
bam1_t b;
uint32_t beg, end;
struct __linkbuf_t *next;
} lbnode_t;
/* --- BEGIN: Memory pool */
typedef struct {
int cnt, n, max;
lbnode_t **buf;
} mempool_t;
static mempool_t *mp_init()
{
mempool_t *mp;
mp = (mempool_t*)calloc(1, sizeof(mempool_t));
return mp;
}
static void mp_destroy(mempool_t *mp)
{
int k;
for (k = 0; k < mp->n; ++k) {
free(mp->buf[k]->b.data);
free(mp->buf[k]);
}
free(mp->buf);
free(mp);
}
static inline lbnode_t *mp_alloc(mempool_t *mp)
{
++mp->cnt;
if (mp->n == 0) return (lbnode_t*)calloc(1, sizeof(lbnode_t));
else return mp->buf[--mp->n];
}
static inline void mp_free(mempool_t *mp, lbnode_t *p)
{
--mp->cnt; p->next = 0; // clear lbnode_t::next here
if (mp->n == mp->max) {
mp->max = mp->max? mp->max<<1 : 256;
mp->buf = (lbnode_t**)realloc(mp->buf, sizeof(lbnode_t*) * mp->max);
}
mp->buf[mp->n++] = p;
}
/* --- END: Memory pool */
/* --- BEGIN: Auxiliary functions */
static inline int resolve_cigar(bam_pileup1_t *p, uint32_t pos)
{
unsigned k;
bam1_t *b = p->b;
bam1_core_t *c = &b->core;
uint32_t x = c->pos, y = 0;
int ret = 1, is_restart = 1, first_op, last_op;
if (c->flag&BAM_FUNMAP) return 0; // unmapped read
assert(x <= pos); // otherwise a bug
p->qpos = -1; p->indel = 0; p->is_del = p->is_head = p->is_tail = 0;
first_op = bam1_cigar(b)[0] & BAM_CIGAR_MASK;
last_op = bam1_cigar(b)[c->n_cigar-1] & BAM_CIGAR_MASK;
for (k = 0; k < c->n_cigar; ++k) {
int op = bam1_cigar(b)[k] & BAM_CIGAR_MASK; // operation
int l = bam1_cigar(b)[k] >> BAM_CIGAR_SHIFT; // length
if (op == BAM_CMATCH) { // NOTE: this assumes the first and the last operation MUST BE a match or a clip
if (x + l > pos) { // overlap with pos
p->indel = p->is_del = 0;
p->qpos = y + (pos - x);
if (x == pos && is_restart && first_op != BAM_CDEL) p->is_head = 1;
if (x + l - 1 == pos) { // come to the end of a match
int has_next_match = 0;
unsigned i;
for (i = k + 1; i < c->n_cigar; ++i) {
uint32_t cigar = bam1_cigar(b)[i];
int opi = cigar&BAM_CIGAR_MASK;
if (opi == BAM_CMATCH) {
has_next_match = 1;
break;
} else if (opi == BAM_CSOFT_CLIP || opi == BAM_CREF_SKIP || opi == BAM_CHARD_CLIP) break;
}
if (!has_next_match && last_op != BAM_CDEL) p->is_tail = 1;
if (k < c->n_cigar - 1 && has_next_match) { // there are additional operation(s)
uint32_t cigar = bam1_cigar(b)[k+1]; // next CIGAR
int op_next = cigar&BAM_CIGAR_MASK; // next CIGAR operation
if (op_next == BAM_CDEL) p->indel = -(int32_t)(cigar>>BAM_CIGAR_SHIFT); // del
else if (op_next == BAM_CINS) p->indel = cigar>>BAM_CIGAR_SHIFT; // ins
else if (op_next == BAM_CPAD && k + 2 < c->n_cigar) { // no working for adjacent padding
cigar = bam1_cigar(b)[k+2]; op_next = cigar&BAM_CIGAR_MASK;
if (op_next == BAM_CDEL) p->indel = -(int32_t)(cigar>>BAM_CIGAR_SHIFT); // del
else if (op_next == BAM_CINS) p->indel = cigar>>BAM_CIGAR_SHIFT; // ins
}
}
}
}
x += l; y += l;
} else if (op == BAM_CDEL) { // then set ->is_del
if (k == 0 && x == pos) p->is_head = 1;
else if (x + l - 1 == pos && k == c->n_cigar - 1) p->is_tail = 1;
if (x + l > pos) {
p->indel = 0; p->is_del = 1;
p->qpos = y;
}
x += l;
} else if (op == BAM_CREF_SKIP) x += l;
else if (op == BAM_CINS || op == BAM_CSOFT_CLIP) y += l;
if (is_restart) is_restart ^= (op == BAM_CMATCH);
else is_restart ^= (op == BAM_CREF_SKIP || op == BAM_CSOFT_CLIP || op == BAM_CHARD_CLIP);
if (x > pos) {
if (op == BAM_CREF_SKIP) ret = 0; // then do not put it into pileup at all
break;
}
}
assert(x > pos); // otherwise a bug
return ret;
}
/* --- END: Auxiliary functions */
/*******************
* pileup iterator *
*******************/
struct __bam_plp_t {
mempool_t *mp;
lbnode_t *head, *tail, *dummy;
int32_t tid, pos, max_tid, max_pos;
int is_eof, flag_mask, max_plp, error;
bam_pileup1_t *plp;
// for the "auto" interface only
bam1_t *b;
bam_plp_auto_f func;
void *data;
};
bam_plp_t bam_plp_init(bam_plp_auto_f func, void *data)
{
bam_plp_t iter;
iter = calloc(1, sizeof(struct __bam_plp_t));
iter->mp = mp_init();
iter->head = iter->tail = mp_alloc(iter->mp);
iter->dummy = mp_alloc(iter->mp);
iter->max_tid = iter->max_pos = -1;
iter->flag_mask = BAM_DEF_MASK;
if (func) {
iter->func = func;
iter->data = data;
iter->b = bam_init1();
}
return iter;
}
void bam_plp_destroy(bam_plp_t iter)
{
mp_free(iter->mp, iter->dummy);
mp_free(iter->mp, iter->head);
if (iter->mp->cnt != 0)
fprintf(stderr, "[bam_plp_destroy] memory leak: %d. Continue anyway.\n", iter->mp->cnt);
mp_destroy(iter->mp);
if (iter->b) bam_destroy1(iter->b);
free(iter->plp);
free(iter);
}
const bam_pileup1_t *bam_plp_next(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
{
if (iter->error) { *_n_plp = -1; return 0; }
*_n_plp = 0;
if (iter->is_eof && iter->head->next == 0) return 0;
while (iter->is_eof || iter->max_tid > iter->tid || (iter->max_tid == iter->tid && iter->max_pos > iter->pos)) {
int n_plp = 0;
lbnode_t *p, *q;
// write iter->plp at iter->pos
iter->dummy->next = iter->head;
for (p = iter->head, q = iter->dummy; p->next; q = p, p = p->next) {
if (p->b.core.tid < iter->tid || (p->b.core.tid == iter->tid && p->end <= iter->pos)) { // then remove
q->next = p->next; mp_free(iter->mp, p); p = q;
} else if (p->b.core.tid == iter->tid && p->beg <= iter->pos) { // here: p->end > pos; then add to pileup
if (n_plp == iter->max_plp) { // then double the capacity
iter->max_plp = iter->max_plp? iter->max_plp<<1 : 256;
iter->plp = (bam_pileup1_t*)realloc(iter->plp, sizeof(bam_pileup1_t) * iter->max_plp);
}
iter->plp[n_plp].b = &p->b;
if (resolve_cigar(iter->plp + n_plp, iter->pos)) ++n_plp; // skip the read if we are looking at ref-skip
}
}
iter->head = iter->dummy->next; // dummy->next may be changed
*_n_plp = n_plp; *_tid = iter->tid; *_pos = iter->pos;
// update iter->tid and iter->pos
if (iter->head->next) {
if (iter->tid > iter->head->b.core.tid) {
fprintf(stderr, "[%s] unsorted input. Pileup aborts.\n", __func__);
iter->error = 1;
*_n_plp = -1;
return 0;
}
}
if (iter->tid < iter->head->b.core.tid) { // come to a new reference sequence
iter->tid = iter->head->b.core.tid; iter->pos = iter->head->beg; // jump to the next reference
} else if (iter->pos < iter->head->beg) { // here: tid == head->b.core.tid
iter->pos = iter->head->beg; // jump to the next position
} else ++iter->pos; // scan contiguously
// return
if (n_plp) return iter->plp;
if (iter->is_eof && iter->head->next == 0) break;
}
return 0;
}
int bam_plp_push(bam_plp_t iter, const bam1_t *b)
{
if (iter->error) return -1;
if (b) {
if (b->core.tid < 0) return 0;
if (b->core.flag & iter->flag_mask) return 0;
bam_copy1(&iter->tail->b, b);
iter->tail->beg = b->core.pos; iter->tail->end = bam_calend(&b->core, bam1_cigar(b));
if (b->core.tid < iter->max_tid) {
fprintf(stderr, "[bam_pileup_core] the input is not sorted (chromosomes out of order)\n");
iter->error = 1;
return -1;
}
if ((b->core.tid == iter->max_tid) && (iter->tail->beg < iter->max_pos)) {
fprintf(stderr, "[bam_pileup_core] the input is not sorted (reads out of order)\n");
iter->error = 1;
return -1;
}
iter->max_tid = b->core.tid; iter->max_pos = iter->tail->beg;
if (iter->tail->end > iter->pos || iter->tail->b.core.tid > iter->tid) {
iter->tail->next = mp_alloc(iter->mp);
iter->tail = iter->tail->next;
}
} else iter->is_eof = 1;
return 0;
}
const bam_pileup1_t *bam_plp_auto(bam_plp_t iter, int *_tid, int *_pos, int *_n_plp)
{
const bam_pileup1_t *plp;
if (iter->func == 0 || iter->error) { *_n_plp = -1; return 0; }
if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
else {
*_n_plp = 0;
if (iter->is_eof) return 0;
while (iter->func(iter->data, iter->b) >= 0) {
if (bam_plp_push(iter, iter->b) < 0) {
*_n_plp = -1;
return 0;
}
if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
}
bam_plp_push(iter, 0);
if ((plp = bam_plp_next(iter, _tid, _pos, _n_plp)) != 0) return plp;
return 0;
}
}
void bam_plp_reset(bam_plp_t iter)
{
lbnode_t *p, *q;
iter->max_tid = iter->max_pos = -1;
iter->tid = iter->pos = 0;
iter->is_eof = 0;
for (p = iter->head; p->next;) {
q = p->next;
mp_free(iter->mp, p);
p = q;
}
iter->head = iter->tail;
}
void bam_plp_set_mask(bam_plp_t iter, int mask)
{
iter->flag_mask = mask < 0? BAM_DEF_MASK : (BAM_FUNMAP | mask);
}
/*****************
* callback APIs *
*****************/
int bam_pileup_file(bamFile fp, int mask, bam_pileup_f func, void *func_data)
{
bam_plbuf_t *buf;
int ret;
bam1_t *b;
b = bam_init1();
buf = bam_plbuf_init(func, func_data);
bam_plbuf_set_mask(buf, mask);
while ((ret = bam_read1(fp, b)) >= 0)
bam_plbuf_push(b, buf);
bam_plbuf_push(0, buf);
bam_plbuf_destroy(buf);
bam_destroy1(b);
return 0;
}
void bam_plbuf_set_mask(bam_plbuf_t *buf, int mask)
{
bam_plp_set_mask(buf->iter, mask);
}
void bam_plbuf_reset(bam_plbuf_t *buf)
{
bam_plp_reset(buf->iter);
}
bam_plbuf_t *bam_plbuf_init(bam_pileup_f func, void *data)
{
bam_plbuf_t *buf;
buf = calloc(1, sizeof(bam_plbuf_t));
buf->iter = bam_plp_init(0, 0);
buf->func = func;
buf->data = data;
return buf;
}
void bam_plbuf_destroy(bam_plbuf_t *buf)
{
bam_plp_destroy(buf->iter);
free(buf);
}
int bam_plbuf_push(const bam1_t *b, bam_plbuf_t *buf)
{
int ret, n_plp, tid, pos;
const bam_pileup1_t *plp;
ret = bam_plp_push(buf->iter, b);
if (ret < 0) return ret;
while ((plp = bam_plp_next(buf->iter, &tid, &pos, &n_plp)) != 0)
buf->func(tid, pos, n_plp, plp, buf->data);
return 0;
}
/***********
* mpileup *
***********/
struct __bam_mplp_t {
int n;
uint64_t min, *pos;
bam_plp_t *iter;
int *n_plp;
const bam_pileup1_t **plp;
};
bam_mplp_t bam_mplp_init(int n, bam_plp_auto_f func, void **data)
{
int i;
bam_mplp_t iter;
iter = calloc(1, sizeof(struct __bam_mplp_t));
iter->pos = calloc(n, 8);
iter->n_plp = calloc(n, sizeof(int));
iter->plp = calloc(n, sizeof(void*));
iter->iter = calloc(n, sizeof(void*));
iter->n = n;
iter->min = (uint64_t)-1;
for (i = 0; i < n; ++i) {
iter->iter[i] = bam_plp_init(func, data[i]);
iter->pos[i] = iter->min;
}
return iter;
}
void bam_mplp_destroy(bam_mplp_t iter)
{
int i;
for (i = 0; i < iter->n; ++i) bam_plp_destroy(iter->iter[i]);
free(iter->iter); free(iter->pos); free(iter->n_plp); free(iter->plp);
free(iter);
}
int bam_mplp_auto(bam_mplp_t iter, int *_tid, int *_pos, int *n_plp, const bam_pileup1_t **plp)
{
int i, ret = 0;
uint64_t new_min = (uint64_t)-1;
for (i = 0; i < iter->n; ++i) {
if (iter->pos[i] == iter->min) {
int tid, pos;
iter->plp[i] = bam_plp_auto(iter->iter[i], &tid, &pos, &iter->n_plp[i]);
iter->pos[i] = (uint64_t)tid<<32 | pos;
}
if (iter->plp[i] && iter->pos[i] < new_min) new_min = iter->pos[i];
}
iter->min = new_min;
if (new_min == (uint64_t)-1) return 0;
*_tid = new_min>>32; *_pos = (uint32_t)new_min;
for (i = 0; i < iter->n; ++i) {
if (iter->pos[i] == iter->min) { // FIXME: valgrind reports "uninitialised value(s) at this line"
n_plp[i] = iter->n_plp[i], plp[i] = iter->plp[i];
++ret;
} else n_plp[i] = 0, plp[i] = 0;
}
return ret;
}
| CosteaPaul/SamTools_custom | bam_pileup.c | C | mit | 11,537 |
#
# Compliments of @igrigorik
# @see: https://gist.github.com/igrigorik/a491cc732b5d4627e193
#
require 'garb'
require 'pp'
#
# $ gem install garb
# $ ruby report.rb [email protected] pass UA-XXXXX-X
#
user, pass, property = ARGV
class TopPages
extend Garb::Model
metrics :pageviews, :visits, :exitrate
dimensions :page_path
end
class Destinations
extend Garb::Model
metrics :pageviews
dimensions :page_path
end
Garb::Session.login(user, pass)
profile = Garb::Management::Profile.all.detect {|p| p.web_property_id == property}
top = TopPages.results(profile, :limit => 10, :sort => :pageviews.desc)
top.each do |page|
destinations = Destinations.results(profile, {
:filters => {:previouspagepath.eql => page.page_path},
:limit => 100, :sort => :pageviews.desc
}).reject {|d| d.page_path == page.page_path }
total = destinations.reduce(0) {|t,v| t+=v.pageviews.to_i}
puts
puts sprintf("Pageviews: %d, Exit rate: %.2f%%, Clickthroughs: %d, **Path: %s**\n\n",
page.pageviews, page.exit_rate.to_f, total, page.page_path)
destinations.first(10).each do |dest|
prob = (dest.pageviews.to_f / page.pageviews.to_f) * 100
puts sprintf("%10.2f%% - %3s pv : %s", prob, dest.pageviews, dest.page_path)
end
end
| rupl/frontend-ops | examples/prerender/report.rb | Ruby | mit | 1,250 |
elections14
========================
* [What is this?](#what-is-this)
* [Assumptions](#assumptions)
* [What's in here?](#whats-in-here)
* [Bootstrap the project](#bootstrap-the-project)
* [Simulate election results](#simulate-election-results)
* [Display the big board in the building](#display-the-big-board-in-the-building)
* [Hide project secrets](#hide-project-secrets)
* [Save media assets](#save-media-assets)
* [Add a page to the site](#add-a-page-to-the-site)
* [Run the project](#run-the-project)
* [COPY editing](#copy-editing)
* [Arbitrary Google Docs](#arbitrary-google-docs)
* [Run Python tests](#run-python-tests)
* [Run Javascript tests](#run-javascript-tests)
* [Compile static assets](#compile-static-assets)
* [Test the rendered app](#test-the-rendered-app)
* [Deploy to S3](#deploy-to-s3)
* [Deploy to EC2](#deploy-to-ec2)
* [Bootstrapping the server](#bootstrapping-the-server)
* [Install cron jobs](#install-cron-jobs)
* [Install web services](#install-web-services)
* [Run a remote fab command](#run-a-remote-fab-command)
* [Report analytics](#report-analytics)
What is this?
-------------
**TKTK: Describe elections14 here.**
Assumptions
-----------
The following things are assumed to be true in this documentation.
* You are running OSX.
* You are using Python 2.7. (Probably the version that came OSX.)
* You have [virtualenv](https://pypi.python.org/pypi/virtualenv) and [virtualenvwrapper](https://pypi.python.org/pypi/virtualenvwrapper) installed and working.
* You have NPR's AWS credentials stored as environment variables locally.
For more details on the technology stack used with the app-template, see our [development environment blog post](http://blog.apps.npr.org/2013/06/06/how-to-setup-a-developers-environment.html).
What's in here?
---------------
The project contains the following folders and important files:
* ``confs`` -- Server configuration files for nginx and uwsgi. Edit the templates then ``fab <ENV> servers.render_confs``, don't edit anything in ``confs/rendered`` directly.
* ``data`` -- Data files, such as those used to generate HTML.
* ``fabfile`` -- [Fabric](http://docs.fabfile.org/en/latest/) commands for automating setup, deployment, data processing, etc.
* ``etc`` -- Miscellaneous scripts and metadata for project bootstrapping.
* ``jst`` -- Javascript ([Underscore.js](http://documentcloud.github.com/underscore/#template)) templates.
* ``less`` -- [LESS](http://lesscss.org/) files, will be compiled to CSS and concatenated for deployment.
* ``templates`` -- HTML ([Jinja2](http://jinja.pocoo.org/docs/)) templates, to be compiled locally.
* ``tests`` -- Python unit tests.
* ``www`` -- Static and compiled assets to be deployed. (a.k.a. "the output")
* ``www/assets`` -- A symlink to an S3 bucket containing binary assets (images, audio).
* ``www/live-data`` -- "Live" data deployed to S3 via cron jobs or other mechanisms. (Not deployed with the rest of the project.)
* ``www/test`` -- Javascript tests and supporting files.
* ``app.py`` -- A [Flask](http://flask.pocoo.org/) app for rendering the project locally.
* ``app_config.py`` -- Global project configuration for scripts, deployment, etc.
* ``copytext.py`` -- Code supporting the [Editing workflow](#editing-workflow)
* ``crontab`` -- Cron jobs to be installed as part of the project.
* ``admin_app.py`` -- A [Flask](http://flask.pocoo.org/) app for running server-side, administrative code.
* ``render_utils.py`` -- Code supporting template rendering.
* ``requirements.txt`` -- Python requirements.
* ``static.py`` -- Static Flask views used in both ``app.py`` and ``admin_app.py``.
Bootstrap the project
---------------------
Node.js is required for the static asset pipeline. If you don't already have it, get it like this:
```
brew install node
curl https://npmjs.org/install.sh | sh
```
Before bootstrapping, you will also need to add a new set of credentials to your environment variables. Ask somebody on the team.
Then bootstrap the project:
```
cd elections14
mkvirtualenv elections14
pip install -r requirements.txt
npm install
fab text
fab ap.init
fab data.bootstrap
```
**Problems installing requirements?** You may need to run the pip command as ``ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install -r requirements.txt`` to work around an issue with OSX.
**Problems with data.bootstrap?** Run ``createdb`` to initialize your user database, and make sure you have the project environment variables in your ``.bash_profile``.
Simulate election results
-------------------------
To apply random poll closing times, vote counts, race calls, etc. to default Associated Press data, run:
```
fab data.mock_results
```
Display the big board in the building
-------------------------------------
The Senate big board is available on IPTV on channel 151. The internal IP address for administration is 10.32.64.205.
Reset server and database
-------------------------
To reset a server and database, run:
```
fab staging master data.reset_server
```
Hide project secrets
--------------------
Project secrets should **never** be stored in ``app_config.py`` or anywhere else in the repository. They will be leaked to the client if you do. Instead, always store passwords, keys, etc. in environment variables and document that they are needed here in the README.
Save media assets
-----------------
Large media assets (images, videos, audio) are synced with an Amazon S3 bucket specified in ``app_config.ASSETS_S3_BUCKET`` in a folder with the name of the project. (This bucket should not be the same as any of your ``app_config.PRODUCTION_S3_BUCKETS`` or ``app_config.STAGING_S3_BUCKETS``.) This allows everyone who works on the project to access these assets without storing them in the repo, giving us faster clone times and the ability to open source our work.
Syncing these assets requires running a couple different commands at the right times. When you create new assets or make changes to current assets that need to get uploaded to the server, run ```fab assets.sync```. This will do a few things:
* If there is an asset on S3 that does not exist on your local filesystem it will be downloaded.
* If there is an asset on that exists on your local filesystem but not on S3, you will be prompted to either upload (type "u") OR delete (type "d") your local copy.
* You can also upload all local files (type "la") or delete all local files (type "da"). Type "c" to cancel if you aren't sure what to do.
* If both you and the server have an asset and they are the same, it will be skipped.
* If both you and the server have an asset and they are different, you will be prompted to take either the remote version (type "r") or the local version (type "l").
* You can also take all remote versions (type "ra") or all local versions (type "la"). Type "c" to cancel if you aren't sure what to do.
Unfortunantely, there is no automatic way to know when a file has been intentionally deleted from the server or your local directory. When you want to simultaneously remove a file from the server and your local environment (i.e. it is not needed in the project any longer), run ```fab assets.rm:"www/assets/file_name_here.jpg"```
Adding a page to the site
-------------------------
A site can have any number of rendered pages, each with a corresponding template and view. To create a new one:
* Add a template to the ``templates`` directory. Ensure it extends ``_base.html``.
* Add a corresponding view function to ``app.py``. Decorate it with a route to the page name, i.e. ``@app.route('/filename.html')``
* By convention only views that end with ``.html`` and do not start with ``_`` will automatically be rendered when you call ``fab render``.
Run the project
---------------
A flask app is used to run the project locally. It will automatically recompile templates and assets on demand.
```
workon $PROJECT_SLUG
python app.py
```
Visit [localhost:8000](http://localhost:8000) in your browser.
COPY editing
------------
This app uses a Google Spreadsheet for a simple key/value store that provides an editing workflow.
View the [sample copy spreadsheet](https://docs.google.com/spreadsheet/pub?key=0AlXMOHKxzQVRdHZuX1UycXplRlBfLVB0UVNldHJYZmc#gid=0).
This document is specified in ``app_config`` with the variable ``COPY_GOOGLE_DOC_KEY``. To use your own spreadsheet, change this value to reflect your document's key (found in the Google Docs URL after ``&key=``).
A few things to note:
* If there is a column called ``key``, there is expected to be a column called ``value`` and rows will be accessed in templates as key/value pairs
* Rows may also be accessed in templates by row index using iterators (see below)
* You may have any number of worksheets
* This document must be "published to the web" using Google Docs' interface
The app template is outfitted with a few ``fab`` utility functions that make pulling changes and updating your local data easy.
To update the latest document, simply run:
```
fab copytext.update
```
Note: ``copytext.update`` runs automatically whenever ``fab render`` is called.
At the template level, Jinja maintains a ``COPY`` object that you can use to access your values in the templates. Using our example sheet, to use the ``byline`` key in ``templates/index.html``:
```
{{ COPY.attribution.byline }}
```
More generally, you can access anything defined in your Google Doc like so:
```
{{ COPY.sheet_name.key_name }}
```
You may also access rows using iterators. In this case, the column headers of the spreadsheet become keys and the row cells values. For example:
```
{% for row in COPY.sheet_name %}
{{ row.column_one_header }}
{{ row.column_two_header }}
{% endfor %}
```
When naming keys in the COPY document, pleaseattempt to group them by common prefixes and order them by appearance on the page. For instance:
```
title
byline
about_header
about_body
about_url
download_label
download_url
```
Arbitrary Google Docs
----------------------
Sometimes, our projects need to read data from a Google Doc that's not involved with the COPY rig. In this case, we've got a class for you to download and parse an arbitrary Google Doc to a CSV.
This solution will download the uncached version of the document, unlike those methods which use the "publish to the Web" functionality baked into Google Docs. Published versions can take up to 15 minutes up update!
First, export a valid Google username (email address) and password to your environment.
```
export [email protected]
export APPS_GOOGLE_PASS=MyPaSsW0rd1!
```
Then, you can load up the `GoogleDoc` class in `etc/gdocs.py` to handle the task of authenticating and downloading your Google Doc.
Here's an example of what you might do:
```
import csv
from etc.gdoc import GoogleDoc
def read_my_google_doc():
doc = {}
doc['key'] = '0ArVJ2rZZnZpDdEFxUlY5eDBDN1NCSG55ZXNvTnlyWnc'
doc['gid'] = '4'
doc['file_format'] = 'csv'
doc['file_name'] = 'gdoc_%s.%s' % (doc['key'], doc['file_format'])
g = GoogleDoc(**doc)
g.get_auth()
g.get_document()
with open('data/%s' % doc['file_name'], 'wb') as readfile:
csv_file = list(csv.DictReader(readfile))
for line_number, row in enumerate(csv_file):
print line_number, row
read_my_google_doc()
```
Google documents will be downloaded to `data/gdoc.csv` by default.
You can pass the class many keyword arguments if you'd like; here's what you can change:
* gid AKA the sheet number
* key AKA the Google Docs document ID
* file_format (xlsx, csv, json)
* file_name (to download to)
See `etc/gdocs.py` for more documentation.
Run Python tests
----------------
Python unit tests are stored in the ``tests`` directory. Run them with ``fab tests``.
Run Javascript tests
--------------------
With the project running, visit [localhost:8000/test/SpecRunner.html](http://localhost:8000/test/SpecRunner.html).
Compile static assets
---------------------
Compile LESS to CSS, compile javascript templates to Javascript and minify all assets:
```
workon elections14
fab render
```
(This is done automatically whenever you deploy to S3.)
Test the rendered app
---------------------
If you want to test the app once you've rendered it out, just use the Python webserver:
```
cd www
python -m SimpleHTTPServer
```
Deploy to S3
------------
```
fab staging master deploy
```
Deploy to EC2
-------------
You can deploy to EC2 for a variety of reasons. We cover two cases: Running a dynamic web application (`admin_app.py`) and executing cron jobs (`crontab`).
Servers capable of running the app can be setup using our [servers](https://github.com/nprapps/servers) project.
For running a Web application:
* In ``app_config.py`` set ``DEPLOY_TO_SERVERS`` to ``True``.
* Also in ``app_config.py`` set ``DEPLOY_WEB_SERVICES`` to ``True``.
* Run ``fab staging master servers.setup`` to configure the server.
* Run ``fab staging master deploy`` to deploy the app.
For running cron jobs:
* In ``app_config.py`` set ``DEPLOY_TO_SERVERS`` to ``True``.
* Also in ``app_config.py``, set ``INSTALL_CRONTAB`` to ``True``
* Run ``fab staging master servers.setup`` to configure the server.
* Run ``fab staging master deploy`` to deploy the app.
You can configure your EC2 instance to both run Web services and execute cron jobs; just set both environment variables in the fabfile.
Bootstrapping the server
------------------------
```
fab staging master servers.fabcast:"data.bootstrap"
fab staging master server.fabcast:"data.mock_results"
```
Install cron jobs
-----------------
Cron jobs are defined in the file `crontab`. Each task should use the `cron.sh` shim to ensure the project's virtualenv is properly activated prior to execution. For example:
```
* * * * * ubuntu bash /home/ubuntu/apps/elections14/repository/cron.sh fab $DEPLOYMENT_TARGET cron_jobs.test
```
To install your crontab set `INSTALL_CRONTAB` to `True` in `app_config.py`. Cron jobs will be automatically installed each time you deploy to EC2.
The cron jobs themselves should be defined in `fabfile/cron_jobs.py` whenever possible.
Install web services
---------------------
Web services are configured in the `confs/` folder.
Running ``fab servers.setup`` will deploy your confs if you have set ``DEPLOY_TO_SERVERS`` and ``DEPLOY_WEB_SERVICES`` both to ``True`` at the top of ``app_config.py``.
To check that these files are being properly rendered, you can render them locally and see the results in the `confs/rendered/` directory.
```
fab servers.render_confs
```
You can also deploy only configuration files by running (normally this is invoked by `deploy`):
```
fab servers.deploy_confs
```
Run a remote fab command
-------------------------
Sometimes it makes sense to run a fabric command on the server, for instance, when you need to render using a production database. You can do this with the `fabcast` fabric command. For example:
```
fab staging master servers.fabcast:deploy
```
If any of the commands you run themselves require executing on the server, the server will SSH into itself to run them.
Analytics
---------
The Google Analytics events tracked in this application are:
|Category|Action|Label|Value|Custom 1|Custom 2|
|--------|------|-----|-----|--------|--------|
|elections14|chromecast-initiated||||
|elections14|chromecast-stopped||||
|elections14|fullscreen||||
|elections14|state-selected|`state`|||
|elections14|audio-toggle||||
|elections14|audio-fail||||
|elections14|slide-link-click||||
|elections14|next-slide-click||||
|elections14|prev-slide-click||||
|elections14|keyboard-nav||||
|elections14|facebook|share-discuss|||
|elections14|tweet|share-discuss|||
|elections14|mobile-controls||||
* The following events only fire once per session: `next-slide-clicked`, `prev-slide-clicked`, `keyboard-nav` and `mobile-controls`.
| nprapps/elections14 | README.md | Markdown | mit | 15,880 |
package main
import (
"fmt"
"github.com/influxdata/influxdb/client/v2"
"github.com/namsral/flag"
)
// DataLayerInterface abstracts the db connection
type DataLayerInterface interface {
CreatePoint(pt *client.Point) error
QueryDB(cmd string) (res []client.Result, err error)
}
var (
DBName *string
)
// InfluxDL implements the DataLayerInterface
type InfluxDL struct {
Client client.Client
BatchConfig client.BatchPointsConfig
}
//Init the database
func (i *InfluxDL) Init() error {
url := flag.String("influx-url", "localhost", "Influx host url")
DBName = flag.String("influx-db-name", "iochti", "Influx default database name")
username := flag.String("influx-user", "iochti", "Influx username")
inflxPwd := flag.String("influx-pwd", "", "Influx user's password")
flag.Parse()
fmt.Println(*url, *DBName, *username, *inflxPwd)
c, err := client.NewHTTPClient(client.HTTPConfig{
Addr: fmt.Sprintf("http://%s:8086", *url),
Username: *username,
Password: *inflxPwd,
})
if err != nil {
return err
}
q := client.Query{
Command: fmt.Sprintf(`
CREATE DATABASE IF NOT EXISTS %s;
CREATE RETENTION POLICY \"ten_min_only\" ON \"%s\" DURATION 10min REPLICATION 1;
`, *DBName, *DBName),
Database: *DBName,
}
if response, err := c.Query(q); err != nil {
if response.Error() != nil {
return response.Error()
}
}
i.Client = c
i.BatchConfig = client.BatchPointsConfig{
Database: *DBName,
}
return nil
}
// CreatePoint creates a point in the DB
func (i *InfluxDL) CreatePoint(pt *client.Point) error {
bp, err := client.NewBatchPoints(i.BatchConfig)
if err != nil {
return err
}
bp.AddPoint(pt)
if err = i.Client.Write(bp); err != nil {
return err
}
return nil
}
// QueryDB convenience function to query the database
func (i *InfluxDL) QueryDB(cmd string) (res []client.Result, err error) {
q := client.Query{
Command: cmd,
Database: *DBName,
}
if response, err := i.Client.Query(q); err == nil {
if response.Error() != nil {
return res, response.Error()
}
res = response.Results
} else {
return res, err
}
return res, nil
}
| iochti/point-service | data-layer.go | GO | mit | 2,136 |
(function () {
'use strict';
angular.module('processMonitor').service('api', heatingControlApi);
function heatingControlApi($http) {
var apiUrl = '/api/';
this.get = function (endpoint) {
return $http.get(apiUrl + endpoint);
};
this.set = function (endpoint, data) {
return $http.put(apiUrl + endpoint, data);
};
}
}());
| roland-vachter/process-runner | public/app/components/shared/api.service.js | JavaScript | mit | 345 |
<!DOCTYPE html>
<html ng-app="ngBoilerplate" ng-controller="AppCtrl">
<head>
<title ng-bind="pageTitle"></title>
<!-- social media tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@joshdmiller">
<meta name="twitter:title" content="ngBoilerplate">
<meta name="twitter:description" content="Non-Trivial AngularJS Made Easy: Everything you need to kickstart AngularJS projects: a best-practice directory structure, an intelligent build system, and the best web design libraries around.">
<meta name="twitter:creator" content="@joshdmiller">
<meta name="twitter:image:src" content="https://a248.e.akamai.net/assets.github.com/images/modules/logos_page/Octocat.png?1366128846">
<meta property="og:title" content="ngBoilerplate" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://bit.ly/ngBoilerplate" />
<meta property="og:image" content="https://a248.e.akamai.net/assets.github.com/images/modules/logos_page/Octocat.png?1366128846" />
<meta property="og:description" content="Non-Trivial AngularJS Made Easy: Everything you need to kickstart AngularJS projects: a best-practice directory structure, an intelligent build system, and the best web design libraries around.">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- font awesome from BootstrapCDN -->
<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<!-- compiled CSS -->
<link rel="stylesheet" type="text/css" href="assets/ngbp-0.3.2.css" />
<!-- compiled JavaScript -->
<script type="text/javascript" src="vendor/angular/angular.js"></script>
<script type="text/javascript" src="vendor/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script type="text/javascript" src="vendor/angular-ui-router/release/angular-ui-router.js"></script>
<script type="text/javascript" src="src/app/about/about.js"></script>
<script type="text/javascript" src="src/app/app.js"></script>
<script type="text/javascript" src="src/app/home/home.js"></script>
<script type="text/javascript" src="src/common/plusOne/plusOne.js"></script>
<script type="text/javascript" src="templates-common.js"></script>
<script type="text/javascript" src="templates-app.js"></script>
<!-- it's stupid to have to load it here, but this is for the +1 button -->
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{ "parsetags": "explicit" }
</script>
</head>
<body>
<div class="container">
<div class="navbar navbar-default">
<div class="navbar-header">
<button type="button" class="navbar-toggle" ng-init="menuCollapsed = true"
ng-click="menuCollapsed = ! menuCollapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="navbar-brand">
ngbp
<small>
<a href="http://github.com/ngbp/ngbp/blob/v0.3.2-release/CHANGELOG.md">
v0.3.2
</a>
</small>
</div>
</div>
<div class="collapse navbar-collapse" collapse="menuCollapsed">
<ul class="nav navbar-nav">
<li ui-sref-active="active">
<a href ui-sref="home">
<i class="fa fa-home"></i>
Home
</a>
</li>
<li ui-sref-active="active">
<a href ui-sref="about">
<i class="fa fa-info-circle"></i>
What is it?
</a>
</li>
<li>
<a href="https://github.com/ngbp/ngbp#readme">
<i class="fa fa-book"></i>
Read the Docs
</a>
</li>
<li>
<a href="https://github.com/ngbp/ngbp">
<i class="fa fa-github-alt"></i>
Github
</a>
</li>
<li>
<a href="https://github.com/ngbp/ngbp/issues">
<i class="fa fa-comments"></i>
Support
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container" ui-view="main"></div>
<footer class="footer">
<div class="container">
<div class="footer-inner">
<ul class="social">
<li><a target="_blank" href="http://gplus.to/joshdmiller"><i class="fa fa-google-plus-sign"></i></a></li>
<li><a target="_blank" href="http://twitter.com/joshdmiller"><i class="fa fa-twitter-sign"></i></a></li>
<li><a target="_blank" href="http://linkedin.com/in/joshdmiller"><i class="fa fa-linkedin-sign"></i></a></li>
<li><a target="_blank" href="http://github.com/ngbp/ngbp"><i class="fa fa-github-sign"></i></a></li>
</ul>
<p>
(c) 2013 <a href="http://www.joshdavidmiller.com">Josh David Miller</a>.
<a href="http://github.com/ngbp/ngbp/fork_select">Fork this</a>
to kickstart your next project.
<br />
ngbp is based on
<a href="http://www.angularjs.org">AngularJS</a>,
<a href="http://getbootstrap.com">Bootstrap</a>,
<a href="http://angular-ui.github.com/bootstrap">UI Bootstrap</a>,
and
<a href="http://fortawesome.github.com/Font-Awesome">Font Awesome</a>.
</p>
</div>
</div>
</footer>
</body>
</html>
| vishwakarmarhl/ngboilerplate-heroku | build/index.html | HTML | mit | 5,735 |
// -----------------------------------------------------------------------
// <copyright file="FlexArrayListMultiSet.cs" company="Phoenix Game Studios, LLC">
// Copyright (c) 2017 Phoenix Game Studios, LLC. All rights reserved.
// Licensed under the MIT License.
// See https://github.com/PhoenixGameStudios/DangrLib/blob/master/LICENSE for full license information.
// </copyright>
// -----------------------------------------------------------------------
namespace Dangr.Core.FlexCollections.MultiSet
{
public static class FlexArrayListMultiSet
{
/// <summary>
/// Provides read only covariant methods for the collection.
/// </summary>
/// <typeparam name="T">The type of object contained in the collection.</typeparam>
public interface IReadOnlyCovariant<out T> : FlexListMultiSet.IReadOnlyCovariant<T>
{
}
/// <summary>
/// Provides read only methods for the collection.
/// </summary>
/// <typeparam name="T">The type of object contained in the collection.</typeparam>
public interface IReadOnly<T> : IReadOnlyCovariant<T>, FlexListMultiSet.IReadOnly<T>
{
}
/// <summary>
/// Provides covariant methods for the collection.
/// </summary>
/// <typeparam name="T">The type of object contained in the collection.</typeparam>
public interface ICovariant<out T> : IReadOnlyCovariant<T>, FlexListMultiSet.ICovariant<T>
{
}
/// <summary>
/// Provides generic methods for the collection.
/// </summary>
/// <typeparam name="T">The type of object contained in the collection.</typeparam>
public interface IGeneric<T> : IReadOnly<T>, ICovariant<T>, FlexListMultiSet.IGeneric<T>
{
}
}
} | PhoenixGameStudios/DangrLib | src/Dangr.Collections/Core/FlexCollections/MultiSet/FlexArrayListMultiSet.cs | C# | mit | 1,843 |
/*
* main.cpp
*
*/
#include "Robot.h"
#include "Behaviour.h"
#include "Action.h"
#include <player-3.0/libplayerc++/playerc++.h>
#include <iostream>
#include <cstdlib>
#include <exception>
#include <sstream>
#include <algorithm>
#define _GXX_EXPERIMENTAL_CXX0X__
#include <chrono>
using namespace PlayerCc;
using namespace std;
void printBehaviour(ostream& left, const Behaviour& b) {
left << "Behaviour " << &b << " ";
b.print(left);
}
void printDescriptor(ostream& left, const RobotDescriptor &rd) {
left << "Descriptor " << &rd << ". Enumerating behaviours:" << endl;
for (unsigned int i = 0; i < rd.behaviours.size(); i++) {
printBehaviour(left, *(rd.behaviours[i]));
}
}
int main(int argc, char **argv) {
PlayerClient *robot = nullptr;
int at = 0;
stringstream portConverter(argv[2]);
int simPort;
portConverter >> simPort;
while (robot == nullptr) {
try {
robot = new PlayerClient("localhost", simPort);
} catch (PlayerError &ex) {
robot = nullptr;
sleep(1);
}
if(at >= 20){
return 0;
}
at++;
}
Position2dProxy pp(robot);
LaserProxy lp(robot);
ifstream targetData("target.txt");
double rtx = 0;
double rty = 0;
double timeLimit = 60;
targetData >> rtx >> rty;
targetData.close();
cout << "Target: " << rtx << ", " << rty << endl;
RobotDescriptor descriptor;
Robot r(&pp, &lp, &descriptor);
stringstream fileName;
fileName << "robots/desc" << argv[1];
ifstream read;
read.open("stats.txt");
stringstream fileLockName;
fileLockName << "lock." << argv[1];
ifstream fileLockCheck(fileLockName.str());
if(fileLockCheck.good()){
fileLockCheck.close();
return 0;
}
fileLockCheck.close();
bool simulated = false;
do {
string id;
double score;
int stall;
double duration;
read >> id >> score >> stall >> duration;
if (!id.length()) {
break;
}
stringstream fileName2;
fileName2 << "robots/desc" << id;
if (fileName == fileName2) {
simulated = true;
break;
}
} while (!read.eof());
if(simulated){
return 0;
}
cout << "Creating LOCK" << endl;
ofstream fileLock(fileLockName.str());
fileLock << endl;
fileLock.close();
cout << "READING FROM FILE: " << fileName.str() << endl;
ifstream inputFile;
inputFile.open(fileName.str());
descriptor.loadFromFile(inputFile, &r);
inputFile.close();
//printDescriptor(cout, descriptor);
cout << "*** DESCRIPTOR READ. STARTING SIMULATION. ***" << endl;
auto begin = chrono::high_resolution_clock::now();
auto lastSample = chrono::high_resolution_clock::now();
double points = 0;
bool stall = false;
vector<double> pl;
double sampleRate = 1;
while (true) {
robot->Read();
r.update();
if (pp.GetStall()) {
stall = true;
break;
}
auto now = chrono::high_resolution_clock::now();
double elapsed = (chrono::duration_cast<chrono::duration<double> >(
now - begin)).count();
if ((chrono::duration_cast<chrono::duration<double> >(now - lastSample)).count()
>= sampleRate) {
lastSample = now;
double dist = pow(pp.GetXPos() - rtx, 2)
+ pow(pp.GetYPos() - rty, 2);
pl.push_back(dist);
}
if (elapsed > timeLimit) {
break;
}
}
sort(pl.begin(), pl.end());
int samples = 0;
for (unsigned int i = 0; (i < 10 && i < pl.size()); i++) {
points += pl[i];
samples++;
}
points /= samples;
double duration = (chrono::duration_cast<chrono::duration<double> >(
chrono::high_resolution_clock::now() - begin)).count();
cout << "Acabou o tempo! Pontos: " << points << endl;
cout << "Bateu: " << stall << endl;
cout << "Duration: " << duration << endl;
ofstream stats;
stats.open("stats.txt", ios::app);
stats << argv[1] << " " << points << " " << (stall ? "1" : "0") << " " << duration
<< endl;
stats.close();
remove(fileLockName.str().c_str());
return 0;
}
| Windsdon/evolutive | src/main.cpp | C++ | mit | 3,816 |
# -*- coding: utf-8 -*-
import marshmallow
from marshmallow import fields
class LoginAttemptsView(marshmallow.Schema):
class Meta:
strict = True
credentials = fields.String(required=True)
@marshmallow.post_load
def prepend_authentication_scheme(self, data):
data_ = data.copy()
try:
data_['credentials'] = 'Basic ' + data_['credentials']
except KeyError:
pass
return data_
| dnguyen0304/tuxedo-mask | tuxedo_mask/views/login_attempts_view.py | Python | mit | 460 |
package com.github.newnewcoder.batch.jdbc;
/**
* Copy from project Microsoft/mssql-jdbc's SQLServerBulkCSVFileRecord.ColumnMetadata, and updated some code.
*
* @see <a href="https://github.com/Microsoft/mssql-jdbc/blob/master/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java">mssql-jdbc</a>
*/
public final class ColumnMetadata {
final String fieldName;
final String columnName;
final int columnType;
final int precision;
final int scale;
ColumnMetadata(String fieldName, String columnName, int type, int precision, int scale) {
this.fieldName = fieldName;
this.columnName = columnName;
this.columnType = type;
this.precision = precision;
this.scale = scale;
}
} | newnewcoder/spring-batch-mssql-bulkcopy | src/main/java/com/github/newnewcoder/batch/jdbc/ColumnMetadata.java | Java | mit | 783 |
class MapIcon < FontGenerator
attr_reader :font
def initialize
@font = Font.new "map_icons", read_icons
end
def run
self.generate_code
end
protected
def array_name
"mapIconArr"
end
def read_icons
icons = []
File.read("./../IconFontCss/map_icons.scss").each_line do |line|
parts = line.split(' ')
icon_name = parts[0]
if icon_name && icon_name.start_with?('$map-icon-')
icon_name = icon_name['$map-icon-'.length..(icon_name.length) -2]
nameParts = icon_name.split('-')
icon_name = nameParts.join
icon_code = parts[1]
icon_code = icon_code[2..5]
icons.push({
"name": icon_name,
"code": "\\u{#{icon_code}}"
})
end
end
icons
end
end | 0x73/SwiftIconFont | FontGenerator/icons/map_icons.rb | Ruby | mit | 818 |
<?php
namespace MM\Controller;
/**
* Class Exception
* @package MM\Controller
*/
class Exception extends \Exception
{
} | marianmeres/mm-php | mm-controller/library/MM/Controller/Exception.php | PHP | mit | 124 |
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FlashMessagesService } from 'angular2-flash-messages';
import { AuthService } from '../../services/auth.service';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
email: string;
password: string;
constructor (
private _router: Router,
private _flash: FlashMessagesService,
private _auth: AuthService
) {}
ngOnInit () {}
onSubmit () {
this._auth.auth(this.email, this.password).then((res) => {
this._flash.show(
'Welcome! You are now logged in',
{cssClass: 'alert-success', timeout: 6000}
);
this._router.navigate(['/']);
}).catch((err) => {
this._flash.show(
err.message,
{cssClass: 'alert-danger', timeout: 6000}
);
this._router.navigate(['/login']);
})
}
} | jibanez74/BusinessPanel | src/app/components/login/login.component.ts | TypeScript | mit | 990 |
<?php $page = $this->page; ?>
<?php if(file_exists('/var/www/fashionweb.hu/contimg/firm/' . $page->ceg_id . '/parallax.jpg')) : ?>
<!-- POLICY -->
<div class="policy-item parallax-bg1" style="height: 300px; background: url(/contimg/firm/<?php echo $page->ceg_id; ?>/parallax.jpg) no-repeat top fixed">
<div class="container">
<div class="row">
</div>
</div>
</div>
<?php endif; ?> | kocsis/fashionweb | www/function/module/microsite_parallax/template/main.php | PHP | mit | 404 |
define(["js/core/Component", "xaml!sprd/data/SprdApiDataSource", "flow", "sprd/model/Session", "js/core/Bus"], function(Component, SprdApiDataSource, flow, Session, Bus) {
return Component.inherit("sprd.manager.AuthenticationManager", {
defaults: {
session: null
},
inject: {
api: SprdApiDataSource,
bus: Bus
},
_commitSession: function(session) {
var api = this.$.api;
api && api.set("session", session);
},
/***
*
* @param sessionId
* @param [withUser=true]
* @param callback
*/
initializeWithSessionId: function(sessionId, withUser, callback) {
if (arguments[1] instanceof Function) {
callback = withUser;
withUser = true;
}
if (!sessionId) {
callback && callback("No sessionId");
return;
}
var api = this.$.api,
self = this,
session = api.createEntity(Session, sessionId);
session.fetch({
fetchSubModels: (withUser ? ["user"] : []),
noCache: true
}, function(err, session) {
if (err) {
session = null;
}
api.set("session", session);
self.set("session", session);
callback && callback(err, session);
});
},
loginWithSession: function(session, callback) {
var self = this,
api = this.$.api;
session.login(function (err) {
if (err) {
session = null;
}
api.set("session", session);
self.set("session", session);
callback && callback(err, session);
});
},
login: function(username, password, callback) {
var session = this.$.api.createEntity(Session);
session.set({
username: username,
password: password
});
this.loginWithSession(session, callback);
},
logout: function(callback) {
var session = this.$.session,
self = this;
if (!session) {
session = this.$.api.createEntity(Session, "current");
}
session.remove(null, function(err) {
if (self.$.session === session) {
self.set("session", null);
}
if (!err) {
self.$.bus.trigger('User.logout');
}
callback && callback(err);
});
}
});
}); | spreadshirt/rAppid.js-sprd | sprd/manager/AuthenticationManager.js | JavaScript | mit | 2,822 |
// Copyright (c) 2011-2013 The Bitcoin Core and Deuscoin Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef MACNOTIFICATIONHANDLER_H
#define MACNOTIFICATIONHANDLER_H
#include <QObject>
/** Macintosh-specific notification handler (supports UserNotificationCenter and Growl).
*/
class MacNotificationHandler : public QObject
{
Q_OBJECT
public:
/** shows a 10.8+ UserNotification in the UserNotificationCenter
*/
void showNotification(const QString &title, const QString &text);
/** executes AppleScript */
void sendAppleScript(const QString &script);
/** check if OS can handle UserNotifications */
bool hasUserNotificationCenterSupport(void);
static MacNotificationHandler *instance();
};
#endif // MACNOTIFICATIONHANDLER_H
| deuscoin/deuscoin | src/qt/macnotificationhandler.h | C | mit | 885 |
# tipograph
*A little javascript library and command line tool that makes your written content more typographically correct.*
**STATUS:** The library is in passive maintenance. I don't have any active use
of this project personally. Nevertheless, all feature requests and bug reports
will be addressed in a reasonable time manner.
> "When you ignore typography, you’re ignoring an opportunity to improve the effectiveness of your writing." -
> Matthew Butterick
Even if typography can be seen as a set of rules given by some freaks, it's actually quite an important aspect of
written content. Besides it brings an aesthetic value, it also helps a person to read the text more fluently and
comfortably. And curly quotes just look great!
However, to be typographically correct one has to make some non-trivial effort, be it to learn the rules or to find out
how to type all those special characters instead of these present on his keyboard. And therefore *tipograph* comes here
to help. It tries its best to fix a text and apply the rules.
It's impossible to manage all rules out there, because *tipograph* is just a set of simple transformation rules and it
doesn't understand wider linguistic context. And sometimes it will fail. But still, the help deserves to be appreciated.
Especially when it costs nothing.
*In version 0.4.0 there are API breaking changes as it's a complete rewrite. However, the migration should not be
difficult (see the [guide](03to04.md)). If you are interested, [here](https://github.com/pnevyk/tipograph/tree/v0.3.5)
is the documentation for the old API.*
*Tipograph is not in stable phase yet. Rules will be added and improved over time. Feel free to make suggestion or ask
question if you have any.*
Note that Tipograph is focused on character substitution text-wise.
Therefore it has a different goal than [Typeset](https://github.com/davidmerfield/Typeset) library
which focuses on nice typography regarding appearance
(although there is a small overlap in some pattern substitution).
## Demo
You can see what *tipograph* help you with [here](http://pnevyk.github.io/tipograph/).
## Installation
**In node**
```shell
# to use it as library
npm install --save tipograph
# to use it as command line utility
npm install --global tipograph
```
**In browser**
```html
<script type="text/javascript" src="https://unpkg.com/tipograph"></script>
```
## Usage
```js
// in browser, tipograph is accessible as property of window
var tipograph = require('tipograph');
// initialize new instance
var typo1 = tipograph();
// initialize new instance with different configuration
var typo2 = tipograph({
format: 'html',
language: 'czech',
presets: ['quotes', 'language'],
post: 'latex',
options: {
dash: 'em',
},
});
typo2('"Ahoj <b style="color: red;">světe</b>!"') // „Ahoj <b style="color: red;">světe</b>!“
// stream support (only in node)
var fs = require('fs');
fs.createReadStream('input.txt')
.pipe(tipograph.createStream(/*{ options }*/))
.pipe(fs.createWriteStream('output.txt'));
```
### CLI
*Tipograph* also provides command line interface. You just need to install the package globally.
**Basic usage**
```shell
tipograph -i input.txt -o output.txt
```
**Help**
```shell
tipograph --help
```
*Note that writing the transformed content into the source file itself results in an empty file. Moreover, you should
always check the output whether it's correct and make a backup of a content if you want to write into the file back.*
## Presets
There is a number of predefined rules which are grouped into presets. By default, all these presets are used, although
you can pick just those you want by passing an array into *options* object. If you want to apply your own custom rules,
you can pass your preset into the array (see [preset documentation](src/presets/readme.md) for more details). Note that
the order in *presets* array determines the order of rules application onto the input.
*Rules mentioned here don't cover all typography rules, just those which are handled by tipograph. Please, read some
other resources in order to be able to make your content better.*
*Description here is quite a general overview. You can see a lot of examples how these presets behave [here](rules.md).*
<!-- {{ presets }} -->
#### custom
If *tipograph*'s rules are not enough for you, you can define your own. Please, consider whether your rule would make
sense in *tipograph* core, and if so, I will gladly accept your contribution.
```js
var custom = function (language) {
// set of rules
return [
// rule is a pair of search value and its replacement
[/-([a-z])/g, function (match, letter) {
return letter.toUpperCase();
}]
];
};
var typo1 = tipograph({ presets: [custom] }); // use only your custom preset
var typo2 = tipograph({ presets: tipograph.extend([custom]) }); // or extend the default presets
```
## Formats
The input might be in a different format than just a plain text and it might be important to take it into account. For
example, you don't want to apply typography rules inside HTML tag. For that case, you can specify the format
preprocessor. There are few already made, and again, you can define your own (see
[format documentation](src/formats/readme.md) for more details).
<!-- {{ formats }} -->
## Postprocessing
Sometimes the special characters need to be replaced with their corresponding macros/entities in an output format, so
that the file can be saved as ascii-encoded file or the compiler/interpreter of the format (and the human too)
understands it.
<!-- {{ post }} -->
## Changes
It is possible to retrieve the information how the text was changed by tipograph. This can be useful for providing the
user with these details or to implement more complex application above tipograph (e.g., WYSIWYG editor). This
information is in the form of the collection of pairs where the first item of the pair represents an index slice in the
source text and the second items an index slice in the output text. Probably more understandable from an example:
```js
var typo = tipograph();
typo('"lorem --- ipsum"', function (converted, changes) {
// process the changes:
// [
// [[0, 1], [0, 1]], // '"' -> '\u201C'
// [[6, 11], [6, 9]], // '"' -> '\u200a\u2014\u200a'
// [[16, 17], [14, 15]] // '"' -> '\u201D'
// ]
// converted: '\u201Clorem\u200a\u2014\u200aipsum\u201D'
// return the converted text
// this return value becomes the return value of the whole `typo` function
// you can also return the changes
return converted;
});
// stream
fs.createReadStream('input.txt')
.pipe(tipograph.createStream(/*{ options }, */callback))
.pipe(fs.createWriteStream('output.txt'));
```
## Languages
Different languages may have different rules. The most notable example are quotes. There are few predefined languages
and you can define your own (see [language documentation](src/languages/readme.md) for more details). The language
contains configuration for some presets (at the moment, only *quotes*) and moreover it contains rules specific for the
language. Just don't forget to include *language* preset into *presets* option.
<!-- {{ languages }} -->
#### custom
If you need a language which is not included in *tipograph* core or you need to make specific changes to a built-in
language, you can do so by passing the language object instead of a name. The same as in custom preset case, consider
contributing your language to *tipograph* itself.
```js
var typo = tipograph({
language: {
quotes: [
// french quotes (see src/quotes.js)
[tipograph.quotes.DOUBLE_LEFT_SPACE, tipograph.quotes.DOUBLE_RIGHT_SPACE],
[tipograph.quotes.SINGLE_LEFT_SPACE, tipograph.quotes.SINGLE_RIGHT_SPACE]
],
// same interface as in custom preset
rules: []
}
});
```
If you want to reuse either quotes or rules definition of an existing language, it is possible using exported
`languages` property, that is, using `tipograph.languages.french.quotes` and `tipograph.languages.french.rules`.
## Resources
* [Practical Typography](https://practicaltypography.com/) for the most of the rules in *tipograph*
* [Summary table](https://en.wikipedia.org/wiki/Quotation_mark#Summary_table) on Wikipedia for quote symbols in various
languages
## Contributing
See [contributing guide](CONTRIBUTING.md).
## License
Tipograph is licensed under [MIT](LICENSE). Feel free to use it, contribute or spread the word.
| pnevyk/tipograph | .readme.md | Markdown | mit | 8,658 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the
# Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice
# shall be included in all copies or substantial portions of
# the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
# OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""Implementation of compile_html based on markdown."""
from __future__ import unicode_literals
import io
import os
try:
from markdown import markdown
except ImportError:
markdown = None # NOQA
nikola_extension = None
gist_extension = None
podcast_extension = None
from nikola.plugin_categories import PageCompiler
from nikola.utils import makedirs, req_missing, write_metadata
class CompileMarkdown(PageCompiler):
"""Compile Markdown into HTML."""
name = "markdown"
friendly_name = "Markdown"
demote_headers = True
extensions = []
site = None
def set_site(self, site):
"""Set Nikola site."""
super(CompileMarkdown, self).set_site(site)
self.config_dependencies = []
for plugin_info in self.get_compiler_extensions():
self.config_dependencies.append(plugin_info.name)
self.extensions.append(plugin_info.plugin_object)
plugin_info.plugin_object.short_help = plugin_info.description
self.config_dependencies.append(str(sorted(site.config.get("MARKDOWN_EXTENSIONS"))))
def compile_html(self, source, dest, is_two_file=True):
"""Compile source file into HTML and save as dest."""
if markdown is None:
req_missing(['markdown'], 'build this site (compile Markdown)')
makedirs(os.path.dirname(dest))
self.extensions += self.site.config.get("MARKDOWN_EXTENSIONS")
with io.open(dest, "w+", encoding="utf8") as out_file:
with io.open(source, "r", encoding="utf8") as in_file:
data = in_file.read()
if not is_two_file:
_, data = self.split_metadata(data)
output = markdown(data, self.extensions)
output = self.site.apply_shortcodes(output, filename=source)
out_file.write(output)
def create_post(self, path, **kw):
"""Create a new post."""
content = kw.pop('content', None)
onefile = kw.pop('onefile', False)
# is_page is not used by create_post as of now.
kw.pop('is_page', False)
metadata = {}
metadata.update(self.default_metadata)
metadata.update(kw)
makedirs(os.path.dirname(path))
if not content.endswith('\n'):
content += '\n'
with io.open(path, "w+", encoding="utf8") as fd:
if onefile:
fd.write('<!-- \n')
fd.write(write_metadata(metadata))
fd.write('-->\n\n')
fd.write(content)
| x1101/nikola | nikola/plugins/compile/markdown/__init__.py | Python | mit | 3,680 |
package zfs
import (
"bytes"
"fmt"
"io"
"os/exec"
"regexp"
"strconv"
"strings"
"github.com/pborman/uuid"
)
type command struct {
Command string
Stdin io.Reader
Stdout io.Writer
}
func (c *command) Run(arg ...string) ([][]string, error) {
cmd := exec.Command(c.Command, arg...)
var stdout, stderr bytes.Buffer
if c.Stdout == nil {
cmd.Stdout = &stdout
} else {
cmd.Stdout = c.Stdout
}
if c.Stdin != nil {
cmd.Stdin = c.Stdin
}
cmd.Stderr = &stderr
id := uuid.New()
joinedArgs := strings.Join(cmd.Args, " ")
logger.Log([]string{"ID:" + id, "START", joinedArgs})
err := cmd.Run()
logger.Log([]string{"ID:" + id, "FINISH"})
if err != nil {
return nil, &Error{
Err: err,
Debug: strings.Join([]string{cmd.Path, joinedArgs}, " "),
Stderr: stderr.String(),
}
}
// assume if you passed in something for stdout, that you know what to do with it
if c.Stdout != nil {
return nil, nil
}
lines := strings.Split(stdout.String(), "\n")
//last line is always blank
lines = lines[0 : len(lines) - 1]
output := make([][]string, len(lines))
for i, l := range lines {
output[i] = strings.Fields(l)
}
return output, nil
}
func setString(field *string, value string) {
v := ""
if value != "-" {
v = value
}
*field = v
}
func setUint(field *uint64, value string) error {
var v uint64
if value != "-" {
var err error
v, err = strconv.ParseUint(value, 10, 64)
if err != nil {
return err
}
}
*field = v
return nil
}
func (ds *Dataset) parseLine(line []string) error {
prop := line[1]
val := line[2]
var err error
switch prop {
case "available":
err = setUint(&ds.Avail, val)
case "compression":
setString(&ds.Compression, val)
case "mountpoint":
setString(&ds.Mountpoint, val)
case "quota":
err = setUint(&ds.Quota, val)
case "type":
setString(&ds.Type, val)
case "origin":
setString(&ds.Origin, val)
case "used":
err = setUint(&ds.Used, val)
case "volsize":
err = setUint(&ds.Volsize, val)
case "written":
err = setUint(&ds.Written, val)
case "logicalused":
err = setUint(&ds.Logicalused, val)
}
return err
}
/*
* from zfs diff`s escape function:
*
* Prints a file name out a character at a time. If the character is
* not in the range of what we consider "printable" ASCII, display it
* as an escaped 3-digit octal value. ASCII values less than a space
* are all control characters and we declare the upper end as the
* DELete character. This also is the last 7-bit ASCII character.
* We choose to treat all 8-bit ASCII as not printable for this
* application.
*/
func unescapeFilepath(path string) (string, error) {
buf := make([]byte, 0, len(path))
llen := len(path)
for i := 0; i < llen; {
if path[i] == '\\' {
if llen < i + 4 {
return "", fmt.Errorf("Invalid octal code: too short")
}
octalCode := path[(i + 1):(i + 4)]
val, err := strconv.ParseUint(octalCode, 8, 8)
if err != nil {
return "", fmt.Errorf("Invalid octal code: %v", err)
}
buf = append(buf, byte(val))
i += 4
} else {
buf = append(buf, path[i])
i++
}
}
return string(buf), nil
}
var changeTypeMap = map[string]ChangeType{
"-": Removed,
"+": Created,
"M": Modified,
"R": Renamed,
}
var inodeTypeMap = map[string]InodeType{
"B": BlockDevice,
"C": CharacterDevice,
"/": Directory,
">": Door,
"|": NamedPipe,
"@": SymbolicLink,
"P": EventPort,
"=": Socket,
"F": File,
}
// matches (+1) or (-1)
var referenceCountRegex = regexp.MustCompile("\\(([+-]\\d+?)\\)")
func parseReferenceCount(field string) (int, error) {
matches := referenceCountRegex.FindStringSubmatch(field)
if matches == nil {
return 0, fmt.Errorf("Regexp does not match")
}
return strconv.Atoi(matches[1])
}
func parseInodeChange(line []string) (*InodeChange, error) {
llen := len(line)
if llen < 1 {
return nil, fmt.Errorf("Empty line passed")
}
changeType := changeTypeMap[line[0]]
if changeType == 0 {
return nil, fmt.Errorf("Unknown change type '%s'", line[0])
}
switch changeType {
case Renamed:
if llen != 4 {
return nil, fmt.Errorf("Mismatching number of fields: expect 4, got: %d", llen)
}
case Modified:
if llen != 4 && llen != 3 {
return nil, fmt.Errorf("Mismatching number of fields: expect 3..4, got: %d", llen)
}
default:
if llen != 3 {
return nil, fmt.Errorf("Mismatching number of fields: expect 3, got: %d", llen)
}
}
inodeType := inodeTypeMap[line[1]]
if inodeType == 0 {
return nil, fmt.Errorf("Unknown inode type '%s'", line[1])
}
path, err := unescapeFilepath(line[2])
if err != nil {
return nil, fmt.Errorf("Failed to parse filename: %v", err)
}
var newPath string
var referenceCount int
switch changeType {
case Renamed:
newPath, err = unescapeFilepath(line[3])
if err != nil {
return nil, fmt.Errorf("Failed to parse filename: %v", err)
}
case Modified:
if llen == 4 {
referenceCount, err = parseReferenceCount(line[3])
if err != nil {
return nil, fmt.Errorf("Failed to parse reference count: %v", err)
}
}
default:
newPath = ""
}
return &InodeChange{
Change: changeType,
Type: inodeType,
Path: path,
NewPath: newPath,
ReferenceCountChange: referenceCount,
}, nil
}
// example input
//M / /testpool/bar/
//+ F /testpool/bar/hello.txt
//M / /testpool/bar/hello.txt (+1)
//M / /testpool/bar/hello-hardlink
func parseInodeChanges(lines [][]string) ([]*InodeChange, error) {
changes := make([]*InodeChange, len(lines))
for i, line := range lines {
c, err := parseInodeChange(line)
if err != nil {
return nil, fmt.Errorf("Failed to parse line %d of zfs diff: %v, got: '%s'", i, err, line)
}
changes[i] = c
}
return changes, nil
}
func listByType(t, filter string) ([]*Dataset, error) {
args := []string{"get", "-rHp", "-t", t, "all"}
if filter != "" {
args = append(args, filter)
}
out, err := zfs(args...)
if err != nil {
return nil, err
}
var datasets []*Dataset
name := ""
var ds *Dataset
for _, line := range out {
if name != line[0] {
name = line[0]
ds = &Dataset{Name: name}
datasets = append(datasets, ds)
}
if err := ds.parseLine(line); err != nil {
return nil, err
}
}
return datasets, nil
}
func propsSlice(properties map[string]string) []string {
args := make([]string, 0, len(properties) * 3)
for k, v := range properties {
args = append(args, "-o")
args = append(args, fmt.Sprintf("%s=%s", k, v))
}
return args
}
func (z *Zpool) parseLine(line []string) error {
prop := line[1]
val := line[2]
var err error
switch prop {
case "health":
setString(&z.Health, val)
case "allocated":
err = setUint(&z.Allocated, val)
case "size":
err = setUint(&z.Size, val)
case "free":
err = setUint(&z.Free, val)
}
return err
}
| spacexnice/ctlplane | Godeps/_workspace/src/github.com/google/cadvisor/Godeps/_workspace/src/github.com/mistifyio/go-zfs/utils.go | GO | mit | 7,936 |
using System;
namespace ArkeCLR.Runtime.Tables.Flags {
[Flags]
public enum PropertyAttributes : ushort {
SpecialName = 0x0200,
RTSpecialName = 0x0400,
HasDefault = 0x1000,
Unused = 0xE9F
}
}
| Arke64/ArkeCLR | ArkeCLR.Runtime/Tables/Flags/PropertyAttributes.cs | C# | mit | 236 |
<?php include $_SERVER['DOCUMENT_ROOT'] . '/snippets/document/header/index.php'; ?>
<div class="layout-home">
<div class="home context-content">
<section class="home__layout">
<header class="home__header">
<div class="container">
<div class="list list_featured">
<div class="list__item">
<div class="card card_horizontal">
<a class="card__link" aria-label="Goto Project Helmholtz Zentrum" href="/templates/project-helmholz-zentrum.php">
<h2 class="card__title">Helmholtz Zentrum</h2>
<div class="card__info">
<ul class="list list_tags">
<li class="list__item">
<span class="tag tag_text">Development - Frontend</span>
</li>
</ul>
</div>
<div class="card__media">
<div class="image">
<img class="image__tag" src="../assets/images/media_card__wide--hzb.png" alt="Thumbnail of Project Helmholtz Zentrum">
</div>
</div>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Glow" href="/templates/project-glow.php">
<h2 class="card__title">Glow</h2>
<div class="card__info">
<ul class="list list_tags">
<li class="list__item">
<span class="tag tag_text">Development - Frontend</span>
</li>
</ul>
</div>
<div class="card__media">
<div class="image">
<img class="image__tag" src="../assets/images/media_card--glow.png" alt="Thumbnail of Project Glow">
</div>
</div>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Deutscher Filmpreis" href="/templates/project-deutscher-filmpreis.php">
<h2 class="card__title">Deutscher Filmpreis</h2>
<div class="card__info">
<ul class="list list_tags">
<li class="list__item">
<span class="tag tag_text">Development - Frontend</span>
</li>
</ul>
</div>
<div class="card__media">
<div class="image">
<img class="image__tag" src="../assets/images/media_card--dfp.png" alt="Thumbnail of Project Deutscher Filmpreis">
</div>
</div>
</a>
</div>
</div>
<div class="list__item">
<div class="card card_horizontal">
<a class="card__link" aria-label="Goto Project Davide Rizzo" href="/templates/project-davide-rizzo.php">
<h2 class="card__title">Davide Rizzo</h2>
<div class="card__info">
<ul class="list list_tags">
<li class="list__item">
<span class="tag tag_text">Development - Frontend</span>
</li>
</ul>
</div>
<div class="card__media">
<div class="image">
<img class="image__tag" src="../assets/images/media_card__wide--rizzo.png" alt="Thumbnail of Project Davide Rizzo">
</div>
</div>
</a>
</div>
</div>
</div>
</div>
</header>
<main class="home__main">
<div class="container">
<div class="list list_projects">
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Deutsche Filmakademie" href="/templates/project-deutsche-filmakademie.php">
<h3 class="card__title">Deutsche Filmakademie</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Audio Verlag" href="/templates/project-audio-verlag.php">
<h3 class="card__title">Audio Verlag</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Duerr" href="/templates/project-duerr.php">
<h3 class="card__title">Duerr</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Rohde und Schwarz" href="/templates/project-rohde-und-schwarz.php">
<h3 class="card__title">Rohde und Schwarz</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Mycs" href="/templates/project-mycs.php">
<h3 class="card__title">Mycs</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Artuner" href="/templates/project-artuner.php">
<h3 class="card__title">Artuner</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Unitb" href="/templates/project-unitb.php">
<h3 class="card__title">Unitb</h3>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Goto Project Universal Music" href="/templates/project-universal-music.php">
<h3 class="card__title">Universal Music</h3>
</a>
</div>
</div>
</div>
</div>
</main>
<footer class="home__footer">
<div class="container">
<div class="list list_social">
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Open Github Profile" href="https://github.com/mrnmrhcs" target="_blank" rel="noreferrer noopener">
<h4 class="card__title">Github</h4>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Open Raindrop.io Collection" href="https://raindrop.io/mrnmrhcs/view/17462336/theme=dark&sort=title&perpage=50" target="_blank" rel="noreferrer noopener">
<h4 class="card__title">Raindrop</h4>
</a>
</div>
</div>
<div class="list__item">
<div class="card">
<a class="card__link" aria-label="Open Soundcloud Profile" href="https://soundcloud.com/mrnmrhcs" target="_blank" rel="noreferrer noopener">
<h4 class="card__title">Soundcloud</h4>
</a>
</div>
</div>
</div>
</div>
</footer>
</section>
</div>
</div>
<?php include $_SERVER['DOCUMENT_ROOT'] . '/snippets/document/footer/index.php'; ?>
| Booozz/portfolio-m | app/templates/home.php | PHP | mit | 7,868 |
/**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highmaps]]
*/
package com.highmaps.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>series<pivotpoints>-events</code>
*/
@js.annotation.ScalaJSDefined
class SeriesPivotpointsEvents extends com.highcharts.HighchartsGenericObject {
/**
* <p>Fires after the series has finished its initial animation, or in
* case animation is disabled, immediately as the series is displayed.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-afteranimate/">Show label after animate</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-afteranimate/">Show label after animate</a>
* @since 4.0
*/
val afterAnimate: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the checkbox next to the series' name in the legend is
* clicked. One parameter, <code>event</code>, is passed to the function. The state
* of the checkbox is found by <code>event.checked</code>. The checked item is
* found by <code>event.item</code>. Return <code>false</code> to prevent the default action
* which is to toggle the select state of the series.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-checkboxclick/">Alert checkbox status</a>
* @since 1.2.0
*/
val checkboxClick: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the series is clicked. One parameter, <code>event</code>, is passed to
* the function, containing common event information. Additionally,
* <code>event.point</code> holds a pointer to the nearest point on the graph.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-click/">Alert click info</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/stock/plotoptions/series-events-click/">Alert click info</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/maps/plotoptions/series-events-click/">Display click info in subtitle</a>
* @since 6.0.0
*/
val click: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the series is hidden after chart generation time, either
* by clicking the legend item or by calling <code>.hide()</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-hide/">Alert when the series is hidden by clicking the legend item</a>
* @since 1.2.0
*/
val hide: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the legend item belonging to the series is clicked. One
* parameter, <code>event</code>, is passed to the function. The default action
* is to toggle the visibility of the series. This can be prevented
* by returning <code>false</code> or calling <code>event.preventDefault()</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-legenditemclick/">Confirm hiding and showing</a>
* @since 6.0.0
*/
val legendItemClick: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the mouse leaves the graph. One parameter, <code>event</code>, is
* passed to the function, containing common event information. If the
* <a href="#plotOptions.series">stickyTracking</a> option is true, <code>mouseOut</code>
* doesn't happen before the mouse enters another graph or leaves the
* plot area.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-mouseover-sticky/">With sticky tracking by default</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-mouseover-no-sticky/">Without sticky tracking</a>
* @since 6.0.0
*/
val mouseOut: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the mouse enters the graph. One parameter, <code>event</code>, is
* passed to the function, containing common event information.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-mouseover-sticky/">With sticky tracking by default</a>
<a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-mouseover-no-sticky/">Without sticky tracking</a>
* @since 6.0.0
*/
val mouseOver: js.UndefOr[js.Function] = js.undefined
/**
* <p>Fires when the series is shown after chart generation time, either
* by clicking the legend item or by calling <code>.show()</code>.</p>
* @example <a href="https://jsfiddle.net/gh/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-events-show/">Alert when the series is shown by clicking the legend item.</a>
* @since 1.2.0
*/
val show: js.UndefOr[js.Function] = js.undefined
}
object SeriesPivotpointsEvents {
/**
* @param afterAnimate <p>Fires after the series has finished its initial animation, or in. case animation is disabled, immediately as the series is displayed.</p>
* @param checkboxClick <p>Fires when the checkbox next to the series' name in the legend is. clicked. One parameter, <code>event</code>, is passed to the function. The state. of the checkbox is found by <code>event.checked</code>. The checked item is. found by <code>event.item</code>. Return <code>false</code> to prevent the default action. which is to toggle the select state of the series.</p>
* @param click <p>Fires when the series is clicked. One parameter, <code>event</code>, is passed to. the function, containing common event information. Additionally,. <code>event.point</code> holds a pointer to the nearest point on the graph.</p>
* @param hide <p>Fires when the series is hidden after chart generation time, either. by clicking the legend item or by calling <code>.hide()</code>.</p>
* @param legendItemClick <p>Fires when the legend item belonging to the series is clicked. One. parameter, <code>event</code>, is passed to the function. The default action. is to toggle the visibility of the series. This can be prevented. by returning <code>false</code> or calling <code>event.preventDefault()</code>.</p>
* @param mouseOut <p>Fires when the mouse leaves the graph. One parameter, <code>event</code>, is. passed to the function, containing common event information. If the. <a href="#plotOptions.series">stickyTracking</a> option is true, <code>mouseOut</code>. doesn't happen before the mouse enters another graph or leaves the. plot area.</p>
* @param mouseOver <p>Fires when the mouse enters the graph. One parameter, <code>event</code>, is. passed to the function, containing common event information.</p>
* @param show <p>Fires when the series is shown after chart generation time, either. by clicking the legend item or by calling <code>.show()</code>.</p>
*/
def apply(afterAnimate: js.UndefOr[js.Function] = js.undefined, checkboxClick: js.UndefOr[js.Function] = js.undefined, click: js.UndefOr[js.Function] = js.undefined, hide: js.UndefOr[js.Function] = js.undefined, legendItemClick: js.UndefOr[js.Function] = js.undefined, mouseOut: js.UndefOr[js.Function] = js.undefined, mouseOver: js.UndefOr[js.Function] = js.undefined, show: js.UndefOr[js.Function] = js.undefined): SeriesPivotpointsEvents = {
val afterAnimateOuter: js.UndefOr[js.Function] = afterAnimate
val checkboxClickOuter: js.UndefOr[js.Function] = checkboxClick
val clickOuter: js.UndefOr[js.Function] = click
val hideOuter: js.UndefOr[js.Function] = hide
val legendItemClickOuter: js.UndefOr[js.Function] = legendItemClick
val mouseOutOuter: js.UndefOr[js.Function] = mouseOut
val mouseOverOuter: js.UndefOr[js.Function] = mouseOver
val showOuter: js.UndefOr[js.Function] = show
com.highcharts.HighchartsGenericObject.toCleanObject(new SeriesPivotpointsEvents {
override val afterAnimate: js.UndefOr[js.Function] = afterAnimateOuter
override val checkboxClick: js.UndefOr[js.Function] = checkboxClickOuter
override val click: js.UndefOr[js.Function] = clickOuter
override val hide: js.UndefOr[js.Function] = hideOuter
override val legendItemClick: js.UndefOr[js.Function] = legendItemClickOuter
override val mouseOut: js.UndefOr[js.Function] = mouseOutOuter
override val mouseOver: js.UndefOr[js.Function] = mouseOverOuter
override val show: js.UndefOr[js.Function] = showOuter
})
}
}
| Karasiq/scalajs-highcharts | src/main/scala/com/highmaps/config/SeriesPivotpointsEvents.scala | Scala | mit | 9,112 |
<?php
declare(strict_types=1);
namespace greboid\stock;
use \Exception;
use \greboid\stock\Stock;
use \Silex\Application;
class LocationRoutes {
public function addRoutes(Application $app): void {
$app->get('/location/', function(Application $app) {
return $app['twig']->render('locations.tpl', array());
});
$app->get('/location/manage', function(Application $app) {
try {
return $app['twig']->render('managelocations.tpl', array(
'locationsstockcount' => $app['stock']->getLocationStockCounts(),
));
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
$app->get('/location/{locationName}', function(Application $app, $locationName) {
$locationName = filter_var($locationName, FILTER_UNSAFE_RAW);
$locationid = $app['stock']->getLocationID($locationName);
if ($locationid === false) {
return $app->abort(404, 'Location '.$locationid.' not found.');
}
try {
if ($app['stock']->getLocationName($locationid) !== false) {
return $app['twig']->render('stock.tpl', array(
'locationid' => $locationid,
'site' => $app['stock']->getLocationName($locationid),
'stock' => $app['stock']->getLocationStock($locationid),
));
} else {
return $app->abort(404, 'Location '.$locationid.' not found.');
}
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
$app->get('/location/add', function(Application $app) {
if (count($app['stock']->getLocations()) == 0) {
return $app->redirect('/site/add');
}
try {
return $app['twig']->render('addlocation.tpl', array());
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
$app->post('/location/add', function(Application $app) {
try {
$name = filter_input(INPUT_POST, "name", FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE);
$site = filter_input(INPUT_POST, "site", FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
if ($name !== false && $site !== false) {
$app['stock']->insertLocation($name, $site);
} else {
return $app->abort(500, 'Missing required value.');
}
return $app->redirect('/location/manage');
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
$app->post('/location/edit', function(Application $app) {
try {
$locationID = filter_input(INPUT_POST, "editID", FILTER_VALIDATE_INT);
$locationName = filter_input(INPUT_POST, "editName", FILTER_UNSAFE_RAW, FILTER_NULL_ON_FAILURE);
$siteID = filter_input(INPUT_POST, "editSite", FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
if ($locationName !== false) {
$app['stock']->editLocation($locationID, $locationName, $siteID);
} else {
return $app->abort(500, 'Missing required value.');
}
return $app->redirect('/location/manage');
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
$app->post('/location/delete/{locationid}', function(Application $app, $locationid) {
$locationid = filter_var($locationid, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
try {
$app['stock']->deleteLocation($locationid);
return $app->redirect('/location/manage');
} catch (Exception $e) {
return $app->abort(500, $e->getMessage());
}
});
}
}
| greboid/stock | src/LocationRoutes.php | PHP | mit | 4,497 |