You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monaco-editor/test/samples-all.generated.js

343 lines
1.6 MiB
JavaScript

//This is a generated file via gulp generate-test-samples
define([], function() { return[
{
"name": "run-editor-failing-js.txt",
"content": "var container = document.getElementById(\"container\");\r\nvar cssCode = [\r\n\t'body {',\r\n\t'\tmargin: 0px;',\r\n\t'\tpadding: 0px;',\r\n\t'}'\r\n].join('\\n');\r\n\r\nMonaco.Editor.create(container, {\r\n\tvalue: cssCode,\r\n\tmode: \"text/css\"\r\n});\r\n\r\nrequire(['vs/platform/platform', 'vs/editor/modes/modesExtensions'], \r\n\tfunction (Platform, ModesExtensions) {\r\n\t\tvar modesRegistry = Platform.Registry.as(ModesExtensions.Extensions.EditorModes);\r\n\t\t\r\n\t\t// Try 'ignore', 'warning', and 'error'\r\n\t\tmodesRegistry.configureMode('text/css', {\r\n\t\t\t\"validationSettings\": {\r\n\t\t\t\t\"lint\": {\r\n\t\t\t\t\tcompatibleVendorPrefixes\": \"warning\",\r\n\t\t\t\t\tvendorPrefix\": \"warning\",\r\n\t\t\t\t\tduplicateProperties\": \"warning\",\r\n\t\t\t\t\temptyRules\": \"warning\",\r\n\t\t\t\t\timportStatement\": \"ignore\",\r\n\t\t\t\t\tboxModel\": \"ignore\",\r\n\t\t\t\t\tuniversalSelector\": \"warning\",\r\n\t\t\t\t\tzeroUnits\": \"ignore\",\r\n\t\t\t\t\tfontFaceProperties\": \"warning\",\r\n\t\t\t\t\thexColorLength\": \"error\",\r\n\t\t\t\t\targumentsInColorFunction\": \"error\",\r\n\t\t\t\t\tunknownProperties\": \"warning\",\r\n\t\t\t\t\tunknownVendorSpecificProperties\": \"warning\",\r\n\t\t\t\t\tpropertyIgnoredDueToDisplay\": \"warning\",\r\n\t\t\t\t\timportant\": \"ignore\",\r\n\t\t\t\t\tfloat\": \"ignore\",\r\n\t\t\t\t\tidSelector\": \"ignore\"\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n);\r\n\r"
},
{
"name": "run-editor-intellisense-js.txt",
"content": "\r\n\"use strict\";\r\nfunction Person(age) {\r\n\tif (age) {\r\n\t\tthis.age = age;\r\n\t}\r\n}\r\nPerson.prototype.getAge = function () {\r\n\treturn this.age;\r\n};\r\n\r\nfunction Student(age, grade) {\r\n\tPerson.call(this, age);\r\n\tthis.grade = grade;\r\n}\r\nStudent.prototype = new Person();\r\nStudent.prototype.getGrade = function () {\r\n\treturn this.grade;\r\n};\r\n\r\nvar s = new Student(24, 5.75);\r\n//var age = s.\r\n\r\n//delete s.age;\r\n//s.getAge = function() { return {foo:\"bar\"}; };\r\n//s.\r\n//s.getAge().\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
},
{
"name": "run-editor-jquery-min-js.txt",
"content": "نقطة التقاء نهريّ الساڤا والدانوب، حيث يلتقي السهل الپانونّي لأوروبا الوسطى بشبه جزيرة البلقان. يصل عدد سكان المدينة نفسها إلى\r\n//< as\r\n\r\n/*\r\nFour byte: Ext-A 㐀㒣㕴㕵㙉㙊䵯䵰䶴䶵 (Unicode 3.0)\r\nFour byte: Ext-B 𠀀𠀁𠀂𠀃𪛑𪛒𪛓𪛔𪛕𪛖 (Unicode 3.1)\r\nFour byte: Mongolian ᠀᠐᠙ᠠᡷᢀᡨᡩᡪᡫ\r\nFour byte: Tibetan ༀཇཉཪཱྋ྾࿌࿏ྼྙ\r\nFour byte: Yi ꀀꒌꂋꂌꂍꂎꂔꂕ꒐꓆\r\nFour byte: Uighur ،؟ئبتجدرشعەﭖﭙﯓﯿﺉﺒﻺﻼ\r\nFour byte: Tai Le ᥐᥥᥦᥧᥨᥭᥰᥱᥲᥴ\r\nFour byte: Hangul ᄓᄕᇬᇌᇜᇱㄱㅣ가힝\r\n\r\n*/\r\n\r\n//فرعون) هو فيلم وثائقي من إنتاج لجنة تكريم شهداء الحركة الإسلامية العالمية الإيرانية. يتناول الفيلم عملية اغتيال الرئيس المصري السابق\r\n//The Chinese\r\n//العربية/عربي al-ʻarabīyah/ʻarabī language\r\n// (汉语/漢語 Hànyǔ; 华语/華語 Huáyǔ; 中文 Zhōngwén)\r\n/*! jQuery v1.8.2 jquery.com | jquery.org/license */\r\n(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s),function(a,c){b[c]=!0}),b}function J(a,c,d){if(d===b&&a.nodeType===1){var e=\"data-\"+c.replace(I,\"-$1\").toLowerCase();d=a.getAttribute(e);if(typeof d==\"string\"){try{d=d===\"true\"?!0:d===\"false\"?!1:d===\"null\"?null:+d+\"\"===d?+d:H.test(d)?p.parseJSON(d):d}catch(f){}p.data(a,c,d)}else d=b}return d}function K(a){var b;for(b in a){if(b===\"data\"&&p.isEmptyObject(a[b]))continue;if(b!==\"toJSON\")return!1}return!0}function ba(){return!1}function bb(){return!0}function bh(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function bi(a,b){do a=a[b];while(a&&a.nodeType!==1);return a}function bj(a,b,c){b=b||0;if(p.isFunction(b))return p.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return p.grep(a,function(a,d){return a===b===c});if(typeof b==\"string\"){var d=p.grep(a,function(a){return a.nodeType===1});if(be.test(b))return p.filter(b,d,!c);b=p.filter(b,d)}return p.grep(a,function(a,d){return p.inArray(a,b)>=0===c})}function bk(a){var b=bl.split(\"|\"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function bC(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bD(a,b){if(b.nodeType!==1||!p.hasData(a))return;var c,d,e,f=p._data(a),g=p._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;d<e;d++)p.event.add(b,c,h[c][d])}g.data&&(g.data=p.extend({},g.data))}function bE(a,b){var c;if(b.nodeType!==1)return;b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),c===\"object\"?(b.parentNode&&(b.outerHTML=a.outerHTML),p.support.html5Clone&&a.innerHTML&&!p.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):c===\"input\"&&bv.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):c===\"option\"?b.selected=a.defaultSelected:c===\"input\"||c===\"textarea\"?b.defaultValue=a.defaultValue:c===\"script\"&&b.text!==a.text&&(b.text=a.text),b.removeAttribute(p.expando)}function bF(a){return typeof a.getElementsByTagName!=\"undefined\"?a.getElementsByTagName(\"*\"):typeof a.querySelectorAll!=\"undefined\"?a.querySelectorAll(\"*\"):[]}function bG(a){bv.test(a.type)&&(a.defaultChecked=a.checked)}function bY(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=bW.length;while(e--){b=bW[e]+c;if(b in a)return b}return d}function bZ(a,b){return a=b||a,p.css(a,\"display\")===\"none\"||!p.contains(a.ownerDocument,a)}function b$(a,b){var c,d,e=[],f=0,g=a.length;for(;f<g;f++){c=a[f];if(!c.style)continue;e[f]=p._data(c,\"olddisplay\"),b?(!e[f]&&c.style.display===\"none\"&&(c.style.display=\"\"),c.style.display===\"\"&&bZ(c)&&(e[f]=p._data(c,\"olddisplay\",cc(c.nodeName))
},
{
"name": "run-editor-js-validationParticipant.js",
"content": "define([\r\n\t'vs/base/common/severity'\r\n], function(severity) {\r\n\t'use strict';\r\n\tfunction ValidateParticipant() {\r\n\r\n\t}\r\n\r\n\tValidateParticipant.ID = 'doc.validateParticipant';\r\n\tValidateParticipant.prototype.validate = function(mirrorModel, markerService) {\r\n\r\n\t\tvar marker = {\r\n\t\t\tseverity: severity.Error,\r\n\t\t\tmessage: [\r\n\t\t\t\t{ isText: true, text: '\\u2188 ' },\r\n\t\t\t\t{ tagName: 'span', style: 'color:red', text: 'I AM' },\r\n\t\t\t\t{ isText: true, text: ' A VALIDATION PARTICIPANT \\u2188' }\r\n\t\t\t],\r\n\t\t\tstartLineNumber: 1,\r\n\t\t\tstartColumn: 1,\r\n\t\t\tendLineNumber: 1,\r\n\t\t\tendColumn: 3\r\n\t\t};\r\n\r\n\t\tmarkerService.changeOne(ValidateParticipant.ID, mirrorModel.getAssociatedResource(), [marker]);\r\n\t};\r\n\treturn {\r\n\t\tValidateParticipant: ValidateParticipant\r\n\t};\r\n});"
},
{
"name": "run-editor-korean.txt",
"content": "/*\r\n\r\n전문\r\n유구한 역사와 전통에 빛나는 우리 대한 국민은 3·1 운동으로 건립된 대한민국 임시 정부의 법통과 불의에 항거한 4·19 민주 이념을 계승하고, 조국의 민주 개혁과 평화적 통일의 사명에 입각하여 정의·인도와 동포애로써 민족의 단결을 공고히 하고, 모든 사회적 폐습과 불의를 타파하며, 자율과 조화를 바탕으로 자유 민주적 기본 질서를 더욱 확고히 하여 정치·경제·사회·문화의 모든 영역에 있어서 각인의 기회를 균등히 하고, 능력을 최고도로 발휘하게 하며, 자유와 권리에 따르는 책임과 의무를 완수하게 하여, 안으로는 국민 생활의 균등한 향상을 기하고 밖으로는 항구적인 세계 평화와 인류 공영에 이바지함으로써 우리들과 우리들의 자손의 안전과 자유와 행복을 영원히 확보할 것을 다짐하면서 1948년 7월 12일에 제정되고 8차에 걸쳐 개정된 헌법을 이제 국회의 의결을 거쳐 국민 투표에 의하여 개정한다.\r\n1987년 10월 29일\r\n前文\r\n悠久한 歷史와 傳統에 빛나는 우리 大韓國民은 3·1 運動으로 建立된 大韓民國臨時政府의 法統과 不義에 抗拒한 4·19 民主理念을 繼承하고, 祖國의 民主改革과 平和的統一의 使命에 立脚하여 正義·人道와 同胞愛로써 民族의 團結을 鞏固히 하고, 모든 社會的弊習과 不義를 打破하며, 自律과 調和를 바탕으로 自由民主的基本秩序를 더욱 確固히 하여 政治·經濟·社會·文化의 모든 領域에 있어서 各人의 機會를 均等히 하고, 能力을 最高度로 發揮하게 하며, 自由와 權利에 따르는 責任과 義務를 完遂하게 하여, 안으로는 國民生活의 均等한 向上을 基하고 밖으로는 恒久的인 世界平和와 人類共榮에 이바지함으로써 우리들과 우리들의 子孫의 安全과 自由와 幸福을 永遠히 確保할 것을 다짐하면서 1948年 7月 12日에 制定되고 8次에 걸쳐 改正된 憲法을 이제 國會의 議決을 거쳐 國民投票에 依하여 改正한다.\r\n1987年 10月 29日\r\n\r\n*/"
},
{
"name": "run-editor-sample-big-css.txt",
"content": "#wrapper .w12,#wrapper.w12{min-width:972px;width:81em}.pa{margin:0 auto;padding:0 .5em}.pa #area1,.pa #area2,.pa #area3{float:left}.pa #subfoot{clear:both}.pa #area2,.pa #area3{margin-left:1em}.pa #page:after{clear:both;content:\".\";display:block;height:0;visibility:hidden}#wrapper{padding:0 0;text-align:left;margin:0 auto}#wrapper .w1{min-width:70px;width:5.833em}#wrapper .w2{min-width:152px;width:12.667em}#wrapper .w3{min-width:234px;width:19.5em}#wrapper .w3 .w50{min-width:111px;width:9.25em}#wrapper .w4{min-width:316px;width:26.333em}#wrapper .w4 .w33{min-width:97px;width:8.083em}#wrapper .w4 .ce3.w33{min-width:98px;width:8.167em}#wrapper .w5{min-width:398px;width:33.167em}#wrapper .w5 .w33{min-width:124px;width:10.333em}#wrapper .w5 .ce2.w33,#wrapper .w5 .ce3.w33{min-width:125px;width:10.417em}#wrapper .w5 .w50{min-width:193px;width:16.083em}#wrapper .w6{min-width:480px;width:40em}#wrapper .w7{min-width:562px;width:46.833em}#wrapper .w7 .w33{min-width:179px;width:14.917em}#wrapper .w7 .ce3.w33{min-width:180px;width:15em}#wrapper .w7 .w50{min-width:275px;width:22.917em}#wrapper .w8{min-width:644px;width:53.667em}#wrapper .w8 .w33{min-width:206px;width:17.167em}#wrapper .w8 .ce1.w33,#wrapper .w8 .ce3.w33{min-width:206px;width:17.167em}#wrapper .w9{min-width:726px;width:60.5em}#wrapper .w9 .w50{min-width:357px;width:29.75em}#wrapper .w10{min-width:808px;width:67.333em}#wrapper .w10 .w33{min-width:261px;width:21.75em}#wrapper .w10 .ce3.w33{min-width:262px;width:21.833em}#wrapper .w11{min-width:890px;width:74.167em}#wrapper .w11 .w33{min-width:288px;width:24em}#wrapper .w11 .ce2.w33,#wrapper .w11 .ce3.w33{min-width:289px;width:24.083em}#wrapper .w11 .w50{min-width:439px;width:36.583em}#wrapper .w12{min-width:972px;width:81em}#head{min-width:972px;background:transparent}#nav{min-width:972px;background:transparent}#content{background:#fff}#foot{min-width:972px;background:transparent}.wings{background-color:#009ad9;min-width:81em;width:100%}#nav .wings{height:1.667em}#doublerownav .wings{height:3.75em}body{color:#333;font-family:arial,sans-serif;font-size:75%;line-height:1.33em;margin:0;padding:0;text-align:center}a.more,div.br *,.cotb *,.coss *{font-family:arial,sans-serif}@media print{form,object{display:none}}a,a:link,a:visited{color:#333;text-decoration:none}a:hover,a:hover span{color:#000;text-decoration:underline}a img{border:none}input,select,textarea{font-size:15px;line-height:normal}big,div.h2,div.h3,h1,h2,h3,h4,h5,h6,small{font-family:arial,sans-serif;font-size:100%;margin:0;padding:0}.cf:after,ul.cf li:after,.ro:after{clear:both;content:\".\";display:block;height:0;visibility:hidden}.none{display:none}#area1 .ro .co,#area2 .ro .co{margin:.667em}body.ukhp{background:#ededed url(../../i/9e/d11d472df557c51b75b9f0b27752e0.gif) repeat-x center top}#page{background-color:#fff;min-width:972px;background:transparent}#wrapper .msnfoot1{margin:0}#area2 .ro .w4 .co3b2 .br2{min-width:100px;width:8.333em}#wrapper .actfeed1 .ac-head,#wrapper .actfeed1 .ac-status{border-color:#e2f1d4}.headerbar1 .websearch2 .opt,.headerbar1 .websearch2 .opt span,.headerbar1 .websearch2 label{color:#fff}.headerbar1 .websearch2 .scopes span{color:#c1c1c1}#wrapper .searchbar3{padding:5px 0}.ebay1 .simple8 input.image{float:right;margin-top:0}.headerbar3 .websearch2 input.text{width:322px}#head:after,#page:after,#foot:after{clear:both;content:\".\";display:block;height:0;visibility:hidden}#area1 .co,#area2 .co,#wrapper #area1 .cogr,#wrapper #area2 .cogr{margin:.667em}#wrapper.w12,#head .w12,#foot .w12,#nav .w12,#page .w12{width:81.667em;min-width:980px}#subhead .w12{width:81em;min-width:972px}#foot .w12{background-color:#fff}body.cephp{background:#ededed url(../../i/9e/d11d472df557c51b75b9f0b27752e0.gif) repeat-x center top}#wrapper .searchbar2{background-color:#3d8bb6;margin-bottom:0;padding:15px 0}#subhead .flash1{margin:0 1em}#wrapper .w8 .w33.ce1{margin-right:.583em}#wrapper .w8 .w33.ce3{margin-left:.583em}.hminbox1 ul.greet li.first{width:52%}#subfoot .ro{margin-left:.25em}.sitemap .linklist13 li{width:16%;margin:0 .5% 0 0}.men
},
{
"name": "run-editor-sample-bom-cs.txt",
"content": "using System;\r\nusing System.Collections.Generic;\r\nusing System.Net.Http;\r\nusing System.Security.Claims;\r\nusing System.Security.Cryptography;\r\nusing System.Threading.Tasks;\r\nusing System.Web;\r\nusing System.Web.Http;\r\nusing System.Web.Http.ModelBinding;\r\nusing Microsoft.AspNet.Identity;\r\nusing Microsoft.AspNet.Identity.EntityFramework;\r\nusing Microsoft.AspNet.Identity.Owin;\r\nusing Microsoft.Owin.Security;\r\nusing Microsoft.Owin.Security.Cookies;\r\nusing Microsoft.Owin.Security.OAuth;\r\nusing WebApplication.Models;\r\nusing WebApplication.Providers;\r\nusing WebApplication.Results;\r\n\r\nnamespace WebApplication.Controllers\r\n{\r\n [Authorize]\r\n [RoutePrefix(\"api/Account\")]\r\n public class AccountController : ApiController\r\n {\r\n private const string LocalLoginProvider = \"Local\";\r\n private ApplicationUserManager _userManager;\r\n\r\n public AccountController()\r\n {\r\n }\r\n\r\n public AccountController(ApplicationUserManager userManager,\r\n ISecureDataFormat<AuthenticationTicket> accessTokenFormat)\r\n {\r\n UserManager = userManager;\r\n AccessTokenFormat = accessTokenFormat;\r\n }\r\n\r\n public ApplicationUserManager UserManager\r\n {\r\n get\r\n {\r\n return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>();\r\n }\r\n private set\r\n {\r\n _userManager = value;\r\n }\r\n }\r\n\r\n public ISecureDataFormat<AuthenticationTicket> AccessTokenFormat { get; private set; }\r\n\r\n // GET api/Account/UserInfo\r\n [HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]\r\n [Route(\"UserInfo\")]\r\n public UserInfoViewModel GetUserInfo()\r\n {\r\n ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity);\r\n\r\n return new UserInfoViewModel\r\n {\r\n Email = User.Identity.GetUserName(),\r\n HasRegistered = externalLogin == null,\r\n LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null\r\n };\r\n }\r\n\r\n // POST api/Account/Logout\r\n [Route(\"Logout\")]\r\n public IHttpActionResult Logout()\r\n {\r\n Authentication.SignOut(CookieAuthenticationDefaults.AuthenticationType);\r\n return Ok();\r\n }\r\n\r\n // GET api/Account/ManageInfo?returnUrl=%2F&generateState=true\r\n [Route(\"ManageInfo\")]\r\n public async Task<ManageInfoViewModel> GetManageInfo(string returnUrl, bool generateState = false)\r\n {\r\n IdentityUser user = await UserManager.FindByIdAsync(User.Identity.GetUserId());\r\n\r\n if (user == null)\r\n {\r\n return null;\r\n }\r\n\r\n List<UserLoginInfoViewModel> logins = new List<UserLoginInfoViewModel>();\r\n \r\n foreach (IdentityUserLogin linkedAccount in user.Logins)\r\n {\r\n logins.Add(new UserLoginInfoViewModel\r\n {\r\n LoginProvider = linkedAccount.LoginProvider,\r\n ProviderKey = linkedAccount.ProviderKey\r\n });\r\n }\r\n\r\n if (user.PasswordHash != null)\r\n {\r\n logins.Add(new UserLoginInfoViewModel\r\n {\r\n LoginProvider = LocalLoginProvider,\r\n ProviderKey = user.UserName,\r\n });\r\n }\r\n\r\n return new ManageInfoViewModel\r\n {\r\n LocalLoginProvider = LocalLoginProvider,\r\n Email = user.UserName,\r\n Logins = logins,\r\n ExternalLoginProviders = GetExternalLogins(returnUrl, generateState)\r
},
{
"name": "run-editor-sample-cr-ps1.txt",
"content": "\r\n# A line that ends only in CR(0x0D) and not LF (0x0A).\rforeach($parameterSet in $ObjInfoArray)\r\n{\r\n\t# This line also ends only in CR(0x0D) and not LF (0x0A).\r\tif ($parameterSet[\"class\"] -eq \"blank\")\r\n\t{\r\n\t\tif ($XenCenterNodeSelected)\r\n\t\t{\r\n\t\t\tcontinue\r\n\t\t}\r\n\t\t$XenCenterNodeSelected = 1;\r\t\t$SelectedObjectNames += \"XenCenter\"\r\n\t}\r\n}"
},
{
"name": "run-editor-sample-dynamic.txt",
"content": "[Sun Mar 7 16:02:00 2004] [notice] Apache/1.3.29 (Unix) configured -- resuming normal operations\r\n[Sun Mar 7 16:02:00 2004] [info] Server built: Feb 27 2004 13:56:37\r\n[Sun Mar 7 16:02:00 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)\r\n[Sun Mar 7 16:05:49 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 16:45:56 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 17:13:50 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 17:21:44 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 17:23:53 2004] statistics: Use of uninitialized value in concatenation (.) or string at /home/httpd/twiki/lib/TWiki.pm line 528.\r\n[Sun Mar 7 17:23:53 2004] statistics: Can't create file /home/httpd/twiki/data/Main/WebStatistics.txt - Permission denied\r\n[Sun Mar 7 17:27:37 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 17:31:39 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 17:58:00 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:00:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:10:09 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:19:01 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:42:29 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:52:30 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 18:58:52 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 19:03:58 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 19:08:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:04:35 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:11:33 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:12:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:25:31 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:44:48 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 20:58:27 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 21:16:17 2004] [error] [client xx.xx.xx.xx] File does not exist: /home/httpd/twiki/view/Main/WebHome\r\n[Sun Mar 7 21:20:14 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 21:31:12 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 21:39:55 2004] [info] [client xx.xx.xx.xx] (104)Connection reset by peer: client stopped connection before send body completed\r\n[Sun Mar 7 21:44:10 2004] [info] [client xx.xx.xx.xx] (104)Conne
},
{
"name": "run-editor-sample-f12-css.txt",
"content": "@charset 'UTF-8'; audio,canvas,video {\r\n display: inline-block\r\n}\r\n\r\naudio:not([controls]) {\r\n display: none\r\n}\r\n\r\nhtml {\r\n height: 100%;\r\n font-size: 100%;\r\n -webkit-text-size-adjust: 100%;\r\n -ms-text-size-adjust: 100%;\r\n width: 100%\r\n}\r\n\r\nhtml,button,input,select,textarea {\r\n font-family: sans-serif;\r\n color: #222\r\n}\r\n\r\nbody {\r\n margin: 0;\r\n font-size: 1em;\r\n line-height: 1.4\r\n}\r\n\r\na {\r\n color: #0af;\r\n text-decoration: none\r\n}\r\n\r\na:visited {\r\n color: #4ec4ff\r\n}\r\n\r\na:hover {\r\n color: #1a95d2\r\n}\r\n\r\na:focus {\r\n outline: thin dotted\r\n}\r\n\r\na:hover,a:active {\r\n outline: 0\r\n}\r\n\r\nabbr[title] {\r\n border-bottom: 1px dotted\r\n}\r\n\r\nb,strong {\r\n font-weight: 700\r\n}\r\n\r\nblockquote {\r\n margin: 1em 40px\r\n}\r\n\r\nhr {\r\n display: block;\r\n height: 1px;\r\n border: 0;\r\n border-top: 1px solid #ccc;\r\n margin: 1em 0;\r\n padding: 0\r\n}\r\n\r\npre,code,kbd,samp {\r\n font-family: monospace,serif;\r\n font-size: 1em\r\n}\r\n\r\npre {\r\n white-space: pre;\r\n white-space: pre-wrap;\r\n word-wrap: break-word\r\n}\r\n\r\nsmall {\r\n font-size: 85%\r\n}\r\n\r\nsub,sup {\r\n font-size: 75%;\r\n line-height: 0;\r\n position: relative;\r\n vertical-align: baseline\r\n}\r\n\r\nsup {\r\n top: -.5em}sub{bottom:-.25em\r\n}\r\n\r\nul,ol {\r\n margin: 0;\r\n padding: 0\r\n}\r\n\r\ndd {\r\n margin: 0\r\n}\r\n\r\nnav ul,nav ol {\r\n list-style: none;\r\n list-style-image: none\r\n}\r\n\r\nimg {\r\n border: 0;\r\n vertical-align: middle\r\n}\r\n\r\n.lt-ie9 {\r\n -ms-interpolation-mode: bicubic;\r\n display: block\r\n}\r\n\r\nsvg:not(:root) {\r\n overflow: hidden\r\n}\r\n\r\nfigure {\r\n margin: 0\r\n}\r\n\r\nform {\r\n margin: 0\r\n}\r\n\r\nfieldset {\r\n border: 0;\r\n margin: 0;\r\n padding: 0\r\n}\r\n\r\nlabel {\r\n cursor: pointer\r\n}\r\n\r\nlegend {\r\n border: 0;\r\n padding: 0;\r\n white-space: normal\r\n}\r\n\r\nbutton,input,select,textarea {\r\n font-size: 100%;\r\n margin: 0;\r\n vertical-align: baseline\r\n}\r\n\r\nbutton,input {\r\n line-height: normal\r\n}\r\n\r\nbutton,input[type=button],input[type=reset],input[type=submit] {\r\n cursor: pointer;\r\n -webkit-appearance: button\r\n}\r\n\r\nbutton[disabled],input[disabled] {\r\n cursor: default\r\n}\r\n\r\ninput[type=checkbox],input[type=radio] {\r\n box-sizing: border-box;\r\n padding: 0\r\n}\r\n\r\ninput[type=search] {\r\n -webkit-appearance: textfield;\r\n -moz-box-sizing: content-box;\r\n -webkit-box-sizing: content-box;\r\n box-sizing: content-box\r\n}\r\n\r\ninput[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-cancel-button {\r\n -webkit-appearance: none\r\n}\r\n\r\nbutton::-moz-focus-inner,input::-moz-focus-inner {\r\n border: 0;\r\n padding: 0\r\n}\r\n\r\ntextarea {\r\n overflow: auto;\r\n vertical-align: top;\r\n resize: vertical\r\n}\r\n\r\ninput:invalid,textarea:invalid {\r\n background-color: #f0dddd\r\n}\r\n\r\ntable {\r\n border-collapse: collapse;\r\n border-spacing: 0\r\n}\r\n\r\ntd {\r\n vertical-align: top\r\n}\r\n\r\n.chromeframe {\r\n margin: .2em 0;\r\n background: #ccc;\r\n color: #000;\r\n padding: .2em 0\r\n}\r\n\r\n.no-touch {\r\n text-rendering: geometricPrecision;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale\r\n}\r\n\r\nbody {\r\n background: #f6f6f6 url(../../images/patterns/noise_f6f6f6.png) repeat top left;\r\n font-family: Arial,sans-serif;\r\n min-height: 100%;\r\n min-width: 980px;\r\n position: relative;\r\n width: 100%\r\n}\r\n\r\nbody.partner-background {\r\n background: #f6f6f6 url(../../images/patterns/noise.png)\r\n}\r\n\r\n@-moz-document url-prefix() {\r\n img {\r\n display: inline-block\r\n }\r\n}\r\n\r\n.clst-main-title,.static-page .page-content>.clst-main-title {\r
},
{
"name": "run-editor-sample-html.txt",
"content": "<!DOCTYPE HTML>\r\n<!--\r\n\tComments are overrated\r\n-->\r\n<html>\r\n<head>\r\n\t<title>HTML Sample</title>\r\n\t<style type=\"text/css\">\r\n\t\th1 {\r\n\t\t\tcolor: #CCA3A3;\r\n\t\t}\r\n\t\tbody {\r\n\t\t}\r\n\t</style>\r\n\t<script type=\"text/javascript\">\r\n\t\twindow.alert(\"I am a sample...\");\r\n\t</script>\r\n</head>\r\n<body>\r\n\t<h1>Heading No.1</h1>\r\n\t<input disabled type=\"button\" value=\"Click me\" />\r\n</body>\r\n</html>\r\n"
},
{
"name": "run-editor-sample-js.txt",
"content": "/*\r\n © Microsoft. All rights reserved.\r\n\r\nhttps://microsoft.com\r\nblablahttp://en.wikipedia.org/wiki/Timisoara bla bla\r\nblabla\thttp://en.wikipedia.org/wiki/Timisoara bla bla\r\n\r\n This library is supported for use in Windows Tailored Apps only.\r\n\r\n Build: 6.2.8100.0\r\n Version: 0.5\r\n*/\r\n\r\nvar קודמות = \"מיותר קודמות צ'ט של, אם לשון העברית שינויים ויש, אם\";\r\n\r\n'a string\\\r\non multiple lines';\r\n(function (global, undefined) {\r\n\t\"use strict\";\r\n\tundefinedVariable = {}; undefinedVariable.bar = 5;\r\n\tundefinedVariable.foo = 5; undefinedVariable.baz = 10;\r\n\r\n function initializeProperties(target, members) {\r\n var keys = Object.keys(members);\r\n var properties;\r\n var i, len;\r\n for (i = 0, len = keys.length; i < len; i++) {\r\n var key = keys[i];\r\n var enumerable = key.charCodeAt(0) !== /*_*/95;\r\n var member = members[key];\r\n if (member && typeof member === 'object') {\r\n if (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {\r\n if (member.enumerable === undefined) {\r\n member.enumerable = enumerable;\r\n }\r\n properties = properties || {};\r\n properties[key] = member;\r\n continue;\r\n }\r\n }\r\n if (!enumerable) {\r\n properties = properties || {};\r\n properties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }\r\n continue;\r\n }\r\n target[key] = member;\r\n }\r\n if (properties) {\r\n Object.defineProperties(target, properties);\r\n }\r\n }\r\n\r\n (function (rootNamespace) {\r\n\r\n // Create the rootNamespace in the global namespace\r\n if (!global[rootNamespace]) {\r\n global[rootNamespace] = Object.create(Object.prototype);\r\n }\r\n\r\n // Cache the rootNamespace we just created in a local variable\r\n var _rootNamespace = global[rootNamespace];\r\n if (!_rootNamespace.Namespace) {\r\n _rootNamespace.Namespace = Object.create(Object.prototype);\r\n }\r\n\r\n function defineWithParent(parentNamespace, name, members) {\r\n /// <summary locid=\"1\">\r\n /// Defines a new namespace with the specified name, under the specified parent namespace.\r\n /// </summary>\r\n /// <param name=\"parentNamespace\" type=\"Object\" locid=\"2\">\r\n /// The parent namespace which will contain the new namespace.\r\n /// </param>\r\n /// <param name=\"name\" type=\"String\" locid=\"3\">\r\n /// Name of the new namespace.\r\n /// </param>\r\n /// <param name=\"members\" type=\"Object\" locid=\"4\">\r\n /// Members in the new namespace.\r\n /// </param>\r\n /// <returns locid=\"5\">\r\n /// The newly defined namespace.\r\n /// </returns>\r\n var currentNamespace = parentNamespace,\r\n namespaceFragments = name.split(\".\");\r\n\r\n for (var i = 0, len = namespaceFragments.length; i < len; i++) {\r\n var namespaceName = namespaceFragments[i];\r\n if (!currentNamespace[namespaceName]) {\r\n Object.defineProperty(currentNamespace, namespaceName,\r\n { value: {}, writable: false, enumerable: true, configurable: true }\r\n );\r\n }\r\n currentNamespace = currentNamespace[namespaceName];\r\n }\r\n\r\n if (members) {\r\n initializeProperties(currentNamespace, members);\r\n }\r\n\r\n return currentNamespace;\r\n };\r\n\r\n function
},
{
"name": "run-editor-sample-msn-js.txt",
"content": "(function(n){function t(n,i,r){return typeof n==\"number\"&&(t(i)?n>=i:!0)&&(t(r)?n<=r:!0)}function i(n,i){return typeof n==\"string\"&&(t(i)?n.length>=i:!0)}var r=n.isArray;n.extend({isNumber:t,isString:i,isObject:function(n){return typeof n==\"object\"&&n!==null},isDefined:function(n){return typeof n!=\"undefined\"},isArray:function(n,i){return r(n)&&(t(i)?n.length>=i:!0)}})})($vxp),function(n){function i(i){var u={},f,e,r;if(n.isString(i,1)){f=arguments.length>1?n.makeArray(arguments).slice(1).join(\"|\"):\"\\\\w+\",e=new RegExp(\"\\\\b(\"+f+\")=([^&#]+)\",\"ig\");while(r=e.exec(i))u[r[1][t]()]=r[2]}return u}function r(t,r){var e=n.param(n.extend(i(t),u(r))),f=/\\b[^?]*/g.exec(t).join(\"\");return f=e?f+\"?\"+e:f}function u(n){var r={},i;for(i in n)r[i[t]()]=n[i];return r}var t=\"toLowerCase\";n.extend({queryString:{setParam:r,getParam:i}})}($vxp),function(){String.prototype.format=function(){for(var t=this,n=0;n<arguments.length;++n)t=t.replace(new RegExp(\"\\\\{\"+n+\"\\\\}\",\"g\"),arguments[n]);return t}}();(function(n){var i;n.isDefined(window.MsnVideoUx)||(window.MsnVideoUx={}),n.vxpGlobal||(n.vxpGlobal={});var t=window.MsnVideoUx,e=[],r=[],o={},s=function(){return window.navigator.userAgent.match(/iPad/i)},u=function(){return/MSIE (\\d+\\.\\d+)/.test(window.navigator.userAgent)?new Number(RegExp.$1):/\\(IE (\\d+\\.\\d+)/.test(window.navigator.userAgent)?new Number(RegExp.$1):0},h=function(){return u()>0},nt=function(){return u()>=10},f,g=function(){var r,e;if(undefined==f){f=!1;var t=null,i=window.navigator.plugins,n=\"Shockwave Flash\",u=window.ActiveXObject;if(i&&i.length)t=i[n]||i[n+\" 2.0\"],t&&t.description&&(f=!0);else if(u)for(n=n.replace(\" \",\"\")+\".\",r=15;r>2;--r)try{t=new u(n+n+r),e=parseActiveXVersion(getActiveXVersion(t)),f=!0;break}catch(o){}}return f},it=function(n){for(var t in n)n[t]=encodeURIComponent(c(n[t]));return n},c=function(n,t){var i=\"\",e,u,o,f,r;if(n instanceof Array){for(e=t,t.charAt(t.length-1)==\"s\"&&(i+=\"<\"+t+\">\",e=t.substr(0,t.length-1)),u=0;u<n.length;u++)i+=c(n[u],e);t.charAt(t.length-1)==\"s\"&&(i+=\"</\"+t+\">\")}else if(n instanceof Object){t&&t!=\"$\"&&t!=\"value\"&&(i+=\"<\"+t),o=\"\",f={};for(r in n)r.indexOf(\"$\")!=0||r==\"$\"||r==\"value\"?o+=c(n[r],r):f[r.substr(1,r.length-1)]=n[r];if(t&&t!=\"$\"&&t!=\"value\"){for(r in f)i+=\" \"+r+'=\"'+tt(f[r])+'\"';i+=\">\"}i+=o,t&&t!=\"$\"&&t!=\"value\"&&(i+=\"</\"+t+\">\")}else n!=null&&(t&&t!=\"$\"&&t!=\"value\"&&(i+=\"<\"+t+\">\"),i+=k(n.toString()),t&&t!=\"$\"&&t!=\"value\"&&(i+=\"</\"+t+\">\"));return i},k=function(n){return n.replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\").replace(/\\\"/g,\"&quot;\").replace(/'/g,\"&apos;\")},tt=function(n){return n.replace(/\\\"/g,\"&quot;\")},l=function(t,i){n.initHub(t,i)},a=function(){for(var n=0;n<e.length;n++)window.Msn.Video.createWidget2(e[n]);e=[]},p=function(n){var i=document.getElementsByTagName(\"head\")[0],t=document.createElement(\"link\");t.setAttribute(\"rel\",\"stylesheet\"),t.setAttribute(\"type\",\"text/css\"),t.setAttribute(\"href\",n),i.appendChild(t)},y=function(n){var i=document.getElementsByTagName(\"head\")[0],t=document.createElement(\"style\");t.setAttribute(\"type\",\"text/css\"),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n)),i.appendChild(t)},v=function(){var t=n(\"#vxp_css_load_indicator\"),i;return t.length==0&&(n(\"<meta>\",{id:\"vxp_css_load_indicator\",name:\"vxp_css_load_indicator\",content:\"vxp_css_load_indicator\"}).appendTo(\"head\"),t=n(\"#vxp_css_load_indicator\")),i=t.css(\"font-size\"),i==\"8px\"},b=function(){window.MsnVideoUxStylesRequested||!window.MsnVideoUx.versionedFiles||v()||(window.MsnVideoUxStylesRequested=!0,p(window.MsnVideoUx.versionedFiles.css))},w=function(n){window.MsnVideoUxPaletteStylesRequested||(window.MsnVideoUxPaletteStylesRequested=!0,p(n))},d=function(n){var t=setInterval(function(){v()&&(clearInterval(t),n())},100)};b(),t.render=function(t,i,r,u,f,e){function k(){var k=document.getElementById(i),u=n.queryString.getParam(document.location.href.toSt
},
{
"name": "sample.abap.txt",
"content": "REPORT zrosetta_base64_encode_data.\n\nDATA: li_client TYPE REF TO if_http_client,\n lv_encoded TYPE string,\n lv_data TYPE xstring.\n\n\ncl_http_client=>create_by_url(\n EXPORTING\n url = 'http://rosettacode.org/favicon.ico'\n IMPORTING\n client = li_client ).\n\nli_client->send( ).\nli_client->receive( ).\n\nlv_data = li_client->response->get_data( ).\n\nCALL FUNCTION 'SSFC_BASE64_ENCODE'\n EXPORTING\n bindata = lv_data\n IMPORTING\n b64data = lv_encoded.\n\nWHILE strlen( lv_encoded ) > 100.\n WRITE: / lv_encoded(100).\n lv_encoded = lv_encoded+100.\nENDWHILE.\nWRITE: / lv_encoded.\n"
},
6 years ago
{
"name": "sample.aes.txt",
"content": "// Contract simulating developers organization\ncontract HackBG =\n\n record state = { developers: map(address, developer) }\n\n record developer = { name: string\n , age: int\n , skillset: map(skill, experience) }\n\n type skill = string\n type experience = int\n\n datatype event =\n LogDeveloperAdded(indexed address, indexed int, string)\n\n entrypoint init() : state = { developers = {} }\n\n stateful entrypoint dev_add(account: address, dev_name: string, dev_age: int) =\n require(!is_member(account), \"ERROR_DEVELOPER_ALREADY_EXISTS\")\n let dev : developer = { name = dev_name\n , age = dev_age\n , skillset = {} }\n put(state{ developers[account] = dev })\n Chain.event(LogDeveloperAdded(account, Chain.timestamp, dev_name))\n\n stateful entrypoint dev_update(account: address, dev_name: string, dev_age: int) =\n require(is_member(account), \"ERROR_DEVELOPER_DOES_NOT_EXIST\")\n put(state{ developers[account].name = dev_name })\n put(state{ developers[account].age = dev_age })\n\n function is_member(account: address) : bool =\n Map.member(account, state.developers)\n\n stateful entrypoint dev_skill_modify(account: address, skill: string, experience: int) =\n put(state{ developers[account].skillset[skill] = experience })\n\n entrypoint dev_get(account: address) : developer =\n state.developers[account]"
},
{
"name": "sample.apex.txt",
"content": "/* Using a single database query, find all the leads in\n the database that have the same email address as any\n of the leads being inserted or updated. */\nfor (Lead lead : [SELECT Email FROM Lead WHERE Email IN :leadMap.KeySet()]) {\n Lead newLead = leadMap.get(lead.Email);\n newLead.Email.addError('A lead with this email address already exists.');\n}\n"
},
{
"name": "sample.azcli.txt",
"content": "# Create a resource group.\naz group create --name myResourceGroup --location westeurope\n\n# Create a new virtual machine, this creates SSH keys if not present.\naz vm create --resource-group myResourceGroup --name myVM --image UbuntuLTS --generate-ssh-keys"
},
{
"name": "sample.bat.txt",
"content": "rem *******Begin Comment**************\nrem This program starts the superapp batch program on the network,\nrem directs the output to a file, and displays the file\nrem in Notepad.\nrem *******End Comment**************\n@echo off\nif exist C:\\output.txt goto EMPTYEXISTS\nsetlocal\n\tpath=g:\\programs\\superapp;%path%\n\tcall superapp>C:\\output.txt\nendlocal\n:EMPTYEXISTS\nstart notepad c:\\output.txt"
},
4 years ago
{
"name": "sample.bicep.txt",
"content": "targetScope = 'subscription'\n\nparam deployStorage bool = true\n\n@description('The object ID of the principal that will get the role assignment')\nparam aadPrincipalId string\n\nmodule stg './storage.bicep' = if(deployStorage) {\n name: 'storageDeploy'\n scope: resourceGroup('another-rg') // this will target another resource group in the same subscription\n params: {\n storageAccountName: '<YOURUNIQUESTORAGENAME>'\n }\n}\n\nvar contributor = 'b24988ac-6180-42a0-ab88-20f7382dd24c'\nresource roleDef 'Microsoft.Authorization/roleDefinitions@2018-01-01-preview' existing = {\n name: contributor\n}\n\nresource rbac 'Microsoft.Authorization/roleAssignments@2020-04-01-preview' = {\n name: guid(subscription().id, aadPrincipalId, contributor)\n properties: {\n roleDefinitionId: roleDef.id\n principalId: aadPrincipalId\n }\n}\n\noutput storageName array = stg.outputs.containerProps\n"
},
{
"name": "sample.c.txt",
"content": "// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full\n// license information.\n\n/*\n *\tCOMMAND LINE: -Ox -Gz -YX -UPROTOTYPES_REQUIRED\n */\n\n#pragma warning(disable : 4532)\n#pragma warning(disable : 4702)\n\n#if defined(_WIN32)\n\n#if defined(_M_SH)\n#define WIN_CE\n#endif\n\n#if defined(_M_AMD64)\n#define NEST_IN_FINALLY /* allow when __try nested in __finally OK */\n#endif\n\n#define NTSTATUS LONG\n#define EXCEPTION_NESTED_CALL 0x10\n#define RtlRaiseStatus(x) RaiseException((x), 0, 0, NULL)\n#define RtlRaiseException(x) \\\n RaiseException((x)->ExceptionCode, (x)->ExceptionFlags, \\\n (x)->NumberParameters, (x)->ExceptionInformation)\n#define IN\n#define OUT\n#if !(defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \\\n defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64))\n#define i386 1\n#endif\n#define try __try\n#define except __except\n#define finally __finally\n#define leave __leave\n\n#endif\n\n#define WIN32_LEAN_AND_MEAN\n\n#include \"stdio.h\"\n#if defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \\\n defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)\n#include \"setjmpex.h\"\n#else\n#include \"setjmp.h\"\n#endif\n#include \"float.h\"\n#include \"windows.h\"\n#include \"math.h\"\n\n#if !defined(STATUS_SUCCESS)\n#define STATUS_SUCCESS 0\n#endif\n#if !defined(STATUS_UNSUCCESSFUL)\n#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)\n#endif\n\n//\n// Define switch constants.\n//\n\n#define BLUE 0\n#define RED 1\n\n//\n// Define function prototypes.\n//\n\nVOID addtwo(IN LONG First, IN LONG Second, IN PLONG Place);\n\nVOID bar1(IN NTSTATUS Status, IN PLONG Counter);\n\nVOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter);\n\nVOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter);\n\nLONG Echo(IN LONG Value);\n\n#if !defined(WIN_CE) // return through finally not allowed on WinCE\nVOID eret(IN NTSTATUS Status, IN PLONG Counter);\n#endif\n\nVOID except1(IN PLONG Counter);\n\nULONG\nexcept2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);\n\nULONG\nexcept3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);\n\nVOID foo1(IN NTSTATUS Status);\n\nVOID foo2(IN PLONG BlackHole, IN PLONG BadAddress);\n\n#if !defined(WIN_CE) // return from finally not allowed on WinCE\nVOID fret(IN PLONG Counter);\n#endif\n\nBOOLEAN\nTkm(VOID);\n\nVOID Test61Part2(IN OUT PULONG Counter);\n\ndouble SquareDouble(IN double op);\n\nDECLSPEC_NOINLINE\nULONG\nPgFilter(VOID)\n\n{\n\n printf(\"filter entered...\");\n return EXCEPTION_EXECUTE_HANDLER;\n}\n\n#pragma warning(push)\n#pragma warning(disable : 4532)\n\nVOID PgTest69(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 1) {\n *State += 1;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 1) == 1) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {\n if (*State != 2) {\n *Fault += 1;\n }\n }\n\n return;\n}\n\nVOID PgTest70(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 2) {\n PgFilter();\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n except(((*State += 2) == 2) ? EXCEPTION_EXECUTE_HANDLER\n : EXCEPTION_CONTINUE_SEARCH) {\n *Fault += 1;\n }\n\n return;\n}\n\nVOID PgTest71(IN PLONG State, IN PLONG Fault)\n\n{\n\n try {\n try {\n try {\n *Fault += 1;\n }\n finally {\n if (AbnormalTermination()) {\n if (*State == 3) {\n *State += 3;\n return;\n\n } else {\n *Fault += 1;\n }\n }\n }\n }\n finally {\n if (AbnormalTermination())
},
{
"name": "sample.cameligo.txt",
"content": "type storage = int\ntype parameter =\n Increment of int\n| Decrement of int\n| Reset\ntype return = operation list * storage\n// Two entrypoints\nlet add (store, delta : storage * int) : storage = store + delta\nlet sub (store, delta : storage * int) : storage = store - delta\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\nlet main (action, store : parameter * storage) : return =\n ([] : operation list), // No operations\n (match action with\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0)\n"
},
{
"name": "sample.clojure.txt",
"content": "(ns game-of-life\n \"Conway's Game of Life, based on the work of\n Christophe Grand (http://clj-me.cgrand.net/2011/08/19/conways-game-of-life)\n and Laurent Petit (https://gist.github.com/1200343).\")\n\n;;; Core game of life's algorithm functions\n\n(defn neighbors\n \"Given a cell's coordinates `[x y]`, returns the coordinates of its\n neighbors.\"\n [[x y]]\n (for [dx [-1 0 1]\n dy (if (zero? dx)\n [-1 1]\n [-1 0 1])]\n [(+ dx x) (+ dy y)]))\n\n(defn step\n \"Given a set of living `cells`, computes the new set of living cells.\"\n [cells]\n (set (for [[cell n] (frequencies (mapcat neighbors cells))\n :when (or (= n 3)\n (and (= n 2)\n (cells cell)))]\n cell)))\n\n;;; Utility methods for displaying game on a text terminal\n\n(defn print-grid\n \"Prints a `grid` of `w` columns and `h` rows, on *out*, representing a\n step in the game.\"\n [grid w h]\n (doseq [x (range (inc w))\n y (range (inc h))]\n (when (= y 0) (println))\n (print (if (grid [x y])\n \"[X]\"\n \" . \"))))\n\n(defn print-grids\n \"Prints a sequence of `grids` of `w` columns and `h` rows on *out*,\n representing several steps.\"\n [grids w h]\n (doseq [grid grids]\n (print-grid grid w h)\n (println)))\n\n;;; Launches an example grid\n\n(def grid\n \"`grid` represents the initial set of living cells\"\n #{[2 1] [2 2] [2 3]})\n\n(print-grids (take 3 (iterate step grid)) 5 5)"
},
{
"name": "sample.coffeescript.txt",
"content": "\"\"\"\nA CoffeeScript sample.\n\"\"\"\n\nclass Vehicle\n constructor: (@name) =>\n \n drive: () =>\n alert \"Conducting #{@name}\"\n\nclass Car extends Vehicle\n drive: () =>\n alert \"Driving #{@name}\"\n\nc = new Car \"Brandie\"\n\nwhile notAtDestination()\n c.drive()\n\nraceVehicles = (new Car for i in [1..100])\n\nstartRace = (vehicles) -> [vehicle.drive() for vehicle in vehicles]\n\nfancyRegExp = ///\n\t(\\d+)\t# numbers\n\t(\\w*)\t# letters\n\t$\t\t# the end\n///\n"
},
{
"name": "sample.cpp.txt",
"content": "#include \"pch.h\"\n#include \"Direct3DBase.h\"\n\nusing namespace Microsoft::WRL;\nusing namespace Windows::UI::Core;\nusing namespace Windows::Foundation;\n\n// Constructor.\nDirect3DBase::Direct3DBase()\n{\n}\n\n// Initialize the Direct3D resources required to run.\nvoid Direct3DBase::Initialize(CoreWindow^ window)\n{\n m_window = window;\n \n CreateDeviceResources();\n CreateWindowSizeDependentResources();\n}\n\n// These are the resources that depend on the device.\nvoid Direct3DBase::CreateDeviceResources()\n{\n // This flag adds support for surfaces with a different color channel ordering than the API default.\n // It is recommended usage, and is required for compatibility with Direct2D.\n UINT creationFlags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;\n\n#if defined(_DEBUG)\n // If the project is in a debug build, enable debugging via SDK Layers with this flag.\n creationFlags |= D3D11_CREATE_DEVICE_DEBUG;\n#endif\n\n // This array defines the set of DirectX hardware feature levels this app will support.\n // Note the ordering should be preserved.\n // Don't forget to declare your application's minimum required feature level in its\n // description. All applications are assumed to support 9.1 unless otherwise stated.\n D3D_FEATURE_LEVEL featureLevels[] = \n {\n D3D_FEATURE_LEVEL_11_1,\n D3D_FEATURE_LEVEL_11_0,\n D3D_FEATURE_LEVEL_10_1,\n D3D_FEATURE_LEVEL_10_0,\n D3D_FEATURE_LEVEL_9_3,\n D3D_FEATURE_LEVEL_9_2,\n D3D_FEATURE_LEVEL_9_1\n };\n\n // Create the DX11 API device object, and get a corresponding context.\n ComPtr<ID3D11Device> device;\n ComPtr<ID3D11DeviceContext> context;\n DX::ThrowIfFailed(\n D3D11CreateDevice(\n nullptr, // specify null to use the default adapter\n D3D_DRIVER_TYPE_HARDWARE,\n nullptr, // leave as nullptr unless software device\n creationFlags, // optionally set debug and Direct2D compatibility flags\n featureLevels, // list of feature levels this app can support\n ARRAYSIZE(featureLevels), // number of entries in above list\n D3D11_SDK_VERSION, // always set this to D3D11_SDK_VERSION\n &device, // returns the Direct3D device created\n &m_featureLevel, // returns feature level of device created\n &context // returns the device immediate context\n )\n );\n\n // Get the DirectX11.1 device by QI off the DirectX11 one.\n DX::ThrowIfFailed(\n device.As(&m_d3dDevice)\n );\n\n // And get the corresponding device context in the same way.\n DX::ThrowIfFailed(\n context.As(&m_d3dContext)\n );\n}\n\n// Allocate all memory resources that change on a window SizeChanged event.\nvoid Direct3DBase::CreateWindowSizeDependentResources()\n{ \n // Store the window bounds so the next time we get a SizeChanged event we can\n // avoid rebuilding everything if the size is identical.\n m_windowBounds = m_window->Bounds;\n\n // If the swap chain already exists, resize it.\n if(m_swapChain != nullptr)\n {\n DX::ThrowIfFailed(\n m_swapChain->ResizeBuffers(2, 0, 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0)\n );\n }\n // Otherwise, create a new one.\n else\n {\n // Create a descriptor for the swap chain.\n DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {0};\n swapChainDesc.Width = 0; // use automatic sizing\n swapChainDesc.Height = 0;\n swapChainDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; // this is the most common swapchain format\n swapChainDesc.Stereo = false; \n swapChainDesc.SampleDesc.Count = 1; // don't use multi-sampling\n swapChainDesc.SampleDesc.Quality = 0;\n swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\n sw
},
{
"name": "sample.csharp.txt",
"content": "/*\r\n* C# Program to Display All the Prime Numbers Between 1 to 100\r\n*/\r\n\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace VS\r\n{\r\n\tclass Program\r\n\t{\r\n\t\tstatic void Main(string[] args)\r\n \t\t{\r\n\t\t\tbool isPrime = true;\r\n\t\t\tConsole.WriteLine(\"Prime Numbers : \");\r\n\t\t\tfor (int i = 2; i <= 100; i++)\r\n\t\t\t{\r\n\t\t\t\tfor (int j = 2; j <= 100; j++)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (i != j && i % j == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tisPrime = false;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (isPrime)\r\n\t\t\t\t{\r\n\t\t\t\t\tConsole.Write(\"\\t\" +i);\r\n\t\t\t\t}\r\n\t\t\t\tisPrime = true;\r\n\t\t\t}\r\n\t\t\tConsole.ReadKey();\r\n\t\t}\r\n\t}\r\n}\r\n"
},
{
"name": "sample.csp.txt",
"content": "Content-Security-Policy: default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com"
},
{
"name": "sample.css.txt",
"content": "html {\r\n background-color: #e2e2e2;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\nbody {\r\n background-color: #fff;\r\n border-top: solid 10px #000;\r\n color: #333;\r\n font-size: .85em;\r\n font-family: \"Segoe UI\",\"HelveticaNeue-Light\", sans-serif;\r\n margin: 0;\r\n padding: 0;\r\n}\r\n\r\na:link, a:visited, \r\na:active, a:hover {\r\n color: #333;\r\n outline: none;\r\n padding-left: 0;\r\n padding-right: 3px;\r\n text-decoration: none;\r\n \r\n}\r\n\r\n\r\na:hover {\r\n background-color: #c7d1d6;\r\n}\r\n\r\n\r\nheader, footer, hgroup\r\nnav, section {\r\n display: block;\r\n}\r\n\r\n.float-left {\r\n float: left;\r\n}\r\n\r\n.float-right {\r\n float: right;\r\n}\r\n\r\n.highlight {\r\n/* background-color: #a6dbed;\r\n padding-left: 5px;\r\n padding-right: 5px;*/\r\n}\r\n\r\n.clear-fix:after {\r\n content: \".\";\r\n clear: both;\r\n display: block;\r\n height: 0;\r\n visibility: hidden;\r\n}\r\n\r\nh1, h2, h3, \r\nh4, h5, h6 {\r\n color: #000;\r\n margin-bottom: 0;\r\n padding-bottom: 0;\r\n \r\n}\r\n\r\nh1 {\r\n font-size: 2em; \r\n}\r\n\r\nh2 {\r\n font-size: 1.75em;\r\n}\r\n\r\nh3 {\r\n font-size: 1.2em;\r\n}\r\n\r\nh4 {\r\n font-size: 1.1em;\r\n}\r\n\r\nh5, h6 {\r\n font-size: 1em;\r\n}\r\n\r\n\r\n.tile {\r\n /* 2px solid #7ac0da; */\r\n border: 0;\r\n \r\n float: left;\r\n width: 200px;\r\n height: 325px;\r\n \r\n padding: 5px;\r\n margin-right: 5px;\r\n margin-bottom: 20px;\r\n margin-top: 20px;\r\n -webkit-perspective: 0;\r\n -webkit-transform-style: preserve-3d;\r\n -webkit-transition: -webkit-transform 0.2s;\r\n -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);\r\n background-position: center center;\r\n background-repeat: no-repeat;\r\n \r\n background-color: #fff;\r\n}\r\n\r\n.tile-item {\r\n /* 2px solid #7ac0da; */\r\n border-color: inherit;\r\n float: left;\r\n width: 50px;\r\n height: 70px;\r\n margin-right: 20px;\r\n margin-bottom: 20px;\r\n margin-top: 20px;\r\n background-image: url('../Images/documents.png');\r\n background-repeat: no-repeat;\r\n \r\n}\r\n\r\n.tile-wrapper {\r\n width: 100%;\r\n font-family: \"Segoe UI\" , Tahoma, Geneva, Verdana, sans-serif;\r\n line-height: 21px;\r\n font-size: 14px;\r\n}\r\n\r\na.blue-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.blue-box:hover {\r\n border: 4px solid #8ABAE4; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n \r\na.green-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.green-box:hover {\r\n border: 4px solid #9CCF42; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n background-color: #FFFFFF;\r\n}\r\n\r\n\r\na.green-box2 {\r\n font-size: 14px;\r\n height: 48px;\r\n width: 48px;\r\n display: block; /* border-color: #C0C0C0; */\r\n padding-top: 6px;\r\n font-weight: bold;\r\n \r\n}\r\n\r\n a.green-box2:hover {\r\n border: solid #8ABAE4;\r\n padding-top: 0px;\r\n padding-left: 0px;\r\n background-image: url('../Images/documents.png');\r\n background-color: #EFEFEF;\r\n}\r\n\r\na.yellow-box {\r\n font-size: 28px;\r\n height: 100px;\r\n display: block;\r\n border-style: solid;\r\n border-width: 1px 1px 4px 1px;\r\n border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;\r\n padding-top: 15px;\r\n padding-left: 15px;\r\n}\r\n\r\n a.yellow-box:hover {\r\n border: 4px solid #DECF6B; \r\n padding-top: 12px;\r\n padding-left: 12px;\r\n
},
{
"name": "sample.dart.txt",
"content": "import 'dart:async';\nimport 'dart:math' show Random;\nmain() async {\n print('Compute π using the Monte Carlo method.');\n await for (var estimate in computePi().take(100)) {\n print('π ≅ $estimate');\n }\n}\n/// Generates a stream of increasingly accurate estimates of π.\nStream<double> computePi({int batch: 100000}) async* {\n var total = 0;\n var count = 0;\n while (true) {\n var points = generateRandom().take(batch);\n var inside = points.where((p) => p.isInsideUnitCircle);\n total += batch;\n count += inside.length;\n var ratio = count / total;\n // Area of a circle is A = π⋅r², therefore π = A/r².\n // So, when given random points with x ∈ <0,1>,\n // y ∈ <0,1>, the ratio of those inside a unit circle\n // should approach π / 4. Therefore, the value of π\n // should be:\n yield ratio * 4;\n }\n}\nIterable<Point> generateRandom([int seed]) sync* {\n final random = Random(seed);\n while (true) {\n yield Point(random.nextDouble(), random.nextDouble());\n }\n}\nclass Point {\n final double x, y;\n const Point(this.x, this.y);\n bool get isInsideUnitCircle => x * x + y * y <= 1;\n}\n"
},
{
"name": "sample.dockerfile.txt",
"content": "FROM mono:3.12\r\n\r\nENV KRE_FEED https://www.myget.org/F/aspnetvnext/api/v2\r\nENV KRE_USER_HOME /opt/kre\r\n\r\nRUN apt-get -qq update && apt-get -qqy install unzip \r\n\r\nONBUILD RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.sh | sh\r\nONBUILD RUN bash -c \"source $KRE_USER_HOME/kvm/kvm.sh \\\r\n && kvm install latest -a default \\\r\n && kvm alias default | xargs -i ln -s $KRE_USER_HOME/packages/{} $KRE_USER_HOME/packages/default\"\r\n\r\n# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)\r\nRUN apt-get -qqy install \\\r\n autoconf \\\r\n automake \\\r\n build-essential \\\r\n libtool \r\nRUN LIBUV_VERSION=1.0.0-rc2 \\\r\n && curl -sSL https://github.com/joyent/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \\\r\n && cd /usr/local/src/libuv-$LIBUV_VERSION \\\r\n && sh autogen.sh && ./configure && make && make install \\\r\n && rm -rf /usr/local/src/libuv-$LIBUV_VERSION \\\r\n && ldconfig\r\n\r\nENV PATH $PATH:$KRE_USER_HOME/packages/default/bin\r\n\r\n# Extra things to test\r\nRUN echo \"string at end\"\r\nRUN echo must work 'some str' and some more\r\nRUN echo hi this is # not a comment\r\nRUN echo 'String with ${VAR} and another $one here'"
},
{
"name": "sample.elixir.txt",
"content": "# Elixir is a dynamic, functional language for building scalable\n# and maintainable applications. Learn more: https://elixir-lang.org\n\n\"Elixir\" |> String.graphemes() |> Enum.frequencies()\n#=> %{\"E\" => 1, \"i\" => 2, \"l\" => 1, \"r\" => 1, \"x\" => 1}\n\n\n### Scalability ###\n\n# All Elixir code runs inside lightweight threads of execution (called processes)\n# that are isolated and exchange information via messages:\n\ncurrent_process = self()\n\n# Spawn an Elixir process (not an operating system one!)\nspawn_link(fn ->\n send(current_process, {:msg, \"hello world\"})\nend)\n\n# Block until the message is received\nreceive do\n {:msg, contents} -> IO.puts(contents)\nend\n\n\n### Fault-tolerance ###\n\n# To cope with failures, Elixir provides supervisors which describe\n# how to restart parts of your system when things go awry, going back\n# to a known initial state that is guaranteed to work:\n\nchildren = [\n TCP.Pool,\n {TCP.Acceptor, port: 4040}\n]\n\nSupervisor.start_link(children, strategy: :one_for_one)\n\n\n### Functional programming ###\n\n# Functional programming promotes a coding style that helps\n# developers write code that is short, concise, and maintainable.\n# One prominent example is pattern matching:\n\n%User{name: name, age: age} = User.get(\"John Doe\")\nname #=> \"John Doe\"\n\n# When mixed with guards, pattern matching allows us to elegantly\n# match and assert specific conditions for some code to execute:\n\ndef drive(%User{age: age}) when age >= 16 do\n # Code that drives a car\nend\n\ndrive(User.get(\"John Doe\"))\n#=> Fails if the user is under 16\n\n\n### Extensibility and DSLs ###\n\n# Elixir has been designed to be extensible, letting developers\n# naturally extend the language to particular domains,\n# in order to increase their productivity.\n\ndefmodule MathTest do\n use ExUnit.Case, async: true\n\n test \"can add two numbers\" do\n assert 1 + 1 == 2\n end\nend\n\n\n### Erlang compatible ###\n\n# An Elixir programmer can invoke any Erlang function with no runtime cost:\n\n:crypto.hash(:md5, \"Using crypto from Erlang OTP\")\n#=> <<192, 223, 75, 115, ...>>\n"
},
{
"name": "sample.fsharp.txt",
"content": "(* Sample F# application *)\r\n[<EntryPoint>]\r\nlet main argv = \r\n printfn \"%A\" argv\r\n System.Console.WriteLine(\"Hello from F#\")\r\n 0 // return an integer exit code\r\n\r\n//-------------------------------------------------------- \r\n"
},
{
"name": "sample.go.txt",
"content": "// We often need our programs to perform operations on\r\n// collections of data, like selecting all items that\r\n// satisfy a given predicate or mapping all items to a new\r\n// collection with a custom function.\r\n\r\n// In some languages it's idiomatic to use [generic](http://en.wikipedia.org/wiki/Generic_programming)\r\n// data structures and algorithms. Go does not support\r\n// generics; in Go it's common to provide collection\r\n// functions if and when they are specifically needed for\r\n// your program and data types.\r\n\r\n// Here are some example collection functions for slices\r\n// of `strings`. You can use these examples to build your\r\n// own functions. Note that in some cases it may be\r\n// clearest to just inline the collection-manipulating\r\n// code directly, instead of creating and calling a\r\n// helper function.\r\n\r\npackage main\r\n\r\nimport \"strings\"\r\nimport \"fmt\"\r\n\r\n// Returns the first index of the target string `t`, or\r\n// -1 if no match is found.\r\nfunc Index(vs []string, t string) int {\r\n for i, v := range vs {\r\n if v == t {\r\n return i\r\n }\r\n }\r\n return -1\r\n}\r\n\r\n// Returns `true` if the target string t is in the\r\n// slice.\r\nfunc Include(vs []string, t string) bool {\r\n return Index(vs, t) >= 0\r\n}\r\n\r\n// Returns `true` if one of the strings in the slice\r\n// satisfies the predicate `f`.\r\nfunc Any(vs []string, f func(string) bool) bool {\r\n for _, v := range vs {\r\n if f(v) {\r\n return true\r\n }\r\n }\r\n return false\r\n}\r\n\r\n// Returns `true` if all of the strings in the slice\r\n// satisfy the predicate `f`.\r\nfunc All(vs []string, f func(string) bool) bool {\r\n for _, v := range vs {\r\n if !f(v) {\r\n return false\r\n }\r\n }\r\n return true\r\n}\r\n\r\n// Returns a new slice containing all strings in the\r\n// slice that satisfy the predicate `f`.\r\nfunc Filter(vs []string, f func(string) bool) []string {\r\n vsf := make([]string, 0)\r\n for _, v := range vs {\r\n if f(v) {\r\n vsf = append(vsf, v)\r\n }\r\n }\r\n return vsf\r\n}\r\n\r\n// Returns a new slice containing the results of applying\r\n// the function `f` to each string in the original slice.\r\nfunc Map(vs []string, f func(string) string) []string {\r\n vsm := make([]string, len(vs))\r\n for i, v := range vs {\r\n vsm[i] = f(v)\r\n }\r\n return vsm\r\n}\r\n\r\nfunc main() {\r\n\r\n // Here we try out our various collection functions.\r\n var strs = []string{\"peach\", \"apple\", \"pear\", \"plum\"}\r\n\r\n fmt.Println(Index(strs, \"pear\"))\r\n\r\n fmt.Println(Include(strs, \"grape\"))\r\n\r\n fmt.Println(Any(strs, func(v string) bool {\r\n return strings.HasPrefix(v, \"p\")\r\n }))\r\n\r\n fmt.Println(All(strs, func(v string) bool {\r\n return strings.HasPrefix(v, \"p\")\r\n }))\r\n\r\n fmt.Println(Filter(strs, func(v string) bool {\r\n return strings.Contains(v, \"e\")\r\n }))\r\n\r\n // The above examples all used anonymous functions,\r\n // but you can also use named functions of the correct\r\n // type.\r\n fmt.Println(Map(strs, strings.ToUpper))\r\n\r\n}\r\n"
},
{
"name": "sample.graphql.txt",
"content": "# GraphQL Schema Definition Language\n\n\"\"\"\nColor value\n\"\"\"\nscalar Color\n\n\"\"\"\nNode interface\n\n- allows (re)fetch arbitrary entity only by ID\n- allows client side cache normalization\n\nSee [Relay Global Object Identification Specification](https://facebook.github.io/relay/graphql/objectidentification.htm)\n\"\"\"\ninterface Node {\n \"\"\"\n Globally unique identifier,\n typically `${__typename}:${dbId}`\n may be encoded in *base64*\n \"\"\"\n id: ID!\n}\n\n\"\"\"\nA character in the Star Wars Trilogy\n\"\"\"\ninterface Character {\n \"\"\"\n The id of the character.\n \"\"\"\n id: ID!\n\n \"\"\"\n The name of the character.\n \"\"\"\n name: String\n\n \"\"\"\n The friends of the character, or an empty list if they have none.\n \"\"\"\n friends: [Character]\n\n \"\"\"\n Which movies they appear in\n \"\"\"\n appearsIn: [Episode]\n\n \"\"\"\n All secrets about their past\n \"\"\"\n secretBackstory: String\n}\n\n\"\"\"\nA mechanical creature in the Star Wars universe.\n\"\"\"\ntype Droid implements Character {\n \"\"\"\n The id of the droid.\n \"\"\"\n id: ID!\n\n \"\"\"\n The name of the droid.\n \"\"\"\n name: String\n\n \"\"\"\n The friends of the droid, or an empty list if they have none.\n \"\"\"\n friends: [Character]\n\n \"\"\"\n Which movies they appear in.\n \"\"\"\n appearsIn: [Episode]\n\n \"\"\"\n Construction date and the name of the designer.\n \"\"\"\n secretBackstory: String\n\n \"\"\"\n The primary function of the droid.\n \"\"\"\n primaryFunction: String\n\n \"\"\"\n Chase color of the droid.\n \"\"\"\n color: Color\n}\n\n# One of the films in the Star Wars Trilogy\nenum Episode {\n \"\"\"\n Released in 1977.\n \"\"\"\n NEWHOPE\n\n \"\"\"\n Released in 1980.\n \"\"\"\n EMPIRE\n\n \"\"\"\n Released in 1983.\n \"\"\"\n JEDI\n}\n\n\"\"\"\nA humanoid creature in the Star Wars universe.\n\"\"\"\ntype Human implements Character {\n \"\"\"\n The id of the human.\n \"\"\"\n id: ID!\n\n \"\"\"\n The name of the human.\n \"\"\"\n name: String\n\n \"\"\"\n The friends of the human, or an empty list if they have none.\n \"\"\"\n friends: [Character]\n\n \"\"\"\n Which movies they appear in.\n \"\"\"\n appearsIn: [Episode]\n\n \"\"\"\n The home planet of the human, or null if unknown.\n \"\"\"\n homePlanet: String\n\n \"\"\"\n Where are they from and how they came to be who they are.\n \"\"\"\n secretBackstory: String\n}\n\nenum LengthUnit {\n METER\n FEET\n}\n\ntype Starship {\n id: ID!\n name: String!\n length(unit: LengthUnit = METER): Float\n}\n\nunion SearchResult = Human | Droid | Starship\n\ninput SearchInput {\n name: String\n episode: Episode\n}\n\n\"\"\"\nRoot Query\n\"\"\"\ntype Query {\n \"\"\"\n Return the hero by episode.\n \"\"\"\n hero(\n \"\"\"\n If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.\n \"\"\"\n episode: Episode\n ): Character\n\n \"\"\"\n Return the Human by ID.\n \"\"\"\n human(\n \"\"\"\n id of the human\n \"\"\"\n id: ID!\n ): Human\n\n \"\"\"\n Return the Droid by ID.\n \"\"\"\n droid(\n \"\"\"\n id of the droid\n \"\"\"\n id: ID!\n ): Droid\n\n \"\"\"\n Search everything by name\n\n __NOTE__: You should use Relay pagination\n \"\"\"\n search(search: SearchInput!): [SearchResult]\n @deprecated(reason: \"`search` will be replaced.\")\n}\n\n\"\"\"\nRoot Mutation\n\"\"\"\ntype Mutation {\n \"\"\"\n Save the favorite episode.\n \"\"\"\n favorite(\n \"\"\"\n Favorite episode.\n \"\"\"\n episode: Episode!\n ): Episode\n}\n\n\"\"\"\nSubscriptions — live events\n\"\"\"\ntype Subscription {\n \"\"\"\n Message\n \"\"\"\n message: String\n}\n\nextend type Query {\n \"\"\"\n Dummy query for highlighting test\n \"\"\"\n dummy(\n int: Int = 123\n float: Float = 123.456\n str: String = \"Hello World!\"\n boolDefaultTrue: Boolean = true\n boolDefaultFalse: Boolean = false\n id: ID\n search: SearchInput = null\n )
},
{
"name": "sample.handlebars.txt",
"content": "\n<div class=\"entry\">\n\t<h1>{{title}}</h1>\n\t{{#if author}}\n\t<h2>{{author.firstName}} {{author.lastName}}</h2>\n\t{{else}}\n\t<h2>Unknown Author</h2>\n\t{{/if}}\n\t{{contentBody}}\n</div>\n\n{{#unless license}}\n <h3 class=\"warning\">WARNING: This entry does not have a license!</h3>\n{{/unless}}\n\n<div class=\"footnotes\">\n\t<ul>\n\t\t{{#each footnotes}}\n\t\t<li>{{this}}</li>\n\t\t{{/each}}\n\t</ul>\n</div>\n\n<h1>Comments</h1>\n\n<div id=\"comments\">\n\t{{#each comments}}\n\t<h2><a href=\"/posts/{{../permalink}}#{{id}}\">{{title}}</a></h2>\n\t<div>{{body}}</div>\n\t{{/each}}\n</div>\n"
},
{
"name": "sample.hcl.txt",
"content": "terraform {\r\n required_providers {\r\n aws = {\r\n source = \"hashicorp/aws\"\r\n version = \"~> 1.0.4\"\r\n }\r\n }\r\n}\r\n\r\nvariable \"aws_region\" {}\r\n\r\nvariable \"base_cidr_block\" {\r\n description = \"A /16 CIDR range definition, such as 10.1.0.0/16, that the VPC will use\"\r\n default = \"10.1.0.0/16\"\r\n}\r\n\r\nvariable \"availability_zones\" {\r\n description = \"A list of availability zones in which to create subnets\"\r\n type = list(string)\r\n}\r\n\r\nprovider \"aws\" {\r\n region = var.aws_region\r\n}\r\n\r\nresource \"aws_vpc\" \"main\" {\r\n # Referencing the base_cidr_block variable allows the network address\r\n # to be changed without modifying the configuration.\r\n cidr_block = var.base_cidr_block\r\n}\r\n\r\nresource \"aws_subnet\" \"az\" {\r\n # Create one subnet for each given availability zone.\r\n count = length(var.availability_zones)\r\n\r\n # For each subnet, use one of the specified availability zones.\r\n availability_zone = var.availability_zones[count.index]\r\n\r\n # By referencing the aws_vpc.main object, Terraform knows that the subnet\r\n # must be created only after the VPC is created.\r\n vpc_id = aws_vpc.main.id\r\n\r\n # Built-in functions and operators can be used for simple transformations of\r\n # values, such as computing a subnet address. Here we create a /20 prefix for\r\n # each subnet, using consecutive addresses for each availability zone,\r\n # such as 10.1.16.0/20 .\r\n cidr_block = cidrsubnet(aws_vpc.main.cidr_block, 4, count.index+1)\r\n}\r\n"
},
{
"name": "sample.html.txt",
"content": "<!DOCTYPE HTML>\r\n<!--Example of comments in HTML-->\r\n<html>\r\n<head>\r\n\t<!--This is the head section-->\r\n\t<title>HTML Sample</title>\r\n\t<meta charset=\"utf-8\">\r\n\r\n\t<!--This is the style tag to set style on elements-->\r\n\t<style type=\"text/css\">\r\n\t\th1\r\n\t\t{\r\n\t\t\tfont-family: Tahoma;\r\n\t\t\tfont-size: 40px;\r\n\t\t\tfont-weight: normal;\r\n\t\t\tmargin: 50px;\r\n\t\t\tcolor: #a0a0a0;\r\n\t\t}\r\n\r\n\t\th2\r\n\t\t{\r\n\t\t\tfont-family: Tahoma;\r\n\t\t\tfont-size: 30px;\r\n\t\t\tfont-weight: normal;\r\n\t\t\tmargin: 50px;\r\n\t\t\tcolor: #fff;\r\n\t\t}\r\n\r\n\t\tp\r\n\t\t{\r\n\t\t\tfont-family: Tahoma;\r\n\t\t\tfont-size: 17px;\r\n\t\t\tfont-weight: normal;\r\n\t\t\tmargin: 0px 200px;\r\n\t\t\tcolor: #fff;\r\n\t\t}\r\n\r\n\t\tdiv.Center\r\n\t\t{\r\n\t\t\ttext-align: center;\r\n\t\t}\r\n\r\n\t\tdiv.Blue\r\n\t\t{\r\n\t\t\tpadding: 50px;\r\n\t\t\tbackground-color: #7bd2ff;\r\n\t\t}\r\n\r\n\t\tbutton.Gray\r\n\t\t{\r\n\t\t\tfont-family: Tahoma;\r\n\t\t\tfont-size: 17px;\r\n\t\t\tfont-weight: normal;\r\n\t\t\tmargin-top: 100px;\r\n\t\t\tpadding: 10px 50px;\r\n\t\t\tbackground-color: #727272;\r\n\t\t\tcolor: #fff;\r\n\t\t\toutline: 0;\r\n \t\t\tborder: none;\r\n \t\t\tcursor: pointer;\r\n\t\t}\r\n\r\n\t\tbutton.Gray:hover\r\n\t\t{\r\n\t\t\tbackground-color: #898888;\r\n\t\t}\r\n\r\n\t\tbutton.Gray:active\r\n\t\t{\r\n\t\t\tbackground-color: #636161;\r\n\t\t}\r\n\r\n\t</style>\r\n\r\n\t<!--This is the script tag-->\r\n\t<script type=\"text/javascript\">\r\n\t\tfunction ButtonClick(){\r\n\t\t\t// Example of comments in JavaScript\r\n\t\t\twindow.alert(\"I'm an alert sample!\");\r\n\t\t}\r\n\t</script>\r\n</head>\r\n<body>\r\n\t<!--This is the body section-->\r\n\t<div class=\"Center\">\r\n\t\t<h1>NAME OF SITE</h1>\r\n\t</div>\r\n\t<div class=\"Center Blue\">\r\n\t\t\t<h2>I'm h2 Header! Edit me in &lt;h2&gt;</h2>\r\n\t\t\t<p>\r\n\t\t\t\tI'm a paragraph! Edit me in &lt;p&gt;\r\n\t\t\t\tto add your own content and make changes to the style and font.\r\n\t\t\t\tIt's easy! Just change the text between &lt;p&gt; ... &lt;/p&gt; and change the style in &lt;style&gt;.\r\n\t\t\t\tYou can make it as long as you wish. The browser will automatically wrap the lines to accommodate the\r\n\t\t\t\tsize of the browser window.\r\n\t\t\t</p>\r\n\t\t\t<button class=\"Gray\" onclick=\"ButtonClick()\">Click Me!</button>\r\n\t</div>\r\n</body>\r\n</html>\r\n"
},
{
"name": "sample.ini.txt",
"content": "# Example of a .gitconfig file\r\n\r\n[core]\r\n\trepositoryformatversion = 0\r\n\tfilemode = false\r\n\tbare = false\r\n\tlogallrefupdates = true\r\n\tsymlinks = false\r\n\tignorecase = true\r\n\thideDotFiles = dotGitOnly\r\n\r\n# Defines the master branch\r\n[branch \"master\"]\r\n\tremote = origin\r\n\tmerge = refs/heads/master\r\n"
},
{
"name": "sample.java.txt",
"content": "/*\n\tBasic Java example using FizzBuzz\n*/\n\nimport java.util.Random;\n\npublic class Example {\n\tpublic static void main (String[] args){\n\t\t// Generate a random number between 1-100. (See generateRandomNumber method.)\n\t\tint random = generateRandomNumber(100);\n\n\t\t// Output generated number.\n\t\tSystem.out.println(\"Generated number: \" + random + \"\\n\");\n\n\t\t// Loop between 1 and the number we just generated.\n\t\tfor (int i=1; i<=random; i++){\n\t\t\t// If i is divisible by both 3 and 5, output \"FizzBuzz\".\n\t\t\tif (i % 3 == 0 && i % 5 == 0){\n\t\t\t\tSystem.out.println(\"FizzBuzz\");\n\t\t\t}\n\t\t\t// If i is divisible by 3, output \"Fizz\"\n\t\t\telse if (i % 3 == 0){\n\t\t\t\tSystem.out.println(\"Fizz\");\n\t\t\t}\n\t\t\t// If i is divisible by 5, output \"Buzz\".\n\t\t\telse if (i % 5 == 0){\n\t\t\t\tSystem.out.println(\"Buzz\");\n\t\t\t}\n\t\t\t// If i is not divisible by either 3 or 5, output the number.\n\t\t\telse {\n\t\t\t\tSystem.out.println(i);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t\tGenerates a new random number between 0 and 100.\n\t\t@param bound The highest number that should be generated.\n\t\t@return An integer representing a randomly generated number between 0 and 100.\n\t*/\n\tprivate static int generateRandomNumber(int bound){\n\t\t// Create new Random generator object and generate the random number.\n\t\tRandom randGen = new Random();\n\t\tint randomNum = randGen.nextInt(bound);\n\n\t\t// If the random number generated is zero, use recursion to regenerate the number until it is not zero.\n\t\tif (randomNum < 1){\n\t\t\trandomNum = generateRandomNumber(bound);\n\t\t}\n\n\t\treturn randomNum;\n\t}\n}\n "
},
{
"name": "sample.javascript.txt",
"content": "/*\r\n © Microsoft. All rights reserved.\r\n\r\n This library is supported for use in Windows Tailored Apps only.\r\n\r\n Build: 6.2.8100.0 \r\n Version: 0.5 \r\n*/\r\n\r\n(function (global, undefined) {\r\n\t\"use strict\";\r\n\tundefinedVariable = {};\r\n\tundefinedVariable.prop = 5;\r\n\r\n\tfunction initializeProperties(target, members) {\r\n\t\tvar keys = Object.keys(members);\r\n\t\tvar properties;\r\n\t\tvar i, len;\r\n\t\tfor (i = 0, len = keys.length; i < len; i++) {\r\n\t\t\tvar key = keys[i];\r\n\t\t\tvar enumerable = key.charCodeAt(0) !== /*_*/95;\r\n\t\t\tvar member = members[key];\r\n\t\t\tif (member && typeof member === 'object') {\r\n\t\t\t\tif (member.value !== undefined || typeof member.get === 'function' || typeof member.set === 'function') {\r\n\t\t\t\t\tif (member.enumerable === undefined) {\r\n\t\t\t\t\t\tmember.enumerable = enumerable;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tproperties = properties || {};\r\n\t\t\t\t\tproperties[key] = member;\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t} \r\n\t\t\t}\r\n\t\t\tif (!enumerable) {\r\n\t\t\t\tproperties = properties || {};\r\n\t\t\t\tproperties[key] = { value: member, enumerable: enumerable, configurable: true, writable: true }\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\t\t\ttarget[key] = member;\r\n\t\t}\r\n\t\tif (properties) {\r\n\t\t\tObject.defineProperties(target, properties);\r\n\t\t}\r\n\t}\r\n\r\n\t(function (rootNamespace) {\r\n\r\n\t\t// Create the rootNamespace in the global namespace\r\n\t\tif (!global[rootNamespace]) {\r\n\t\t\tglobal[rootNamespace] = Object.create(Object.prototype);\r\n\t\t}\r\n\r\n\t\t// Cache the rootNamespace we just created in a local variable\r\n\t\tvar _rootNamespace = global[rootNamespace];\r\n\t\tif (!_rootNamespace.Namespace) {\r\n\t\t\t_rootNamespace.Namespace = Object.create(Object.prototype);\r\n\t\t}\r\n\r\n\t\tfunction defineWithParent(parentNamespace, name, members) {\r\n\t\t\t/// <summary locid=\"1\">\r\n\t\t\t/// Defines a new namespace with the specified name, under the specified parent namespace.\r\n\t\t\t/// </summary>\r\n\t\t\t/// <param name=\"parentNamespace\" type=\"Object\" locid=\"2\">\r\n\t\t\t/// The parent namespace which will contain the new namespace.\r\n\t\t\t/// </param>\r\n\t\t\t/// <param name=\"name\" type=\"String\" locid=\"3\">\r\n\t\t\t/// Name of the new namespace.\r\n\t\t\t/// </param>\r\n\t\t\t/// <param name=\"members\" type=\"Object\" locid=\"4\">\r\n\t\t\t/// Members in the new namespace.\r\n\t\t\t/// </param>\r\n\t\t\t/// <returns locid=\"5\">\r\n\t\t\t/// The newly defined namespace.\r\n\t\t\t/// </returns>\r\n\t\t\tvar currentNamespace = parentNamespace,\r\n\t\t\t\tnamespaceFragments = name.split(\".\");\r\n\r\n\t\t\tfor (var i = 0, len = namespaceFragments.length; i < len; i++) {\r\n\t\t\t\tvar namespaceName = namespaceFragments[i];\r\n\t\t\t\tif (!currentNamespace[namespaceName]) {\r\n\t\t\t\t\tObject.defineProperty(currentNamespace, namespaceName, \r\n\t\t\t\t\t\t{ value: {}, writable: false, enumerable: true, configurable: true }\r\n\t\t\t\t\t);\r\n\t\t\t\t}\r\n\t\t\t\tcurrentNamespace = currentNamespace[namespaceName];\r\n\t\t\t}\r\n\r\n\t\t\tif (members) {\r\n\t\t\t\tinitializeProperties(currentNamespace, members);\r\n\t\t\t}\r\n\r\n\t\t\treturn currentNamespace;\r\n\t\t}\r\n\r\n\t\tfunction define(name, members) {\r\n\t\t\t/// <summary locid=\"6\">\r\n\t\t\t/// Defines a new namespace with the specified name.\r\n\t\t\t/// </summary>\r\n\t\t\t/// <param name=\"name\" type=\"String\" locid=\"7\">\r\n\t\t\t/// Name of the namespace. This could be a dot-separated nested name.\r\n\t\t\t/// </param>\r\n\t\t\t/// <param name=\"members\" type=\"Object\" locid=\"4\">\r\n\t\t\t/// Members in the new namespace.\r\n\t\t\t/// </param>\r\n\t\t\t/// <returns locid=\"5\">\r\n\t\t\t/// The newly defined namespace.\r\n\t\t\t/// </returns>\r\n\t\t\treturn defineWithParent(global, name, members);\r\n\t\t}\r\n\r\n\t\t// Establish members of the \"WinJS.Namespace\" namespace\r\n\t\tObject.defineProperties(_rootNamespace.Namespace, {\r\n\r\n\t\t\tdefineWithParent: { value: defineWithParent, writab
},
{
"name": "sample.json.txt",
"content": "{\r\n\t\"type\": \"team\",\r\n\t\"test\": {\r\n\t\t\"testPage\": \"tools/testing/run-tests.htm\",\r\n\t\t\"enabled\": true\r\n\t},\r\n \"search\": {\r\n \"excludeFolders\": [\r\n\t\t\t\".git\",\r\n\t\t\t\"node_modules\",\r\n\t\t\t\"tools/bin\",\r\n\t\t\t\"tools/counts\",\r\n\t\t\t\"tools/policheck\",\r\n\t\t\t\"tools/tfs_build_extensions\",\r\n\t\t\t\"tools/testing/jscoverage\",\r\n\t\t\t\"tools/testing/qunit\",\r\n\t\t\t\"tools/testing/chutzpah\",\r\n\t\t\t\"server.net\"\r\n ]\r\n },\r\n\t\"languages\": {\r\n\t\t\"vs.languages.typescript\": {\r\n\t\t\t\"validationSettings\": [{\r\n\t\t\t\t\"scope\":\"/\",\r\n\t\t\t\t\"noImplicitAny\":true,\r\n\t\t\t\t\"noLib\":false,\r\n\t\t\t\t\"extraLibs\":[],\r\n\t\t\t\t\"semanticValidation\":true,\r\n\t\t\t\t\"syntaxValidation\":true,\r\n\t\t\t\t\"codeGenTarget\":\"ES5\",\r\n\t\t\t\t\"moduleGenTarget\":\"\",\r\n\t\t\t\t\"lint\": {\r\n \"emptyBlocksWithoutComment\": \"warning\",\r\n \"curlyBracketsMustNotBeOmitted\": \"warning\",\r\n \"comparisonOperatorsNotStrict\": \"warning\",\r\n \"missingSemicolon\": \"warning\",\r\n \"unknownTypeOfResults\": \"warning\",\r\n \"semicolonsInsteadOfBlocks\": \"warning\",\r\n \"functionsInsideLoops\": \"warning\",\r\n \"functionsWithoutReturnType\": \"warning\",\r\n \"tripleSlashReferenceAlike\": \"warning\",\r\n \"unusedImports\": \"warning\",\r\n \"unusedVariables\": \"warning\",\r\n \"unusedFunctions\": \"warning\",\r\n \"unusedMembers\": \"warning\"\r\n }\r\n\t\t\t}, \r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/client\",\r\n\t\t\t\t\"baseUrl\":\"/client\",\r\n\t\t\t\t\"moduleGenTarget\":\"amd\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/server\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/build\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"scope\":\"/node_modules/nake\",\r\n\t\t\t\t\"moduleGenTarget\":\"commonjs\"\r\n\t\t\t}],\r\n\t\t\t\"allowMultipleWorkers\": true\r\n\t\t}\r\n\t}\r\n}"
},
{
"name": "sample.julia.txt",
"content": "# good style\nfunction fixedpointmap(f; iv, tolerance=1E-7, maxiter=1000)\n # setup the algorithm\n x_old = iv\n normdiff = Inf\n iter = 1\n while normdiff > tolerance && iter <= maxiter\n x_new = f(x_old) # use the passed in map\n normdiff = norm(x_new - x_old)\n x_old = x_new\n iter = iter + 1\n end\n return (value = x_old, normdiff=normdiff, iter=iter) # A named tuple\nend\n\n# define a map and parameters\np = 1.0\nβ = 0.9\nf(v) = p + β * v # note that p and β are used in the function!\n\nsol = fixedpointmap(f, iv=0.8, tolerance=1.0E-8) # don't need to pass\nprintln(\"Fixed point = $(sol.value), and |f(x) - x| = $(sol.normdiff) in $(sol.iter)\"*\n \" iterations\")\n"
},
{
"name": "sample.kotlin.txt",
"content": "const val POINTS_X_PASS: Int = 15\r\nval EZPassAccounts: MutableMap<Int, Int> = mutableMapOf(1 to 100, 2 to 100, 3 to 100)\r\nval EZPassReport: Map<Int, Int> = EZPassAccounts\r\n\r\n// update points credit\r\nfun updatePointsCredit(accountId: Int) {\r\n if (EZPassAccounts.containsKey(accountId)) {\r\n println(\"Updating $accountId...\")\r\n EZPassAccounts[accountId] = EZPassAccounts.getValue(accountId) + POINTS_X_PASS\r\n } else {\r\n println(\"Error: Trying to update a non-existing account (id: $accountId)\")\r\n }\r\n}\r\n\r\nfun accountsReport() {\r\n println(\"EZ-Pass report:\")\r\n EZPassReport.forEach{\r\n k, v -> println(\"ID $k: credit $v\")\r\n }\r\n}\r\n\r\nfun main() {\r\n accountsReport()\r\n updatePointsCredit(1)\r\n updatePointsCredit(1)\r\n updatePointsCredit(5)\r\n accountsReport()\r\n}"
},
{
"name": "sample.less.txt",
"content": "@base: #f938ab;\r\n\r\n.box-shadow(@style, @c) when (iscolor(@c)) {\r\n\tborder-radius: @style @c;\r\n}\r\n\r\n.box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) {\r\n\t.box-shadow(@style, rgba(0, 0, 0, @alpha));\r\n}\r\n\r\n.box { \r\n\tcolor: saturate(@base, 5%);\r\n\tborder-color: lighten(@base, 30%);\r\n\t\r\n\tdiv {\r\n\t\t.box-shadow((0 0 5px), 30%);\r\n\t}\r\n}\r\n\r\n#header {\r\n\th1 {\r\n\t\tfont-size: 26px;\r\n\t\tfont-weight: bold;\r\n\t}\r\n\t\r\n\tp { font-size: 12px;\r\n\t\ta { text-decoration: none;\r\n\t\t\t&:hover { border-width: 1px }\r\n\t\t}\r\n\t}\r\n}\r\n\r\n@the-border: 1px;\r\n@base-color: #111;\r\n@red: #842210;\r\n\r\n#header {\r\n\tcolor: (@base-color * 3);\r\n\tborder-left: @the-border;\r\n\tborder-right: (@the-border * 2);\r\n}\r\n\r\n#footer {\r\n\tcolor: (@base-color + #003300);\r\n\tborder-color: desaturate(@red, 10%);\r\n}\r\n"
},
{
"name": "sample.lex.txt",
"content": "LEX Paid Escrow.\nLEXON: 0.2.20\nCOMMENT: 3.f - an escrow that is controlled by a third party for a fee.\n\n“Payer” is a person.\n“Payee” is a person.\n“Arbiter” is a person.\n“Fee” is an amount.\n\nThe Payer pays an Amount into escrow,\nappoints the Payee,\nappoints the Arbiter,\nand also fixes the Fee.\n\nCLAUSE: Pay Out.\nThe Arbiter may pay from escrow the Fee to themselves,\nand afterwards pay the remainder of the escrow to the Payee.\n\nCLAUSE: Pay Back.\nThe Arbiter may pay from escrow the Fee to themselves,\nand afterwards return the remainder of the escrow to the Payer.\n"
},
{
"name": "sample.lua.txt",
"content": " -- defines a factorial function\n function fact (n)\n if n == 0 then\n return 1\n else\n return n * fact(n-1)\n end\n end\n \n print(\"enter a number:\")\n a = io.read(\"*number\") -- read a number\n print(fact(a))"
},
{
"name": "sample.markdown.txt",
"content": "# Header 1 #\r\n## Header 2 ##\r\n### Header 3 ### (Hashes on right are optional)\r\n## Markdown plus h2 with a custom ID ## {#id-goes-here}\r\n[Link back to H2](#id-goes-here)\r\n\r\n```js\r\nvar x = \"string\";\r\nfunction f() {\r\n return x;\r\n}\r\n```\r\n\r\n<!-- html madness -->\r\n<div class=\"custom-class\" markdown=\"1\">\r\n <div>\r\n nested div\r\n </div>\r\n <script type='text/x-koka'>\r\n function( x: int ) { return x*x; }\r\n </script>\r\n This is a div _with_ underscores\r\n and a & <b class=\"bold\">bold</b> element.\r\n <style>\r\n body { font: \"Consolas\" }\r\n </style>\r\n</div>\r\n\r\n* Bullet lists are easy too\r\n- Another one\r\n+ Another one\r\n\r\nThis is a paragraph, which is text surrounded by\r\nwhitespace. Paragraphs can be on one\r\nline (or many), and can drone on for hours.\r\n\r\nNow some inline markup like _italics_, **bold**,\r\nand `code()`. Note that underscores\r\nin_words_are ignored.\r\n\r\n````application/json\r\n { value: [\"or with a mime type\"] }\r\n````\r\n\r\n> Blockquotes are like quoted text in email replies\r\n>> And, they can be nested\r\n\r\n1. A numbered list\r\n2. Which is numbered\r\n3. With periods and a space\r\n\r\nAnd now some code:\r\n\r\n // Code is just text indented a bit\r\n which(is_easy) to_remember();\r\n\r\nAnd a block\r\n\r\n~~~\r\n// Markdown extra adds un-indented code blocks too\r\n\r\nif (this_is_more_code == true && !indented) {\r\n // tild wrapped code blocks, also not indented\r\n}\r\n~~~\r\n\r\nText with\r\ntwo trailing spaces\r\n(on the right)\r\ncan be used\r\nfor things like poems\r\n\r\n### Horizontal rules\r\n\r\n* * * *\r\n****\r\n--------------------------\r\n\r\n![picture alt](/images/photo.jpeg \"Title is optional\")\r\n\r\n## Markdown plus tables ##\r\n\r\n| Header | Header | Right |\r\n| ------ | ------ | -----: |\r\n| Cell | Cell | $10 |\r\n| Cell | Cell | $20 |\r\n\r\n* Outer pipes on tables are optional\r\n* Colon used for alignment (right versus left)\r\n\r\n## Markdown plus definition lists ##\r\n\r\nBottled water\r\n: $ 1.25\r\n: $ 1.55 (Large)\r\n\r\nMilk\r\nPop\r\n: $ 1.75\r\n\r\n* Multiple definitions and terms are possible\r\n* Definitions can include multiple paragraphs too\r\n\r\n*[ABBR]: Markdown plus abbreviations (produces an <abbr> tag)"
},
{
"name": "sample.mips.txt",
"content": "# A[i] = A[i/2] + 1;\n lw $t0, 0($gp) # fetch i\n srl $t1, $t0, 1 # i/2\n sll $t1, $t1, 2 # turn i/2 into a byte offset (*4)\n add $t1, $gp, $t1 # &A[i/2] - 28\n lw $t1, 28($t1) # fetch A[i/2]\n addi $t1, $t1, 1 # A[i/2] + 1\n sll $t2, $t0, 2 # turn i into a byte offset\n add $t2, $t2, $gp # &A[i] - 28\n sw $t1, 28($t2) # A[i] = ...\n# A[i+1] = -1;\n addi $t1, $zero, -1 # -1\n sw $t1, 32($t2) # A[i+1] = -1\n"
},
{
"name": "sample.msdax.txt",
"content": " = CALCULATE(SUM(Sales[SalesAmount]), PREVIOUSQUARTER(Calendar[DateKey]))"
},
{
"name": "sample.mysql.txt",
"content": "CREATE TABLE shop (\n article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL,\n dealer CHAR(20) DEFAULT '' NOT NULL,\n price DOUBLE(16,2) DEFAULT '0.00' NOT NULL,\n PRIMARY KEY(article, dealer));\nINSERT INTO shop VALUES\n (1,'A',3.45),(1,'B',3.99),(2,'A',10.99),(3,'B',1.45),\n (3,'C',1.69),(3,'D',1.25),(4,'D',19.95);"
},
{
"name": "sample.objective-c.txt",
"content": "//\r\n// Copyright (c) Microsoft Corporation. All rights reserved.\r\n//\r\n\r\n#import \"UseQuotes.h\"\r\n#import <Use/GTLT.h> \r\n\r\n/*\r\n\tMulti \r\n\tLine\r\n\tComments \r\n*/\r\n@implementation Test\r\n\r\n- (void) applicationWillFinishLaunching:(NSNotification *)notification\r\n{\r\n}\r\n\r\n- (IBAction)onSelectInput:(id)sender\r\n{\r\n NSString* defaultDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0];\r\n \r\n NSOpenPanel* panel = [NSOpenPanel openPanel];\r\n [panel setAllowedFileTypes:[[NSArray alloc] initWithObjects:@\"ipa\", @\"xcarchive\", @\"app\", nil]];\r\n \r\n [panel beginWithCompletionHandler:^(NSInteger result)\r\n {\r\n if (result == NSFileHandlingPanelOKButton)\r\n [self.inputTextField setStringValue:[panel.URL path]];\r\n }];\r\n return YES;\r\n\r\n int hex = 0xFEF1F0F;\r\n\t float ing = 3.14;\r\n\t ing = 3.14e0;\r\n\t ing = 31.4e-2;\r\n}\r\n\r\n-(id) initWithParams:(id<anObject>) aHandler withDeviceStateManager:(id<anotherObject>) deviceStateManager\r\n{\r\n // add a tap gesture recognizer\r\n UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];\r\n NSMutableArray *gestureRecognizers = [NSMutableArray array];\r\n [gestureRecognizers addObject:tapGesture];\r\n [gestureRecognizers addObjectsFromArray:scnView.gestureRecognizers];\r\n scnView.gestureRecognizers = gestureRecognizers;\r\n\r\n\treturn tapGesture;\r\n\treturn nil;\r\n}\r\n\r\n@end\r\n"
},
6 years ago
{
"name": "sample.pascal.txt",
"content": "program GreetingsNumberOfTimes;\n\n{$APPTYPE CONSOLE}\n\n{$R *.res}\n\nuses\n System.SysUtils;\n\nvar\n greetingsMessage: string;\n numberOfTimes, i: integer;\n\nbegin\n try\n { TODO -oUser -cConsole Main : Insert code here }\n greetingsMessage := 'Hello World!';\n numberOfTimes := 10;\n\n for i := 1 to numberOfTimes do\n begin\n Writeln(greetingsMessage);\n end;\n except\n on E: Exception do\n Writeln(E.ClassName, ': ', E.Message);\n end;\nend.\n"
},
{
"name": "sample.pascaligo.txt",
"content": "type storage is int\ntype parameter is\n Increment of int\n| Decrement of int\n| Reset\ntype return is list (operation) * storage\n// Two entrypoints\nfunction add (const store : storage; const delta : int) : storage is\n store + delta\nfunction sub (const store : storage; const delta : int) : storage is\n store - delta\n(* Main access point that dispatches to the entrypoints according to\n the smart contract parameter. *)\nfunction main (const action : parameter; const store : storage) : return is\n ((nil : list (operation)), // No operations\n case action of\n Increment (n) -> add (store, n)\n | Decrement (n) -> sub (store, n)\n | Reset -> 0\n end)\n"
},
{
"name": "sample.perl.txt",
"content": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nuse Path::Tiny;\n\nmy $dir = path('foo','bar'); # foo/bar\n\n# Iterate over the content of foo/bar\nmy $iter = $dir->iterator;\nwhile (my $file = $iter->()) {\n\n # See if it is a directory and skip\n next if $file->is_dir();\n\n # Print out the file name and path\n print \"$file\\n\";\n}"
},
{
"name": "sample.pgsql.txt",
"content": "BEGIN\n SELECT * INTO STRICT myrec FROM emp WHERE empname = myname;\n EXCEPTION\n WHEN NO_DATA_FOUND THEN\n RAISE EXCEPTION 'employee % not found', myname;\n WHEN TOO_MANY_ROWS THEN\n RAISE EXCEPTION 'employee % not unique', myname;\nEND;"
6 years ago
},
{
"name": "sample.php.txt",
"content": "<?php\r\n// The next line contains a syntax error:\r\nif () {\r\n\treturn \"The parser recovers from this type of syntax error\";\r\n}\r\n?>\r\n<html>\r\n<head>\r\n\t<title>Example page</title>\r\n</head>\r\n\r\n<body>\r\n\r\n<script type=\"text/javascript\">\r\n\t// Some PHP embedded inside JS\r\n\t// Generated <?=date('l, F jS, Y')?>\r\n\t\r\n\tvar server_token = <?=rand(5, 10000)?>\r\n\tif (typeof server_token === 'number') {\r\n\t\talert('token: ' + server_token);\r\n\t}\r\n</script>\r\n\r\n<div>\r\nHello\r\n<? if (isset($user)) { ?>\r\n\t<b><?=$user?></b>\r\n<? } else { ?>\r\n\t<i>guest</i>\r\n<? } ?>\r\n!\r\n</div>\r\n\r\n<?php\r\n\r\n\t/* Example PHP file\r\n\tmultiline comment\r\n\t*/\r\n\r\n\t$cards = array(\"ah\", \"ac\", \"ad\", \"as\",\r\n\t\t\"2h\", \"2c\", \"2d\", \"2s\",\r\n\t\t\"3h\", \"3c\", \"3d\", \"3s\",\r\n\t\t\"4h\", \"4c\", \"4d\", \"4s\",\r\n\t\t\"5h\", \"5c\", \"5d\", \"5s\",\r\n\t\t\"6h\", \"6c\", \"6d\", \"6s\",\r\n\t\t\"7h\", \"7c\", \"7d\", \"7s\",\r\n\t\t\"8h\", \"8c\", \"8d\", \"8s\",\r\n\t\t\"9h\", \"9c\", \"9d\", \"9s\",\r\n\t\t\"th\", \"tc\", \"td\", \"ts\",\r\n\t\t\"jh\", \"jc\", \"jd\", \"js\",\r\n\t\t\"qh\", \"qc\", \"qd\", \"qs\",\r\n\t\t\"kh\", \"kc\", \"kd\", \"ks\");\r\n\r\n\tsrand(time());\r\n\r\n\tfor($i = 0; $i < 52; $i++) {\r\n\t\t$count = count($cards);\r\n\t\t$random = (rand()%$count);\r\n\r\n\t\tif($cards[$random] == \"\") {\r\n\t\t\t$i--;\r\n\t\t} else {\r\n\t\t\t$deck[] = $cards[$random];\r\n\t\t\t$cards[$random] = \"\";\r\n\t\t}\r\n\t}\r\n\r\n\tsrand(time());\r\n\t$starting_point = (rand()%51);\r\n\tprint(\"Starting point for cut cards is: $starting_point<p>\");\r\n\r\n\t// display shuffled cards (EXAMPLE ONLY)\r\n\tfor ($index = 0; $index < 52; $index++) {\r\n\t\tif ($starting_point == 52) { $starting_point = 0; }\r\n\t\tprint(\"Uncut Point: <strong>$deck[$index]</strong> \");\r\n\t\tprint(\"Starting Point: <strong>$deck[$starting_point]</strong><br>\");\r\n\t\t$starting_point++;\r\n\t}\r\n?>\r\n\r\n</body>\r\n</html>"
},
{
"name": "sample.plaintext.txt",
"content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec cursus aliquet sapien, sed rhoncus leo ullamcorper ornare. Interdum et malesuada fames ac ante ipsum primis in faucibus. Phasellus feugiat eleifend nisl, aliquet rhoncus quam scelerisque vel. Morbi eu pellentesque ex. Nam suscipit maximus leo blandit cursus. Aenean sollicitudin nisi luctus, ornare nibh viverra, laoreet ex. Donec eget nibh sit amet dolor ornare elementum. Morbi sollicitudin enim vitae risus pretium vestibulum. Ut pretium hendrerit libero, non vulputate ante volutpat et. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nullam malesuada turpis vitae est porttitor, id tincidunt neque dignissim. Integer rhoncus vestibulum justo in iaculis. Praesent nec augue ut dui scelerisque gravida vel id velit. Donec vehicula feugiat mollis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.\r\n\r\nPraesent diam lorem, luctus quis ullamcorper non, consequat quis orci. Ut vel massa vel nunc sagittis porttitor a vitae ante. Quisque euismod lobortis imperdiet. Vestibulum tincidunt vehicula posuere. Nulla facilisi. Donec sodales imperdiet risus id ullamcorper. Nulla luctus orci tortor, vitae tincidunt urna aliquet nec. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Etiam consequat dapibus massa. Sed ac pharetra magna, in imperdiet neque. Nullam nunc nisi, consequat vel nunc et, sagittis aliquam arcu. Aliquam non orci magna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed id sem ut sem pulvinar rhoncus. Aenean venenatis nunc eget mi ornare, vitae maximus lacus varius. Quisque quis vestibulum justo.\r\n\r\nDonec euismod luctus volutpat. Donec sed lacinia enim. Vivamus aliquam elit cursus, convallis diam at, volutpat turpis. Sed lacinia nisl in auctor dapibus. Nunc turpis mi, mattis ut rhoncus id, lacinia sed lectus. Donec sodales tellus quis libero gravida pretium et quis magna. Etiam ultricies mollis purus, eget consequat velit. Duis vitae nibh vitae arcu tincidunt congue. Maecenas ut velit in ipsum condimentum dictum quis eget urna. Sed mattis nulla arcu, vitae mattis ligula dictum at.\r\n\r\nPraesent at dignissim dolor. Donec quis placerat sem. Cras vitae placerat sapien, eu sagittis ex. Mauris nec luctus risus. Cras imperdiet semper neque suscipit auctor. Mauris nisl massa, commodo sit amet dignissim id, malesuada sed ante. Praesent varius sapien eget eros vehicula porttitor.\r\n\r\nMauris auctor nunc in quam tempor, eget consectetur nisi rhoncus. Donec et nulla imperdiet, gravida dui at, accumsan velit. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin sollicitudin condimentum auctor. Sed lacinia eleifend nisi, id scelerisque leo laoreet sit amet. Morbi congue augue a malesuada pulvinar. Curabitur nec ante finibus, commodo orci vel, aliquam libero. Morbi molestie purus non nunc placerat fermentum. Pellentesque commodo ligula sed pretium aliquam. Praesent ut nibh ex. Vivamus vestibulum velit in leo suscipit, vitae pellentesque urna vulputate. Suspendisse pretium placerat ligula eu ullamcorper. Nam eleifend mi tellus, ut tristique ante ultricies vitae. Quisque venenatis dapibus tellus sit amet mattis. Donec erat arcu, elementum vel nisl at, sagittis vulputate nisi."
},
{
"name": "sample.postiats.txt",
"content": "// http://www.ats-lang.org/\n(* Say Hello! once *)\nval () = print\"Hello!\\n\"\n//\n(* Say Hello! 3 times *)\nval () = 3*delay(print\"Hello!\")\nval () = print_newline((*void*))\n//\n\n//\n(* Build a list of 3 *)\nval xs = $list{int}(0, 1, 2)\n//\nval x0 = xs[0] // legal\nval x1 = xs[1] // legal\nval x2 = xs[2] // legal\nval x3 = xs[3] // illegal\n//\n\n//\nextern\nfun{} f0 (): int\nextern\nfun{} f1 (int): int\nextern\nfun{} repeat_f0f1 (int): int\n//\nimplement\n{}(*tmp*)\nrepeat_f0f1(n) =\n if n = 0\n then f0()\n else f1(repeat_f0f1(n-1))\n // end of [if]\n//\nfun\ntimes (\n m:int, n:int\n) : int = // m*n\n repeat_f0f1 (m) where\n{\n implement f0<> () = 0\n implement f1<> (x) = x + n\n}\n//\nfun\npower (\n m:int, n:int\n) : int = // m^n\n repeat_f0f1 (n) where\n{\n implement f0<> () = 1\n implement f1<> (x) = m * x\n}\n//\nval () =\nprintln! (\"5*5 = \", times(5,5))\nval () =\nprintln! (\"5^2 = \", power(5,2))\nval () =\nprintln! (\"2^10 = \", power(2,10))\nval () =\nprintln! (\"3^10 = \", power(3,10))\n//\n"
},
{
"name": "sample.powerquery.txt",
"content": "let\n Source = Excel.CurrentWorkbook(){[Name=\"Table1\"]}[Content],\n SplitColumnDelimiter = Table.SplitColumn(Source,\"Input\",Splitter.SplitTextByDelimiter(\",\"),13),\n Unpivot = Table.Unpivot(SplitColumnDelimiter,{\"Input.1\", \"Input.2\", \"Input.3\", \"Input.4\",\n \"Input.5\", \"Input.6\", \"Input.7\", \"Input.8\", \"Input.9\", \"Input.10\", \"Input.11\", \"Input.12\"\n , \"Input.13\"},\"Attribute\",\"Value\"),\n RemovedColumns = Table.RemoveColumns(Unpivot,{\"Attribute\"}),\n DuplicatesRemoved = Table.Distinct(RemovedColumns),\n GroupedRows = Table.Group(DuplicatesRemoved, {\"RowID\"}, {{\"Count of Distinct Values\"\n , each Table.RowCount(_), type number}})\nin\n GroupedRows"
},
{
"name": "sample.powershell.txt",
"content": "$SelectedObjectNames=@();\n$XenCenterNodeSelected = 0;\n#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list\nforeach($parameterSet in $ObjInfoArray)\n{\n\tif ($parameterSet[\"class\"] -eq \"blank\")\n\t{\n\t\t#When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank\n\t\tif ($XenCenterNodeSelected)\n\t\t{\n\t\t\tcontinue\n\t\t}\n\t\t$XenCenterNodeSelected = 1;\n\t\t$SelectedObjectNames += \"XenCenter\"\n\t}\n\telseif ($parameterSet[\"sessionRef\"] -eq \"null\")\n\t{\n\t\t#When a disconnected server is selected there is no session information, we get null for everything except class\n\t}\n\t\t$SelectedObjectNames += \"a disconnected server\"\n\telse\n\t{\n\t\tConnect-XenServer -url $parameterSet[\"url\"] -opaqueref $parameterSet[\"sessionRef\"]\n\t\t#Use $class to determine which server objects to get\n\t\t#-properties allows us to filter the results to just include the selected object\n\t\t$exp = \"Get-XenServer:{0} -properties @{{uuid='{1}'}}\" -f $parameterSet[\"class\"], $parameterSet[\"objUuid\"]\n\t\t$obj = Invoke-Expression $exp\n\t\t$SelectedObjectNames += $obj.name_label;\n\t} \n}"
},
{
"name": "sample.pug.txt",
"content": "doctype 5\nhtml(lang=\"en\")\n head\n title= pageTitle\n script(type='text/javascript')\n if (foo) {\n bar()\n }\n body\n // Disclaimer: You will need to turn insertSpaces to true in order for the\n syntax highlighting to kick in properly (especially for comments)\n Enjoy :)\n h1 Pug - node template engine\n #container\n if youAreUsingPug\n p You are amazing\n else\n p Get on it!"
},
{
"name": "sample.python.txt",
"content": "import banana\r\n\r\n\r\nclass Monkey:\r\n # Bananas the monkey can eat.\r\n capacity = 10\r\n def eat(self, n):\r\n \"\"\"Make the monkey eat n bananas!\"\"\"\r\n self.capacity -= n * banana.size\r\n\r\n def feeding_frenzy(self):\r\n self.eat(9.25)\r\n return \"Yum yum\"\r\n"
},
{
"name": "sample.r.txt",
"content": "# © Microsoft. All rights reserved.\r\n\r\n#' Add together two numbers.\r\n#' \r\n#' @param x A number.\r\n#' @param y A number.\r\n#' @return The sum of \\code{x} and \\code{y}.\r\n#' @examples\r\n#' add(1, 1)\r\n#' add(10, 1)\r\nadd <- function(x, y) {\r\n x + y\r\n}\r\n\r\nadd(1, 2)\r\nadd(1.0, 2.0)\r\nadd(-1, -2)\r\nadd(-1.0, -2.0)\r\nadd(1.0e10, 2.0e10)\r\n\r\n\r\n#' Concatenate together two strings.\r\n#' \r\n#' @param x A string.\r\n#' @param y A string.\r\n#' @return The concatenated string built of \\code{x} and \\code{y}.\r\n#' @examples\r\n#' strcat(\"one\", \"two\")\r\nstrcat <- function(x, y) {\r\n paste(x, y)\r\n}\r\n\r\npaste(\"one\", \"two\")\r\npaste('one', 'two')\r\npaste(NULL, NULL)\r\npaste(NA, NA)\r\n\r\npaste(\"multi-\r\n line\",\r\n 'multi-\r\n line')\r\n"
},
{
"name": "sample.razor.txt",
"content": "@{\r\n var total = 0;\r\n var totalMessage = \"\";\r\n @* a multiline\r\n razor comment embedded in csharp *@\r\n if (IsPost) {\r\n\r\n // Retrieve the numbers that the user entered.\r\n var num1 = Request[\"text1\"];\r\n var num2 = Request[\"text2\"];\r\n\r\n // Convert the entered strings into integers numbers and add.\r\n total = num1.AsInt() + num2.AsInt();\r\n\t\t<italic><bold>totalMessage = \"Total = \" + total;</bold></italic>\r\n }\r\n}\r\n\r\n<!DOCTYPE html>\r\n<html lang=\"en\">\r\n <head>\r\n <title>Add Numbers</title>\r\n <meta charset=\"utf-8\" />\r\n </head>\r\n<body>\r\n <p>Enter two whole numbers and then click <strong>Add</strong>.</p>\r\n <form action=\"\" method=\"post\">\r\n <p><label for=\"text1\">First Number:</label>\r\n <input type=\"text\" name=\"text1\" />\r\n </p>\r\n <p><label for=\"text2\">Second Number:</label>\r\n <input type=\"text\" name=\"text2\" />\r\n </p>\r\n <p><input type=\"submit\" value=\"Add\" /></p>\r\n </form>\r\n\r\n\t@* now we call the totalMessage method \r\n\t (a multi line razor comment outside code) *@\r\n\r\n <p>@totalMessage</p>\r\n \r\n <p>@(totalMessage+\"!\")</p>\r\n \r\n An email address (with escaped at character): name@@domain.com\r\n \r\n</body>\r\n</html>\r\n"
},
{
"name": "sample.redis.txt",
"content": "EXISTS mykey\nAPPEND mykey \"Hello\"\nAPPEND mykey \" World\"\nGET mykey"
},
{
"name": "sample.redshift.txt",
"content": "create view tables_vw as\nselect distinct(id) table_id\n,trim(datname) db_name\n,trim(nspname) schema_name\n,trim(relname) table_name\nfrom stv_tbl_perm\njoin pg_class on pg_class.oid = stv_tbl_perm.id\njoin pg_namespace on pg_namespace.oid = relnamespace\njoin pg_database on pg_database.oid = stv_tbl_perm.db_id;\n"
},
{
"name": "sample.restructuredtext.txt",
"content": "=================\nMy Project Readme\n=================\n-------------------------\nClever subtitle goes here\n-------------------------\n\nIntroduction\n============\n\nThis is an example reStructuredText document that starts at the very top\nwith a title and a sub-title. There is one primary header, Introduction.\nThere is one example subheading below.\nThe document is just plain text so it is easily readable even before\nbeing converted to HTML, man page, PDF or other formats.\n\nSubheading\n----------\n\nThe basic syntax is not that different from Markdown, but it also\nhas many more powerful features that Markdown doesn't have. We aren't\ntaking advantage of those yet though.\n\n- Bullet points\n- Are intuitive\n- And simple too\n"
},
{
"name": "sample.ruby.txt",
"content": "#-------------------------------------------------------------------------\r\n# Copyright (c) Microsoft. All rights reserved.\r\n#--------------------------------------------------------------------------\r\n\r\nmodule Azure\r\n module Blob\r\n class Blob\r\n \r\n def initialize\r\n @properties = {}\r\n @metadata = {}\r\n yield self if block_given?\r\n end\r\n\r\n attr_accessor :name\r\n attr_accessor :snapshot\r\n attr_accessor :properties\r\n attr_accessor :metadata\r\n end\r\n end\r\nend"
},
{
"name": "sample.rust.txt",
"content": "fn main() {\n let greetings = [\"Hello\", \"Hola\", \"Bonjour\",\n \"Ciao\", \"こんにちは\", \"안녕하세요\",\n \"Cześć\", \"Olá\", \"Здравствуйте\",\n \"Chào bạn\", \"您好\", \"Hallo\",\n \"Hej\", \"Ahoj\", \"سلام\"];\n\n for (num, greeting) in greetings.iter().enumerate() {\n print!(\"{} : \", greeting);\n match num {\n 0 => println!(\"This code is editable and runnable!\"),\n 1 => println!(\"¡Este código es editable y ejecutable!\"),\n 2 => println!(\"Ce code est modifiable et exécutable !\"),\n 3 => println!(\"Questo codice è modificabile ed eseguibile!\"),\n 4 => println!(\"このコードは編集して実行出来ます!\"),\n 5 => println!(\"여기에서 코드를 수정하고 실행할 수 있습니다!\"),\n 6 => println!(\"Ten kod można edytować oraz uruchomić!\"),\n 7 => println!(\"Este código é editável e executável!\"),\n 8 => println!(\"Этот код можно отредактировать и запустить!\"),\n 9 => println!(\"Bạn có thể edit và run code trực tiếp!\"),\n 10 => println!(\"这段代码是可以编辑并且能够运行的!\"),\n 11 => println!(\"Dieser Code kann bearbeitet und ausgeführt werden!\"),\n 12 => println!(\"Den här koden kan redigeras och köras!\"),\n 13 => println!(\"Tento kód můžete upravit a spustit\"),\n 14 => println!(\"این کد قابلیت ویرایش و اجرا دارد!\"),\n _ => {},\n }\n }\n}\n"
},
{
"name": "sample.sb.txt",
"content": "begin:\nTextWindow.Write(\"Enter a number: \")\nnum = TextWindow.ReadNumber()\nremainder = Math.Remainder(num, 2)\nIf (remainder = 0) Then\n TextWindow.WriteLine(\"The number is Even\")\nElse\n TextWindow.WriteLine(\"The number is Odd\")\nEndIf\nGoto begin"
},
{
"name": "sample.scala.txt",
"content": "package examples\n\n/** Quick sort, imperative style */\nobject sort {\n\n /** Nested methods can use and even update everything\n * visible in their scope (including local variables or\n * arguments of enclosing methods).\n */\n def sort(a: Array[Int]) {\n\n def swap(i: Int, j: Int) {\n val t = a(i); a(i) = a(j); a(j) = t\n }\n\n def sort1(l: Int, r: Int) {\n val pivot = a((l + r) / 2)\n var i = l\n var j = r\n while (i <= j) {\n while (a(i) < pivot) i += 1\n while (a(j) > pivot) j -= 1\n if (i <= j) {\n swap(i, j)\n i += 1\n j -= 1\n }\n }\n if (l < j) sort1(l, j)\n if (j < r) sort1(i, r)\n }\n\n if (a.length > 0)\n sort1(0, a.length - 1)\n }\n\n def println(ar: Array[Int]) {\n def print1 = {\n def iter(i: Int): String =\n ar(i) + (if (i < ar.length-1) \",\" + iter(i+1) else \"\")\n if (ar.length == 0) \"\" else iter(0)\n }\n Console.println(\"[\" + print1 + \"]\")\n }\n\n def main(args: Array[String]) {\n val ar = Array(6, 2, 8, 5, 1)\n println(ar)\n sort(ar)\n println(ar)\n }\n\n}\n"
},
{
"name": "sample.scheme.txt",
"content": ";;; make-matrix creates a matrix (a vector of vectors).\n(define make-matrix\n (lambda (rows columns)\n (do ((m (make-vector rows))\n (i 0 (+ i 1)))\n ((= i rows) m)\n (vector-set! m i (make-vector columns)))))\n\n;;; matrix? checks to see if its argument is a matrix.\n;;; It isn't foolproof, but it's generally good enough.\n(define matrix?\n (lambda (x)\n (and (vector? x)\n (> (vector-length x) 0)\n (vector? (vector-ref x 0)))))\n\n;; matrix-rows returns the number of rows in a matrix.\n(define matrix-rows\n (lambda (x)\n (vector-length x)))\n\n;; matrix-columns returns the number of columns in a matrix.\n(define matrix-columns\n (lambda (x)\n (vector-length (vector-ref x 0))))\n\n;;; matrix-ref returns the jth element of the ith row.\n(define matrix-ref\n (lambda (m i j)\n (vector-ref (vector-ref m i) j)))\n\n;;; matrix-set! changes the jth element of the ith row.\n(define matrix-set!\n (lambda (m i j x)\n (vector-set! (vector-ref m i) j x)))\n\n;;; mul is the generic matrix/scalar multiplication procedure\n(define mul\n (lambda (x y)\n ;; mat-sca-mul multiplies a matrix by a scalar.\n (define mat-sca-mul\n (lambda (m x)\n (let* ((nr (matrix-rows m))\n (nc (matrix-columns m))\n (r (make-matrix nr nc)))\n (do ((i 0 (+ i 1)))\n ((= i nr) r)\n (do ((j 0 (+ j 1)))\n ((= j nc))\n (matrix-set! r i j\n (* x (matrix-ref m i j))))))))\n\n ;; mat-mat-mul multiplies one matrix by another, after verifying\n ;; that the first matrix has as many columns as the second\n ;; matrix has rows.\n (define mat-mat-mul\n (lambda (m1 m2)\n (let* ((nr1 (matrix-rows m1))\n (nr2 (matrix-rows m2))\n (nc2 (matrix-columns m2))\n (r (make-matrix nr1 nc2)))\n (if (not (= (matrix-columns m1) nr2))\n (match-error m1 m2))\n (do ((i 0 (+ i 1)))\n ((= i nr1) r)\n (do ((j 0 (+ j 1)))\n ((= j nc2))\n (do ((k 0 (+ k 1))\n (a 0\n (+ a\n (* (matrix-ref m1 i k)\n (matrix-ref m2 k j)))))\n ((= k nr2)\n (matrix-set! r i j a))))))))\n\n ;; type-error is called to complain when mul receives an invalid\n ;; type of argument.\n (define type-error\n (lambda (what)\n (error 'mul\n \"~s is not a number or matrix\"\n what)))\n\n ;; match-error is called to complain when mul receives a pair of\n ;; incompatible arguments.\n (define match-error\n (lambda (what1 what2)\n (error 'mul\n \"~s and ~s are incompatible operands\"\n what1\n what2)))\n\n ;; body of mul; dispatch based on input types\n (cond\n ((number? x)\n (cond\n ((number? y) (* x y))\n ((matrix? y) (mat-sca-mul y x))\n (else (type-error y))))\n ((matrix? x)\n (cond\n ((number? y) (mat-sca-mul x y))\n ((matrix? y) (mat-mat-mul x y))\n (else (type-error y))))\n (else (type-error x)))))"
},
{
"name": "sample.scss.txt",
"content": "$baseFontSizeInPixels: 14;\r\n\r\n@function px2em ($font_size, $base_font_size: $baseFontSizeInPixels) { \r\n @return ($font_size / $base_font_size) + em; \r\n}\r\n\r\nh1 {\r\n font-size: px2em(36, $baseFontSizeInPixels);\r\n}\r\nh2 {\r\n font-size: px2em(28, $baseFontSizeInPixels);\r\n}\r\n.class {\r\n font-size: px2em(14, $baseFontSizeInPixels);\r\n}\r\n\r\nnav {\r\n ul {\r\n margin: 0;\r\n padding: 0;\r\n list-style: none;\r\n }\r\n\r\n li { display: inline-block; }\r\n\r\n a {\r\n display: block;\r\n padding: 6px 12px;\r\n text-decoration: none;\r\n }\r\n \r\n @each $animal in puma, sea-slug, egret, salamander {\r\n .#{$animal}-icon {\r\n background-image: url('/images/#{$animal}.png');\r\n }\r\n }\r\n}"
},
{
"name": "sample.shell.txt",
"content": "#!/bin/bash\n# Simple line count example, using bash\n#\n# Bash tutorial: http://linuxconfig.org/Bash_scripting_Tutorial#8-2-read-file-into-bash-array\n# My scripting link: http://www.macs.hw.ac.uk/~hwloidl/docs/index.html#scripting\n#\n# Usage: ./line_count.sh file\n# -----------------------------------------------------------------------------\n\n# Link filedescriptor 10 with stdin\nexec 10<&0\n# stdin replaced with a file supplied as a first argument\nexec < $1\n# remember the name of the input file\nin=$1\n\n# init\nfile=\"current_line.txt\"\nlet count=0\n\n# this while loop iterates over all lines of the file\nwhile read LINE\ndo\n # increase line counter\n ((count++))\n # write current line to a tmp file with name $file (not needed for counting)\n echo $LINE > $file\n # this checks the return code of echo (not needed for writing; just for demo)\n if [ $? -ne 0 ]\n then echo \"Error in writing to file ${file}; check its permissions!\"\n fi\ndone\n\necho \"Number of lines: $count\"\necho \"The last line of the file is: `cat ${file}`\"\n\n# Note: You can achieve the same by just using the tool wc like this\necho \"Expected number of lines: `wc -l $in`\"\n\n# restore stdin from filedescriptor 10\n# and close filedescriptor 10\nexec 0<&10 10<&-"
},
{
"name": "sample.sol.txt",
"content": "pragma solidity ^0.4.11;\n\n/// @title Voting with delegation.\ncontract Ballot {\n // This declares a new complex type which will\n // be used for variables later.\n // It will represent a single voter.\n struct Voter {\n uint weight; // weight is accumulated by delegation\n bool voted; // if true, that person already voted\n address delegate; // person delegated to\n uint vote; // index of the voted proposal\n }\n\n // This is a type for a single proposal.\n struct Proposal {\n bytes32 name; // short name (up to 32 bytes)\n uint voteCount; // number of accumulated votes\n }\n\n address public chairperson;\n\n // This declares a state variable that\n // stores a `Voter` struct for each possible address.\n mapping(address => Voter) public voters;\n\n // A dynamically-sized array of `Proposal` structs.\n Proposal[] public proposals;\n\n /// Create a new ballot to choose one of `proposalNames`.\n function Ballot(bytes32[] proposalNames) {\n chairperson = msg.sender;\n voters[chairperson].weight = 1;\n\n // For each of the provided proposal names,\n // create a new proposal object and add it\n // to the end of the array.\n for (uint i = 0; i < proposalNames.length; i++) {\n // `Proposal({...})` creates a temporary\n // Proposal object and `proposals.push(...)`\n // appends it to the end of `proposals`.\n proposals.push(Proposal({\n name: proposalNames[i],\n voteCount: 0\n }));\n }\n }\n\n // Give `voter` the right to vote on this ballot.\n // May only be called by `chairperson`.\n function giveRightToVote(address voter) {\n // If the argument of `require` evaluates to `false`,\n // it terminates and reverts all changes to\n // the state and to Ether balances. It is often\n // a good idea to use this if functions are\n // called incorrectly. But watch out, this\n // will currently also consume all provided gas\n // (this is planned to change in the future).\n require((msg.sender == chairperson) && !voters[voter].voted && (voters[voter].weight == 0));\n voters[voter].weight = 1;\n }\n\n /// Delegate your vote to the voter `to`.\n function delegate(address to) {\n // assigns reference\n Voter sender = voters[msg.sender];\n require(!sender.voted);\n\n // Self-delegation is not allowed.\n require(to != msg.sender);\n\n // Forward the delegation as long as\n // `to` also delegated.\n // In general, such loops are very dangerous,\n // because if they run too long, they might\n // need more gas than is available in a block.\n // In this case, the delegation will not be executed,\n // but in other situations, such loops might\n // cause a contract to get \"stuck\" completely.\n while (voters[to].delegate != address(0)) {\n to = voters[to].delegate;\n\n // We found a loop in the delegation, not allowed.\n require(to != msg.sender);\n }\n\n // Since `sender` is a reference, this\n // modifies `voters[msg.sender].voted`\n sender.voted = true;\n sender.delegate = to;\n Voter delegate = voters[to];\n if (delegate.voted) {\n // If the delegate already voted,\n // directly add to the number of votes\n proposals[delegate.vote].voteCount += sender.weight;\n } else {\n // If the delegate did not vote yet,\n // add to her weight.\n delegate.weight += sender.weight;\n }\n }\n\n /// Give your vote (including votes delegated to you)\n /// to proposal `proposals[proposal].name`.\n function vote(uint proposal) {\n Voter sender = voters[msg.sender];\n require(!sender.voted);\n sender.voted = true;\n sender.vote = proposal;\n\n
},
{
"name": "sample.sql.txt",
"content": "CREATE TABLE dbo.EmployeePhoto\n(\n EmployeeId INT NOT NULL PRIMARY KEY,\n Photo VARBINARY(MAX) FILESTREAM NULL,\n MyRowGuidColumn UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL\n UNIQUE DEFAULT NEWID()\n);\n\nGO\n\n/*\ntext_of_comment\n/* nested comment */\n*/\n\n-- line comment\n\nCREATE NONCLUSTERED INDEX IX_WorkOrder_ProductID\n ON Production.WorkOrder(ProductID)\n WITH (FILLFACTOR = 80,\n PAD_INDEX = ON,\n DROP_EXISTING = ON);\nGO\n\nWHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300\nBEGIN\n UPDATE Production.Product\n SET ListPrice = ListPrice * 2\n SELECT MAX(ListPrice) FROM Production.Product\n IF (SELECT MAX(ListPrice) FROM Production.Product) > $500\n BREAK\n ELSE\n CONTINUE\nEND\nPRINT 'Too much for the market to bear';\n\nMERGE INTO Sales.SalesReason AS [Target]\nUSING (VALUES ('Recommendation','Other'), ('Review', 'Marketing'), ('Internet', 'Promotion'))\n AS [Source] ([NewName], NewReasonType)\nON [Target].[Name] = [Source].[NewName]\nWHEN MATCHED\nTHEN UPDATE SET ReasonType = [Source].NewReasonType\nWHEN NOT MATCHED BY TARGET\nTHEN INSERT ([Name], ReasonType) VALUES ([NewName], NewReasonType)\nOUTPUT $action INTO @SummaryOfChanges;\n\nSELECT ProductID, OrderQty, SUM(LineTotal) AS Total\nFROM Sales.SalesOrderDetail\nWHERE UnitPrice < $5.00\nGROUP BY ProductID, OrderQty\nORDER BY ProductID, OrderQty\nOPTION (HASH GROUP, FAST 10);\n"
},
{
"name": "sample.st.txt",
"content": "CONFIGURATION DefaultCfg\n VAR_GLOBAL\n Start_Stop AT %IX0.0: BOOL; (* This is a comment *)\n END_VAR\n TASK NewTask (INTERVAL := T#20ms);\n PROGRAM Main WITH NewTask : PLC_PRG;\nEND_CONFIGURATION\n\nPROGRAM demo\n VAR_EXTERNAL\n Start_Stop: BOOL;\n END_VAR\n VAR\n a : REAL; // Another comment\n todTest: TIME_OF_DAY := TOD#12:55;\n END_VAR\n a := csq(12.5);\n TON1(IN := TRUE, PT := T#2s);\n 16#FAC0 2#1001_0110\n IF TON1.Q AND a > REAL#100 THEN\n Start_Stop := TRUE;\n END_IF\nEND_PROGRAM;\n\n/* Get a square of the circle */\nFUNCTION csq : REAL\n VAR_INPUT\n r: REAL;\n END_VAR\n VAR CONSTANT\n c_pi: REAL := 3.14;\n END_VAR\n csq := ABS(c_pi * (r * 2));\nEND_FUNCTION"
},
{
"name": "sample.swift.txt",
"content": "import Foundation\r\n\r\nprotocol APIControllerProtocol {\r\n func didReceiveAPIResults(results: NSArray)\r\n}\r\n\r\nclass APIController {\r\n var delegate: APIControllerProtocol\r\n\r\n init(delegate: APIControllerProtocol) {\r\n self.delegate = delegate\r\n }\r\n\r\n func get(path: String) {\r\n let url = NSURL(string: path)\r\n let session = NSURLSession.sharedSession()\r\n let task = session.dataTaskWithURL(url!, completionHandler: {data, response, error -> Void in\r\n println(\"Task completed\")\r\n if(error != nil) {\r\n // If there is an error in the web request, print it to the console\r\n println(error.localizedDescription)\r\n }\r\n var err: NSError?\r\n if let jsonResult = NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions.MutableContainers, error: &err) as? NSDictionary {\r\n if(err != nil) {\r\n // If there is an error parsing JSON, print it to the console\r\n println(\"JSON Error \\(err!.localizedDescription)\")\r\n }\r\n if let results: NSArray = jsonResult[\"results\"] as? NSArray {\r\n self.delegate.didReceiveAPIResults(results)\r\n }\r\n }\r\n })\r\n\r\n // The task is just an object with all these properties set\r\n // In order to actually make the web request, we need to \"resume\"\r\n task.resume()\r\n }\r\n\r\n func searchItunesFor(searchTerm: String) {\r\n // The iTunes API wants multiple terms separated by + symbols, so replace spaces with + signs\r\n let itunesSearchTerm = searchTerm.stringByReplacingOccurrencesOfString(\" \", withString: \"+\", options: NSStringCompareOptions.CaseInsensitiveSearch, range: nil)\r\n\r\n // Now escape anything else that isn't URL-friendly\r\n if let escapedSearchTerm = itunesSearchTerm.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) {\r\n let urlPath = \"https://itunes.apple.com/search?term=\\(escapedSearchTerm)&media=music&entity=album\"\r\n }\r\n }\r\n\r\n}"
},
{
"name": "sample.systemverilog.txt",
"content": "// File : tb_top.sv\nmodule tb_top ();\n\n\treg clk;\n\treg resetn;\n\treg d;\n\twire q;\n\n\t// Instantiate the design\n\td_ff d_ff0 (\t.clk (clk),\n\t\t \t\t.resetn (resetn),\n\t\t \t\t.d (d),\n\t\t \t\t.q (q));\n\n\t// Create a clock\n\talways #10 clk <= ~clk;\n\n\tinitial begin\n\t\tresetn <= 0;\n\t\td <= 0;\n\n\t\t#10 resetn <= 1;\n\t\t#5 d <= 1;\n\t\t#8 d <= 0;\n\t\t#2 d <= 1;\n\t\t#10 d <= 0;\n\tend\nendmodule\n"
},
{
"name": "sample.tcl.txt",
"content": "proc find {{basedir .} {filterScript {}}} {\n set oldwd [pwd]\n cd $basedir\n set cwd [pwd]\n set filenames [glob -nocomplain * .*]\n set files {}\n set filt [string length $filterScript]\n foreach filename $filenames {\n if {!$filt || [eval $filterScript [list $filename]]} {\n lappend files [file join $cwd $filename]\n }\n if {[file isdirectory $filename]} {\n set files [concat $files [find $filename $filterScript]]\n }\n }\n cd $oldwd\n return $files\n}\n"
},
{
"name": "sample.twig.txt",
"content": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"UTF-8\">\n <title>{% block title %}Welcome!{% endblock %}</title>\n {% block stylesheets %}{% endblock %}\n </head>\n <body>\n {% block body %}{% endblock %}\n {% block javascripts %}{% endblock %}\n </body>\n</html>\n"
},
{
"name": "sample.typescript.txt",
"content": "/* Game of Life\r\n * Implemented in TypeScript\r\n * To learn more about TypeScript, please visit http://www.typescriptlang.org/\r\n */\r\n\r\nnamespace Conway {\r\n\r\n\texport class Cell {\r\n\t\tpublic row: number;\r\n\t\tpublic col: number;\r\n\t\tpublic live: boolean;\r\n\r\n\t\tconstructor(row: number, col: number, live: boolean) {\r\n\t\t\tthis.row = row;\r\n\t\t\tthis.col = col;\r\n\t\t\tthis.live = live;\r\n\t\t}\r\n\t}\r\n\r\n\texport class GameOfLife {\r\n\t\tprivate gridSize: number;\r\n\t\tprivate canvasSize: number;\r\n\t\tprivate lineColor: string;\r\n\t\tprivate liveColor: string;\r\n\t\tprivate deadColor: string;\r\n\t\tprivate initialLifeProbability: number;\r\n\t\tprivate animationRate: number;\r\n\t\tprivate cellSize: number;\r\n\t\tprivate context: CanvasRenderingContext2D;\r\n\t\tprivate world;\r\n\r\n\r\n\t\tconstructor() {\r\n\t\t\tthis.gridSize = 50;\r\n\t\t\tthis.canvasSize = 600;\r\n\t\t\tthis.lineColor = '#cdcdcd';\r\n\t\t\tthis.liveColor = '#666';\r\n\t\t\tthis.deadColor = '#eee';\r\n\t\t\tthis.initialLifeProbability = 0.5;\r\n\t\t\tthis.animationRate = 60;\r\n\t\t\tthis.cellSize = 0;\r\n\t\t\tthis.world = this.createWorld();\r\n\t\t\tthis.circleOfLife();\r\n\t\t}\r\n\r\n\t\tpublic createWorld() {\r\n\t\t\treturn this.travelWorld( (cell : Cell) => {\r\n\t\t\t\tcell.live = Math.random() < this.initialLifeProbability;\r\n\t\t\t\treturn cell;\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tpublic circleOfLife() : void {\r\n\t\t\tthis.world = this.travelWorld( (cell: Cell) => {\r\n\t\t\t\tcell = this.world[cell.row][cell.col];\r\n\t\t\t\tthis.draw(cell);\r\n\t\t\t\treturn this.resolveNextGeneration(cell);\r\n\t\t\t});\r\n\t\t\tsetTimeout( () => {this.circleOfLife()}, this.animationRate);\r\n\t\t}\r\n\r\n\t\tpublic resolveNextGeneration(cell : Cell) {\r\n\t\t\tvar count = this.countNeighbors(cell);\r\n\t\t\tvar newCell = new Cell(cell.row, cell.col, cell.live);\r\n\t\t\tif(count < 2 || count > 3) newCell.live = false;\r\n\t\t\telse if(count == 3) newCell.live = true;\r\n\t\t\treturn newCell;\r\n\t\t}\r\n\r\n\t\tpublic countNeighbors(cell : Cell) {\r\n\t\t\tvar neighbors = 0;\r\n\t\t\tfor(var row = -1; row <=1; row++) {\r\n\t\t\t\tfor(var col = -1; col <= 1; col++) {\r\n\t\t\t\t\tif(row == 0 && col == 0) continue;\r\n\t\t\t\t\tif(this.isAlive(cell.row + row, cell.col + col)) {\r\n\t\t\t\t\t\tneighbors++;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn neighbors;\r\n\t\t}\r\n\r\n\t\tpublic isAlive(row : number, col : number) {\r\n\t\t\tif(row < 0 || col < 0 || row >= this.gridSize || col >= this.gridSize) return false;\r\n\t\t\treturn this.world[row][col].live;\r\n\t\t}\r\n\r\n\t\tpublic travelWorld(callback) {\r\n\t\t\tvar result = [];\r\n\t\t\tfor(var row = 0; row < this.gridSize; row++) {\r\n\t\t\t\tvar rowData = [];\r\n\t\t\t\tfor(var col = 0; col < this.gridSize; col++) {\r\n\t\t\t\t\trowData.push(callback(new Cell(row, col, false)));\r\n\t\t\t\t}\r\n\t\t\t\tresult.push(rowData);\r\n\t\t\t}\r\n\t\t\treturn result;\r\n\t\t}\r\n\r\n\t\tpublic draw(cell : Cell) {\r\n\t\t\tif(this.context == null) this.context = this.createDrawingContext();\r\n\t\t\tif(this.cellSize == 0) this.cellSize = this.canvasSize/this.gridSize;\r\n\r\n\t\t\tthis.context.strokeStyle = this.lineColor;\r\n\t\t\tthis.context.strokeRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);\r\n\t\t\tthis.context.fillStyle = cell.live ? this.liveColor : this.deadColor;\r\n\t\t\tthis.context.fillRect(cell.row * this.cellSize, cell.col*this.cellSize, this.cellSize, this.cellSize);\r\n\t\t}\r\n\r\n\t\tpublic createDrawingContext() {\r\n\t\t\tvar canvas = <HTMLCanvasElement> document.getElementById('conway-canvas');\r\n\t\t\tif(canvas == null) {\r\n\t\t\t\t\tcanvas = document.createElement('canvas');\r\n\t\t\t\t\tcanvas.id = 'conway-canvas';\r\n\t\t\t\t\tcanvas.width = this.canvasSize;\r\n\t\t\t\t\tcanvas.height = this.canvasSize;\r\n\t\t\t\t\tdocument.body.appendChild(canvas);\r\n\t\t\t}\r\n\t\t\treturn canvas.getContext('2d');\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvar game = new Conway.GameOfLife();\r\n"
},
{
"name": "sample.vb.txt",
"content": "Imports System\r\nImports System.Collections.Generic\r\n\r\nModule Module1\r\n\r\n Sub Main()\r\n Dim a As New M8Ball\r\n\r\n Do While True\r\n\r\n Dim q As String = \"\"\r\n Console.Write(\"ask me about the future... \")\r\n q = Console.ReadLine()\r\n\r\n If q.Trim <> \"\" Then\r\n Console.WriteLine(\"the answer is... {0}\", a.getAnswer(q))\r\n Else\r\n Exit Do\r\n End If\r\n Loop\r\n\r\n End Sub\r\n\r\nEnd Module\r\n\r\nClass M8Ball\r\n\r\n Public Answers As System.Collections.Generic.Dictionary(Of Integer, String)\r\n\r\n Public Sub New()\r\n Answers = New System.Collections.Generic.Dictionary(Of Integer, String)\r\n Answers.Add(0, \"It is certain\")\r\n Answers.Add(1, \"It is decidedly so\")\r\n Answers.Add(2, \"Without a doubt\")\r\n Answers.Add(3, \"Yes, definitely\")\r\n Answers.Add(4, \"You may rely on \")\r\n Answers.Add(5, \"As I see it, yes\")\r\n Answers.Add(6, \"Most likely\")\r\n Answers.Add(7, \"Outlook good\")\r\n Answers.Add(8, \"Signs point to yes\")\r\n Answers.Add(9, \"Yes\")\r\n Answers.Add(10, \"Reply hazy, try again\")\r\n Answers.Add(11, \"Ask again later\")\r\n Answers.Add(12, \"Better not tell you now\")\r\n Answers.Add(13, \"Cannot predict now\")\r\n Answers.Add(14, \"Concentrate and ask again\")\r\n Answers.Add(15, \"Don't count on it\")\r\n Answers.Add(16, \"My reply is no\")\r\n Answers.Add(17, \"My sources say no\")\r\n Answers.Add(18, \"Outlook not so\")\r\n Answers.Add(19, \"Very doubtful\")\r\n End Sub\r\n\r\n Public Function getAnswer(theQuestion As String) As String\r\n Dim r As New Random\r\n Return Answers(r.Next(0, 19))\r\n End Function\r\n\r\nEnd Class\r\n"
},
{
"name": "sample.verilog.txt",
"content": "`include \"first_counter.v\"\nmodule first_counter_tb();\n// Declare inputs as regs and outputs as wires\nreg clock, reset, enable;\nwire [3:0] counter_out;\n\n// Initialize all variables\ninitial begin\n $display (\"time\\t clk reset enable counter\");\n $monitor (\"%g\\t %b %b %b %b\",\n\t $time, clock, reset, enable, counter_out);\n clock = 1; // initial value of clock\n reset = 0; // initial value of reset\n enable = 0; // initial value of enable\n #5 reset = 1; // Assert the reset\n #10 reset = 0; // De-assert the reset\n #10 enable = 1; // Assert enable\n #100 enable = 0; // De-assert enable\n #5 $finish; // Terminate simulation\nend\n\n// Clock generator\nalways begin\n #5 clock = ~clock; // Toggle clock every 5 ticks\nend\n\n// Connect DUT to test bench\nfirst_counter U_counter (\nclock,\nreset,\nenable,\ncounter_out\n);\n\nendmodule\n"
},
{
"name": "sample.xml.txt",
"content": "<?xml version=\"1.0\"?>\r\n<configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\">\r\n <connectionStrings>\r\n <add name=\"MyDB\" \r\n connectionString=\"value for the deployed Web.config file\" \r\n xdt:Transform=\"SetAttributes\" xdt:Locator=\"Match(name)\"/>\r\n </connectionStrings>\r\n <system.web>\r\n <customErrors defaultRedirect=\"GenericError.htm\"\r\n mode=\"RemoteOnly\" xdt:Transform=\"Replace\">\r\n <error statusCode=\"500\" redirect=\"InternalError.htm\"/>\r\n </customErrors>\r\n </system.web>\r\n</configuration>"
8 years ago
},
{
"name": "sample.yaml.txt",
"content": "%TAG ! tag:clarkevans.com,2002:\n--- !shape\n # Use the ! handle for presenting\n # tag:clarkevans.com,2002:circle\n- !circle\n center: &ORIGIN {x: 73, y: 129}\n radius: 7\n- !line\n start: *ORIGIN\n finish: { x: 89, y: 102 }\n- !label\n start: *ORIGIN\n color: 0xFFEEBB\n text: Pretty vector drawing.\n"
}
]; });