{"text": "var videoState={\n\n \n create: function(){\n var video;\n var sprite;\n \n video = game.add.video('storyvideo');\n video.play(false);\n sprite = video.addToWorld(game.world.centerX, game.world.centerY, 0.5, 0.5, 2, 2);\n//pause\n var picLabel= game.add.image(game.width/2, game.height-30, 'skip');\n picLabel.anchor.setTo(-1,1);\n picLabel.inputEnabled = true;\n picLabel.events.onInputDown.add(this.start, this);\n\n//skip video\n// var picLabel= game.add.image(game.width/2, game.height-30, 'skip');\n// picLabel.anchor.setTo(-2,1);\n// picLabel.inputEnabled = true;\n// picLabel.events.onInputDown.add(this.startgame, this);\n\n\n\n\n\n\n // game.time.events.add(Phaser.Timer.SECOND * 10, this.fadeState, this);\n\n // game.stage.backgroundColor= '#ffffff';\n\n game.physics.startSystem(Phaser.Physics. ARCADE);\n game.renderer.renderSession.roundPixels=true;\n \n },\n \n // fadeState: function(){\n // game.state.start('play');\n\n // },\n start: function(){\n game.paused = (game.paused) ? false : true;\n game.state.start('play');\n \n },\n // startgame: function(){\n // game.state.start('play');\n \n // },\n\n};", "meta": {"content_hash": "1c932c7359417cc3e05f3380eabb7fac", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 89, "avg_line_length": 25.41176470588235, "alnum_prop": 0.5601851851851852, "repo_name": "nickchulani99/ITE-445", "id": "d9d5cb9bb5e54f95b73df6a87d4bcecebdc40318", "size": "1296", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "final/alien copy 4/js/video.js", "mode": "33188", "license": "mit", "language": [{"name": "HTML", "bytes": "16832"}, {"name": "JavaScript", "bytes": "451272"}]}} {"text": "package mts\n\n//Licensed under the Apache License, Version 2.0 (the \"License\");\n//you may not use this file except in compliance with the License.\n//You may obtain a copy of the License at\n//\n//http://www.apache.org/licenses/LICENSE-2.0\n//\n//Unless required by applicable law or agreed to in writing, software\n//distributed under the License is distributed on an \"AS IS\" BASIS,\n//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n//See the License for the specific language governing permissions and\n//limitations under the License.\n//\n// Code generated by Alibaba Cloud SDK Code Generator.\n// Changes may cause incorrect behavior and will be lost if the code is regenerated.\n\nimport (\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests\"\n\t\"github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses\"\n)\n\n// SearchMedia invokes the mts.SearchMedia API synchronously\nfunc (client *Client) SearchMedia(request *SearchMediaRequest) (response *SearchMediaResponse, err error) {\n\tresponse = CreateSearchMediaResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}\n\n// SearchMediaWithChan invokes the mts.SearchMedia API asynchronously\nfunc (client *Client) SearchMediaWithChan(request *SearchMediaRequest) (<-chan *SearchMediaResponse, <-chan error) {\n\tresponseChan := make(chan *SearchMediaResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.SearchMedia(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}\n\n// SearchMediaWithCallback invokes the mts.SearchMedia API asynchronously\nfunc (client *Client) SearchMediaWithCallback(request *SearchMediaRequest, callback func(response *SearchMediaResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *SearchMediaResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.SearchMedia(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}\n\n// SearchMediaRequest is the request struct for api SearchMedia\ntype SearchMediaRequest struct {\n\t*requests.RpcRequest\n\tResourceOwnerId requests.Integer `position:\"Query\" name:\"ResourceOwnerId\"`\n\tDescription string `position:\"Query\" name:\"Description\"`\n\tTitle string `position:\"Query\" name:\"Title\"`\n\tPageNumber requests.Integer `position:\"Query\" name:\"PageNumber\"`\n\tCateId string `position:\"Query\" name:\"CateId\"`\n\tPageSize requests.Integer `position:\"Query\" name:\"PageSize\"`\n\tFrom string `position:\"Query\" name:\"From\"`\n\tTag string `position:\"Query\" name:\"Tag\"`\n\tKeyWord string `position:\"Query\" name:\"KeyWord\"`\n\tResourceOwnerAccount string `position:\"Query\" name:\"ResourceOwnerAccount\"`\n\tOwnerAccount string `position:\"Query\" name:\"OwnerAccount\"`\n\tOwnerId requests.Integer `position:\"Query\" name:\"OwnerId\"`\n\tSortBy string `position:\"Query\" name:\"SortBy\"`\n\tTo string `position:\"Query\" name:\"To\"`\n}\n\n// SearchMediaResponse is the response struct for api SearchMedia\ntype SearchMediaResponse struct {\n\t*responses.BaseResponse\n\tTotalNum int64 `json:\"TotalNum\" xml:\"TotalNum\"`\n\tPageSize int64 `json:\"PageSize\" xml:\"PageSize\"`\n\tRequestId string `json:\"RequestId\" xml:\"RequestId\"`\n\tPageNumber int64 `json:\"PageNumber\" xml:\"PageNumber\"`\n\tMediaList MediaListInSearchMedia `json:\"MediaList\" xml:\"MediaList\"`\n}\n\n// CreateSearchMediaRequest creates a request to invoke SearchMedia API\nfunc CreateSearchMediaRequest() (request *SearchMediaRequest) {\n\trequest = &SearchMediaRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Mts\", \"2014-06-18\", \"SearchMedia\", \"mts\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}\n\n// CreateSearchMediaResponse creates a response to parse from SearchMedia response\nfunc CreateSearchMediaResponse() (response *SearchMediaResponse) {\n\tresponse = &SearchMediaResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}\n", "meta": {"content_hash": "4765aae0af2406ea691fb001ea5a83df", "timestamp": "", "source": "github", "line_count": 116, "max_line_length": 144, "avg_line_length": 38.23275862068966, "alnum_prop": 0.7019165727170237, "repo_name": "aliyun/alibaba-cloud-sdk-go", "id": "e23386a31fa5de227e10f19984b8f3e7eb736f22", "size": "4435", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "services/mts/search_media.go", "mode": "33188", "license": "apache-2.0", "language": [{"name": "Go", "bytes": "734307"}, {"name": "Makefile", "bytes": "183"}]}} {"text": "\n\n\n \n Invitation to calendar\n \n\n\n

You was invited to calendar.

\n\n

You can login and set password procceed by link:

\n\n\">\n\n", "meta": {"content_hash": "324efbc1ad28fdfe902cd1e51f7e095e", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 76, "avg_line_length": 23.733333333333334, "alnum_prop": 0.6432584269662921, "repo_name": "vchukhalyonock/calendar", "id": "5ca5e852381e8a65c1d2612696445e148aa8677b", "size": "356", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/views/email/invite.php", "mode": "33188", "license": "mit", "language": [{"name": "ApacheConf", "bytes": "366"}, {"name": "CSS", "bytes": "39144"}, {"name": "HTML", "bytes": "5502"}, {"name": "JavaScript", "bytes": "460150"}, {"name": "PHP", "bytes": "1807984"}]}} {"text": "import os\nfrom flask import Flask,render_template,url_for,request,session,redirect\nfrom flask_login import LoginManager\nfrom flask_bootstrap import Bootstrap\nfrom flask_script import Manager,Shell\nfrom flask_sqlalchemy import SQLAlchemy\nfrom flask_mail import Mail\nfrom flask_moment import Moment\nfrom flask_socketio import SocketIO\nfrom flask_gravatar import Gravatar\n\napp = Flask(__name__)\nbasedir = os.path.abspath(os.path.dirname(__file__))\napp.config['SQLALCHEMY_DATABASE_URI'] =\\\n 'sqlite:///' + os.path.join(basedir, 'data.sqlite')\n#app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://sql6140009:Y1912zwYwC@sql6.freemysqlhosting.net/sql6140009'\napp.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False\napp.config['SECRET_KEY'] = 'hard to guess string'\n\napp.config['MAIL_SERVER'] = 'smtp.googlemail.com'\napp.config['MAIL_PORT'] = 587\napp.config['MAIL_USE_TLS'] = True\napp.config['MAIL_USERNAME'] = os.environ.get('MAIL_USERNAME')\napp.config['MAIL_PASSWORD'] = os.environ.get('MAIL_PASSWORD')\n\nmanager = Manager(app)\nbootstrap = Bootstrap()\ndb = SQLAlchemy(app)\nmail = Mail(app)\nmoment = Moment(app)\nsocketio = SocketIO(app)\ngravatar = Gravatar(app)\n\nlogin_manager = LoginManager()\nlogin_manager.session_protection = 'strong'\nlogin_manager.login_view = 'auth.login'\n# app.config['SECRET_KEY'] = 'hard to guess string'\n# app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True\n#app = create_app('DEVELOPMENT')\n\nbootstrap.init_app(app)\n#db.init_app(app)\nlogin_manager.init_app(app)\n\nfrom app import models\n\n@app.route('/')\ndef index():\n return render_template('index.html')\n\nfrom app.auth.views import admin\napp.register_blueprint(auth.views.admin,url_prefix = '/authentication')\n\nfrom app.main.views import welcome\napp.register_blueprint(main.views.welcome,url_prefix = '/welcome')\n\nfrom app.twitterAPI.views import api\napp.register_blueprint(twitterAPI.views.api,url_prefix = '/api')\n", "meta": {"content_hash": "a9735eefc6ff4807441825a5f2811599", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 117, "avg_line_length": 32.62068965517241, "alnum_prop": 0.7563424947145877, "repo_name": "sumedh123/debatify", "id": "89d78b1a48e585a5353b33fa5344659ba9f8770a", "size": "1892", "binary": false, "copies": "1", "ref": "refs/heads/UI", "path": "app/__init__.py", "mode": "33188", "license": "mit", "language": [{"name": "C", "bytes": "5939"}, {"name": "CSS", "bytes": "347155"}, {"name": "HTML", "bytes": "102503"}, {"name": "JavaScript", "bytes": "608373"}, {"name": "Python", "bytes": "8393673"}, {"name": "Shell", "bytes": "3298"}]}} {"text": "/*\n * String hash computation (interning).\n */\n\n#include \"duk_internal.h\"\n\n/* constants for duk_hashstring() */\n#define STRING_HASH_SHORTSTRING 4096\n#define STRING_HASH_MEDIUMSTRING (256 * 1024)\n#define STRING_HASH_BLOCKSIZE 256\n\nduk_uint32_t duk_heap_hashstring(duk_heap *heap, duk_uint8_t *str, duk_size_t len) {\n\t/*\n\t * Sampling long strings by byte skipping (like Lua does) is potentially\n\t * a cache problem. Here we do 'block skipping' instead for long strings:\n\t * hash an initial part, and then sample the rest of the string with\n\t * reasonably sized chunks.\n\t *\n\t * Skip should depend on length and bound the total time to roughly\n\t * logarithmic.\n\t *\n\t * With current values:\n\t *\n\t * 1M string => 256 * 241 = 61696 bytes (0.06M) of hashing\n\t * 1G string => 256 * 16321 = 4178176 bytes (3.98M) of hashing\n\t *\n\t * After an initial part has been hashed, an offset is applied before\n\t * starting the sampling. The initial offset is computed from the\n\t * hash of the initial part of the string. The idea is to avoid the\n\t * case that all long strings have certain offset ranges that are never\n\t * sampled.\n\t */\n\t\n\t/* note: mixing len into seed improves hashing when skipping */\n\tduk_uint32_t str_seed = heap->hash_seed ^ len;\n\n\tif (len <= STRING_HASH_SHORTSTRING) {\n\t\treturn duk_util_hashbytes(str, len, str_seed);\n\t} else {\n\t\tduk_uint32_t hash;\n\t\tduk_size_t off;\n\t\tduk_size_t skip;\n\n\t\tif (len <= STRING_HASH_MEDIUMSTRING) {\n\t\t\tskip = (duk_size_t) (16 * STRING_HASH_BLOCKSIZE + STRING_HASH_BLOCKSIZE);\n\t\t} else {\n\t\t\tskip = (duk_size_t) (256 * STRING_HASH_BLOCKSIZE + STRING_HASH_BLOCKSIZE);\n\t\t}\n\n\t\thash = duk_util_hashbytes(str, (duk_size_t) STRING_HASH_SHORTSTRING, str_seed);\n\t\toff = STRING_HASH_SHORTSTRING + (skip * (hash % 256)) / 256;\n\n\t\t/* FIXME: inefficient loop */\n\t\twhile (off < len) {\n\t\t\tduk_size_t left = len - off;\n\t\t\tduk_size_t now = (duk_size_t) (left > STRING_HASH_BLOCKSIZE ? STRING_HASH_BLOCKSIZE : left);\n\t\t\thash ^= duk_util_hashbytes(str + off, now, str_seed);\n\t\t\toff += skip;\n\t\t}\n\n\t\treturn hash;\n\t}\n}\n\n", "meta": {"content_hash": "bab3317c67f40063ff7a69f3bcc74bb0", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 95, "avg_line_length": 32.140625, "alnum_prop": 0.6684491978609626, "repo_name": "JoshEngebretson/duktape", "id": "29411796cbb56b7d91920771a24db254493ccfc8", "size": "2057", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/duk_heap_hashstring.c", "mode": "33188", "license": "mit", "language": [{"name": "C", "bytes": "1972812"}, {"name": "C++", "bytes": "20922"}, {"name": "CoffeeScript", "bytes": "895"}, {"name": "JavaScript", "bytes": "15926045"}, {"name": "Objective-C", "bytes": "6054"}, {"name": "Python", "bytes": "136104"}, {"name": "Shell", "bytes": "12610"}]}} {"text": "--TEST--\nRunkit_Sandbox_Parent Class -- Echo\n--SKIPIF--\n\n--FILE--\nini_set('display_errors', true);\n$php->ini_set('html_errors', false);\n$php->eval('$PARENT = new Runkit_Sandbox_Parent;\n\t\t\techo \"Foo\\n\";\n\t\t\t$PARENT->echo(\"BarBar\\n\");');\n\nfunction test_handler($str) {\n if (strlen($str) == 0) return NULL; /* flush() */\n /* Echoing and returning have the same effect here, both go to parent's output chain */\n echo 'Received string from sandbox: ' . strlen($str) . \" bytes long.\\n\";\n\n return strtoupper($str);\n}\n--EXPECT--\nReceived string from sandbox: 4 bytes long.\nFOO\nReceived string from sandbox: 149 bytes long.\n\nWARNING: RUNKIT_SANDBOX_PARENT::ECHO(): ACCESS TO ECHO DATA IN THE PARENT CONTEXT IS NOT ENABLED IN UNKNOWN(0) : RUNKIT_SANDBOX EVAL CODE ON LINE 3\n", "meta": {"content_hash": "009fcdd5cf234bb851939760b7bb2bec", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 147, "avg_line_length": 36.93333333333333, "alnum_prop": 0.6796028880866426, "repo_name": "lzpfmh/runkit", "id": "44237969acec682b89517ba99d074aa575d5c09a", "size": "1108", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "tests/Runkit_Sandbox_Parent__.echo.access.phpt", "mode": "33188", "license": "bsd-3-clause", "language": [{"name": "C", "bytes": "263129"}, {"name": "C++", "bytes": "372"}, {"name": "PHP", "bytes": "141611"}, {"name": "SourcePawn", "bytes": "193"}]}} {"text": "\npackage org.codehaus.groovy.grails.scaffolding;\n\nimport grails.build.logging.GrailsConsole;\nimport groovy.text.SimpleTemplateEngine;\nimport groovy.text.Template;\n\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.Writer;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.codehaus.groovy.grails.commons.GrailsApplication;\nimport org.codehaus.groovy.grails.commons.GrailsDomainClass;\nimport org.codehaus.groovy.grails.commons.GrailsDomainClassProperty;\nimport org.codehaus.groovy.grails.plugins.GrailsPluginInfo;\nimport org.codehaus.groovy.grails.plugins.GrailsPluginManager;\nimport org.codehaus.groovy.grails.plugins.GrailsPluginUtils;\nimport org.codehaus.groovy.grails.plugins.PluginManagerAware;\nimport org.codehaus.groovy.runtime.IOGroovyMethods;\nimport org.codehaus.groovy.runtime.StringGroovyMethods;\nimport org.springframework.context.ResourceLoaderAware;\nimport org.springframework.core.io.AbstractResource;\nimport org.springframework.core.io.FileSystemResource;\nimport org.springframework.core.io.Resource;\nimport org.springframework.core.io.ResourceLoader;\nimport org.springframework.core.io.support.PathMatchingResourcePatternResolver;\nimport org.springframework.util.Assert;\nimport org.springframework.util.StringUtils;\n\npublic abstract class AbstractGrailsTemplateGenerator implements GrailsTemplateGenerator, ResourceLoaderAware, PluginManagerAware {\n\n\tprotected static final Log log = LogFactory.getLog(AbstractGrailsTemplateGenerator.class);\n\n\tprotected String basedir = \".\";\n\tprotected boolean overwrite = false;\n\tprotected SimpleTemplateEngine engine = new SimpleTemplateEngine();\n\tprotected ResourceLoader resourceLoader;\n\tprotected Template renderEditorTemplate;\n\tprotected String domainSuffix = \"\";\n\tprotected GrailsPluginManager pluginManager;\n\tprotected GrailsApplication grailsApplication;\n\n\tprotected AbstractGrailsTemplateGenerator(ClassLoader classLoader) {\n\t\tengine = new SimpleTemplateEngine(classLoader);\n\t}\n\n\tpublic void generateViews(GrailsDomainClass domainClass, String destDir) throws IOException {\n\t\tAssert.hasText(destDir, \"Argument [destdir] not specified\");\n\n\t\tFile viewsDir = new File(destDir, \"grails-app/views/\" + domainClass.getPropertyName());\n\t\tif (!viewsDir.exists()) {\n\t\t\tviewsDir.mkdirs();\n\t\t}\n\n\t\tfor (String name : getTemplateNames()) {\n if(log.isInfoEnabled())\n\t\t\t log.info(\"Generating [\"+name+\"] view for domain class [\"+domainClass.getFullName()+\"]\");\n\t\t\tgenerateView(domainClass, name, viewsDir.getAbsolutePath());\n\t\t}\n\t}\n\n\tpublic void generateController(GrailsDomainClass domainClass, String destDir) throws IOException {\n\t\tAssert.hasText(destDir, \"Argument [destdir] not specified\");\n\n\t\tif (domainClass == null) {\n\t\t\treturn;\n\t\t}\n\n\t\tString fullName = domainClass.getFullName();\n\t\tString pkg = \"\";\n\t\tint pos = fullName.lastIndexOf('.');\n\t\tif (pos != -1) {\n\t\t\t// Package name with trailing '.'\n\t\t\tpkg = fullName.substring(0, pos + 1);\n\t\t}\n\n\t\tFile destFile = new File(destDir, \"grails-app/controllers/\" + pkg.replace('.', '/') + domainClass.getShortName() + \"Controller.groovy\");\n\t\tif (canWrite(destFile)) {\n\t\t\tdestFile.getParentFile().mkdirs();\n\n\t\t\tBufferedWriter writer = null;\n\t\t\ttry {\n\t\t\t\twriter = new BufferedWriter(new FileWriter(destFile));\n\t\t\t\tgenerateController(domainClass, writer);\n\t\t\t\ttry {\n\t\t\t\t\twriter.flush();\n\t\t\t\t}\n\t\t\t\tcatch (IOException ignored) {}\n\t\t\t}\n\t\t\tfinally {\n\t\t\t\tIOGroovyMethods.closeQuietly(writer);\n\t\t\t}\n\n\t\t\tlog.info(\"Controller generated at [\"+destFile+\"]\");\n\t\t}\n\t}\n\n @Override\n public void generateAsyncController(GrailsDomainClass domainClass, String destDir) throws IOException {\n Assert.hasText(destDir, \"Argument [destdir] not specified\");\n\n if (domainClass == null) {\n return;\n }\n\n String fullName = domainClass.getFullName();\n String pkg = \"\";\n int pos = fullName.lastIndexOf('.');\n if (pos != -1) {\n // Package name with trailing '.'\n pkg = fullName.substring(0, pos + 1);\n }\n\n File destFile = new File(destDir, \"grails-app/controllers/\" + pkg.replace('.', '/') + domainClass.getShortName() + \"Controller.groovy\");\n if (canWrite(destFile)) {\n destFile.getParentFile().mkdirs();\n\n BufferedWriter writer = null;\n try {\n writer = new BufferedWriter(new FileWriter(destFile));\n generateAsyncController(domainClass, writer);\n try {\n writer.flush();\n }\n catch (IOException ignored) {}\n }\n finally {\n IOGroovyMethods.closeQuietly(writer);\n }\n\n log.info(\"Controller generated at [\"+destFile+\"]\");\n }\n }\n\n public void generateView(GrailsDomainClass domainClass, String viewName, Writer out) throws IOException {\n\t\tString templateText = getTemplateText(viewName + \".gsp\");\n\n\t\tif (!StringUtils.hasLength(templateText)) {\n\t\t\treturn;\n\t\t}\n\n\t\tGrailsDomainClassProperty multiPart = null;\n\t\tfor (GrailsDomainClassProperty property : domainClass.getProperties()) {\n\t\t\tif (property.getType() == Byte[].class || property.getType() == byte[].class) {\n\t\t\t\tmultiPart = property;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tString packageName = StringUtils.hasLength(domainClass.getPackageName()) ? \"<%@ page import=\\\"\" + domainClass.getFullName() + \"\\\" %>\" : \"\";\n\t\tMap binding = createBinding(domainClass);\n\t\tbinding.put(\"packageName\", packageName);\n\t\tbinding.put(\"multiPart\", multiPart);\n\t\tbinding.put(\"propertyName\", getPropertyName(domainClass));\n\n\t\tgenerate(templateText, binding, out);\n\t}\n\n\tprotected abstract Object getRenderEditor();\n\n\tpublic void generateView(GrailsDomainClass domainClass, String viewName, String destDir) throws IOException {\n\t\tFile destFile = new File(destDir, viewName + \".gsp\");\n\t\tif (!canWrite(destFile)) {\n\t\t\treturn;\n\t\t}\n\n\t\tBufferedWriter writer = null;\n\t\ttry {\n\t\t\twriter = new BufferedWriter(new FileWriter(destFile));\n\t\t\tgenerateView(domainClass, viewName, writer);\n\t\t\ttry {\n\t\t\t\twriter.flush();\n\t\t\t}\n\t\t\tcatch (IOException ignored) {}\n\t\t}\n\t\tfinally {\n\t\t\tIOGroovyMethods.closeQuietly(writer);\n\t\t}\n\t}\n\n\tpublic void generateController(GrailsDomainClass domainClass, Writer out) throws IOException {\n\t\tString templateText = getTemplateText(\"Controller.groovy\");\n\n\t\tMap binding = createBinding(domainClass);\n\t\tbinding.put(\"packageName\", domainClass.getPackageName());\n\t\tbinding.put(\"propertyName\", getPropertyName(domainClass));\n\n\t\tgenerate(templateText, binding, out);\n\t}\n\n public void generateAsyncController(GrailsDomainClass domainClass, Writer out) throws IOException {\n String templateText = getTemplateText(\"AsyncController.groovy\");\n\n Map binding = createBinding(domainClass);\n binding.put(\"packageName\", domainClass.getPackageName());\n binding.put(\"propertyName\", getPropertyName(domainClass));\n\n generate(templateText, binding, out);\n }\n\n @Override\n public void generateAsyncTest(GrailsDomainClass domainClass, String destDir) throws IOException {\n generateTest(domainClass, destDir, \"AsyncSpec.groovy\");\n }\n\n\tpublic void generateTest(GrailsDomainClass domainClass, String destDir) throws IOException {\n generateTest(domainClass, destDir, \"Spec.groovy\");\n\t}\n\n private void generateTest(GrailsDomainClass domainClass, String destDir, String templateName) throws IOException {\n File destFile = new File(destDir, domainClass.getPackageName().replace('.', '/') + '/' + domainClass.getShortName() + \"ControllerSpec.groovy\");\n if (!canWrite(destFile)) {\n return;\n }\n\n String templateText = getTemplateText(templateName);\n\n Map binding = createBinding(domainClass);\n binding.put(\"packageName\", domainClass.getPackageName());\n binding.put(\"propertyName\", domainClass.getLogicalPropertyName());\n binding.put(\"modelName\", getPropertyName(domainClass));\n\n destFile.getParentFile().mkdirs();\n BufferedWriter writer = null;\n try {\n writer = new BufferedWriter(new FileWriter(destFile));\n generate(templateText, binding, writer);\n try {\n writer.flush();\n }\n catch (IOException ignored) {}\n }\n finally {\n IOGroovyMethods.closeQuietly(writer);\n }\n }\n\n\n @SuppressWarnings(\"deprecation\")\n protected Map createBinding(GrailsDomainClass domainClass) {\n\t\tboolean hasHibernate = pluginManager.hasGrailsPlugin(\"hibernate\") || pluginManager.hasGrailsPlugin(\"hibernate4\");\n\n\t\tMap binding = new HashMap();\n\t\tbinding.put(\"pluginManager\", pluginManager);\n\t\tbinding.put(\"domainClass\", domainClass);\n\t\tbinding.put(\"className\", domainClass.getShortName());\n\t\tbinding.put(\"renderEditor\", getRenderEditor());\n\t\tbinding.put(\"comparator\", hasHibernate ? DomainClassPropertyComparator.class : SimpleDomainClassPropertyComparator.class);\n\t\treturn binding;\n\t}\n\n\tprotected void generate(String templateText, Map binding, Writer out) {\n\t\ttry {\n\t\t\tengine.createTemplate(templateText).make(binding).writeTo(out);\n\t\t}\n\t\tcatch (ClassNotFoundException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t\tcatch (IOException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tprotected String getPropertyName(GrailsDomainClass domainClass) {\n\t\treturn domainClass.getPropertyName() + domainSuffix;\n\t}\n\n\tprotected String getTemplateText(String template) throws IOException {\n\t\tInputStream inputStream = null;\n\t\tif (resourceLoader != null && grailsApplication.isWarDeployed()) {\n\t\t\tinputStream = resourceLoader.getResource(\"/WEB-INF/templates/scaffolding/\" + template).getInputStream();\n\t\t}\n\t\telse {\n\t\t\tAbstractResource templateFile = getTemplateResource(template);\n\t\t\tif (templateFile.exists()) {\n\t\t\t\tinputStream = templateFile.getInputStream();\n\t\t\t}\n\t\t}\n\n\t\treturn inputStream == null ? null : IOGroovyMethods.getText(inputStream);\n\t}\n\n\tprotected AbstractResource getTemplateResource(String template) throws IOException {\n\t\tString name = \"src/templates/scaffolding/\" + template;\n\t\tAbstractResource templateFile = new FileSystemResource(new File(basedir, name).getAbsoluteFile());\n\t\tif (!templateFile.exists()) {\n\t\t\ttemplateFile = new FileSystemResource(new File(getPluginDir(), name).getAbsoluteFile());\n\t\t}\n\n\t\treturn templateFile;\n\t}\n\n\tprotected File getPluginDir() throws IOException {\n\t\tGrailsPluginInfo info = GrailsPluginUtils.getPluginBuildSettings().getPluginInfoForName(\"scaffolding\");\n\t\treturn info.getDescriptor().getFile().getParentFile();\n\t}\n\n\tprotected boolean canWrite(File testFile) {\n\t\tif (overwrite || !testFile.exists()) {\n\t\t\treturn true;\n\t\t}\n\n\t\ttry {\n\t\t\tString relative = makeRelativeIfPossible(testFile.getAbsolutePath(), basedir);\n\t\t\tString response = GrailsConsole.getInstance().userInput(\n\t\t\t\t\t\"File \" + relative + \" already exists. Overwrite?\", new String[] { \"y\", \"n\", \"a\" });\n\t\t\toverwrite = overwrite || \"a\".equals(response);\n\t\t\treturn overwrite || \"y\".equals(response);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\t// failure to read from standard in means we're probably running from an automation tool like a build server\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tprotected String makeRelativeIfPossible(String fileName, String base) throws IOException {\n\t\tif (StringUtils.hasLength(base)) {\n\t\t\tfileName = StringGroovyMethods.minus(fileName, new File(base).getCanonicalPath());\n\t\t}\n\t\treturn fileName;\n\t}\n\n\tprotected Set getTemplateNames() throws IOException {\n\n\t\tif (resourceLoader != null && grailsApplication.isWarDeployed()) {\n\t\t\ttry {\n\t\t\t\tPathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(resourceLoader);\n\t\t\t\treturn extractNames(resolver.getResources(\"/WEB-INF/templates/scaffolding/*.gsp\"));\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\treturn Collections.emptySet();\n\t\t\t}\n\t\t}\n\n\t\tPathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();\n\t\tSet resources = new HashSet();\n\n\t\tString templatesDirPath = basedir + \"/src/templates/scaffolding\";\n\t\tResource templatesDir = new FileSystemResource(templatesDirPath);\n\t\tif (templatesDir.exists()) {\n\t\t\ttry {\n\t\t\t\tresources.addAll(extractNames(resolver.getResources(\"file:\" + templatesDirPath + \"/*.gsp\")));\n\t\t\t}\n\t\t\tcatch (Exception e) {\n\t\t\t\tlog.error(\"Error while loading views from \" + basedir, e);\n\t\t\t}\n\t\t}\n\n\t\tFile pluginDir = getPluginDir();\n\t\ttry {\n\t\t\tresources.addAll(extractNames(resolver.getResources(\"file:\" + pluginDir + \"/src/templates/scaffolding/*.gsp\")));\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\t// ignore\n\t\t\tlog.error(\"Error locating templates from \" + pluginDir + \": \" + e.getMessage(), e);\n\t\t}\n\n\t\treturn resources;\n\t}\n\n\tprotected Set extractNames(Resource[] resources) {\n\t\tSet names = new HashSet();\n\t\tfor (Resource resource : resources) {\n\t\t\tString name = resource.getFilename();\n\t\t\tnames.add(name.substring(0, name.length() - 4));\n\t\t}\n\t\treturn names;\n\t}\n\n\tpublic void setGrailsApplication(GrailsApplication ga) {\n\t\tgrailsApplication = ga;\n\t\tObject suffix = ga.getFlatConfig().get(\"grails.scaffolding.templates.domainSuffix\");\n\t\tif (suffix instanceof CharSequence) {\n\t\t\tdomainSuffix = suffix.toString();\n\t\t}\n\t}\n\n\tpublic void setResourceLoader(ResourceLoader rl) {\n if(log.isInfoEnabled())\n\t\t log.info(\"Scaffolding template generator set to use resource loader [\"+rl+\"]\");\n\t\tresourceLoader = rl;\n\t}\n\n\tpublic void setPluginManager(GrailsPluginManager gpm) {\n\t\tpluginManager = gpm;\n\t}\n\n\tpublic void setOverwrite(boolean shouldOverwrite) {\n\t\toverwrite = shouldOverwrite;\n\t}\n}\n", "meta": {"content_hash": "8970b7709bd54fcfed5f3a9952916ba2", "timestamp": "", "source": "github", "line_count": 401, "max_line_length": 151, "avg_line_length": 34.53366583541147, "alnum_prop": 0.7154823801270942, "repo_name": "eptresmo/dbMigrationTest", "id": "e723c197e0218138ec76d778e67165fef6866c91", "size": "14445", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "dbMigrationTest/target/work/plugins/scaffolding-2.0.1/src/java/org/codehaus/groovy/grails/scaffolding/AbstractGrailsTemplateGenerator.java", "mode": "33188", "license": "apache-2.0", "language": []}} {"text": "\ufeff// --------------------------------------------------------------------------------------------\r\n// \r\n// Copyright (C) 2011-2014 Effort Team\r\n//\r\n// Permission is hereby granted, free of charge, to any person obtaining a copy\r\n// of this software and associated documentation files (the \"Software\"), to deal\r\n// in the Software without restriction, including without limitation the rights\r\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n// copies of the Software, and to permit persons to whom the Software is\r\n// furnished to do so, subject to the following conditions:\r\n//\r\n// The above copyright notice and this permission notice shall be included in\r\n// all copies or substantial portions of the Software.\r\n//\r\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\n// THE SOFTWARE.\r\n// \r\n// --------------------------------------------------------------------------------------------\r\n\r\nnamespace Effort.Provider\r\n{\r\n using System;\r\n using System.Data;\r\n using System.Data.Common;\r\n#if !EFOLD\r\n using System.Data.Entity.Core.Common;\r\n#endif\r\n\r\n /// \r\n /// Represents a set of methods for creating instances of the \r\n /// provider's implementation of the data source classes.\r\n /// \r\n public class EffortProviderFactory : DbProviderFactory, IServiceProvider\r\n {\r\n /// \r\n /// Provides a singleton instance of the class.\r\n /// \r\n public static readonly EffortProviderFactory Instance = new EffortProviderFactory();\r\n\r\n /// \r\n /// Prevents a default instance of the class\r\n /// from being created.\r\n /// \r\n private EffortProviderFactory()\r\n {\r\n }\r\n\r\n /// \r\n /// Returns a new instance of the class.\r\n /// \r\n /// \r\n /// A new instance of .\r\n /// \r\n public override DbConnection CreateConnection()\r\n {\r\n return new EffortConnection();\r\n }\r\n\r\n /// \r\n /// Gets the service object of the specified type.\r\n /// \r\n /// \r\n /// An object that specifies the type of service object to get.\r\n /// \r\n /// \r\n /// A service object of type .-or- null if there is\r\n /// no service object of type .\r\n /// \r\n public object GetService(Type serviceType)\r\n {\r\n if (serviceType == typeof(DbProviderServices))\r\n {\r\n return EffortProviderServices.Instance;\r\n }\r\n\r\n return null;\r\n }\r\n }\r\n}\r\n", "meta": {"content_hash": "767841cdd80110458b083c02f09c4e70", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 96, "avg_line_length": 42.023809523809526, "alnum_prop": 0.5781869688385269, "repo_name": "wertzui/effort", "id": "62bcbbc5cb1dad86155bd8a97196855269b6d236", "size": "3532", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "Main/Source/Effort/Provider/EffortProviderFactory.cs", "mode": "33188", "license": "mit", "language": [{"name": "Batchfile", "bytes": "1104"}, {"name": "C#", "bytes": "2446943"}]}} {"text": "import { VGrid } from '../v-grid';\nimport { BindingContextInterface, OverrideContextInterface } from '../../interfaces';\nexport declare class VGridAttributesImageFix {\n private vGrid;\n private element;\n private value;\n private bindingContext;\n private overrideContext;\n constructor(element: HTMLImageElement, vGrid: VGrid);\n valueChanged(newValue: string): void;\n bind(bindingContext: BindingContextInterface, overrideContext: OverrideContextInterface): void;\n}\n", "meta": {"content_hash": "288050943bddd389f02d6c1488f7c9da", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 99, "avg_line_length": 40.5, "alnum_prop": 0.7551440329218106, "repo_name": "vegarringdal/vGrid", "id": "7a892151b3f517aeff4464ab7de2c01ac475f8d0", "size": "486", "binary": false, "copies": "4", "ref": "refs/heads/dev-rebuild", "path": "dist/es2015/grid/attributes/v-image.d.ts", "mode": "33188", "license": "mit", "language": [{"name": "CSS", "bytes": "24447"}, {"name": "HTML", "bytes": "19771"}, {"name": "JavaScript", "bytes": "7057"}, {"name": "TypeScript", "bytes": "1639454"}]}} {"text": "layout: page\ntitle: Cliffs Tech Executive Retreat\ndate: 2016-05-24\nauthor: Beverly Snyder\ntags: weekly links, java\nstatus: published\nsummary: Vivamus sed ligula quis mi cursus venenatis sed sed nunc.\nbanner: images/banner/people.jpg\nbooking:\n startDate: 05/29/2018\n endDate: 05/31/2018\n ctyhocn: HSTFLHX\n groupCode: CTER\npublished: true\n---\nMauris id odio eget libero fermentum egestas vel vitae ligula. Suspendisse vestibulum ipsum sem, vel ornare ex lacinia ac. Etiam a sem auctor, dignissim tellus vitae, consequat arcu. Cras rutrum lorem metus, sed lacinia nunc sollicitudin non. Praesent quam mi, aliquet ut lorem at, dictum faucibus ante. Vivamus sit amet ligula vulputate, sollicitudin arcu at, ullamcorper elit. Aenean aliquet molestie tincidunt. Nulla sed lectus diam. Donec gravida enim ut lorem blandit, sed ultricies arcu auctor. Donec odio ante, fringilla id lacus vel, sagittis dignissim elit. Duis mattis turpis tellus, at pulvinar leo commodo at. Etiam in lectus odio. Curabitur ipsum nisi, tincidunt eu ligula ac, cursus pellentesque lacus. Quisque enim sem, tempor non convallis maximus, semper id nisl. Donec eu sapien vel sapien posuere semper. Cras nisi justo, rhoncus ac urna at, cursus scelerisque libero.\n\n1 Proin bibendum tortor at ipsum commodo, vel gravida elit pretium\n1 Phasellus tincidunt lorem vitae elit ultrices, id volutpat mi fermentum\n1 Nunc interdum orci vel lobortis sodales.\n\nPraesent at risus ipsum. Morbi mattis blandit mauris, in fermentum nibh condimentum ut. In mattis risus et diam sagittis euismod. Sed vel dolor id dui dapibus viverra. Praesent efficitur ut quam et auctor. Sed venenatis convallis ex, nec vulputate est tincidunt vitae. In pulvinar faucibus odio, eu viverra tortor pharetra iaculis. Nunc cursus sagittis mauris, at blandit nisi auctor eget. Sed mollis diam eu volutpat pulvinar. In a luctus felis. Integer lobortis purus id lacus porta rutrum. Etiam sit amet lobortis magna. Nulla id libero convallis, luctus lorem ac, fermentum orci. Integer vel maximus sapien, non blandit sapien. Vivamus a tempus purus.\n", "meta": {"content_hash": "43f9f6179677a71fbbce864c5125cf6a", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 887, "avg_line_length": 94.31818181818181, "alnum_prop": 0.8043373493975904, "repo_name": "KlishGroup/prose-pogs", "id": "6f3c04ea1edb8b269359b353872dd5964911f4eb", "size": "2079", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "pogs/H/HSTFLHX/CTER/index.md", "mode": "33188", "license": "mit", "language": []}}