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
html { position: relative; min-height: 100%; padding: 0; margin: 0; } /*Normalize html and body elements,this style is just good to have*/ body { width: 100%; margin: 0 0 100px; min-height: 100%; } .container { /*height of footer below line*/ margin-bottom: 50px; width: 1400px; min-height: 100%; height: 100%; } .footer { position: absolute; bottom: 0; left: 0; height: 50px; width: 100%; background: #f2f2f2; min-height: 50px; min-width: 1450px; z-index: 2; text-align: center; padding-top: 15px; } /* apparently there is a bug at Rstudio or Bootstrap3 which causes 'row class div' to have margin and padding which creates a horizontal scrollbar https://github.com/twbs/bootstrap/issues/10711 */ .row { margin: 0; padding: 0 } .icon { position: relative; top: 20px; width: 100%; height: 330px; border-radius: 50%; font-size: 30px; text-align: center; vertical-align: middle; padding-top: 25%; line-height: 370px; color: #fff; background: #f7a35c; } #parent { width: 1000px; } .image { float: left; width: 270px; } .custom_slider { margin-left: 35px; float: left; width: 140px; } /* In case I want to format tables differently table tr:nth-child(odd){ background-color: #e6faff; } table, th, td{ border: 1px solid white; border-collapse: collapse; } table tr:nth-child(1){ background-color: #ffffff; } table tr:nth-child(2){ background-color: #ffffff; border-bottom: 2px solid black; } */ /* table tr:nth-child(n+3):hover { background-color: #7cb5ec; } table { border-spacing: 0; border-collapse: collapse; overflow: hidden; z-index: 1; } td, th { cursor: pointer; padding: 10px; position: relative; } td:hover::after { background-color: #7cb5ec; content: '\00a0'; height: 10000px; left: 0; position: absolute; top: -5000px; width: 100%; z-index: -1; } */ .table_team_stats { position: relative; } .navbar { height: 30px; padding-left: 40px; min-width: 1450px; } .bg { position: relative; overflow: hidden; } .first_line { padding-top: 150px; position: relative; text-align: center; z-index: 2; font-family: serif; font-size: 90px; } .second_line { position: relative; text-align: center; z-index: 2; font-family: serif; font-size: 35px; } .divider { display: block; margin: 0 auto; z-index: 2; } .background { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: -1; background: no-repeat center center; background-size: 100% auto; } .flags { display: inline-block; margin-left: auto; margin-right: auto; height: 30px; z-index: 2; } #row_images { text-align: center; } .third_line { position: relative; text-align: center; z-index: 2; font-family: serif; font-size: 20px; } #front_button { position: relative; z-index: 2; left: 50%; margin-left: -30px; margin-top: 10px; background: #fff; background: rgba(255, 255, 255, 0.2); font-family: serif; border: 0.5px ridge grey; } #front_button:hover { box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); } #github_icon { color: black; } #github_icon:hover { color:#999999 ; } .fa-heart { color: red; } #ribbon-about { width: 100%; } .nav-pills[data-value="Author"]{ border: 0.5px solid #f2f2f2; z-index: 100; } .nav-pills[data-value="Data/Charts"]{ border: 0.5px solid #f2f2f2; z-index: 100; } .nav-pills[data-value="Contact"]{ border: 0.5px solid #f2f2f2; z-index: 100; } #about { font-size: 20px; }
LyzandeR/FootballeR
app/www/football.css
CSS
mit
3,576
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="GENERATOR" content="VSdocman - documentation generator; https://www.helixoft.com" /> <link rel="icon" href="favicon.ico"> <title>TemplatesResponseDto.Templates Property</title> <link rel="stylesheet" type="text/css" href="msdn2019/toc.css" /> <script src="msdn2019/toc.js"></script> <link rel="stylesheet" type="text/css" href="msdn2019/msdn2019.css"></link> <script src="msdn2019/msdn2019.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shCore_helixoft.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushVb.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushCSharp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushFSharp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushCpp.js" type="text/javascript"></script> <script src="SyntaxHighlighter/scripts/shBrushJScript.js" type="text/javascript"></script> <link href="SyntaxHighlighter/styles/shCore.css" rel="stylesheet" type="text/css" /> <link href="SyntaxHighlighter/styles/shThemeMsdnLW.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> SyntaxHighlighter.all(); </script> <link rel="stylesheet" type="text/css" href="vsdocman_overrides.css"></link> </head> <body style="direction: ltr;"> <div id="topic"> <!--HEADER START--> <div id="header"> <div id="header-top-container"> <div id="header-top-parent-container1"> <div id="header-top-container1"> <div id="runningHeaderText1"><a id="headerLogo" href="#" onclick="window.location.href = getCssCustomProperty('--headerLogoLink'); return false;">logo</a></div> <div id="runningHeaderText1b"><script> document.write(getCssCustomProperty('--headerTopCustomLineHtml')); </script></div> </div> </div> <div id="header-top-container2"> <div id="runningHeaderText">SOLUTION-WIDE PROPERTIES Reference</div> <div id="search-bar-container"> <form id="search-bar" action="search--.html"> <input id="HeaderSearchInput" type="search" name="search" placeholder="Search" > <button id="btn-search" class="c-glyph" title="Search"> <span>Search</span> </button> </form> <button id="cancel-search" class="cancel-search" title="Cancel"> <span>Cancel</span> </button> </div> </div> </div> <hr /> <div id="header-breadcrumbs"></div> <div id="headerLinks"> </div> <hr /> </div> <!--HEADER END--> <div id="mainSection"> <div id="toc-area"> <div id="toc-container" class="stickthis full-height"> <div id="-1"></div> <div id="c-1"> <div id="ci-1" class="inner-for-height"></div> </div> </div> </div> <div id="mainBody"> <h1 class="title">TemplatesResponseDto.Templates Property</h1> <div class="metadata"> Namespace: <a href="topic_00000000000009C0.html">Tlece.Recruitment.Models.Templates</a> <br />Assembly: Tlece.Recruitment (in Tlece.Recruitment.dll) </div> <div class="section_container"> <div id="syntaxSection" class="section"> <div id="syntaxCodeBlocks"> <div class="codeSnippetContainer"> <div class="codeSnippetTabs"> <div class="codeSnippetTabLeftCornerActive"> </div> <div class="codeSnippetTab csFirstTab csActiveTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a> </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a> </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a> </div> <div class="codeSnippetTabRightCorner"> </div> <div style="clear:both;"> </div> </div> <div class="codeSnippetCodeCollection"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeVB"> <pre xml:space="preserve" class="brush: vb">Public Property Templates() As <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>(Of <a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>)</pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="codeSnippetContainer"> <div class="codeSnippetTabs"> <div class="codeSnippetTabLeftCorner"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csActiveTab codeCsharp"> <a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a> </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a> </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a> </div> <div class="codeSnippetTabRightCorner"> </div> <div style="clear:both;"> </div> </div> <div class="codeSnippetCodeCollection"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeCsharp"> <pre xml:space="preserve" class="brush: csharp">public <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>&gt; Templates {get; set;}</pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="codeSnippetContainer"> <div class="codeSnippetTabs"> <div class="codeSnippetTabLeftCorner"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a> </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a> </div> <div class="codeSnippetTab csActiveTab codeCpp"> <a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a> </div> <div class="codeSnippetTab csLastTab csNaTab codeJScript"> <a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a> </div> <div class="codeSnippetTabRightCorner"> </div> <div style="clear:both;"> </div> </div> <div class="codeSnippetCodeCollection"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeCpp"> <pre xml:space="preserve" class="brush: cpp">public: &nbsp;<br />property <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>^&gt;^ Templates {&nbsp;<br /> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>^&gt;^ get( );&nbsp;<br /> void set(&nbsp;<br /> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>^&gt;^ value&nbsp;<br /> );&nbsp;<br />}</pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> <div class="codeSnippetContainer"> <div class="codeSnippetTabs"> <div class="codeSnippetTabLeftCorner"> </div> <div class="codeSnippetTab csFirstTab csNaTab codeVB"> <a>VB</a> </div> <div class="codeSnippetTab csNaTab codeCsharp"> <a href="javascript: CodeSnippet_SetLanguage('Csharp');">C#</a> </div> <div class="codeSnippetTab csNaTab codeFsharp"> <a href="javascript: CodeSnippet_SetLanguage('Fsharp');">F#</a> </div> <div class="codeSnippetTab csNaTab codeCpp"> <a href="javascript: CodeSnippet_SetLanguage('Cpp');">C++</a> </div> <div class="codeSnippetTab csActiveTab csLastTab codeJScript"> <a href="javascript: CodeSnippet_SetLanguage('JScript');">JScript</a> </div> <div class="codeSnippetTabRightCornerActive"> </div> <div style="clear:both;"> </div> </div> <div class="codeSnippetCodeCollection"> <div class="codeSnippetToolbar"> <a title="Copy to clipboard." href="javascript:void(0)" onclick="CopyCode(this);">Copy</a> </div> <div class="codeSnippetCode codeJScript"> <pre xml:space="preserve" class="brush: js">JScript does not support generic types and methods.</pre> </div> <div class="codeSnippetCode codeNA"> <pre xml:space="preserve">This language is not supported or no code example is available.</pre> </div> </div> </div> </div> <h4 class="subHeading"> Property Value</h4> <a target="_top" href="https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a target="_top" href="topic_00000000000009C1.html" onclick="this.target='';return true;">TemplateModel</a>&gt; </div> </div> <div class="section_container"> <div class="section_heading"> <span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">Applies to</a></span> <div>&nbsp;</div> </div> <div id="frameworksSection" class="section"> <h4 class="subHeading">.NET Framework</h4>Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1<br /> </div> </div> <div class="section_container"> <div class="section_heading"> <span><a href="javascript:void(0)" title="Collapse" onclick="toggleSection(this);">See Also</a></span> <div>&nbsp;</div> </div> <div id="seeAlsoSection" class="section"> <div> <a href="topic_00000000000009C9.html">TemplatesResponseDto Class</a><br /> <a href="topic_00000000000009C0.html">Tlece.Recruitment.Models.Templates Namespace</a><br /> </div> </div> </div> </div> <div id="internal-toc-area"> <div id="internal-toc-container" class="stickthis"> <h3 id="internal-toc-heading">In this article</h3> <span id="internal-toc-definition-localized-text">Definition</span> </div> </div> </div> <div id="footer"> <div id="footer-container"> <p><span style="color: #FF0000;">Generated with unregistered version of <a target="_top" href="http://www.helixoft.com/vsdocman/overview.html">VSdocman</a></span>&nbsp;<br />Your own footer text will only be shown in registered version.</p> </div> </div> </div> </body> </html>
asiboro/asiboro.github.io
vsdoc/topic_00000000000009CA.html
HTML
mit
12,395
import com.cubethree.GPIOLib.*; public class Turn { public static void main( String[] args ){ try{ Servo s = GPIOLib.allocateServo( 4 ); s.setAngle( -90 ); Thread.sleep( 1000 ); for( double a = -90; a < 90; a += 5 ){ s.setAngle( a ); Thread.sleep(100); } }catch(Exception e){ e.printStackTrace( System.err ); }finally{ GPIOLib.cleanup(); } } }
FelixMaxwell/GPIOLib
test/Turn.java
Java
mit
374
# MyTextPad My Text Pad
anno2070/MyTextPad
README.md
Markdown
mit
24
import { infinitives as haberInfinitive, builder as haberBuilder } from "../verbos/haber"; import { infinitives as poderInfinitive, builder as poderBuilder } from "../verbos/poder"; import { infinitives as quererInfinitive, builder as quererBuilder } from "../verbos/querer"; import { infinitives as tenerInfinitive, builder as tenerBuilder } from "../verbos/tener"; import sentences from "../sentences/index"; import { storage } from "./storage"; import { shuffle, endsWith, startsWith } from "./fun"; function build(infinitives: Array<{ es: string; en: string }>, builder: Array<{ es: string; en: string }>) { let qa: Array<{ q: string; a: string }> = []; infinitives.forEach(verb => { builder.forEach(b => qa.push({ a: b.es.replace("{verb}", verb.es), q: b.en.replace("{verb}", verb.en) }) ); }); return qa; } let haberQa = build(haberInfinitive, haberBuilder); let poderQa = build(poderInfinitive, poderBuilder); let quererQa = build(quererInfinitive, quererBuilder); let tenerQa = build(tenerInfinitive, tenerBuilder); type WordMapHash = { [key: string]: string }; type WordMap = { en: string; es: string }; const verbs = { llamar: "call", confiar: "trust", esperar: "wait", amar: "love", quedar: "stay", comer: "eat", visitar: "visit", escuchar: "hear", caminar: "walk", limpiar: "clean", pagar: "pay", permanecer: "stay", llevar: "wear", entrar: "enter", "nadar {adjective}": "swim {adjective}", "correr {adjective}": "run {adjective}" }; const places = { "a casa": "home" }; const colors = { anaranjado: "orange", azul: "blue", rojo: "red", verde: "green", negro: "black", marrón: "brown", rosado: "pink", amarillo: "yellow" }; const nouns = { "una casa": "a house", "esa casa": "that house", "otra casa": "another house", "una bicicleta": "a bike", "una caminata": "a hike", "un libro": "a book", "una persona": "a person" }; const adjectives = { rápido: "fast", "más rápido": "faster", "lo más rápido": "fastest" }; const numbers = { dos: "two", tres: "three", quatro: "four", cinco: "five", seis: "six", siete: "seven", ocho: "eight", nuevo: "nine", diez: "ten", once: "eleven", doce: "twelve" }; /* If the singular definite article is "el" the plural is "los." The plural of either "tú" or "usted" in Latin America is "ustedes" and will take the same verb endings as "él/la and ellos/ellas respectively. The plural (ellos/ellas) ending of verbs is "an" for "ar" verbs and "en" for "er/ir verbs. If a noun ends in a vowel, simply add -s. If a noun ends in a consonant, simply add -es. If a noun ends in a -z, change the z to c before adding -es. If a noun ends in ión, drop the written accent before adding -es. If the plural refers to a mixed group, use the masculine. */ function pluralizeNoun(noun: WordMap) { let num = randomNumber(); let es = noun.es; let en = noun.en; if (endsWith(es, "a")) es += "s"; else if (endsWith(es, "e")) es += "s"; else if (endsWith(es, "i")) es += "s"; else if (endsWith(es, "o")) es += "s"; else if (endsWith(es, "u")) es += "s"; else if (endsWith(es, "z")) es = es.substring(0, es.length - 1) + "ces"; else es += "es"; if (startsWith(es, "el ")) { es = "los" + es.substring(2); en += " (plural)"; } else if (startsWith(es, "tú ")) { es = "ustedes" + es.substring(2); en += " (plural)"; } else if (startsWith(es, "esa ")) { es = "esas" + es.substring(3); en += " (plural)"; } else if (startsWith(es, "usted ")) { es = "ustedes" + es.substring(5); en += " (plural)"; } else if (startsWith(es, "un ")) { es = num.es + es.substring(2); en = `${noun.en} (${num.en} of them)`; } else if (startsWith(es, "una ")) { es = num.es + es.substring(3); en = `${noun.en} (${num.en} of them)`; } else { en += " (plural)"; } return { es: es, en: en }; } function randomItem(list: WordMapHash) { let keys = Object.keys(list); let index = Math.round(Math.random() * (keys.length - 1)); let es = keys[index]; return { es: es, en: list[es] || es }; } function randomVerb() { return randomItem(verbs); } function randomPlace() { return randomItem(places); } function randomNoun() { return randomItem(nouns); } function randomNumber() { return randomItem(numbers); } function randomColor() { return randomItem(colors); } function randomAdjective() { return randomItem(adjectives); } const QA = [ { a: "voy", q: "I go" }, { a: "voy a", q: "I will" }, { a: "yo necesito", q: "I need" }, { a: "tú necesitas", q: "you need" }, { a: "me gusta", q: "I like" }, { a: "nosotros necesitamos", q: "we need" }, { a: "necesito {verb}", q: "I need to {verb}" }, { a: "necesito {noun}", q: "I need {noun}" }, { a: "necesito {verb} por favor", q: "I need to {verb} please" }, { a: "necesito {noun} por favor", q: "I need {noun} please" }, { a: "necesitas {verb}", q: "you need to {verb}" }, { a: "necesitas {noun}", q: "you need {noun}" }, { a: "necesitamos {noun}", q: "we need {noun}" }, { a: "necesitamos {verb}", q: "we need to {verb}" }, { a: "me gusta {verb}", q: "I like to {verb}" }, { a: "me gusta {noun}", q: "I like {noun}" }, { a: "te gusta {verb}", q: "you like to {verb}" }, { a: "te gusta {noun}", q: "you like {noun}" }, { a: "me gustaría {verb}", q: "I would like to {verb}" }, { a: "me gustaría {noun}", q: "I would like {noun}" }, { a: "me gustaría {verb} y {noun} {verb}", q: "I would like to {verb} and {noun} to {verb}" }, { a: "me encanta {noun}", q: "I love {noun}" }, { a: "me encantaría {noun}", q: "I would love {noun}" }, { a: "voy a {verb}", q: "I will {verb}" }, { a: "quiero {verb}", q: "I want to {verb}" }, { a: "quiero {noun}", q: "I want {noun}" }, { a: "quiero {noun} o {noun}", q: "I want {noun} or {noun}" }, { a: "me llamo es", q: "my name is" }, { a: "me voy {place}", q: "I am going {place}" }, { a: "I want to stay", q: "Quiero quedarme" }, { a: "nosotros queremos {verb} en otro {noun} {color}", q: "we want to {verb} at {noun} that is {color}" }, { a: "ellos quieren {verb} {noun} {adjective}", q: "they want to {verb} {noun} {adjective}" }, { a: "es dos mas pequeño que cinco?", q: "is two smaller than five?" }, { a: "es {number} mas pequeño que {number}?", q: "is {number} smaller than {number}?" }, { a: "es {number} mas mayor que {number}?", q: "is {number} larger than {number}?" }, { a: "Tengas una buena mañana", q: "have a good morning" }, { a: "¡Que tengas una buena semana!", q: "you have a good week!" } ]; // dropping QA temporarily let qa = sentences.map(v => ({ a: v.es, q: v.en })).concat(haberQa, poderQa, quererQa, tenerQa); let questions = qa.map(item => { let q = item.q; let a = item.a; while (true) { let verb = randomVerb(); let noun = randomNoun(); let place = randomPlace(); let num = randomNumber(); let pluralNoun = pluralizeNoun(randomNoun()); let adjective = randomAdjective(); let color = randomColor(); let q2 = q .replace("{verb}", verb.en) .replace("{plural-noun}", pluralNoun.en) .replace("{noun}", noun.en) .replace("{place}", place.en) .replace("{color}", color.en) .replace("{adjective}", adjective.en) .replace("{number}", num.en); let a2 = a .replace("{verb}", verb.es) .replace("{plural-noun}", pluralNoun.es) .replace("{noun}", noun.es) .replace("{place}", place.es) .replace("{color}", color.es) .replace("{adjective}", adjective.es) .replace("{number}", num.es); if (q2 == q) break; q = q2; a = a2; } return { q: q, a: a }; }); function remove(v: string, chars: string) { let result = v; chars.split("").forEach(c => (result = result.replace(new RegExp(`\\${c}`, "g"), ""))); result = result.replace(/ /g, " "); return result; } function spacesIn(v: string) { let result = 0; for (let i = 0; i < v.length; i++) if (v.charAt(i) === " ") result++; return result; } let scores = questions //.sort((a, b) => (a.a < b.a ? -1 : 0)) //.sort((a, b) => spacesIn(a.a) - spacesIn(b.a)) .map(v => { let [q, a] = [remove(v.q, "!."), remove(v.a, "!.¿¡")]; let hint = v.q; // english let score = storage.getScore({ question: q }); return { q, a, score, hint: hint }; }); scores = scores.sort((a, b) => b.score - a.score); // exclude items that exceed the worst score by 100 points let minScore = scores[scores.length - 1].score; scores = scores.filter(s => s.score < minScore + 100); // skip the top scorer, take the next 10 best, scramble and return 5 scores = scores.slice(1, 11); scores = shuffle(scores); export = scores.slice(0, 5);
corey-alix/schole-bus
espanola/quizlet/qa.ts
TypeScript
mit
8,531
#include <bits/stdc++.h> #define N 10100 using namespace std; vector<int> g[N]; int r[N]; int l[N]; bool vis[N]; int n,m,e,a,b; bool dfs(int v) { if(vis[v]) return false; vis[v]=true; for(int u=0;u<g[v].size();++u) { if(!r[g[v][u]]) { l[v]=g[v][u]; r[g[v][u]]=v; return true; } } for(int u=0;u<g[v].size();++u) { if(dfs(r[g[v][u]])) { l[v]=g[v][u]; r[g[v][u]]=v; return true; } } return false; } int main() { freopen("cuplaj.in","r",stdin); freopen("cuplaj.out","w",stdout); scanf("%d%d%d",&n,&m,&e); for(int i=0;i<e;++i) { scanf("%d%d",&a,&b); g[a].push_back(b); } for(int i=1;i<=n;++i) l[i]=0; for(int i=1;i<=m;++i) r[i]=0; bool change=true; while(change) { change=false; fill(vis,vis+n+1,false); for(int i=1;i<=n;++i) if(!l[i]) change |=dfs(i); } int cnt=0; for(int i=1;i<=n;++i) if(l[i]) cnt++; printf("%d\n",cnt); for(int i=1;i<=n;++i) { if(l[i]) printf("%d %d\n",i,l[i]); } return 0; }
rstancioiu/uva-online-judge
infoarena/cuplaj/cuplaj.cpp
C++
mit
984
/* * Vermilion Gruntfile * http://vermilion.com */ 'use strict'; /** * Grunt Module */ module.exports = function(grunt) { // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), sass: { options: { sourceMap: true }, dist: { files: { '_/css/main.css': '_/scss/main.scss' } } }, uglify: { options: { mangle: { except: ['$', 'jQuery'] }, semicolons: true }, my_target: { files: { '_/js/app.js': ['_/js/main.js'] } } }, jshint: { files: ['_/js/*.js', '!_/js/app.js'], options: { globals: { jquery: true, }, browser: true, devel: true, jquery: true, elision: true, laxbreak: true, laxcomma: true, notypeof: true, bitwise: true, eqeqeq: true, freeze: true, newcap: true, noarg: false, noempty: true, nonbsp: true, nonew: true, regexp: true, undef: true, unused: true, predef: [ 'Modernizr' ] } }, watch: { gruntfile: { files: ['gruntfile.js'] }, templates: { files: ['*.html', '*.php'], options: { spawn: false, livereload: true } }, jshints: { files: ['<%= jshint.files %>'], tasks: ['jshint'] }, styles: { files: ['_/scss/*.scss'], tasks: ['sass'] } } }); // load plugins here grunt.loadNpmTasks('grunt-sass'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-watch'); // Default task(s). grunt.registerTask('default', ['sass:dist']); grunt.registerTask('dev', ['watch']); };
vermiliondesign/taco_boilerplate_2015_no_symlinks
html/app/wp-content/themes/app/gruntfile.js
JavaScript
mit
1,776
require 'slim' require_relative './helpers/fake_context' module Jekyll module Tags class SlimExampleBlock < Liquid::Block include Liquid::StandardFilters SLIM_RENDER_OPTIONS = { pretty: true, disable_escape: true, disable_capture: false, use_html_safe: false } def render(context) code = super.to_s.strip compiled_slim = render_example(code) highlighted_slim = render_rouge(code, "slim") highlighted_html = render_rouge(compiled_slim, "html") add_code_tag(highlighted_slim, "slim") + example(compiled_slim) + add_code_tag(highlighted_html, "html") end private def example(output) "<div class=\"bd-example\" data-example-id=\"#{options[:id]}\">\n#{output}\n</div>" end def add_code_tag(code, lang) # Add nested <code> tags to code blocks code = code.sub(/<pre>\n*/,'<pre><code class="language-' + lang.to_s.gsub("+", "-") + '" data-lang="' + lang + '">') code = code.sub(/\n*<\/pre>/,"</code></pre>") code.strip end def render_example(code) ::Slim::Template.new(SLIM_RENDER_OPTIONS) { code }.render(FakeContext.new) end def render_rouge(code, lang) require 'rouge' formatter = Rouge::Formatters::HTML.new(line_numbers: options[:linenos], wrap: false) lexer = Rouge::Lexer.find_fancy(lang, code) || Rouge::Lexers::PlainText code = formatter.format(lexer.lex(code)) "<div class=\"highlight\"><pre>#{code}</pre></div>" end end end end Liquid::Template.register_tag('slimexample', Jekyll::Tags::SlimExampleBlock)
decisely/umka
docs/_plugins/slim_example.rb
Ruby
mit
1,684
<?php /** * The loop template file. * * Included on pages like index.php, archive.php and search.php to display a loop of posts * Learn more: http://codex.wordpress.org/The_Loop * * @package neckbeard */ do_action( 'neckbeard_loop_before' ); while ( have_posts() ) : the_post(); /* Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); endwhile; /** * @hooked neckbeard_paging_nav - 10 */ do_action( 'neckbeard_loop_after' );
digitoimistodude/neckbeard
loop.php
PHP
mit
667
class LoginUserFinder def initialize(user_id) @user_id = user_id end def find if in_development? && mock_enabled? @current_user = mock_user else User.find_by_id(@user_id) end end private def mock_user @found ||= User.find_by_id(-1) if @found @found.staff = mock_is_staff? return @found end u = User.new u.id = -1 u.username = 'developer' u.provider = 'twitter' u.avatar_url = 'https://abs.twimg.com/sticky/default_profile_images/default_profile_0_reasonably_small.png' u.staff = mock_is_staff? u.save u end def in_development? Rails.env.development? end def mock_enabled? ENV.key?("MOCK_USER") end def mock_is_staff? ENV['MOCK_USER'] == 'staff' end end
marcinbunsch/beat-the-riddler
app/services/login_user_finder.rb
Ruby
mit
783
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>18 --> 19</title> <link href="./../../assets/style.css" rel="stylesheet"> </head> <body> <h2>You have to be fast</h2> <a href="./9c0ed741c8d9afba89903b0435a15a19c8d70e36d4d2119d822f72d8ade74196.html">Teleport</a> <hr> <a href="./../../about.md">About</a> (Spoilers! ) <script src="./../../assets/md5.js"></script> <script> window.currentLevel = 7; </script> <script src="./../../assets/script.js"></script> </body> </html>
simonmysun/praxis
TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/c31e8b731c40068c360e623e1846e78f6d8ac29a848773e6802796f11b1c4a2c.html
HTML
mit
550
import getGame from '../game'; export const REALLY_BIG_NUMBER = 999999999999999; const numbers = ['ZERO', 'ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE']; export function num(number) { return numbers[number]; } export const clamp = (number, min, max) => Math.min(Math.max(number, min), max); export function tryChance(chance) { const randomNumber = getGame().rnd.integerInRange(0, 100); return randomNumber <= chance; } export function wrap(value, length) { if (value < 0) return length - 1; if (value >= length) return 0; return value; }
ThomasMays/incremental-forest
src/utils/numbers.js
JavaScript
mit
581
using BTCPayServer.Data; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; namespace BTCPayServer.Migrations { [DbContext(typeof(ApplicationDbContext))] [Migration("20171105235734_PaymentAccounted")] public partial class PaymentAccounted : Migration { protected override void Up(MigrationBuilder migrationBuilder) { int? maxLength = this.IsMySql(migrationBuilder.ActiveProvider) ? (int?)255 : null; migrationBuilder.AddColumn<bool>( name: "Accounted", table: "Payments", nullable: false, defaultValue: false); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "Accounted", table: "Payments"); } } }
btcpayserver/btcpayserver
BTCPayServer.Data/Migrations/20171105235734_PaymentAccounted.cs
C#
mit
904
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace BTCPayServer.Events { public interface IHasInvoiceId { string InvoiceId { get; } } }
btcpayserver/btcpayserver
BTCPayServer/Events/IHasInvoiceId.cs
C#
mit
213
using Augustus.CRM.Attributes; using Microsoft.Xrm.Sdk; using System; using System.Collections.Generic; using System.Reflection; namespace Augustus.CRM { public static class AttributeHelper { private static Dictionary<string, object> AttributeCache = new Dictionary<string, object>(); public static string GetLogicalName(BaseEntity entity, string caller) { return GetAttribute< AttributeLogicalNameAttribute, string>(entity, caller, a => a.LogicalName); } public static int[] GetStatusLookup(BaseEntity entity, string caller) { return GetAttribute<StatusLookupAttribute, int[]>(entity, caller, a => a.StatusLookup); } public static string GetEntityReferenceLogicalName(BaseEntity entity, string caller) { return GetAttribute<EntityReferenceAttribute, string>(entity, caller, a => a.LogicalName); } private static U GetAttribute<T, U>(BaseEntity entity, string caller, Func<T, U> result) where T : Attribute { var type = entity.GetType(); var key = string.Format("{0} {1} {2}", type.Name, caller, typeof(T).Name); lock (AttributeCache) { if (AttributeCache.ContainsKey(key)) { return (U)AttributeCache[key]; } else { var prop = type.GetProperty(caller); var attr = prop.GetCustomAttribute<T>(); var obj = (U)result(attr); AttributeCache.Add(key, obj); return obj; } } } } }
gothandy/Augustus
Augustus.CRM/AttributeHelper.cs
C#
mit
1,712
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_29) on Sun Dec 11 02:00:47 EET 2011 --> <TITLE> DefaultScheduler </TITLE> <META NAME="date" CONTENT="2011-12-11"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DefaultScheduler"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DefaultScheduler.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultMoveMode.html" title="class in edu.cmu.cs.stage3.alice.authoringtool.util"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultUndoableRedoable.html" title="class in edu.cmu.cs.stage3.alice.authoringtool.util"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DefaultScheduler.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> edu.cmu.cs.stage3.alice.authoringtool.util</FONT> <BR> Class DefaultScheduler</H2> <PRE> java.lang.Object <IMG SRC="../../../../../../../resources/inherit.gif" ALT="extended by "><B>edu.cmu.cs.stage3.alice.authoringtool.util.DefaultScheduler</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD>java.lang.Runnable</DD> </DL> <HR> <DL> <DT><PRE>public class <B>DefaultScheduler</B><DT>extends java.lang.Object<DT>implements java.lang.Runnable</DL> </PRE> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#DefaultScheduler()">DefaultScheduler</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#addDoOnceRunnable(java.lang.Runnable)">addDoOnceRunnable</A></B>(java.lang.Runnable&nbsp;doOnceRunnable)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#addEachFrameRunnable(java.lang.Runnable)">addEachFrameRunnable</A></B>(java.lang.Runnable&nbsp;eachFrameRunnable)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.Runnable[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#getEachFrameRunnables()">getEachFrameRunnables</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;double</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#getSimulationFPS()">getSimulationFPS</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#removeEachFrameRunnable(java.lang.Runnable)">removeEachFrameRunnable</A></B>(java.lang.Runnable&nbsp;eachFrameRunnable)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html#run()">run</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="DefaultScheduler()"><!-- --></A><H3> DefaultScheduler</H3> <PRE> public <B>DefaultScheduler</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="addDoOnceRunnable(java.lang.Runnable)"><!-- --></A><H3> addDoOnceRunnable</H3> <PRE> public boolean <B>addDoOnceRunnable</B>(java.lang.Runnable&nbsp;doOnceRunnable)</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="addEachFrameRunnable(java.lang.Runnable)"><!-- --></A><H3> addEachFrameRunnable</H3> <PRE> public boolean <B>addEachFrameRunnable</B>(java.lang.Runnable&nbsp;eachFrameRunnable)</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="removeEachFrameRunnable(java.lang.Runnable)"><!-- --></A><H3> removeEachFrameRunnable</H3> <PRE> public boolean <B>removeEachFrameRunnable</B>(java.lang.Runnable&nbsp;eachFrameRunnable)</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getEachFrameRunnables()"><!-- --></A><H3> getEachFrameRunnables</H3> <PRE> public java.lang.Runnable[] <B>getEachFrameRunnables</B>()</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="run()"><!-- --></A><H3> run</H3> <PRE> public void <B>run</B>()</PRE> <DL> <DD><DL> <DT><B>Specified by:</B><DD><CODE>run</CODE> in interface <CODE>java.lang.Runnable</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="getSimulationFPS()"><!-- --></A><H3> getSimulationFPS</H3> <PRE> public double <B>getSimulationFPS</B>()</PRE> <DL> <DD><DL> </DL> </DD> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/DefaultScheduler.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultMoveMode.html" title="class in edu.cmu.cs.stage3.alice.authoringtool.util"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../../../edu/cmu/cs/stage3/alice/authoringtool/util/DefaultUndoableRedoable.html" title="class in edu.cmu.cs.stage3.alice.authoringtool.util"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../../../index.html?edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="DefaultScheduler.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>
ai-ku/langvis
doc/edu/cmu/cs/stage3/alice/authoringtool/util/DefaultScheduler.html
HTML
mit
13,764
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("openHistorianShell")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Grid Protection Alliance")] [assembly: AssemblyProduct("openHistorianShell")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2ae8742c-4298-4d49-9a73-8b347b279dc2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("2.8.156.0")] [assembly: AssemblyVersion("2.8.156.0")] [assembly: AssemblyFileVersion("2.8.156.0")]
GridProtectionAlliance/openHistorian
Source/Applications/openHistorian/openHistorianShell/Properties/AssemblyInfo.cs
C#
mit
1,443
namespace LesGamblers.Data.Migrations { using System.Data.Entity.Migrations; using System.Linq; using Microsoft.AspNet.Identity.EntityFramework; using Microsoft.AspNet.Identity; using Models; public sealed class Configuration : DbMigrationsConfiguration<LesGamblers.Data.LesGamblersDbContext> { public Configuration() { this.AutomaticMigrationsEnabled = true; this.AutomaticMigrationDataLossAllowed = true; } protected override void Seed(LesGamblers.Data.LesGamblersDbContext context) { SeedRolesAndAdmin(context); } private void SeedRolesAndAdmin(LesGamblers.Data.LesGamblersDbContext context) { if (context.Users.Count() > 0) { return; } var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(context)); var userManager = new UserManager<Gambler>(new UserStore<Gambler>(context)); userManager.PasswordValidator = new MinimumLengthValidator(5); if (!roleManager.RoleExists(LesGamblers.Common.GlobalConstants.AdministratorRoleName)) { roleManager.Create(new IdentityRole(LesGamblers.Common.GlobalConstants.AdministratorRoleName)); } var admin1 = new Gambler { UserName = "[email protected]", Email = "[email protected]", PhoneNumber = "0888888888", FirstName = "Martin", LastName = "Atanasov" }; if (userManager.FindByName("[email protected]") == null) { var result = userManager.Create(admin1, "martoCheater123"); if (result.Succeeded) { userManager.AddToRole(admin1.Id, LesGamblers.Common.GlobalConstants.AdministratorRoleName); } } context.SaveChanges(); } } }
juvemar/LesGamblers
LesGamblers.Data/Migrations/Configuration.cs
C#
mit
2,023
// Copyright (c) 2010-2013 SharpDX - Alexandre Mutel // // 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. using System; namespace SharpDX.DirectWrite { public partial class FontFileLoaderNative { /// <summary> /// Creates a font file stream object that encapsulates an open file resource. /// </summary> /// <remarks> /// The resource is closed when the last reference to fontFileStream is released. /// </remarks> /// <param name="fontFileReferenceKey">A reference to a font file reference key that uniquely identifies the font file resource within the scope of the font loader being used. The buffer allocated for this key must at least be the size, in bytes, specified by fontFileReferenceKeySize. </param> /// <returns>a reference to the newly created <see cref="SharpDX.DirectWrite.FontFileStream"/> object. </returns> /// <unmanaged>HRESULT IDWriteFontFileLoader::CreateStreamFromKey([In, Buffer] const void* fontFileReferenceKey,[None] int fontFileReferenceKeySize,[Out] IDWriteFontFileStream** fontFileStream)</unmanaged> public FontFileStream CreateStreamFromKey(DataPointer fontFileReferenceKey) { FontFileStream temp; CreateStreamFromKey_(fontFileReferenceKey.Pointer, fontFileReferenceKey.Size, out temp); return temp; } } }
wyrover/SharpDX
Source/SharpDX.Direct2D1/DirectWrite/FontFileLoaderNative.cs
C#
mit
2,457
"use strict"; var async = require("async"); var moment = require("moment"); var fs = require("fs"); var os = require("os"); var Suite = function(args) { var self = this; self._now = moment(); self._args = args || {}; self._args.duration = (self._args.duration || (1000)) * 1000; // duration in milliseconds, converted to microseconds self._args.bounce = self._args.bounce !== undefined ? self._args.bounce : false; self._args.bounceEvery = self._args.bounceEvery || 1000; self._args.compare = self._args.compare !== undefined ? self._args.compare : false; self._args.save = self._args.save !== undefined ? self._args.save : false; self._args.savePath = self._args.savePath !== undefined ? self._args.savePath : process.cwd() + "/"; self._args.saveFileRoot = self._args.saveFileRoot !== undefined ? self._args.saveFileRoot : "simplebench"; self._args.saveFilename = self._args.saveFilename !== undefined ? self._args.saveFilename : `${self._args.saveFileRoot}.${self._now.format("YYYY-MM-DD-X")}.json`; self._args.logArgs = self._args.logArgs !== undefined ? self._args.logArgs : false; if (self._args.logArgs) { console.log("Using args", self._args); } self._groups = { default : { tests : {} } }; self.skip = { add : function() {}, group : function() {} } } Suite.prototype.group = function(name, fn) { var self = this; if (self._group !== undefined) { throw new Error("Cannot nest a group within a group"); } self._groups[name] = self._group = { tests : {} } fn(); self._group = undefined; } Suite.prototype.add = function(name, fn) { var self = this; var group = self._group !== undefined ? self._group : self._groups.default; group.tests[name] = fn; } Suite.prototype.run = function(cb) { var self = this; if (Object.keys(self._groups).length > 1 && Object.keys(self._groups.default.tests).length > 0) { throw new Error("If using suite.group(), all tests must be within a group"); } for(var i in self._groups) { if (Object.keys(self._groups[i].tests).length === 0) { delete self._groups[i]; } } async.mapValuesSeries(self._groups, function(group, name, cb) { return self._runGroup(group, cb); }, function(err, groupResults) { if (err) { return cb(err); } var results = { suiteArgs : self._args, date : self._now.format("LLLL"), os : { cpus : os.cpus(), totalmem : os.totalmem(), }, process : { version : process.version, versions : process.versions } } results.groups = groupResults; cb(null, results); }); } Suite.prototype._runGroup = function(group, cb) { var self = this; async.mapValuesSeries(group.tests, function(test, key, cb) { self._runTest(test, function(err, data) { if (err) { return cb(err); } if (global.gc !== undefined) { // if we have the gc object available, 2 mark-and-sweep and 1 scavenge to reduce test interference global.gc(); global.gc(); global.gc(true); } // bounce off the event loop to allow some garbage collection from the last test setTimeout(function() { cb(null, data); }, 100); }); }, function(err, temp) { if (err) { return cb(err); } var results = { results : [] } if (self._args.compare === true) { results.winner = undefined; results.winnerCount = 0; for(var i in temp) { if (temp[i] > results.winnerCount) { results.winner = i; results.winnerCount = temp[i]; } } } for(var i in temp) { var val = temp[i]; var diff = i === results.winner ? undefined : (val - results.winnerCount) / results.winnerCount * 100; results.results.push({ name : i, count : val, diff : self._args.compare === true ? diff : undefined, diffString : self._args.compare === true && diff ? `, diff: ${diff.toFixed(2)}%` : "", opsSec : val / (self._args.duration / 1000 / 1000) }); } results.results = results.results.sort((a, b) => a.count < b.count); return cb(null, results); }); } Suite.prototype.report = function(results) { var self = this; for(var groupName in results.groups) { var group = results.groups[groupName]; console.log("Group: ", groupName); if (self._args.compare) { console.log(`Winner - ${group.winner}\n`); } for(var value of group.results) { console.log(`${value.name} - count: ${value.count}, ops/sec: ${value.opsSec}${value.diffString}`); } } } Suite.prototype.saveResults = function(results, cb) { var self = this; return fs.writeFile(`${self._args.savePath}${self._args.saveFilename}`, JSON.stringify(results, null, "\t"), cb); } // return microsecond difference between two hrtimes var _diffHrtime = function(hrtime) { var diff = process.hrtime(hrtime); return (diff[0] * 1000000) + (diff[1] / 1000); } //// private Suite.prototype._runTest = function(fn, cb) { var self = this; var context = { count : 0, start : process.hrtime(), fn : fn, cb : cb, runTestIteration : undefined, runTestCb : undefined } context.runTestIteration = self._runTestIteration.bind(self, context); context.runTestCb = self._runTestCb.bind(self, context); return context.runTestIteration(); } Suite.prototype._runTestIteration = function(context) { var self = this; return context.fn(context.runTestCb); } Suite.prototype._runTestCb = function(context) { var self = this; // for some magic reason, this has to be done here, if we simply call context.cb(null, context.count) a few lines below this we get a v8 deopt with 'Insufficient type feedback for generic named access' var count = context.count; var diff = _diffHrtime(context.start); if (diff > self._args.duration) { return context.cb(null, count); } context.count++; if (self._args.bounce === true && context.count % self._args.bounceEvery === 0) { // to ensure high performance we don't want to bounce every execution, so only bounce if enabled return setImmediate(context.runTestIteration); } else { return context.runTestIteration(); } } module.exports = Suite;
simpleviewinc/simplebench
Suite.js
JavaScript
mit
6,280
/** * Created by vanya on 6/2/2015. */ function findResult(array) { var i, len, result = false; array = array || []; console.log('Array: ' + array); for (i = 1, len = array.length - 1; i < len; i += 1) { if (array[i] > array[i - 1] && array[i] > array[i + 1]) { return console.log('The element on position ' + i + ' is the first element bigger than its neighbours --> ' + true); } } if (!result) { return console.log(-1); } } findResult([5, 10, 13, 8, 100, 6]); console.log('-------------------------'); findResult([1, 2, 3, 4, 5]); console.log('-------------------------'); findResult([5, 100, 3, 6]);
VanyaD/JavaScript-Fundamentals
FunctionsHomework/Task7/FirstLargerThanNeighbours.js
JavaScript
mit
690
/* * Scene.cpp * * Created on: Jul 23, 2017 * Author: blroot */ #include "Scene.h" #include <iostream> #include <math.h> #include "../primitives/Intersect.h" namespace superboy { Scene::Scene() { this->height = 0; this->width = 0; this->maxdepth = 1; this->filename = "default.png"; } Scene::~Scene() { // TODO Auto-generated destructor stub } void Scene::addObject(std::shared_ptr<Object> object) { this->objects.push_back(object); } void Scene::addLight(std::shared_ptr<Light> light) { this->lights.push_back(light); } void Scene::setCamera(Camera &camera) { this->camera = camera; } void Scene::setResolution(int width, int height) { this->height = height; this->width = width; } void Scene::setFilename(std::string filename) { this->filename = filename; } void Scene::setMaxdepth(int depth) { this->maxdepth = depth; } IntersectionInfo Scene::intersect(Ray &ray) { float minimum_distance = INFINITY; std::shared_ptr<Object> hitobject = nullptr; vec3 normal; vec3 hitpoint; for (int i = 0; i < this->objects.size(); i++) { Intersect intersection; intersection = this->objects[i]->intersect(ray); if (intersection.getDistance() > 0.0f and intersection.getDistance() < minimum_distance) { minimum_distance = intersection.getDistance(); hitobject = this->objects[i]; normal = intersection.getNormal(); hitpoint = intersection.getHitpoint(); } } return IntersectionInfo(minimum_distance, normal, hitpoint, ray, hitobject); } bool Scene::isInShadow(Ray &ray, float &distance_to_light) { for (int i = 0; i < this->objects.size(); i++) { Intersect intersection; intersection = this->objects[i]->intersect(ray); if (intersection.getDistance() > 0.0f and intersection.getDistance() < distance_to_light) { return true; } } return false; } std::vector< std::shared_ptr<Object> >& Scene::getObjects() { return this->objects; } std::vector< std::shared_ptr<Light> >& Scene::getLights() { return this->lights; } Camera& Scene::getCamera() { return this->camera; } int& Scene::getWidth() { return this->width; } int& Scene::getHeight() { return this->height; } int& Scene::getMaxdepth() { return this->maxdepth; } std::string& Scene::getFilename() { return this->filename; } } /* namespace superboy */
blroot/superboy
core/scene/Scene.cpp
C++
mit
2,384
import "es5-shim/es5-shim"; import "es5-shim/es5-sham"; import _ from "underscore"; window._ = _; import "regenerator/runtime"; import Promise from "bluebird"; window.Promise = Promise;
micnigh/yet-another-isomorphic-blog
client/js/libs/entry.js
JavaScript
mit
186
#PlantCart This is a simple ecommerce shopping website for indoor plants, that sells three types of plants : Succulents, Bonsai and Air plants. Environment used : - **Angular Seed** boiler plate (https://github.com/angular/angular-seed). - Custom routing using **Angular-Route**. - Created Controllers and Views for different page templates. - Used **$http** service to fetch all the data from .json files and **$filter** service to filer data from the files.
anushamedicharla/PlantCart
README.md
Markdown
mit
472
import re with open('day10.txt') as f: inp = f.readline().strip() for i in xrange(0, 40): inp = "".join(map(lambda x: str(len(x[0])) + x[1], re.findall(r'((.)\2*)', inp))) print len(inp)
jsvennevid/adventofcode
2015/10/puzzle1.py
Python
mit
193
require "capistrano-nodeenv/version" require "capistrano/configuration/actions/file_transfer_ext" require "uri" module Capistrano module Nodeenv # Your code goes here... def self.extended(configuration) configuration.load { namespace(:nodeenv) { _cset(:nodeenv_version, nil) _cset(:nodeenv_jobs, 4) _cset(:nodeenv_verbose, true) _cset(:nodeenv_with_npm, true) _cset(:nodeenv_script_url, 'https://raw.github.com/ekalinin/nodeenv/e85a806e21d9bb5e417f1c17080964c485332b27/nodeenv.py') _cset(:nodeenv_script_file) { File.join(shared_path, 'nodeenv', File.basename(URI.parse(nodeenv_script_url).path)) } _cset(:nodeenv_bootstrap_python, 'python') # the python executable which will be used to craete nodeenv # Make installation command # execute downloaded nodeenv.py _cset(:nodeenv_cmd) { [ nodeenv_bootstrap_python, nodeenv_script_file, nodeenv_options, ].flatten.join(' ') } _cset(:nodeenv_requirements_file) { # secondary package list File.join(release_path) } _cset(:nodeenv_options) { os = "" os << "--jobs=#{nodeenv_jobs} " os << "--verbose " if nodeenv_verbose os << "--node=#{nodeenv_version} " if nodeenv_version #os << "--with-npm" if nodeenv_with_npm #os << "--requirement=#{nodeenv_requirements_file}" if nodeenv_requirements_file os } _cset(:nodeenv_npm_options, "") _cset(:nodeenv_npm_install_options, []) _cset(:nodeenv_npm_package, 'npm') _cset(:nodeenv_requirements, []) # primary package list _cset(:nodeenv_build_requirements, {}) _cset(:nodeenv_install_packages, []) # apt packages ## shared nodeenv: ## - created in shared_path ## - to be used to share libs between releases _cset(:nodeenv_shared_path) { File.join(shared_path, 'nodeenv', 'shared') } _cset(:nodeenv_shared_node) { File.join(nodeenv_shared_path, 'bin', 'node') } _cset(:nodeenv_shared_npm) { File.join(nodeenv_shared_path, 'bin', 'npm') } _cset(:nodeenv_shared_npm_cmd) { [ nodeenv_shared_node, nodeenv_shared_npm, nodeenv_npm_options, ].flatten.join(' ') } ## release nodeenv ## - created in release_path ## - common libs are copied from shared nodeenv ## - will be used for running application _cset(:nodeenv_release_path) { # the path where runtime nodeenv will be created File.join(release_path, 'vendor', 'nodeenv') } _cset(:nodeenv_release_node) { # the python executable within nodeenv File.join(nodeenv_release_path, 'bin', 'node') } _cset(:nodeenv_release_npm) { File.join(nodeenv_release_path, 'bin', 'npm') } _cset(:nodeenv_release_npm_cmd) { [ nodeenv_release_node, nodeenv_release_npm, nodeenv_npm_options, ].flatten.join(' ') } ## current nodeenv ## - placed in current_path ## - nodeenv of currently running application _cset(:nodeenv_current_path) { File.join(current_path, 'vendor', 'nodeenv') } _cset(:nodeenv_current_node) { File.join(nodeenv_current_path, 'bin', 'node') } _cset(:nodeenv_current_npm) { File.join(nodeenv_current_path, 'bin', 'npm') } _cset(:nodeenv_current_npm_cmd) { [ nodeenv_current_python, nodeenv_current_npm, nodeenv_npm_options, ].flatten.join(' ') } desc("Setup nodeenv.") task(:setup, :except => { :no_release => true }) { transaction { install create_shared } } after 'deploy:setup', 'nodeenv:setup' desc("Install nodeenv.") task(:install, :except => { :no_release => true }) { #run("#{sudo} apt-get install #{nodeenv_install_packages.join(' ')}") unless nodeenv_install_packages.empty? # Download nodeenv.py file dirs = [ File.dirname(nodeenv_script_file) ].uniq() run("mkdir -p #{dirs.join(' ')} && ( test -f #{nodeenv_script_file} || wget --no-verbose -O #{nodeenv_script_file} #{nodeenv_script_url} )") } desc("Uninstall nodeenv.") task(:uninstall, :except => { :no_release => true }) { run("rm -f #{nodeenv_script_file}") } task(:create_shared, :except => { :no_release => true }) { dirs = [ File.dirname(nodeenv_shared_path) ].uniq() cmds = [ ] cmds << "mkdir -p #{dirs.join(' ')}" cmds << "( test -d #{nodeenv_shared_path} || #{nodeenv_cmd} #{nodeenv_shared_path} )" cmds << "#{nodeenv_shared_node} --version && #{nodeenv_shared_npm_cmd} --version" run(cmds.join(' && ')) } task(:destroy_shared, :except => { :no_release => true }) { run("rm -rf #{nodeenv_shared_path}") } desc("Update nodeenv for project.") task(:update, :except => { :no_release => true }) { transaction { update_shared create_release } } after 'deploy:finalize_update', 'nodeenv:update' task(:update_shared, :except => { :no_release => true }) { unless nodeenv_requirements.empty? top.safe_put(nodeenv_requirements.join("\n"), nodeenv_requirements_file, :place => :if_modified) end cmds = ["touch #{nodeenv_requirements_file}"] cmds << ". #{nodeenv_shared_path}/bin/activate" cmds << "cat #{nodeenv_requirements_file}/package.json | python -c 'import json,sys;obj=json.load(sys.stdin);print \"\\r\\n\".join([k+\"@\"+v for k, v in obj.get(\"dependencies\", {}).items()])' | awk '{ print \"npm install -g #{nodeenv_npm_install_options.join(' ')} \"$0}' | bash" cmds << "deactivate_node" #run( && && #{nodeenv_shared_npm_cmd} install -g #{nodeenv_npm_install_options.join(' ')} #{nodeenv_requirements_file}") invoke_command(cmds.join(' && ')) puts("Updated requirements") execute = nodeenv_build_requirements.map { |package, options| build_options = ( options || [] ) ". #{nodeenv_shared_path}/bin/activate && #{nodeenv_shared_npm_cmd} install -g #{nodeenv_npm_install_options.join(' ')} #{build_options.join(' ')} #{package.dump} && deactivate_node" } invoke_command(execute.join(' && ')) unless execute.empty? } task(:create_release, :except => { :no_release => true }) { dirs = [ File.dirname(nodeenv_release_path) ].uniq() cmds = [ ] cmds << "mkdir -p #{dirs.join(' ')}" # Copy nodeenv from shared to release directory cmds << "cp -rf #{nodeenv_shared_path} #{nodeenv_release_path}" cmds << "sed -i -e 's|#{nodeenv_shared_path}|#{nodeenv_release_path}|g' #{nodeenv_release_path}/bin/activate" invoke_command(cmds.join(' && ')) } } } end end end if Capistrano::Configuration.instance Capistrano::Configuration.instance.extend(Capistrano::Nodeenv) end
Lispython/capistrano-nodeenv
lib/capistrano-nodeenv.rb
Ruby
mit
7,835
package tests; import java.awt.Color; import java.awt.Font; import javax.swing.JFrame; import javax.swing.JLabel; public class ContadorTiempo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub JFrame miVentana = new JFrame(); JLabel miLabel = new JLabel(" XX "); miLabel.setForeground( Color.blue ); miLabel.setBackground( Color.black ); miLabel.setOpaque( true ); miLabel.setFont( new Font( "Arial", Font.BOLD, 20)); miVentana.add( miLabel ); miVentana.pack(); miVentana.setVisible( true ); miVentana.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); MiContador cont = new MiContador( 10000, miLabel ); cont.start(); } } class MiContador extends Thread { private long miliSegsQueFaltan; private JLabel dondeLoVeo; private long momentoInicial; public MiContador( long pMiliSegsQueFaltan, JLabel pDondeLoVeo ) { miliSegsQueFaltan = pMiliSegsQueFaltan; dondeLoVeo = pDondeLoVeo; momentoInicial = System.currentTimeMillis(); } public void run() { while (momentoInicial + miliSegsQueFaltan >= System.currentTimeMillis()) { long tiempoQueFalta = momentoInicial + miliSegsQueFaltan - System.currentTimeMillis(); dondeLoVeo.setText( ""+ (int) (tiempoQueFalta/1000)); dondeLoVeo.updateUI(); System.out.println( "A"); try { Thread.sleep( 1000 ); } catch (InterruptedException e) { e.printStackTrace(); } if (interrupted()) break; } } }
andoni-eguiluz/UD-Prog3-ant
src/tests/ContadorTiempo.java
Java
mit
1,466
--- layout: post title: "Studio 3T (MongoChef), My 'Swiss Army Knife' for MongoDB" tags: [mongodb, tools] --- Our production [Worktile](https://worktile.com/) is using MongoDB as backend database. When I joint this team I was looking for a good GUI tool for MongoDB. Very soon I found MongoChef, which named [Studio 3T](https://studio3t.com/) now, and it's being used as my primary MongoDB tool till now. > Side Note: Anthony Dillon from Studio 3T reached out my blog and found I mentioned Studio 3T in one of my previours post, and he asked me if I can write something about it once he knew I have used Studio 3T for 3 years. And this is one of the reason you saw this post. But the primary reason is, I do think Studio 3T is the best GUI tool for MongoDB and recommend over to you. > tl; dr: Download [here](https://studio3t.com/download), it's cross-platform and free for 14 days trail. And you can use its non-commercial license for personal projects. In this post I'm not going to talk its features one by one, since you can find them in their [website](https://studio3t.com/#_product). I would like to mention some highlight points after using it 3 years. How you will say "WOW!" then. ### Create Connection from URI and Generate URI from Connection You can use Studio 3T connection dialog to create a connection to your MongoDB with specifying the host, port, username and authentication database, etc. and test it. But as a developer you may already know the connection string from your source code. In this case, Studio 3T don't need you to provide your database information separately. You can just copy and page your MongoDB connection string from code to Studio 3T. Assuming your found the MongoDB connection in the source code like this (in JavaScript) ```javascript const mongodb = `mongodb://THE_USER_NAME:[email protected]:21201/worktile`; ``` Note that it contains username, password, host, port and the authentication database. Copy the connection string and open Studio 3T. In "New Connection" dialog click the button "From URI..." and paste it. ![001.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/001.png) Now you will find all connection information were filled automatically based on the connection string. ![002.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/002.png) ![003.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/003.png) Besides, if you already have a connection saved in Studio 3T and would like to use it in your source code, can just open the connection details window and click "To URI...". Studio 3T will generate connection string from the connection information you specified before. You can also ask Studio 3T to include password in the connection string or not. ![004.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/004.png) > Studio 3T also supports connect the MongoDB server through SSL, to a replica-set, or even through SSH tunning which means you can use it to touch MongoDB located in a remote server. But my case I only have the rights to connect to local development environment, I don't have the chance to try these powerful features right now. ### 3 Types of Document View: JSON, Tree, Table MongoDB is a document NoSQL database and it's data structure is JSON-based. So the MongoDB fetch result would a set of JSON. It's very common in other MongoDB tools and the native MongoDB Command-Line Tool. But Studio 3T adds two more views to make us easier and simpler to operate the document. Below is some documents I found from the "tasks" collection. You can see the result was in tree view. It looks like JSON but every document was collapsed by default, which the "_id" and the properties count. ![005.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/005.png) You can click the arrow on the left side for each document node to expand. And if it contains array or sub document and can expand them recurrently. ![006.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/006.png) Tree vew is good, but I would like to show the table view, which I'm using daily and I think the best one. As you know MongoDB is schema-less. Comparing with those relational databases such as MySQL, SQL Server and Oracle, in MongoDB you can push documents in different structure into one collection. But in practice, documents in the same collection may have **very similar** structure. It can be different in some properties but overall it's the same. Thus, Studio 3T introduces table view as below. ![007.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/007.png) It looks like a RDB, the collection looks the a table and documents looks like a set of records. Table view allows us to check more information than JSON and tree view. Array and sub documents are presented as below. ![008.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/008.png) You can double-click on an array or sub document cell, Studio 3T will dig into it can return the content. ![009.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/009.png) ### Bookmarks Studio 3T allows us to save query into bookmarks. This is useful when I amd developing and testing against some dedicate documents. For example I saved a query which fetch documents for my own user. ![010.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/010.png) ![011.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/011.png) You can manage bookmarks by clicking the star icon on the top right side. It supports not only the query, but the projection, sort and options as well. You can put all frequent used queries into bookmarks. ![012.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/012.png) ### Import & Export In [Worktile](https://worktile.com/), not only production data, all log entries are stored in MongoDB. We have a basic web application to search logs. It helps for most cases, but for some complex and strange errors we need to search log entries with complex query, or maybe it needs `aggregate`. Although we can use MongoDB Command-Line tool for these queries but it's inefficiency. In order to identify the root cause of the error quickly what we can do is to import related log entries to my local MongoDB through and analyze them in Studio 3T. First of all I will connect to the remote machine to connect to the MongoDB database where log stored. Assuming I want to retrieve log entries for user operation id `1496829900001`. The query command would be ``` db.logs.find({"oid": "1496829900001"}); ``` I can export all fetched documents into a JSON file through the command below. ``` mongo --host localhost --port 27017 -u MY_USERNAME -p MY_PASSWORD --authenticationDatabase logs --quite logs --eval 'printjson(db.logs.find({"oid": "1496829900001"}).toArray())' > logs_oid_1496829900001.json ``` Then I can copy this JSON file to my local machine and import them into my local MongoDB through Studio 3T. First connect to my local MongoDB and right-click "Import Collection..." ![013.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/013.png) Select to format of the import data. Since we exported log entries in JSON so here we select the first one. ![014.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/014.png) Next, click the green "+" icon to select the JSON file. ![015.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/015.png) > Besides the file, Studio 3T also allows to import documents from clipboard. This is very useful when importing small amount of documents. For example, fetch documents from remote MongoDB Command-Line and copy the output content, then import them into local machine through Studio 3T directly from clipboard. You can rename the collection name. ![016.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/016.png) Finally we can investigate logs from local database. ![017.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/017.png) ### Features I Haven't Try These are the features I'm using in daily development work. Besides, Studio 3T also provides a lot of cool stuff for database administrator and developers those not familiar NoSQL very well. Below are some of them I didn't try but worth to mention. **SQL** I'm ont of many developers are experienced with RDS and SQL, and then moved to MongoDB. At the beginning I need to learn how to write MongoDB query based on SQL query I already to know. For example how to write MongoDB query like `SELECT * FROM my_collection WHERE name LIKE "%shaun%"`, `SELECT name, SUM(score) FROM my_collection GROUP BY name`, etc. Studio 3T provides a feature where we can write SQL statement and run against MongoDB. In fact, Studio 3T translate SQL into MongoDB query and run it. In fact I do **NOT** want to encourage you to use this feature to query MongoDB, since MongoDB query is something you **MUST** to learn and to use if really want to work with it. But this is a good feature to help you **learn** MongoDB query. You can write SQL query and check how it will be in MongoDB. ![018.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/018.png) **Aggregate Builder** Aggregate is a powerful feature MongoDB provides for data mining and analytics. With aggregate we can complete almost all kinds of queries such as filter, projection, cross-collection lookup, de-structure, etc. But it needs more knowledge to write a proper aggregate query. Studio 3T provides a GUI builder to create aggregate statement. You can find pipeline you want, specify the query content and run it immediately. ![019.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/019.png) Again, this feature can helps you to understand aggregate. But I recommend you to write aggregate by yourself, and I think this is a **MUST HAVE** skill for MongoDB. **DBA Related** Studio 3T also provides many feature for database administrator. You can manage the database users and roles. You can also compare documents between collections and databases. Besides, you can use Studio 3T to analyze a collection and generate the schema information. Since I'm not a DBA so I don't have the chance to try them. ### Customer Support Besides these cool feature I mentioned below, Studio 3T also provides very positive customer support. Their support team gave a very deep impression when I reported a bug in v4.3. When I upgraded to v4.3 I found the application crashed when I edited a document in the edit dialog. I just sent a feedback and I keep working. Several hours later I got an email sent from Studio 3T support team to check the error I reported. I provides more information about that bug. ![020.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/020.png) Several days later I received another email from Studio 3T. They just released a new version which contains the fix of the bug I reported. To me, this means Studio 3T respects every users, tracks every feedback and provides updates as quick as possible. ![021.png]({{site.baseurl}}/img/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb/021.png) I believe Studio 3T will be success because of not only the features, but their attitude. ### Summary Studio 3T is the only tool I'm using for MongoDB tool. Actually I use it everyday. You can try it from the [download page](https://studio3t.com/download). Hopes you love it.
shaunxu/shaunxu.github.io
_posts/2017-06-09-studio-3t-my-swiss-army-knife-for-mongodb.md
Markdown
mit
11,776
# XCDataBase
xianhe92/XCDataBase
README.md
Markdown
mit
12
class Users::RegistrationsController < Devise::RegistrationsController def new super end end
SeoulSistas/groovy_prototype
app/controllers/users/registrations_controller.rb
Ruby
mit
103
<?php class TrackingException extends Exception {} class Track extends Model { public $id; public $user; public $track_date; public $weight; public $value; // Booleans for tracking activity. public $tuesday; public $wednesday; public $thursday; public $friday; public $saturday; public $sunday; public $monday; public function __construct() { $this->dbConnect(); if ( isset($this->id) ) { $this->id = (int)$this->id; $this->track_date = date('D M d Y H:i:s O', strtotime($this->track_date)); $this->weight = $this->roundFloat($this->weight); $this->value = $this->roundFloat($this->value); $this->formatDaysBool(); } } public function __destruct() { $this->conn = null; } public function __toString() { return $this->weight; } public function formatDaysBool() { $this->tuesday = ($this->tuesday == true); $this->wednesday = ($this->wednesday == true); $this->thursday = ($this->thursday == true); $this->friday = ($this->friday == true); $this->saturday = ($this->saturday == true); $this->sunday = ($this->sunday == true); $this->monday = ($this->monday == true); } public static function roundFloat($float_value) { return round( (float)$float_value, 1 ); } public function setWeight($weight) { $this->weight = $this->roundFloat($weight); } public function validate() { /* Checks attributes for valid inputs. In the style of Backbone.js, this * only returns a value if one or more attributes are incorrect. */ if ( !isset($this->user, $this->track_date, $this->weight, $this->value) ) { return "One of more required fields is blank."; } if ($this->weight <= 0) { return "Reported weight must be a positive number."; } } public function save() { /* If the object is valid, runs either an UPDATE or an INSERT query * depending on the existence of the ID attribute. Upon INSERT, the * new ID is attached to the object. */ $not_valid = $this->validate(); if ($not_valid) { throw new TrackingException($not_valid); } if ( isset($this->id) ) { $stmt = $this->conn->prepare("UPDATE track t SET t.track_date = :track_date, t.weight = :weight, t.value = :value WHERE t.id = :id"); $stmt->execute(array( "id"=>$this->id, "track_date"=>$this->sanitizeDate($this->track_date), "weight"=>$this->weight, "value"=>$this->value )); } else { $stmt = $this->conn->prepare("INSERT INTO track (`user`, `track_date`, `weight`, `value`, `tuesday`, `wednesday`, `thursday`, `friday`, `saturday`, `sunday`, `monday`) VALUES (:user, :track_date, :weight, :value, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday, :monday);"); $stmt->execute(array( "user"=>(int)$this->user, "track_date"=>$this->sanitizeDate($this->track_date), "weight"=>$this->weight, "value"=>$this->roundFloat($this->value), "tuesday"=>(int)$this->tuesday, "wednesday"=>(int)$this->wednesday, "thursday"=>(int)$this->thursday, "friday"=>(int)$this->friday, "saturday"=>(int)$this->saturday, "sunday"=>(int)$this->sunday, "monday"=>(int)$this->monday )); $this->id = (int)$this->conn->lastInsertId(); } } } ?>
patsweet/weigh-to-go
weigh-to-go/app/models/track.php
PHP
mit
4,143
<!-- id: 13788450906 link: http://tumblr.atmos.org/post/13788450906/tribute-to-drive-by-tom-haugomat-bruno slug: tribute-to-drive-by-tom-haugomat-bruno date: Mon Dec 05 2011 11:56:55 GMT-0800 (PST) publish: 2011-12-05 tags: title: tribute to drive (by tom haugomat &amp; bruno mangyoku) --> tribute to drive (by tom haugomat &amp; bruno mangyoku) =======================================================
atmos/tumblr.atmos.org
posts/2011/12/tribute-to-drive-by-tom-haugomat-bruno.md
Markdown
mit
409
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>portfolio</title> <link rel="stylesheet" href="styles1.css"> </head> <body> <header> <h1>Sharif Ahmad</h1> <p>Chota Ismaila, Swabi, Pakistan</p> </header> <main> <h2>About Me</h2> <p class="total_indent"> I waste alot of my time going through daily news and does not do my work on time which I should be doing.I usually forward my work to oht weeks and hence get less GPA. But this time things need to be turned around because I severely need good GPA. </p> <h2>Interests</h2> <p>Cricket</p> <p>Knowing about interesting technologies</p> <p>Lollywood movies</p> <h2>Hobbies</h2> <p>arduino</p> <p>computer games</p> <h2>Websites I Like</h2> <a href="https://www.youtube.com">Youtube</a> <p>website which I like the most . Probably 4 to 5 hours spent daily on it.</p> <a href="https://www.twitter.com">Twitter</a> <p>The second in command to Youtube. Probably spend about an hour on it.</p> <a href="https://mail.google.com">Gmail</a> <p>It does not take much of my time.</p> </main> </body> </html>
sharifahmad2061/web_engineerning_5th_sem
lab1/portfolio.html
HTML
mit
1,406
# -*- coding: utf-8 -*- """ In this assignment you will implement one or more algorithms for the all-pairs shortest-path problem. Here are data files describing three graphs: [./Graph1.txt], [./Graph2.txt], [./Graph3.txt] The first line indicates the number of vertices and edges, respectively. Each subsequent line describes an edge (the first two numbers are its tail and head, respectively) and its length (the third number). NOTE: some of the edge lengths are negative. NOTE: These graphs may or may not have negative-cost cycles. Your task is to compute the "shortest shortest path". Precisely, you must first identify which, if any, of the three graphs have no negative cycles. For each such graph, you should compute all-pairs shortest paths and remember the smallest one (i.e., compute minu,v∈Vd(u,v), where d(u,v) denotes the shortest-path distance from u to v). If each of the three graphs has a negative-cost cycle, then enter "NULL" in the box below. If exactly one graph has no negative-cost cycles, then enter the length of its shortest shortest path in the box below. If two or more of the graphs have no negative-cost cycles, then enter the smallest of the lengths of their shortest shortest paths in the box below. OPTIONAL: You can use whatever algorithm you like to solve this question. If you have extra time, try comparing the performance of different all-pairs shortest-path algorithms! OPTIONAL: If you want a bigger data set to play with, try computing the shortest shortest path for this graph [./GraphLarge.txt] """ #import os # #from src.all_pairs_shortest_paths import dijkstra, roy_floyd_warshall, johnson #from src.graph import Graph # # #def read_graph(file_name): # """ Reads graph adjacency matrix from the given file. """ # g = Graph.build(directed=True) # with open('{base}/test/{f}'.format(base=os.getcwd(), f=file_name), 'r') as f: # [num_vertices, num_edges] = map(int, f.readline().split()) # for __ in range(num_edges): # [tail, head, value] = map(int, f.readline().split()) # g.add_edge((tail, head, value)) # return g # #g1 = read_graph('Graph1.txt') #g2 = read_graph('Graph2.txt') #g3 = read_graph('Graph3.txt') # #o1 = johnson(g1) #o2 = johnson(g2) #o3 = johnson(g3) #o1 = roy_floyd_warshall(g1) #o2 = roy_floyd_warshall(g2) #o3 = roy_floyd_warshall(g3) # #if o1 is False: # print "graph1 has a negative cost cycle" #else: # print 'min shortest path in graph1 is ' + min([y for __, y in x.iteritems() for __, x in o1.iteritems()]) #if o2 is False: # print "graph1 has a negative cost cycle" #else: # print 'min shortest path in graph1 is ' + min([y for __, y in x.iteritems() for __, x in o2.iteritems()]) #if o3 is False: # print "graph1 has a negative cost cycle" #else: # print 'min shortest path in graph1 is ' + min([y for __, y in x.iteritems() for __, x in o3.iteritems()])
topliceanu/learn
python/algo/test/test_programming_set_2_4.py
Python
mit
2,900
var config = require('./config'), shelljs = require('shelljs'), Promise = require('bluebird'), fse = Promise.promisifyAll(require('fs-extra')), path = require('path'), mustache = require('mustache'), UglifyJS = require('uglify-js'); var STATIC_FILES = ['LICENSE']; var rootPath = path.join(__dirname , '/../../'); module.exports = function(conf) { config.load(conf || {}).validate(); return build(); }; function build() { return Promise.resolve() .then(function() { return cleanDirectory(config.get('build')); }) .then(function() { return getModules(); }) .map(function(module) { return buildModule(module); }); } function buildModule(module) { var destPath = path.join(config.get('build'), module), srcPath = path.join(config.get('src'), module); console.error('Building %s', module); return Promise.resolve() .then(function() { //Copy src files return fse.copyAsync(srcPath, destPath); }) .then(function() { //Make bower.json return Promise.join( fse.readFileAsync(path.join(destPath, 'bower.tpl.json'), {encoding: 'utf8'}), fse.readJsonAsync(path.join(rootPath, 'bower.json')), function(tpl, bower) { return mustache.render(tpl, bower); } ) .then(function(bowerStr) { return fse.writeFileAsync(path.join(destPath, 'bower.json'), bowerStr); }) .then(function() { return fse.unlinkAsync(path.join(destPath, 'bower.tpl.json')); }); }) .then(function() { //Add header to file return Promise.join( fse.readFileAsync(path.join(__dirname, '../', 'assets', 'header.tpl.js'), {encoding: 'utf8'}), fse.readFileAsync(path.join(destPath, module + '.js'), {encoding: 'utf8'}), fse.readJsonAsync(path.join(destPath, 'bower.json')), function(tpl, content, bower) { bower.year = (new Date()).getFullYear(); var data = mustache.render(tpl, bower) + content; return fse.writeFileAsync(path.join(destPath, module + '.js'), data); } ); }) .then(function() { //Add bower info to README //TODO: dont copy paste code return Promise.join( fse.readFileAsync(path.join(__dirname, '../', 'assets', 'README-header.tpl.md'), {encoding: 'utf8'}), fse.readFileAsync(path.join(__dirname, '../', 'assets', 'README-footer.tpl.md'), {encoding: 'utf8'}), fse.readFileAsync(path.join(destPath, 'README.md'), {encoding: 'utf8'}), fse.readJsonAsync(path.join(destPath, 'bower.json')), function(tplHeader, tplFooter, content, bower) { bower.year = (new Date()).getFullYear(); var data = mustache.render(tplHeader, bower) + content + mustache.render(tplFooter, bower); return fse.writeFileAsync(path.join(destPath, 'README.md'), data); } ); }) .then(function() { //minify var result = UglifyJS.minify(path.join(destPath, module + '.js'), { outSourceMap: module + '.min.js.map', output: { comments: function(node, comment) { return comment.type === 'comment2' && /@preserve|@license|@cc_on/i.test(comment.value); } } }); var sourceMap = JSON.parse(result.map); sourceMap.sources = sourceMap.sources.map(function(file) { return file.replace(destPath + path.sep, ''); }); sourceMap.file = sourceMap.file.replace('.map', ''); result.map = JSON.stringify(sourceMap); return Promise.all([ fse.writeFileAsync(path.join(destPath, module + '.min.js'), result.code), fse.writeFileAsync(path.join(destPath, module + '.min.js.map'), result.map) ]); }) .then(function() { //copy static files return Promise .map(STATIC_FILES, function(file) { var sourceFile = path.join(rootPath, file), destFile = path.join(destPath, file); return fse.copyAsync(sourceFile, destFile); }) .return(); }) .return(module); } function getModules() { var sourceDir = config.get('src'); return fse.readdirAsync(sourceDir) .filter(function(file) { var p = path.join(sourceDir, file); return fse.lstatSync(p).isDirectory(); }); } function cleanDirectory(directory) { return fse.removeAsync(directory) .return(directory); }
angular-hu/angular-hu
scripts/src/build.js
JavaScript
mit
4,446
/* *Copyright (C) 2013 by Matthias Stangl * *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. */ #include "dataconv.h" uint8_t* I2OSP(mpz_class uIntX, size_t octetXLen) { uint8_t *octetX = new uint8_t[octetXLen]; mpz_class tmp; int index = 0; while(uIntX > 0){ tmp = uIntX % 256; octetX[octetXLen - 1 - index] = tmp.get_ui(); uIntX /= 256; index++; } //fill the rest with 0x00 std::fill_n(octetX, octetXLen - index, 0x00); return octetX; } mpz_class OS2IP(uint8_t *octetX, size_t octetXLen) { mpz_class ret, rop; for(int i = octetXLen - 1; i >= 0; i--){ mpz_ui_pow_ui(rop.get_mpz_t(), 256, octetXLen - 1 - i); ret += rop * octetX[i]; } return ret; }
mtzstngl/RSA_Encryption
dataconv.cpp
C++
mit
1,719
"""ZNC AlertMod - Module to send user an alert when their nick is mentioned""" import os import smtplib import znc class alertmod(znc.Module): description = "Alert module" module_types = [znc.CModInfo.NetworkModule] wiki_page = 'https://github.com/treytabner/znc-alert/wiki' def OnLoad(self, args, message): if not self.nv.get('smtp_server') or not self.nv.get('alert_email'): self.do_help() return znc.CONTINUE def OnModCommand(self, command): try: if command.lower().startswith("set "): (_, key, value) = command.split() if ((key.lower() == 'smtp_server' or key.lower() == 'alert_email')): self.nv[key.lower()] = value return znc.CONTINUE except: pass if not command.lower().startswith("help"): self.PutModule("Sorry, I didn't understand.") self.do_help() return znc.CONTINUE def OnPrivAction(self, nick, message): return self.alert(message, nick, action=True) def OnChanAction(self, nick, channel, message): return self.alert(message, nick, channel=channel, action=True) def OnPrivMsg(self, nick, message): return self.alert(message, nick) def OnChanMsg(self, nick, channel, message): return self.alert(message, nick, channel=channel) def do_help(self): if self.nv.get('smtp_server'): self.PutModule("Your outgoing SMTP server is set to: %s" % self.nv.get('smtp_server')) else: self.PutModule("Please set your outgoing SMTP server, for " "example: 'set smtp_server mail.example.com'") if self.nv.get('alert_email'): self.PutModule("Your alert email address is set to: %s" % self.nv.get('alert_email')) else: self.PutModule("Please set your alert email address, for " "example: 'set alert_email [email protected]'") if self.nv.get('smtp_server') and self.nv.get('alert_email'): self.PutModule("You can update your settings with: " "'set smtp_server ...' or 'set alert_email ...'") try: text_message = self.nv.get('alert_email').split('@')[0].isdigit() except: text_message = False if not text_message: self.PutModule("Did you know you can send " "yourself a text message too?") self.PutModule(""" AT&T - [email protected] Verizon - [email protected] T-Mobile - [email protected] Sprint PCS - [email protected] Virgin Mobile - [email protected] US Cellular - [email protected] Nextel - [email protected] Boost - [email protected] Alltel - [email protected] """.strip()) def alert(self, message, nick, channel=None, action=False): # If we're not away, ignore if not self.GetNetwork().IsIRCAway(): return znc.CONTINUE my_nick = self.GetNetwork().GetNick() # Don't bother sending ourselves email if my_nick == nick.GetNick(): return znc.CONTINUE if channel and my_nick not in message.s: return znc.CONTINUE # Make sure we've been setup first if not self.nv.get('smtp_server') or not self.nv.get('alert_email'): return self.do_help() fromaddr = 'ZNC <%s@%s>' % (os.environ.get('USER'), os.environ.get('HOSTNAME')) if action: body = '* %s %s' % (nick.GetNick(), message.s) if channel else message.s else: body = '<%s> %s' % (nick.GetNick(), message.s) if channel else message.s subject = channel.GetName() if channel else nick.GetNick() msg_tpl = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" msg = msg_tpl % (fromaddr, self.nv.get('alert_email'), subject, body) server = smtplib.SMTP(self.nv.get('smtp_server')) server.sendmail(fromaddr, [self.nv.get('alert_email')], msg) server.quit() return znc.CONTINUE
treytabner/znc-alert
alertmod.py
Python
mit
4,330
{htmlbefore} <div class="image" data-picture data-alt="{alt}"{maxwidth}> <div data-src="{source}/opt/small.png"></div> <div data-src="{source}/opt/small_x2.png" data-media="(min-device-pixel-ratio: 2.0)"></div> <div data-src="{source}/opt/medium.png" data-media="(min-width: 481px)"></div> <div data-src="{source}/opt/medium_x2.png" data-media="(min-width: 481px) and (min-device-pixel-ratio: 2.0)"></div> <div data-src="{source}/opt/large.png" data-media="(min-width: 980px)"></div> <div data-src="{source}/opt/large_x2.png" data-media="(min-width: 980px) and (min-device-pixel-ratio: 2.0)"></div> <div data-src="{source}/opt/huge.png" data-media="(min-width: 1200px)"></div> <div data-src="{source}/opt/huge_x2.png" data-media="(min-width: 1200px) and (min-device-pixel-ratio: 2.0)"></div> <!--[if (lt IE 9) & (!IEMobile)]> <div data-src="{source}/large.png"></div> <![endif]--> <noscript> <img class="img-responsive" src="{source}/opt/medium_x2.png" alt="{alt}"> </noscript> </div> {htmlafter}
lakemedelsboken/LB
servers/cms/contenttypes/image/output.html
HTML
mit
1,012
<div> <ul class="ui-tree" data-bind="template: { name: 'text!koui/tree/item.html', foreach: $data.children, templateEngine: $data.engine }"></ul> </div>
spatools/koui
src/tree/container.html
HTML
mit
159
<div class="content"> <div class="user-profile" id="pad-wrapper"> <!-- header --> <div class="row header"> <h2 class="personal-title">Edit Gift</h2> <div class="col-md-10 col-sm-12 col-xs-12 pull-right"> <a class="btn-flat success pull-right" href="/admin/add_gift/"> <span>+</span> Add Gift </a> </div> </div> <div class="col-md-7 personal-info"> <?php if(isset($msg) && !empty($msg)) { ?> <div class="alert alert-info"> <i class="icon-lightbulb"></i> <?php echo $msg; ?> </div> <?php } ?> <form role="form" enctype="multipart/form-data" class="form-horizontal" action="<?php echo base_url()?>admin/gift/<?php echo $results['id'];?>/" method="post"> <div class="form-group"> <label class="col-lg-4 control-label">Gift Name :</label> <div class="col-lg-8"> <input name="gname" id='gname' type="text" value="<?php echo $results['gname'];?>" class="form-control"> </div> </div> <div class="form-group"> <label class="col-lg-4 control-label">Gift Type :</label> <div class="col-lg-8"> <select name="gift_type" id="gift_type" > <option <?php if($results['gift_type'] == 'gift') {?> selected="selected" <?php } ?> value="gift">Gift</option> <option <?php if($results['gift_type'] == 'dollar') {?> selected="selected" <?php } ?> value="dollar">Dollar</option> <option <?php if($results['gift_type'] == 'money') {?> selected="selected" <?php } ?> value="money">Money Pot</option> </select> </div> </div> <div class="form-group"> <label class="col-lg-4 control-label">Icon :</label> <div class="col-lg-8"> <input name="icon" type="text" value="<?php echo $results['icon'];?>" id='icon' class="form-control"> <a target="_blank" href="http://fortawesome.github.io/Font-Awesome/3.2.1/icons/"> More Icons </a> </div> </div> <div class="actions"> <input type="submit" name="submit" value="Save Changes" class="btn-glow primary"> <span>OR</span> <input type="submit" class="btn btn-danger" name="delete" value="Delete"> </div> </form> </div> </div> </div>
anoopkp06/guestlist
application/views/admin/gift.php
PHP
mit
3,259
# frozen_string_literal: true require 'rails_helper' RSpec.describe Group, type: :model do let(:organization) { GitHubFactory.create_owner_classroom_org } describe 'slug uniqueness' do it 'verifies that the slug is unique even if the titles are unique' do Grouping.create(title: 'Grouping 1', organization: organization) new_group = Grouping.create(title: 'grouping-1', organization: organization) expect { new_group.save! }.to raise_error(ActiveRecord::RecordInvalid) end end end
mkcode/classroom
spec/models/grouping_spec.rb
Ruby
mit
516
<div class="breadcrumb"> <a href="{{ pathto(master_doc) }}">Obsah</a> » {%- for parent in parents %} <a href="{{ parent.link|e }}" {%- if loop.last %}{{ accesskey("U") }}{%- endif %}>{{ parent.title }}</a> » {%- endfor %} {{ title }} </div>
webuni/sphinx-symfonydocs
webuni/sphinx/symfonydocs/themes/symfonydocs_cs/breadcrumb.html
HTML
mit
263
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import 'vs/css!./bulkEdit'; import { WorkbenchAsyncDataTree, IOpenEvent, ResourceNavigator } from 'vs/platform/list/browser/listService'; import { WorkspaceEdit } from 'vs/editor/common/modes'; import { BulkEditElement, BulkEditDelegate, TextEditElementRenderer, FileElementRenderer, BulkEditDataSource, BulkEditIdentityProvider, FileElement, TextEditElement, BulkEditAccessibilityProvider, BulkEditAriaProvider, CategoryElementRenderer, BulkEditNaviLabelProvider, CategoryElement, BulkEditSorter } from 'vs/workbench/contrib/bulkEdit/browser/bulkEditTree'; import { FuzzyScore } from 'vs/base/common/filters'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { registerThemingParticipant, IColorTheme, ICssStyleCollector, IThemeService } from 'vs/platform/theme/common/themeService'; import { diffInserted, diffRemoved } from 'vs/platform/theme/common/colorRegistry'; import { localize } from 'vs/nls'; import { DisposableStore } from 'vs/base/common/lifecycle'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { BulkEditPreviewProvider, BulkFileOperations, BulkFileOperationType } from 'vs/workbench/contrib/bulkEdit/browser/bulkEditPreview'; import { ILabelService } from 'vs/platform/label/common/label'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { URI } from 'vs/base/common/uri'; import { ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet'; import { ResourceLabels, IResourceLabelsContainer } from 'vs/workbench/browser/labels'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import Severity from 'vs/base/common/severity'; import { basename } from 'vs/base/common/resources'; import { IMenuService, MenuId } from 'vs/platform/actions/common/actions'; import { IAction } from 'vs/base/common/actions'; import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem'; import { ITreeContextMenuEvent } from 'vs/base/browser/ui/tree/tree'; import { CancellationToken } from 'vs/base/common/cancellation'; import { ITextEditorOptions } from 'vs/platform/editor/common/editor'; import type { IAsyncDataTreeViewState } from 'vs/base/browser/ui/tree/asyncDataTree'; import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { IViewDescriptorService } from 'vs/workbench/common/views'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; const enum State { Data = 'data', Message = 'message' } export class BulkEditPane extends ViewPane { static readonly ID = 'refactorPreview'; static readonly ctxHasCategories = new RawContextKey('refactorPreview.hasCategories', false); static readonly ctxGroupByFile = new RawContextKey('refactorPreview.groupByFile', true); static readonly ctxHasCheckedChanges = new RawContextKey('refactorPreview.hasCheckedChanges', true); private static readonly _memGroupByFile = `${BulkEditPane.ID}.groupByFile`; private _tree!: WorkbenchAsyncDataTree<BulkFileOperations, BulkEditElement, FuzzyScore>; private _treeDataSource!: BulkEditDataSource; private _treeViewStates = new Map<boolean, IAsyncDataTreeViewState>(); private _message!: HTMLSpanElement; private readonly _ctxHasCategories: IContextKey<boolean>; private readonly _ctxGroupByFile: IContextKey<boolean>; private readonly _ctxHasCheckedChanges: IContextKey<boolean>; private readonly _disposables = new DisposableStore(); private readonly _sessionDisposables = new DisposableStore(); private _currentResolve?: (edit?: WorkspaceEdit) => void; private _currentInput?: BulkFileOperations; constructor( options: IViewletViewOptions, @IInstantiationService private readonly _instaService: IInstantiationService, @IEditorService private readonly _editorService: IEditorService, @ILabelService private readonly _labelService: ILabelService, @ITextModelService private readonly _textModelService: ITextModelService, @IDialogService private readonly _dialogService: IDialogService, @IMenuService private readonly _menuService: IMenuService, @IContextMenuService private readonly _contextMenuService: IContextMenuService, @IContextKeyService private readonly _contextKeyService: IContextKeyService, @IStorageService private readonly _storageService: IStorageService, @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IKeybindingService keybindingService: IKeybindingService, @IContextMenuService contextMenuService: IContextMenuService, @IConfigurationService configurationService: IConfigurationService, @IOpenerService openerService: IOpenerService, @IThemeService themeService: IThemeService, @ITelemetryService telemetryService: ITelemetryService, ) { super( { ...options, titleMenuId: MenuId.BulkEditTitle }, keybindingService, contextMenuService, configurationService, _contextKeyService, viewDescriptorService, _instaService, openerService, themeService, telemetryService ); this.element.classList.add('bulk-edit-panel', 'show-file-icons'); this._ctxHasCategories = BulkEditPane.ctxHasCategories.bindTo(_contextKeyService); this._ctxGroupByFile = BulkEditPane.ctxGroupByFile.bindTo(_contextKeyService); this._ctxHasCheckedChanges = BulkEditPane.ctxHasCheckedChanges.bindTo(_contextKeyService); } dispose(): void { this._tree.dispose(); this._disposables.dispose(); } protected renderBody(parent: HTMLElement): void { super.renderBody(parent); const resourceLabels = this._instaService.createInstance( ResourceLabels, <IResourceLabelsContainer>{ onDidChangeVisibility: this.onDidChangeBodyVisibility } ); this._disposables.add(resourceLabels); // tree const treeContainer = document.createElement('div'); treeContainer.className = 'tree'; treeContainer.style.width = '100%'; treeContainer.style.height = '100%'; parent.appendChild(treeContainer); this._treeDataSource = this._instaService.createInstance(BulkEditDataSource); this._treeDataSource.groupByFile = this._storageService.getBoolean(BulkEditPane._memGroupByFile, StorageScope.GLOBAL, true); this._ctxGroupByFile.set(this._treeDataSource.groupByFile); this._tree = <WorkbenchAsyncDataTree<BulkFileOperations, BulkEditElement, FuzzyScore>>this._instaService.createInstance( WorkbenchAsyncDataTree, this.id, treeContainer, new BulkEditDelegate(), [new TextEditElementRenderer(), this._instaService.createInstance(FileElementRenderer, resourceLabels), new CategoryElementRenderer()], this._treeDataSource, { accessibilityProvider: this._instaService.createInstance(BulkEditAccessibilityProvider), ariaProvider: new BulkEditAriaProvider(), identityProvider: new BulkEditIdentityProvider(), expandOnlyOnTwistieClick: true, multipleSelectionSupport: false, keyboardNavigationLabelProvider: new BulkEditNaviLabelProvider(), sorter: new BulkEditSorter() } ); this._disposables.add(this._tree.onContextMenu(this._onContextMenu, this)); const navigator = ResourceNavigator.createTreeResourceNavigator(this._tree, { openOnFocus: true }); this._disposables.add(navigator); this._disposables.add(navigator.onDidOpenResource(e => this._openElementAsEditor(e))); // message this._message = document.createElement('span'); this._message.className = 'message'; this._message.innerText = localize('empty.msg', "Invoke a code action, like rename, to see a preview of its changes here."); parent.appendChild(this._message); // this._setState(State.Message); } protected layoutBody(height: number, width: number): void { this._tree.layout(height, width); } private _setState(state: State): void { this.element.dataset['state'] = state; } async setInput(edit: WorkspaceEdit, token: CancellationToken): Promise<WorkspaceEdit | undefined> { this._setState(State.Data); this._sessionDisposables.clear(); this._treeViewStates.clear(); if (this._currentResolve) { this._currentResolve(undefined); this._currentResolve = undefined; } const input = await this._instaService.invokeFunction(BulkFileOperations.create, edit); const provider = this._instaService.createInstance(BulkEditPreviewProvider, input); this._sessionDisposables.add(provider); this._sessionDisposables.add(input); // const hasCategories = input.categories.length > 1; this._ctxHasCategories.set(hasCategories); this._treeDataSource.groupByFile = !hasCategories || this._treeDataSource.groupByFile; this._ctxHasCheckedChanges.set(input.checked.checkedCount > 0); this._currentInput = input; return new Promise(async resolve => { token.onCancellationRequested(() => resolve()); this._currentResolve = resolve; this._setTreeInput(input); // refresh when check state changes this._sessionDisposables.add(input.checked.onDidChange(() => { this._tree.updateChildren(); this._ctxHasCheckedChanges.set(input.checked.checkedCount > 0); })); }); } hasInput(): boolean { return Boolean(this._currentInput); } private async _setTreeInput(input: BulkFileOperations) { const viewState = this._treeViewStates.get(this._treeDataSource.groupByFile); await this._tree.setInput(input, viewState); this._tree.domFocus(); if (viewState) { return; } // async expandAll (max=10) is the default when no view state is given const expand = [...this._tree.getNode(input).children].slice(0, 10); while (expand.length > 0) { const { element } = expand.shift()!; if (element instanceof FileElement) { await this._tree.expand(element, true); } if (element instanceof CategoryElement) { await this._tree.expand(element, true); expand.push(...this._tree.getNode(element).children); } } } accept(): void { const conflicts = this._currentInput?.conflicts.list(); if (!conflicts || conflicts.length === 0) { this._done(true); return; } let message: string; if (conflicts.length === 1) { message = localize('conflict.1', "Cannot apply refactoring because '{0}' has changed in the meantime.", this._labelService.getUriLabel(conflicts[0], { relative: true })); } else { message = localize('conflict.N', "Cannot apply refactoring because {0} other files have changed in the meantime.", conflicts.length); } this._dialogService.show(Severity.Warning, message, []).finally(() => this._done(false)); } discard() { this._done(false); } private _done(accept: boolean): void { if (this._currentResolve) { this._currentResolve(accept ? this._currentInput?.getWorkspaceEdit() : undefined); } this._currentInput = undefined; this._setState(State.Message); this._sessionDisposables.clear(); } toggleChecked() { const [first] = this._tree.getFocus(); if ((first instanceof FileElement || first instanceof TextEditElement) && !first.isDisabled()) { first.setChecked(!first.isChecked()); } } groupByFile(): void { if (!this._treeDataSource.groupByFile) { this.toggleGrouping(); } } groupByType(): void { if (this._treeDataSource.groupByFile) { this.toggleGrouping(); } } toggleGrouping() { const input = this._tree.getInput(); if (input) { // (1) capture view state let oldViewState = this._tree.getViewState(); this._treeViewStates.set(this._treeDataSource.groupByFile, oldViewState); // (2) toggle and update this._treeDataSource.groupByFile = !this._treeDataSource.groupByFile; this._setTreeInput(input); // (3) remember preference this._storageService.store(BulkEditPane._memGroupByFile, this._treeDataSource.groupByFile, StorageScope.GLOBAL); this._ctxGroupByFile.set(this._treeDataSource.groupByFile); } } private async _openElementAsEditor(e: IOpenEvent<BulkEditElement | null>): Promise<void> { type Mutable<T> = { -readonly [P in keyof T]: T[P] }; let options: Mutable<ITextEditorOptions> = { ...e.editorOptions }; let fileElement: FileElement; if (e.element instanceof TextEditElement) { fileElement = e.element.parent; options.selection = e.element.edit.textEdit.edit.range; } else if (e.element instanceof FileElement) { fileElement = e.element; options.selection = e.element.edit.textEdits[0]?.textEdit.edit.range; } else { // invalid event return; } const previewUri = BulkEditPreviewProvider.asPreviewUri(fileElement.edit.uri); if (fileElement.edit.type & BulkFileOperationType.Delete) { // delete -> show single editor this._editorService.openEditor({ label: localize('edt.title.del', "{0} (delete, refactor preview)", basename(fileElement.edit.uri)), resource: previewUri, options }); } else { // rename, create, edits -> show diff editr let leftResource: URI | undefined; try { (await this._textModelService.createModelReference(fileElement.edit.uri)).dispose(); leftResource = fileElement.edit.uri; } catch { leftResource = BulkEditPreviewProvider.emptyPreview; } let typeLabel: string | undefined; if (fileElement.edit.type & BulkFileOperationType.Rename) { typeLabel = localize('rename', "rename"); } else if (fileElement.edit.type & BulkFileOperationType.Create) { typeLabel = localize('create', "create"); } let label: string; if (typeLabel) { label = localize('edt.title.2', "{0} ({1}, refactor preview)", basename(fileElement.edit.uri), typeLabel); } else { label = localize('edt.title.1', "{0} (refactor preview)", basename(fileElement.edit.uri)); } this._editorService.openEditor({ leftResource, rightResource: previewUri, label, options }); } } private _onContextMenu(e: ITreeContextMenuEvent<any>): void { const menu = this._menuService.createMenu(MenuId.BulkEditContext, this._contextKeyService); const actions: IAction[] = []; const disposable = createAndFillInContextMenuActions(menu, undefined, actions, this._contextMenuService); this._contextMenuService.showContextMenu({ getActions: () => actions, getAnchor: () => e.anchor, onHide: () => { disposable.dispose(); menu.dispose(); } }); } } registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) => { const diffInsertedColor = theme.getColor(diffInserted); if (diffInsertedColor) { collector.addRule(`.monaco-workbench .bulk-edit-panel .highlight.insert { background-color: ${diffInsertedColor}; }`); } const diffRemovedColor = theme.getColor(diffRemoved); if (diffRemovedColor) { collector.addRule(`.monaco-workbench .bulk-edit-panel .highlight.remove { background-color: ${diffRemovedColor}; }`); } });
joaomoreno/vscode
src/vs/workbench/contrib/bulkEdit/browser/bulkEditPane.ts
TypeScript
mit
15,489
// // AppDelegate.h // PrimerPrueba // // Created by Jose Eduardo Quintero Gutierrez on 02/06/13. // Copyright (c) 2013 Jose Eduardo Quintero Gutierrez. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
colectivoej/calidadAireiOS
PrimerPrueba/AppDelegate.h
C
mit
323
require 'spec_helper' describe "drugs/edit.html.haml" do before(:each) do @drug = assign(:drug, stub_model(Drug, :name => "MyString" )) end it "renders the edit drug form" do render # Run the generator again with the --webrat flag if you want to use webrat matchers assert_select "form", :action => drugs_path(@drug), :method => "post" do assert_select "input#drug_name", :name => "drug[name]" end end end
ryanatwork/SCVTracker
spec/views/drugs/edit.html.haml_spec.rb
Ruby
mit
453
require 'spec_helper' require 'interactors/convert_exams' describe ConvertExams do subject { described_class } let(:course) { double(link_id: 'BI-ZUM', link_title: 'Sample course') } let(:kosapi_room) { double(link_id: 'T9:105') } let(:kosapi_rooms) { [kosapi_room]} let(:teacher) { double(link_id: 'kordikp', link_title: 'Ing. Pavel Kordík Ph.D.') } let(:examiners) { nil } let(:exam) { create_exam } let(:exams) { [exam] } let(:faculty_semester) { Fabricate.build(:faculty_semester) } let(:rooms) { [Fabricate.build(:room, id: 42, kos_code: 'T9:105')] } describe '#perform' do it 'converts exams to events' do instance = subject.perform(exams: exams, faculty_semester: faculty_semester, rooms: rooms) events = instance.results[:events] event = events.first expect(events).to be expect(event.starts_at).to eq Time.parse('2015-01-12T11:00:00') expect(event.ends_at).to eq Time.parse('2015-01-12T12:00:00') expect(event.course_id).to eq 'BI-ZUM' expect(event.teacher_ids).to eq ['kordikp'] expect(event.capacity).to eq 10 expect(event.event_type).to eq 'exam' expect(event.semester).to eq 'B141' expect(event.faculty).to eq 18000 expect(event.source_type).to eq('exam') expect(event.source_id).to eq('620283180005') end context 'with no examiner' do let(:teacher) { nil } it 'sets empty teacher_ids array' do instance = subject.perform(exams: exams, faculty_semester: faculty_semester, rooms: rooms) events = instance.results[:events] event = events.first expect(event.teacher_ids).to eq [] end end context 'with multiple examiners' do let(:teacher) { nil } let(:examiners) { [double(link_id: 'vomackar', link_title: 'Ing. Karel Vomáčka Ph.D.'), double(link_id: 'skocdpet', link_title: 'Petr Skočdopole')]} it 'sets multiple assigned teachers' do instance = subject.perform(exams: exams, faculty_semester: faculty_semester, rooms: rooms) events = instance.results[:events] event = events.first expect(event.teacher_ids).to contain_exactly('vomackar', 'skocdpet') end end context 'with missing end time' do let(:exam) { create_exam(end_date: nil) } it 'sets default duration of 90 minutes' do instance = subject.perform(exams: exams, faculty_semester: faculty_semester, rooms: rooms) events = instance.results[:events] event = events.first expect(event.ends_at).to eq(event.starts_at + 90.minutes) end end context 'with assessment instead of exam' do let(:exam) { create_exam(term_type: :assessment) } it 'sets event type as assessment' do instance = subject.perform(exams: exams, faculty_semester: faculty_semester, rooms: rooms) events = instance.results[:events] event = events.first expect(event.event_type).to eq 'assessment' end end end def create_exam(end_date: Time.parse('2015-01-12T12:00:00'), term_type: :final_exam) double(:exam, link: double(link_id: 620283180005), start_date: Time.parse('2015-01-12T11:00:00'), end_date: end_date, capacity: 10, course: course, room: kosapi_room, examiner: teacher, term_type: term_type, note: 'Foo', examiners: examiners) end end
cvut/sirius
spec/interactors/convert_exams_spec.rb
Ruby
mit
3,392
package com.example.administrator.concentrationea; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; public class Jugar extends ConcentrationActivity { public static final String nJugadores = "nPlayers"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_jugar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); } public void startGame(View view){ int id = view.getId(); if (id == R.id.btnp1 ){ Intent intent = new Intent(this,GetNames.class); intent.putExtra(nJugadores,1); startActivity(intent); } else if (id == R.id.btnp2 ){ Intent intent = new Intent(this,GetNames.class); intent.putExtra(nJugadores,2); startActivity(intent); } else if (id == R.id.btnp3 ){ Intent intent = new Intent(this,GetNames.class); intent.putExtra(nJugadores,3); startActivity(intent); } else if (id == R.id.btnp4 ){ Intent intent = new Intent(this,GetNames.class); intent.putExtra(nJugadores,4); startActivity(intent); } } }
EdgarM-/MobileComputing
ConcentrationEA/app/src/main/java/com/example/administrator/concentrationea/Jugar.java
Java
mit
1,531
/* * Copyright (C) Alex Nekipelov ([email protected]) * License: MIT */ #pragma once #include <deque> #include <boost/system/error_code.hpp> #include "redisbuffer.h" #include "config.h" namespace redisclient { class RedisSyncClient; class RedisValue; // See https://redis.io/topics/pipelining. class Pipeline { public: REDIS_CLIENT_DECL Pipeline(RedisSyncClient &client); // add command to pipe REDIS_CLIENT_DECL Pipeline &command(std::string cmd, std::deque<RedisBuffer> args); // Sends all commands to the redis server. // For every request command will get response value. // Example: // // Pipeline pipe(redis); // // pipe.command("GET", {"foo"}) // .command("GET", {"bar"}) // .command("GET", {"more"}); // // std::vector<RedisValue> result = pipe.finish().toArray(); // // result[0]; // value of the key "foo" // result[1]; // value of the key "bar" // result[2]; // value of the key "more" // REDIS_CLIENT_DECL RedisValue finish(); REDIS_CLIENT_DECL RedisValue finish(boost::system::error_code &ec); private: std::deque<std::deque<RedisBuffer>> commands; RedisSyncClient &client; }; } #ifdef REDIS_CLIENT_HEADER_ONLY #include "redisclient/impl/pipeline.cpp" #endif
nekipelov/redisclient
src/redisclient/pipeline.h
C
mit
1,299
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_24) on Thu Dec 01 09:19:10 CET 2011 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> API Help (Java Architecture for XML Binding 2.2.6 API) </TITLE> <META NAME="date" CONTENT="2011-12-01"> <LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="API Help (Java Architecture for XML Binding 2.2.6 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> JAXB<br>v2.2.6</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <CENTER> <H1> How This API Document Is Organized</H1> </CENTER> This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3> Overview</H3> <BLOCKQUOTE> <P> The <A HREF="overview-summary.html">Overview</A> page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.</BLOCKQUOTE> <H3> Package</H3> <BLOCKQUOTE> <P> Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL> <LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL> </BLOCKQUOTE> <H3> Class/Interface</H3> <BLOCKQUOTE> <P> Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL> <LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description <P> <LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary <P> <LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL> Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE> </BLOCKQUOTE> <H3> Annotation Type</H3> <BLOCKQUOTE> <P> Each annotation type has its own separate page with the following sections:<UL> <LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL> </BLOCKQUOTE> </BLOCKQUOTE> <H3> Enum</H3> <BLOCKQUOTE> <P> Each enum has its own separate page with the following sections:<UL> <LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL> </BLOCKQUOTE> <H3> Tree (Class Hierarchy)</H3> <BLOCKQUOTE> There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL> <LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL> </BLOCKQUOTE> <H3> Deprecated API</H3> <BLOCKQUOTE> The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE> <H3> Index</H3> <BLOCKQUOTE> The <A HREF="index-all.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE> <H3> Prev/Next</H3> These links take you to the next or previous class, interface, package, or related page.<H3> Frames/No Frames</H3> These links show and hide the HTML frames. All pages are available with or without frames. <P> <H3> Serialized Form</H3> Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. <P> <H3> Constant Field Values</H3> The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values. <P> <FONT SIZE="-1"> <EM> This help file applies to API documentation generated using the standard doclet.</EM> </FONT> <BR> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Package</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> JAXB<br>v2.2.6</EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV&nbsp; &nbsp;NEXT</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <font size=-1> <br>Comments to: <a href='mailto:[email protected]'><i>[email protected]</i></a> <br>More information at: <a target='_top' href='http://jaxb.java.net'><i>http://jaxb.java.net</i></a> <p>Copyright &copy; 2004-2011 Oracle </font> </BODY> </HTML>
jsalla/jatintest
lib/jaxb/docs/api/help-doc.html
HTML
mit
9,435
<?php /** * CodeIgniter * * An open source application development framework for PHP * * This content is released under the MIT License (MIT) * * Copyright (c) 2014 - 2018, British Columbia Institute of Technology * * 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. * * @package CodeIgniter * @author EllisLab Dev Team * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) * @copyright Copyright (c) 2014 - 2018, British Columbia Institute of Technology (http://bcit.ca/) * @license http://opensource.org/licenses/MIT MIT License * @link https://codeigniter.com * @since Version 1.0.0 * @filesource */ /* *--------------------------------------------------------------- * APPLICATION ENVIRONMENT *--------------------------------------------------------------- * * You can load different configurations depending on your * current environment. Setting the environment also influences * things like logging and error reporting. * * This can be set to anything, but default usage is: * * development * testing * production * * NOTE: If you change these, also change the error_reporting() code below */ define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); /* *--------------------------------------------------------------- * ERROR REPORTING *--------------------------------------------------------------- * * Different environments will require different levels of error reporting. * By default development will show errors but testing and live will hide them. */ switch (ENVIRONMENT) { case 'development': error_reporting(E_ALL & ~E_NOTICE); ini_set('display_errors', 1); break; case 'testing': case 'production': ini_set('display_errors', 0); if (version_compare(PHP_VERSION, '5.3', '>=')) { error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); } else { error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); } break; default: header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'The application environment is not set correctly.'; exit(1); // EXIT_ERROR } /* *--------------------------------------------------------------- * SYSTEM DIRECTORY NAME *--------------------------------------------------------------- * * This variable must contain the name of your "system" directory. * Set the path if it is not in the same directory as this file. */ $system_path = 'system'; /* *--------------------------------------------------------------- * APPLICATION DIRECTORY NAME *--------------------------------------------------------------- * * If you want this front controller to use a different "application" * directory than the default one you can set its name here. The directory * can also be renamed or relocated anywhere on your server. If you do, * use an absolute (full) server path. * For more info please see the user guide: * * https://codeigniter.com/user_guide/general/managing_apps.html * * NO TRAILING SLASH! */ $application_folder = 'application'; /* *--------------------------------------------------------------- * VIEW DIRECTORY NAME *--------------------------------------------------------------- * * If you want to move the view directory out of the application * directory, set the path to it here. The directory can be renamed * and relocated anywhere on your server. If blank, it will default * to the standard location inside your application directory. * If you do move this, use an absolute (full) server path. * * NO TRAILING SLASH! */ $view_folder = ''; /* * -------------------------------------------------------------------- * DEFAULT CONTROLLER * -------------------------------------------------------------------- * * Normally you will set your default controller in the routes.php file. * You can, however, force a custom routing by hard-coding a * specific controller class/function here. For most applications, you * WILL NOT set your routing here, but it's an option for those * special instances where you might want to override the standard * routing in a specific front controller that shares a common CI installation. * * IMPORTANT: If you set the routing here, NO OTHER controller will be * callable. In essence, this preference limits your application to ONE * specific controller. Leave the function name blank if you need * to call functions dynamically via the URI. * * Un-comment the $routing array below to use this feature */ // The directory name, relative to the "controllers" directory. Leave blank // if your controller is not in a sub-directory within the "controllers" one // $routing['directory'] = ''; // The controller class file name. Example: mycontroller // $routing['controller'] = ''; // The controller function you wish to be called. // $routing['function'] = ''; /* * ------------------------------------------------------------------- * CUSTOM CONFIG VALUES * ------------------------------------------------------------------- * * The $assign_to_config array below will be passed dynamically to the * config class when initialized. This allows you to set custom config * items or override any default config values found in the config.php file. * This can be handy as it permits you to share one application between * multiple front controller files, with each file containing different * config values. * * Un-comment the $assign_to_config array below to use this feature */ // $assign_to_config['name_of_config_item'] = 'value of config item'; // -------------------------------------------------------------------- // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE // -------------------------------------------------------------------- /* * --------------------------------------------------------------- * Resolve the system path for increased reliability * --------------------------------------------------------------- */ // Set the current directory correctly for CLI requests if (defined('STDIN')) { chdir(dirname(__FILE__)); } if (($_temp = realpath($system_path)) !== FALSE) { $system_path = $_temp.DIRECTORY_SEPARATOR; } else { // Ensure there's a trailing slash $system_path = strtr( rtrim($system_path, '/\\'), '/\\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ).DIRECTORY_SEPARATOR; } // Is the system path correct? if ( ! is_dir($system_path)) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); exit(3); // EXIT_CONFIG } /* * ------------------------------------------------------------------- * Now that we know the path, set the main path constants * ------------------------------------------------------------------- */ // The name of THIS file define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); // Path to the system directory define('BASEPATH', $system_path); // Path to the front controller (this file) directory define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); // Name of the "system" directory define('SYSDIR', basename(BASEPATH)); // The path to the "application" directory if (is_dir($application_folder)) { if (($_temp = realpath($application_folder)) !== FALSE) { $application_folder = $_temp; } else { $application_folder = strtr( rtrim($application_folder, '/\\'), '/\\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ); } } elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) { $application_folder = BASEPATH.strtr( trim($application_folder, '/\\'), '/\\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ); } else { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; exit(3); // EXIT_CONFIG } define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); // The path to the "views" directory if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) { $view_folder = APPPATH.'views'; } elseif (is_dir($view_folder)) { if (($_temp = realpath($view_folder)) !== FALSE) { $view_folder = $_temp; } else { $view_folder = strtr( rtrim($view_folder, '/\\'), '/\\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ); } } elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) { $view_folder = APPPATH.strtr( trim($view_folder, '/\\'), '/\\', DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR ); } else { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; exit(3); // EXIT_CONFIG } define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR); /* * -------------------------------------------------------------------- * LOAD THE BOOTSTRAP FILE * -------------------------------------------------------------------- * * And away we go... */ require_once BASEPATH.'core/CodeIgniter.php';
anisotton/Smasy
index.php
PHP
mit
10,274
package com.adilmughal.demo.yow.searchd.traditional.test; import java.util.List; import org.junit.Test; import com.adilmughal.demo.yow.searchd.traditional.repository.DummySearchRepository; import junit.framework.TestCase; public class DummySearchRepositoryTest extends TestCase { @Test public void testGetDataShouldReturnNullWithNullKeywords() { DummySearchRepository repositoryUnderTest = new DummySearchRepository(); String keywords = null; List<String> expected = repositoryUnderTest.getData(keywords); assertNull(expected); } }
adilmughal/YOW2014-Android-MVVM
Searchd-Traditional-Test/src/com/adilmughal/demo/yow/searchd/traditional/test/DummySearchRepositoryTest.java
Java
mit
575
/* * Rule: Headings (h1-h6) should be defined only once. */ CSSLint.addRule({ // rule information id: "unique-headings", name: "Headings should only be defined once", desc: "Headings should be defined only once.", url: "https://github.com/CSSLint/csslint/wiki/Headings-should-only-be-defined-once", browsers: "All", // initialization init: function(parser, reporter) { "use strict"; var rule = this; var headings = { h1: 0, h2: 0, h3: 0, h4: 0, h5: 0, h6: 0 }; parser.addListener("startrule", function(event) { var selectors = event.selectors, selector, part, pseudo, i, j; for (i=0; i < selectors.length; i++) { selector = selectors[i]; part = selector.parts[selector.parts.length-1]; if (part.elementName && /(h[1-6])/i.test(part.elementName.toString())) { for (j=0; j < part.modifiers.length; j++) { if (part.modifiers[j].type === "pseudo") { pseudo = true; break; } } if (!pseudo) { headings[RegExp.$1]++; if (headings[RegExp.$1] > 1) { reporter.report("Heading (" + part.elementName + ") has already been defined.", part.line, part.col, rule); } } } } }); parser.addListener("endstylesheet", function() { var prop, messages = []; for (prop in headings) { if (headings.hasOwnProperty(prop)) { if (headings[prop] > 1) { messages.push(headings[prop] + " " + prop + "s"); } } } if (messages.length) { reporter.rollupWarn("You have " + messages.join(", ") + " defined in this stylesheet.", rule); } }); } });
Arcanemagus/csslint
src/rules/unique-headings.js
JavaScript
mit
2,232
/* ********************************************************************************************************* * uC/Probe Communication * * (c) Copyright 2007; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * Knowledge of the source code may NOT be used to develop a similar product. * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. ********************************************************************************************************* */ /* ********************************************************************************************************* * * uC/Probe * * Communication: Configuration * * Filename : probe_com_cfg.h * Version : V1.00 * Programmer(s) : Brian Nagel * Note(s) : (1) This file contains configuration constants for uC/Probe Communication Modules. ********************************************************************************************************* */ /* ********************************************************************************************************* * CHOOSE COMMUNICATION METHOD ********************************************************************************************************* */ #define PROBE_COM_METHOD_RS232 DEF_TRUE /* ********************************************************************************************************* * CONFIGURE GENERAL COMMUNICATION PARAMETERS ********************************************************************************************************* */ #define PROBE_COM_RX_MAX_SIZE 64 #define PROBE_COM_TX_MAX_SIZE 64 #define PROBE_COM_SUPPORT_WR DEF_TRUE #define PROBE_COM_SUPPORT_STR DEF_TRUE #if (PROBE_COM_SUPPORT_STR == DEF_TRUE) /* If strings are supported */ #define PROBE_COM_STR_BUF_SIZE 128 /* (a) Set size of string buffer */ #endif /* ********************************************************************************************************* * CONFIGURE STATISTICS AND COUNTERS ********************************************************************************************************* */ #define PROBE_COM_STAT_EN DEF_ENABLED /* ********************************************************************************************************* * CONFIGURE RS-232 SPECIFIC PARAMETERS ********************************************************************************************************* */ #if (PROBE_COM_METHOD_RS232 == DEF_TRUE) /* For the RS-232 communication method */ #define PROBE_RS232_PARSE_TASK DEF_TRUE /* (a) Set whether a task will handle parsing */ #if (PROBE_RS232_PARSE_TASK == DEF_TRUE) /* (b) If a task will handle parsing */ #define PROBE_RS232_TASK_PRIO 9 /* (i) Set task priority */ #define PROBE_RS232_TASK_STK_SIZE 160 /* (ii) Set task stack size */ #endif #define PROBE_RS232_RX_BUF_SIZE PROBE_COM_RX_MAX_SIZE /* (c) Set Rx buffer size */ #define PROBE_RS232_TX_BUF_SIZE PROBE_COM_TX_MAX_SIZE /* (d) Set Tx buffer size */ #define PROBE_RS232_UART_0 1 #define PROBE_RS232_UART_1 2 #define PROBE_RS232_UART_2 3 #define PROBE_RS232_UART_3 4 #define PROBE_RS232_UART_4 5 #define PROBE_RS232_UART_5 6 #define PROBE_RS232_UART_6 7 #define PROBE_RS232_UART_7 8 #define PROBE_RS232_UART_8 9 #define PROBE_RS232_UART_9 10 #define PROBE_RS232_UART_DBG 63 #define PROBE_RS232_COMM_SEL PROBE_RS232_UART_2 /* (e) Configure UART selection */ #endif
bo-rc/uCOSII_cs431_lab10
probe_com_cfg.h
C
mit
4,594
<section class="app-section trailer-section"> <div class="app-item"> <div class="embed-responsive embed-responsive-16by9"> <iframe class="embed-responsive-item" src="https://www.youtube.com/embed/rj2rKEzDYpw" allowfullscreen></iframe> </div> </div> </section>
a25kk/ck
src/ck.sitetheme/ck/sitetheme/resources/_includes/trailer.html
HTML
mit
285
{% extends "base.html" %} {% block title %}Frequently Asked Questions{% endblock %} {% block header %} <div id="header"> <h1>FAQ</h1> </div> {% endblock %} {% block faq_nav %} class="this"{% endblock %} {% block content %} <div id="content" class="copy"> <h2>Can You Add...</h2> <p>If it's another field then probably not, but do ask anyway. My focus here is keeping this as simple as possible. There are lots of good issue tracking products which allow more control, or hundreds of drop down menus, or permission models and workflows.</p> <h2>Do you have an API?</h2> <p>Not exactly, at least not a write API. Most of the views are available as JSON and RSS at the moment as well as HTML.</p> <p>I'd like to add a write API at a later date. In fact it's required by some of the other nice features I'd like to add.</p> <h2>Other Features?</h2> <p>Although I want to keep everything as simple as possible that doesn't mean I can't add cool new features over time. Most of them will focus on the interfaces to data. So expect more feeds, a scattering of RDF and Microformats and some graphs and stats for projects. I'd also like to work on an Instant Messaging interface and probably a command line version.</p> <h2>GitHub Hooks</h2> <p>As mentioned on each project page you created you can close issues using <a href="http://github.com/guides/post-receive-hooks">GitHub post receive hooks</a>. This is somewhat experimental so I'll be keeping a close eye on this feature. </div> {% endblock %}
krzysztofszymanski/appengine-bugs
templates/faq.html
HTML
mit
1,513
<!-- Disquss --> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = '{{site.owner.disqus_shortname}}'; // required: replace example with your forum shortname /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script>
sahilseth/sahilseth.github.io
_old_site/_includes/disqus.html
HTML
mit
611
--- byline: '' description: '' headline: '' image_url: '' pub_date: 2017-07-01 15:24:21.392931 published: false show_in_feeds: false ---
datadesk/django-bigbuild
example/pages/foobar-325/metadata.md
Markdown
mit
136
<?php require dirname(__DIR__) . '/config.php'; $request = new \Iyzipay\Request\Subscription\SubscriptionCreateRequest(); $request->setLocale("tr"); $request->setConversationId("123456789"); $request->setPricingPlanReferenceCode("c1d489b6-9adc-42fa-88ae-47ea2e5dbe1e"); $request->setSubscriptionInitialStatus("PENDING"); $paymentCard = new \Iyzipay\Model\PaymentCard(); $paymentCard->setCardHolderName("John Doe"); $paymentCard->setCardNumber("4603450000000000"); $paymentCard->setExpireMonth("12"); $paymentCard->setExpireYear("2030"); $paymentCard->setCvc("123"); $request->setPaymentCard($paymentCard); $customer = new \Iyzipay\Model\Customer(); $customer->setName("John"); $customer->setSurname("Doe"); $customer->setGsmNumber("+905555555555"); $customer->setEmail("[email protected]"); $customer->setIdentityNumber("11111111111"); $customer->setShippingContactName("John Doe"); $customer->setShippingCity("Istanbul"); $customer->setShippingCountry("Turkey"); $customer->setShippingAddress("Uskudar Burhaniye Mahallesi iyzico A.S"); $customer->setShippingZipCode("34660"); $customer->setBillingContactName("John Doe"); $customer->setBillingCity("Istanbul"); $customer->setBillingCountry("Turkey"); $customer->setBillingAddress("Uskudar Burhaniye Mahallesi iyzico A.S"); $customer->setBillingZipCode("34660"); $request->setCustomer($customer); $result = \Iyzipay\Model\Subscription\SubscriptionCreate::create($request,Config::options()); print_r($result);
iyzico/iyzipay-php
samples/subscription-samples/create_subscription_api.php
PHP
mit
1,461
namespace DddDemo.Issues { public class IssueLockedException : OperationalException { public string IssueId { get; } public IssueLockedException(string issueId) : base(OperationalExceptionType.IssueLocked) { IssueId = issueId; } } }
hikalkan/samples
DddDemo/src/DddDemo.Domain/Issues/IssueLockedException.cs
C#
mit
304
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Racing</title> <style> canvas { cursor: none; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; image-rendering: pixelated; } </style> <script language="javascript" src="js/game.js"></script> <body bgcolor="black" text="white" link="cyan" onload="main(Racing,128,160);"> <h1 align=center>Racing</h1> <div style="margin: 1em;" align=center> <div id="game" style="position:relative; width:512px; height:640px;"></div> </div> <div style="display:none;"> <img id="font" src="assets/font.png"> <img id="sprites" src="assets/sprites.png"> <audio id="music" src="assets/music.mp3" crossorigin="anonymous" preload="auto"></audio> <audio id="plunge" src="assets/plunge.mp3" crossorigin="anonymous" preload="auto"></audio> </div> </body>
euske/euskit
docs/samples/racing/index.html
HTML
mit
947
/* Copyright Sven Bergström 2014 Adapted from https://github.com/haxenme/nme/ adapted for snow https://github.com/underscorediscovery/snow MIT license */ #ifndef _SNOW_QUICK_VEC_H_ #define _SNOW_QUICK_VEC_H_ #include <algorithm> #ifdef EPPC #include <memory> #else #include <memory.h> #endif #include <stdlib.h> namespace snow { template<typename T> void DoDelete(T &item) { } template<typename T> void DoDelete(T *&item) { delete item; item = 0; } // Little vector/set class, optimised for small data and not using many malloc calls. // Data are allocated with "malloc", so they should not rely on constructors etc. template<typename T_,int QBUF_SIZE_=16> class QuickVec { enum { QBufSize = QBUF_SIZE_ }; public: typedef T_ *iterator; typedef const T_ * const_iterator; public: QuickVec() { mPtr = QBUF_SIZE_==0 ? 0 : mQBuf; mAlloc = QBufSize; mSize = 0; } QuickVec(const QuickVec<T_,QBUF_SIZE_> &inRHS) { if (QBUF_SIZE_!=0 && inRHS.mSize<=QBufSize) { mAlloc = QBufSize; mPtr = mQBuf; } else { mAlloc = inRHS.mAlloc; mPtr = (T_ *)malloc(mAlloc * sizeof(T_)); } mSize = inRHS.mSize; memcpy(mPtr,inRHS.mPtr,sizeof(T_)*mSize); } int Mem() const { return mAlloc * sizeof(T_); } QuickVec(const T_ *inData,int inLen) { mPtr = QBUF_SIZE_==0 ? 0 : mQBuf; mAlloc = QBufSize; mSize = 0; resize(inLen); memcpy(mPtr,inData,sizeof(T_)*inLen); } QuickVec(int inLen) { mPtr = QBUF_SIZE_==0 ? 0 : mQBuf; mAlloc = QBufSize; mSize = 0; resize(inLen); } ~QuickVec() { if (QBUF_SIZE_==0 || mPtr!=mQBuf){ if (mPtr) { free(mPtr); } } } //~QuickVec void clear() { if (QBUF_SIZE_==0) { if (mPtr) { free(mPtr); } mPtr = 0; mAlloc = 0; } else if (mPtr!=mQBuf) { free(mPtr); mPtr = mQBuf; mAlloc = QBufSize; } mSize = 0; } //clear void Set(const T_ *inData,int inN) { resize(inN); if (inN) { memcpy(mPtr,inData,inN*sizeof(T_)); } } void Zero() { if (mPtr && mSize) memset(mPtr,0,mSize*sizeof(T_)); } // This assumes the values in the array are sorted. template<typename X_, typename D_> void Change(X_ inValue,D_ inDiff) { if (mSize==0) { mPtr[mSize++] = T_(inValue,inDiff); return; } // Before/at start if (mPtr[0]==inValue) { mPtr[0] += inDiff; } else if (mPtr[0]>inValue) { InsertAt(0, T_(inValue,inDiff) ); } else { int last = mSize-1; // After/on end if (mPtr[last]==inValue) { mPtr[last] += inDiff; } else if (mPtr[last]<inValue) { Grow(); mPtr[mSize] = T_(inValue,inDiff); ++mSize; } else { // between 0 ... last int min = 0; int max = last; while(max>min+1) { int middle = (max+min+1)/2; T_ &v = mPtr[middle]; if (v==inValue) { v += inDiff; return; } if (v<inValue) min = middle; else max = middle; } // Not found, must be between min and max (=min+1) InsertAt(min+1,T_(inValue,inDiff) ); } } } // This assumes the values in the array are sorted. void Toggle(T_ inValue) { if (mSize==0) { mPtr[mSize++] = inValue; return; } // Before/at start if (inValue<=mPtr[0]) { if (inValue==mPtr[0]) EraseAt(0); else InsertAt(0,inValue); } else { int last = mSize-1; // After/on end if (inValue>=mPtr[last]) { if (inValue==mPtr[last]) EraseAt(last); else { Grow(); mPtr[mSize] = inValue; ++mSize; } } else { // between 0 ... last int min = 0; int max = last; while(max>min+1) { int middle = (max+min+1)/2; T_ v = mPtr[middle]; if (v==inValue) { EraseAt(middle); return; } if (v<inValue) min = middle; else max = middle; } // Not found, must be between min and max (=min+1) InsertAt(min+1,inValue); } } } inline void Grow() { if (mSize>=mAlloc) { if (QBUF_SIZE_!=0 && mPtr==mQBuf) { mPtr = (T_ *)malloc(sizeof(T_)*(QBufSize*2)); memcpy(mPtr, mQBuf, sizeof(mQBuf)); mAlloc = QBufSize*2; } else { if (mAlloc) mAlloc *= 2; else mAlloc = 16; mPtr = (T_*)realloc(mPtr, sizeof(T_)*mAlloc); } } } void reserve(int inSize) { if (mAlloc<inSize && (QBUF_SIZE_==0 || inSize>QBufSize) ) { mAlloc = inSize; if (QBUF_SIZE_==0 || mPtr!=mQBuf) { mPtr = (T_ *)realloc(mPtr,sizeof(T_)*mAlloc); } else { T_ *buf = (T_ *)malloc(sizeof(T_)*mAlloc); memcpy(buf,mPtr,mSize*sizeof(T_)); mPtr = buf; } } } void resize(int inSize) { if (mAlloc<inSize) { if (QBUF_SIZE_!=0 && mPtr==mQBuf) { mAlloc = inSize; mPtr = (T_ *)malloc(sizeof(T_)*(mAlloc)); memcpy(mPtr, mQBuf, sizeof(T_)*mSize); } else { mAlloc = inSize; mPtr = (T_*)realloc(mPtr, sizeof(T_)*mAlloc); } } mSize = inSize; } inline void push_back(const T_ &inVal) { Grow(); mPtr[mSize++] = inVal; } inline T_ qpop() { return mPtr[--mSize]; } inline void EraseAt(int inPos) { memmove(mPtr + inPos, mPtr + inPos + 1, (mSize-inPos-1) * sizeof(T_) ); --mSize; } inline void EraseAt(int inFirst,int inLast) { memmove(mPtr + inFirst, mPtr + inLast, (mSize-inLast) * sizeof(T_) ); mSize -= inLast-inFirst; } void erase(int inFirst,int inLen) { if (inFirst>mSize || inFirst<0) return; if (inFirst+inLen>=mSize || inLen<0) resize(inFirst); else { memmove(mPtr + inFirst, mPtr + inFirst + inLen, (mSize-inFirst-inLen) * sizeof(T_) ); mSize -= inLen; } } inline void InsertAt(int inPos,const T_ &inValue) { Grow(); memmove(mPtr + inPos + 1, mPtr + inPos, (mSize-inPos) * sizeof(T_) ); memcpy(mPtr+inPos,&inValue, sizeof(T_)); ++mSize; } inline void InsertAt(int inPos,const T_ *inValues,int inN) { resize(mSize+inN); memmove(mPtr + inPos + inN, mPtr + inPos, (mSize-inPos-inN) * sizeof(T_) ); memcpy(mPtr+inPos,inValues,inN*sizeof(T_)); } bool operator == (const QuickVec<T_,QBUF_SIZE_> &inRHS) { return (*mPtr == *(inRHS.mPtr)); } bool operator != (const QuickVec<T_,QBUF_SIZE_> &inRHS) { return !(*mPtr == *(inRHS.mPtr)); } inline int size() const { return mSize; } inline bool empty() const { return mSize==0; } inline T_& operator[](int inIndex) { return mPtr[inIndex]; } inline T_& last() { return mPtr[mSize-1]; } inline const T_& operator[](int inIndex) const { return mPtr[inIndex]; } inline iterator begin() { return mPtr; } inline iterator rbegin() { return mPtr + mSize -1; } inline iterator end() { return mPtr + mSize; } inline const_iterator begin() const { return mPtr; } inline const_iterator rbegin() const { return mPtr + mSize - 1; } inline const_iterator end() const { return mPtr + mSize; } void swap( QuickVec<T_,QBUF_SIZE_> &inRHS ) { if (QBUF_SIZE_==0) { std::swap(mPtr,inRHS.mPtr); } else if (mPtr!=mQBuf) { // Both "real" pointers - just swap them if (inRHS.mPtr!=inRHS.mQBuf) { std::swap(mPtr,inRHS.mPtr); } else { // RHS in in the qbuf, we have a pointer memcpy(mQBuf,inRHS.mQBuf,inRHS.mSize*sizeof(T_)); inRHS.mPtr = mPtr; mPtr = mQBuf; } } else { // We have a qbuf, rhs has a pointer if (inRHS.mPtr!=inRHS.mQBuf) { memcpy(inRHS.mQBuf,mQBuf,mSize*sizeof(T_)); mPtr = inRHS.mPtr; inRHS.mPtr = inRHS.mQBuf; } else { // Both using QBuf ... if (mSize && inRHS.mSize) { T_ tmp[QBufSize]; memcpy(tmp,mPtr,mSize*sizeof(T_)); memcpy(mPtr,inRHS.mPtr,inRHS.mSize*sizeof(T_)); memcpy(inRHS.mPtr,tmp,mSize*sizeof(T_)); } else if (mSize) memcpy(inRHS.mQBuf,mQBuf,mSize*sizeof(T_)); else memcpy(mQBuf,inRHS.mQBuf,inRHS.mSize*sizeof(T_)); } } std::swap(mAlloc,inRHS.mAlloc); std::swap(mSize,inRHS.mSize); } QuickVec<T_,QBUF_SIZE_> &operator=(const QuickVec<T_,QBUF_SIZE_> &inRHS) { if ( (QBUF_SIZE_==0 || mPtr!=mQBuf) && mPtr ) free(mPtr); if (QBUF_SIZE_!=0 && inRHS.mSize<=QBufSize) { mPtr = mQBuf; mAlloc = QBufSize; } else { mAlloc = inRHS.mAlloc; mPtr = (T_ *)(mAlloc ? malloc( mAlloc * sizeof(T_)) : 0); } mSize = inRHS.mSize; if (mSize) memcpy(mPtr,inRHS.mPtr,mSize*sizeof(T_)); return *this; } void DeleteAll() { for(int i=0;i<mSize;i++) DoDelete( mPtr[i] ); resize(0); } void append(const QuickVec<T_> &inOther) { int s = mSize; resize(mSize+inOther.mSize); for(int i=0;i<inOther.mSize;i++) mPtr[s+i] = inOther[i]; } void append(const T_ *inOther,int inLen) { int s = mSize; resize(mSize+inLen); for(int i=0;i<inLen;i++) mPtr[s+i] = inOther[i]; } T_ *mPtr; T_ mQBuf[QBufSize==0?1:QBufSize]; int mAlloc; int mSize; }; } // snow namespace #endif //_SNOW_QUICK_VEC_H_
mrcdk/snow
project/include/common/QuickVec.h
C
mit
11,879
(function () { window.controllers = window.controllers || {}; window.controllers.componentB = function ($rootScope, $timeout) { this.$rootScope = $rootScope; this.$timeout = $timeout; this._constructor_(); }; window.controllers.componentB.prototype._constructor_ = function(){ console.log('window.controllers.componentB'); var self = this; //this.rootScope = $rootScope; this.$timeout(function () { self.now = new Date(); }, 500); //this.rootScope.$on('subscription1.componentA.buttonClick', function (scope, obj) { // self.now = obj.now; //}); // eventSrv.makeSubcriptions(); this.doOnButton = function () { } this.registerEvents(this.rootScope); } window.controllers.componentB.prototype.registerEvents = function (rootScope) { var self = this; this.$rootScope.$on('componentA.buttonClick', function (scope, obj) { self.now = obj.now; console.log('componentA.buttonClick'); }); console.log('Events subscribed for ComponentB'); } window.controllers.componentB.prototype.XXX = function(){ alert(111) } //ctrl.prototype.now = new Date(); angular.module('example.componentB', []).controller("componentBController", ['$rootScope', '$timeout', window.controllers.componentB]); }());
spederiva/angular-dynamic-views
_oldversions/app4-uiroute/components/componentB/componentB.js
JavaScript
mit
1,437
<div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1> Products <small>Control panel</small> </h1> <ol class="breadcrumb"> <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> <li class="active">Dashboard</li> </ol> </section> <section class="content"> <!-- Default box --> <div class="box"> <div class="box-header with-border"> <h3 class="box-title"><button type="button" class="btn btn-primary" id="btn_add_new_product"><i class="fa fa-plus"></i> Add New</button></h3> <div class="box-tools pull-right"> <button class="btn btn-box-tool" data-widget="collapse" data-toggle="tooltip" title="Collapse"><i class="fa fa-minus"></i></button> <button class="btn btn-box-tool" data-widget="remove" data-toggle="tooltip" title="" data-original-title="Remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body"> <div id="container"> <?php /*echo $this->table->generate();*/ ?> <table class="table table-hover" id="product_table"> <thead> <tr> <th>Model Number</th> <th>Category</th> <th>Net Weight</th> <th>Gross Weight</th> <th>Price</th> <th>Image</th> <th>Actions</th> </tr> </thead> <tfoot> <tr> <th>Model Number</th> <th>Category</th> <th>Net Weight</th> <th>Gross Weight</th> <th>Price</th> </tr> </tfoot> </table> <script type="text/javascript"> $(document).ready(function() { $('.image-popup-link').magnificPopup({type:'image'}); }); </script> </div> </div><!-- /.box-body --> </div><!-- /.box --> </section> <!-- Main content --> </div><!-- /.content-wrapper --> <!-- section starts for modal --> <div class="modal fade" id="mdl_add_products" > <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Add New Product</h4> </div> <div class="modal-body"> <form action="<?php echo('product/add') ?>" method="POST" role="form" id="product_add_form"> <div class="row"> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> <div class="form-group"> <label for="">Model Number</label> <input type="text" name="model_no" class="form-control" id="model_no" placeholder="Model Number"> <span></span> </div> </div> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> <div class="form-group"> <label for="">Category</label> <select name="category" id="category" class="form-control"> <option value="0">-- Select Category --</option> <?php foreach ($product_categories as $category): ?> <option value="<?php echo($category->category_id) ?>"><?php echo($category->category) ?></option> <?php endforeach ?> </select> <span></span> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="panel panel-default"> <div class="panel-body"> <div class="table-responsive table-bordered"> <table class="table"> <thead> <tr> <th>Metal Type</th> <th>Metal</th> <th>Weight</th> <th></th> </tr> </thead> <tbody> <tbody id="metal_grid"> <tr> <td> <div class="form-group" id="metal_dropdown"> <select name="m_metaltype" id="m_metaltype" class="form-control" required="required"> <?php foreach ($metal_type as $metal): ?> <option value=""><?php echo($metal->metal_type) ?></option> <?php endforeach ?> </select> <span></span> </div> </td> <td> <div class="form-group" id="metal_dropdown"> <select name="m_metal" id="m_metal" class="form-control" required="required"> <option value="0">--Select metal--</option> </select> <span></span> </div> </td> <td> <div class="form-group" id="weight"> <input type="text" name="m_weight" id="m_weight" class="form-control" placeholder="Weight" > <span></span> </div> </td> <td> <div class="form-group"> <button type="button" class="btn btn-primary" id="add_metalto_grid">Add</button> </div> </td> </tr> </tbody> </tbody> </table> </div> </div> </div> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="panel panel-default"> <div class="panel-body"> <table class="table"> <thead> <tr> <th>Stone</th> <th>pcs</th> <th>cts</th> </tr> </thead> <tbody> <tbody id="stone_grid"> <tr> <td width="200"> <div class="form-group" id="stone_dropdown"> <select name="m_stone" id="m_stone" class="form-control" required="required"> <option value="0">--select lot no--</option> <?php foreach ($stones as $stone): ?> <option value="<?php echo($stone->stone_id) ?>"><?php echo($stone->lot_no) ?></option> <?php endforeach ?> </select> <span></span> </div> </td> <td> <div class="form-group"> <input type="number" name="m_pcs" id="m_pcs" class="form-control" value="" placeholder="Pcs"> <span></span> </div> </td> <td> <div class="form-group"> <input type="number" name="m_cts" id="m_cts" class="form-control" value="" placeholder="Cts"> <span></span> </div> </td> <td> <div> <button type="button" class="btn btn-primary" id="add_stoneto_togrid">Add</button> </div> </td> </tr> </tbody> </tbody> </table> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Gross Weight</label> <input type="number" name="grossweight" class="form-control" id="grossweight" placeholder="Gross Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Net Weight</label> <input type="number" name="netweight" class="form-control" id="netweight" placeholder="Net Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Weight loss</label> <input type="number" name="weight_loss" class="form-control" id="weight_loss" placeholder="Net Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Price</label> <input type="text" name="price" class="form-control" id="price" placeholder="Price"> <span></span> </div> </div> <div class="form-group"> <label for="">Image</label> <input type="file" name="photo" id="photo"> </div> </div> </form> </div> <div class="modal-footer"> <span class="label label-success pull-left" id="product_save_message" style="display:none">New product added successfully !</span> <button type="button" class="btn btn-primary" id="btn_product_add">Save</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- modal starts --> <div class="modal fade" id="product_edit_modal"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Edit Product</h4> </div> <div class="modal-body"> <form action="<?php echo('product/update') ?>" method="POST" role="form" id="product_update_form"> <div class="row"> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> <div class="form-group"> <label for="">Model Number</label> <input type="text" name="model_no" class="form-control" id="model_no" placeholder="Model Number"> <span></span> </div> </div> <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> <div class="form-group"> <label for="">Category</label> <select name="category" id="category" class="form-control"> <option value="0">-- Select Category --</option> <?php foreach ($product_categories as $category): ?> <option value="<?php echo($category->category_id) ?>"><?php echo($category->category) ?></option> <?php endforeach ?> </select> <span></span> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="panel panel-default"> <div class="panel-body"> <div class="table-responsive table-bordered"> <table class="table"> <thead> <tr> <th>Metal Type</th> <th>Metal</th> <th>Weight</th> <th></th> </tr> </thead> <tbody> <tbody id="metal_grid"> <tr> <td> <div class="form-group" id="metal_dropdown"> <select name="m_metaltype" id="m_metaltype" class="form-control" required="required"> <?php foreach ($metal_type as $metal): ?> <option value=""><?php echo($metal->metal_type) ?></option> <?php endforeach ?> </select> <span></span> </div> </td> <td> <div class="form-group" id="metal_dropdown"> <select name="m_metal" id="m_metal" class="form-control" required="required"> <option value="0">--Select metal--</option> </select> <span></span> </div> </td> <td> <div class="form-group" id="weight"> <input type="text" name="m_weight" id="m_weight" class="form-control" placeholder="Weight" > <span></span> </div> </td> <td> <div class="form-group"> <button type="button" class="btn btn-primary" id="add_metalto_grid">Add</button> </div> </td> </tr> </tbody> </tbody> </table> </div> </div> </div> </div> </div> </div> <div class="form-group"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12"> <div class="panel panel-default"> <div class="panel-body"> <table class="table"> <thead> <tr> <th>Stone</th> <th>pcs</th> <th>cts</th> </tr> </thead> <tbody> <tbody id="stone_grid"> <tr> <td width="200"> <div class="form-group" id="stone_dropdown"> <select name="m_stone" id="m_stone" class="form-control" required="required"> <option value="0">--select lot no--</option> <?php foreach ($stones as $stone): ?> <option value="<?php echo($stone->stone_id) ?>"><?php echo($stone->lot_no) ?></option> <?php endforeach ?> </select> <span></span> </div> </td> <td> <div class="form-group"> <input type="number" name="m_pcs" id="m_pcs" class="form-control" value="" placeholder="Pcs"> <span></span> </div> </td> <td> <div class="form-group"> <input type="number" name="m_cts" id="m_cts" class="form-control" value="" placeholder="Cts"> <span></span> </div> </td> <td> <div> <button type="button" class="btn btn-primary" id="add_stoneto_togrid">Add</button> </div> </td> </tr> </tbody> </tbody> </table> </div> </div> </div> </div> </div> <div class="row"> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Gross Weight</label> <input type="number" name="grossweight" class="form-control" id="grossweight" placeholder="Gross Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Net Weight</label> <input type="number" name="netweight" class="form-control" id="netweight" placeholder="Net Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Weight loss</label> <input type="number" name="weight_loss" class="form-control" id="weight_loss" placeholder="Net Weight"> <span></span> </div> </div> <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="form-group"> <label for="">Price</label> <input type="text" name="price" class="form-control" id="price" placeholder="Price"> <span></span> </div> </div> <div class="form-group"> <label for="">Image</label> <input type="file" name="photo" id="photo"> </div> </div> </form> </div> <div class="modal-footer"> <span class="label label-success pull-left" id="product_update_message" style="display:none">Product update successfully !</span> <button type="button" class="btn btn-primary" id="btn_product_update">Update</button> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- modal end --> <script type="text/javascript"> $(document).ready(function() { var selected_value=$('#m_metaltype').find("option:selected").text() var productid=''; fill_metal_combo(selected_value,'save');//functon for fill metal combobox when page first load $('#btn_add_new_product').click(function() { $('#mdl_add_products').modal('show'); }); //add data to metal grid $('#add_metalto_grid').click(function() { if($('#m_metal').val()==='0' || $('#m_unit').val()==='' || $('#m_weight').val()==='') { if ($('#m_metal').val()==='0') { $('#m_metal').next().html('<p class="text-warning">Please select metal</p>'); } if($('#m_unit').val()==='') { $('#m_unit').next().html('<p class="text-warning">Unit field is empty !</p>'); } if($('#m_weight').val()==='') { $('#m_weight').next().html('<p class="text-warning">Weight field is empty !</p>'); } } else { $('#metal_grid').append('<tr class="success"><td>'+$('#m_metaltype').find("option:selected").text()+'</td><td><input type="hidden" name="metal[]" value="'+$('#m_metal').val()+'">'+$('#m_metal').find("option:selected").text()+'</td><td><input type="hidden" name="weight[]" value="'+$('#m_weight').val()+'">'+$('#m_weight').val()+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>'); $('#m_metal').val('0'); $('#m_unit').val(''); $('#m_weight').val(''); } }); $('#add_stoneto_togrid').click(function() { if($('#m_stone').val()==='0' || $('#m_pcs').val()==='' || $('#m_cts').val()==='') { if ($('#m_stone').val()==='0') { $('#m_stone').next().html('<p class="text-warning">Please select stone</p>'); } if($('#m_pcs').val()==='') { $('#m_pcs').next().html('<p class="text-warning">Pcs field is empty !</p>'); } if($('#m_cts').val()==='') { $('#m_cts').next().html('<p class="text-warning">Cts field is empty !</p>'); } } else { $('#stone_grid').append('<tr class="success"><td><input type="hidden" name="stone[]" value="'+$('#m_stone').val()+'">'+$('#m_stone').find("option:selected").text()+'</td><td><input type="hidden" name="pcs[]" value="'+$('#m_pcs').val()+'">'+$('#m_pcs').val()+'</td><td><input type="hidden" name="cts[]" value="'+$('#m_cts').val()+'">'+$('#m_cts').val()+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>'); //reseting value of input field $('#m_stone').val('0'); $('#m_pcs').val(''); $('#m_cts').val(''); } }); $("body").on("click",'.remove', function() { $(this).closest('tr').remove(); }); $('.modal').on('hidden.bs.modal', function(){ $(this).find('form')[0].reset(); }); //for edit product $('body').on('click','.btnedit',function() { $("#product_update_form #stone_grid tr").not("tr:eq(0)").not("tbody:first").remove(); $("#product_update_form #metal_grid tr").not("tr:eq(0)").not("tbody:first").remove(); productid=$(this).data('productid'); var selected_value=$('#product_update_form #m_metaltype').find("option:selected").text(); fill_metal_combo(selected_value,'update'); $.ajax({ url: '<?php echo(site_url("product/get_product_detail")) ?>'+'/'+productid, dataType: 'json', success:function(data){ $('#product_update_form #model_no').val(data[0].model_no); $('#product_update_form #category').val(data[0].category_id); $('#product_update_form #grossweight').val(data[0].gross_weight); $('#product_update_form #netweight').val(data[0].net_weight); $('#product_update_form #weight_loss').val(data[0].weight_loss); $('#product_update_form #price').val(data[0].price); $.ajax({ url: '<?php echo(site_url("metal/get_metal_details")) ?>'+'/'+productid, dataType: 'json', success:function(data) { console.log(data); $.each(data, function(index, val) { $('#product_update_form #metal_grid').append('<tr class="success"><td>'+val.metal_type+'</td><td><input type="hidden" name="metal[]" value="'+val.metal_id+'">'+val.metal+'</td><td><input type="hidden" name="weight[]" value="'+val.weight+'">'+val.weight+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>') }); } }) .fail(function() { alert("something went wrong please contact capital eye for technical support"); }) .always(function() { console.log("complete"); }); //ajax for get data for stone details $.ajax({ url: '<?php echo(site_url("stone/get_stone_details")) ?>'+'/'+productid, dataType: 'json', success:function(data) { console.log(data); $.each(data, function(index, val) { $('#product_update_form #stone_grid').append('<tr class="success"><td><input type="hidden" name="stone[]" value="'+val.stone_id+'">'+val.stone_id+'</td><td><input type="hidden" name="pcs[]" value="'+val.pcs+'">'+val.pcs+'</td><td><input type="hidden" name="cts[]" value="'+val.cts+'">'+val.cts+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>'); }); } }) .fail(function() { alert("something went wrong please contact capital eye for technical support"); }) .always(function() { console.log("complete"); }); } }) .fail(function() { alert('something went wrong please contact capital eye for technical support.'); }); $('#product_edit_modal').modal('show'); }); //add metal to grid on edit $('#product_update_form #add_metalto_grid').click(function() { if($('#product_update_form #m_metal').val()==='0' || $('#product_update_form #m_unit').val()==='' || $('#product_update_form #m_weight').val()==='') { if ($('#product_update_form #m_metal').val()==='0') { $('#product_update_form #m_metal').next().html('<p class="text-warning">Please select metal</p>'); } if($('#product_update_form #m_unit').val()==='') { $('#product_update_form #m_unit').next().html('<p class="text-warning">Unit field is empty !</p>'); } if($('#product_update_form #m_weight').val()==='') { $('#product_update_form #m_weight').next().html('<p class="text-warning">Weight field is empty !</p>'); } } else { $('#product_update_form #metal_grid').append('<tr class="success"><td>'+$('#product_update_form #m_metaltype').find("option:selected").text()+'</td><td><input type="hidden" name="metal[]" value="'+$('#product_update_form #m_metal').val()+'">'+$('#product_update_form #m_metal').find("option:selected").text()+'</td><td><input type="hidden" name="weight[]" value="'+$('#product_update_form #m_weight').val()+'">'+$('#product_update_form #m_weight').val()+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>'); $('#product_update_form #m_metal').val('0'); $('#product_update_form #m_unit').val(''); $('#product_update_form #m_weight').val(''); } }); //add stone to grid on edit $('#product_update_form #add_stoneto_togrid').click(function() { if($('#product_update_form #m_stone').val()==='0' || $('#product_update_form #m_pcs').val()==='' || $('#product_update_form #m_cts').val()==='') { if ($('#product_update_form #m_stone').val()==='0') { $('#product_update_form #m_stone').next().html('<p class="text-warning">Please select stone</p>'); } if($('#product_update_form #m_pcs').val()==='') { $('#product_update_form #m_pcs').next().html('<p class="text-warning">Pcs field is empty !</p>'); } if($('#product_update_form #m_cts').val()==='') { $('#product_update_form #m_cts').next().html('<p class="text-warning">Cts field is empty !</p>'); } } else { $('#product_update_form #stone_grid').append('<tr class="success"><td><input type="hidden" name="stone[]" value="'+$('#product_update_form #m_stone').val()+'">'+$('#product_update_form #m_stone').find("option:selected").text()+'</td><td><input type="hidden" name="pcs[]" value="'+$('#product_update_form #m_pcs').val()+'">'+$('#product_update_form #m_pcs').val()+'</td><td><input type="hidden" name="cts[]" value="'+$('#product_update_form #m_cts').val()+'">'+$('#product_update_form #m_cts').val()+'</td><td><a href="#" class="remove"><span class="label label-danger">Remove</span></a></td></tr>'); //reseting value of input field $('#product_update_form #m_stone').val('0'); $('#product_update_form #m_pcs').val(''); $('#product_update_form #m_cts').val(''); } }); $('#product_update_form #m_metaltype').change(function() { var selected_value=$('#product_update_form #m_metaltype').find("option:selected").text() if($('#product_update_form #m_metaltype').val()!=='0') { fill_metal_combo(selected_value,user_form='update'); } }); /*function starts for dealing with errors*/ $("input").change(function(){ $(this).parent().parent().removeClass('has-error'); $(this).next().empty(); }); $("textarea").change(function(){ $(this).parent().parent().removeClass('has-error'); $(this).next().empty(); }); $("select").change(function(){ $(this).parent().parent().removeClass('has-error'); $(this).next().empty(); }); /*functon ends for dealing errors*/ $('#m_metaltype').change(function() { var selected_value=$('#m_metaltype').find("option:selected").text() if($('#m_metaltype').val()!=='0') { fill_metal_combo(selected_value,save='save'); } }); //add new product $('#btn_product_add').click(function() { var formData = new FormData($('#product_add_form')[0]); $(this).prop('disabled',true); $(this).text('Saving........'); $.ajax({ url: '<?php echo(site_url("product/add")) ?>', type: 'POST', dataType: 'json', cache: false, contentType: false, processData: false, data: formData,/*$('#product_add_form').serialize(),*/ success:function(data) { console.log(data); if(data.status==false) { $('#btn_product_add').prop('disabled',false); $('#btn_product_add').text('Save'); $.each(data, function(index, val) { $('#product_add_form #'+val.error_string).next().html(val.input_error); $('#product_add_form #'+val.error_string).parent().parent().addClass('has-error'); }); } else { $('#product_save_message').show(); location.reload(); } }, error:function(data) { alert("An error occured please contact capital eye for technical support"); } }) .fail(function() { console.log("error"); }); }); $('#btn_product_update').click(function() { var formData = new FormData($('#product_update_form')[0]); $(this).prop('disabled',true); $(this).text('Updating........'); $.ajax({ url: '<?php echo(site_url("product/update")) ?>'+'/'+productid, type: 'POST', dataType: 'json', cache: false, contentType: false, processData: false, data: formData,/*$('#product_add_form').serialize(),*/ success:function(data) { console.log(data); if(data.status==false) { $('#btn_product_update').prop('disabled',false); $('#btn_product_update').text('Update'); $.each(data, function(index, val) { $('#product_update_form #'+val.error_string).next().html(val.input_error); $('#product_update_form #'+val.error_string).parent().parent().addClass('has-error'); }); } else { $('#product_update_message').show(); location.reload(); } }, error:function(data) { $('#btn_product_update').prop('disabled',false); alert("An error occured please contact capital eye for technical support"); } }) .fail(function() { console.log("error"); }); }); }); function fill_metal_combo(metal_type,user_form) { if(user_form!=='update') { $.ajax({ url: '<?php echo("product/fill_metal_combo") ?>'+'/'+metal_type, type: 'POST', dataType: 'json', success:function(data) { $('#m_metal').empty(); $('#m_metal').append('<option value="0">--Please select metal--</option>'); $.each(data, function(index, val) { var temp_opt='<option value="'+val.metal_id+'">'+val.metal+'</option>'; $('#m_metal').append(temp_opt); }); } }) .done(function() { console.log("success"); }) .fail(function() { console.log("error"); }) .always(function() { console.log("complete"); }); } else { $.ajax({ url: '<?php echo("product/fill_metal_combo") ?>'+'/'+metal_type, type: 'POST', dataType: 'json', success:function(data) { $('#product_update_form #m_metal').empty(); $('#product_update_form #m_metal').append('<option value="0">--Please select metal--</option>'); $.each(data, function(index, val) { var temp_opt='<option value="'+val.metal_id+'">'+val.metal+'</option>'; $('#product_update_form #m_metal').append(temp_opt); }); } }) .fail(function() { console.log("error"); }); } } </script> <script type="text/javascript"> var i=0; $('#product_table tfoot th').each( function () { i++; var title = $(this).text(); $(this).html( '<input type="text" class="search-input-text" placeholder="Search'+title+'" data-column="'+i+'" size="10"/>' ); } ); $('.search-input-text').keyup( function () { // for text boxes var i =$(this).attr('data-column'); // getting column index var v =$(this).val(); // getting search input value table.columns(i).search(v).draw(); } ); table = $('#product_table').DataTable({ "processing": true, //Feature control the processing indicator. "serverSide": true, //Feature control DataTables' server-side processing mode. "order": [], //Initial no order. // Load data for the table's content from an Ajax source "ajax": { "url": "<?php echo site_url('product/ajax_list')?>", "type": "POST" }, //Set column definition initialisation properties. "columnDefs": [ { "targets": [ -1,-2 ], //last column "orderable": false, //set not orderable }, ], }); </script>
amttmg/rb
application/views/pages/products/product_view.php
PHP
mit
44,293
--- title: 2.3.24 tags: Sort weight: 2324 date: 2018-08-05 22:04:15 --- # 2.3.24 ## 解答 取样排序的想法很简单: 常规快排的枢轴只有一个。 如果用一个数组来充当枢轴,根据排序位置的不同自动选择对应的枢轴, 显然能够更好的估计中位数,以求更好的切分效果。 于是引入了「取样」的概念,假如我们从源数组中随机取了 3 个元素并对其排序, 那么这 3 个元素的中位数可以作为第一次切分的枢轴,剩余两个元素则可以充当切分后两个子数组的枢轴。 那么当取样元素到达一个合适的数量时,就能达到提升切分效率的目标。 大致思路如下: 首先先从输入数组里随机取一些元素,作为「取样数组」。 用任意排序算法(比如快排)对取样数组进行排序。 (由于取样数组通常都比较小,这一步的时间消耗通常不会影响性能) 取出取样数组里面的中位数,当作枢轴对剩下的数组进行切分。 之后的切分中,根据排序区间在剩余数组中的相对位置, 用取样数组中对应位置的数作为枢轴,直到整个排序完成。 论文里提到了两种实现方式。 第一种方法 取样数组和剩余数组是分开保存的。 每次切分完成后,并不把枢轴放入剩余数组中, 而是等到剩余数组全部排序完毕之后再用一次归并(merge)操作将取样数组和剩余数组归并。 第二种方法 取样数组和剩余数组保存在同一片空间里,这也是这份题解所实现的方法。 ![](/resources/2-3-24/1.gif) 在打乱输入数组之后,取前 2^k-1 个元素作为取样数组,用快排对其排序。 然后把取样数组的后半部分放到整个数组的末尾。 这样操作的结果是输入数组分为了四个部分: 有序的取样数组、取样数组的中位数、无序的剩余数组、有序的取样数组。 中位数则位于第一部分的末尾,我们将其作为枢轴对剩余数组进行切分,数组变为: 有序的取样数组、小于中位数的部分、枢轴、大于中位数的部分、有序的取样数组 接下来我们再对第一个部分取半,放到中位数之前;对最后一部分取半,放到中位数之后: 0 ~ 1/4 取样数组、小于中位数、1/4 ~ 1/2 取样数组、枢轴、1/2~3/4 取样数组、大于中位数、3/4~1 取样数组 你会发现枢轴前后又分别变回了初始条件,递归执行上述操作,便能对整个数组排序。 注意当取样数组用完的时候,直接变回普通的快排。 现代的取样排序 这里的「现代」并不意味着更好,只是让取样排序能更好的适应多线程排序。 首先仍然是取样,取样的数量往往取决于线程的数量,比如说取了 p-1 个,就将数组分为 p 份。 对取样数组进行排序,获得 p 个区间(桶)。 遍历输入的数组,把元素扔到相应的桶里面。 把每个桶和对应的枢轴送到对应的线程进行排序。 汇总各个桶中的结果,排序完毕。 测试结果: ![](/resources/2-3-24/2.png) 大概能提升 5%~10% 的性能。 ## 代码 ```csharp using System; using System.Diagnostics; namespace Quick { /// <summary> /// 取样排序类。 /// </summary> public class SampleSort : QuickSort { /// <summary> /// 取样数组长度 2^k - 1 的阶数。 /// </summary> public int K { get; set; } /// <summary> /// 默认构造函数。 /// </summary> public SampleSort() { this.K = 8; } /// <summary> /// 用快速排序对数组 a 进行升序排序。 /// </summary> /// <typeparam name="T">需要排序的类型。</typeparam> /// <param name="a">需要排序的数组。</param> public override void Sort<T>(T[] a) { if (a.Length < Math.Pow(2, this.K + 1)) { // 小于 2^(k+1) 的数组直接进行快排 base.Sort(a); return; } Shuffle(a); int samplehi = (int)Math.Pow(2, this.K) - 2; // 利用快速排序对取样数组进行排序 base.Sort(a, 0, samplehi); // 找到取样数组的中位数 int sampleMedian = samplehi / 2; // 将取样数组后半部分放到数组末尾 int i = samplehi, j = a.Length - 1; while (i != sampleMedian) Exch(a, i--, j--); // 根据取样数组进行排序 Sort(a, 0, sampleMedian, j, a.Length - 1); Debug.Assert(IsSorted(a)); } /// <summary> /// 用快速排序对数组 a 的 lo ~ hi 范围排序。 /// </summary> /// <typeparam name="T">需要排序的数组类型。</typeparam> /// <param name="a">需要排序的数组。</param> /// <param name="samplelo">取样数组的起始下标。</param> /// <param name="lo">排序范围的起始下标。</param> /// <param name="hi">排序范围的结束下标。</param> /// <param name="samplehi">取样数组的终止下标。</param> private void Sort<T>(T[] a, int samplelo, int lo, int hi, int samplehi) where T : IComparable<T> { if (hi <= lo) // 别越界 return; int j = Partition(a, lo, hi); // 将前部的有序取样数组取半,后半部分放在枢轴前面。 if (lo - samplelo > 1) { // p 应该始终指向有序部分的最后一项 // v 应该始终指向有序部分的前面一项 int p = lo - 1, v = j - 1; for (int i = 0; i < (lo - samplelo) / 2; i++) { Exch(a, p--, v--); } Sort(a, samplelo, p, v, j - 1); } else { // 取样数组已经用完,退化为普通 Quicksort base.Sort(a, samplelo, j - 1); } // 将尾部有序取样数组取半,前半部分放在枢轴后面。 if (samplehi - hi > 1) { // p 应该始终指向有序部分的前面一项 // v 应该始终指向有序部分的最后一项 int p = hi, v = j; for (int i = 0; i < (samplehi - hi) / 2; i++) { Exch(a, ++p, ++v); } Sort(a, j + 1, v, p, samplehi); } else { // 取样数组已用完,退化为普通 Quicksort base.Sort(a, j + 1, samplehi); } } /// <summary> /// 对数组进行切分,返回枢轴位置。 /// </summary> /// <typeparam name="T">需要切分的数组类型。</typeparam> /// <param name="a">需要切分的数组。</param> /// <param name="lo">切分的起始点。</param> /// <param name="hi">切分的末尾点。</param> /// <returns>枢轴下标。</returns> private int Partition<T>(T[] a, int lo, int hi) where T : IComparable<T> { int i = lo, j = hi + 1; T v = a[lo]; while (true) { while (Less(a[++i], v)) if (i == hi) break; while (Less(v, a[--j])) if (j == lo) break; if (i >= j) break; Exch(a, i, j); } Exch(a, lo, j); return j; } /// <summary> /// 打乱数组。 /// </summary> /// <typeparam name="T">需要打乱的数组类型。</typeparam> /// <param name="a">需要打乱的数组。</param> private void Shuffle<T>(T[] a) { Random random = new Random(); for (int i = 0; i < a.Length; i++) { int r = i + random.Next(a.Length - i); T temp = a[i]; a[i] = a[r]; a[r] = temp; } } } } ``` 测试用例: ```csharp using System; using Quick; namespace _2._3._24 { /* * 2.3.24 * * 取样排序。(W.Frazer,A.McKellar) * 实现一个快速排序, * 取样大小为 2^k-1。首先将取样得到的元素排序, * 然后在递归函数中使用样品的中位数切分。 * 分为两部分的其余样品元素无需再次排序并可以分别应用于原数组的两个子数组。 * 这种算法称为取样排序。 * */ class Program { static void Main(string[] args) { QuickSort quickNormal = new QuickSort(); SampleSort sampleSort = new SampleSort(); int arraySize = 1600000; // 初始数组大小。 const int kSteps = 10; // 取样 k 值的递增次数。 const int trialTimes = 1; // 每次实验的重复次数。 const int trialLevel = 2; // 双倍递增的次数。 Console.WriteLine("k\tn\t\tsample\tnormal\tratio"); for (int i = 0; i < kSteps; i++) { int array = arraySize; for (int j = 0; j < trialLevel; j++) { double timeSample = 0; double timeNormal = 0; for (int k = 0; k < trialTimes; k++) { int[] a = SortCompare.GetRandomArrayInt(array); int[] b = new int[a.Length]; a.CopyTo(b, 0); timeNormal += SortCompare.Time(quickNormal, b); timeSample += SortCompare.Time(sampleSort, a); } timeSample /= trialTimes; timeNormal /= trialTimes; if (arraySize < 10000000) Console.WriteLine(sampleSort.K + "\t" + array + "\t\t" + timeSample + "\t" + timeNormal + "\t" + timeSample / timeNormal); else Console.WriteLine(sampleSort.K + "\t" + array + "\t" + timeSample + "\t" + timeNormal + "\t" + timeSample / timeNormal); array *= 2; } sampleSort.K++; } } } } ``` ## 另请参阅 关于取样排序的论文(1970 年): [Frazer W D, McKellar A C. Samplesort: A sampling approach to minimal storage tree sorting[J]. Journal of the ACM (JACM), 1970, 17(3): 496-507.](https://dl.acm.org/citation.cfm?id=321600) 维基百科中的取样排序: [Samplesort-Wikipedia](https://en.wikipedia.org/wiki/Samplesort) 本题用到的类库链接: [Quick 库](https://github.com/ikesnowy/Algorithms-4th-Edition-in-Csharp/tree/master/2%20Sorting/2.3/Quick)
ikesnowy/Algorithms-4th-Edition-in-Csharp
docs/content/2-3-24.md
Markdown
mit
11,249
/** * */ package com.zimbra.qa.selenium.projects.admin.ui; import com.zimbra.qa.selenium.framework.ui.*; import com.zimbra.qa.selenium.framework.util.HarnessException; /** * @author Matt Rhoades * */ public class PageManageServerStatus extends AbsTab { public static class Locators { public static final String zti__MONITORING__SSTATUS = "zti__AppAdmin__MONITORING__SSTATUS_textCell"; public static final String zRefreshButton = "zb__STALV__REFRESH_title"; } public PageManageServerStatus(AbsApplication application) { super(application); } /* (non-Javadoc) * @see projects.admin.ui.AbsTab#isActive() */ @Override public boolean zIsActive() throws HarnessException { // If the "Refresh" button is visible, assume the ServerStatus page is active // Look for the Refresh Button boolean present = sIsElementPresent(Locators.zRefreshButton); if ( !present ) { logger.debug("isActive() present = "+ present); return (false); } // Look for the Refresh Button. boolean visible = zIsVisiblePerPosition(Locators.zRefreshButton, 0, 0); if ( !visible ) { logger.debug("isActive() visible = "+ visible); return (false); } logger.debug("isActive() = "+ true); return (true); } /* (non-Javadoc) * @see projects.admin.ui.AbsTab#myPageName() */ @Override public String myPageName() { return (this.getClass().getName()); } /* (non-Javadoc) * @see projects.admin.ui.AbsTab#navigateTo() */ @Override public void zNavigateTo() throws HarnessException { if ( zIsActive() ) { // This page is already active. return; } // Click on Addresses -> Accounts zClick(Locators.zti__MONITORING__SSTATUS); zWaitForActive(); } @Override public AbsPage zListItem(Action action, String item) throws HarnessException { // TODO Auto-generated method stub return null; } @Override public AbsPage zListItem(Action action, Button option, String item) throws HarnessException { // TODO Auto-generated method stub return null; } @Override public AbsPage zListItem(Action action, Button option, Button subOption ,String item) throws HarnessException { // TODO Auto-generated method stub return null; } @Override public AbsPage zToolbarPressButton(Button button) throws HarnessException { // TODO Auto-generated method stub return null; } @Override public AbsPage zToolbarPressPulldown(Button pulldown, Button option) throws HarnessException { // TODO Auto-generated method stub return null; } }
nico01f/z-pec
ZimbraSelenium/src/java/com/zimbra/qa/selenium/projects/admin/ui/PageManageServerStatus.java
Java
mit
2,525
/* Template Name: PlusBusiness File: Featured Slider CSS Author: OS Templates Author URI: http://www.os-templates.com/ Licence: <a href="http://www.os-templates.com/template-terms">Website Template Licence</a> */ #featured_slide { position:relative; margin:0 auto 0; display:block; width:860px; height:260px; padding:20px 50px; overflow:hidden; font-size:12px; font-family:Verdana, Arial, Helvetica, sans-serif; color:#333333; background-color:#B2C629; } #featured_slide a{ color:#FFFFFF; background-color:#B2C629; } #featured_slide a, #featured_slide ul, #featured_slide img{ margin:0; padding:0; border:none; outline:none; list-style:none; text-decoration:none; } #featured_slide h1, #featured_slide h2, #featured_slide h3, #featured_slide h4, #featured_slide h5, #featured_slide h6{ margin:15px 0 10px 0; padding:0; line-height:normal; font-size:36px; font-weight:normal; font-family:Georgia, "Times New Roman", Times, serif; } /* ----------------------------------------------Start Carousel-------------------------------------*/ #featured_content, #featured_content ul{ display:block; width:860px; height:260px; margin:0; padding:0; list-style:none; overflow:hidden; } #featured_content li{ display:block; position:relative; width:860px; height:260px; overflow:hidden; } /* ----------------------------------------------Carousel Content-------------------------------------*/ #featured_content img{ display:block; float:right; width:380px; height:250px; margin:0 10px 0 0; padding:4px; border:1px solid #FFFFFF; } #featured_content .floater{ display:block; float:left; width:415px; height:250px; margin:0 0 0 10px; padding:0; overflow:hidden; } #featured_content p{ margin:0 0 20px 0; padding:0; line-height:1.6em; } #featured_content p.readmore{ display:block; width:100%; margin:0; padding:0; text-align:right; line-height:normal; font-weight:bold; } #featured_content p.readmore a{ padding:8px 15px 10px; color:#FFFFFF; background-color:#95AD19; } /* ----------------------------------------------Previous & Next Buttons-------------------------------------*/ #featured-item-prev, #featured-item-next{ display:block; position:absolute; top:118px; width:36px; height:64px; } #featured-item-prev {left:5px;} #featured-item-next {right:5px;} /* ---------------------------------------------------------------------------------------------------------- */ /* ---------------DO NOT CHANGE THE FOLLOWING CODE OTHERWISE THE FEATURED PANEL WONT WORK-------------------- */ /* ---------------------------------------------------------------------------------------------------------- */ /* Product Name: jCarousel Version: 0.2.3 Author: Jan Sorgalla Author URI: http://sorgalla.com/jcarousel/ Licence: Dual licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT</a> and <a href="http://www.opensource.org/licenses/gpl-license.php">GPL</a> licenses. */ .jcarousel-container{position:relative;} .jcarousel-clip{ z-index:2; padding:0; margin:0; overflow:hidden; position:relative; } .jcarousel-list{ z-index:1; overflow:hidden; position:relative; top:0; left:0; margin:0; padding:0; } .jcarousel-list li, .jcarousel-item{ float:left; list-style:none; width:75px; height:75px; } .jcarousel-next{ z-index:3; display:none; } .jcarousel-prev{ z-index:3; display:none; }
thunderenlight/test_NCC
styles/featured_slide.css
CSS
mit
3,593
package org.mars; public final class User { public User(int id, String name, String passwd) { this._id=id; this._name=name; this._passwd=passwd; } public final int get_uid() { return _id; } public final void set_uid(int _uid) { this._id = _uid; } public final String get_uname() { return _name; } public final void set_uname(String _uname) { this._name = _uname; } public final String get_passwd() { return _passwd; } public final void set_passwd(String _passwd) { this._passwd = _passwd; } public final String get_auth() { return _auth; } public final void set_auth(String _auth) { this._auth = _auth; } private int _id; private String _name; private String _passwd; private String _auth; }
junjiemars/ant-ivy
src/java/redis/src/org/mars/User.java
Java
mit
741
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * HTML class for a textarea type field * * PHP versions 4 and 5 * * LICENSE: This source file is subject to version 3.01 of the PHP license * that is available through the world-wide-web at the following URI: * http://www.php.net/license/3_01.txt If you did not receive a copy of * the PHP License and are unable to obtain it through the web, please * send a note to [email protected] so we can mail you a copy immediately. * * @category HTML * @package HTML_QuickForm * @author Adam Daniel <[email protected]> * @author Bertrand Mansion <[email protected]> * @copyright 2001-2007 The PHP Group * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @version CVS: $Id: textarea.php,v 1.1 2008-07-07 18:00:40 mrflos Exp $ * @link http://pear.php.net/package/HTML_QuickForm */ /** * Base class for form elements */ require_once BAZ_CHEMIN.'libs'.DIRECTORY_SEPARATOR.'vendor'.DIRECTORY_SEPARATOR.'HTML/QuickForm/element.php'; /** * HTML class for a textarea type field * * @category HTML * @package HTML_QuickForm * @author Adam Daniel <[email protected]> * @author Bertrand Mansion <[email protected]> * @version Release: 3.2.10 * @since 1.0 */ class HTML_QuickForm_textarea extends HTML_QuickForm_element { // {{{ properties /** * Field value * @var string * @since 1.0 * @access private */ public $_value = null; // }}} // {{{ constructor /** * Class constructor * * @param string Input field name attribute * @param mixed Label(s) for a field * @param mixed Either a typical HTML attribute string or an associative array * @since 1.0 * @access public * @return void */ public function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null) { HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes); $this->_persistantFreeze = true; $this->_type = 'textarea'; } //end constructor // }}} // {{{ setName() /** * Sets the input field name * * @param string $name Input field name attribute * @since 1.0 * @access public * @return void */ public function setName($name) { $this->updateAttributes(array('name'=>$name)); } //end func setName // }}} // {{{ getName() /** * Returns the element name * * @since 1.0 * @access public * @return string */ public function getName() { return $this->getAttribute('name'); } //end func getName // }}} // {{{ setValue() /** * Sets value for textarea element * * @param string $value Value for textarea element * @since 1.0 * @access public * @return void */ public function setValue($value) { $this->_value = $value; } //end func setValue // }}} // {{{ getValue() /** * Returns the value of the form element * * @since 1.0 * @access public * @return string */ public function getValue() { return $this->_value; } // end func getValue // }}} // {{{ setWrap() /** * Sets wrap type for textarea element * * @param string $wrap Wrap type * @since 1.0 * @access public * @return void */ public function setWrap($wrap) { $this->updateAttributes(array('wrap' => $wrap)); } //end func setWrap // }}} // {{{ setRows() /** * Sets height in rows for textarea element * * @param string $rows Height expressed in rows * @since 1.0 * @access public * @return void */ public function setRows($rows) { $this->updateAttributes(array('rows' => $rows)); } //end func setRows // }}} // {{{ setCols() /** * Sets width in cols for textarea element * * @param string $cols Width expressed in cols * @since 1.0 * @access public * @return void */ public function setCols($cols) { $this->updateAttributes(array('cols' => $cols)); } //end func setCols // }}} // {{{ toHtml() /** * Returns the textarea element in HTML * * @since 1.0 * @access public * @return string */ public function toHtml() { if ($this->_flagFrozen) { return $this->getFrozenHtml(); } else { return $this->_getTabs() . '<textarea' . $this->_getAttrString($this->_attributes) . '>' . // because we wrap the form later we don't want the text indented preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value, ENT_COMPAT, YW_CHARSET)) . '</textarea>'; } } //end func toHtml // }}} // {{{ getFrozenHtml() /** * Returns the value of field without HTML tags (in this case, value is changed to a mask) * * @since 1.0 * @access public * @return string */ public function getFrozenHtml() { $value = htmlspecialchars($this->getValue(), ENT_COMPAT, YW_CHARSET); if ($this->getAttribute('wrap') == 'off') { $html = $this->_getTabs() . '<pre>' . $value."</pre>\n"; } else { $html = nl2br($value)."\n"; } return $html . $this->_getPersistantData(); } //end func getFrozenHtml // }}} } //end class HTML_QuickForm_textarea
YesWiki/ferme
packages/yeswiki-cercopitheque/files/tools/bazar/libs/vendor/HTML/QuickForm/textarea.php
PHP
mit
5,769
<!DOCTYPE html> <html> <head> <title>Hello World!</title> </head> <body> <h1>Hello World!</h1> We are using node.js <script>document.write(process.version)</script>. <script charset="utf-8"> var gui = require('nw.gui'); // Get the current window var win = gui.Window.get(); var cwd = process.cwd(); var auth = function() { var options = { client_id: "695555703893-c0ejog53pgrs9tmq8g5osn7h7r4tclvc.apps.googleusercontent.com", redirect_uri: "urn:ietf:wg:oauth:2.0:oob", response_type: "code", scope: 'profile email https://mail.google.com/' } var authUrl = 'https://accounts.google.com/o/oauth2/auth'; var key = null; var i = 0; for (key in options) { if(i==0) { authUrl += '?' } else { authUrl += '&' } authUrl += key + '=' + options[key]; i++; } // Create a new window and get it var auth_win = gui.Window.get( window.open(authUrl, '_blank', 'location=no,toolbar=no') ); // And listen to new window's focus event auth_win.on('loaded', function() { var match = auth_win.title.match(/Success code=(.*)/); if(match!=null) { var code = match[1]; console.log(code); document.getElementById('code').innerHTML = "Signed In with token: " + code; document.getElementById('signin').innerHTML = ""; auth_win.close(true); } }); } </script> <div> <a id="signin" onclick="auth()" href="#">Sign In With Google!</a> <p id="code"></p> </div> </body> </html>
fdrei/inbox
src/app/index.html
HTML
mit
1,746
var gs = (function($) { var game = $.connection.gameHub; var server = game.server; var client = game.client; $(function() { // set up all the signalr stuff here :-) $.connection.hub.start().done(function() { game.client.playerJoined = function (name) { console.log("Player " + name + " joined the game"); if (typeof gs.onPlayerJoined === 'function') gs.onPlayerJoined(); }; game.client.playerLeft = function (name) { console.log("Player " + name + " left the game"); if (typeof gs.onPlayerLeft === 'function') gs.onPlayerLeft(); }; game.client.gameStarting = function () { if (typeof gs.onGameStarting === 'function') gs.onGameStarting(); }; game.client.gameStarted = function () { if (typeof gs.onGameStarted === 'function') gs.onGameStarted(); }; game.client.mazePieceCollected = function () { if (typeof gs.onMazePieceCollected === 'function') gs.onMazePieceCollected(); }; game.client.puzzlePiecePlaced = function () { if (typeof gs.onPuzzlePiecePlaced === 'function') gs.onPuzzlePiecePlaced(); }; game.client.gameCompleted = function () { if (typeof gs.onGameCompleted === 'function') gs.onGameCompleted(); }; }); }); return { createGame: function() { server.createGame(); }, joinGame: function() { server.joinGame(); }, startGame: function() { server.startGame(); }, ready: function() { server.playerReady(); }, moved: function() { server.playerMoved(); }, collect: function() { server.collectMazePiece(); }, place: function() { server.placePiece(); } }; }(jQuery))
tully2003/HACK24-2016
multi/content/js/game/game-server.js
JavaScript
mit
2,183
<?php namespace Wandu\DI\Providers\Doctrine; use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\CachedReader; use Doctrine\Common\Annotations\Reader; use Doctrine\Common\Cache\Cache; use Wandu\Config\Contracts\Config; use Wandu\DI\ContainerInterface; use Wandu\DI\ServiceProviderInterface; class AnnotationServiceProvider implements ServiceProviderInterface { public function register(ContainerInterface $app) { $app->closure(Reader::class, function (Cache $cache, Config $config) { return new CachedReader(new AnnotationReader(), $cache, $config->get('debug', true)); }); } public function boot(ContainerInterface $app) { } }
Wandu/Framework
src/Wandu/DI/Providers/Doctrine/AnnotationServiceProvider.php
PHP
mit
714
# $FreeBSD: release/9.2.0/usr.bin/ncal/Makefile 204706 2010-03-04 12:18:24Z edwin $ PROG= ncal DPADD= ${LIBCALENDAR} ${LIBTERMCAP} LDADD= -lcalendar -ltermcap LINKS= ${BINDIR}/ncal ${BINDIR}/cal MLINKS= ncal.1 cal.1 .include <bsd.prog.mk> ## cal コマンド作成 追加 cal: mv ./ncal ./cal #### memo # make the debug version. # > make DEBUG_FLAGS=-g
tonkachi/cal
Makefile
Makefile
mit
362
#!/usr/bin/env python3 from __future__ import division, print_function from monosat import * import functools import math from monosat import * import os from random import shuffle import random import random import sys import itertools import bz2 #note: for testing purposes, not recommended for practical pb solving! Monosat().newSolver("-verb=1 -pb-verb=1",output_file="/tmp/monosat_pb.gnf") if __name__ == "__main__": seed = random.randint(1,100000) filename=None if len(sys.argv)>1: filename=sys.argv[1] if len(sys.argv)>2: seed=int(sys.argv[2]) random.seed(seed) if filename is None: print("Usage: python3 read_pb.py <filename.opb>") sys.exit(0) used_vars = dict() goal = [] print("begin encode"); for line in (bz2.open(filename,"rt") if filename.endswith("bz2") else open(filename)): print(line, file=sys.stderr) line = line.strip(); if line.startswith("*"): continue if(line.endswith(";")): line = line[0:-1] #this is a goal line words = line.split() is_objective = False objective = None if words[0] == "min:" or words[0] == "max:": is_objective = True objective=words[0] if words[0]=="min:": objective="min" else: objective="max" words = words[1:] const = None comp = None rhs = None lits = [] pbs = [] weights = [] for w in words: if w.startswith("<") or w.startswith(">") or w.startswith("=") or w.startswith("!"): #this is a comparison if is_objective: raise Exception("Comparison in goal line") comp = w else: #try to convert w to a number try: assert (const is None) const = int(w) #this is a constant if comp is not None: rhs = const const=None break except: neg = False if w[0]=="~": neg = true() w = w[1:] assert(w[0]=="x") varnum = int(w[1:]) assert(varnum>0) if varnum not in used_vars: used_vars[varnum] = Var("x%d"%(varnum)).getLit() var = Var(used_vars[varnum]) if const is None: const = 1 lit = var if not neg else Not(var) lits.append(lit) pbs.append(varnum if not neg else -varnum) weights.append(const) const = None assert(const is None) assert(len(weights) == len(lits)) #print(lits) #print(weights) #print(comp) #print(rhs) if not is_objective: assert(comp is not None) assert(rhs is not None) if (comp =="<"): AssertLessThanPB(lits,rhs,weights); elif (comp ==">"): AssertGreaterThanPB(lits,rhs,weights); elif (comp =="<="): AssertLessEqPB(lits,rhs,weights); elif (comp ==">="): AssertGreaterEqPB(lits,rhs,weights); elif (comp.startswith("=")): AssertEqualPB(lits,rhs,weights); else: raise Exception("Unknown operator " + str(comp)) else: goal = [objective,lits,pbs,weights] assert(comp is None) assert(rhs is None) assert(objective is not None) if objective == "min": minimize(lits,weights) elif objective=="max": maximize(lits,weights) else: raise Exception("Unknown objective " + str(objective)) #print("RandomSeed=" + str(seed)) result=Solve() print("Result is " + str(result)) if result: witness = [] model = dict() witstr = "v "; for pb,l in used_vars.items(): lit = Var(l) if lit.value(): witstr+="x%d "%(pb) witness.append(pb) model[pb]=True model[-pb]=False elif lit.value()==False: witstr+="-x%d "%(pb) witness.append(-pb) model[pb]=False model[-pb]=True else: print("No full model for x%d"%(pb), file=sys.stderr) assert(False) witstr.rstrip(); goalval = 0 for pb,w in zip(goal[2],goal[3]): if pb not in model or -pb not in model: print("No model for x%d"%(pb), file=sys.stderr) assert(pb in model and -pb in model) if model[pb]: goalval+=w print("c Optimal solution: %d"%(goalval)) print("s OPTIMUM FOUND") print("o %d"%(goalval)) print(witstr) else: print("s UNSATISFIABLE")
sambayless/monosat
tests/python/read_pb.py
Python
mit
4,745
<html> <head> <link href="//gmpg.org/xfn/11" rel="profile"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>இன்றைய வசனம் &middot; புதிய உடன்படிக்கை</title> <meta name="mobile-web-app-capable" content="yes"> <meta name="HandheldFriendly" content="True" /> <meta name="MobileOptimized" content="320" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" type="text/css" media="only screen and (min-width: 900px)" href="/assets/css/desktop.css" /> <link rel="stylesheet" type="text/css" media="only screen and (max-width: 899px)" href="/assets/css/mobile.css" /> <link href="/assets/css/syntax.css" type="text/css" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css?family=Hind+Madurai:300,400,500,600,700" rel="stylesheet"> <link rel="apple-touch-icon" href="https://thenewcovenantofgod.github.io/assets/images/icon.png"> <link rel="shortcut icon" href="https://thenewcovenantofgod.github.io/assets/images/favicon.ico"> <link rel="alternate" type="application/rss+xml" title="RSS" href="https://thenewcovenantofgod.github.io/atom.xml"> <link href="/assets/css/font-awesome.min.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="/assets/js/jquery-2.1.0.min.js"></script> <!-- Begin Jekyll SEO tag v2.5.0 --> <title>இன்றைய வசனம் | புதிய உடன்படிக்கை</title> <meta name="generator" content="Jekyll v3.8.5" /> <meta property="og:title" content="இன்றைய வசனம்" /> <meta name="author" content="பயனற்ற பணியாள்" /> <meta property="og:locale" content="en_US" /> <meta name="description" content="அவர் அந்நாள்வரை அவர்களைப் பாதுகாத்திருந்தார்; அந்நாளில் அவர்கள்மீது தம் இரக்கத்தைப் பொழியத் தொடங்கியிருந்தார்" /> <meta property="og:description" content="அவர் அந்நாள்வரை அவர்களைப் பாதுகாத்திருந்தார்; அந்நாளில் அவர்கள்மீது தம் இரக்கத்தைப் பொழியத் தொடங்கியிருந்தார்" /> <link rel="canonical" href="https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122" /> <meta property="og:url" content="https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122" /> <meta property="og:site_name" content="புதிய உடன்படிக்கை" /> <meta property="og:type" content="article" /> <meta property="article:published_time" content="2022-01-26T00:00:00+05:30" /> <script type="application/ld+json"> {"url":"https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122","author":{"@type":"Person","name":"பயனற்ற பணியாள்"},"headline":"இன்றைய வசனம்","dateModified":"2022-01-26T09:05:27+05:30","description":"அவர் அந்நாள்வரை அவர்களைப் பாதுகாத்திருந்தார்; அந்நாளில் அவர்கள்மீது தம் இரக்கத்தைப் பொழியத் தொடங்கியிருந்தார்","datePublished":"2022-01-26T00:00:00+05:30","@type":"BlogPosting","mainEntityOfPage":{"@type":"WebPage","@id":"https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122"},"@context":"http://schema.org"}</script> <!-- End Jekyll SEO tag --> <!-- Theme Color for Chrome on Android Lollipop --> <meta name="theme-color" content="#302F2D"> </head> <body> <header class="clean" style="background-image: url(/media/vod.jpg); height: 100%; background-attachment: scroll;" data-stellar-background-ratio="0.5" data-stellar-horizontal-offset="50"> <label class="menu" for="_1"> <span class="fa fa-bars"></span> </label> <input id="_1" type="checkbox"> <div class="menu-content"> <p class="menu-title">புதிய உடன்படிக்கை<p> <div class="menu" style="background-color: #1a1a1a; z-index: -1;"></div> <a class="fa fa-home" href="/">&nbsp;முகப்பு</a> <a class="fa fa-info" href="/about">&nbsp;நோக்கம்</a> <a class="fa fa-tags" href="/tags">&nbsp;குறிச்சொற்கள்</a> <!-- <hr> <a href="https://feedly.com/i/subscription/feed/https://thenewcovenantofgod.github.io/atom.xml" class="social-links-menu" target="_blank" title="பதிவு செய்க"><span class="fa fa-rss"></span></a> --> </div> <div class="social-links" data-stellar-ratio="0.1"> <a href="https://feedly.com/i/subscription/feed/https://thenewcovenantofgod.github.io/atom.xml" target="_blank" title="பதிவு செய்க"><span class="fa fa-rss"></span></a> </div> <div id="post-info" data-stellar-ratio="0.7"> <ul class="tags"> <li><a href="/tags#இன்றைய-வசனம்" class="tag">இன்றைய-வசனம்</a></li> </ul> <h1>இன்றைய வசனம்</h1> <h2>நாளும் பொழுதும் இறைவனோடு துவங்கட்டும்</h2> <a class="site-title" href="https://thenewcovenantofgod.github.io"><div class="site-icon-small" style="background-image: url(/assets/images/icon.png);"></div>பயனற்ற பணியாள்</a> &middot; <span class="fa fa-calendar"></span> 26 சனவரி 2022 &middot; <span class="fa fa-comments"></span> <a href="https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122#disqus_thread"></a> </div> <div id="nav-icon" style="bottom: 30px;" data-stellar-ratio="4"> <a class="scroll" data-speed="500" href="#article"><span class="fa fa-angle-down"></span></a> </div> </header> <div id="middle"> <div id="article"> <h1 id="அவர்-அந்நாள்வரை-அவர்களைப்-பாதுகாத்திருந்தார்-அந்நாளில்-அவர்கள்மீது-தம்-இரக்கத்தைப்-பொழியத்-தொடங்கியிருந்தார்">அவர் அந்நாள்வரை அவர்களைப் பாதுகாத்திருந்தார்; அந்நாளில் அவர்கள்மீது தம் இரக்கத்தைப் பொழியத் தொடங்கியிருந்தார்</h1> <blockquote> <p style="text-align: justify; text-indent: 40px;"><sup>25</sup>தங்களை அடிமைகளாக வாங்க வந்திருந்தவர்களிடமிருந்து பணத்தைக் கைப்பற்றினார்கள். சிறிது தொலை பகைவர்களைத் துரத்திச் சென்றபின் ஏற்கெனவே நேரமாகிவிட்டதால் அவர்கள் திரும்பி வரவேண்டியதாயிற்று. <sup>26</sup>அன்று ஓய்வுநாளுக்கு முந்திய நாளாய் இருந்த காரணத்தால் நீண்ட தொலை அவர்களைத் துரத்திச்செல்லும் முயற்சியைக் கைவிட்டார்கள். <sup>27</sup>எதிரிகளின் படைக்கலங்களை ஒன்றுசேர்த்துப் பொருள்களைப் பறித்துக்கொண்ட பின் ஆண்டவரைப் போற்றி நன்றி கூறி ஓய்வுநாளைக் கடைப்பிடித்தார்கள்; ஏனெனில் அவர் அந்நாள்வரை அவர்களைப் பாதுகாத்திருந்தார்; அந்நாளில் அவர்கள்மீது தம் இரக்கத்தைப் பொழியத் தொடங்கியிருந்தார்.</p> <p style="text-align: right;">- 2 மக்கபேயர் 8:25-27</p> </blockquote> </div> <div id="comments"> <div id="disqus_thread"></div> <script type="text/javascript"> var disqus_shortname = 'thenewcovenantofgod'; var disqus_url = 'https://thenewcovenantofgod.github.io/verse-of-the-day/vod-260122'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> </div> </div> <footer class="clean" style="background-image: url(/media/vod.jpg); height: 75%; min-height: 500px; background-attachment: scroll;" data-stellar-background-ratio="0.5" data-stellar-horizontal-offset="50" data-stellar-vertical-offset="50"> <div id="nav-icon" style="top: 60px;" data-stellar-ratio="0.8"> <a class="scroll" data-speed="500" href="#article"><span class="fa fa-angle-up"></span></a> </div> <div id="post-info" data-stellar-ratio="0.5" data-stellar-vertical-offset="120"> <h3>அடுத்தது</h3> <a href="/verse-of-the-day/vod-270122"> <h1>இன்றைய வசனம்</h1> <h2>நாளும் பொழுதும் இறைவனோடு துவங்கட்டும்</h2> </a> </div> <p class="copyright">காப்புரிமம் <span class="fa fa-copyright"></span> 2022 &middot; <a href="https://thenewcovenantofgod.github.io/" target="_blank">புதிய உடன்படிக்கை வலைப்பதிவு</a> &middot; <a href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">அனைத்து உரிமைகளும் பதிவு செய்யப்பட்டு உள்ளன</a></p> </footer> <script src="/assets/js/smooth-scroll.js"></script> <script> var width = $(window).width() if ( width > 899 ) $( function(){ $.stellar({ responsive: true, verticalScrolling: true, horizontalOffset: 0, verticalOffset: 0, positionProperty: 'transform', }); }); </script> <script id="dsq-count-scr" src="//thenewcovenantofgod.disqus.com/count.js" async></script> </body> </html>
thenewcovenantofgod/thenewcovenantofgod.github.io
verse-of-the-day/vod-260122.html
HTML
mit
10,773
<a href='https://github.com/angular/angular.js/edit/master/src/Angular.js?message=docs(angular.isDate)%3A%20describe%20your%20change...#L562' class='improve-docs btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Improve this Doc</a> <a href='https://github.com/a-lucas/angular.js/tree/master/src/Angular.js#L562' class='view-source pull-right btn btn-primary'> <i class="glyphicon glyphicon-zoom-in">&nbsp;</i>View Source </a> <header class="api-profile-header"> <h1 class="api-profile-header-heading">angular.isDate</h1> <ol class="api-profile-header-structure naked-list step-list"> <li> - function in module <a href="api/ng">ng</a> </li> </ol> </header> <div class="api-profile-description"> <p>Determines if a value is a date.</p> </div> <div> <h2 id="usage">Usage</h2> <p><code>angular.isDate(value);</code></p> <section class="api-section"> <h3>Arguments</h3> <table class="variables-matrix input-arguments"> <thead> <tr> <th>Param</th> <th>Type</th> <th>Details</th> </tr> </thead> <tbody> <tr> <td> value </td> <td> <a href="" class="label type-hint type-hint-object">*</a> </td> <td> <p>Reference to check.</p> </td> </tr> </tbody> </table> </section> <h3>Returns</h3> <table class="variables-matrix return-arguments"> <tr> <td><a href="" class="label type-hint type-hint-boolean">boolean</a></td> <td><p>True if <code>value</code> is a <code>Date</code>.</p> </td> </tr> </table> </div>
a-lucas/angular.js
build/docs/partials/api/ng/function/angular.isDate.html
HTML
mit
1,671
use piston_window::*; use piston_window::types::*; use piston_window::character::CharacterCache; /// Prints text to the screen pub struct Printer { pub font_size: FontSize, pub glyphs: Glyphs, pub ctx: Context, line_nr: u32, left_padding: Scalar, } impl Printer { /// Create a new Printer pub fn new(font_size: FontSize, glyphs: Glyphs, ctx: Context) -> Printer { Printer { font_size: font_size, glyphs: glyphs, ctx: ctx, line_nr: 1, left_padding: 0.0 } } /// Goes to the next line pub fn newline(&mut self) { self.line_nr += 1; self.left_padding = 0.0; } /// Print without ending with a new line pub fn print(&mut self, string: &str, color: Color, g2d: &mut G2d) { text::Text::new_color(color, self.font_size) .draw( string, &mut self.glyphs, &self.ctx.draw_state, self.ctx.transform.trans(self.left_padding, Scalar::from(self.line_nr * self.font_size * 2)), g2d, ); self.left_padding += self.glyphs.width(self.font_size, string); } /// Print and end with a new line pub fn print_ln(&mut self, string: &str, color: Color, g2d: &mut G2d) { self.print(string, color, g2d); self.newline(); } /// Parse and print a molecule string in basic (non-nesting) LaTeX format, as provided by feroxide pub fn print_molecule_string(&mut self, molecule_string: &str, color: Color, g2d: &mut G2d) { let color_text_full = text::Text::new_color(color, self.font_size); let color_text_half = text::Text::new_color(color, self.font_size / 2); let mut is_subscript = false; let mut is_superscript = false; // Parse string for c in molecule_string.chars() { if c == '_' { is_subscript = true; continue; } else if c == '^' { is_superscript = true; continue; } else if c == '{' { continue; } else if c == '}' { is_subscript = false; is_superscript = false; continue; } // Get the correct Text to work with let text = if is_subscript || is_superscript { color_text_half } else { color_text_full }; // Calculate height let mut y = Scalar::from(self.line_nr * self.font_size * 2); if is_superscript { y -= Scalar::from(text.font_size); } // Draw text text.draw( &c.to_string(), &mut self.glyphs, &self.ctx.draw_state, self.ctx.transform.trans(self.left_padding, y), g2d, ); // Add left padding self.left_padding += self.glyphs.width(text.font_size, &c.to_string()); } } /// Print a molecule string with an added newline pub fn print_molecule_string_ln(&mut self, molecule_string: &str, color: Color, g2d: &mut G2d) { self.print_molecule_string(molecule_string, color, g2d); self.newline(); } }
feroxide/feroxide-gui
src/printer.rs
Rust
mit
3,425
<?php namespace HockeyStats\Bundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Prospect */ class Prospect { /** * @var integer */ private $id; /** * @var string */ private $name; /** * @var integer */ private $prospectID; /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name * @return Prospect */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set prospectID * * @param integer $prospectID * @return Prospect */ public function setProspectID($prospectID) { $this->prospectID = $prospectID; return $this; } /** * Get prospectID * * @return integer */ public function getProspectID() { return $this->prospectID; } }
ssollows/prospectwatcher
src/HockeyStats/Bundle/Entity/Prospect.php
PHP
mit
1,119
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); /* |-------------------------------------------------------------------------- | Active template |-------------------------------------------------------------------------- | | The $template['active_template'] setting lets you choose which template | group to make active. By default there is only one group (the | "default" group). | */ $template['active_template'] = 'default'; /* |-------------------------------------------------------------------------- | Explaination of template group variables |-------------------------------------------------------------------------- | | ['template'] The filename of your master template file in the Views folder. | Typically this file will contain a full XHTML skeleton that outputs your | full template or region per region. Include the file extension if other | than ".php" | ['regions'] Places within the template where your content may land. | You may also include default markup, wrappers and attributes here | (though not recommended). Region keys must be translatable into variables | (no spaces or dashes, etc) | ['parser'] The parser class/library to use for the parse_view() method | NOTE: See http://codeigniter.com/forums/viewthread/60050/P0/ for a good | Smarty Parser that works perfectly with Template | ['parse_template'] FALSE (default) to treat master template as a View. TRUE | to user parser (see above) on the master template | | Region information can be extended by setting the following variables: | ['content'] Must be an array! Use to set default region content | ['name'] A string to identify the region beyond what it is defined by its key. | ['wrapper'] An HTML element to wrap the region contents in. (We | recommend doing this in your template file.) | ['attributes'] Multidimensional array defining HTML attributes of the | wrapper. (We recommend doing this in your template file.) | | Example: | $template['default']['regions'] = array( | 'header' => array( | 'content' => array('<h1>Welcome</h1>','<p>Hello World</p>'), | 'name' => 'Page Header', | 'wrapper' => '<div>', | 'attributes' => array('id' => 'header', 'class' => 'clearfix') | ) | ); | */ /* |-------------------------------------------------------------------------- | Default Template Configuration (adjust this or create your own) |-------------------------------------------------------------------------- */ $template['default']['template'] = 'layout/landing.php'; $template['default']['regions'] = array( 'title'=>array('content' =>array('Landing Page')), 'app_info', 'app_icon', 'header', 'menu', 'app_name'=>array('content' =>array('Landing Page')), 'search', 'content', 'page_title', 'page_header', 'message', 'notifications', 'sidebar', 'action_button', 'footer' ); $template['default']['parser'] = 'parser'; $template['default']['parser_method'] = 'parse'; $template['default']['parse_template'] = FALSE; /* |-------------------------------------------------------------------------- | Second Template Configuration (adjust this or create your own) |-------------------------------------------------------------------------- */ $template['admin']['template']='layout/admin.php'; $template['error404']['template']='layout/error-404.php'; /* End of file template.php */ /* Location: ./system/application/config/template.php */
vthawat/study_outside
application/config/template.php
PHP
mit
3,460
<nav class="navbar navbar-default"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#frontend-navbar-collapse"> <span class="sr-only">{{__('Toggle Navigation')}}</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand">{{ config('amamarul-location.name') }}</a> </div><!--navbar-header--> <div class="collapse navbar-collapse" id="frontend-navbar-collapse"> <ul class="nav navbar-nav"> <li></li> </ul> <ul class="nav navbar-nav navbar-right"> </ul> </div><!--navbar-collapse--> </div><!--container--> </nav>
amamarul/laravel-json-locations-manager
src/views/includes/nav.blade.php
PHP
mit
902
#ifdef __OBJC__ #import <UIKit/UIKit.h> #else #ifndef FOUNDATION_EXPORT #if defined(__cplusplus) #define FOUNDATION_EXPORT extern "C" #else #define FOUNDATION_EXPORT extern #endif #endif #endif FOUNDATION_EXPORT double SipHashVersionNumber; FOUNDATION_EXPORT const unsigned char SipHashVersionString[];
primetimer/PrimeFactors
Example/Pods/Target Support Files/SipHash/SipHash-umbrella.h
C
mit
306
<?php namespace Comodojo\Cache\Drivers; use \Comodojo\Cache\Traits\InstanceTrait; use \Comodojo\Foundation\Utils\UniqueId; use \Memcached as MemcachedInstance; use \Exception; /** * @package Comodojo Spare Parts * @author Marco Giovinazzi <[email protected]> * @license MIT * * LICENSE: * * 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. */ class Memcached extends AbstractDriver { use InstanceTrait; const DRIVER_NAME = "memcached"; /** * {@inheritdoc} */ public function __construct(array $configuration = []) { if ( class_exists('Memcached') === false ) throw new Exception("ext-memcached not available"); $instance = new MemcachedInstance($configuration['persistent_id']); $instance->addServer( $configuration['server'], $configuration['port'], $configuration['weight'] ); if ( !empty($configuration['username']) && !empty($configuration['password']) ) { $instance->setOption(MemcachedInstance::OPT_BINARY_PROTOCOL, true); $instance->setSaslAuthData($configuration['username'], $configuration['password']); } $this->setInstance($instance); } /** * {@inheritdoc} */ public function test() { return sizeof($this->getInstance()->getServerList()) > 0 && $this->ping(); } public function ping() { // try to read a fake value from cache and check it's return code $instance = $this->getInstance(); $instance->get('cache-internals'); $code = $instance->getResultCode(); // check if code represents a failure // $code != [MEMCACHED_SUCCESS, MEMCACHED_NOTFOUND] return in_array($code, [0, 16]); } /** * {@inheritdoc} */ public function get($key, $namespace) { $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) return null; $shadowName = "$scope-$key"; $instance = $this->getInstance(); $item = $instance->get($shadowName); return $instance->getResultCode() == MemcachedInstance::RES_NOTFOUND ? null : $item; } /** * {@inheritdoc} */ public function set($key, $namespace, $value, $ttl = null) { if ( $ttl == null ) $ttl = 0; $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) $scope = $this->setNamespaceKey($namespace); if ( $scope === false ) return false; $shadowName = "$scope-$key"; return $this->getInstance()->set($shadowName, $value, $ttl); } /** * {@inheritdoc} */ public function delete($key, $namespace) { $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) return false; $shadowName = "$scope-$key"; return $this->getInstance()->delete($shadowName); } /** * {@inheritdoc} */ public function clear($namespace = null) { if ( $namespace == null ) { return $this->getInstance()->flush(); } else { $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) return false; return $this->getInstance()->delete($namespace); } } /** * {@inheritdoc} */ public function getMultiple(array $keys, $namespace) { if ( empty($keys) ) return []; $keypad = array_combine($keys, array_fill(0, count($keys), null)); $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) return $keypad; $keyscope = array_map(function($key) use($scope) { return "$scope-$key"; }, $keys); if ( version_compare(phpversion(), '7.0.0', '<') ) { $data = $this->getInstance()->getMulti($keyscope, $null = null, MemcachedInstance::GET_PRESERVE_ORDER); } else { $data = $this->getInstance()->getMulti($keyscope, MemcachedInstance::GET_PRESERVE_ORDER); } $return = []; foreach ( $data as $scoped_key => $value ) { $key = substr($scoped_key, strlen("$scope-")); $return[$key] = $value; } return array_replace($keypad, $return); } /** * {@inheritdoc} */ public function setMultiple(array $key_values, $namespace, $ttl = null) { if ( $ttl == null ) $ttl = 0; $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) $scope = $this->setNamespaceKey($namespace); if ( $scope === false ) return false; $shadowNames = []; foreach ( $key_values as $key => $value ) { $shadowNames["$scope-$key"] = $value; } return $this->getInstance()->setMulti($shadowNames, $ttl); } /** * {@inheritdoc} */ public function deleteMultiple(array $keys, $namespace) { $scope = $this->getNamespaceKey($namespace); if ( $scope === false ) return false; $shadowNames = array_map(function($key) use($scope) { return "$scope-$key"; }, $keys); $delete = $this->getInstance()->deleteMulti($shadowNames); return count(array_diff(array_unique($delete), [true])) === 0; } /** * {@inheritdoc} */ public function has($key, $namespace) { return $this->get($key, $namespace) === null ? false : true; } /** * {@inheritdoc} */ public function stats() { return $this->getInstance()->getStats(); } /** * Set namespace key * * @return mixed */ private function setNamespaceKey($namespace) { $uId = UniqueId::generate(64); return $this->getInstance()->set($namespace, $uId, 0) === false ? false : $uId; } /** * Get namespace key * * @return string */ private function getNamespaceKey($namespace) { return $this->getInstance()->get($namespace); } }
comodojo/cache
src/Comodojo/Cache/Drivers/Memcached.php
PHP
mit
6,450
from django.conf import settings from django.contrib.auth.decorators import user_passes_test from django.core.paginator import Paginator, InvalidPage from django.core.urlresolvers import reverse, resolve, Resolver404 from django.http import Http404, HttpResponseRedirect, HttpResponse from django.shortcuts import render_to_response from django.utils.encoding import smart_unicode, force_unicode, iri_to_uri from django.utils.translation import ugettext_lazy as _ from django.views.decorators.cache import never_cache from rosetta.polib import pofile from rosetta.poutil import find_pos, pagination_range from rosetta.conf import settings as rosetta_settings import re, os, rosetta, datetime, unicodedata from django.template import RequestContext try: resolve(settings.LOGIN_URL) except Resolver404: try: resolve('/admin/') except Resolver404: raise Exception('Rosetta cannot log you in!\nYou must define a LOGIN_URL in your settings if you don\'t run the Django admin site at a standard URL.') else: LOGIN_URL = '/admin/' else: LOGIN_URL = settings.LOGIN_URL def get_mofile(fn): root, ext = os.path.splitext(fn) return str(root + '.mo') def home(request): """ Displays a list of messages to be translated """ def fix_nls(in_,out_): """Fixes submitted translations by filtering carriage returns and pairing newlines at the begging and end of the translated string with the original """ if 0 == len(in_) or 0 == len(out_): return out_ if "\r" in out_ and "\r" not in in_: out_=out_.replace("\r",'') if "\n" == in_[0] and "\n" != out_[0]: out_ = "\n" + out_ elif "\n" != in_[0] and "\n" == out_[0]: out_ = out_.lstrip() if "\n" == in_[-1] and "\n" != out_[-1]: out_ = out_ + "\n" elif "\n" != in_[-1] and "\n" == out_[-1]: out_ = out_.rstrip() return out_ version = rosetta.get_version(True) if 'rosetta_i18n_fn' in request.session: rosetta_i18n_fn=request.session.get('rosetta_i18n_fn') rosetta_i18n_app = get_app_name(rosetta_i18n_fn) rosetta_i18n_pofile = request.session.get('rosetta_i18n_pofile') rosetta_i18n_lang_code = request.session['rosetta_i18n_lang_code'] rosetta_i18n_lang_bidi = (rosetta_i18n_lang_code in settings.LANGUAGES_BIDI) rosetta_i18n_write = request.session.get('rosetta_i18n_write', True) if 'filter' in request.GET: if request.GET.get('filter') in ('untranslated', 'translated', 'fuzzy', 'all'): filter_ = request.GET.get('filter') request.session['rosetta_i18n_filter'] = filter_ return HttpResponseRedirect(reverse('rosetta-home')) rosetta_i18n_filter = request.session.get('rosetta_i18n_filter', 'all') if '_next' in request.POST: rx=re.compile(r'^m_([0-9]+)') rx_plural=re.compile(r'^m_([0-9]+)_([0-9]+)') file_change = False for k in request.POST.keys(): if rx_plural.match(k): id=int(rx_plural.match(k).groups()[0]) idx=int(rx_plural.match(k).groups()[1]) rosetta_i18n_pofile[id].msgstr_plural[str(idx)] = fix_nls(rosetta_i18n_pofile[id].msgid_plural[idx], request.POST.get(k)) file_change = True elif rx.match(k): id=int(rx.match(k).groups()[0]) rosetta_i18n_pofile[id].msgstr = fix_nls(rosetta_i18n_pofile[id].msgid, request.POST.get(k)) file_change = True if file_change and 'fuzzy' in rosetta_i18n_pofile[id].flags and not request.POST.get('f_%d' %id, False): rosetta_i18n_pofile[id].flags.remove('fuzzy') elif file_change and 'fuzzy' not in rosetta_i18n_pofile[id].flags and request.POST.get('f_%d' %id, False): rosetta_i18n_pofile[id].flags.append('fuzzy') if file_change and rosetta_i18n_write: try: rosetta_i18n_pofile.metadata['Last-Translator'] = unicodedata.normalize('NFKD', u"%s %s <%s>" %(request.user.first_name,request.user.last_name,request.user.email)).encode('ascii', 'ignore') rosetta_i18n_pofile.metadata['X-Translated-Using'] = u"django-rosetta %s" % rosetta.get_version(False) rosetta_i18n_pofile.metadata['PO-Revision-Date'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M%z') except UnicodeDecodeError: pass try: rosetta_i18n_pofile.save() rosetta_i18n_pofile.save_as_mofile(get_mofile(rosetta_i18n_fn)) # Try auto-reloading via the WSGI daemon mode reload mechanism if rosetta_settings.WSGI_AUTO_RELOAD and \ request.environ.has_key('mod_wsgi.process_group') and \ request.environ.get('mod_wsgi.process_group',None) and \ request.environ.has_key('SCRIPT_FILENAME') and \ int(request.environ.get('mod_wsgi.script_reloading', '0')): try: os.utime(request.environ.get('SCRIPT_FILENAME'), None) except OSError: pass except: request.session['rosetta_i18n_write'] = False request.session['rosetta_i18n_pofile']=rosetta_i18n_pofile # Retain query arguments query_arg = '' if 'query' in request.REQUEST: query_arg = '?query=%s' %request.REQUEST.get('query') if 'page' in request.GET: if query_arg: query_arg = query_arg + '&' else: query_arg = '?' query_arg = query_arg + 'page=%d' % int(request.GET.get('page')) return HttpResponseRedirect(reverse('rosetta-home') + iri_to_uri(query_arg)) rosetta_i18n_lang_name = _(request.session.get('rosetta_i18n_lang_name')) rosetta_i18n_lang_code = request.session.get('rosetta_i18n_lang_code') if 'query' in request.REQUEST and request.REQUEST.get('query','').strip(): query=request.REQUEST.get('query').strip() rx=re.compile(re.escape(query), re.IGNORECASE) paginator = Paginator([e for e in rosetta_i18n_pofile if rx.search(smart_unicode(e.msgstr)+smart_unicode(e.msgid)+u''.join([o[0] for o in e.occurrences]))], rosetta_settings.MESSAGES_PER_PAGE) else: if rosetta_i18n_filter == 'untranslated': paginator = Paginator(rosetta_i18n_pofile.untranslated_entries(), rosetta_settings.MESSAGES_PER_PAGE) elif rosetta_i18n_filter == 'translated': paginator = Paginator(rosetta_i18n_pofile.translated_entries(), rosetta_settings.MESSAGES_PER_PAGE) elif rosetta_i18n_filter == 'fuzzy': paginator = Paginator(rosetta_i18n_pofile.fuzzy_entries(), rosetta_settings.MESSAGES_PER_PAGE) else: paginator = Paginator([e for e in rosetta_i18n_pofile if not e.obsolete], rosetta_settings.MESSAGES_PER_PAGE) if 'page' in request.GET and int(request.GET.get('page')) <= paginator.num_pages and int(request.GET.get('page')) > 0: page = int(request.GET.get('page')) else: page = 1 messages = paginator.page(page).object_list if rosetta_settings.MAIN_LANGUAGE and rosetta_settings.MAIN_LANGUAGE != rosetta_i18n_lang_code: main_language = None for language in settings.LANGUAGES: if language[0] == rosetta_settings.MAIN_LANGUAGE: main_language = _(language[1]) break fl = ("/%s/" % rosetta_settings.MAIN_LANGUAGE).join(rosetta_i18n_fn.split("/%s/" % rosetta_i18n_lang_code)) po = pofile(fl) main_messages = [] for message in messages: message.main_lang = po.find(message.msgid).msgstr needs_pagination = paginator.num_pages > 1 if needs_pagination: if paginator.num_pages >= 10: page_range = pagination_range(1, paginator.num_pages, page) else: page_range = range(1,1+paginator.num_pages) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX ENABLE_TRANSLATION_SUGGESTIONS = rosetta_settings.ENABLE_TRANSLATION_SUGGESTIONS MESSAGES_SOURCE_LANGUAGE_NAME = rosetta_settings.MESSAGES_SOURCE_LANGUAGE_NAME MESSAGES_SOURCE_LANGUAGE_CODE = rosetta_settings.MESSAGES_SOURCE_LANGUAGE_CODE return render_to_response('rosetta/pofile.html', locals(), context_instance=RequestContext(request)) else: return list_languages(request) home=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(home) home=never_cache(home) def download_file(request): import zipfile, os from StringIO import StringIO # original filename rosetta_i18n_fn=request.session.get('rosetta_i18n_fn', None) # in-session modified catalog rosetta_i18n_pofile = request.session.get('rosetta_i18n_pofile', None) # language code rosetta_i18n_lang_code = request.session.get('rosetta_i18n_lang_code', None) if not rosetta_i18n_lang_code or not rosetta_i18n_pofile or not rosetta_i18n_fn: return HttpResponseRedirect(reverse('rosetta-home')) try: if len(rosetta_i18n_fn.split('/')) >= 5: offered_fn = '_'.join(rosetta_i18n_fn.split('/')[-5:]) else: offered_fn = rosetta_i18n_fn.split('/')[-1] po_fn = str(rosetta_i18n_fn.split('/')[-1]) mo_fn = get_mofile(po_fn) zipdata = StringIO() zipf = zipfile.ZipFile(zipdata, mode="w") zipf.writestr(po_fn, str(rosetta_i18n_pofile)) zipf.writestr(mo_fn, rosetta_i18n_pofile.to_binary()) zipf.close() zipdata.seek(0) response = HttpResponse(zipdata.read()) response['Content-Disposition'] = 'attachment; filename=%s.%s.zip' %(offered_fn,rosetta_i18n_lang_code) response['Content-Type'] = 'application/x-zip' return response except Exception, e: return HttpResponseRedirect(reverse('rosetta-home')) download_file=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(download_file) download_file=never_cache(download_file) def list_languages(request): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ languages = [] do_django = 'django' in request.GET do_rosetta = 'rosetta' in request.GET has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0],include_djangos=do_django,include_rosetta=do_rosetta) has_pos = has_pos or len(pos) languages.append( (language[0], _(language[1]), [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], ) ) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX version = rosetta.get_version(True) return render_to_response('rosetta/languages.html', locals(), context_instance=RequestContext(request)) list_languages=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(list_languages) list_languages=never_cache(list_languages) def get_app_name(path): app = path.split("/locale")[0].split("/")[-1] return app def lang_sel(request,langid,idx): """ Selects a file to be translated """ if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: do_django = 'django' in request.GET do_rosetta = 'rosetta' in request.GET file_ = find_pos(langid,include_djangos=do_django,include_rosetta=do_rosetta)[int(idx)] request.session['rosetta_i18n_lang_code'] = langid request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for i in range(len(po)): po[i].id = i request.session['rosetta_i18n_pofile'] = po try: os.utime(file_,None) request.session['rosetta_i18n_write'] = True except OSError: request.session['rosetta_i18n_write'] = False return HttpResponseRedirect(reverse('rosetta-home')) lang_sel=user_passes_test(lambda user:can_translate(user),LOGIN_URL)(lang_sel) lang_sel=never_cache(lang_sel) def can_translate(user): if not user.is_authenticated(): return False elif user.is_superuser: return True else: try: from django.contrib.auth.models import Group translators = Group.objects.get(name='translators') return translators in user.groups.all() except Group.DoesNotExist: return False
rob-b/Django-Rosetta
rosetta/views.py
Python
mit
13,641
module Halftime VERSION = "0.0.1" end
calleerlandsson/halftime
lib/halftime/version.rb
Ruby
mit
40
// Copyright (c) 2015 fjz13. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. #pragma once #include "IButton.h" MEDUSA_BEGIN; class TextureButton :public IButton { MEDUSA_NODE(TextureButton,IButton); public: TextureButton(StringRef name = StringRef::Empty, const IEventArg& e = IEventArg::Empty); TextureButton(StringRef name, const FileIdRef& normalTextureName, const FileIdRef& selectedTextureName = FileIdRef::Empty, const FileIdRef& disabledTextureName = FileIdRef::Empty, const FileIdRef& disabledSelectedTextureName = FileIdRef::Empty); virtual ~TextureButton(void); virtual bool Initialize() override; FileIdRef NormalTextureName() const { return mNormalTextureName.ToRef(); } void SetNormalTextureName(const FileIdRef& val); FileIdRef SelectedTextureName() const { return mSelectedTextureName.ToRef(); } void SetSelectedTextureName(const FileIdRef& val); FileIdRef DisabledTextureName() const { return mDisabledTextureName.ToRef(); } void SetDisabledTextureName(const FileIdRef& val); FileIdRef DisabledSelectedTextureName() const { return mDisabledSelectedTextureName.ToRef(); } void SetDisabledSelectedTextureName(const FileIdRef& val); bool IsNineGridEnabled() const { return mIsNineGridEnabled; } void EnableNineGrid(bool val); const ThicknessF& TexturePadding() const { return mTexturePadding; } void SetTexturePadding(const ThicknessF& val); protected: virtual void OnMoveableDirty(MoveableChangedFlags changedFlags) override; virtual void OnUpdateMesh(); void SetImage(const FileIdRef& image); virtual void OnButtonStateChanged() override; protected: FileId mNormalTextureName; FileId mSelectedTextureName; FileId mDisabledTextureName; FileId mDisabledSelectedTextureName; bool mIsNineGridEnabled=false; Size2F mTargetSize; ThicknessF mTexturePadding; }; MEDUSA_ENABLE_STATIC_CONSTRUCTOR(TextureButton); MEDUSA_END;
fjz13/Medusa
Medusa/Medusa/Node/Control/Button/TextureButton.h
C
mit
1,945
/* The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is OpenFAST. The Initial Developer of the Original Code is The LaSalle Technology Group, LLC. Portions created by The LaSalle Technology Group, LLC are Copyright (C) The LaSalle Technology Group, LLC. All Rights Reserved. Contributor(s): Jacob Northey <[email protected]> Craig Otis <[email protected]> */ /** * */ package org.openfast.template.type.codec; import java.io.InputStream; import java.io.UnsupportedEncodingException; import org.openfast.ByteVectorValue; import org.openfast.ScalarValue; import org.openfast.StringValue; import org.openfast.error.FastConstants; import org.openfast.error.FastException; final class NullableUnicodeString extends NotStopBitEncodedTypeCodec { private static final long serialVersionUID = 1L; NullableUnicodeString() { } /** * Takes a ScalarValue object, and converts it to a byte array * * @param value * The ScalarValue to be encoded * @return Returns a byte array of the passed object */ public byte[] encodeValue(ScalarValue value) { if (value.isNull()) return TypeCodec.NULLABLE_BYTE_VECTOR_TYPE.encodeValue(ScalarValue.NULL); try { byte[] utf8encoding = ((StringValue) value).value.getBytes("UTF8"); return TypeCodec.NULLABLE_BYTE_VECTOR_TYPE.encode(new ByteVectorValue(utf8encoding)); } catch (UnsupportedEncodingException e) { throw new FastException("Apparently Unicode is no longer supported by Java.", FastConstants.IMPOSSIBLE_EXCEPTION, e); } } /** * Reads in a stream of data and stores it to a StringValue object * * @param in * The InputStream to be decoded * @return Returns a new StringValue object with the data stream as its * parameters */ public ScalarValue decode(InputStream in) { ScalarValue decodedValue = TypeCodec.NULLABLE_BYTE_VECTOR_TYPE.decode(in); if (decodedValue == null) return null; ByteVectorValue value = (ByteVectorValue) decodedValue; try { return new StringValue(new String(value.value, "UTF8")); } catch (UnsupportedEncodingException e) { throw new FastException("Apparently Unicode is no longer supported by Java.", FastConstants.IMPOSSIBLE_EXCEPTION, e); } } /** * @return Returns a new StringValue object with the passed value */ public ScalarValue fromString(String value) { return new StringValue(value); } /** * * @return Returns a new StringValue object with a default value */ public ScalarValue getDefaultValue() { return new StringValue(""); } public boolean equals(Object obj) { return obj != null && obj.getClass() == getClass(); } }
zkkz/OrientalExpress
source/openfast/src/org/openfast/template/type/codec/NullableUnicodeString.java
Java
mit
3,089
<?php namespace EntityManager517fd3200ac01_546a8d27f194334ee012bfe64f629947b07e4919\__CG__\Doctrine\ORM; /** * CG library enhanced proxy class. * * This code was generated automatically by the CG library, manual changes to it * will be lost upon next generation. */ class EntityManager extends \Doctrine\ORM\EntityManager { private $delegate; private $container; /** * Executes a function in a transaction. * * The function gets passed this EntityManager instance as an (optional) parameter. * * {@link flush} is invoked prior to transaction commit. * * If an exception occurs during execution of the function or flushing or transaction commit, * the transaction is rolled back, the EntityManager closed and the exception re-thrown. * * @param callable $func The function to execute transactionally. * @return mixed Returns the non-empty value returned from the closure or true instead */ public function transactional($func) { return $this->delegate->transactional($func); } /** * Performs a rollback on the underlying database connection. */ public function rollback() { return $this->delegate->rollback(); } /** * Removes an entity instance. * * A removed entity will be removed from the database at or before transaction commit * or as a result of the flush operation. * * @param object $entity The entity instance to remove. */ public function remove($entity) { return $this->delegate->remove($entity); } /** * Refreshes the persistent state of an entity from the database, * overriding any local changes that have not yet been persisted. * * @param object $entity The entity to refresh. */ public function refresh($entity) { return $this->delegate->refresh($entity); } /** * Tells the EntityManager to make an instance managed and persistent. * * The entity will be entered into the database at or before transaction * commit or as a result of the flush operation. * * NOTE: The persist operation always considers entities that are not yet known to * this EntityManager as NEW. Do not pass detached entities to the persist operation. * * @param object $object The instance to make managed and persistent. */ public function persist($entity) { return $this->delegate->persist($entity); } /** * Create a new instance for the given hydration mode. * * @param int $hydrationMode * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator */ public function newHydrator($hydrationMode) { return $this->delegate->newHydrator($hydrationMode); } /** * Merges the state of a detached entity into the persistence context * of this EntityManager and returns the managed copy of the entity. * The entity passed to merge will not become associated/managed with this EntityManager. * * @param object $entity The detached entity to merge into the persistence context. * @return object The managed copy of the entity. */ public function merge($entity) { return $this->delegate->merge($entity); } /** * Acquire a lock on the given entity. * * @param object $entity * @param int $lockMode * @param int $lockVersion * @throws OptimisticLockException * @throws PessimisticLockException */ public function lock($entity, $lockMode, $lockVersion = NULL) { return $this->delegate->lock($entity, $lockMode, $lockVersion); } /** * Check if the Entity manager is open or closed. * * @return bool */ public function isOpen() { return $this->delegate->isOpen(); } /** * Checks whether the state of the filter collection is clean. * * @return boolean True, if the filter collection is clean. */ public function isFiltersStateClean() { return $this->delegate->isFiltersStateClean(); } /** * Helper method to initialize a lazy loading proxy or persistent collection. * * This method is a no-op for other objects * * @param object $obj */ public function initializeObject($obj) { return $this->delegate->initializeObject($obj); } /** * Checks whether the Entity Manager has filters. * * @return True, if the EM has a filter collection. */ public function hasFilters() { return $this->delegate->hasFilters(); } /** * Gets the UnitOfWork used by the EntityManager to coordinate operations. * * @return \Doctrine\ORM\UnitOfWork */ public function getUnitOfWork() { return $this->delegate->getUnitOfWork(); } /** * Gets the repository for an entity class. * * @param string $entityName The name of the entity. * @return EntityRepository The repository class. */ public function getRepository($className) { $repository = $this->delegate->getRepository($className); if ($repository instanceof \Symfony\Component\DependencyInjection\ContainerAwareInterface) { $repository->setContainer($this->container); return $repository; } if (null !== $metadata = $this->container->get("jms_di_extra.metadata.metadata_factory")->getMetadataForClass(get_class($repository))) { foreach ($metadata->classMetadata as $classMetadata) { foreach ($classMetadata->methodCalls as $call) { list($method, $arguments) = $call; call_user_func_array(array($repository, $method), $this->prepareArguments($arguments)); } } } return $repository; } /** * Gets a reference to the entity identified by the given type and identifier * without actually loading it, if the entity is not yet loaded. * * @param string $entityName The name of the entity type. * @param mixed $id The entity identifier. * @return object The entity reference. */ public function getReference($entityName, $id) { return $this->delegate->getReference($entityName, $id); } /** * Gets the proxy factory used by the EntityManager to create entity proxies. * * @return ProxyFactory */ public function getProxyFactory() { return $this->delegate->getProxyFactory(); } /** * Gets a partial reference to the entity identified by the given type and identifier * without actually loading it, if the entity is not yet loaded. * * The returned reference may be a partial object if the entity is not yet loaded/managed. * If it is a partial object it will not initialize the rest of the entity state on access. * Thus you can only ever safely access the identifier of an entity obtained through * this method. * * The use-cases for partial references involve maintaining bidirectional associations * without loading one side of the association or to update an entity without loading it. * Note, however, that in the latter case the original (persistent) entity data will * never be visible to the application (especially not event listeners) as it will * never be loaded in the first place. * * @param string $entityName The name of the entity type. * @param mixed $identifier The entity identifier. * @return object The (partial) entity reference. */ public function getPartialReference($entityName, $identifier) { return $this->delegate->getPartialReference($entityName, $identifier); } /** * Gets the metadata factory used to gather the metadata of classes. * * @return \Doctrine\ORM\Mapping\ClassMetadataFactory */ public function getMetadataFactory() { return $this->delegate->getMetadataFactory(); } /** * Gets a hydrator for the given hydration mode. * * This method caches the hydrator instances which is used for all queries that don't * selectively iterate over the result. * * @param int $hydrationMode * @return \Doctrine\ORM\Internal\Hydration\AbstractHydrator */ public function getHydrator($hydrationMode) { return $this->delegate->getHydrator($hydrationMode); } /** * Gets the enabled filters. * * @return FilterCollection The active filter collection. */ public function getFilters() { return $this->delegate->getFilters(); } /** * Gets an ExpressionBuilder used for object-oriented construction of query expressions. * * Example: * * <code> * $qb = $em->createQueryBuilder(); * $expr = $em->getExpressionBuilder(); * $qb->select('u')->from('User', 'u') * ->where($expr->orX($expr->eq('u.id', 1), $expr->eq('u.id', 2))); * </code> * * @return \Doctrine\ORM\Query\Expr */ public function getExpressionBuilder() { return $this->delegate->getExpressionBuilder(); } /** * Gets the EventManager used by the EntityManager. * * @return \Doctrine\Common\EventManager */ public function getEventManager() { return $this->delegate->getEventManager(); } /** * Gets the database connection object used by the EntityManager. * * @return \Doctrine\DBAL\Connection */ public function getConnection() { return $this->delegate->getConnection(); } /** * Gets the Configuration used by the EntityManager. * * @return \Doctrine\ORM\Configuration */ public function getConfiguration() { return $this->delegate->getConfiguration(); } /** * Returns the ORM metadata descriptor for a class. * * The class name must be the fully-qualified class name without a leading backslash * (as it is returned by get_class($obj)) or an aliased class name. * * Examples: * MyProject\Domain\User * sales:PriceRequest * * @return \Doctrine\ORM\Mapping\ClassMetadata * @internal Performance-sensitive method. */ public function getClassMetadata($className) { return $this->delegate->getClassMetadata($className); } /** * Flushes all changes to objects that have been queued up to now to the database. * This effectively synchronizes the in-memory state of managed objects with the * database. * * If an entity is explicitly passed to this method only this entity and * the cascade-persist semantics + scheduled inserts/removals are synchronized. * * @param object $entity * @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that * makes use of optimistic locking fails. */ public function flush($entity = NULL) { return $this->delegate->flush($entity); } /** * Finds an Entity by its identifier. * * @param string $entityName * @param mixed $id * @param integer $lockMode * @param integer $lockVersion * * @return object */ public function find($entityName, $id, $lockMode = 0, $lockVersion = NULL) { return $this->delegate->find($entityName, $id, $lockMode, $lockVersion); } /** * Detaches an entity from the EntityManager, causing a managed entity to * become detached. Unflushed changes made to the entity if any * (including removal of the entity), will not be synchronized to the database. * Entities which previously referenced the detached entity will continue to * reference it. * * @param object $entity The entity to detach. */ public function detach($entity) { return $this->delegate->detach($entity); } /** * Create a QueryBuilder instance * * @return QueryBuilder $qb */ public function createQueryBuilder() { return $this->delegate->createQueryBuilder(); } /** * Creates a new Query object. * * @param string $dql The DQL string. * @return \Doctrine\ORM\Query */ public function createQuery($dql = '') { return $this->delegate->createQuery($dql); } /** * Creates a native SQL query. * * @param string $sql * @param ResultSetMapping $rsm The ResultSetMapping to use. * @return NativeQuery */ public function createNativeQuery($sql, \Doctrine\ORM\Query\ResultSetMapping $rsm) { return $this->delegate->createNativeQuery($sql, $rsm); } /** * Creates a Query from a named query. * * @param string $name * @return \Doctrine\ORM\Query */ public function createNamedQuery($name) { return $this->delegate->createNamedQuery($name); } /** * Creates a NativeQuery from a named native query. * * @param string $name * @return \Doctrine\ORM\NativeQuery */ public function createNamedNativeQuery($name) { return $this->delegate->createNamedNativeQuery($name); } /** * Creates a copy of the given entity. Can create a shallow or a deep copy. * * @param object $entity The entity to copy. * @return object The new entity. * @todo Implementation need. This is necessary since $e2 = clone $e1; throws an E_FATAL when access anything on $e: * Fatal error: Maximum function nesting level of '100' reached, aborting! */ public function copy($entity, $deep = false) { return $this->delegate->copy($entity, $deep); } /** * Determines whether an entity instance is managed in this EntityManager. * * @param object $entity * @return boolean TRUE if this EntityManager currently manages the given entity, FALSE otherwise. */ public function contains($entity) { return $this->delegate->contains($entity); } /** * Commits a transaction on the underlying database connection. */ public function commit() { return $this->delegate->commit(); } /** * Closes the EntityManager. All entities that are currently managed * by this EntityManager become detached. The EntityManager may no longer * be used after it is closed. */ public function close() { return $this->delegate->close(); } /** * Clears the EntityManager. All entities that are currently managed * by this EntityManager become detached. * * @param string $entityName if given, only entities of this type will get detached */ public function clear($entityName = NULL) { return $this->delegate->clear($entityName); } /** * Starts a transaction on the underlying database connection. */ public function beginTransaction() { return $this->delegate->beginTransaction(); } public function __construct($objectManager, \Symfony\Component\DependencyInjection\ContainerInterface $container) { $this->delegate = $objectManager; $this->container = $container; } private function prepareArguments(array $arguments) { $processed = array(); foreach ($arguments as $arg) { if ($arg instanceof \Symfony\Component\DependencyInjection\Reference) { $processed[] = $this->container->get((string) $arg, $arg->getInvalidBehavior()); } else if ($arg instanceof \Symfony\Component\DependencyInjection\Parameter) { $processed[] = $this->container->getParameter((string) $arg); } else { $processed[] = $arg; } } return $processed; } }
arwawi/enligne
app/cache/dev/jms_diextra/doctrine/EntityManager_517fd3200ac01.php
PHP
mit
16,022
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_22) on Thu Nov 11 09:12:13 EST 2010 --> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <TITLE> JspcMojo (Jetty Server Project 6.1.26 API) </TITLE> <META NAME="date" CONTENT="2010-11-11"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../javadoc.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="JspcMojo (Jetty Server Project 6.1.26 API)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JspcMojo.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV CLASS&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/mortbay/jetty/jspc/plugin/JspcMojo.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="JspcMojo.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.mortbay.jetty.jspc.plugin</FONT> <BR> Class JspcMojo</H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">org.apache.maven.plugin.AbstractMojo <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.mortbay.jetty.jspc.plugin.JspcMojo</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD>org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo</DD> </DL> <HR> <DL> <DT><PRE>public class <B>JspcMojo</B><DT>extends org.apache.maven.plugin.AbstractMojo</DL> </PRE> <P> <p> This goal will compile jsps for a webapp so that they can be included in a war. </p> <p> At runtime, the plugin will use the jsp2.0 jspc compiler if you are running on a 1.4 or lower jvm. If you are using a 1.5 jvm, then the jsp2.1 compiler will be selected. (this is the same behaviour as the <a href="http://jetty.mortbay.org/maven-plugin">jetty plugin</a> for executing webapps). </p> <p> Note that the same java compiler will be used as for on-the-fly compiled jsps, which will be the Eclipse java compiler. </p> <p> See <a href="http://docs.codehaus.org/display/JETTY/Maven+Jetty+Jspc+Plugin">Usage Guide</a> for instructions on using this plugin. </p> <P> <P> <DL> <DT><B>Author:</B></DT> <DD>janb</DD> </DL> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#END_OF_WEBAPP">END_OF_WEBAPP</A></B></CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="fields_inherited_from_class_org.apache.maven.plugin.Mojo"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Fields inherited from interface org.apache.maven.plugin.Mojo</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>ROLE</CODE></TD> </TR> </TABLE> &nbsp; <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#JspcMojo()">JspcMojo</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#cleanupSrcs()">cleanupSrcs</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Until Jasper supports the option to generate the srcs in a different dir than the classes, this is the best we can do.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#compile()">compile</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#execute()">execute</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/mortbay/jetty/jspc/plugin/JspcMojo.html#mergeWebXml()">mergeWebXml</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Take the web fragment and put it inside a copy of the web.xml file from the webAppSourceDirectory.</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_org.apache.maven.plugin.AbstractMojo"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class org.apache.maven.plugin.AbstractMojo</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>getLog, getPluginContext, setLog, setPluginContext</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="END_OF_WEBAPP"><!-- --></A><H3> END_OF_WEBAPP</H3> <PRE> public static final java.lang.String <B>END_OF_WEBAPP</B></PRE> <DL> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#org.mortbay.jetty.jspc.plugin.JspcMojo.END_OF_WEBAPP">Constant Field Values</A></DL> </DL> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="JspcMojo()"><!-- --></A><H3> JspcMojo</H3> <PRE> public <B>JspcMojo</B>()</PRE> <DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="execute()"><!-- --></A><H3> execute</H3> <PRE> public void <B>execute</B>() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException</PRE> <DL> <DD><DL> <DT><B>Throws:</B> <DD><CODE>org.apache.maven.plugin.MojoExecutionException</CODE> <DD><CODE>org.apache.maven.plugin.MojoFailureException</CODE></DL> </DD> </DL> <HR> <A NAME="compile()"><!-- --></A><H3> compile</H3> <PRE> public void <B>compile</B>() throws java.lang.Exception</PRE> <DL> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <HR> <A NAME="cleanupSrcs()"><!-- --></A><H3> cleanupSrcs</H3> <PRE> public void <B>cleanupSrcs</B>() throws java.lang.Exception</PRE> <DL> <DD>Until Jasper supports the option to generate the srcs in a different dir than the classes, this is the best we can do. <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <HR> <A NAME="mergeWebXml()"><!-- --></A><H3> mergeWebXml</H3> <PRE> public void <B>mergeWebXml</B>() throws java.lang.Exception</PRE> <DL> <DD>Take the web fragment and put it inside a copy of the web.xml file from the webAppSourceDirectory. You can specify the insertion point by specifying the string in the insertionMarker configuration entry. If you dont specify the insertionMarker, then the fragment will be inserted at the end of the file just before the &lt;/webapp&gt; <P> <DD><DL> <DT><B>Throws:</B> <DD><CODE>java.lang.Exception</CODE></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JspcMojo.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;PREV CLASS&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/mortbay/jetty/jspc/plugin/JspcMojo.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="JspcMojo.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> Copyright &#169; 1995-2010 <a href="http://www.mortbay.com">Mort Bay Consulting</a>. All Rights Reserved. </BODY> </HTML>
napcs/qedserver
jetty/javadoc/org/mortbay/jetty/jspc/plugin/JspcMojo.html
HTML
mit
15,440
# frozen_string_literal: true module I18n::Tasks module References # Given a raw usage tree and a tree of reference keys in the data, return 3 trees: # 1. Raw references -- a subset of the usages tree with keys that are reference key usages. # 2. Resolved references -- all the used references in their fully resolved form. # 3. Reference keys -- all the used reference keys. def process_references(usages, data_refs = merge_reference_trees(data_forest.select_keys { |_, node| node.reference? })) fail ArgumentError, 'usages must be a Data::Tree::Instance' unless usages.is_a?(Data::Tree::Siblings) fail ArgumentError, 'all_references must be a Data::Tree::Instance' unless data_refs.is_a?(Data::Tree::Siblings) raw_refs = empty_forest resolved_refs = empty_forest refs = empty_forest data_refs.key_to_node.each do |ref_key_part, ref_node| usages.each do |usage_node| next unless usage_node.key == ref_key_part if ref_node.leaf? process_leaf!(ref_node, usage_node, raw_refs, resolved_refs, refs) else process_non_leaf!(ref_node, usage_node, raw_refs, resolved_refs, refs) end end end [raw_refs, resolved_refs, refs] end private # @param [I18n::Tasks::Data::Tree::Node] ref # @param [I18n::Tasks::Data::Tree::Node] usage # @param [I18n::Tasks::Data::Tree::Siblings] raw_refs # @param [I18n::Tasks::Data::Tree::Siblings] resolved_refs # @param [I18n::Tasks::Data::Tree::Siblings] refs def process_leaf!(ref, usage, raw_refs, resolved_refs, refs) refs.merge_node!(Data::Tree::Node.new(key: ref.key, data: usage.data)) unless refs.key_to_node.key?(ref.key) new_resolved_refs = Data::Tree::Siblings.from_key_names([ref.value.to_s]) do |_, resolved_node| raw_refs.merge_node!(usage) if usage.leaf? resolved_node.data.merge!(usage.data) else resolved_node.children = usage.children end resolved_node.leaves { |node| node.data[:ref_info] = [ref.full_key, ref.value.to_s] } end add_occurences! refs.key_to_node[ref.key].data, new_resolved_refs resolved_refs.merge! new_resolved_refs end # @param [Hash] ref_data # @param [I18n::Tasks::Data::Tree::Siblings] new_resolved_refs def add_occurences!(ref_data, new_resolved_refs) ref_data[:occurrences] ||= [] new_resolved_refs.leaves do |leaf| ref_data[:occurrences].concat(leaf.data[:occurrences] || []) end ref_data[:occurrences].sort_by!(&:path) ref_data[:occurrences].uniq! end # @param [I18n::Tasks::Data::Tree::Node] ref # @param [I18n::Tasks::Data::Tree::Node] usage # @param [I18n::Tasks::Data::Tree::Siblings] raw_refs # @param [I18n::Tasks::Data::Tree::Siblings] resolved_refs # @param [I18n::Tasks::Data::Tree::Siblings] refs def process_non_leaf!(ref, usage, raw_refs, resolved_refs, refs) child_raw_refs, child_resolved_refs, child_refs = process_references(usage.children, ref.children) raw_refs.merge_node! Data::Tree::Node.new(key: ref.key, children: child_raw_refs) unless child_raw_refs.empty? resolved_refs.merge! child_resolved_refs refs.merge_node! Data::Tree::Node.new(key: ref.key, children: child_refs) unless child_refs.empty? end # Given a forest of references, merge trees into one tree, ensuring there are no conflicting references. # @param roots [I18n::Tasks::Data::Tree::Siblings] # @return [I18n::Tasks::Data::Tree::Siblings] def merge_reference_trees(roots) roots.inject(empty_forest) do |forest, root| root.keys do |full_key, node| if full_key == node.value.to_s log_warn( "Self-referencing key #{node.full_key(root: false).inspect} in #{node.data[:locale].inspect}" ) end end forest.merge!( root.children, on_leaves_merge: lambda do |node, other| if node.value != other.value log_warn( 'Conflicting references: '\ "#{node.full_key(root: false)} ⮕ #{node.value} in #{node.data[:locale]},"\ " but ⮕ #{other.value} in #{other.data[:locale]}" ) end end ) end end end end
glebm/i18n-tasks
lib/i18n/tasks/references.rb
Ruby
mit
4,405
<!DOCTYPE html> <html lang="en"> <head> <!--Cabecera--> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <!-- Versión compilada y comprimida del CSS de Bootstrap --> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css"> <!-- Tema opcional --> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css"> <!-- Versión compilada y comprimida del JavaScript de Bootstrap --> <script src="//netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script> <title>Embrujo de cuero</title> <!-- Bootstrap Core CSS --> <!--<link href="<?= base_url()?>asset/plantilla/css/bootstrap.min.css" rel="stylesheet">--> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <!-- Custom CSS --> <link href="<?= base_url()?>asset/plantilla/css/business-casual.css" rel="stylesheet"> <!-- Fonts --> <link href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css"> <link href="http://fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css"> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="row"> <div class="col-md-4"> </div> <!--div class="col-md-3"><img src="<?= base_url()?>asset/plantilla/img/logo.png"--> <div></div> </div> </div> <div class="row"> <div class="col-md-4"><br><br><br><br><br><br><br><br></div> </div> <div align="center"> <br> <br> <!-- Menu--> <!-- Navigation --> <nav class="navbar navbar-default" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">TOOGLE</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed --> <a class="navbar-brand" href="index.html">Hecho a mano</a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li> <?php echo anchor('Entrada','Tienda');?> </li> <li> <?php echo anchor('Entrada/Destacados','Destacados');?> </li> <li> <?php echo anchor('Entrada/Categorias','Categorias');?> </li> <li> <?php if(!isset($_SESSION['usuario_correcto']) || $_SESSION['usuario_correcto']==false) echo anchor('Login/verificar','Identificate');?> </li> <li> <?php if(!isset($_SESSION['usuario_correcto']) ||$_SESSION['usuario_correcto']==false) echo anchor('Login/RecogerDatosUser','Registrese');?> </li> <li> <?php if(isset($_SESSION['usuario_correcto'])&& $_SESSION['usuario_correcto']==true ){ echo anchor('Login/perfil',' Mi perfil '); }?> </li> <li> <?php if(isset($_SESSION['usuario_correcto'])&& $_SESSION['usuario_correcto']==true ){ echo anchor('Login/Salir',' Salir '); }?> </li> </ul> </div> <!-- /.navbar-collapse --> </div> <!-- /.container --> </nav> <!--Fin de menu--> <!--Encabezado--> <div class="container"> <?php if(isset($cuerpo)) { echo $cuerpo; }else redirect("/Entrada/Destacados","location",301); ?> <!--Fin del encabezado--> </div> <!-- /.container --> <!-- Fin del cuerpo --> <!-- Pie de pagina--> <footer> <div class="container"> <div class="row"> <div class="col-lg-12 text-center"> </div> </div> </div> </footer> <!--Fin del pie--> <!-- jQuery --> <script src="<?= base_url()?>asset/plantilla/js/jquery.js"></script> <!-- Bootstrap Core JavaScript --> <script src="<?= base_url()?>asset/plantilla/js/bootstrap.min.js"></script> <!-- Script to Activate the Carousel --> <script> $('.carousel').carousel({ interval: 5000 //changes the speed }) </script> </body> </html>
adriangirol/Proyecto
application/views/Index.php
PHP
mit
6,164
using System.Windows; namespace Digimezzo.WPFControls.Tests.Tests { public partial class UWPSliderTest : Window { public UWPSliderTest() { InitializeComponent(); } } }
digimezzo/WPFControls
Digimezzo.WPFControls.Tests/Tests/UWPSliderTest.xaml.cs
C#
mit
220
body { padding-top: 50px; padding-bottom: 20px; margin-bottom: 60px; // Footer height } .footer { position: absolute; bottom: 0; width: 100%; /* Set the fixed height of the footer here */ height: 60px; background-color: #f5f5f5; } .footer p { text-align: center; margin: 0; }
JetForMe/spring-hoa
src/main/resources/static/css/site.css
CSS
mit
294
# Ayurveda Knowledge base for Ayurveda life style iOS app for iPhone
eabe1961/Ayurveda
README.md
Markdown
mit
70
require 'rails_helper' RSpec.describe Product, type: :model do let(:product_no_title) {Product.new(description: "this is the description", price: 10)} let(:product_no_description) {Product.new(title: "this is the title", price: 20)} let(:product_no_price) {Product.new(title: "this is the title", description: "another description")} let(:product_negative_price) {Product.new(title: "this is the title", description: "another description", price: -20)} let(:good_product) {Product.new(title: "this is the title", description: "another description", price: 20)} describe 'validations' do context 'raises an error' do it 'product has no title' do product_no_title.save expect(product_no_title.errors[:title]).to include("can't be blank") end it 'product has no description' do product_no_description.save expect(product_no_description.errors[:description]).to include("can't be blank") end it 'product has no price' do product_no_price.save expect(product_no_price.errors[:price]).to include("can't be blank") end it 'product has negative price' do product_negative_price.save expect(product_negative_price.errors[:price]).to include("must be greater than or equal to 0") end end context 'no error message' do it 'product has title, description, price, and price is not negative' do expect{good_product.save}.to change{Product.count}.by(1) end end end end
BerniceChua/shoppe
spec/models/product_spec.rb
Ruby
mit
1,580
"use strict"; var _ = require("lodash"), mongoose = require("mongoose"), directory = require("require-dir"); var models = {}; _.each(directory("./"), function(model) { models[model.name] = mongoose.model(model.name, model.schema); }); module.exports = models;
chrisharrington/find-followers-server
lib/data/models/index.js
JavaScript
mit
267
import arcpy # TODO: # 1) change the structure of the row to be fieldNames index (e.g. fieldNames.index("GeneralElementErrors")]) # 2) ... #Parcel class defines a parcel record based on the attribute schema class Parcel: #Class vars go here #Initialize a parcel object def __init__(self,row,fieldNames): self.objectid = row[fieldNames.index("OID@")] self.shape = row[fieldNames.index("SHAPE@")] self.stateid = row[fieldNames.index("STATEID")] self.parcelid = row[fieldNames.index("PARCELID")] self.taxparcelid = row[fieldNames.index("TAXPARCELID")] self.parceldate = row[fieldNames.index("PARCELDATE")] self.taxrollyear = row[fieldNames.index("TAXROLLYEAR")] self.ownernme1 = row[fieldNames.index("OWNERNME1")] self.ownernme2 = row[fieldNames.index("OWNERNME2")] self.pstladress = row[fieldNames.index("PSTLADRESS")] self.siteadress = row[fieldNames.index("SITEADRESS")] self.addnumprefix = row[fieldNames.index("ADDNUMPREFIX")] self.addnum = row[fieldNames.index("ADDNUM")] self.addnumsuffix = row[fieldNames.index("ADDNUMSUFFIX")] self.prefix = row[fieldNames.index("PREFIX")] self.streetname = row[fieldNames.index("STREETNAME")] self.streettype = row[fieldNames.index("STREETTYPE")] self.suffix = row[fieldNames.index("SUFFIX")] self.landmarkname = row[fieldNames.index("LANDMARKNAME")] self.unittype = row[fieldNames.index("UNITTYPE")] self.unitid = row[fieldNames.index("UNITID")] self.placename = row[fieldNames.index("PLACENAME")] self.zipcode = row[fieldNames.index("ZIPCODE")] self.zip4 = row[fieldNames.index("ZIP4")] self.state = row[fieldNames.index("STATE")] self.schooldist = row[fieldNames.index("SCHOOLDIST")] self.schooldistno = row[fieldNames.index("SCHOOLDISTNO")] self.improved = row[fieldNames.index("IMPROVED")] self.cntassdvalue = row[fieldNames.index("CNTASSDVALUE")] self.lndvalue = row[fieldNames.index("LNDVALUE")] self.impvalue = row[fieldNames.index("IMPVALUE")] self.forestvalue = row[fieldNames.index("FORESTVALUE")] self.estfmkvalue = row[fieldNames.index("ESTFMKVALUE")] self.netprpta = row[fieldNames.index("NETPRPTA")] self.grsprpta = row[fieldNames.index("GRSPRPTA")] self.propclass = row[fieldNames.index("PROPCLASS")] self.auxclass = row[fieldNames.index("AUXCLASS")] self.assdacres = row[fieldNames.index("ASSDACRES")] self.deedacres = row[fieldNames.index("DEEDACRES")] self.gisacres = row[fieldNames.index("GISACRES")] self.coname = row[fieldNames.index("CONAME")] self.loaddate = row[fieldNames.index("LOADDATE")] self.parcelfips = row[fieldNames.index("PARCELFIPS")] self.parcelsrc = row[fieldNames.index("PARCELSRC")] self.shapeLength = row[fieldNames.index("SHAPE@LENGTH")] self.shapeArea = row[fieldNames.index("SHAPE@AREA")] self.shapeXY = row[fieldNames.index("SHAPE@XY")] self.geometricErrors = [] self.addressErrors = [] self.taxErrors = [] self.generalErrors = [] def writeErrors(self, row, cursor, fieldNames): #Write all accumulated errors to their respective rows, then update the row within the cursor if len(self.addressErrors) > 0: row[fieldNames.index("AddressElementErrors")] = str(self.addressErrors).strip('[]').replace("'","").replace('"','').replace(","," | ") if len(self.generalErrors) > 0: row[fieldNames.index("GeneralElementErrors")] = str(self.generalErrors).strip('[]').replace("'","").replace('"','').replace(","," | ") if len(self.taxErrors) > 0: row[fieldNames.index("TaxrollElementErrors")] = str(self.taxErrors).strip('[]').replace("'","").replace('"','').replace(","," | ") if len(self.geometricErrors) > 0: row[fieldNames.index("GeometricElementErrors")] = str(self.geometricErrors).strip('[]').replace("'","").replace('"','').replace(","," | ") cursor.updateRow(row)
WIStCart/V3ValidationTool
V3ValidationTool_dist/script/Parcel.py
Python
mit
3,785
local complex = require "complex" local cx,cx1,cx2,re,im -- complex.to / complex call cx = complex { 2,3 } assert( tostring( cx ) == "2+3i" ) cx = complex ( 2 ) assert( tostring( cx ) == "2" ) assert( cx:tostring() == 2 ) cx = complex "2^2+3/2i" assert( tostring( cx ) == "4+1.5i" ) cx = complex ".5-2E-3i" assert( tostring( cx ) == "0.5-0.002i" ) cx = complex "3i" assert( tostring( cx ) == "3i" ) cx = complex "2" assert( tostring( cx ) == "2" ) assert( cx:tostring() == 2 ) assert( complex "2 + 4i" == nil ) -- complex.new cx = complex.new( 2,3 ) assert( tostring( cx ) == "2+3i" ) -- complex.type assert( complex.type( cx ) == "complex" ) assert( complex.type( {} ) == nil ) -- complex.convpolar( radius, phi ) assert( complex.convpolar( 3, 0 ):round(10) == complex "3" ) assert( complex.convpolar( 3, math.pi/2 ):round(10) == complex "3i" ) assert( complex.convpolar( 3, math.pi ):round(10) == complex "-3" ) assert( complex.convpolar( 3, math.pi*3/2 ):round(10) == complex "-3i" ) assert( complex.convpolar( 3, math.pi*2 ):round(10) == complex "3" ) -- complex.convpolardeg( radius, phi ) assert( complex.convpolardeg( 3, 0 ):round(10) == complex "3" ) assert( complex.convpolardeg( 3, 90 ):round(10) == complex "3i" ) assert( complex.convpolardeg( 3, 180 ):round(10) == complex "-3" ) assert( complex.convpolardeg( 3, 270 ):round(10) == complex "-3i" ) assert( complex.convpolardeg( 3, 360 ):round(10) == complex "3" ) -- complex.tostring( cx,formatstr ) cx = complex "2+3i" assert( complex.tostring( cx ) == "2+3i" ) assert( complex.tostring( cx, "%.2f" ) == "2.00+3.00i" ) -- does not support a second argument assert( tostring( cx, "%.2f" ) == "2+3i" ) -- complex.polar( cx ) local r,phi = complex.polar( {3,0} ) assert( r == 3 ) assert( phi == 0 ) local r,phi = complex.polar( {0,3} ) assert( r == 3 ) assert( phi == math.pi/2 ) local r,phi = complex.polar( {-3,0} ) assert( r == 3 ) assert( phi == math.pi ) local r,phi = complex.polar( {0,-3} ) assert( r == 3 ) assert( phi == -math.pi/2 ) -- complex.polardeg( cx ) local r,phi = complex.polardeg( {3,0} ) assert( r == 3 ) assert( phi == 0 ) local r,phi = complex.polardeg( {0,3} ) assert( r == 3 ) assert( phi == 90 ) local r,phi = complex.polardeg( {-3,0} ) assert( r == 3 ) assert( phi == 180 ) local r,phi = complex.polardeg( {0,-3} ) assert( r == 3 ) assert( phi == -90 ) -- complex.mulconjugate( cx ) cx = complex "2+3i" assert( complex.mulconjugate( cx ) == 13 ) -- complex.abs( cx ) cx = complex "3+4i" assert( complex.abs( cx ) == 5 ) -- complex.get( cx ) cx = complex "2+3i" re,im = complex.get( cx ) assert( re == 2 ) assert( im == 3 ) -- complex.set( cx, re, im ) cx = complex "2+3i" complex.set( cx, 3, 2 ) assert( cx == complex "3+2i" ) -- complex.is( cx, re, im ) cx = complex "2+3i" assert( complex.is( cx, 2, 3 ) == true ) assert( complex.is( cx, 3, 2 ) == false ) -- complex.copy( cx ) cx = complex "2+3i" cx1 = complex.copy( cx ) complex.set( cx, 1, 1 ) assert( cx1 == complex "2+3i" ) -- complex.add( cx1, cx2 ) cx1 = complex "2+3i" cx2 = complex "3+2i" assert( complex.add(cx1,cx2) == complex "5+5i" ) -- complex.sub( cx1, cx2 ) cx1 = complex "2+3i" cx2 = complex "3+2i" assert( complex.sub(cx1,cx2) == complex "-1+1i" ) -- complex.mul( cx1, cx2 ) cx1 = complex "2+3i" cx2 = complex "3+2i" assert( complex.mul(cx1,cx2) == complex "13i" ) -- complex.mulnum( cx, num ) cx = complex "2+3i" assert( complex.mulnum( cx, 2 ) == complex "4+6i" ) -- complex.div( cx1, cx2 ) cx1 = complex "2+3i" cx2 = complex "3-2i" assert( complex.div(cx1,cx2) == complex "i" ) -- complex.divnum( cx, num ) cx = complex "2+3i" assert( complex.divnum( cx, 2 ) == complex "1+1.5i" ) -- complex.pow( cx, num ) cx = complex "2+3i" assert( complex.pow( cx, 3 ) == complex "-46+9i" ) cx = complex( -121 ) cx = cx^.5 -- we have to round here due to the polar calculation of the squareroot cx = cx:round( 10 ) assert( cx == complex "11i" ) cx = complex"2+3i" assert( cx^-2 ~= 1/cx^2 ) assert( cx^-2 == (cx^-1)^2 ) assert( tostring( cx^-2 ) == tostring( 1/cx^2 ) ) -- complex.sqrt( cx ) cx = complex( -121 ) assert( complex.sqrt( cx ) == complex "11i" ) cx = complex "2-3i" cx = cx^2 assert( cx:sqrt() == complex "2-3i" ) -- complex.ln( cx ) cx = complex "3+4i" assert( cx:ln():round( 4 ) == complex "1.6094+0.9273i" ) -- complex.exp( cx ) cx = complex "2+3i" assert( cx:ln():exp() == complex "2+3i" ) -- complex.conjugate( cx ) cx = complex "2+3i" assert( cx:conjugate() == complex "2-3i" ) -- metatable -- __add cx = complex "2+3i" assert( cx+2 == complex "4+3i" ) -- __unm cx = complex "2+3i" assert( -cx == complex "-2-3i" )
kkirstein/proglang-playground
Lua/complex_test.lua
Lua
mit
4,619
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>ckgoto</title> <link rel="stylesheet" type="text/css" href="csound.css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /> <link rel="home" href="index.html" title="Manuel de référence canonique de Csound" /> <link rel="up" href="OpcodesTop.html" title="Opcodes et opérateurs de l'orchestre" /> <link rel="prev" href="cigoto.html" title="cigoto" /> <link rel="next" href="clear.html" title="clear" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">ckgoto</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="cigoto.html">Précédent</a> </td> <th width="60%" align="center">Opcodes et opérateurs de l'orchestre</th> <td width="20%" align="right"> <a accesskey="n" href="clear.html">Suivant</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="ckgoto"></a> <div class="titlepage"></div> <a id="IndexCkgoto" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">ckgoto</span> </h2> <p>ckgoto — Transfert conditionnel du contrôle lors des phases d'exécution. </p> </div> <div class="refsect1"> <a id="idm47887691281808"></a> <h2>Description</h2> <p> Tranfert conditionnel du contrôle vers l'instruction étiquetée par <span class="emphasis"><em>label</em></span>, lors des phases d'exécution seulement. </p> </div> <div class="refsect1"> <a id="idm47887691279920"></a> <h2>Syntaxe</h2> <pre class="synopsis"><span class="command"><strong>ckgoto</strong></span> condition, label</pre> <p> où <span class="emphasis"><em>label</em></span> se trouve dans le même bloc d'instrument et n'est pas une expression, et où <span class="emphasis"><em>condition</em></span> utilise un des opérateurs relationnels (<span class="emphasis"><em>&lt;</em></span>, <span class="emphasis"><em>=</em></span>, <span class="emphasis"><em>&lt;=</em></span>, <span class="emphasis"><em>==</em></span>, <span class="emphasis"><em>!=</em></span>) (et <span class="emphasis"><em>=</em></span> par commodité, voir aussi <a class="link" href="ControlConditional.html" title="Valeurs conditionnelles"><em class="citetitle">Valeurs Conditionnelles</em></a>). </p> </div> <div class="refsect1"> <a id="idm47887691197856"></a> <h2>Exemples</h2> <p> Voici un exemple de l'opcode ckgoto. Il utilise le fichier <a class="ulink" href="examples/ckgoto.csd" target="_top"><em class="citetitle">ckgoto.csd</em></a>. </p> <div class="example"> <a id="idm47887691195984"></a> <p class="title"> <strong>Exemple 125. Exemple de l'opcode ckgoto.</strong> </p> <div class="example-contents"> <p>Voir les sections <a class="link" href="UsingRealTime.html" title="Audio en temps réel"><em class="citetitle">Audio en Temps Réel</em></a> et <a class="link" href="CommandFlags.html" title="Ligne de commande de Csound"><em class="citetitle">Options de la Ligne de Commande</em></a> pour plus d'information sur l'utilisation des options de la ligne de commande.</p> <div class="refsect1"> <a id="idm47887531286688"></a> <pre class="programlisting"> <span class="csdtag">&lt;CsoundSynthesizer&gt;</span> <span class="csdtag">&lt;CsOptions&gt;</span> <span class="comment">; Select audio/midi flags here according to platform</span> <span class="comment">; Audio out Audio in No messages</span> -odac -iadc -d <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o ckgoto.wav -W ;;; for file output any platform</span> <span class="csdtag">&lt;/CsOptions&gt;</span> <span class="csdtag">&lt;CsInstruments&gt;</span> <span class="comment">; Initialize the global variables.</span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 <span class="comment">; Instrument #1.</span> <span class="oblock">instr</span> 1 <span class="comment">; Change kval linearly from 0 to 2 over</span> <span class="comment">; the period set by the third p-field.</span> kval <span class="opc">line</span> 0, p3, 2 <span class="comment">; If kval is greater than or equal to 1 then play the high note.</span> <span class="comment">; If not then play the low note.</span> <span class="octrl">ckgoto</span> (kval <span class="op">&gt;=</span> 1), <span class="olabel">highnote</span> <span class="octrl">kgoto</span> <span class="olabel">lownote</span> <span class="olabel">highnote</span><span class="op">:</span> kfreq <span class="op">=</span> 880 <span class="octrl">goto</span> <span class="olabel">playit</span> <span class="olabel">lownote</span><span class="op">:</span> kfreq <span class="op">=</span> 440 <span class="octrl">goto</span> <span class="olabel">playit</span> <span class="olabel">playit</span><span class="op">:</span> <span class="comment">; Print the values of kval and kfreq.</span> <span class="opc">printks</span> "kval <span class="op">=</span> <span class="op">%</span>f, kfreq <span class="op">=</span> <span class="op">%</span>f\\n", 1, kval, kfreq a1 <span class="opc">oscil</span> 10000, kfreq, 1 <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="csdtag">&lt;/CsInstruments&gt;</span> <span class="csdtag">&lt;CsScore&gt;</span> <span class="comment">; Table: a simple sine wave.</span> <span class="stamnt">f</span> 1 0 32768 10 1 <span class="comment">; Play Instrument #1 for two seconds.</span> <span class="stamnt">i</span> 1 0 2 <span class="stamnt">e</span> <span class="csdtag">&lt;/CsScore&gt;</span> <span class="csdtag">&lt;/CsoundSynthesizer&gt;</span> </pre> </div> </div> </div> <p><br class="example-break" /> Sa sortie contiendra des lignes comme celles-ci : </p> <pre class="screen"> kval = 0.000000, kfreq = 440.000000 kval = 0.999732, kfreq = 440.000000 kval = 1.999639, kfreq = 880.000000</pre> <p> </p> </div> <div class="refsect1"> <a id="idm47887691190784"></a> <h2>Voir aussi</h2> <p> <a class="link" href="cggoto.html" title="cggoto"><em class="citetitle">cggoto</em></a>, <a class="link" href="cigoto.html" title="cigoto"><em class="citetitle">cigoto</em></a>, <a class="link" href="cngoto.html" title="cngoto"><em class="citetitle">cngoto</em></a>, <a class="link" href="goto.html" title="goto"><em class="citetitle">goto</em></a>, <a class="link" href="if.html" title="if"><em class="citetitle">if</em></a>, <a class="link" href="igoto.html" title="igoto"><em class="citetitle">igoto</em></a>, <a class="link" href="tigoto.html" title="tigoto"><em class="citetitle">tigoto</em></a>, <a class="link" href="timout.html" title="timout"><em class="citetitle">timout</em></a> </p> </div> <div class="refsect1"> <a id="idm47887691182048"></a> <h2>Crédits</h2> <p>Exemple écrit par Kevin Conder.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="cigoto.html">Précédent</a> </td> <td width="20%" align="center"> <a accesskey="u" href="OpcodesTop.html">Niveau supérieur</a> </td> <td width="40%" align="right"> <a accesskey="n" href="clear.html">Suivant</a></td> </tr> <tr> <td width="40%" align="left" valign="top">cigoto </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Sommaire</a> </td> <td width="40%" align="right" valign="top"> clear</td> </tr> </table> </div> </body> </html>
ketchupok/csound.github.io
docs/manual-fr/ckgoto.html
HTML
mit
8,759
import * as React from 'react'; interface IProps { error: string; submitLogin: (user: string, pass: string) => void; } interface IState { user: string; pass: string; } const formStyle: React.CSSProperties = { display: 'flex', flexDirection: 'column', alignItems: 'center', padding: '10px' }; const inputStyle: React.CSSProperties = { border: 0, outline: 'none', padding: '4px', borderLeft: '3px solid rgba(0, 0, 0, 0.5)' }; const buttonStyle: React.CSSProperties = { border: 0, padding: '4px' }; const errorStyle: React.CSSProperties = { color: 'rgba(255, 0, 0, 0.65)', fontSize: 14 }; export class LoginForm extends React.Component<IProps, IState> { constructor(props: any) { super(props); this.state = { user: '', pass: '' }; this.handleSubmit = this.handleSubmit.bind(this); this.inputChanged = this.inputChanged.bind(this); } public render() { let error = null; if (this.props.error) { error = <div style={errorStyle}>{this.props.error}</div>; } return ( <form onSubmit={this.handleSubmit} style={formStyle}> <h1>ircos</h1> {error} <input type="text" name="user" placeholder="Username" style={inputStyle} value={this.state.user} onChange={this.inputChanged} /> <input type="password" name="pass" placeholder="Password" style={inputStyle} value={this.state.pass} onChange={this.inputChanged} /> <input type="submit" style={buttonStyle} value="Login!" /> </form> ); } private inputChanged(event: any) { this.setState({ [event.target.name]: event.target.value }); } private handleSubmit(event: any) { event.preventDefault(); if (this.state.user !== '' && this.state.pass !== '') { this.props.submitLogin(this.state.user, this.state.pass); } } }
Hallowatcher/ircos
src/components/LoginForm.tsx
TypeScript
mit
1,987
# -*- coding: utf-8 -*- from collections import defaultdict class ClassAggregate(object): def __init__(self, syncano_name, syncano_schema, parse_name, parse_schema): self.syncano_name = syncano_name self.syncano_schema = syncano_schema self.parse_name = parse_name self.parse_schema = parse_schema class DataAggregated(object): def __init__(self): self.classes = [] self.reference_map = defaultdict(dict) def add_class(self, syncano_name, syncano_schema, parse_name, parse_schema): self.classes.append( ClassAggregate(syncano_name, syncano_schema, parse_name, parse_schema) ) def sort_classes(self): without_relations = [] with_relations = [] for _class in self.classes: has_relation = False for field in _class.syncano_schema: if field['type'] == 'reference' or field['type'] == 'relation': has_relation = True break if not has_relation: without_relations.append(_class) else: with_relations.append(_class) # sort with relations properly; # TODO: some cyclic references return without_relations + with_relations data_aggregate = DataAggregated()
Syncano/parse2syncano
parse_to_syncano/migrations/aggregation.py
Python
mit
1,328
# Based on Pluralsight course # https://app.pluralsight.com/library/courses/two-tier-enterprise-app-api-development-angular-sails/ if [ -d ./socialfleet/ ]; then echo "socialfleet folder already created"; else ./socialfleet.sh; fi cd socialfleet if [ -d ./frontend/ ]; then rm -rf frontend; fi mkdir frontend cd frontend # Init package.json file; only defaults and not prompt you for any options. npm init --force npm install bower --save-dev # Init bower.json file. There is no built-in option for # bower init to execute silently, but the unix yes command will work. yes '' | bower init bower install angular --save
RodolfoDiaz/codelibrary
nodejs/sailsjs/socialfleet-front.sh
Shell
mit
618