text
stringlengths
2
1.04M
meta
dict
NSString *RELPathForDocument(NSString *name, NSString *type); @class ReadingList; @interface ReadingListStore : NSObject + (instancetype)storeWithName:(NSString *)storeName; - (instancetype)initWithStoreName:(NSString *)storeName; - (ReadingList *)fetchedReadingList; - (void)saveReadingList:(ReadingList *)readingList; @end
{ "content_hash": "c012963a98c0f9112a359d140831b8b4", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 61, "avg_line_length": 25.384615384615383, "alnum_prop": 0.7878787878787878, "repo_name": "AboutObjectsTraining/ios-objc-comp-reston-2016-08", "id": "ffd15a96aaeeee9a349aefa4c518e4e61967553b", "size": "365", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Demos/ReadingList/ReadingListModel/ReadingListStore.h", "mode": "33261", "license": "mit", "language": [ { "name": "C", "bytes": "10343" }, { "name": "C++", "bytes": "799" }, { "name": "Objective-C", "bytes": "37505" } ], "symlink_target": "" }
from decimal import Decimal class Order(object): last_id = -1 @classmethod def new_id(cls): cls.last_id = cls.last_id + 1 return cls.last_id def __init__(self, ins, buysell, quantity, stop_loss, take_profit, issue_date, expiry_date = None, trader_id = None, target_price = None, target_floor = None, target_ceiling = None ): ''' ''' self.id = Order.new_id() self.trader_id = trader_id self.ins = ins self.buysell = buysell self.quantity = quantity self.stop_loss = stop_loss self.take_profit = take_profit self.issue_date = issue_date self.expiry_date = expiry_date self.leverage = Decimal(1) self.target_price = target_price self.target_floor = target_floor self.target_ceiling = target_ceiling def __unicode__(self): return (ins + ' - ' + buysell + ' - ' + quantity) def __str__(self): return (ins + ' - ' + buysell + ' - ' + quantity)
{ "content_hash": "c6ed1b2884413d372722a8cb42b751e0", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 53, "avg_line_length": 20.58, "alnum_prop": 0.5636540330417882, "repo_name": "davidbarkhuizen/simagora", "id": "0057b543ed76a422e325ffa3999d6d0e8d61f411", "size": "1029", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "order.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "43388" } ], "symlink_target": "" }
package io.appium.java_client.appium.element.generation.ios; import static io.appium.java_client.MobileBy.AccessibilityId; import static org.junit.Assert.assertTrue; import static org.openqa.selenium.By.id; import static org.openqa.selenium.By.name; import static org.openqa.selenium.By.partialLinkText; import io.appium.java_client.appium.element.generation.BaseElementGenerationTest; import io.appium.java_client.ios.IOSElement; import io.appium.java_client.remote.IOSMobileCapabilityType; import io.appium.java_client.remote.MobileBrowserType; import io.appium.java_client.remote.MobileCapabilityType; import io.appium.java_client.remote.MobilePlatform; import org.junit.Ignore; import org.junit.Test; import org.openqa.selenium.Capabilities; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.io.File; import java.util.function.Function; import java.util.function.Supplier; public class IOSElementGenerationTest extends BaseElementGenerationTest { private final File testApp = new File(new File("src/test/java/io/appium/java_client"), "TestApp.app.zip"); private final File webViewApp = new File(new File("src/test/java/io/appium/java_client"), "vodqa.zip"); private Supplier<DesiredCapabilities> serverAppCapabilitiesSupplier = () -> { DesiredCapabilities serverCapabilities = new DesiredCapabilities(); serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8"); serverCapabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000); //some environment is too slow serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.3"); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS); return serverCapabilities; }; private Function<File, Supplier<Capabilities>> appFileSupplierFunction = file -> { final DesiredCapabilities clientCapabilities = new DesiredCapabilities(); return () -> { clientCapabilities.setCapability(MobileCapabilityType.APP, file.getAbsolutePath()); return clientCapabilities; }; }; private final Supplier<DesiredCapabilities> serverBrowserCapabilitiesSupplier = () -> { DesiredCapabilities serverCapabilities = new DesiredCapabilities(); serverCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, MobileBrowserType.SAFARI); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.3"); serverCapabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8"); //sometimes environment has performance problems serverCapabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000); return serverCapabilities; }; private final Supplier<Capabilities> clientBrowserCapabilitiesSupplier = () -> { DesiredCapabilities clientCapabilities = new DesiredCapabilities(); clientCapabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS); return clientCapabilities; }; @Test public void whenIOSNativeAppIsLaunched() { assertTrue(check(serverAppCapabilitiesSupplier, appFileSupplierFunction.apply(testApp), commonPredicate, AccessibilityId("Answer"), IOSElement.class)); } @Ignore @Test public void whenIOSHybridAppIsLaunched() { assertTrue(check(serverAppCapabilitiesSupplier, appFileSupplierFunction.apply(webViewApp), (by, aClass) -> { new WebDriverWait(driver, 30) .until(ExpectedConditions.presenceOfElementLocated(id("login"))) .click(); driver.findElementByAccessibilityId("webView").click(); new WebDriverWait(driver, 30) .until(ExpectedConditions .presenceOfElementLocated(AccessibilityId("Webview"))); try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } driver.getContextHandles().forEach((handle) -> { if (handle.contains("WEBVIEW")) { driver.context(handle); } }); return commonPredicate.test(by, aClass); }, partialLinkText("login"), IOSElement.class)); } @Test public void whenIOSBrowserIsLaunched() { assertTrue(check(serverBrowserCapabilitiesSupplier, clientBrowserCapabilitiesSupplier, (by, aClass) -> { driver.get("https://www.google.com"); return commonPredicate.test(by, aClass); }, name("q"), IOSElement.class)); } @Test public void whenIOSNativeAppIsLaunched2() { assertTrue(check(() -> { DesiredCapabilities serverCapabilities = serverAppCapabilitiesSupplier.get(); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.3"); return serverCapabilities; }, appFileSupplierFunction.apply(testApp), commonPredicate, id("IntegerA"), IOSElement.class)); } @Test public void whenIOSBrowserIsLaunched2() { assertTrue(check(() -> { DesiredCapabilities serverCapabilities = serverBrowserCapabilitiesSupplier.get(); serverCapabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "11.3"); return serverCapabilities; }, clientBrowserCapabilitiesSupplier, (by, aClass) -> { driver.get("https://www.google.com"); return commonPredicate.test(by, aClass); }, name("q"), IOSElement.class)); } }
{ "content_hash": "e77508368761893d333d42294b49d67b", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 103, "avg_line_length": 45.89230769230769, "alnum_prop": 0.6803553469661414, "repo_name": "saikrishna321/java-client", "id": "2e5dd944b13d470ae2bb031497316a35b41f3953", "size": "5966", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/io/appium/java_client/appium/element/generation/ios/IOSElementGenerationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "80758" }, { "name": "Java", "bytes": "1259315" }, { "name": "JavaScript", "bytes": "30" }, { "name": "Shell", "bytes": "54" } ], "symlink_target": "" }
////////////////////////////////////////////////////////////////////////////// // // Copyright 2020, Cornutum Project // www.cornutum.org // ////////////////////////////////////////////////////////////////////////////// package org.cornutum.tcases.openapi.resolver; import org.cornutum.tcases.openapi.Characters; /** * Defines a singleton email string value set. */ public class EmailConstant extends StringConstant { /** * Creates a new EmailConstant instance. */ public EmailConstant( String value) { this( value, Characters.ASCII); } /** * Creates a new EmailConstant instance. */ public EmailConstant( String value, Characters chars) { super( assertEmail( value), chars); } /** * Returns a {@link DataValue} for the given value in this domain. */ @Override protected DataValue<String> dataValueOf( String value) { return new EmailValue( value); } /** * Reports a failure if the given value is not a valid email string. Otherwise, return the given value. */ public static String assertEmail( String value) { if( !EmailDomain.isEmail( value)) { throw new ValueDomainException( String.format( "Value=%s is not a valid email", value)); } return value; } }
{ "content_hash": "9fde1dc8a596b32eab6893ca127d580d", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 105, "avg_line_length": 24.64814814814815, "alnum_prop": 0.5567242674680691, "repo_name": "Cornutum/tcases", "id": "48107de06d7c72820b7bd5b2ab7d8121e236434e", "size": "1331", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tcases-openapi/src/main/java/org/cornutum/tcases/openapi/resolver/EmailConstant.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "6075" }, { "name": "CSS", "bytes": "3876" }, { "name": "HTML", "bytes": "245900" }, { "name": "Java", "bytes": "5847298" }, { "name": "JavaScript", "bytes": "2968" }, { "name": "XSLT", "bytes": "89741" } ], "symlink_target": "" }
require 'faker' FactoryGirl.define do factory :package do name Faker::App.name section Faker::Lorem.word homepage Faker::Internet.url summary Faker::Lorem.paragraph end end
{ "content_hash": "4f26f30ad871dbadee94aace8ee7d6f8", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 34, "avg_line_length": 19.4, "alnum_prop": 0.7216494845360825, "repo_name": "upd89/controlcenter", "id": "7694f4e0000fe0e74066408bdd2cb48cddd5c4bf", "size": "194", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/factories/packages.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "70818" }, { "name": "CoffeeScript", "bytes": "4914" }, { "name": "HTML", "bytes": "114237" }, { "name": "JavaScript", "bytes": "49779" }, { "name": "Ruby", "bytes": "175815" } ], "symlink_target": "" }
<h2>Edit My Ride</h2> <h3>Here is where you can make changes.</h3> <form> <div class="form-group"> <label>Date</label> <!-- TODO: Hook up this form to our JS for submitting --> <input type="text" class="form-control" placeholder="" ng-model="editRide.start_datetime | date"/> </div> <div class="form-group"> <label>Title</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.name"/> </div> <div class="form-group"> <label>Source</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.source"/> </div> <div class="form-group"> <label>Distance in km</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.distance_total | distance"/> </div> <div class="form-group"> <label>Distance in miles</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.distance_total | miles"/> </div> <div class="form-group"> <label>Elapsed time in minutes</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.active_time_total | minutes"/> </div> <div class="form-group"> <label>Avg Heart Rate</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.heartrate_avg"/> </div> <div class="form-group"> <label>Max Heart Rate</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.heartrate_max"/> </div> <div class="form-group"> <label>Calories burned</label> <input type="text" class="form-control" placeholder="" ng-model="editRide.aggregates.metabolic_energy_total | calories"/> </div> <!-- TODO: bind this button to a function --> <button class="btn btn-default" ng-click="editItem(editRide)">Edit</button> </form>
{ "content_hash": "7d4d4a8f9749da66c7e22f99a23f874b", "timestamp": "", "source": "github", "line_count": 55, "max_line_length": 125, "avg_line_length": 33.945454545454545, "alnum_prop": 0.6657739689341189, "repo_name": "wierje/c17-capstone", "id": "b27f06cee342e5b319c08cb481bd95c4396e333d", "size": "1867", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "partials/ride-edit.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "165" }, { "name": "HTML", "bytes": "9704" }, { "name": "JavaScript", "bytes": "12357" } ], "symlink_target": "" }
#include <pthread.h> #include <unistd.h> #include <stdlib.h> #include <assert.h> static const char *image; static pthread_barrier_t barrier; static char *argv1 = "go away"; static void * thread_execler (void *arg) { int i; pthread_barrier_wait (&barrier); /* Exec ourselves again. */ if (execl (image, image, argv1, NULL) == -1) /* break-here */ { perror ("execl"); abort (); } return NULL; } static void * just_loop (void *arg) { unsigned int i; pthread_barrier_wait (&barrier); for (i = 1; i > 0; i++) usleep (1); return NULL; } #define THREADS 5 pthread_t loop_thread[THREADS]; int main (int argc, char **argv) { pthread_t thread; int i, t; image = argv[0]; /* Pass "inf" as argument to keep re-execing ad infinitum, which can be useful for manual testing. Passing any other argument exits immediately (and that's what the execl above does by default). */ if (argc == 2 && strcmp (argv[1], "inf") == 0) argv1 = argv[1]; else if (argc > 1) exit (0); pthread_barrier_init (&barrier, NULL, 2 + THREADS); i = pthread_create (&thread, NULL, thread_execler, NULL); assert (i == 0); for (t = 0; t < THREADS; t++) { i = pthread_create (&loop_thread[t], NULL, just_loop, NULL); assert (i == 0); } pthread_barrier_wait (&barrier); pthread_join (thread, NULL); return 0; }
{ "content_hash": "fb1e20c6fd1f56228ddde33ab676e915", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 70, "avg_line_length": 18.16883116883117, "alnum_prop": 0.6032880629020729, "repo_name": "execunix/vinos", "id": "d38a1781d7306d265785fb8dec5aedc0b2ebd4a6", "size": "2151", "binary": false, "copies": "41", "ref": "refs/heads/master", "path": "external/gpl3/gdb/dist/gdb/testsuite/gdb.threads/non-ldr-exc-4.c", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
<div class="navbar-spacer"></div> <nav class="navbar"> <div class="container"> <ul class="navbar-list"> <li class="navbar-item"> <a class="navbar-link smooth" href="#" data-popover="#Services" >Services</a > <div id="Services" class="popover"> <ul class="popover-list"> {% for service in site.translations[site.lang].services %} <li class="popover-item"> <a class="popover-link smooth" href="#{{ service.id }}"> {{ service.title }} </a> </li> {% endfor %} </ul> </div> </li> <li class="navbar-item"> <a class="navbar-link smooth" href="#" data-popover="#Works">Works</a> <div id="Works" class="popover"> <ul class="popover-list"> {% for work in site.translations[site.lang].works %} <li class="popover-item"> <a class="popover-link smooth" href="#{{ work.id }}"> {{ work.title }} </a> </li> {% endfor %} </ul> </div> </li> <li class="navbar-item"> <a class="navbar-link smooth" href="#contact">Contact</a> </li> <li class="navbar-item"> <a class="navbar-link smooth" href="#about">About</a> </li> </ul> </div> </nav>
{ "content_hash": "a535ded78b1af27aca00f2b7d52aac9f", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 78, "avg_line_length": 32.16279069767442, "alnum_prop": 0.47288503253796094, "repo_name": "nerdyfactory/nerdyfactory.github.io", "id": "ab425363d46b309220545bfb0917cf87907c0b28", "size": "1383", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_includes/navi.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "3226" }, { "name": "HTML", "bytes": "16221" }, { "name": "JavaScript", "bytes": "1951" }, { "name": "Ruby", "bytes": "7291" } ], "symlink_target": "" }
# SocialAlloy This repository contains a clone of the Episerver Alloy sample application, which has been extended to demonstrate the features of Episerver Social. The goals for this project are twofold: * To provide a simple application demonstrating Episerver Social features and capabilities * To provide developers looking to get started with Episerver Social with a helpful point of reference ## Getting Started An Episerver Social account is required to run this application. If you do not have an Episerver Social account, please contact your Episerver account manager. ### Setup * Run the setup script with Powershell: `.\src\Scripts\Setup.ps1` * This script will copy the site's database and assets into the appropriate locations. * Open the SocialAlloy.sln in Visual Studio * Open the web.config and update the `episerver.social` configuration section with your account information. * For more information on how to configure Episerver Social, [please visit our Getting Connected guide](http://world.episerver.com/documentation/developer-guides/social/social_platform-overview/Installing-Episerver-Social/#GettingConnected). ### Running the Application * Build the application in Visual Studio 2015 * This operation will restore the necessary NuGet packages dependencies. * Launch the application from Visual Studio 2015 * With debugging (F5) * Without debugging (CTRL+F5) ## What's Inside? ### Blocks Many of the Social features demonstrated in this application are implemented using Episerver blocks. Episerver blocks are available for the following Episerver Social features: #### Comments The **CommentBlock** allows visitors to contribute comments to the page on which it resides. (A visitor may contribute comments anonymously or as a logged in user.) The block will display the most recent comments that have been contributed for that page. The maximum number of items displayed by the block are configurable via the CommentDisplayMax property of the block (default = 20). If the **CommentBlock** is configured to send activities (which is the default behavior), it will publish an activity to the Social Activity Streams system when a comment is contributed to the page. A record of this activity will appear in the activity feed of user's that have subscribed to the page. (See "Activity Streams" below for more information.) #### Ratings The **RatingBlock** allows a logged in user to rate the page on which it resides. (A user may only rate the page once.) The block also displays the accumulated rating statistics for the page. If the **RatingBlock** is configured to send activities (which is the default behavior), it will publish an activity to the Social Activity Streams system when a rating is submitted by the logged in user. A record of this activity will appear in the activity feed of user's that have subscribed to the page. (See "Activity Streams" below for more information.) #### Groups The **GroupCreationBlock** allows a user to create a new group. A group creator can optionally require that new members are moderated before being allowed to join the group. The **GroupAdmissionBlock** allows users to require membership into a specific group. The block is configured by specifying the name of the group to which it applies. If the associated group is not configured for moderation, a user submitting a request will be added to the group. If the associated group has been configured for moderation, membership requests will be entered into a workflow for review. (To view requests under moderation, see "Moderation UI" below for more information.) The **MembershipDisplayBlock** allows users to see the members that have joined a group. The block is configured by specifying the name of the group to which it applies. If the associated group has been configured for membership moderation only approved member requests will be displayed in the block. (To view requests that are pending approval, see "Moderation UI" below for more information.) The **Moderation UI** allows a user to moderate requests to join a group. The page can be found by navigating to the following page within the site: http://*host*:*port*/Moderation. From this page, a user can select a group, which has been configured for moderation, and view the membership requests that have been submitted for it. The user is presented with actions that allow them to move that request through the workflow. If a request is approved, the requesting user will be added as a member of the group. #### Activity Streams The **SubscriptionBlock** allows a logged in user to subscribe to and unsubscribe from the page on which it resides. A user will accumulate a feed of activities from the pages to which they are subscribed. (See "FeedBlock" below for information on displaying a feed.) When a user unsubscribes from a page, activities generated by that page will no longer be added to the user's feed. The **FeedBlock** displays a record of activities occurring on pages to which the currently logged in user is subscribed. The block will display feed items representing the most recent activities that have occurred. The maximum number of items displayed by the block are configurable via the FeedDisplayMax property of the block (default = 20). #### Block Configuration To configure an Episerver Social feature block in a page do the following: * Login to the SocialAlloy CMS edit panel * Create a new block and select the "**&lt;feature&gt;** Block" * Tweak any configuration in the block properties * Publish the block * Go to the page where the block functionality is desired * Add/drag the block anywhere in the page * Publish the modified page * Viewing the page in the frontend should allow the use of that block's social feature For implementation details of each of the Episerver Social blocks see the [source code](https://github.com/episerver/SocialAlloy/tree/master/src/EPiServer.SocialAlloy.Web/Social). ### Pages #### Reseller Community Page The **CommunityPage** represents a digital community which can be created for resellers of the Alloy platform. The page allows members of the reseller team to join the community. Site visitors can also comment on and rate the community page. Site users may subscribe to their favorite reseller communities and monitor a feed of activities from their personal profile. ## Developer Reference Developers looking to get started with Episerver Social will find the [repository implementations](https://github.com/episerver/SocialAlloy/tree/master/src/EPiServer.SocialAlloy.Web/Social/Repositories) as the primary point of interaction between the application and the Episerver Social framework. ## Disclaimer This website was assembled to serve as a demonstration and has not been tested for production use. ## More Information For detailed information on how to implement social content solutions with Episerver Social, [please visit Episerver World](http://world.episerver.com/documentation/developer-guides/social/). ## Forum Have questions, feature requests, or implementations that you'd like to share? Join the community on the [Episerver developer forum](http://world.episerver.com/forum/developer-forum/episerver-social/). ## Issues If you encounter a problem, please [open a new issue](https://github.com/episerver/SocialAlloy/issues/new). ## Contributions Please see our [contributing guidelines](https://github.com/episerver/SocialAlloy/blob/master/CONTRIBUTING).
{ "content_hash": "36f205a415c884c96075933cd852f3f2", "timestamp": "", "source": "github", "line_count": 89, "max_line_length": 513, "avg_line_length": 83.89887640449439, "alnum_prop": 0.7976429623677515, "repo_name": "episerver/SocialAlloy", "id": "67a0b93b8421b0eb5980b53eb23ae0aca2b91e4d", "size": "7467", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ASP", "bytes": "121" }, { "name": "C#", "bytes": "432930" }, { "name": "CSS", "bytes": "14178" }, { "name": "HTML", "bytes": "402" }, { "name": "JavaScript", "bytes": "4150" }, { "name": "PowerShell", "bytes": "339" } ], "symlink_target": "" }
import os import re import sys import copy import zlib import time import shlex import shutil import fnmatch import tarfile import argparse import platform import datetime import tempfile import posixpath import subprocess from build.common import * from build.config import * from build.build import * pythonExecutable = sys.executable or "python" def die (msg): print msg sys.exit(-1) def removeLeadingPath (path, basePath): # Both inputs must be normalized already assert os.path.normpath(path) == path assert os.path.normpath(basePath) == basePath return path[len(basePath) + 1:] def findFile (candidates): for file in candidates: if os.path.exists(file): return file return None def getFileList (basePath): allFiles = [] basePath = os.path.normpath(basePath) for root, dirs, files in os.walk(basePath): for file in files: relPath = removeLeadingPath(os.path.normpath(os.path.join(root, file)), basePath) allFiles.append(relPath) return allFiles def toDatetime (dateTuple): Y, M, D = dateTuple return datetime.datetime(Y, M, D) class PackageBuildInfo: def __init__ (self, releaseConfig, srcBasePath, dstBasePath, tmpBasePath): self.releaseConfig = releaseConfig self.srcBasePath = srcBasePath self.dstBasePath = dstBasePath self.tmpBasePath = tmpBasePath def getReleaseConfig (self): return self.releaseConfig def getReleaseVersion (self): return self.releaseConfig.getVersion() def getReleaseId (self): # Release id is crc32(releaseConfig + release) return zlib.crc32(self.releaseConfig.getName() + self.releaseConfig.getVersion()) & 0xffffffff def getSrcBasePath (self): return self.srcBasePath def getTmpBasePath (self): return self.tmpBasePath class DstFile (object): def __init__ (self, dstFile): self.dstFile = dstFile def makeDir (self): dirName = os.path.dirname(self.dstFile) if not os.path.exists(dirName): os.makedirs(dirName) def make (self, packageBuildInfo): assert False # Should not be called class CopyFile (DstFile): def __init__ (self, srcFile, dstFile): super(CopyFile, self).__init__(dstFile) self.srcFile = srcFile def make (self, packageBuildInfo): self.makeDir() if os.path.exists(self.dstFile): die("%s already exists" % self.dstFile) shutil.copyfile(self.srcFile, self.dstFile) class GenReleaseInfoFileTarget (DstFile): def __init__ (self, dstFile): super(GenReleaseInfoFileTarget, self).__init__(dstFile) def make (self, packageBuildInfo): self.makeDir() scriptPath = os.path.normpath(os.path.join(packageBuildInfo.srcBasePath, "framework", "qphelper", "gen_release_info.py")) execute([ pythonExecutable, "-B", # no .py[co] scriptPath, "--name=%s" % packageBuildInfo.getReleaseVersion(), "--id=0x%08x" % packageBuildInfo.getReleaseId(), "--out=%s" % self.dstFile ]) class GenCMake (DstFile): def __init__ (self, srcFile, dstFile, replaceVars): super(GenCMake, self).__init__(dstFile) self.srcFile = srcFile self.replaceVars = replaceVars def make (self, packageBuildInfo): self.makeDir() print " GenCMake: %s" % removeLeadingPath(self.dstFile, packageBuildInfo.dstBasePath) src = readFile(self.srcFile) for var, value in self.replaceVars: src = re.sub('set\(%s\s+"[^"]*"' % re.escape(var), 'set(%s "%s"' % (var, value), src) writeFile(self.dstFile, src) def createFileTargets (srcBasePath, dstBasePath, files, filters): usedFiles = set() # Files that are already included by other filters targets = [] for isMatch, createFileObj in filters: # Build list of files that match filter matchingFiles = [] for file in files: if not file in usedFiles and isMatch(file): matchingFiles.append(file) # Build file objects, add to used set for file in matchingFiles: usedFiles.add(file) targets.append(createFileObj(os.path.join(srcBasePath, file), os.path.join(dstBasePath, file))) return targets # Generates multiple file targets based on filters class FileTargetGroup: def __init__ (self, srcBasePath, dstBasePath, filters, srcBasePathFunc=PackageBuildInfo.getSrcBasePath): self.srcBasePath = srcBasePath self.dstBasePath = dstBasePath self.filters = filters self.getSrcBasePath = srcBasePathFunc def make (self, packageBuildInfo): fullSrcPath = os.path.normpath(os.path.join(self.getSrcBasePath(packageBuildInfo), self.srcBasePath)) fullDstPath = os.path.normpath(os.path.join(packageBuildInfo.dstBasePath, self.dstBasePath)) allFiles = getFileList(fullSrcPath) targets = createFileTargets(fullSrcPath, fullDstPath, allFiles, self.filters) # Make all file targets for file in targets: file.make(packageBuildInfo) # Single file target class SingleFileTarget: def __init__ (self, srcFile, dstFile, makeTarget): self.srcFile = srcFile self.dstFile = dstFile self.makeTarget = makeTarget def make (self, packageBuildInfo): fullSrcPath = os.path.normpath(os.path.join(packageBuildInfo.srcBasePath, self.srcFile)) fullDstPath = os.path.normpath(os.path.join(packageBuildInfo.dstBasePath, self.dstFile)) target = self.makeTarget(fullSrcPath, fullDstPath) target.make(packageBuildInfo) class BuildTarget: def __init__ (self, baseConfig, generator, targets = None): self.baseConfig = baseConfig self.generator = generator self.targets = targets def make (self, packageBuildInfo): print " Building %s" % self.baseConfig.getBuildDir() # Create config with full build dir path config = BuildConfig(os.path.join(packageBuildInfo.getTmpBasePath(), self.baseConfig.getBuildDir()), self.baseConfig.getBuildType(), self.baseConfig.getArgs(), srcPath = os.path.join(packageBuildInfo.dstBasePath, "src")) assert not os.path.exists(config.getBuildDir()) build(config, self.generator, self.targets) class BuildAndroidTarget: def __init__ (self, dstFile): self.dstFile = dstFile def make (self, packageBuildInfo): print " Building Android binary" buildRoot = os.path.join(packageBuildInfo.tmpBasePath, "android-build") assert not os.path.exists(buildRoot) os.makedirs(buildRoot) # Execute build script scriptPath = os.path.normpath(os.path.join(packageBuildInfo.dstBasePath, "src", "android", "scripts", "build.py")) execute([ pythonExecutable, "-B", # no .py[co] scriptPath, "--build-root=%s" % buildRoot, ]) srcFile = os.path.normpath(os.path.join(buildRoot, "package", "bin", "dEQP-debug.apk")) dstFile = os.path.normpath(os.path.join(packageBuildInfo.dstBasePath, self.dstFile)) CopyFile(srcFile, dstFile).make(packageBuildInfo) class FetchExternalSourcesTarget: def __init__ (self): pass def make (self, packageBuildInfo): scriptPath = os.path.normpath(os.path.join(packageBuildInfo.dstBasePath, "src", "external", "fetch_sources.py")) execute([ pythonExecutable, "-B", # no .py[co] scriptPath, ]) class RemoveSourcesTarget: def __init__ (self): pass def make (self, packageBuildInfo): shutil.rmtree(os.path.join(packageBuildInfo.dstBasePath, "src"), ignore_errors=False) class Module: def __init__ (self, name, targets): self.name = name self.targets = targets def make (self, packageBuildInfo): for target in self.targets: target.make(packageBuildInfo) class ReleaseConfig: def __init__ (self, name, version, modules, sources = True): self.name = name self.version = version self.modules = modules self.sources = sources def getName (self): return self.name def getVersion (self): return self.version def getModules (self): return self.modules def packageWithSources (self): return self.sources def matchIncludeExclude (includePatterns, excludePatterns, filename): components = os.path.normpath(filename).split(os.sep) for pattern in excludePatterns: for component in components: if fnmatch.fnmatch(component, pattern): return False for pattern in includePatterns: for component in components: if fnmatch.fnmatch(component, pattern): return True return False def copyFileFilter (includePatterns, excludePatterns=[]): return (lambda f: matchIncludeExclude(includePatterns, excludePatterns, f), lambda s, d: CopyFile(s, d)) def makeFileCopyGroup (srcDir, dstDir, includePatterns, excludePatterns=[]): return FileTargetGroup(srcDir, dstDir, [copyFileFilter(includePatterns, excludePatterns)]) def makeTmpFileCopyGroup (srcDir, dstDir, includePatterns, excludePatterns=[]): return FileTargetGroup(srcDir, dstDir, [copyFileFilter(includePatterns, excludePatterns)], PackageBuildInfo.getTmpBasePath) def makeFileCopy (srcFile, dstFile): return SingleFileTarget(srcFile, dstFile, lambda s, d: CopyFile(s, d)) def getReleaseFileName (configName, releaseName): today = datetime.date.today() return "dEQP-%s-%04d-%02d-%02d-%s" % (releaseName, today.year, today.month, today.day, configName) def getTempDir (): dirName = os.path.join(tempfile.gettempdir(), "dEQP-Releases") if not os.path.exists(dirName): os.makedirs(dirName) return dirName def makeRelease (releaseConfig): releaseName = getReleaseFileName(releaseConfig.getName(), releaseConfig.getVersion()) tmpPath = getTempDir() srcBasePath = DEQP_DIR dstBasePath = os.path.join(tmpPath, releaseName) tmpBasePath = os.path.join(tmpPath, releaseName + "-tmp") packageBuildInfo = PackageBuildInfo(releaseConfig, srcBasePath, dstBasePath, tmpBasePath) dstArchiveName = releaseName + ".tar.bz2" print "Creating release %s to %s" % (releaseName, tmpPath) # Remove old temporary dirs for path in [dstBasePath, tmpBasePath]: if os.path.exists(path): shutil.rmtree(path, ignore_errors=False) # Make all modules for module in releaseConfig.getModules(): print " Processing module %s" % module.name module.make(packageBuildInfo) # Remove sources? if not releaseConfig.packageWithSources(): shutil.rmtree(os.path.join(dstBasePath, "src"), ignore_errors=False) # Create archive print "Creating %s" % dstArchiveName archive = tarfile.open(dstArchiveName, 'w:bz2') archive.add(dstBasePath, arcname=releaseName) archive.close() # Remove tmp dirs for path in [dstBasePath, tmpBasePath]: if os.path.exists(path): shutil.rmtree(path, ignore_errors=False) print "Done!" # Module declarations SRC_FILE_PATTERNS = ["*.h", "*.hpp", "*.c", "*.cpp", "*.m", "*.mm", "*.inl", "*.java", "*.aidl", "CMakeLists.txt", "LICENSE.txt", "*.cmake"] TARGET_PATTERNS = ["*.cmake", "*.h", "*.lib", "*.dll", "*.so", "*.txt"] BASE = Module("Base", [ makeFileCopy ("LICENSE", "src/LICENSE"), makeFileCopy ("CMakeLists.txt", "src/CMakeLists.txt"), makeFileCopyGroup ("targets", "src/targets", TARGET_PATTERNS), makeFileCopyGroup ("execserver", "src/execserver", SRC_FILE_PATTERNS), makeFileCopyGroup ("executor", "src/executor", SRC_FILE_PATTERNS), makeFileCopy ("modules/CMakeLists.txt", "src/modules/CMakeLists.txt"), makeFileCopyGroup ("external", "src/external", ["CMakeLists.txt", "*.py"]), # Stylesheet for displaying test logs on browser makeFileCopyGroup ("doc/testlog-stylesheet", "doc/testlog-stylesheet", ["*"]), # Non-optional parts of framework makeFileCopy ("framework/CMakeLists.txt", "src/framework/CMakeLists.txt"), makeFileCopyGroup ("framework/delibs", "src/framework/delibs", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/common", "src/framework/common", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/qphelper", "src/framework/qphelper", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/platform", "src/framework/platform", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/opengl", "src/framework/opengl", SRC_FILE_PATTERNS, ["simplereference"]), makeFileCopyGroup ("framework/egl", "src/framework/egl", SRC_FILE_PATTERNS), # android sources makeFileCopyGroup ("android/package/src", "src/android/package/src", SRC_FILE_PATTERNS), makeFileCopy ("android/package/AndroidManifest.xml", "src/android/package/AndroidManifest.xml"), makeFileCopyGroup ("android/package/res", "src/android/package/res", ["*.png", "*.xml"]), makeFileCopyGroup ("android/scripts", "src/android/scripts", [ "common.py", "build.py", "resources.py", "install.py", "launch.py", "debug.py" ]), # Release info GenReleaseInfoFileTarget("src/framework/qphelper/qpReleaseInfo.inl") ]) DOCUMENTATION = Module("Documentation", [ makeFileCopyGroup ("doc/pdf", "doc", ["*.pdf"]), makeFileCopyGroup ("doc", "doc", ["porting_layer_changes_*.txt"]), ]) GLSHARED = Module("Shared GL Tests", [ # Optional framework components makeFileCopyGroup ("framework/randomshaders", "src/framework/randomshaders", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/opengl/simplereference", "src/framework/opengl/simplereference", SRC_FILE_PATTERNS), makeFileCopyGroup ("framework/referencerenderer", "src/framework/referencerenderer", SRC_FILE_PATTERNS), makeFileCopyGroup ("modules/glshared", "src/modules/glshared", SRC_FILE_PATTERNS), ]) GLES2 = Module("GLES2", [ makeFileCopyGroup ("modules/gles2", "src/modules/gles2", SRC_FILE_PATTERNS), makeFileCopyGroup ("data/gles2", "src/data/gles2", ["*.*"]), makeFileCopyGroup ("doc/testspecs/GLES2", "doc/testspecs/GLES2", ["*.txt"]) ]) GLES3 = Module("GLES3", [ makeFileCopyGroup ("modules/gles3", "src/modules/gles3", SRC_FILE_PATTERNS), makeFileCopyGroup ("data/gles3", "src/data/gles3", ["*.*"]), makeFileCopyGroup ("doc/testspecs/GLES3", "doc/testspecs/GLES3", ["*.txt"]) ]) GLES31 = Module("GLES31", [ makeFileCopyGroup ("modules/gles31", "src/modules/gles31", SRC_FILE_PATTERNS), makeFileCopyGroup ("data/gles31", "src/data/gles31", ["*.*"]), makeFileCopyGroup ("doc/testspecs/GLES31", "doc/testspecs/GLES31", ["*.txt"]) ]) EGL = Module("EGL", [ makeFileCopyGroup ("modules/egl", "src/modules/egl", SRC_FILE_PATTERNS) ]) INTERNAL = Module("Internal", [ makeFileCopyGroup ("modules/internal", "src/modules/internal", SRC_FILE_PATTERNS), makeFileCopyGroup ("data/internal", "src/data/internal", ["*.*"]), ]) EXTERNAL_SRCS = Module("External sources", [ FetchExternalSourcesTarget() ]) ANDROID_BINARIES = Module("Android Binaries", [ BuildAndroidTarget ("bin/android/dEQP.apk"), makeFileCopyGroup ("targets/android", "bin/android", ["*.bat", "*.sh"]), ]) COMMON_BUILD_ARGS = ['-DPNG_SRC_PATH=%s' % os.path.realpath(os.path.join(DEQP_DIR, '..', 'libpng'))] NULL_X32_CONFIG = BuildConfig('null-x32', 'Release', ['-DDEQP_TARGET=null', '-DCMAKE_C_FLAGS=-m32', '-DCMAKE_CXX_FLAGS=-m32'] + COMMON_BUILD_ARGS) NULL_X64_CONFIG = BuildConfig('null-x64', 'Release', ['-DDEQP_TARGET=null', '-DCMAKE_C_FLAGS=-m64', '-DCMAKE_CXX_FLAGS=-m64'] + COMMON_BUILD_ARGS) GLX_X32_CONFIG = BuildConfig('glx-x32', 'Release', ['-DDEQP_TARGET=x11_glx', '-DCMAKE_C_FLAGS=-m32', '-DCMAKE_CXX_FLAGS=-m32'] + COMMON_BUILD_ARGS) GLX_X64_CONFIG = BuildConfig('glx-x64', 'Release', ['-DDEQP_TARGET=x11_glx', '-DCMAKE_C_FLAGS=-m64', '-DCMAKE_CXX_FLAGS=-m64'] + COMMON_BUILD_ARGS) EXCLUDE_BUILD_FILES = ["CMakeFiles", "*.a", "*.cmake"] LINUX_X32_COMMON_BINARIES = Module("Linux x32 Common Binaries", [ BuildTarget (NULL_X32_CONFIG, ANY_UNIX_GENERATOR), makeTmpFileCopyGroup(NULL_X32_CONFIG.getBuildDir() + "/execserver", "bin/linux32", ["*"], EXCLUDE_BUILD_FILES), makeTmpFileCopyGroup(NULL_X32_CONFIG.getBuildDir() + "/executor", "bin/linux32", ["*"], EXCLUDE_BUILD_FILES), ]) LINUX_X64_COMMON_BINARIES = Module("Linux x64 Common Binaries", [ BuildTarget (NULL_X64_CONFIG, ANY_UNIX_GENERATOR), makeTmpFileCopyGroup(NULL_X64_CONFIG.getBuildDir() + "/execserver", "bin/linux64", ["*"], EXCLUDE_BUILD_FILES), makeTmpFileCopyGroup(NULL_X64_CONFIG.getBuildDir() + "/executor", "bin/linux64", ["*"], EXCLUDE_BUILD_FILES), ]) # Special module to remove src dir, for example after binary build REMOVE_SOURCES = Module("Remove sources from package", [ RemoveSourcesTarget() ]) # Release configuration ALL_MODULES = [ BASE, DOCUMENTATION, GLSHARED, GLES2, GLES3, GLES31, EGL, INTERNAL, EXTERNAL_SRCS, ] ALL_BINARIES = [ LINUX_X64_COMMON_BINARIES, ANDROID_BINARIES, ] RELEASE_CONFIGS = { "src": ALL_MODULES, "src-bin": ALL_MODULES + ALL_BINARIES, "bin": ALL_MODULES + ALL_BINARIES + [REMOVE_SOURCES], } def parseArgs (): parser = argparse.ArgumentParser(description = "Build release package") parser.add_argument("-c", "--config", dest="config", choices=RELEASE_CONFIGS.keys(), required=True, help="Release configuration") parser.add_argument("-n", "--name", dest="name", required=True, help="Package-specific name") parser.add_argument("-v", "--version", dest="version", required=True, help="Version code") return parser.parse_args() if __name__ == "__main__": args = parseArgs() config = ReleaseConfig(args.name, args.version, RELEASE_CONFIGS[args.config]) makeRelease(config)
{ "content_hash": "adc4047bd7970593b8d10f515110d10f", "timestamp": "", "source": "github", "line_count": 514, "max_line_length": 148, "avg_line_length": 33.45136186770428, "alnum_prop": 0.7046062579969757, "repo_name": "googlestadia/VK-GL-CTS", "id": "c480e0edf01efa47dfec3364a2d8e15bff073f63", "size": "18052", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/make_release.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "320" }, { "name": "C", "bytes": "534102" }, { "name": "C++", "bytes": "23213728" }, { "name": "CMake", "bytes": "112160" }, { "name": "HTML", "bytes": "55736" }, { "name": "Java", "bytes": "218430" }, { "name": "Makefile", "bytes": "69395" }, { "name": "Objective-C", "bytes": "10922" }, { "name": "Objective-C++", "bytes": "19107" }, { "name": "Python", "bytes": "608961" }, { "name": "Shell", "bytes": "2672" } ], "symlink_target": "" }
package AsposeCellsExamples.Data; import com.aspose.cells.Workbook; import AsposeCellsExamples.Utils; public class AddingDataToCells { public static void main(String[] args) throws Exception { // The path to the documents directory. String dataDir = Utils.getSharedDataDir(AddingDataToCells.class) + "Data/"; // Instantiating a Workbook object Workbook workbook = new Workbook(); // Accessing the added worksheet in the Excel file int sheetIndex = workbook.getWorksheets().add(); com.aspose.cells.Worksheet worksheet = workbook.getWorksheets().get(sheetIndex); com.aspose.cells.Cells cells = worksheet.getCells(); // Adding a string value to the cell com.aspose.cells.Cell cell = cells.get("A1"); cell.setValue("Hello World"); // Adding a double value to the cell cell = cells.get("A2"); cell.setValue(20.5); // Adding an integer value to the cell cell = cells.get("A3"); cell.setValue(15); // Adding a boolean value to the cell cell = cells.get("A4"); cell.setValue(true); // Adding a date/time value to the cell cell = cells.get("A5"); cell.setValue(java.util.Calendar.getInstance()); // Setting the display format of the date com.aspose.cells.Style style = cell.getStyle(); style.setNumber(15); cell.setStyle(style); // Saving the Excel file workbook.save(dataDir + "AddingDataToCells_out.xlsx"); // Print message System.out.println("Data Added Successfully"); } }
{ "content_hash": "c4aa94471f5ddc5e576e0a62d7dd0b9f", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 82, "avg_line_length": 28.30188679245283, "alnum_prop": 0.69, "repo_name": "asposecells/Aspose_Cells_Java", "id": "4460f35586846a4a70ebd03e4a44196ea7f2dbeb", "size": "1500", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Examples/src/AsposeCellsExamples/Data/AddingDataToCells.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5888" }, { "name": "HTML", "bytes": "79320" }, { "name": "Java", "bytes": "826384" }, { "name": "JavaScript", "bytes": "92031" }, { "name": "PHP", "bytes": "56094" }, { "name": "Python", "bytes": "111280" }, { "name": "Ruby", "bytes": "47960" } ], "symlink_target": "" }
"""empty message Revision ID: 34b0ac3fe0c7 Revises: 2bdf1e80a9be Create Date: 2014-03-20 04:07:04.967000 """ # revision identifiers, used by Alembic. revision = '34b0ac3fe0c7' down_revision = '2bdf1e80a9be' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### pass ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### pass ### end Alembic commands ###
{ "content_hash": "beba60f5589b5214381f795871eaced7", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 63, "avg_line_length": 19.46153846153846, "alnum_prop": 0.6877470355731226, "repo_name": "micknh/EdFirst", "id": "8afca731f0eb37a67dfc404f3282956d9f1803f8", "size": "506", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "migrationsold/versions/34b0ac3fe0c7_.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1262" }, { "name": "JavaScript", "bytes": "4206" }, { "name": "Python", "bytes": "111349" } ], "symlink_target": "" }
/** * */ package gg.riotapichallenge.riotapi.models; /** * @author Enivri * */ public class ParticipantIdentity { /** * For use with Match API * */ private int participantID; // participant id private Player player; // player info public ParticipantIdentity() { this.participantID = 0; this.player = null; } public int getParticipantID() { return participantID; } public void setParticipantID(int participantID) { this.participantID = participantID; } public Player getPlayer() { return player; } public void setPlayer(Player player) { this.player = player; } @Override public String toString() { return "ParticipantIdentity [participantID=" + participantID + ", player=" + player + "]"; } }
{ "content_hash": "1c118c57e9b2afb130256f2b5a1ea802", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 62, "avg_line_length": 17.02127659574468, "alnum_prop": 0.63375, "repo_name": "enivri/riotapichallenge", "id": "26aef51aee038a261a77d79f38e5a431574fb158", "size": "800", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/gg/riotapichallenge/riotapi/models/ParticipantIdentity.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5127" }, { "name": "Java", "bytes": "495285" }, { "name": "JavaScript", "bytes": "22011" } ], "symlink_target": "" }
import codegenNativeComponent from '../Utilities/codegenNativeComponent'; import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; import type { WithDefault, DirectEventHandler, Int32, } from '../Types/CodegenTypes'; import type {ViewProps} from '../Components/View/ViewPropTypes'; type OrientationChangeEvent = $ReadOnly<{| orientation: 'portrait' | 'landscape', |}>; type NativeProps = $ReadOnly<{| ...ViewProps, /** * The `animationType` prop controls how the modal animates. * * See https://reactnative.dev/docs/modal#animationtype */ animationType?: WithDefault<'none' | 'slide' | 'fade', 'none'>, /** * The `presentationStyle` prop controls how the modal appears. * * See https://reactnative.dev/docs/modal#presentationstyle */ presentationStyle?: WithDefault< 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen', 'fullScreen', >, /** * The `transparent` prop determines whether your modal will fill the * entire view. * * See https://reactnative.dev/docs/modal#transparent */ transparent?: WithDefault<boolean, false>, /** * The `statusBarTranslucent` prop determines whether your modal should go under * the system statusbar. * * See https://reactnative.dev/docs/modal#statusBarTranslucent */ statusBarTranslucent?: WithDefault<boolean, false>, /** * The `hardwareAccelerated` prop controls whether to force hardware * acceleration for the underlying window. * * See https://reactnative.dev/docs/modal#hardwareaccelerated */ hardwareAccelerated?: WithDefault<boolean, false>, /** * The `onRequestClose` callback is called when the user taps the hardware * back button on Android or the menu button on Apple TV. * * This is required on Apple TV and Android. * * See https://reactnative.dev/docs/modal#onrequestclose */ onRequestClose?: ?DirectEventHandler<null>, /** * The `onShow` prop allows passing a function that will be called once the * modal has been shown. * * See https://reactnative.dev/docs/modal#onshow */ onShow?: ?DirectEventHandler<null>, /** * The `onDismiss` prop allows passing a function that will be called once * the modal has been dismissed. * * See https://reactnative.dev/docs/modal#ondismiss */ onDismiss?: ?DirectEventHandler<null>, /** * The `visible` prop determines whether your modal is visible. * * See https://reactnative.dev/docs/modal#visible */ visible?: WithDefault<boolean, false>, /** * Deprecated. Use the `animationType` prop instead. */ animated?: WithDefault<boolean, false>, /** * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. * * See https://reactnative.dev/docs/modal#supportedorientations */ supportedOrientations?: WithDefault< $ReadOnlyArray< | 'portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right', >, 'portrait', >, /** * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. * * See https://reactnative.dev/docs/modal#onorientationchange */ onOrientationChange?: ?DirectEventHandler<OrientationChangeEvent>, /** * The `identifier` is the unique number for identifying Modal components. */ identifier?: WithDefault<Int32, 0>, |}>; export default (codegenNativeComponent<NativeProps>('ModalHostView', { interfaceOnly: true, paperComponentName: 'RCTModalHostView', }): HostComponent<NativeProps>);
{ "content_hash": "8a1225d2a660f57dfbf24cbbcc4f87d0", "timestamp": "", "source": "github", "line_count": 131, "max_line_length": 114, "avg_line_length": 27.709923664122137, "alnum_prop": 0.6909090909090909, "repo_name": "janicduplessis/react-native", "id": "69fef94afd8c0700acae6c37b8712a70caf5099a", "size": "3856", "binary": false, "copies": "2", "ref": "refs/heads/main", "path": "Libraries/Modal/RCTModalHostViewNativeComponent.js", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "14919" }, { "name": "Batchfile", "bytes": "289" }, { "name": "C", "bytes": "19108" }, { "name": "C++", "bytes": "3493194" }, { "name": "CMake", "bytes": "70538" }, { "name": "HTML", "bytes": "1473" }, { "name": "Java", "bytes": "3737129" }, { "name": "JavaScript", "bytes": "6796801" }, { "name": "Kotlin", "bytes": "177656" }, { "name": "Makefile", "bytes": "7871" }, { "name": "Objective-C", "bytes": "1625993" }, { "name": "Objective-C++", "bytes": "1203679" }, { "name": "Ruby", "bytes": "274453" }, { "name": "Shell", "bytes": "99437" }, { "name": "Starlark", "bytes": "428986" }, { "name": "XSLT", "bytes": "2244" } ], "symlink_target": "" }
'use strict'; module.exports = require('./is-implemented')() ? String.prototype.normalize : require('./shim');
{ "content_hash": "5c9010ed5937b582e196bb90bd281c99", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 46, "avg_line_length": 23.8, "alnum_prop": 0.6470588235294118, "repo_name": "rowanmiller/Demo-MVADec14", "id": "e77d31dacd8b8d94bb69009d79fc5237b53ba4ba", "size": "119", "binary": false, "copies": "12", "ref": "refs/heads/master", "path": "CompletedSource/CycleSales/src/CycleSales/node_modules/grunt-bower-task/node_modules/es5-ext/string/#/normalize/index.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "41980" }, { "name": "CSS", "bytes": "1252" }, { "name": "JavaScript", "bytes": "2312" } ], "symlink_target": "" }
var args = arguments[0] || {}; var lib=require("mhjLib"); $.navbar.getView('titlelabel').text="我的收藏"; $.navbar.getView('backimage').addEventListener('click',function(e){ Alloy.Globals.Navigator.pop(); }); var HTTP=require("mhjHttpMethod"); var toast=Alloy.createWidget("net.beyondlink.toast"); $.mycollectback.add(toast.getView()); var lastflag=''; var updating=false; $.is.init($.gongluelist); $.ptr.refresh(); function myrefresh(){ HTTP.HttpGET( 'articleList',{ limit:Alloy.CFG.LIMITS, uid:lib.getUserInfo('uid'), last_flag:"", type:"my_fav" }, success, error, true, 'refresh' ); } function success(e,type){ var result=JSON.parse(e); if (result.status == 200) { if(type =="refresh"){ lastflag=result.data.last_flag; updating=false; $.list.setItems(bindView(result.data.articles)); $.ptr.hide(); } if(type == "loadMore"){ lastflag=result.data.last_flag; updating=false; if(result.data.more != 0){ $.is.state(1); }else { $.is.state(-1); } $.list.appendItems(bindView(result.data.articles)); } }else{ if(type=="refresh"){ $.ptr.hide(); } if(type=="loadMore") { updating=false; $.is.state(0); } toast.info(result.msg); } } function error(e,type){ if(type=="refresh"){ $.ptr.hide(); } if(type=="loadMore"){ updating=false; $.is.state(0); } toast.info("请检查网络连接并稍后重试"); } function bindView(dataList,type){ var itemList=[]; Ti.API.info("mycollect"); _.each(dataList,function(element,index,list){ var item={ template:"article", nid:element.nid, title:{text:element.title}, created:{text:Alloy.Globals.stamptotime(element.created)} }; Ti.API.info("mycollect1"); itemList.push(item); }); return itemList; } function loadMore(e){ if (updating) { e.success(); return; }; updating=true; HTTP.HttpGET( 'articleList',{ limit:Alloy.CFG.LIMITS, uid:lib.getUserInfo('uid'), last_flag:"", type:"my_fav" }, success, error, true, "loadMore" ); } $.gongluelist.addEventListener("itemclick",function(e){ var item=e.section.getItemAt(e.itemIndex); var articleinfo=Alloy.createController("articleinfo",{nid:item.nid}); Alloy.Globals.Navigator.push(articleinfo); });
{ "content_hash": "f4a99bb1cf49612e5ec3416f7350276c", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 81, "avg_line_length": 23.11111111111111, "alnum_prop": 0.5325443786982249, "repo_name": "titanium-forks/siroccoicode.aiyou-mhj-master", "id": "0f58b907f52a13524f98434356e6119edffd500f", "size": "2736", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/controllers/myowncollect.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1276" }, { "name": "JavaScript", "bytes": "125109" }, { "name": "Python", "bytes": "5251" } ], "symlink_target": "" }
 #include "RtmpDemuxer.h" #include "Extension/Factory.h" namespace mediakit { bool RtmpDemuxer::loadMetaData(const AMFValue &val){ bool ret = false; try { int audiosamplerate = 0; int audiochannels = 0; int audiosamplesize = 0; const AMFValue *audiocodecid = nullptr; const AMFValue *videocodecid = nullptr; val.object_for_each([&](const string &key, const AMFValue &val) { if (key == "duration") { _fDuration = val.as_number(); return; } if (key == "audiosamplerate") { audiosamplerate = val.as_integer(); return; } if (key == "audiosamplesize") { audiosamplesize = val.as_integer(); return; } if (key == "stereo") { audiochannels = val.as_boolean() ? 2 : 1; return; } if (key == "videocodecid") { //找到视频 videocodecid = &val; return; } if (key == "audiocodecid") { //找到音频 audiocodecid = &val; return; } }); if (videocodecid) { //有视频 ret = true; makeVideoTrack(*videocodecid); } if (audiocodecid) { //有音频 ret = true; makeAudioTrack(*audiocodecid, audiosamplerate, audiochannels, audiosamplesize); } } catch (std::exception &ex) { WarnL << ex.what(); } return ret; } void RtmpDemuxer::inputRtmp(const RtmpPacket::Ptr &pkt) { switch (pkt->type_id) { case MSG_VIDEO: { if (!_try_get_video_track) { _try_get_video_track = true; auto codec = AMFValue(pkt->getMediaType()); makeVideoTrack(codec); } if (_video_rtmp_decoder) { _video_rtmp_decoder->inputRtmp(pkt); } break; } case MSG_AUDIO: { if (!_try_get_audio_track) { _try_get_audio_track = true; auto codec = AMFValue(pkt->getMediaType()); makeAudioTrack(codec, pkt->getAudioSampleRate(), pkt->getAudioChannel(), pkt->getAudioSampleBit()); } if (_audio_rtmp_decoder) { _audio_rtmp_decoder->inputRtmp(pkt); } break; } default : break; } } void RtmpDemuxer::makeVideoTrack(const AMFValue &videoCodec) { //生成Track对象 _videoTrack = dynamic_pointer_cast<VideoTrack>(Factory::getVideoTrackByAmf(videoCodec)); if (_videoTrack) { //生成rtmpCodec对象以便解码rtmp _video_rtmp_decoder = Factory::getRtmpCodecByTrack(_videoTrack, false); if (_video_rtmp_decoder) { //设置rtmp解码器代理,生成的frame写入该Track _video_rtmp_decoder->addDelegate(_videoTrack); onAddTrack(_videoTrack); _try_get_video_track = true; } else { //找不到相应的rtmp解码器,该track无效 _videoTrack.reset(); } } } void RtmpDemuxer::makeAudioTrack(const AMFValue &audioCodec,int sample_rate, int channels, int sample_bit) { //生成Track对象 _audioTrack = dynamic_pointer_cast<AudioTrack>(Factory::getAudioTrackByAmf(audioCodec, sample_rate, channels, sample_bit)); if (_audioTrack) { //生成rtmpCodec对象以便解码rtmp _audio_rtmp_decoder = Factory::getRtmpCodecByTrack(_audioTrack, false); if (_audio_rtmp_decoder) { //设置rtmp解码器代理,生成的frame写入该Track _audio_rtmp_decoder->addDelegate(_audioTrack); onAddTrack(_audioTrack); _try_get_audio_track = true; } else { //找不到相应的rtmp解码器,该track无效 _audioTrack.reset(); } } } } /* namespace mediakit */
{ "content_hash": "ecef9de2b3014113f8975e08e96281af", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 127, "avg_line_length": 31.03174603174603, "alnum_prop": 0.5179028132992327, "repo_name": "xiongziliang/ZLMediaKit", "id": "53ce4c872ae90700cd3c22450b9a44b06a2b8cc1", "size": "4491", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Rtmp/RtmpDemuxer.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "7790839" }, { "name": "CMake", "bytes": "141555" }, { "name": "HTML", "bytes": "287" }, { "name": "Java", "bytes": "6202" }, { "name": "Objective-C", "bytes": "5915" }, { "name": "Shell", "bytes": "1614" } ], "symlink_target": "" }
package dms_enterprise //Licensed under the Apache License, Version 2.0 (the "License"); //you may not use this file except in compliance with the License. //You may obtain a copy of the License at // //http://www.apache.org/licenses/LICENSE-2.0 // //Unless required by applicable law or agreed to in writing, software //distributed under the License is distributed on an "AS IS" BASIS, //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //See the License for the specific language governing permissions and //limitations under the License. // // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. // DatabaseInfo is a nested struct in dms_enterprise response type DatabaseInfo struct { DbId int64 `json:"DbId" xml:"DbId"` Logic bool `json:"Logic" xml:"Logic"` DbType string `json:"DbType" xml:"DbType"` SearchName string `json:"SearchName" xml:"SearchName"` EnvType string `json:"EnvType" xml:"EnvType"` OwnerIds []int64 `json:"OwnerIds" xml:"OwnerIds"` OwnerNickNames []string `json:"OwnerNickNames" xml:"OwnerNickNames"` }
{ "content_hash": "b36c7c9f24d6f3e2f62b151660e81cba", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 84, "avg_line_length": 44.55555555555556, "alnum_prop": 0.7206982543640897, "repo_name": "aliyun/alibaba-cloud-sdk-go", "id": "36fdeb9bd5a92e15364e3fe968d773a7ec76aba8", "size": "1203", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "services/dms-enterprise/struct_database_info.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "734307" }, { "name": "Makefile", "bytes": "183" } ], "symlink_target": "" }
// @flow import Button, { ButtonGroup } from '@atlaskit/button'; import Modal, { ModalFooter } from '@atlaskit/modal-dialog'; import _ from 'lodash'; import React, { Component } from 'react'; import { translate } from '../../../i18n/functions'; import type { DialogProps } from '../../constants'; /** * The ID to be used for the cancel button if enabled. * @type {string} */ const CANCEL_BUTTON_ID = 'modal-dialog-cancel-button'; /** * The ID to be used for the ok button if enabled. * @type {string} */ const OK_BUTTON_ID = 'modal-dialog-ok-button'; /** * The type of the React {@code Component} props of {@link StatelessDialog}. * * @static */ type Props = { ...DialogProps, i18n: Object, /** * Disables dismissing the dialog when the blanket is clicked. Enabled * by default. */ disableBlanketClickDismiss: boolean, /** * If true, the cancel button will not display but cancel actions, like * clicking the blanket, will cancel. */ hideCancelButton: boolean, /** * Whether the dialog is modal. This means clicking on the blanket will * leave the dialog open. No cancel button. */ isModal: boolean, /** * Disables rendering of the submit button. */ submitDisabled: boolean, /** * Function to be used to retreive translated i18n labels. */ t: Function, /** * Width of the dialog, can be: * - 'small' (400px), 'medium' (600px), 'large' (800px), * 'x-large' (968px) * - integer value for pixel width * - string value for percentage */ width: string }; /** * Web dialog that uses atlaskit modal-dialog to display dialogs. */ class StatelessDialog extends Component<Props> { /** * The functional component to be used for rendering the modal footer. */ _Footer: ?Function _dialogElement: ?HTMLElement; /** * Initializes a new {@code StatelessDialog} instance. * * @param {Object} props - The read-only properties with which the new * instance is to be initialized. */ constructor(props) { super(props); // Bind event handlers so they are only bound once for every instance. this._onCancel = this._onCancel.bind(this); this._onDialogDismissed = this._onDialogDismissed.bind(this); this._onKeyDown = this._onKeyDown.bind(this); this._onSubmit = this._onSubmit.bind(this); this._renderFooter = this._renderFooter.bind(this); this._setDialogElement = this._setDialogElement.bind(this); } /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render() { const { children, t /* The following fixes a flow error: */ = _.identity, titleString, titleKey, width } = this.props; return ( <Modal autoFocus = { true } footer = { this._renderFooter } heading = { titleString || t(titleKey) } i18n = { this.props.i18n } onClose = { this._onDialogDismissed } onDialogDismissed = { this._onDialogDismissed } shouldCloseOnEscapePress = { true } width = { width || 'medium' }> <div onKeyDown = { this._onKeyDown } ref = { this._setDialogElement }> <form className = 'modal-dialog-form' id = 'modal-dialog-form' onSubmit = { this._onSubmit }> { children } </form> </div> </Modal> ); } _renderFooter: () => React$Node; /** * Returns a ReactElement to display buttons for closing the modal. * * @param {Object} propsFromModalFooter - The props passed in from the * {@link ModalFooter} component. * @private * @returns {ReactElement} */ _renderFooter(propsFromModalFooter) { // Filter out falsy (null) values because {@code ButtonGroup} will error // if passed in anything but buttons with valid type props. const buttons = [ this._renderOKButton(), this._renderCancelButton() ].filter(Boolean); return ( <ModalFooter showKeyline = { propsFromModalFooter.showKeyline } > { /** * Atlaskit has this empty span (JustifySim) so... */ } <span /> <ButtonGroup> { buttons } </ButtonGroup> </ModalFooter> ); } _onCancel: () => void; /** * Dispatches action to hide the dialog. * * @returns {void} */ _onCancel() { if (!this.props.isModal) { const { onCancel } = this.props; onCancel && onCancel(); } } _onDialogDismissed: () => void; /** * Handles click on the blanket area. * * @returns {void} */ _onDialogDismissed() { if (!this.props.disableBlanketClickDismiss) { this._onCancel(); } } _onSubmit: (?string) => void; /** * Dispatches the action when submitting the dialog. * * @private * @param {string} value - The submitted value if any. * @returns {void} */ _onSubmit(value) { const { onSubmit } = this.props; onSubmit && onSubmit(value); } /** * Renders Cancel button. * * @private * @returns {ReactElement|null} The Cancel button if enabled and dialog is * not modal. */ _renderCancelButton() { if (this.props.cancelDisabled || this.props.isModal || this.props.hideCancelButton) { return null; } const { t /* The following fixes a flow error: */ = _.identity } = this.props; return ( <Button appearance = 'subtle' id = { CANCEL_BUTTON_ID } key = 'cancel' onClick = { this._onCancel } type = 'button'> { t(this.props.cancelKey || 'dialog.Cancel') } </Button> ); } /** * Renders OK button. * * @private * @returns {ReactElement|null} The OK button if enabled. */ _renderOKButton() { if (this.props.submitDisabled) { return null; } const { t /* The following fixes a flow error: */ = _.identity } = this.props; return ( <Button appearance = 'primary' form = 'modal-dialog-form' id = { OK_BUTTON_ID } isDisabled = { this.props.okDisabled } key = 'submit' onClick = { this._onSubmit } type = 'button'> { t(this.props.okKey || 'dialog.Ok') } </Button> ); } _setDialogElement: (?HTMLElement) => void; /** * Sets the instance variable for the div containing the component's dialog * element so it can be accessed directly. * * @param {HTMLElement} element - The DOM element for the component's * dialog. * @private * @returns {void} */ _setDialogElement(element: ?HTMLElement) { this._dialogElement = element; } _onKeyDown: (Object) => void; /** * Handles 'Enter' key in the dialog to submit/hide dialog depending on * the available buttons and their disabled state. * * @param {Object} event - The key event. * @private * @returns {void} */ _onKeyDown(event) { // If the event coming to the dialog has been subject to preventDefault // we don't handle it here. if (event.defaultPrevented) { return; } if (event.key === 'Enter') { event.preventDefault(); event.stopPropagation(); if (this.props.submitDisabled && !this.props.cancelDisabled) { this._onCancel(); } else if (!this.props.okDisabled) { this._onSubmit(); } } } } export default translate(StatelessDialog);
{ "content_hash": "16f4124faee392ed30c1ce6d0ea0c4b2", "timestamp": "", "source": "github", "line_count": 321, "max_line_length": 80, "avg_line_length": 26.45482866043614, "alnum_prop": 0.5231983042863871, "repo_name": "bgrozev/jitsi-meet", "id": "5507520842423b86cebf14e303a66516e011e15b", "size": "8492", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "react/features/base/dialog/components/web/StatelessDialog.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "160916" }, { "name": "HTML", "bytes": "16058" }, { "name": "Java", "bytes": "226322" }, { "name": "JavaScript", "bytes": "3344142" }, { "name": "Lua", "bytes": "135705" }, { "name": "Makefile", "bytes": "2797" }, { "name": "Objective-C", "bytes": "116779" }, { "name": "Ruby", "bytes": "7967" }, { "name": "Shell", "bytes": "27391" }, { "name": "Starlark", "bytes": "152" }, { "name": "Swift", "bytes": "44491" } ], "symlink_target": "" }
// version 1.6.2 // http://welcome.totheinter.net/columnizer-jquery-plugin/ // created by: Adam Wulf @adamwulf, adam.wulf@gmail.com (function($){ $.fn.columnize = function(options) { this.cols =[]; this.offset= 0; this.before=[]; this.lastOther=0; this.prevMax =0; this.debug=0; this.setColumnStart =null; this.elipsisText=''; var defaults = { // default width of columns width: 400, // optional # of columns instead of width columns : false, // true to build columns once regardless of window resize // false to rebuild when content box changes bounds buildOnce : false, // an object with options if the text should overflow // it's container if it can't fit within a specified height overflow : false, // this function is called after content is columnized doneFunc : function(){}, // if the content should be columnized into a // container node other than it's own node target : false, // re-columnizing when images reload might make things // run slow. so flip this to true if it's causing delays ignoreImageLoading : true, // should columns float left or right columnFloat : "left", // ensure the last column is never the tallest column lastNeverTallest : false, // (int) the minimum number of characters to jump when splitting // text nodes. smaller numbers will result in higher accuracy // column widths, but will take slightly longer accuracy : false, // false to round down column widths (for compatibility) // true to conserve all decimals in the column widths precise : false, // don't automatically layout columns, only use manual columnbreak manualBreaks : false, // previx for all the CSS classes used by this plugin // default to empty string for backwards compatibility cssClassPrefix : "", elipsisText:'...', debug:0 }; options = $.extend(defaults, options); if(typeof(options.width) == "string"){ options.width = parseInt(options.width,10); if(isNaN(options.width)){ options.width = defaults.width; } } if(typeof options.setColumnStart== 'function') { this.setColumnStart=options.setColumnStart; } if(typeof options.elipsisText== 'string') { this.elipsisText=options.elipsisText; } if(options.debug) { // assert is off by default this.debug=options.debug; } if(!options.setWidth) { if (options.precise) { options.setWidth = function (numCols) { return 100 / numCols; }; } else { options.setWidth = function (numCols) { return Math.floor(100 / numCols); }; } } /** * appending a text node to a <table> will * cause a jquery crash. * so wrap all append() calls and revert to * a simple appendChild() in case it fails */ function appendSafe($target, $elem){ try{ $target.append($elem); }catch(e){ $target[0].appendChild($elem[0]); } } return this.each(function() { var $inBox = options.target ? $(options.target) : $(this); var maxHeight = $(this).height(); var $cache = $('<div></div>'); // this is where we'll put the real content var lastWidth = 0; var columnizing = false; var manualBreaks = options.manualBreaks; var cssClassPrefix = defaults.cssClassPrefix; if(typeof(options.cssClassPrefix) == "string"){ cssClassPrefix = options.cssClassPrefix; } var adjustment = 0; appendSafe($cache, $(this).contents().clone(true)); // images loading after dom load // can screw up the column heights, // so recolumnize after images load if(!options.ignoreImageLoading && !options.target){ if(!$inBox.data("imageLoaded")){ $inBox.data("imageLoaded", true); if($(this).find("img").length > 0){ // only bother if there are // actually images... var func = function($inBox,$cache){ return function(){ if(!$inBox.data("firstImageLoaded")){ $inBox.data("firstImageLoaded", "true"); appendSafe($inBox.empty(), $cache.children().clone(true)); $inBox.columnize(options); } }; }($(this), $cache); $(this).find("img").one("load", func); $(this).find("img").one("abort", func); return; } } } $inBox.empty(); columnizeIt(); if(!options.buildOnce){ $(window).resize(function() { if(!options.buildOnce){ if($inBox.data("timeout")){ clearTimeout($inBox.data("timeout")); } $inBox.data("timeout", setTimeout(columnizeIt, 200)); } }); } function prefixTheClassName(className, withDot){ var dot = withDot ? "." : ""; if(cssClassPrefix.length){ return dot + cssClassPrefix + "-" + className; } return dot + className; } /** * this fuction builds as much of a column as it can without * splitting nodes in half. If the last node in the new column * is a text node, then it will try to split that text node. otherwise * it will leave the node in $pullOutHere and return with a height * smaller than targetHeight. * * Returns a boolean on whether we did some splitting successfully at a text point * (so we know we don't need to split a real element). return false if the caller should * split a node if possible to end this column. * * @param putInHere, the jquery node to put elements into for the current column * @param $pullOutHere, the jquery node to pull elements out of (uncolumnized html) * @param $parentColumn, the jquery node for the currently column that's being added to * @param targetHeight, the ideal height for the column, get as close as we can to this height */ function columnize($putInHere, $pullOutHere, $parentColumn, targetHeight){ // // add as many nodes to the column as we can, // but stop once our height is too tall while((manualBreaks || $parentColumn.height() < targetHeight) && $pullOutHere[0].childNodes.length){ var node = $pullOutHere[0].childNodes[0]; // // Because we're not cloning, jquery will actually move the element" // http://welcome.totheinter.net/2009/03/19/the-undocumented-life-of-jquerys-append/ if($(node).find(prefixTheClassName("columnbreak", true)).length){ // // our column is on a column break, so just end here return; } if($(node).hasClass(prefixTheClassName("columnbreak"))){ // // our column is on a column break, so just end here return; } appendSafe($putInHere, $(node)); } if($putInHere[0].childNodes.length === 0) return; // now we're too tall, so undo the last one var kids = $putInHere[0].childNodes; var lastKid = kids[kids.length-1]; $putInHere[0].removeChild(lastKid); var $item = $(lastKid); // now lets try to split that last node // to fit as much of it as we can into this column if($item[0].nodeType == 3){ // it's a text node, split it up var oText = $item[0].nodeValue; var counter2 = options.width / 18; if(options.accuracy) counter2 = options.accuracy; var columnText; var latestTextNode = null; while($parentColumn.height() < targetHeight && oText.length){ // // it's been brought up that this won't work for chinese // or other languages that don't have the same use of whitespace // as english. This will need to be updated in the future // to better handle non-english languages. // // https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/124 var indexOfSpace = oText.indexOf(' ', counter2); if (indexOfSpace != -1) { columnText = oText.substring(0, indexOfSpace); } else { columnText = oText; } latestTextNode = document.createTextNode(columnText); appendSafe($putInHere, $(latestTextNode)); if(oText.length > counter2 && indexOfSpace != -1){ oText = oText.substring(indexOfSpace); }else{ oText = ""; } } if($parentColumn.height() >= targetHeight && latestTextNode !== null){ // too tall :( $putInHere[0].removeChild(latestTextNode); oText = latestTextNode.nodeValue + oText; } if(oText.length){ $item[0].nodeValue = oText; }else{ return false; // we ate the whole text node, move on to the next node } } if($pullOutHere.contents().length){ $pullOutHere.prepend($item); }else{ appendSafe($pullOutHere, $item); } return $item[0].nodeType == 3; } /** * Split up an element, which is more complex than splitting text. We need to create * two copies of the element with it's contents divided between each */ function split($putInHere, $pullOutHere, $parentColumn, targetHeight){ if($putInHere.contents(":last").find(prefixTheClassName("columnbreak", true)).length){ // // our column is on a column break, so just end here return; } if($putInHere.contents(":last").hasClass(prefixTheClassName("columnbreak"))){ // // our column is on a column break, so just end here return; } if($pullOutHere.contents().length){ var $cloneMe = $pullOutHere.contents(":first"); // // make sure we're splitting an element if( typeof $cloneMe.get(0) == 'undefined' || $cloneMe.get(0).nodeType != 1 ) return; // // clone the node with all data and events var $clone = $cloneMe.clone(true); // // need to support both .prop and .attr if .prop doesn't exist. // this is for backwards compatibility with older versions of jquery. if($cloneMe.hasClass(prefixTheClassName("columnbreak"))){ // // ok, we have a columnbreak, so add it into // the column and exit appendSafe($putInHere, $clone); $cloneMe.remove(); }else if (manualBreaks){ // keep adding until we hit a manual break appendSafe($putInHere, $clone); $cloneMe.remove(); }else if($clone.get(0).nodeType == 1 && !$clone.hasClass(prefixTheClassName("dontend"))){ appendSafe($putInHere, $clone); if($clone.is("img") && $parentColumn.height() < targetHeight + 20){ // // we can't split an img in half, so just add it // to the column and remove it from the pullOutHere section $cloneMe.remove(); }else if($cloneMe.hasClass(prefixTheClassName("dontsplit")) && $parentColumn.height() < targetHeight + 20){ // // pretty close fit, and we're not allowed to split it, so just // add it to the column, remove from pullOutHere, and be done $cloneMe.remove(); }else if($clone.is("img") || $cloneMe.hasClass(prefixTheClassName("dontsplit"))){ // // it's either an image that's too tall, or an unsplittable node // that's too tall. leave it in the pullOutHere and we'll add it to the // next column $clone.remove(); }else{ // // ok, we're allowed to split the node in half, so empty out // the node in the column we're building, and start splitting // it in half, leaving some of it in pullOutHere $clone.empty(); if(!columnize($clone, $cloneMe, $parentColumn, targetHeight)){ // this node may still have non-text nodes to split // add the split class and then recur $cloneMe.addClass(prefixTheClassName("split")); //if this node was ol element, the child should continue the number ordering if($cloneMe.get(0).tagName == 'OL'){ var startWith = $clone.get(0).childElementCount + $clone.get(0).start; $cloneMe.attr('start',startWith+1); } if($cloneMe.children().length){ split($clone, $cloneMe, $parentColumn, targetHeight); } }else{ // this node only has text node children left, add the // split class and move on. $cloneMe.addClass(prefixTheClassName("split")); } if($clone.get(0).childNodes.length === 0){ // it was split, but nothing is in it :( $clone.remove(); $cloneMe.removeClass(prefixTheClassName("split")); }else if($clone.get(0).childNodes.length == 1){ // was the only child node a text node w/ whitespace? var onlyNode = $clone.get(0).childNodes[0]; if(onlyNode.nodeType == 3){ // text node var whitespace = /\s/; var str = onlyNode.nodeValue; if(whitespace.test(str)){ // yep, only a whitespace textnode $clone.remove(); $cloneMe.removeClass(prefixTheClassName("split")); } } } } } } } function singleColumnizeIt() { if ($inBox.data("columnized") && $inBox.children().length == 1) { return; } $inBox.data("columnized", true); $inBox.data("columnizing", true); $inBox.empty(); $inBox.append($("<div class='" + prefixTheClassName("first") + " " + prefixTheClassName("last") + " " + prefixTheClassName("column") + " " + "' style='width:100%; float: " + options.columnFloat + ";'></div>")); //" $col = $inBox.children().eq($inBox.children().length-1); $destroyable = $cache.clone(true); if(options.overflow){ targetHeight = options.overflow.height; columnize($col, $destroyable, $col, targetHeight); // make sure that the last item in the column isn't a "dontend" if(!$destroyable.contents().find(":first-child").hasClass(prefixTheClassName("dontend"))){ split($col, $destroyable, $col, targetHeight); } while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){ var $lastKid = $col.contents(":last"); $lastKid.remove(); $destroyable.prepend($lastKid); } var html = ""; var div = document.createElement('DIV'); while($destroyable[0].childNodes.length > 0){ var kid = $destroyable[0].childNodes[0]; if(kid.attributes){ for(var i=0;i<kid.attributes.length;i++){ if(kid.attributes[i].nodeName.indexOf("jQuery") === 0){ kid.removeAttribute(kid.attributes[i].nodeName); } } } div.innerHTML = ""; div.appendChild($destroyable[0].childNodes[0]); html += div.innerHTML; } var overflow = $(options.overflow.id)[0]; overflow.innerHTML = html; }else{ appendSafe($col, $destroyable.contents()); } $inBox.data("columnizing", false); if(options.overflow && options.overflow.doneFunc){ options.overflow.doneFunc(); } options.doneFunc(); } /** * returns true if the input dom node * should not end a column. * returns false otherwise */ function checkDontEndColumn(dom){ if(dom.nodeType == 3){ // text node. ensure that the text // is not 100% whitespace if(/^\s+$/.test(dom.nodeValue)){ // // ok, it's 100% whitespace, // so we should return checkDontEndColumn // of the inputs previousSibling if(!dom.previousSibling) return false; return checkDontEndColumn(dom.previousSibling); } return false; } if(dom.nodeType != 1) return false; if($(dom).hasClass(prefixTheClassName("dontend"))) return true; if(dom.childNodes.length === 0) return false; return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]); } function columnizeIt() { //reset adjustment var adjustment = 0; if(lastWidth == $inBox.width()) return; lastWidth = $inBox.width(); var numCols = Math.round($inBox.width() / options.width); var optionWidth = options.width; var optionHeight = options.height; if(options.columns) numCols = options.columns; if(manualBreaks){ numCols = $cache.find(prefixTheClassName("columnbreak", true)).length + 1; optionWidth = false; } // if ($inBox.data("columnized") && numCols == $inBox.children().length) { // return; // } if(numCols <= 1){ return singleColumnizeIt(); } if($inBox.data("columnizing")) return; $inBox.data("columnized", true); $inBox.data("columnizing", true); $inBox.empty(); $inBox.append($("<div style='width:" + options.setWidth(numCols) + "%; float: " + options.columnFloat + ";'></div>")); //" $col = $inBox.children(":last"); appendSafe($col, $cache.clone()); maxHeight = $col.height(); $inBox.empty(); var targetHeight = maxHeight / numCols; var firstTime = true; var maxLoops = 3; var scrollHorizontally = false; if(options.overflow){ maxLoops = 1; targetHeight = options.overflow.height; }else if(optionHeight && optionWidth){ maxLoops = 1; targetHeight = optionHeight; scrollHorizontally = true; } // // We loop as we try and workout a good height to use. We know it initially as an average // but if the last column is higher than the first ones (which can happen, depending on split // points) we need to raise 'adjustment'. We try this over a few iterations until we're 'solid'. // // also, lets hard code the max loops to 20. that's /a lot/ of loops for columnizer, // and should keep run aways in check. if somehow someone has content combined with // options that would cause an infinite loop, then this'll definitely stop it. for(var loopCount=0;loopCount<maxLoops && loopCount<20;loopCount++){ $inBox.empty(); var $destroyable, className, $col, $lastKid; try{ $destroyable = $cache.clone(true); }catch(e){ // jquery in ie6 can't clone with true $destroyable = $cache.clone(); } $destroyable.css("visibility", "hidden"); // create the columns for (var i = 0; i < numCols; i++) { /* create column */ className = (i === 0) ? prefixTheClassName("first") : ""; className += " " + prefixTheClassName("column"); className = (i == numCols - 1) ? (prefixTheClassName("last") + " " + className) : className; $inBox.append($("<div class='" + className + "' style='width:" + options.setWidth(numCols) + "%; float: " + options.columnFloat + ";'></div>")); //" } // fill all but the last column (unless overflowing) i = 0; while(i < numCols - (options.overflow ? 0 : 1) || scrollHorizontally && $destroyable.contents().length){ if($inBox.children().length <= i){ // we ran out of columns, make another $inBox.append($("<div class='" + className + "' style='width:" + options.setWidth(numCols) + "%; float: " + options.columnFloat + ";'></div>")); //" } $col = $inBox.children().eq(i); if(scrollHorizontally){ $col.width(optionWidth + "px"); } columnize($col, $destroyable, $col, targetHeight); // make sure that the last item in the column isn't a "dontend" split($col, $destroyable, $col, targetHeight); while($col.contents(":last").length && checkDontEndColumn($col.contents(":last").get(0))){ $lastKid = $col.contents(":last"); $lastKid.remove(); $destroyable.prepend($lastKid); } i++; // // https://github.com/adamwulf/Columnizer-jQuery-Plugin/issues/47 // // check for infinite loop. // // this could happen when a dontsplit or dontend item is taller than the column // we're trying to build, and its never actually added to a column. // // this results in empty columns being added with the dontsplit item // perpetually waiting to get put into a column. lets force the issue here if($col.contents().length === 0 && $destroyable.contents().length){ // // ok, we're building zero content columns. this'll happen forever // since nothing can ever get taken out of destroyable. // // to fix, lets put 1 item from destroyable into the empty column // before we iterate $col.append($destroyable.contents(":first")); }else if(i == numCols - (options.overflow ? 0 : 1) && !options.overflow){ // // ok, we're about to exit the while loop because we're done with all // columns except the last column. // // if $destroyable still has columnbreak nodes in it, then we need to keep // looping and creating more columns. if($destroyable.find(prefixTheClassName("columnbreak", true)).length){ numCols ++; } } } if(options.overflow && !scrollHorizontally){ var IE6 = false; /*@cc_on @if (@_jscript_version < 5.7) IE6 = true; @end @*/ var IE7 = (document.all) && (navigator.appVersion.indexOf("MSIE 7.") != -1); if(IE6 || IE7){ var html = ""; var div = document.createElement('DIV'); while($destroyable[0].childNodes.length > 0){ var kid = $destroyable[0].childNodes[0]; for(i=0;i<kid.attributes.length;i++){ if(kid.attributes[i].nodeName.indexOf("jQuery") === 0){ kid.removeAttribute(kid.attributes[i].nodeName); } } div.innerHTML = ""; div.appendChild($destroyable[0].childNodes[0]); html += div.innerHTML; } var overflow = $(options.overflow.id)[0]; overflow.innerHTML = html; }else{ $(options.overflow.id).empty().append($destroyable.contents().clone(true)); } }else if(!scrollHorizontally){ // the last column in the series $col = $inBox.children().eq($inBox.children().length-1); $destroyable.contents().each( function() { $col.append( $(this) ); }); var afterH = $col.height(); var diff = afterH - targetHeight; var totalH = 0; var min = 10000000; var max = 0; var lastIsMax = false; var numberOfColumnsThatDontEndInAColumnBreak = 0; $inBox.children().each(function($inBox){ return function($item){ var $col = $inBox.children().eq($item); var endsInBreak = $col.children(":last").find(prefixTheClassName("columnbreak", true)).length; if(!endsInBreak){ var h = $col.height(); lastIsMax = false; totalH += h; if(h > max) { max = h; lastIsMax = true; } if(h < min) min = h; numberOfColumnsThatDontEndInAColumnBreak++; } }; }($inBox)); var avgH = totalH / numberOfColumnsThatDontEndInAColumnBreak; if(totalH === 0){ // // all columns end in a column break, // so we're done here loopCount = maxLoops; }else if(options.lastNeverTallest && lastIsMax){ // the last column is the tallest // so allow columns to be taller // and retry // // hopefully this'll mean more content fits into // earlier columns, so that the last column // can be shorter than the rest adjustment += 5; targetHeight = targetHeight + 30; if(loopCount == maxLoops-1) maxLoops++; }else if(max - min > 30){ // too much variation, try again targetHeight = avgH + 30; }else if(Math.abs(avgH-targetHeight) > 20){ // too much variation, try again targetHeight = avgH; }else { // solid, we're done loopCount = maxLoops; } }else{ // it's scrolling horizontally, fix the width/classes of the columns $inBox.children().each(function(i){ $col = $inBox.children().eq(i); $col.width(optionWidth + "px"); if(i === 0){ $col.addClass(prefixTheClassName("first")); }else if(i==$inBox.children().length-1){ $col.addClass(prefixTheClassName("last")); }else{ $col.removeClass(prefixTheClassName("first")); $col.removeClass(prefixTheClassName("last")); } }); $inBox.width($inBox.children().length * optionWidth + "px"); } $inBox.append($("<br style='clear:both;'>")); } $inBox.find(prefixTheClassName("column", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove(); $inBox.find(prefixTheClassName("column", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove(); $inBox.find(prefixTheClassName("split", true)).find(":first" + prefixTheClassName("removeiffirst", true)).remove(); $inBox.find(prefixTheClassName("split", true)).find(':last' + prefixTheClassName("removeiflast", true)).remove(); $inBox.data("columnizing", false); if(options.overflow){ options.overflow.doneFunc(); } options.doneFunc(); } }); }; $.fn.renumberByJS=function($searchTag, $colno, $targetId, $targetClass ) { this.setList = function($cols, $list, $tag1) { var $parents = this.before.parents(); var $rest; $rest = $($cols[this.offset-1]).find('>*'); if( ($rest.last())[0].tagName!=$tag1.toUpperCase()) { if(this.debug) { console.log("Last item in previous column, isn't a list..."); } return 0; } $rest = $rest.length; var $tint = 1; if(this.lastOther<=0) { $tint = this.before.children().length+1; } else { $tint = $($parents[this.lastOther]).children().length+1; } // if the first LI in the current column is split, decrement, as we want the same number/key if( $($cols[this.offset]).find($tag1+':first li.split').length ) { var $whereElipsis=$($cols[this.offset-1]).find($tag1+':last li:last'); if( this.elipsisText==='' || $($cols[this.offset-1]).find($tag1+':last ~ div').length || $($cols[this.offset-1]).find($tag1+':last ~ p').length ) { ; } else { if($($whereElipsis).find('ul, ol, dl').length ==0 ) { var $txt=$whereElipsis.last().text(); // char counting, 'cus MSIE 8 is appearently stupid var $len=$txt.length; if($txt.substring($len-1)==';') { if($txt.substring($len-4)!=this.elipsisText+';') { $txt=$txt.substring(0, $len-1)+this.elipsisText+';'; } } else { if($txt.substring($len-3)!=this.elipsisText) { $txt+=this.elipsisText; } } $whereElipsis.last().text($txt); } } // an item in split between two columns. it only holds one key... if($($cols[this.offset]).find($tag1+':first >li.split >'+$tag1).length==0) { $tint--; } } if($rest==1) { // the last column only held one thing, so assume its wrapped to the column before that as well. $tint += this.prevMax ; } if(this.nest>1) { if(this.debug) { console.log("Supposed to be a nested list...decr"); } $tint--; // some how, id previous list starts split, need secins decrement, // if "split" is now correct, reference this var $tt = $($cols[this.offset -1]).find($tag1+':first li.split:first'); if($tt.length>0) { if(this.debug) { console.log("Previous column started with a split item, so that count is one less than expected"); } $tint--; } $tt = $($cols[this.offset]).find($tag1+':first li:first').clone(); $tt.children().remove(); if( $.trim($tt.text()).length>0 ){ if(this.debug) { console.log("If that was a complete list in the previous column, don't decr."); } $tint++; if($($cols[this.offset-1]).find(">"+$tag1+':last ').children().length==0 ) { if(this.debug) { console.log("unless that was empty, in which case revert"); } $tint--; } } } else { var $tt = $($cols[this.offset]).find($tag1+':first li:first '+$tag1+".split li.split"); if($tt.length>0) { if(this.debug) { console.log("[Nested] Column started with a split item, so that count is one less than expected"); } $tint--; } } if(this.debug) { console.log("Setting the start value to "+$tint+" ("+this.prevMax +")"); } if($tint >0) { // if the above computation leads to 0, or an empty list (more likely), don't set, leave as 1 if(typeof this.setColumnStart == 'function') { this.setColumnStart($list, $tint); } else { $list.attr('start', $tint); } } return 0; } if(typeof $targetId === 'undefined') { $targetId=false; } if(typeof $targetClass === 'undefined') { $targetClass=false; } if(! $targetId && !$targetClass ) { throw "renumberByJS(): Bad param, must pass an id or a class"; } var $target =''; this.prevMax =1; if($targetClass) { $target ="."+$targetClass; } else { $target ="#"+$targetId; } var $tag1 = $searchTag.toLowerCase(); var $tag2 = $searchTag.toUpperCase(); this.cols = $($target); if(this.debug) { console.log("There are "+this.cols.length+" items, looking for "+$tag1); } this.before = $(this.cols[0]).find($tag1+':last'); this.prevMax = this.before.children().length; // start at 1, as must compare to previous... for(this.offset=1; this.offset<this.cols.length; this.offset++) { if(this.debug) { console.log("iterating "+this.offset+"...[of "+this.cols.length+"]"); } // if the first column again, nothing to the left of you, do nothing... if(this.offset % $colno==0) { if(this.debug) { console.log("First column (in theory..)"); } this.prevMax = 1; continue; } this.before = $(this.cols[this.offset-1]).find($tag1+':last'); // if there are no occurences of the searchTag, do nothing if(this.before.length) { if(this.debug) { console.log("Have some "+$searchTag+" elements in the previous column"); } var $list = $(this.cols[this.offset]).find($tag1+':first'); var $first = $(this.cols[this.offset]).find('*:first'); if($first[0] !== $list[0]) { // don't renumber anything, its not a rollover list continue; } var $parents = this.before.parents(); this.lastOther = 0; var $found = false; for(; this.lastOther<$parents.length; this.lastOther++) { if($parents[this.lastOther].tagName != $tag2 && $parents[this.lastOther].tagName != "LI") { $found = true; this.lastOther--; break; } } this.nest =1; if($(this.cols[this.offset]).find(">"+$tag1+':first li '+$tag1+":first").length) { this.nest = 2; } this.setList(this.cols, $list, $tag1); this.lastOther--; $list = $(this.cols[this.offset]).find($tag1+':first li '+$tag1+":first"); if($list.length) { // I hope the two columns have same nesting, or its busted this.before= $(this.cols[this.offset-1]).find(">"+$tag1+':last li '+$tag1+":last"); this.prevMax= 0; this.nest =1; this.setList(this.cols, $list, $tag1); } var $reset = $(this.cols[this.offset-1]).find(">"+$tag1+':last'); this.prevMax = $reset.children().length; } } return 0; }; })(jQuery);
{ "content_hash": "01fb75ad011c19449d1293851ad6a5f0", "timestamp": "", "source": "github", "line_count": 889, "max_line_length": 154, "avg_line_length": 33.9955005624297, "alnum_prop": 0.6151809939778969, "repo_name": "hutzelknecht/ukebook", "id": "b63a410fd70900a5fe20abc8e2617ddbb02e98c4", "size": "30222", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "frontend/columnizer/src/jquery.columnizer.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "9857" }, { "name": "HTML", "bytes": "7991" }, { "name": "JavaScript", "bytes": "159846" }, { "name": "Shell", "bytes": "224" } ], "symlink_target": "" }
// Initialize HTML editor function rcmail_editor_init(config) { var ret, conf = { mode: 'textareas', editor_selector: 'mce_editor', apply_source_formatting: true, theme: 'advanced', language: config.lang, content_css: config.skin_path + '/editor_content.css', theme_advanced_toolbar_location: 'top', theme_advanced_toolbar_align: 'left', theme_advanced_buttons3: '', theme_advanced_statusbar_location: 'none', extended_valid_elements: 'font[face|size|color|style],span[id|class|align|style]', relative_urls: false, remove_script_host: false, gecko_spellcheck: true, convert_urls: false, // #1486944 external_image_list: window.rcmail_editor_images, rc_client: rcmail }; if (config.mode == 'identity') $.extend(conf, { plugins: 'paste,tabfocus', theme_advanced_buttons1: 'bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,outdent,indent,charmap,hr,link,unlink,code,forecolor', theme_advanced_buttons2: 'fontselect,fontsizeselect' }); else { // mail compose $.extend(conf, { plugins: 'paste,emotions,media,nonbreaking,table,searchreplace,visualchars,directionality,inlinepopups,tabfocus' + (config.spellcheck ? ',spellchecker' : ''), theme_advanced_buttons1: 'bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,outdent,indent,ltr,rtl,blockquote,|,forecolor,backcolor,fontselect,fontsizeselect', theme_advanced_buttons2: 'link,unlink,table,|,emotions,charmap,image,media,|,code,search,undo,redo', spellchecker_languages: (rcmail.env.spellcheck_langs ? rcmail.env.spellcheck_langs : 'Dansk=da,Deutsch=de,+English=en,Espanol=es,Francais=fr,Italiano=it,Nederlands=nl,Polski=pl,Portugues=pt,Suomi=fi,Svenska=sv'), spellchecker_rpc_url: '?_task=utils&_action=spell_html&_remote=1', spellchecker_enable_learn_rpc: config.spelldict, accessibility_focus: false, oninit: 'rcmail_editor_callback' }); // add handler for spellcheck button state update conf.setup = function(ed) { ed.onSetProgressState.add(function(ed, active) { if (!active) rcmail.spellcheck_state(); }); ed.onKeyPress.add(function(ed, e) { rcmail.compose_type_activity++; }); } } // support external configuration settings e.g. from skin if (window.rcmail_editor_settings) $.extend(conf, window.rcmail_editor_settings); tinyMCE.init(conf); } // react to real individual tinyMCE editor init function rcmail_editor_callback() { var css = {}, elem = rcube_find_object('_from'), fe = rcmail.env.compose_focus_elem; if (rcmail.env.default_font) css['font-family'] = rcmail.env.default_font; if (rcmail.env.default_font_size) css['font-size'] = rcmail.env.default_font_size; if (css['font-family'] || css['font-size']) $(tinyMCE.get(rcmail.env.composebody).getBody()).css(css); if (elem && elem.type == 'select-one') { rcmail.change_identity(elem); // Focus previously focused element if (fe && fe.id != rcmail.env.composebody) { // use setTimeout() for IE9 (#1488541) window.setTimeout(function() { window.focus(); // for WebKit (#1486674) fe.focus(); }, 10); } } // set tabIndex and set focus to element that was focused before rcmail_editor_tabindex(fe && fe.id == rcmail.env.composebody); // Trigger resize (needed for proper editor resizing in some browsers using default skin) $(window).resize(); } // set tabIndex on tinyMCE editor function rcmail_editor_tabindex(focus) { if (rcmail.env.task == 'mail') { var editor = tinyMCE.get(rcmail.env.composebody); if (editor) { var textarea = editor.getElement(); var node = editor.getContentAreaContainer().childNodes[0]; if (textarea && node) node.tabIndex = textarea.tabIndex; if (focus) editor.getBody().focus(); } } } // switch html/plain mode function rcmail_toggle_editor(select, textAreaId, flagElement) { var flag, ishtml; if (select.tagName != 'SELECT') ishtml = select.checked; else ishtml = select.value == 'html'; var res = rcmail.command('toggle-editor', {id:textAreaId, mode:ishtml?'html':'plain'}); if (ishtml) { // #1486593 setTimeout("rcmail_editor_tabindex(true);", 500); if (flagElement && (flag = rcube_find_object(flagElement))) flag.value = '1'; } else if (res) { if (flagElement && (flag = rcube_find_object(flagElement))) flag.value = '0'; if (rcmail.env.composebody) rcube_find_object(rcmail.env.composebody).focus(); } else { // !res if (select.tagName == 'SELECT') select.value = 'html'; else if (select.tagName == 'INPUT') select.checked = true; } } // editor callbeck for images listing function rcmail_editor_images() { var i, files = rcmail.env.attachments, list = []; for (i in files) { att = files[i]; if (att.complete && att.mimetype.startsWith('image/')) { list.push([att.name, rcmail.env.comm_path+'&_id='+rcmail.env.compose_id+'&_action=display-attachment&_file='+i]); } } return list; };
{ "content_hash": "134e0fc311620c3f091358c346d4bfd8", "timestamp": "", "source": "github", "line_count": 159, "max_line_length": 218, "avg_line_length": 33.100628930817614, "alnum_prop": 0.6606498194945848, "repo_name": "yorickdewid/qpanel", "id": "df3d41240aa05d28b512a4ae75bafd9449e7d056", "size": "6243", "binary": false, "copies": "15", "ref": "refs/heads/master", "path": "etc/apps/webmail/program/js/editor.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "83187" }, { "name": "C", "bytes": "18346" }, { "name": "CSS", "bytes": "397424" }, { "name": "Diff", "bytes": "8692" }, { "name": "Erlang", "bytes": "163" }, { "name": "Groff", "bytes": "29" }, { "name": "HTML", "bytes": "1412110" }, { "name": "JavaScript", "bytes": "5722234" }, { "name": "Makefile", "bytes": "6774" }, { "name": "PHP", "bytes": "12049123" }, { "name": "Perl", "bytes": "72192" }, { "name": "Python", "bytes": "17086" }, { "name": "Shell", "bytes": "39780" }, { "name": "XSLT", "bytes": "77721" } ], "symlink_target": "" }
package org.shikato.infodumper.dump; import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.telephony.TelephonyManager; import com.facebook.stetho.dumpapp.DumpException; import java.util.LinkedHashMap; import java.util.List; public class TelDumper implements InfoDumper { @Override public String getTitle() { return "TEL"; } @Override public LinkedHashMap<String, String> getDumpMap(Context context) throws DumpException { int permissionInfo = context.getPackageManager().checkPermission(Manifest.permission.READ_PHONE_STATE, context.getPackageName()); if (permissionInfo == PackageManager.PERMISSION_DENIED) { return null; } TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); LinkedHashMap<String, String> dumps = new LinkedHashMap<>(); dumps.put("Line1Number", telephonyManager.getLine1Number()); dumps.put("DeviceId", telephonyManager.getDeviceId()); dumps.put("SimCountryIso", telephonyManager.getSimCountryIso()); dumps.put("SimOperator", telephonyManager.getSimOperator()); dumps.put("SimOperatorName", telephonyManager.getSimOperatorName()); dumps.put("SimSerialNumber", telephonyManager.getSimSerialNumber()); dumps.put("SimState", Integer.toString(telephonyManager.getSimState())); dumps.put("VoiceMailNumber", telephonyManager.getVoiceMailNumber()); return dumps; } @Override public List<String> getDumpList(Context context) throws DumpException { return null; } @Override public String getErrorMessage() { return "Need a permission: android.permission.READ_PHONE_STATE"; } }
{ "content_hash": "f906470f271987d5c2b120ac11bf5ccd", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 124, "avg_line_length": 34.45283018867924, "alnum_prop": 0.7141292442497261, "repo_name": "shikato/info-dumper", "id": "0d9a05f6b8cb0c71b9a6b22a18ebc6eef079d95b", "size": "1826", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "library/src/main/java/org/shikato/infodumper/dump/TelDumper.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "30327" } ], "symlink_target": "" }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } (function (global, factory) { if (typeof define === "function" && define.amd) { define(["exports", "../../globals/js/settings", "../../globals/js/misc/mixin", "../../globals/js/mixins/create-component", "../../globals/js/mixins/init-component-by-search", "../../globals/js/mixins/evented-state", "../../globals/js/mixins/handles", "../../globals/js/misc/event-matches", "../../globals/js/misc/on"], factory); } else if (typeof exports !== "undefined") { factory(exports, require("../../globals/js/settings"), require("../../globals/js/misc/mixin"), require("../../globals/js/mixins/create-component"), require("../../globals/js/mixins/init-component-by-search"), require("../../globals/js/mixins/evented-state"), require("../../globals/js/mixins/handles"), require("../../globals/js/misc/event-matches"), require("../../globals/js/misc/on")); } else { var mod = { exports: {} }; factory(mod.exports, global.settings, global.mixin, global.createComponent, global.initComponentBySearch, global.eventedState, global.handles, global.eventMatches, global.on); global.fileUploader = mod.exports; } })(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _settings, _mixin2, _createComponent, _initComponentBySearch, _eventedState, _handles, _eventMatches, _on) { "use strict"; Object.defineProperty(_exports, "__esModule", { value: true }); _exports.default = void 0; _settings = _interopRequireDefault(_settings); _mixin2 = _interopRequireDefault(_mixin2); _createComponent = _interopRequireDefault(_createComponent); _initComponentBySearch = _interopRequireDefault(_initComponentBySearch); _eventedState = _interopRequireDefault(_eventedState); _handles = _interopRequireDefault(_handles); _eventMatches = _interopRequireDefault(_eventMatches); _on = _interopRequireDefault(_on); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var toArray = function toArray(arrayLike) { return Array.prototype.slice.call(arrayLike); }; var FileUploader = /*#__PURE__*/function (_mixin) { _inherits(FileUploader, _mixin); var _super = _createSuper(FileUploader); /** * File uploader. * @extends CreateComponent * @extends InitComponentBySearch * @extends eventedState * @extends Handles * @param {HTMLElement} element The element working as a file uploader. * @param {object} [options] The component options. See static options. */ function FileUploader(element) { var _this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, FileUploader); _this = _super.call(this, element, options); _this._changeState = function (state, detail, callback) { if (state === 'delete-filename-fileuploader') { _this.container.removeChild(detail.filenameElement); } if (typeof callback === 'function') { callback(); } }; _this._handleDeleteButton = function (evt) { var target = (0, _eventMatches.default)(evt, _this.options.selectorCloseButton); if (target) { _this.changeState('delete-filename-fileuploader', { initialEvt: evt, filenameElement: target.closest(_this.options.selectorSelectedFile) }); } }; _this._handleDragDrop = function (evt) { var isOfSelf = _this.element.contains(evt.target); // In IE11 `evt.dataTransfer.types` is a `DOMStringList` instead of an array if (Array.prototype.indexOf.call(evt.dataTransfer.types, 'Files') >= 0 && !(0, _eventMatches.default)(evt, _this.options.selectorOtherDropContainers)) { var inArea = isOfSelf && (0, _eventMatches.default)(evt, _this.options.selectorDropContainer); if (evt.type === 'dragover') { evt.preventDefault(); var dropEffect = inArea ? 'copy' : 'none'; if (Array.isArray(evt.dataTransfer.types)) { // IE11 throws a "permission denied" error accessing `.effectAllowed` evt.dataTransfer.effectAllowed = dropEffect; } evt.dataTransfer.dropEffect = dropEffect; _this.dropContainer.classList.toggle(_this.options.classDragOver, Boolean(inArea)); } if (evt.type === 'dragleave') { _this.dropContainer.classList.toggle(_this.options.classDragOver, false); } if (inArea && evt.type === 'drop') { evt.preventDefault(); _this._displayFilenames(evt.dataTransfer.files); _this.dropContainer.classList.remove(_this.options.classDragOver); } } }; _this.input = _this.element.querySelector(_this.options.selectorInput); _this.container = _this.element.querySelector(_this.options.selectorContainer); _this.dropContainer = _this.element.querySelector(_this.options.selectorDropContainer); if (!_this.input) { throw new TypeError('Cannot find the file input box.'); } if (!_this.container) { throw new TypeError('Cannot find the file names container.'); } _this.inputId = _this.input.getAttribute('id'); _this.manage((0, _on.default)(_this.input, 'change', function () { return _this._displayFilenames(); })); _this.manage((0, _on.default)(_this.container, 'click', _this._handleDeleteButton)); _this.manage((0, _on.default)(_this.element.ownerDocument, 'dragleave', _this._handleDragDrop)); _this.manage((0, _on.default)(_this.dropContainer, 'dragover', _this._handleDragDrop)); _this.manage((0, _on.default)(_this.dropContainer, 'drop', _this._handleDragDrop)); return _this; } _createClass(FileUploader, [{ key: "_filenamesHTML", value: function _filenamesHTML(name, id) { return "<span class=\"".concat(this.options.classSelectedFile, "\">\n <p class=\"").concat(this.options.classFileName, "\">").concat(name, "</p>\n <span data-for=\"").concat(id, "\" class=\"").concat(this.options.classStateContainer, "\"></span>\n </span>"); } }, { key: "_uploadHTML", value: function _uploadHTML() { return "\n <div class=\"".concat(this.options.classLoadingAnimation, "\">\n <div data-inline-loading-spinner class=\"").concat(this.options.classLoading, "\">\n <svg class=\"").concat(this.options.classLoadingSvg, "\" viewBox=\"-75 -75 150 150\">\n <circle class=\"").concat(this.options.classLoadingBackground, "\" cx=\"0\" cy=\"0\" r=\"37.5\" />\n <circle class=\"").concat(this.options.classLoadingStroke, "\" cx=\"0\" cy=\"0\" r=\"37.5\" />\n </svg>\n </div>\n </div>"); } }, { key: "_closeButtonHTML", value: function _closeButtonHTML() { return "\n <button class=\"".concat(this.options.classFileClose, "\" type=\"button\" aria-label=\"close\">\n <svg aria-hidden=\"true\" viewBox=\"0 0 16 16\" width=\"16\" height=\"16\">\n <path fill=\"#231F20\" d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"/>\n </svg>\n </button>"); } }, { key: "_checkmarkHTML", value: function _checkmarkHTML() { return "\n <svg focusable=\"false\"\n preserveAspectRatio=\"xMidYMid meet\"\n style=\"will-change: transform;\"\n xmlns=\"http://www.w3.org/2000/svg\"\n class=\"".concat(this.options.classFileComplete, "\"\n width=\"16\" height=\"16\" viewBox=\"0 0 16 16\"\n aria-hidden=\"true\">\n <path d=\"M8 1C4.1 1 1 4.1 1 8s3.1 7 7 7 7-3.1 7-7-3.1-7-7-7zM7 11L4.3 8.3l.9-.8L7 9.3l4-3.9.9.8L7 11z\"></path>\n <path d=\"M7 11L4.3 8.3l.9-.8L7 9.3l4-3.9.9.8L7 11z\" data-icon-path=\"inner-path\" opacity=\"0\"></path>\n </svg>\n "); } }, { key: "_getStateContainers", value: function _getStateContainers() { var stateContainers = toArray(this.element.querySelectorAll("[data-for=".concat(this.inputId, "]"))); if (stateContainers.length === 0) { throw new TypeError('State container elements not found; invoke _displayFilenames() first'); } if (stateContainers[0].dataset.for !== this.inputId) { throw new TypeError('File input id must equal [data-for] attribute'); } return stateContainers; } /** * Inject selected files into DOM. Invoked on change event. * @param {File[]} files The files to upload. */ }, { key: "_displayFilenames", value: function _displayFilenames() { var _this2 = this; var files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.input.files; var container = this.element.querySelector(this.options.selectorContainer); var HTMLString = toArray(files).map(function (file) { return _this2._filenamesHTML(file.name, _this2.inputId); }).join(''); container.insertAdjacentHTML('afterbegin', HTMLString); } }, { key: "_removeState", value: function _removeState(element) { if (!element || element.nodeType !== Node.ELEMENT_NODE) { throw new TypeError('DOM element should be given to initialize this widget.'); } while (element.firstChild) { element.removeChild(element.firstChild); } } }, { key: "_handleStateChange", value: function _handleStateChange(elements, selectIndex, html) { var _this3 = this; if (selectIndex === undefined) { elements.forEach(function (el) { _this3._removeState(el); el.insertAdjacentHTML('beforeend', html); }); } else { elements.forEach(function (el, index) { if (index === selectIndex) { _this3._removeState(el); el.insertAdjacentHTML('beforeend', html); } }); } } /** * Handles delete button. * @param {Event} evt The event triggering this action. * @private */ }, { key: "setState", value: function setState(state, selectIndex) { var stateContainers = this._getStateContainers(); if (state === 'edit') { this._handleStateChange(stateContainers, selectIndex, this._closeButtonHTML()); } if (state === 'upload') { this._handleStateChange(stateContainers, selectIndex, this._uploadHTML()); } if (state === 'complete') { this._handleStateChange(stateContainers, selectIndex, this._checkmarkHTML()); } } /** * The map associating DOM element and file uploader instance. * @member FileUploader.components * @type {WeakMap} */ }], [{ key: "options", get: function get() { var prefix = _settings.default.prefix; return { selectorInit: '[data-file]', selectorInput: "input[type=\"file\"].".concat(prefix, "--file-input"), selectorContainer: '[data-file-container]', selectorCloseButton: ".".concat(prefix, "--file-close"), selectorSelectedFile: ".".concat(prefix, "--file__selected-file"), selectorDropContainer: "[data-file-drop-container]", selectorOtherDropContainers: '[data-drop-container]', classLoading: "".concat(prefix, "--loading ").concat(prefix, "--loading--small"), classLoadingAnimation: "".concat(prefix, "--inline-loading__animation"), classLoadingSvg: "".concat(prefix, "--loading__svg"), classLoadingBackground: "".concat(prefix, "--loading__background"), classLoadingStroke: "".concat(prefix, "--loading__stroke"), classFileName: "".concat(prefix, "--file-filename"), classFileClose: "".concat(prefix, "--file-close"), classFileComplete: "".concat(prefix, "--file-complete"), classSelectedFile: "".concat(prefix, "--file__selected-file"), classStateContainer: "".concat(prefix, "--file__state-container"), classDragOver: "".concat(prefix, "--file__drop-container--drag-over"), eventBeforeDeleteFilenameFileuploader: 'fileuploader-before-delete-filename', eventAfterDeleteFilenameFileuploader: 'fileuploader-after-delete-filename' }; } }]); FileUploader.components = new WeakMap(); return FileUploader; }((0, _mixin2.default)(_createComponent.default, _initComponentBySearch.default, _eventedState.default, _handles.default)); var _default = FileUploader; _exports.default = _default; });
{ "content_hash": "66652ad5012b6c0a47c7d8043c3aeb80", "timestamp": "", "source": "github", "line_count": 413, "max_line_length": 595, "avg_line_length": 39.27845036319613, "alnum_prop": 0.6123782517568733, "repo_name": "cdnjs/cdnjs", "id": "731a653620f89e61279080b97d110027d06bbb17", "size": "16222", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ajax/libs/carbon-components/10.33.0-rc.0/umd/components/file-uploader/file-uploader.js", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
from contextlib import contextmanager from collections import defaultdict from itertools import count from functools import wraps from .decorators import singleton def disambiguate(label, taken): """If necessary, add a suffix to label to avoid name conflicts :param label: desired label :param taken: set of taken names Returns label if it is not in the taken set. Otherwise, returns label_NN where NN is the lowest integer such that label_NN not in taken. """ if label not in taken: return label suffix = "_%2.2i" label = str(label) for i in count(1): candidate = label + (suffix % i) if candidate not in taken: return candidate @singleton class Registry(object): """ Stores labels for classes of objects. Ensures uniqueness The registry ensures that labels for objects of the same "group" are unique, and disambiguates as necessary. By default, objects types are used to group, but anything can be used as a group Registry is a singleton, and thus all instances of Registry share the same information Usage: >>> r = Registry() >>> x, y, z = 3, 4, 5 >>> w = list() >>> r.register(x, 'Label') 'Label' >>> r.register(y, 'Label') # duplicate label disambiguated 'Label_01' >>> r.register(w, 'Label') # uniqueness only enforced within groups 'Label' >>> r.register(z, 'Label', group=int) # put z in integer registry 'Label_02' """ def __init__(self): self._registry = defaultdict(dict) self._disable = False def register(self, obj, label, group=None): """ Register label with object (possibly disamgiguating) :param obj: The object to label :param label: The desired label :param group: (optional) use the registry for group (default=type(obj)) :rtype: str *Returns* The disambiguated label """ group = group or type(obj) reg = self._registry[group] has_obj = obj in reg has_label = label in reg.values() label_is_obj = has_label and has_obj and reg[obj] == label if has_label and (not label_is_obj): values = set(reg.values()) if has_obj: values.remove(reg[obj]) if not self._disable: label = disambiguate(label, values) reg[obj] = label return label def unregister(self, obj, group=None): group = group or type(obj) reg = self._registry[group] if obj in reg: reg.pop(obj) def clear(self): """ Reset registry, clearing all stored values """ self._registry = defaultdict(dict) def disable(func): """ Decorator to temporarily disable disambiguation """ @wraps(func) def wrapper(*args, **kwargs): r = Registry() old = r._disable r._disable = True try: return func(*args, **kwargs) finally: r._disable = old return wrapper
{ "content_hash": "d33f48184f0769272f8f2f34ec6781bd", "timestamp": "", "source": "github", "line_count": 113, "max_line_length": 79, "avg_line_length": 27.451327433628318, "alnum_prop": 0.5947775628626693, "repo_name": "bsipocz/glue", "id": "148166ed138465b5d67fd0fd58c87727679ddfff", "size": "3102", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "glue/core/registry.py", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
using System.Web; using System.Web.Optimization; namespace NumericSequenceCalculator { public class BundleConfig { // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862 public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/bundles/jquery").Include( "~/Scripts/jquery-{version}.js")); bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate*")); // Use the development version of Modernizr to develop with and learn from. Then, when you're // ready for production, use the build tool at http://modernizr.com to pick only the tests you need. bundles.Add(new ScriptBundle("~/bundles/modernizr").Include( "~/Scripts/modernizr-*")); bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include( "~/Scripts/bootstrap.js", "~/Scripts/respond.js")); bundles.Add(new StyleBundle("~/Content/css").Include( "~/Content/bootstrap.css", "~/Content/site.css")); } } }
{ "content_hash": "463e9c9bf5b190adb8f3417d8936d3bb", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 112, "avg_line_length": 40.45161290322581, "alnum_prop": 0.5781499202551834, "repo_name": "hackerg/NumericSequenceCalculator", "id": "92c0460088e1d79799000c8700cca5d1ecb4ccd2", "size": "1256", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "NumericSequenceCalculator/App_Start/BundleConfig.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "116" }, { "name": "C#", "bytes": "26657" }, { "name": "CSS", "bytes": "630" }, { "name": "HTML", "bytes": "5127" }, { "name": "JavaScript", "bytes": "10918" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <style type="text/css"> #float { float: right; width: 100px; height: 100px; background-color: blue; } #static { margin-bottom: 40px; height: 20px; background-color: green; } #clear { margin-top: 40px; clear: both; height: 20px; background-color: green; } </style> </head> <body> <div id="float"></div> <div id="static"></div> <div id="clear"></div> </body> </html>
{ "content_hash": "910455cd1f27f3db079145ea3e7dcb79", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 29, "avg_line_length": 14.464285714285714, "alnum_prop": 0.6419753086419753, "repo_name": "sergecodd/FireFox-OS", "id": "08037c1ea4757d9205593a355fc1c5d5e04d16a5", "size": "405", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "B2G/gecko/layout/reftests/margin-collapsing/block-clear-3d.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ada", "bytes": "443" }, { "name": "ApacheConf", "bytes": "85" }, { "name": "Assembly", "bytes": "5123438" }, { "name": "Awk", "bytes": "46481" }, { "name": "Batchfile", "bytes": "56250" }, { "name": "C", "bytes": "101720951" }, { "name": "C#", "bytes": "38531" }, { "name": "C++", "bytes": "148896543" }, { "name": "CMake", "bytes": "23541" }, { "name": "CSS", "bytes": "2758664" }, { "name": "DIGITAL Command Language", "bytes": "56757" }, { "name": "Emacs Lisp", "bytes": "12694" }, { "name": "Erlang", "bytes": "889" }, { "name": "FLUX", "bytes": "34449" }, { "name": "GLSL", "bytes": "26344" }, { "name": "Gnuplot", "bytes": "710" }, { "name": "Groff", "bytes": "447012" }, { "name": "HTML", "bytes": "43343468" }, { "name": "IDL", "bytes": "1455122" }, { "name": "Java", "bytes": "43261012" }, { "name": "JavaScript", "bytes": "46646658" }, { "name": "Lex", "bytes": "38358" }, { "name": "Logos", "bytes": "21054" }, { "name": "Makefile", "bytes": "2733844" }, { "name": "Matlab", "bytes": "67316" }, { "name": "Max", "bytes": "3698" }, { "name": "NSIS", "bytes": "421625" }, { "name": "Objective-C", "bytes": "877657" }, { "name": "Objective-C++", "bytes": "737713" }, { "name": "PHP", "bytes": "17415" }, { "name": "Pascal", "bytes": "6780" }, { "name": "Perl", "bytes": "1153180" }, { "name": "Perl6", "bytes": "1255" }, { "name": "PostScript", "bytes": "1139" }, { "name": "PowerShell", "bytes": "8252" }, { "name": "Protocol Buffer", "bytes": "26553" }, { "name": "Python", "bytes": "8453201" }, { "name": "Ragel in Ruby Host", "bytes": "3481" }, { "name": "Ruby", "bytes": "5116" }, { "name": "Scilab", "bytes": "7" }, { "name": "Shell", "bytes": "3383832" }, { "name": "SourcePawn", "bytes": "23661" }, { "name": "TeX", "bytes": "879606" }, { "name": "WebIDL", "bytes": "1902" }, { "name": "XSLT", "bytes": "13134" }, { "name": "Yacc", "bytes": "112744" } ], "symlink_target": "" }
env response cache positive with env message --SKIPIF-- <?php include "skipif.inc"; ?> --GET-- dummy=1 --FILE-- <?php $e = new http\Env\Request; $e->setHeader("If-Modified-Since", "Fri, 13 Feb 2009 23:31:32 GMT"); $r = new http\Env\Response; $r->setEnvRequest($e); $r->setBody(new http\Message\Body(fopen(__FILE__,"rb"))); $r->setEtag("abc"); $r->setLastModified(1234567891); $r->isCachedByEtag("If-None-Match") and die("Huh? etag? really?\n"); $r->isCachedByLastModified("If-Modified-Since") or die("yep, I should be cached"); $r->send(); ?> --EXPECTHEADERS-- HTTP/1.1 304 Not Modified ETag: "abc" Last-Modified: Fri, 13 Feb 2009 23:31:31 GMT --EXPECT--
{ "content_hash": "8a4f96649224133f4fc9f53b1d2e2309", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 82, "avg_line_length": 28.47826086956522, "alnum_prop": 0.6748091603053435, "repo_name": "m6w6/ext-http", "id": "45e2f6e7971c6cc5b96b1d7354e9b43c7462f906", "size": "664", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "tests/envresponse011.phpt", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "830476" }, { "name": "HTML", "bytes": "136" }, { "name": "M4", "bytes": "30301" }, { "name": "Makefile", "bytes": "611" }, { "name": "PHP", "bytes": "227649" }, { "name": "Shell", "bytes": "1031" } ], "symlink_target": "" }
@interface PodsDummy_Pods_YTPageController_Tests : NSObject @end @implementation PodsDummy_Pods_YTPageController_Tests @end
{ "content_hash": "0ae076c8f6b632d290bcd0f8786828be", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 59, "avg_line_length": 31, "alnum_prop": 0.8467741935483871, "repo_name": "yeatse/YTPageController", "id": "d1ed862e079b6ce376c751c13c40091b1e25e228", "size": "158", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Example/Pods/Target Support Files/Pods-YTPageController_Tests/Pods-YTPageController_Tests-dummy.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "71440" }, { "name": "Ruby", "bytes": "1723" }, { "name": "Shell", "bytes": "17669" }, { "name": "Swift", "bytes": "15046" } ], "symlink_target": "" }
package bookshop2.supplier.client.reserveBooks; import org.aries.bean.Proxy; import org.aries.tx.service.rmi.RMIProxy; public class ReserveBooksProxyForRMI extends RMIProxy implements Proxy<ReserveBooks> { private ReserveBooksInterceptor reserveBooksInterceptor; public ReserveBooksProxyForRMI(String serviceId, String host, int port) { super(serviceId, host, port); createDelegate(); } protected void createDelegate() { reserveBooksInterceptor = new ReserveBooksInterceptor(); reserveBooksInterceptor.setProxy(this); } @Override public ReserveBooks getDelegate() { return reserveBooksInterceptor; } }
{ "content_hash": "beba828105eb2e5c917d8e8b5b31ec83", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 86, "avg_line_length": 22.75, "alnum_prop": 0.7880690737833596, "repo_name": "tfisher1226/ARIES", "id": "2ee9a4086573f6386998fd2dbbb758b3eecbd2d9", "size": "637", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "bookshop2/bookshop2-supplier/bookshop2-supplier-client/src/main/java/bookshop2/supplier/client/reserveBooks/ReserveBooksProxyForRMI.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1606" }, { "name": "CSS", "bytes": "660469" }, { "name": "Common Lisp", "bytes": "91717" }, { "name": "Emacs Lisp", "bytes": "12403" }, { "name": "GAP", "bytes": "86009" }, { "name": "HTML", "bytes": "9381408" }, { "name": "Java", "bytes": "25671734" }, { "name": "JavaScript", "bytes": "304513" }, { "name": "Shell", "bytes": "51942" } ], "symlink_target": "" }
package ae3.service.experiment; import com.google.common.base.Supplier; import com.google.common.collect.Multimap; import com.google.common.collect.Multimaps; import java.util.*; /** * Atlas Experiment API query container class. Can be populated StringBuilder-style and converted to SOLR query string * * @author Pavel Kurnosov */ public class AtlasExperimentQuery { private int rows; private int start; private boolean all; private final List<String> experimentKeywords = new ArrayList<String>(); private final List<String> factors = new ArrayList<String>(); private final List<String> anyFactorValues = new ArrayList<String>(); private final Multimap<String, String> factorValues = Multimaps.newListMultimap( new HashMap<String, Collection<String>>(), new Supplier<List<String>>() { @Override public List<String> get() { return new ArrayList<String>(); } } ); private final List<String> geneIdentifiers = new ArrayList<String>(); /** * @return <code>true</code> if the query should return list of all experiments */ public boolean isListAll() { return all; } /** * @return collection of keywords to search experiments with */ public Collection<String> getExperimentKeywords() { return Collections.unmodifiableCollection(experimentKeywords); } /** * @return collection of factors to search experiments with */ public Collection<String> getFactors() { return Collections.unmodifiableCollection(factors); } /** * @return collection of gene identifiers to return with experiments */ public Collection<String> getGeneIdentifiers() { return Collections.unmodifiableCollection(geneIdentifiers); } /** * @return factor -> values multimap to search experiments with */ public Multimap<String, String> getFactorValues() { return Multimaps.unmodifiableMultimap(factorValues); } /** * @return collection of a factor values to search experiments with */ public List<String> getAnyFactorValues() { return anyFactorValues; } /** * @return number of experiments to fetch */ public int getRows() { return rows; } /** * @return start position for results */ public int getStart() { return start; } public boolean hasExperimentKeywords() { return !experimentKeywords.isEmpty(); } public boolean hasFactors() { return !factors.isEmpty(); } public boolean hasAnyFactorValues() { return !anyFactorValues.isEmpty(); } public boolean hasFactorValues() { return !factorValues.isEmpty(); } /** * @return <code>true</code> if the query is valid */ public boolean isValid() { return all || hasExperimentKeywords() || hasFactors() || hasAnyFactorValues() || hasFactorValues(); } @Override public String toString() { StringBuilder sb = new StringBuilder() .append("AtlasExperimentQuery{") .append("rows=").append(rows) .append(", start=").append(start) .append(", all=").append(all) .append(", experimentKeywords=").append(Arrays.toString(experimentKeywords.toArray(new String[experimentKeywords.size()]))) .append(", factors=").append(Arrays.toString(factors.toArray(new String[factors.size()]))) .append(", anyFactorValues=").append(Arrays.toString(anyFactorValues.toArray(new String[anyFactorValues.size()]))) .append(", geneIdentifiers=").append(Arrays.toString(geneIdentifiers.toArray(new String[geneIdentifiers.size()]))) .append(", factorValues={"); for (String key : factorValues.keySet()) { Collection<String> values = factorValues.get(key); sb.append(key).append(":").append(Arrays.toString(values.toArray(new String[values.size()]))).append(";"); } return sb.append("}}").toString(); } public static class Builder { private final AtlasExperimentQuery query = new AtlasExperimentQuery(); public void setListAll() { query.all = true; query.rows = Integer.MAX_VALUE; } public void withExperimentKeywords(Collection<String> keywords) { query.experimentKeywords.addAll(keywords); } public void withFactors(Collection<String> factors) { query.factors.addAll(factors); } public void withGeneIdentifiers(Collection<String> genes) { query.geneIdentifiers.addAll(genes); } public void withFactorValues(String factor, Collection<String> values) { query.factorValues.putAll(factor, values); } public void withAnyFactorValues(Collection<String> values) { query.anyFactorValues.addAll(values); } public void setRows(int rows) { query.rows = rows; } public void setStart(int start) { query.start = start; } public AtlasExperimentQuery toQuery() { return query; } } }
{ "content_hash": "354faf30adab9f4016964597ac3233fb", "timestamp": "", "source": "github", "line_count": 182, "max_line_length": 139, "avg_line_length": 29.692307692307693, "alnum_prop": 0.6134344929681718, "repo_name": "gxa/gxa", "id": "f59ac7deaa78f54091cc09246b3f3553c03190e8", "size": "6221", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "atlas-web/src/main/java/ae3/service/experiment/AtlasExperimentQuery.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "445" }, { "name": "CSS", "bytes": "89300" }, { "name": "HTML", "bytes": "48536" }, { "name": "Java", "bytes": "3276095" }, { "name": "JavaScript", "bytes": "832587" }, { "name": "PLSQL", "bytes": "135800" }, { "name": "PLpgSQL", "bytes": "725" }, { "name": "R", "bytes": "50308" }, { "name": "SQLPL", "bytes": "18791" }, { "name": "Shell", "bytes": "58956" }, { "name": "Web Ontology Language", "bytes": "16906423" }, { "name": "XSLT", "bytes": "49061" } ], "symlink_target": "" }
import time import pyrabbit from pika.adapters.tornado_connection import TornadoConnection from pika.channel import Channel from tornado.testing import AsyncTestCase from testfixtures import LogCapture from pikachewie.agent import ConsumerAgent from pikachewie.broker import Broker from pikachewie.consumer import Consumer from pikachewie.utils import cached_property from tests import _BaseTestCase, LoggingConsumer class DescribeConsumerAgent(_BaseTestCase): def configure(self): self.consumer = Consumer() self.broker = Broker() self.bindings = [('myqueue', 'myexchange', 'my.routing.key')] def execute(self): self.agent = ConsumerAgent(self.consumer, self.broker, self.bindings) def should_have_consumer(self): self.assertIs(self.agent.consumer, self.consumer) def should_have_broker(self): self.assertIs(self.agent.broker, self.broker) def should_have_bindings(self): self.assertIs(self.agent.bindings, self.bindings) class MockAgent(ConsumerAgent): def __init__(self, broker, consumer, bindings, no_ack=False, config=None, stop_callback=None): super(MockAgent, self).__init__(broker, consumer, bindings, no_ack, config) self._stop = stop_callback def start_consuming(self, queue): super(MockAgent, self).start_consuming(queue) if self._stop: self._stop() def process(self, channel, method, header, body): super(MockAgent, self).process(channel, method, header, body) if self._stop: self._stop(body) class AsyncAgentTestCase(AsyncTestCase): host = 'localhost' user = 'guest' virtual_host = '/integration' admin = pyrabbit.api.Client(host + ':15672', user, 'guest') broker = Broker({'rabbitmq': {'host': host}}, {'virtual_host': virtual_host}) consumer = LoggingConsumer() bindings = ( { 'queue': 'my.queue', 'exchange': 'my.exchange', 'routing_key': 'my.routing.key', }, ) config = { 'exchanges': {'my.exchange': {'exchange_type': 'topic', 'durable': True}}, 'queues': {'my.queue': {'durable': True, 'arguments': {'x-ha-policy': 'all'}}}, } payload = "It's not wise to upset a Wookie." def get_new_ioloop(self): return self.agent.connection.ioloop @cached_property def agent(self): agent = MockAgent(self.consumer, self.broker, self.bindings, False, self.config, stop_callback=self.stop) agent.connect() return agent @property def escaped_vhost(self): return self.virtual_host.replace('/', '%2F') def setUp(self): self._cleanup_virtual_host() self._init_virtual_host() super(AsyncAgentTestCase, self).setUp() self.wait() def tearDown(self): super(AsyncAgentTestCase, self).tearDown() self._cleanup_virtual_host() del self.agent def _cleanup_virtual_host(self): if self.virtual_host in self.admin.get_vhost_names(): self.admin.delete_vhost(self.escaped_vhost) def _init_virtual_host(self): self.admin.create_vhost(self.escaped_vhost) self.admin.set_vhost_permissions(self.escaped_vhost, self.user, config='.*', rd='.*', wr='.*') def _poll_queue_statistics(self, queue, callback): attempts = 10 for i in range(attempts): queue_stats = self.admin.get_queue(self.escaped_vhost, queue) if callback(queue_stats): return queue_stats time.sleep(1) raise AssertionError('Callback condition not satisfied after %d ' 'attempts in _poll_queue_statistics' % attempts) class WhenConnectingToBroker(AsyncAgentTestCase): def setUp(self): super(WhenConnectingToBroker, self).setUp() assert self.admin.publish(self.escaped_vhost, 'my.exchange', 'my.routing.key', self.payload) with LogCapture('tests.LoggingConsumer') as self.consumer_logs: self.message_body = self.wait() def should_set_connection(self): self.assertIsInstance(self.agent.connection, TornadoConnection) def should_set_channel(self): self.assertIsInstance(self.agent.channel, Channel) def should_create_exchange(self): self.assertIsNotNone(self.get_exchange()) def should_set_exchange_type(self): self.assertEqual(self.get_exchange()['type'], 'topic') def should_set_exchange_parameters(self): self.assertTrue(self.get_exchange()['durable']) def should_create_queue(self): self.assertIsNotNone(self.get_queue()) def should_set_queue_parameters(self): self.assertTrue(self.get_queue()['durable']) def should_set_queue_arguments(self): self.assertEqual(self.get_queue()['arguments'], {'x-ha-policy': 'all'}) def should_create_queue_binding(self): expected = self.bindings[0] bindings = self.admin.get_queue_bindings(self.escaped_vhost, 'my.queue') for binding in bindings: if binding['routing_key'] == expected['routing_key'] and \ binding['source'] == expected['exchange']: # expected queue binding exists, thus the test is successful return raise AssertionError('Expected queue binding does not exist: %s' % expected) def should_start_consuming_from_queue(self): has_consumers = lambda queue_stats: 'consumers' in queue_stats and \ queue_stats['consumers'] > 0 queue_stats = self._poll_queue_statistics('my.queue', has_consumers) self.assertEqual(queue_stats['consumers'], 1) self.assertEqual(queue_stats['consumer_details'][0]['consumer_tag'], self.agent._consumer_tags['my.queue']) def should_consume_message(self): self.assertEqual(self.message_body, self.payload) def should_dispatch_message_processing_to_consumer(self): self.consumer_logs.check(('tests.LoggingConsumer', 'INFO', 'Processed message: ' + self.payload)) def get_exchange(self): return self.admin.get_exchange(self.escaped_vhost, 'my.exchange') def get_queue(self): return self.admin.get_queue(self.escaped_vhost, 'my.queue')
{ "content_hash": "107080e448331f8317f5faabb9217d3f", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 77, "avg_line_length": 35.33684210526316, "alnum_prop": 0.6072386058981233, "repo_name": "bdeeney/PikaChewie", "id": "0962942f3ae4e623faa59c2081f8f24cbedc75b2", "size": "6714", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/integration/test_agent.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "135910" } ], "symlink_target": "" }
typedef amici::realtype realtype; #include <cmath> using namespace amici; namespace amici { namespace model_model_neuron_o2{ void w_model_neuron_o2(realtype *w, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *tcl) { w[0] = x[0]*(2.0/2.5E1); w[1] = w[0]+5.0; } } // namespace model_model_neuron_o2 } // namespace amici
{ "content_hash": "29c42d89b0bc82149a66254a724b06c0", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 152, "avg_line_length": 21.77777777777778, "alnum_prop": 0.6887755102040817, "repo_name": "FFroehlich/AMICI", "id": "4f49da479be81079381f7f53909cc088a25ac921", "size": "480", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "models/model_neuron_o2/model_neuron_o2_w.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "6507412" }, { "name": "C++", "bytes": "4515" }, { "name": "CMake", "bytes": "89132" }, { "name": "FORTRAN", "bytes": "115964" }, { "name": "Makefile", "bytes": "196218" }, { "name": "Matlab", "bytes": "436730" }, { "name": "Perl", "bytes": "9412" }, { "name": "TeX", "bytes": "131408" } ], "symlink_target": "" }
/* $Id: sph_sha1.h 216 2010-06-08 09:46:57Z tp $ */ /** * SHA-1 interface. * * SHA-1 is described in FIPS 180-1 (now superseded by FIPS 180-2, but the * description of SHA-1 is still included and has not changed). FIPS * standards can be found at: http://csrc.nist.gov/publications/fips/ * * @warning A theoretical collision attack against SHA-1, with work * factor 2^63, has been published. SHA-1 should not be used in new * protocol designs. * * ==========================(LICENSE BEGIN)============================ * * Copyright (c) 2007-2010 Projet RNRT SAPHIR * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * ===========================(LICENSE END)============================= * * @file sph_sha1.h * @author Thomas Pornin <thomas.pornin@cryptolog.com> */ #ifndef SPH_SHA1_H__ #define SPH_SHA1_H__ #include <stddef.h> #include "sph_types.h" #ifdef __cplusplus extern "C"{ #endif /** * Output size (in bits) for SHA-1. */ #define SPH_SIZE_sha1 160 /** * This structure is a context for SHA-1 computations: it contains the * intermediate values and some data from the last entered block. Once * a SHA-1 computation has been performed, the context can be reused for * another computation. * * The contents of this structure are private. A running SHA-1 computation * can be cloned by copying the context (e.g. with a simple * <code>memcpy()</code>). */ typedef struct { #ifndef DOXYGEN_IGNORE unsigned char buf[64]; /* first field, for alignment */ sph_u32 val[5]; #if SPH_64 sph_u64 count; #else sph_u32 count_high, count_low; #endif #endif } sph_sha1_context; /** * Initialize a SHA-1 context. This process performs no memory allocation. * * @param cc the SHA-1 context (pointer to a <code>sph_sha1_context</code>) */ void sph_sha1_init(void *cc); /** * Process some data bytes. It is acceptable that <code>len</code> is zero * (in which case this function does nothing). * * @param cc the SHA-1 context * @param data the input data * @param len the input data length (in bytes) */ void sph_sha1(void *cc, const void *data, size_t len); /** * Terminate the current SHA-1 computation and output the result into the * provided buffer. The destination buffer must be wide enough to * accomodate the result (20 bytes). The context is automatically * reinitialized. * * @param cc the SHA-1 context * @param dst the destination buffer */ void sph_sha1_close(void *cc, void *dst); /** * Add a few additional bits (0 to 7) to the current computation, then * terminate it and output the result in the provided buffer, which must * be wide enough to accomodate the result (20 bytes). If bit number i * in <code>ub</code> has value 2^i, then the extra bits are those * numbered 7 downto 8-n (this is the big-endian convention at the byte * level). The context is automatically reinitialized. * * @param cc the SHA-1 context * @param ub the extra bits * @param n the number of extra bits (0 to 7) * @param dst the destination buffer */ void sph_sha1_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst); /** * Apply the SHA-1 compression function on the provided data. The * <code>msg</code> parameter contains the 16 32-bit input blocks, * as numerical values (hence after the big-endian decoding). The * <code>val</code> parameter contains the 5 32-bit input blocks for * the compression function; the output is written in place in this * array. * * @param msg the message block (16 values) * @param val the function 160-bit input and output */ void sph_sha1_comp(const sph_u32 msg[16], sph_u32 val[5]); #ifdef __cplusplus } #endif #endif
{ "content_hash": "7fb2ac6c6e0448b600af1acd71f41271", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 78, "avg_line_length": 33.67857142857143, "alnum_prop": 0.6943796394485684, "repo_name": "galaxycash/galaxycash", "id": "34c8787a4a5a896f8e2bf23198f83fab6c31f471", "size": "4715", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/crypto/sph_sha1.h", "mode": "33261", "license": "mit", "language": [ { "name": "Assembly", "bytes": "28453" }, { "name": "C", "bytes": "979081" }, { "name": "C++", "bytes": "7789333" }, { "name": "HTML", "bytes": "20970" }, { "name": "Java", "bytes": "30291" }, { "name": "M4", "bytes": "194790" }, { "name": "Makefile", "bytes": "113826" }, { "name": "Objective-C", "bytes": "3274" }, { "name": "Objective-C++", "bytes": "6766" }, { "name": "Python", "bytes": "198483" }, { "name": "QMake", "bytes": "759" }, { "name": "Roff", "bytes": "24267" }, { "name": "Ruby", "bytes": "1036" }, { "name": "Shell", "bytes": "79150" } ], "symlink_target": "" }
namespace urde { class CCharacterFactory; class CAnimRes; class CCharacterFactoryBuilder { public: class CDummyFactory : public IFactory { public: CFactoryFnReturn Build(const SObjectTag&, const CVParamTransfer&, CObjectReference* selfRef) override; void BuildAsync(const SObjectTag&, const CVParamTransfer&, std::unique_ptr<IObj>*, CObjectReference* selfRef) override; void CancelBuild(const SObjectTag&) override; bool CanBuild(const SObjectTag&) override; const SObjectTag* GetResourceIdByName(std::string_view) const override; FourCC GetResourceTypeById(CAssetId id) const override; void EnumerateResources(const std::function<bool(const SObjectTag&)>& lambda) const override; void EnumerateNamedResources(const std::function<bool(std::string_view, const SObjectTag&)>& lambda) const override; u32 ResourceSize(const urde::SObjectTag& tag) override; std::shared_ptr<IDvdRequest> LoadResourceAsync(const urde::SObjectTag& tag, void* target) override; std::shared_ptr<IDvdRequest> LoadResourcePartAsync(const urde::SObjectTag& tag, u32 off, u32 size, void* target) override; std::unique_ptr<u8[]> LoadResourceSync(const urde::SObjectTag& tag) override; std::unique_ptr<u8[]> LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size) override; }; private: CDummyFactory x0_dummyFactory; CSimplePool x4_dummyStore; public: CCharacterFactoryBuilder(); TToken<CCharacterFactory> GetFactory(const CAnimRes& res); }; } // namespace urde
{ "content_hash": "710c21c67a6cc666d94831f9b46b1268", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 120, "avg_line_length": 43.08108108108108, "alnum_prop": 0.7314930991217063, "repo_name": "RetroView/PathShagged", "id": "38eebb02621d1f2c2d002796698d10ccdedc8f5d", "size": "1702", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Runtime/Character/CAssetFactory.hpp", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "30964" }, { "name": "C++", "bytes": "1853098" }, { "name": "CMake", "bytes": "25640" }, { "name": "Python", "bytes": "29052" } ], "symlink_target": "" }
FROM balenalib/beaglebone-black-ubuntu:bionic-build # remove several traces of debian python RUN apt-get purge -y python.* # http://bugs.python.org/issue19846 # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. ENV LANG C.UTF-8 # key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported # key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \ && gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \ && gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059 ENV PYTHON_VERSION 3.8.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" ENV PYTHON_PIP_VERSION 21.3.1 ENV SETUPTOOLS_VERSION 60.5.4 RUN set -x \ && curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" \ && echo "1caf0609337bf86be785a9a5d17893b06499db0acd992d9cbf3ce61e7bf92eb2 Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" | sha256sum -c - \ && tar -xzf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" --strip-components=1 \ && rm -rf "Python-$PYTHON_VERSION.linux-armv7hf-libffi3.2.tar.gz" \ && ldconfig \ && if [ ! -e /usr/local/bin/pip3 ]; then : \ && curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \ && echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \ && python3 get-pip.py \ && rm get-pip.py \ ; fi \ && pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \ && find /usr/local \ \( -type d -a -name test -o -name tests \) \ -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ -exec rm -rf '{}' + \ && cd / \ && rm -rf /usr/src/python ~/.cache # install "virtualenv", since the vast majority of users of this image will want it RUN pip3 install --no-cache-dir virtualenv ENV PYTHON_DBUS_VERSION 1.2.18 # install dbus-python dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ libdbus-1-dev \ libdbus-glib-1-dev \ && rm -rf /var/lib/apt/lists/* \ && apt-get -y autoremove # install dbus-python RUN set -x \ && mkdir -p /usr/src/dbus-python \ && curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \ && curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \ && gpg --verify dbus-python.tar.gz.asc \ && tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \ && rm dbus-python.tar.gz* \ && cd /usr/src/dbus-python \ && PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \ && make -j$(nproc) \ && make install -j$(nproc) \ && cd / \ && rm -rf /usr/src/dbus-python # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ && ln -sf pip3 pip \ && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -sf idle3 idle \ && ln -sf pydoc3 pydoc \ && ln -sf python3 python \ && ln -sf python3-config python-config # set PYTHONPATH to point to dist-packages ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"] RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \ && echo "Running test-stack@python" \ && chmod +x test-stack@python.sh \ && bash test-stack@python.sh \ && rm -rf test-stack@python.sh RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v7 \nOS: Ubuntu bionic \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.8.12, Pip v21.3.1, Setuptools v60.5.4 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \ && chmod +x /bin/sh-shim \ && cp /bin/sh /bin/sh.real \ && mv /bin/sh-shim /bin/sh
{ "content_hash": "ccadceb52592157f7daebd89dcc26ae7", "timestamp": "", "source": "github", "line_count": 95, "max_line_length": 711, "avg_line_length": 50.68421052631579, "alnum_prop": 0.704257528556594, "repo_name": "resin-io-library/base-images", "id": "f8a856a18b6b84cd4b8b96abea8e3da01026c2cc", "size": "4836", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "balena-base-images/python/beaglebone-black/ubuntu/bionic/3.8.12/build/Dockerfile", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Dockerfile", "bytes": "71234697" }, { "name": "JavaScript", "bytes": "13096" }, { "name": "Shell", "bytes": "12051936" }, { "name": "Smarty", "bytes": "59789" } ], "symlink_target": "" }
import rospy import tf from gazebo_msgs.msg import ModelStates from visualization_msgs.msg import Marker from geometry_msgs.msg import Quaternion, Pose from gazebo_msgs.msg import LinkStates import tf_conversions.posemath as pm from tf.transformations import * from nav_msgs.msg import Odometry from conversions import link2marker_msg import pysdf import time class Gazebo2Rviz: def __init__(self): self.rate = rospy.get_param('~rate', 10.0) # the rate at which to publish the transform self.submodelsToBeIgnored = rospy.get_param('~ignore_submodels_of', '').split(';') # publish odometry self.link_odometry = rospy.get_param('~link_odometry', "") self.topic_odometry = rospy.get_param('~topic_odometry', "odom") self.pub_odom = rospy.Publisher(self.topic_odometry, Odometry, queue_size=1) self.seq = 0 self.tfBroadcaster = tf.TransformBroadcaster() self.link_states_msg = None self.model_states_msg = None self.model_cache = {} self.updatePeriod = 1. / self.rate self.enable_publisher_marker = False self.enable_publisher_tf = False self.markerPub = rospy.Publisher('/model_marker', Marker, queue_size=10) self.modelStatesSub = rospy.Subscriber('gazebo/model_states', ModelStates, self.on_model_states_msg, queue_size=1) self.linkStatesSub = rospy.Subscriber('gazebo/link_states', LinkStates, self.on_link_states_msg, queue_size=1) rate_sleep = rospy.Rate(self.rate) # Main while loop while not rospy.is_shutdown(): if self.enable_publisher_marker and self.enable_publisher_tf: self.publish_tf() self.publish_marker() time.sleep(1/self.rate) # rate_sleep.sleep() def publish_marker(self): for (model_idx, modelinstance_name) in enumerate(self.model_states_msg.name): # print(model_idx, modelinstance_name) model_name = pysdf.name2modelname(modelinstance_name) # print('model_name:', model_name) if not model_name in self.model_cache: sdf = pysdf.SDF(model=model_name) self.model_cache[model_name] = sdf.world.models[0] if len(sdf.world.models) >= 1 else None if not self.model_cache[model_name]: print('Unable to load model: %s' % model_name) model = self.model_cache[model_name] if not model: # Not an SDF model continue # print('model:', model) model.for_all_links(self.publish_link_marker, model_name=model_name, instance_name=modelinstance_name) def publish_link_marker(self, link, full_linkname, **kwargs): full_linkinstancename = full_linkname if 'model_name' in kwargs and 'instance_name' in kwargs: full_linkinstancename = full_linkinstancename.replace(kwargs['model_name'], kwargs['instance_name'], 1) marker_msgs = link2marker_msg(link, full_linkinstancename, False, rospy.Duration()) if len(marker_msgs) > 0: for marker_msg in marker_msgs: self.markerPub.publish(marker_msg) def on_model_states_msg(self, model_states_msg): # save model states self.model_states_msg = model_states_msg self.enable_publisher_marker = True def on_link_states_msg(self, link_states_msg): self.link_states_msg = link_states_msg self.enable_publisher_tf = True def publish_tf(self): model_cache = {} poses = {'gazebo_world': identity_matrix()} for (link_idx, link_name) in enumerate(self.link_states_msg.name): poses[link_name] = pysdf.pose_msg2homogeneous(self.link_states_msg.pose[link_idx]) # print('%s:\n%s' % (link_name, poses[link_name])) for (link_idx, link_name) in enumerate(self.link_states_msg.name): # print(link_idx, link_name) modelinstance_name = link_name.split('::')[0] # print('modelinstance_name:', modelinstance_name) model_name = pysdf.name2modelname(modelinstance_name) # print('model_name:', model_name) if not model_name in model_cache: sdf = pysdf.SDF(model=model_name) model_cache[model_name] = sdf.world.models[0] if len(sdf.world.models) >= 1 else None if not model_cache[model_name]: print('Unable to load model: %s' % model_name) model = model_cache[model_name] link_name_in_model = link_name.replace(modelinstance_name + '::', '') if model: link = model.get_link(link_name_in_model) if link.tree_parent_joint: parent_link = link.tree_parent_joint.tree_parent_link parent_link_name = parent_link.get_full_name() # print('parent:', parent_link_name) parentinstance_link_name = parent_link_name.replace(model_name, modelinstance_name, 1) else: # direct child of world parentinstance_link_name = 'gazebo_world' else: # Not an SDF model parentinstance_link_name = 'gazebo_world' # print('parentinstance:', parentinstance_link_name) pose = poses[link_name] #parent_pose = pysdf.pose_msg2homogeneous(self.model_states_msg.pose[1]) parent_pose = poses[parentinstance_link_name] rel_tf = concatenate_matrices(inverse_matrix(parent_pose), pose) translation, quaternion = pysdf.homogeneous2translation_quaternion(rel_tf) # print('Publishing TF %s -> %s: t=%s q=%s' % (pysdf.sdf2tfname(parentinstance_link_name), pysdf.sdf2tfname(link_name), translation, quaternion)) self.tfBroadcaster.sendTransform(translation, quaternion, rospy.get_rostime(), pysdf.sdf2tfname(link_name), pysdf.sdf2tfname(parentinstance_link_name)) if self.link_odometry == pysdf.sdf2tfname(link_name): self.publish_odometry(translation, quaternion, pysdf.sdf2tfname(link_name), pysdf.sdf2tfname(parentinstance_link_name)) def publish_odometry(self, translation, quaternion, child, parent): odom = Odometry() odom.header.stamp = rospy.Time.now() odom.header.frame_id = parent odom.child_frame_id = child odom.header.seq = self.seq odom.pose.pose.position.x = translation[0] odom.pose.pose.position.y = translation[1] odom.pose.pose.position.z = translation[2] quat = Quaternion() quat.x = quaternion[0] quat.y = quaternion[1] quat.z = quaternion[2] quat.w = quaternion[3] odom.pose.pose.orientation = quat self.pub_odom.publish(odom) self.seq += 1 # Main function. if __name__ == '__main__': # Initialize the node and name it. rospy.init_node('Gazebo2Rviz') # Go to class functions that do all the heavy lifting. Do error checking. try: asd = Gazebo2Rviz() except rospy.ROSInterruptException: pass
{ "content_hash": "266348ddac32f6643d829e2aa5a7b29c", "timestamp": "", "source": "github", "line_count": 163, "max_line_length": 157, "avg_line_length": 44.17791411042945, "alnum_prop": 0.6194972920427718, "repo_name": "francisc0garcia/autonomous_bicycle", "id": "08ac7adbd9ad948da5e7c580aa56ff881d74b83f", "size": "7340", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "scripts/gazebo2rviz.py", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Arduino", "bytes": "4940" }, { "name": "C++", "bytes": "38747" }, { "name": "CMake", "bytes": "2602" }, { "name": "CSS", "bytes": "5959" }, { "name": "HTML", "bytes": "51257" }, { "name": "JavaScript", "bytes": "47563" }, { "name": "Python", "bytes": "208841" }, { "name": "Shell", "bytes": "288" } ], "symlink_target": "" }
using System; using System.Collections.Specialized; using System.Web; using System.Web.Helpers; using System.Web.Routing; namespace RestfulRouting { public class RestfulHttpMethodConstraint : HttpMethodConstraint { public RestfulHttpMethodConstraint(params string[] allowedMethods) : base(allowedMethods) { } protected override bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { switch (routeDirection) { case RouteDirection.IncomingRequest: foreach (var method in AllowedMethods) { if (String.Equals(method, httpContext.Request.HttpMethod, StringComparison.OrdinalIgnoreCase)) return true; // fixes issues #62 and #63 NameValueCollection form; try { // first try to get the unvalidated form first form = httpContext.Request.Unvalidated().Form; } catch (Exception e) { form = httpContext.Request.Form; } if (form == null) continue; var overridden = form["_method"] ?? form["X-HTTP-Method-Override"]; if (String.Equals(method, overridden, StringComparison.OrdinalIgnoreCase)) { return true; } } break; } return base.Match(httpContext, route, parameterName, values, routeDirection); } } }
{ "content_hash": "10cee8072d183aa255074ef7571a6f2a", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 161, "avg_line_length": 35.94230769230769, "alnum_prop": 0.49919743178170145, "repo_name": "restful-routing/restful-routing", "id": "a415dbfeafccc9a4590ff2be64fac21fd93dd661", "size": "1871", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/RestfulRouting/RestfulHttpMethodConstraint.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "119" }, { "name": "C#", "bytes": "249650" }, { "name": "CSS", "bytes": "6278" }, { "name": "JavaScript", "bytes": "84733" }, { "name": "Pascal", "bytes": "1690" }, { "name": "Ruby", "bytes": "1774" } ], "symlink_target": "" }
namespace mx { namespace core { MX_FORWARD_DECLARE_ELEMENT( Volume ) inline VolumePtr makeVolume() { return std::make_shared<Volume>(); } inline VolumePtr makeVolume( const Percent& value ) { return std::make_shared<Volume>( value ); } inline VolumePtr makeVolume( Percent&& value ) { return std::make_shared<Volume>( std::move( value ) ); } class Volume : public ElementInterface { public: Volume(); Volume( const Percent& value ); virtual bool hasAttributes() const; virtual bool hasContents() const; virtual std::ostream& streamAttributes( std::ostream& os ) const; virtual std::ostream& streamName( std::ostream& os ) const; virtual std::ostream& streamContents( std::ostream& os, const int indentLevel, bool& isOneLineOnly ) const; Percent getValue() const; void setValue( const Percent& value ); private: virtual bool fromXElementImpl( std::ostream& message, ::ezxml::XElement& xelement ); private: Percent myValue; }; } }
{ "content_hash": "eca5c6d6acabc2ee9457cf9ac131e32e", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 119, "avg_line_length": 34.878787878787875, "alnum_prop": 0.6020851433536055, "repo_name": "Webern/MusicXML-Class-Library", "id": "3ed29012ee87e0573e82fd4c3083246f93b7a12a", "size": "1430", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Sourcecode/private/mx/core/elements/Volume.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "1796" }, { "name": "C++", "bytes": "8167393" }, { "name": "CMake", "bytes": "2762" }, { "name": "HTML", "bytes": "8450" }, { "name": "Objective-C", "bytes": "1428" }, { "name": "Ruby", "bytes": "141276" }, { "name": "Shell", "bytes": "1997" } ], "symlink_target": "" }
package com.example.stream.core.wechat; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.example.stream.core.network.RestClient; import com.example.stream.core.network.callback.IError; import com.example.stream.core.network.callback.IFailure; import com.example.stream.core.network.callback.ISuccess; import com.example.stream.core.util.log.StreamLogger; import com.tencent.mm.opensdk.modelbase.BaseReq; import com.tencent.mm.opensdk.modelbase.BaseResp; import com.tencent.mm.opensdk.modelmsg.SendAuth; /** * Created by StReaM on 8/21/2017. */ public abstract class BaseWXEntryActivity extends BaseWXActivity { public static final String WX_AUTH_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid="; public static final String SECRET_PARAM = "&secret="; public static final String CODE_PARAM = "&code="; public static final String GRANT_PARAM = "&grant_type=authorization_code"; public static final String WX_USER_INFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token="; public static final String OPEN_ID = "&openId="; public static final String LANG_PARAM = "&lang="; public static final String LANG_VALUE = "zh-CN"; protected abstract void onLoginSuccess (String userInfo); // 微信发送请求到第三方应用的回调 @Override public void onReq(BaseReq baseReq) { } // 第三方应用发送请求到微信后的回调 @Override public void onResp(BaseResp baseResp) { final String code = ((SendAuth.Resp)baseResp).code; final StringBuilder authUrl = new StringBuilder(); authUrl.append(WX_AUTH_URL) .append(StreamWeChat.APP_ID) .append(SECRET_PARAM) .append(StreamWeChat.SERCET) .append(CODE_PARAM) .append(code) .append(GRANT_PARAM); StreamLogger.d("authUrl", authUrl.toString()); getAuth(authUrl.toString()); } private void getAuth(String authUrl) { RestClient.Builder() .url(authUrl) .success(new ISuccess() { @Override public void onSuccess(String response) { final JSONObject authObj = JSON.parseObject(response); final String accessToken = authObj.getString("access_token"); final String openId = authObj.getString("openId"); final StringBuilder userInfoUrl = new StringBuilder(); userInfoUrl.append(WX_USER_INFO_URL) .append(accessToken) .append(OPEN_ID) .append(openId) .append(LANG_PARAM) .append(LANG_VALUE); StreamLogger.d("userInfoUrl", userInfoUrl.toString()); getUserInfo(userInfoUrl.toString()); } }) .build() .get(); } private void getUserInfo(String userInfoUrl) { RestClient.Builder() .url(userInfoUrl) .success(new ISuccess() { @Override public void onSuccess(String response) { } }) .failure(new IFailure() { @Override public void onFailure() { } }) .error(new IError() { @Override public void onError(int code, String msg) { } }) .build() .get(); } }
{ "content_hash": "c06e308edfca9b3a524b4f4ceff02326", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 105, "avg_line_length": 36.48039215686274, "alnum_prop": 0.5549583445310401, "repo_name": "streamj/JX", "id": "c2eaa444970076360d03f08fb00461c040784b42", "size": "3783", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "stream-core/src/main/java/com/example/stream/core/wechat/BaseWXEntryActivity.java", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "3728" }, { "name": "Java", "bytes": "315359" }, { "name": "JavaScript", "bytes": "59268" } ], "symlink_target": "" }
// Copyright 2008 The Closure Library Authors. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS-IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview A DragListGroup is a class representing a group of one or more * "drag lists" with items that can be dragged within them and between them. * * @see ../demos/draglistgroup.html */ goog.provide('goog.fx.DragListDirection'); goog.provide('goog.fx.DragListGroup'); goog.provide('goog.fx.DragListGroup.EventType'); goog.provide('goog.fx.DragListGroupEvent'); goog.require('goog.array'); goog.require('goog.asserts'); goog.require('goog.dom'); goog.require('goog.dom.NodeType'); goog.require('goog.dom.classlist'); goog.require('goog.events.Event'); goog.require('goog.events.EventHandler'); goog.require('goog.events.EventTarget'); goog.require('goog.events.EventType'); goog.require('goog.fx.Dragger'); goog.require('goog.fx.Dragger.EventType'); goog.require('goog.math.Coordinate'); goog.require('goog.string'); goog.require('goog.style'); /** * A class representing a group of one or more "drag lists" with items that can * be dragged within them and between them. * * Example usage: * var dragListGroup = new goog.fx.DragListGroup(); * dragListGroup.setDragItemHandleHoverClass(className1, className2); * dragListGroup.setDraggerElClass(className3); * dragListGroup.addDragList(vertList, goog.fx.DragListDirection.DOWN); * dragListGroup.addDragList(horizList, goog.fx.DragListDirection.RIGHT); * dragListGroup.init(); * * @extends {goog.events.EventTarget} * @constructor */ goog.fx.DragListGroup = function() { goog.events.EventTarget.call(this); /** * The drag lists. * @type {Array.<Element>} * @private */ this.dragLists_ = []; /** * All the drag items. Set by init(). * @type {Array.<Element>} * @private */ this.dragItems_ = []; /** * Which drag item corresponds to a given handle. Set by init(). * Specifically, this maps from the unique ID (as given by goog.getUid) * of the handle to the drag item. * @type {Object} * @private */ this.dragItemForHandle_ = {}; /** * The event handler for this instance. * @type {goog.events.EventHandler} * @private */ this.eventHandler_ = new goog.events.EventHandler(this); /** * Whether the setup has been done to make all items in all lists draggable. * @type {boolean} * @private */ this.isInitialized_ = false; /** * Whether the currDragItem is always displayed. By default the list * collapses, the currDragItem's display is set to none, when we do not * hover over a draglist. * @type {boolean} * @private */ this.isCurrDragItemAlwaysDisplayed_ = false; /** * Whether to update the position of the currDragItem as we drag, i.e., * insert the currDragItem each time to the position where it would land if * we were to end the drag at that point. Defaults to true. * @type {boolean} * @private */ this.updateWhileDragging_ = true; }; goog.inherits(goog.fx.DragListGroup, goog.events.EventTarget); /** * Enum to indicate the direction that a drag list grows. * @enum {number} */ goog.fx.DragListDirection = { DOWN: 0, // common RIGHT: 2, // common LEFT: 3, // uncommon (except perhaps for right-to-left interfaces) RIGHT_2D: 4, // common + handles multiple lines if items are wrapped LEFT_2D: 5 // for rtl languages }; /** * Events dispatched by this class. * @type {Object} */ goog.fx.DragListGroup.EventType = { BEFOREDRAGSTART: 'beforedragstart', DRAGSTART: 'dragstart', BEFOREDRAGMOVE: 'beforedragmove', DRAGMOVE: 'dragmove', BEFOREDRAGEND: 'beforedragend', DRAGEND: 'dragend' }; // The next 4 are user-supplied CSS classes. /** * The user-supplied CSS classes to add to a drag item on hover (not during a * drag action). * @type {Array|undefined} * @private */ goog.fx.DragListGroup.prototype.dragItemHoverClasses_; /** * The user-supplied CSS classes to add to a drag item handle on hover (not * during a drag action). * @type {Array|undefined} * @private */ goog.fx.DragListGroup.prototype.dragItemHandleHoverClasses_; /** * The user-supplied CSS classes to add to the current drag item (during a drag * action). * @type {Array|undefined} * @private */ goog.fx.DragListGroup.prototype.currDragItemClasses_; /** * The user-supplied CSS classes to add to the clone of the current drag item * that's actually being dragged around (during a drag action). * @type {Array.<string>|undefined} * @private */ goog.fx.DragListGroup.prototype.draggerElClasses_; // The next 5 are info applicable during a drag action. /** * The current drag item being moved. * Note: This is only defined while a drag action is happening. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.currDragItem_; /** * The drag list that {@code this.currDragItem_} is currently hovering over, or * null if it is not hovering over a list. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.currHoverList_; /** * The original drag list that the current drag item came from. We need to * remember this in case the user drops the item outside of any lists, in which * case we return the item to its original location. * Note: This is only defined while a drag action is happening. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.origList_; /** * The original next item in the original list that the current drag item came * from. We need to remember this in case the user drops the item outside of * any lists, in which case we return the item to its original location. * Note: This is only defined while a drag action is happening. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.origNextItem_; /** * The current item in the list we are hovering over. We need to remember * this in case we do not update the position of the current drag item while * dragging (see {@code updateWhileDragging_}). In this case the current drag * item will be inserted into the list before this element when the drag ends. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.currHoverItem_; /** * The clone of the current drag item that's actually being dragged around. * Note: This is only defined while a drag action is happening. * @type {Element} * @private */ goog.fx.DragListGroup.prototype.draggerEl_; /** * The dragger object. * Note: This is only defined while a drag action is happening. * @type {goog.fx.Dragger} * @private */ goog.fx.DragListGroup.prototype.dragger_; /** * The amount of distance, in pixels, after which a mousedown or touchstart is * considered a drag. * @type {number} * @private */ goog.fx.DragListGroup.prototype.hysteresisDistance_ = 0; /** * Sets the property of the currDragItem that it is always displayed in the * list. */ goog.fx.DragListGroup.prototype.setIsCurrDragItemAlwaysDisplayed = function() { this.isCurrDragItemAlwaysDisplayed_ = true; }; /** * Sets the private property updateWhileDragging_ to false. This disables the * update of the position of the currDragItem while dragging. It will only be * placed to its new location once the drag ends. */ goog.fx.DragListGroup.prototype.setNoUpdateWhileDragging = function() { this.updateWhileDragging_ = false; }; /** * Sets the distance the user has to drag the element before a drag operation * is started. * @param {number} distance The number of pixels after which a mousedown and * move is considered a drag. */ goog.fx.DragListGroup.prototype.setHysteresis = function(distance) { this.hysteresisDistance_ = distance; }; /** * @return {number} distance The number of pixels after which a mousedown and * move is considered a drag. */ goog.fx.DragListGroup.prototype.getHysteresis = function() { return this.hysteresisDistance_; }; /** * Adds a drag list to this DragListGroup. * All calls to this method must happen before the call to init(). * Remember that all child nodes (except text nodes) will be made draggable to * any other drag list in this group. * * @param {Element} dragListElement Must be a container for a list of items * that should all be made draggable. * @param {goog.fx.DragListDirection} growthDirection The direction that this * drag list grows in (i.e. if an item is appended to the DOM, the list's * bounding box expands in this direction). * @param {boolean=} opt_unused Unused argument. * @param {string=} opt_dragHoverClass CSS class to apply to this drag list when * the draggerEl hovers over it during a drag action. If present, must be a * single, valid classname (not a string of space-separated classnames). */ goog.fx.DragListGroup.prototype.addDragList = function( dragListElement, growthDirection, opt_unused, opt_dragHoverClass) { goog.asserts.assert(!this.isInitialized_); dragListElement.dlgGrowthDirection_ = growthDirection; dragListElement.dlgDragHoverClass_ = opt_dragHoverClass; this.dragLists_.push(dragListElement); }; /** * Sets a user-supplied function used to get the "handle" element for a drag * item. The function must accept exactly one argument. The argument may be * any drag item element. * * If not set, the default implementation uses the whole drag item as the * handle. * * @param {function(Element): Element} getHandleForDragItemFn A function that, * given any drag item, returns a reference to its "handle" element * (which may be the drag item element itself). */ goog.fx.DragListGroup.prototype.setFunctionToGetHandleForDragItem = function( getHandleForDragItemFn) { goog.asserts.assert(!this.isInitialized_); this.getHandleForDragItem_ = getHandleForDragItemFn; }; /** * Sets a user-supplied CSS class to add to a drag item on hover (not during a * drag action). * @param {...!string} var_args The CSS class or classes. */ goog.fx.DragListGroup.prototype.setDragItemHoverClass = function(var_args) { goog.asserts.assert(!this.isInitialized_); this.dragItemHoverClasses_ = goog.array.slice(arguments, 0); }; /** * Sets a user-supplied CSS class to add to a drag item handle on hover (not * during a drag action). * @param {...!string} var_args The CSS class or classes. */ goog.fx.DragListGroup.prototype.setDragItemHandleHoverClass = function( var_args) { goog.asserts.assert(!this.isInitialized_); this.dragItemHandleHoverClasses_ = goog.array.slice(arguments, 0); }; /** * Sets a user-supplied CSS class to add to the current drag item (during a * drag action). * * If not set, the default behavior adds visibility:hidden to the current drag * item so that it is a block of empty space in the hover drag list (if any). * If this class is set by the user, then the default behavior does not happen * (unless, of course, the class also contains visibility:hidden). * * @param {...!string} var_args The CSS class or classes. */ goog.fx.DragListGroup.prototype.setCurrDragItemClass = function(var_args) { goog.asserts.assert(!this.isInitialized_); this.currDragItemClasses_ = goog.array.slice(arguments, 0); }; /** * Sets a user-supplied CSS class to add to the clone of the current drag item * that's actually being dragged around (during a drag action). * @param {string} draggerElClass The CSS class. */ goog.fx.DragListGroup.prototype.setDraggerElClass = function(draggerElClass) { goog.asserts.assert(!this.isInitialized_); // Split space-separated classes up into an array. this.draggerElClasses_ = goog.string.trim(draggerElClass).split(' '); }; /** * Performs the initial setup to make all items in all lists draggable. */ goog.fx.DragListGroup.prototype.init = function() { if (this.isInitialized_) { return; } for (var i = 0, numLists = this.dragLists_.length; i < numLists; i++) { var dragList = this.dragLists_[i]; var dragItems = goog.dom.getChildren(dragList); for (var j = 0, numItems = dragItems.length; j < numItems; ++j) { this.listenForDragEvents(dragItems[j]); } } this.isInitialized_ = true; }; /** * Adds a single item to the given drag list and sets up the drag listeners for * it. * If opt_index is specified the item is inserted at this index, otherwise the * item is added as the last child of the list. * * @param {!Element} list The drag list where to add item to. * @param {!Element} item The new element to add. * @param {number=} opt_index Index where to insert the item in the list. If not * specified item is inserted as the last child of list. */ goog.fx.DragListGroup.prototype.addItemToDragList = function(list, item, opt_index) { if (goog.isDef(opt_index)) { goog.dom.insertChildAt(list, item, opt_index); } else { goog.dom.appendChild(list, item); } this.listenForDragEvents(item); }; /** @override */ goog.fx.DragListGroup.prototype.disposeInternal = function() { this.eventHandler_.dispose(); for (var i = 0, n = this.dragLists_.length; i < n; i++) { var dragList = this.dragLists_[i]; // Note: IE doesn't allow 'delete' for fields on HTML elements (because // they're not real JS objects in IE), so we just set them to undefined. dragList.dlgGrowthDirection_ = undefined; dragList.dlgDragHoverClass_ = undefined; } this.dragLists_.length = 0; this.dragItems_.length = 0; this.dragItemForHandle_ = null; // In the case where a drag event is currently in-progress and dispose is // called, this cleans up the extra state. this.cleanupDragDom_(); goog.fx.DragListGroup.superClass_.disposeInternal.call(this); }; /** * Caches the heights of each drag list and drag item, except for the current * drag item. * * @param {Element} currDragItem The item currently being dragged. * @private */ goog.fx.DragListGroup.prototype.recacheListAndItemBounds_ = function( currDragItem) { for (var i = 0, n = this.dragLists_.length; i < n; i++) { var dragList = this.dragLists_[i]; dragList.dlgBounds_ = goog.style.getBounds(dragList); } for (var i = 0, n = this.dragItems_.length; i < n; i++) { var dragItem = this.dragItems_[i]; if (dragItem != currDragItem) { dragItem.dlgBounds_ = goog.style.getBounds(dragItem); } } }; /** * Listens for drag events on the given drag item. This method is currently used * to initialize drag items. * * @param {Element} dragItem the element to initialize. This element has to be * in one of the drag lists. * @protected */ goog.fx.DragListGroup.prototype.listenForDragEvents = function(dragItem) { var dragItemHandle = this.getHandleForDragItem_(dragItem); var uid = goog.getUid(dragItemHandle); this.dragItemForHandle_[uid] = dragItem; if (this.dragItemHoverClasses_) { this.eventHandler_.listen( dragItem, goog.events.EventType.MOUSEOVER, this.handleDragItemMouseover_); this.eventHandler_.listen( dragItem, goog.events.EventType.MOUSEOUT, this.handleDragItemMouseout_); } if (this.dragItemHandleHoverClasses_) { this.eventHandler_.listen( dragItemHandle, goog.events.EventType.MOUSEOVER, this.handleDragItemHandleMouseover_); this.eventHandler_.listen( dragItemHandle, goog.events.EventType.MOUSEOUT, this.handleDragItemHandleMouseout_); } this.dragItems_.push(dragItem); this.eventHandler_.listen(dragItemHandle, [goog.events.EventType.MOUSEDOWN, goog.events.EventType.TOUCHSTART], this.handlePotentialDragStart_); }; /** * Handles mouse and touch events which may start a drag action. * @param {!goog.events.BrowserEvent} e MOUSEDOWN or TOUCHSTART event. * @private */ goog.fx.DragListGroup.prototype.handlePotentialDragStart_ = function(e) { var uid = goog.getUid(/** @type {Node} */ (e.currentTarget)); this.currDragItem_ = /** @type {Element} */ (this.dragItemForHandle_[uid]); this.draggerEl_ = this.cloneNode_(this.currDragItem_); if (this.draggerElClasses_) { // Add CSS class for the clone, if any. goog.dom.classlist.addAll(this.draggerEl_, this.draggerElClasses_ || []); } // Place the clone (i.e. draggerEl) at the same position as the actual // current drag item. This is a bit tricky since // goog.style.getPageOffset() gets the left-top pos of the border, but // goog.style.setPageOffset() sets the left-top pos of the margin. // It's difficult to adjust for the margins of the clone because it's // difficult to read it: goog.style.getComputedStyle() doesn't work for IE. // Instead, our workaround is simply to set the clone's margins to 0px. this.draggerEl_.style.margin = '0'; this.draggerEl_.style.position = 'absolute'; this.draggerEl_.style.visibility = 'hidden'; var doc = goog.dom.getOwnerDocument(this.currDragItem_); doc.body.appendChild(this.draggerEl_); // Important: goog.style.setPageOffset() only works correctly for IE when the // element is already in the document. var currDragItemPos = goog.style.getPageOffset(this.currDragItem_); goog.style.setPageOffset(this.draggerEl_, currDragItemPos); this.dragger_ = new goog.fx.Dragger(this.draggerEl_); this.dragger_.setHysteresis(this.hysteresisDistance_); // Listen to events on the dragger. These handlers will be unregistered at // DRAGEND, when the dragger is disposed of. We can't use eventHandler_, // because it creates new references to the handler functions at each // dragging action, and keeps them until DragListGroup is disposed of. goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.START, this.handleDragStart_, false, this); goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.END, this.handleDragEnd_, false, this); goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.EARLY_CANCEL, this.cleanup_, false, this); this.dragger_.startDrag(e); }; /** * Handles the start of a drag action. * @param {!goog.fx.DragEvent} e goog.fx.Dragger.EventType.START event. * @private */ goog.fx.DragListGroup.prototype.handleDragStart_ = function(e) { if (!this.dispatchEvent(new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.BEFOREDRAGSTART, this, e.browserEvent, this.currDragItem_, null, null))) { e.preventDefault(); this.cleanup_(); return; } // Record the original location of the current drag item. // Note: this.origNextItem_ may be null. this.origList_ = /** @type {Element} */ (this.currDragItem_.parentNode); this.origNextItem_ = goog.dom.getNextElementSibling(this.currDragItem_); this.currHoverItem_ = this.origNextItem_; this.currHoverList_ = this.origList_; // If there's a CSS class specified for the current drag item, add it. // Otherwise, make the actual current drag item hidden (takes up space). if (this.currDragItemClasses_) { goog.dom.classlist.addAll(this.currDragItem_, this.currDragItemClasses_ || []); } else { this.currDragItem_.style.visibility = 'hidden'; } // Precompute distances from top-left corner to center for efficiency. var draggerElSize = goog.style.getSize(this.draggerEl_); this.draggerEl_.halfWidth = draggerElSize.width / 2; this.draggerEl_.halfHeight = draggerElSize.height / 2; this.draggerEl_.style.visibility = ''; // Record the bounds of all the drag lists and all the other drag items. This // caching is for efficiency, so that we don't have to recompute the bounds on // each drag move. Do this in the state where the current drag item is not in // any of the lists, except when update while dragging is disabled, as in this // case the current drag item does not get removed until drag ends. if (this.updateWhileDragging_) { this.currDragItem_.style.display = 'none'; } this.recacheListAndItemBounds_(this.currDragItem_); this.currDragItem_.style.display = ''; // Listen to events on the dragger. goog.events.listen(this.dragger_, goog.fx.Dragger.EventType.DRAG, this.handleDragMove_, false, this); this.dispatchEvent( new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.DRAGSTART, this, e.browserEvent, this.currDragItem_, this.draggerEl_, this.dragger_)); }; /** * Handles a drag movement (i.e. DRAG event fired by the dragger). * * @param {goog.fx.DragEvent} dragEvent Event object fired by the dragger. * @return {boolean} The return value for the event. * @private */ goog.fx.DragListGroup.prototype.handleDragMove_ = function(dragEvent) { // Compute the center of the dragger element (i.e. the cloned drag item). var draggerElPos = goog.style.getPageOffset(this.draggerEl_); var draggerElCenter = new goog.math.Coordinate( draggerElPos.x + this.draggerEl_.halfWidth, draggerElPos.y + this.draggerEl_.halfHeight); // Check whether the center is hovering over one of the drag lists. var hoverList = this.getHoverDragList_(draggerElCenter); // If hovering over a list, find the next item (if drag were to end now). var hoverNextItem = hoverList ? this.getHoverNextItem_(hoverList, draggerElCenter) : null; var rv = this.dispatchEvent( new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.BEFOREDRAGMOVE, this, dragEvent, this.currDragItem_, this.draggerEl_, this.dragger_, draggerElCenter, hoverList, hoverNextItem)); if (!rv) { return false; } if (hoverList) { if (this.updateWhileDragging_) { this.insertCurrDragItem_(hoverList, hoverNextItem); } else { // If update while dragging is disabled do not insert // the dragged item, but update the hovered item instead. this.updateCurrHoverItem(hoverNextItem, draggerElCenter); } this.currDragItem_.style.display = ''; // Add drag list's hover class (if any). if (hoverList.dlgDragHoverClass_) { goog.dom.classlist.add(hoverList, hoverList.dlgDragHoverClass_); } } else { // Not hovering over a drag list, so remove the item altogether unless // specified otherwise by the user. if (!this.isCurrDragItemAlwaysDisplayed_) { this.currDragItem_.style.display = 'none'; } // Remove hover classes (if any) from all drag lists. for (var i = 0, n = this.dragLists_.length; i < n; i++) { var dragList = this.dragLists_[i]; if (dragList.dlgDragHoverClass_) { goog.dom.classlist.remove(dragList, dragList.dlgDragHoverClass_); } } } // If the current hover list is different than the last, the lists may have // shrunk, so we should recache the bounds. if (hoverList != this.currHoverList_) { this.currHoverList_ = hoverList; this.recacheListAndItemBounds_(this.currDragItem_); } this.dispatchEvent( new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.DRAGMOVE, this, dragEvent, /** @type {Element} */ (this.currDragItem_), this.draggerEl_, this.dragger_, draggerElCenter, hoverList, hoverNextItem)); // Return false to prevent selection due to mouse drag. return false; }; /** * Clear all our temporary fields that are only defined while dragging, and * all the bounds info stored on the drag lists and drag elements. * @param {!goog.events.Event=} opt_e EARLY_CANCEL event from the dragger if * cleanup_ was called as an event handler. * @private */ goog.fx.DragListGroup.prototype.cleanup_ = function(opt_e) { this.cleanupDragDom_(); this.currDragItem_ = null; this.currHoverList_ = null; this.origList_ = null; this.origNextItem_ = null; this.draggerEl_ = null; this.dragger_ = null; // Note: IE doesn't allow 'delete' for fields on HTML elements (because // they're not real JS objects in IE), so we just set them to null. for (var i = 0, n = this.dragLists_.length; i < n; i++) { this.dragLists_[i].dlgBounds_ = null; } for (var i = 0, n = this.dragItems_.length; i < n; i++) { this.dragItems_[i].dlgBounds_ = null; } }; /** * Handles the end or the cancellation of a drag action, i.e. END or CLEANUP * event fired by the dragger. * * @param {!goog.fx.DragEvent} dragEvent Event object fired by the dragger. * @return {boolean} Whether the event was handled. * @private */ goog.fx.DragListGroup.prototype.handleDragEnd_ = function(dragEvent) { var rv = this.dispatchEvent( new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.BEFOREDRAGEND, this, dragEvent, /** @type {Element} */ (this.currDragItem_), this.draggerEl_, this.dragger_)); if (!rv) { return false; } // If update while dragging is disabled insert the current drag item into // its intended location. if (!this.updateWhileDragging_) { this.insertCurrHoverItem(); } // The DRAGEND handler may need the new order of the list items. Clean up the // garbage. // TODO(user): Regression test. this.cleanupDragDom_(); this.dispatchEvent( new goog.fx.DragListGroupEvent( goog.fx.DragListGroup.EventType.DRAGEND, this, dragEvent, this.currDragItem_, this.draggerEl_, this.dragger_)); this.cleanup_(); return true; }; /** * Cleans up DOM changes that are made by the {@code handleDrag*} methods. * @private */ goog.fx.DragListGroup.prototype.cleanupDragDom_ = function() { // Disposes of the dragger and remove the cloned drag item. goog.dispose(this.dragger_); if (this.draggerEl_) { goog.dom.removeNode(this.draggerEl_); } // If the current drag item is not in any list, put it back in its original // location. if (this.currDragItem_ && this.currDragItem_.style.display == 'none') { // Note: this.origNextItem_ may be null, but insertBefore() still works. this.origList_.insertBefore(this.currDragItem_, this.origNextItem_); this.currDragItem_.style.display = ''; } // If there's a CSS class specified for the current drag item, remove it. // Otherwise, make the current drag item visible (instead of empty space). if (this.currDragItemClasses_ && this.currDragItem_) { goog.dom.classlist.removeAll(this.currDragItem_, this.currDragItemClasses_ || []); } else if (this.currDragItem_) { this.currDragItem_.style.visibility = 'visible'; } // Remove hover classes (if any) from all drag lists. for (var i = 0, n = this.dragLists_.length; i < n; i++) { var dragList = this.dragLists_[i]; if (dragList.dlgDragHoverClass_) { goog.dom.classlist.remove(dragList, dragList.dlgDragHoverClass_); } } }; /** * Default implementation of the function to get the "handle" element for a * drag item. By default, we use the whole drag item as the handle. Users can * change this by calling setFunctionToGetHandleForDragItem(). * * @param {Element} dragItem The drag item to get the handle for. * @return {Element} The dragItem element itself. * @private */ goog.fx.DragListGroup.prototype.getHandleForDragItem_ = function(dragItem) { return dragItem; }; /** * Handles a MOUSEOVER event fired on a drag item. * @param {goog.events.BrowserEvent} e The event. * @private */ goog.fx.DragListGroup.prototype.handleDragItemMouseover_ = function(e) { var targetEl = goog.asserts.assertElement(e.currentTarget); goog.dom.classlist.addAll(targetEl, this.dragItemHoverClasses_ || []); }; /** * Handles a MOUSEOUT event fired on a drag item. * @param {goog.events.BrowserEvent} e The event. * @private */ goog.fx.DragListGroup.prototype.handleDragItemMouseout_ = function(e) { var targetEl = goog.asserts.assertElement(e.currentTarget); goog.dom.classlist.removeAll(targetEl, this.dragItemHoverClasses_ || []); }; /** * Handles a MOUSEOVER event fired on the handle element of a drag item. * @param {goog.events.BrowserEvent} e The event. * @private */ goog.fx.DragListGroup.prototype.handleDragItemHandleMouseover_ = function(e) { var targetEl = goog.asserts.assertElement(e.currentTarget); goog.dom.classlist.addAll(targetEl, this.dragItemHandleHoverClasses_ || []); }; /** * Handles a MOUSEOUT event fired on the handle element of a drag item. * @param {goog.events.BrowserEvent} e The event. * @private */ goog.fx.DragListGroup.prototype.handleDragItemHandleMouseout_ = function(e) { var targetEl = goog.asserts.assertElement(e.currentTarget); goog.dom.classlist.removeAll(targetEl, this.dragItemHandleHoverClasses_ || []); }; /** * Helper for handleDragMove_(). * Given the position of the center of the dragger element, figures out whether * it's currently hovering over any of the drag lists. * * @param {goog.math.Coordinate} draggerElCenter The center position of the * dragger element. * @return {Element} If currently hovering over a drag list, returns the drag * list element. Else returns null. * @private */ goog.fx.DragListGroup.prototype.getHoverDragList_ = function(draggerElCenter) { // If the current drag item was in a list last time we did this, then check // that same list first. var prevHoverList = null; if (this.currDragItem_.style.display != 'none') { prevHoverList = /** @type {Element} */ (this.currDragItem_.parentNode); // Important: We can't use the cached bounds for this list because the // cached bounds are based on the case where the current drag item is not // in the list. Since the current drag item is known to be in this list, we // must recompute the list's bounds. var prevHoverListBounds = goog.style.getBounds(prevHoverList); if (this.isInRect_(draggerElCenter, prevHoverListBounds)) { return prevHoverList; } } for (var i = 0, n = this.dragLists_.length; i < n; i++) { var dragList = this.dragLists_[i]; if (dragList == prevHoverList) { continue; } if (this.isInRect_(draggerElCenter, dragList.dlgBounds_)) { return dragList; } } return null; }; /** * Checks whether a coordinate position resides inside a rectangle. * @param {goog.math.Coordinate} pos The coordinate position. * @param {goog.math.Rect} rect The rectangle. * @return {boolean} True if 'pos' is within the bounds of 'rect'. * @private */ goog.fx.DragListGroup.prototype.isInRect_ = function(pos, rect) { return pos.x > rect.left && pos.x < rect.left + rect.width && pos.y > rect.top && pos.y < rect.top + rect.height; }; /** * Updates the value of currHoverItem_. * * This method is used for insertion only when updateWhileDragging_ is false. * The below implementation is the basic one. This method can be extended by * a subclass to support changes to hovered item (eg: highlighting). Parametr * opt_draggerElCenter can be used for more sophisticated effects. * * @param {Element} hoverNextItem element of the list that is hovered over. * @param {goog.math.Coordinate=} opt_draggerElCenter current position of * the dragged element. * @protected */ goog.fx.DragListGroup.prototype.updateCurrHoverItem = function( hoverNextItem, opt_draggerElCenter) { if (hoverNextItem) { this.currHoverItem_ = hoverNextItem; } }; /** * Inserts the currently dragged item in its new place. * * This method is used for insertion only when updateWhileDragging_ is false * (otherwise there is no need for that). In the basic implementation * the element is inserted before the currently hovered over item (this can * be changed by overriding the method in subclasses). * * @protected */ goog.fx.DragListGroup.prototype.insertCurrHoverItem = function() { this.origList_.insertBefore(this.currDragItem_, this.currHoverItem_); }; /** * Helper for handleDragMove_(). * Given the position of the center of the dragger element, plus the drag list * that it's currently hovering over, figures out the next drag item in the * list that follows the current position of the dragger element. (I.e. if * the drag action ends right now, it would become the item after the current * drag item.) * * @param {Element} hoverList The drag list that we're hovering over. * @param {goog.math.Coordinate} draggerElCenter The center position of the * dragger element. * @return {Element} Returns the earliest item in the hover list that belongs * after the current position of the dragger element. If all items in the * list should come before the current drag item, then returns null. * @private */ goog.fx.DragListGroup.prototype.getHoverNextItem_ = function( hoverList, draggerElCenter) { if (hoverList == null) { throw Error('getHoverNextItem_ called with null hoverList.'); } // The definition of what it means for the draggerEl to be "before" a given // item in the hover drag list is not always the same. It changes based on // the growth direction of the hover drag list in question. /** @type {number} */ var relevantCoord; var getRelevantBoundFn; var isBeforeFn; var pickClosestRow = false; var distanceToClosestRow = undefined; switch (hoverList.dlgGrowthDirection_) { case goog.fx.DragListDirection.DOWN: // "Before" means draggerElCenter.y is less than item's bottom y-value. relevantCoord = draggerElCenter.y; getRelevantBoundFn = goog.fx.DragListGroup.getBottomBound_; isBeforeFn = goog.fx.DragListGroup.isLessThan_; break; case goog.fx.DragListDirection.RIGHT_2D: pickClosestRow = true; case goog.fx.DragListDirection.RIGHT: // "Before" means draggerElCenter.x is less than item's right x-value. relevantCoord = draggerElCenter.x; getRelevantBoundFn = goog.fx.DragListGroup.getRightBound_; isBeforeFn = goog.fx.DragListGroup.isLessThan_; break; case goog.fx.DragListDirection.LEFT_2D: pickClosestRow = true; case goog.fx.DragListDirection.LEFT: // "Before" means draggerElCenter.x is greater than item's left x-value. relevantCoord = draggerElCenter.x; getRelevantBoundFn = goog.fx.DragListGroup.getLeftBound_; isBeforeFn = goog.fx.DragListGroup.isGreaterThan_; break; } // This holds the earliest drag item found so far that should come after // this.currDragItem_ in the hover drag list (based on draggerElCenter). var earliestAfterItem = null; // This is the position of the relevant bound for the earliestAfterItem, // where "relevant" is determined by the growth direction of hoverList. var earliestAfterItemRelevantBound; var hoverListItems = goog.dom.getChildren(hoverList); for (var i = 0, n = hoverListItems.length; i < n; i++) { var item = hoverListItems[i]; if (item == this.currDragItem_) { continue; } var relevantBound = getRelevantBoundFn(item.dlgBounds_); // When the hoverlist is broken into multiple rows (i.e., in the case of // LEFT_2D and RIGHT_2D) it is no longer enough to only look at the // x-coordinate alone in order to find the {@earliestAfterItem} in the // hoverlist. Make sure it is chosen from the row closest to the // {@code draggerElCenter}. if (pickClosestRow) { var distanceToRow = goog.fx.DragListGroup.verticalDistanceFromItem_(item, draggerElCenter); // Initialize the distance to the closest row to the current value if // undefined. if (!goog.isDef(distanceToClosestRow)) { distanceToClosestRow = distanceToRow; } if (isBeforeFn(relevantCoord, relevantBound) && (earliestAfterItemRelevantBound == undefined || (distanceToRow < distanceToClosestRow) || ((distanceToRow == distanceToClosestRow) && (isBeforeFn(relevantBound, earliestAfterItemRelevantBound) || relevantBound == earliestAfterItemRelevantBound)))) { earliestAfterItem = item; earliestAfterItemRelevantBound = relevantBound; } // Update distance to closest row. if (distanceToRow < distanceToClosestRow) { distanceToClosestRow = distanceToRow; } } else if (isBeforeFn(relevantCoord, relevantBound) && (earliestAfterItemRelevantBound == undefined || isBeforeFn(relevantBound, earliestAfterItemRelevantBound))) { earliestAfterItem = item; earliestAfterItemRelevantBound = relevantBound; } } // If we ended up picking an element that is not in the closest row it can // only happen if we should have picked the last one in which case there is // no consecutive element. if (!goog.isNull(earliestAfterItem) && goog.fx.DragListGroup.verticalDistanceFromItem_( earliestAfterItem, draggerElCenter) > distanceToClosestRow) { return null; } else { return earliestAfterItem; } }; /** * Private helper for getHoverNextItem(). * Given an item and a target determine the vertical distance from the item's * center to the target. * @param {Element} item The item to measure the distance from. * @param {goog.math.Coordinate} target The (x,y) coordinate of the target * to measure the distance to. * @return {number} The vertical distance between the center of the item and * the target. * @private */ goog.fx.DragListGroup.verticalDistanceFromItem_ = function(item, target) { var itemBounds = item.dlgBounds_; var itemCenterY = itemBounds.top + (itemBounds.height - 1) / 2; return Math.abs(target.y - itemCenterY); }; /** * Private helper for getHoverNextItem_(). * Given the bounds of an item, computes the item's bottom y-value. * @param {goog.math.Rect} itemBounds The bounds of the item. * @return {number} The item's bottom y-value. * @private */ goog.fx.DragListGroup.getBottomBound_ = function(itemBounds) { return itemBounds.top + itemBounds.height - 1; }; /** * Private helper for getHoverNextItem_(). * Given the bounds of an item, computes the item's right x-value. * @param {goog.math.Rect} itemBounds The bounds of the item. * @return {number} The item's right x-value. * @private */ goog.fx.DragListGroup.getRightBound_ = function(itemBounds) { return itemBounds.left + itemBounds.width - 1; }; /** * Private helper for getHoverNextItem_(). * Given the bounds of an item, computes the item's left x-value. * @param {goog.math.Rect} itemBounds The bounds of the item. * @return {number} The item's left x-value. * @private */ goog.fx.DragListGroup.getLeftBound_ = function(itemBounds) { return itemBounds.left || 0; }; /** * Private helper for getHoverNextItem_(). * @param {number} a Number to compare. * @param {number} b Number to compare. * @return {boolean} Whether a is less than b. * @private */ goog.fx.DragListGroup.isLessThan_ = function(a, b) { return a < b; }; /** * Private helper for getHoverNextItem_(). * @param {number} a Number to compare. * @param {number} b Number to compare. * @return {boolean} Whether a is greater than b. * @private */ goog.fx.DragListGroup.isGreaterThan_ = function(a, b) { return a > b; }; /** * Inserts the current drag item to the appropriate location in the drag list * that we're hovering over (if the current drag item is not already there). * * @param {Element} hoverList The drag list we're hovering over. * @param {Element} hoverNextItem The next item in the hover drag list. * @private */ goog.fx.DragListGroup.prototype.insertCurrDragItem_ = function( hoverList, hoverNextItem) { if (this.currDragItem_.parentNode != hoverList || goog.dom.getNextElementSibling(this.currDragItem_) != hoverNextItem) { // The current drag item is not in the correct location, so we move it. // Note: hoverNextItem may be null, but insertBefore() still works. hoverList.insertBefore(this.currDragItem_, hoverNextItem); } }; /** * Note: Copied from abstractdragdrop.js. TODO(user): consolidate. * Creates copy of node being dragged. * * @param {Element} sourceEl Element to copy. * @return {Element} The clone of {@code sourceEl}. * @private */ goog.fx.DragListGroup.prototype.cloneNode_ = function(sourceEl) { var clonedEl = /** @type {Element} */ (sourceEl.cloneNode(true)); switch (sourceEl.tagName.toLowerCase()) { case 'tr': return goog.dom.createDom( 'table', null, goog.dom.createDom('tbody', null, clonedEl)); case 'td': case 'th': return goog.dom.createDom( 'table', null, goog.dom.createDom('tbody', null, goog.dom.createDom( 'tr', null, clonedEl))); default: return clonedEl; } }; /** * The event object dispatched by DragListGroup. * The fields draggerElCenter, hoverList, and hoverNextItem are only available * for the BEFOREDRAGMOVE and DRAGMOVE events. * * @param {string} type The event type string. * @param {goog.fx.DragListGroup} dragListGroup A reference to the associated * DragListGroup object. * @param {goog.events.BrowserEvent|goog.fx.DragEvent} event The event fired * by the browser or fired by the dragger. * @param {Element} currDragItem The current drag item being moved. * @param {Element} draggerEl The clone of the current drag item that's actually * being dragged around. * @param {goog.fx.Dragger} dragger The dragger object. * @param {goog.math.Coordinate=} opt_draggerElCenter The current center * position of the draggerEl. * @param {Element=} opt_hoverList The current drag list that's being hovered * over, or null if the center of draggerEl is outside of any drag lists. * If not null and the drag action ends right now, then currDragItem will * end up in this list. * @param {Element=} opt_hoverNextItem The current next item in the hoverList * that the draggerEl is hovering over. (I.e. If the drag action ends * right now, then this item would become the next item after the new * location of currDragItem.) May be null if not applicable or if * currDragItem would be added to the end of hoverList. * @constructor * @extends {goog.events.Event} */ goog.fx.DragListGroupEvent = function( type, dragListGroup, event, currDragItem, draggerEl, dragger, opt_draggerElCenter, opt_hoverList, opt_hoverNextItem) { goog.events.Event.call(this, type); /** * A reference to the associated DragListGroup object. * @type {goog.fx.DragListGroup} */ this.dragListGroup = dragListGroup; /** * The event fired by the browser or fired by the dragger. * @type {goog.events.BrowserEvent|goog.fx.DragEvent} */ this.event = event; /** * The current drag item being move. * @type {Element} */ this.currDragItem = currDragItem; /** * The clone of the current drag item that's actually being dragged around. * @type {Element} */ this.draggerEl = draggerEl; /** * The dragger object. * @type {goog.fx.Dragger} */ this.dragger = dragger; /** * The current center position of the draggerEl. * @type {goog.math.Coordinate|undefined} */ this.draggerElCenter = opt_draggerElCenter; /** * The current drag list that's being hovered over, or null if the center of * draggerEl is outside of any drag lists. (I.e. If not null and the drag * action ends right now, then currDragItem will end up in this list.) * @type {Element|undefined} */ this.hoverList = opt_hoverList; /** * The current next item in the hoverList that the draggerEl is hovering over. * (I.e. If the drag action ends right now, then this item would become the * next item after the new location of currDragItem.) May be null if not * applicable or if currDragItem would be added to the end of hoverList. * @type {Element|undefined} */ this.hoverNextItem = opt_hoverNextItem; }; goog.inherits(goog.fx.DragListGroupEvent, goog.events.Event);
{ "content_hash": "b1e021888fa15b6d68df113ce21075de", "timestamp": "", "source": "github", "line_count": 1302, "max_line_length": 80, "avg_line_length": 34.824116743471585, "alnum_prop": 0.6847886019276151, "repo_name": "dmincu/IOC", "id": "a50e97fb91ff9e9824c6156c25b5b12ea263207e", "size": "45341", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "new_php/closure-library/closure/goog/fx/draglistgroup.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "276898" }, { "name": "Emacs Lisp", "bytes": "2480" }, { "name": "JavaScript", "bytes": "13304586" }, { "name": "PHP", "bytes": "42285" }, { "name": "Python", "bytes": "77277" }, { "name": "Shell", "bytes": "1962" } ], "symlink_target": "" }
<?php if(!defined('SYSTEM')) die('no access'); class Page_admin_edit_user{ public function __construct() { $this->auth = get_instance(AUTH_CLASS); } function index(){ if(isset($_GET['user_id']) && !$data['user'] = $this->auth->get_user($_GET['user_id'])) { set_error_msg('This user does not exist'); redirect('admin-users'); } $data['user_access_levels'] = $this->auth->get_access_levels(); $this->main_content = load('admin-edit-user','main_content',$data); } function edit_user() { $email = $_POST['email']; $password[0] = $_POST['password'][0]; $password[1] = $_POST['password'][1]; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; $user_access_level = $_POST['user_access_level']; $user_id = $_POST['user_id']; if(!$email) // required fields { set_error_msg(ENTER_REQUIRED); } else if($password[0] != $password[1]) // passwords do not match { set_error_msg(PASSWORDS_DO_NOT_MATCH); } else // do action { if(!$this->auth->update_user($first_name, $last_name, $email, $password[0], $user_access_level, $user_id)) { set_error_msg(USER_EXISTS); } else { set_msg(USER_UPDATED); redirect('admin-users'); } } redirect('admin-edit-user','user_id='.$user_id); } }
{ "content_hash": "4919344f7bba0513b7304e17bebe4ff9", "timestamp": "", "source": "github", "line_count": 50, "max_line_length": 109, "avg_line_length": 26.78, "alnum_prop": 0.5698282300224048, "repo_name": "jasekz/simple-app-for-php", "id": "492fcf81decf6914c69b37f7d0e591d26e894ded", "size": "1339", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "content/admin-edit-user/index.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "174" }, { "name": "CSS", "bytes": "6324" }, { "name": "HTML", "bytes": "150" }, { "name": "PHP", "bytes": "132806" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using Moq.Behaviors; namespace Moq { internal static class HandleWellKnownMethods { private static Dictionary<string, Func<Invocation, Mock, bool>> specialMethods = new Dictionary<string, Func<Invocation, Mock, bool>>() { ["Equals"] = HandleEquals, ["Finalize"] = HandleFinalize, ["GetHashCode"] = HandleGetHashCode, ["get_" + nameof(IMocked.Mock)] = HandleMockGetter, ["ToString"] = HandleToString, }; public static bool Handle(Invocation invocation, Mock mock) { return specialMethods.TryGetValue(invocation.Method.Name, out var handler) && handler.Invoke(invocation, mock); } private static bool HandleEquals(Invocation invocation, Mock mock) { if (IsObjectMethod(invocation.Method) && !mock.MutableSetups.Any(c => IsObjectMethod(c.Method, "Equals"))) { invocation.ReturnValue = ReferenceEquals(invocation.Arguments.First(), mock.Object); return true; } else { return false; } } private static bool HandleFinalize(Invocation invocation, Mock mock) { return IsFinalizer(invocation.Method); } private static bool HandleGetHashCode(Invocation invocation, Mock mock) { // Only if there is no corresponding setup for `GetHashCode()` if (IsObjectMethod(invocation.Method) && !mock.MutableSetups.Any(c => IsObjectMethod(c.Method, "GetHashCode"))) { invocation.ReturnValue = mock.GetHashCode(); return true; } else { return false; } } private static bool HandleToString(Invocation invocation, Mock mock) { // Only if there is no corresponding setup for `ToString()` if (IsObjectMethod(invocation.Method) && !mock.MutableSetups.Any(c => IsObjectMethod(c.Method, "ToString"))) { invocation.ReturnValue = mock.ToString() + ".Object"; return true; } else { return false; } } private static bool HandleMockGetter(Invocation invocation, Mock mock) { if (typeof(IMocked).IsAssignableFrom(invocation.Method.DeclaringType)) { invocation.ReturnValue = mock; return true; } else { return false; } } private static bool IsFinalizer(MethodInfo method) { return method.GetBaseDefinition() == typeof(object).GetMethod("Finalize", BindingFlags.NonPublic | BindingFlags.Instance); } private static bool IsObjectMethod(MethodInfo method) => method.DeclaringType == typeof(object); private static bool IsObjectMethod(MethodInfo method, string name) => IsObjectMethod(method) && method.Name == name; } internal static class FindAndExecuteMatchingSetup { public static bool Handle(Invocation invocation, Mock mock) { var matchingSetup = mock.MutableSetups.FindMatchFor(invocation); if (matchingSetup != null) { matchingSetup.Execute(invocation); return true; } else { return false; } } } internal static class HandleEventSubscription { public static bool Handle(Invocation invocation, Mock mock) { const BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly; var methodName = invocation.Method.Name; // Special case for event accessors. The following, seemingly random character checks are guards against // more expensive checks (for the common case where the invoked method is *not* an event accessor). if (methodName.Length > 4) { if (methodName[0] == 'a' && methodName[3] == '_' && invocation.Method.IsEventAddAccessor()) { var implementingMethod = invocation.Method.GetImplementingMethod(invocation.ProxyType); var @event = implementingMethod.DeclaringType.GetEvents(bindingFlags).SingleOrDefault(e => e.GetAddMethod(true) == implementingMethod); if (@event != null) { bool doesntHaveEventSetup = !mock.MutableSetups.HasEventSetup; if (mock.CallBase && !invocation.Method.IsAbstract) { if (doesntHaveEventSetup) { invocation.ReturnValue = invocation.CallBase(); } } else if (invocation.Arguments.Length > 0 && invocation.Arguments[0] is Delegate delegateInstance) { mock.EventHandlers.Add(@event, delegateInstance); } return doesntHaveEventSetup; } } else if (methodName[0] == 'r' && methodName.Length > 7 && methodName[6] == '_' && invocation.Method.IsEventRemoveAccessor()) { var implementingMethod = invocation.Method.GetImplementingMethod(invocation.ProxyType); var @event = implementingMethod.DeclaringType.GetEvents(bindingFlags).SingleOrDefault(e => e.GetRemoveMethod(true) == implementingMethod); if (@event != null) { bool doesntHaveEventSetup = !mock.MutableSetups.HasEventSetup; if (mock.CallBase && !invocation.Method.IsAbstract) { if (doesntHaveEventSetup) { invocation.ReturnValue = invocation.CallBase(); } } else if (invocation.Arguments.Length > 0 && invocation.Arguments[0] is Delegate delegateInstance) { mock.EventHandlers.Remove(@event, delegateInstance); } return doesntHaveEventSetup; } } } return false; } } internal static class RecordInvocation { public static void Handle(Invocation invocation, Mock mock) { // Save to support Verify[expression] pattern. mock.MutableInvocations.Add(invocation); } } internal static class Return { public static void Handle(Invocation invocation, Mock mock) { new ReturnBaseOrDefaultValue(mock).Execute(invocation); } } internal static class HandleAutoSetupProperties { private static readonly int AccessorPrefixLength = "?et_".Length; // get_ or set_ public static bool Handle(Invocation invocation, Mock mock) { if (mock.AutoSetupPropertiesDefaultValueProvider == null) { return false; } MethodInfo invocationMethod = invocation.Method; if (invocationMethod.IsPropertyAccessor()) { string propertyNameToSearch = invocationMethod.Name.Substring(AccessorPrefixLength); PropertyInfo property = invocationMethod.DeclaringType.GetProperty(propertyNameToSearch); if (property == null) { return false; } var expression = GetPropertyExpression(invocationMethod.DeclaringType, property); object propertyValue; Setup getterSetup = null; if (property.CanRead(out var getter)) { if (ProxyFactory.Instance.IsMethodVisible(getter, out _)) { propertyValue = CreateInitialPropertyValue(mock, getter); getterSetup = new AutoImplementedPropertyGetterSetup(mock, expression, getter, () => propertyValue); mock.MutableSetups.Add(getterSetup); } // If we wanted to optimise for speed, we'd probably be forgiven // for removing the above `IsMethodVisible` guard, as it's rather // unlikely to encounter non-public getters such as the following // in real-world code: // // public T Property { internal get; set; } // // Usually, it's only the setters that are made non-public. For // now however, we prefer correctness. } Setup setterSetup = null; if (property.CanWrite(out var setter)) { if (ProxyFactory.Instance.IsMethodVisible(setter, out _)) { setterSetup = new AutoImplementedPropertySetterSetup(mock, expression, setter, (newValue) => { propertyValue = newValue; }); mock.MutableSetups.Add(setterSetup); } } Setup setupToExecute = invocationMethod.IsGetAccessor() ? getterSetup : setterSetup; setupToExecute.Execute(invocation); return true; } else { return false; } } private static object CreateInitialPropertyValue(Mock mock, MethodInfo getter) { object initialValue = mock.GetDefaultValue(getter, out Mock innerMock, useAlternateProvider: mock.AutoSetupPropertiesDefaultValueProvider); if (innerMock != null) { Mock.SetupAllProperties(innerMock, mock.AutoSetupPropertiesDefaultValueProvider); } return initialValue; } private static LambdaExpression GetPropertyExpression(Type mockType, PropertyInfo property) { var param = Expression.Parameter(mockType, "m"); return Expression.Lambda(Expression.MakeMemberAccess(param, property), param); } } internal static class FailForStrictMock { public static void Handle(Invocation invocation, Mock mock) { if (mock.Behavior == MockBehavior.Strict) { throw MockException.NoSetup(invocation); } } } }
{ "content_hash": "6bf9d06cf58b89afb244364eb92beeda", "timestamp": "", "source": "github", "line_count": 296, "max_line_length": 143, "avg_line_length": 28.97635135135135, "alnum_prop": 0.7007112043838172, "repo_name": "Moq/moq4", "id": "35f618ed058a46b78f5903400f899c780ee7671a", "size": "8758", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Moq/Interception/InterceptionAspects.cs", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "98" }, { "name": "C#", "bytes": "1076265" }, { "name": "XSLT", "bytes": "9157" } ], "symlink_target": "" }
.class Landroid/media/SoundPool$SoundPoolImpl$EventHandler; .super Landroid/os/Handler; .source "SoundPool.java" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Landroid/media/SoundPool$SoundPoolImpl; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x2 name = "EventHandler" .end annotation # instance fields .field private mSoundPool:Landroid/media/SoundPool; .field final synthetic this$0:Landroid/media/SoundPool$SoundPoolImpl; # direct methods .method public constructor <init>(Landroid/media/SoundPool$SoundPoolImpl;Landroid/media/SoundPool;Landroid/os/Looper;)V .locals 0 .param p2, "soundPool" # Landroid/media/SoundPool; .param p3, "looper" # Landroid/os/Looper; .prologue .line 676 iput-object p1, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->this$0:Landroid/media/SoundPool$SoundPoolImpl; .line 677 invoke-direct {p0, p3}, Landroid/os/Handler;-><init>(Landroid/os/Looper;)V .line 678 iput-object p2, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->mSoundPool:Landroid/media/SoundPool; .line 679 return-void .end method # virtual methods .method public handleMessage(Landroid/os/Message;)V .locals 5 .param p1, "msg" # Landroid/os/Message; .prologue .line 683 iget v0, p1, Landroid/os/Message;->what:I packed-switch v0, :pswitch_data_0 .line 693 const-string v0, "SoundPool" new-instance v1, Ljava/lang/StringBuilder; invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V const-string v2, "Unknown message type " invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v1 iget v2, p1, Landroid/os/Message;->what:I invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder; move-result-object v1 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v1 invoke-static {v0, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I .line 696 :goto_0 return-void .line 686 :pswitch_0 iget-object v0, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->this$0:Landroid/media/SoundPool$SoundPoolImpl; # getter for: Landroid/media/SoundPool$SoundPoolImpl;->mLock:Ljava/lang/Object; invoke-static {v0}, Landroid/media/SoundPool$SoundPoolImpl;->access$100(Landroid/media/SoundPool$SoundPoolImpl;)Ljava/lang/Object; move-result-object v1 monitor-enter v1 .line 687 :try_start_0 iget-object v0, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->this$0:Landroid/media/SoundPool$SoundPoolImpl; # getter for: Landroid/media/SoundPool$SoundPoolImpl;->mOnLoadCompleteListener:Landroid/media/SoundPool$OnLoadCompleteListener; invoke-static {v0}, Landroid/media/SoundPool$SoundPoolImpl;->access$200(Landroid/media/SoundPool$SoundPoolImpl;)Landroid/media/SoundPool$OnLoadCompleteListener; move-result-object v0 if-eqz v0, :cond_0 .line 688 iget-object v0, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->this$0:Landroid/media/SoundPool$SoundPoolImpl; # getter for: Landroid/media/SoundPool$SoundPoolImpl;->mOnLoadCompleteListener:Landroid/media/SoundPool$OnLoadCompleteListener; invoke-static {v0}, Landroid/media/SoundPool$SoundPoolImpl;->access$200(Landroid/media/SoundPool$SoundPoolImpl;)Landroid/media/SoundPool$OnLoadCompleteListener; move-result-object v0 iget-object v2, p0, Landroid/media/SoundPool$SoundPoolImpl$EventHandler;->mSoundPool:Landroid/media/SoundPool; iget v3, p1, Landroid/os/Message;->arg1:I iget v4, p1, Landroid/os/Message;->arg2:I invoke-interface {v0, v2, v3, v4}, Landroid/media/SoundPool$OnLoadCompleteListener;->onLoadComplete(Landroid/media/SoundPool;II)V .line 690 :cond_0 monitor-exit v1 goto :goto_0 :catchall_0 move-exception v0 monitor-exit v1 :try_end_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 throw v0 .line 683 nop :pswitch_data_0 .packed-switch 0x1 :pswitch_0 .end packed-switch .end method
{ "content_hash": "c7c6d43afeee37852ad049c0a61188b6", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 164, "avg_line_length": 29.54861111111111, "alnum_prop": 0.7309048178613397, "repo_name": "hexiaoshuai/Flyme_device_ZTE_A1", "id": "1ec91bd55eb84c953be5c51c3397805eb19b5d38", "size": "4255", "binary": false, "copies": "2", "ref": "refs/heads/C880AV1.0.0B06", "path": "framework.jar.out/smali_classes2/android/media/SoundPool$SoundPoolImpl$EventHandler.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "GLSL", "bytes": "1500" }, { "name": "HTML", "bytes": "10195" }, { "name": "Makefile", "bytes": "11258" }, { "name": "Python", "bytes": "924" }, { "name": "Shell", "bytes": "2734" }, { "name": "Smali", "bytes": "234274633" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "3aca67c2badd50a9a74526bbcec55f7a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "af04b1c0c1f0970df83787652a9eef9e192c2794", "size": "192", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Orobanchaceae/Cycnium/Cycnium longiflorum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
ionic-webpack ============= Ionic Webpack Starter ## Quick Start Clone the repository ```bash $ git clone https://github.com/cmackay/ionic-webpack.git ``` Install the dependencies ```bash $ npm install ``` Watch Mode (this will run the webpack dev server) ```bash $ gulp watch ``` Adding Cordova Plugins ```bash $ cordova plugins add ionic-plugin-keyboard cordova-plugin-console cordova-plugin-device ``` Adding Cordova Platforms ```bash $ cordova platform add ios ``` Build ```bash $ gulp && cordova build ``` Running in the emulator ```bash $ cordova emulate ios ```
{ "content_hash": "491b41b63fbd8e11065027ba798e5b39", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 88, "avg_line_length": 12.1875, "alnum_prop": 0.6957264957264957, "repo_name": "cmackay/ionic-webpack", "id": "56fd042f7d962a9d76aa8962b2e362232ded6be7", "size": "585", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "808" }, { "name": "HTML", "bytes": "2591" }, { "name": "JavaScript", "bytes": "12363" } ], "symlink_target": "" }
package com.amazonaws.services.identitymanagement.model; import java.io.Serializable; import com.amazonaws.AmazonWebServiceRequest; /** * */ public class ListPoliciesRequest extends AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> */ private String scope; /** * <p> * A flag to filter the results to only the attached policies. * </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned list * contains only the policies that are attached to a user, group, or role. * When <code>OnlyAttached</code> is <code>false</code>, or when the * parameter is not included, all policies are returned. * </p> */ private Boolean onlyAttached; /** * <p> * The path prefix for filtering the results. This parameter is optional. If * it is not included, it defaults to a slash (/), listing all policies. * </p> */ private String pathPrefix; /** * <p> * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set it to * the value of the <code>Marker</code> element in the response that you * received to indicate where the next call should start. * </p> */ private String marker; /** * <p> * Use this only when paginating results to indicate the maximum number of * items you want in the response. If additional items exist beyond the * maximum you specify, the <code>IsTruncated</code> response element is * <code>true</code>. * </p> * <p> * This parameter is optional. If you do not include it, it defaults to 100. * Note that IAM might return fewer results, even when there are more * results available. In that case, the <code>IsTruncated</code> response * element returns <code>true</code> and <code>Marker</code> contains a * value to include in the subsequent call that tells the service where to * continue from. * </p> */ private Integer maxItems; /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> * * @param scope * The scope to use for filtering the results. </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in * your AWS account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set * to <code>All</code>, all policies are returned. * @see PolicyScopeType */ public void setScope(String scope) { this.scope = scope; } /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> * * @return The scope to use for filtering the results. </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in * your AWS account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is * set to <code>All</code>, all policies are returned. * @see PolicyScopeType */ public String getScope() { return this.scope; } /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> * * @param scope * The scope to use for filtering the results. </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in * your AWS account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set * to <code>All</code>, all policies are returned. * @return Returns a reference to this object so that method calls can be * chained together. * @see PolicyScopeType */ public ListPoliciesRequest withScope(String scope) { setScope(scope); return this; } /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> * * @param scope * The scope to use for filtering the results. </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in * your AWS account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set * to <code>All</code>, all policies are returned. * @return Returns a reference to this object so that method calls can be * chained together. * @see PolicyScopeType */ public void setScope(PolicyScopeType scope) { this.scope = scope.toString(); } /** * <p> * The scope to use for filtering the results. * </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in your AWS * account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set to * <code>All</code>, all policies are returned. * </p> * * @param scope * The scope to use for filtering the results. </p> * <p> * To list only AWS managed policies, set <code>Scope</code> to * <code>AWS</code>. To list only the customer managed policies in * your AWS account, set <code>Scope</code> to <code>Local</code>. * </p> * <p> * This parameter is optional. If it is not included, or if it is set * to <code>All</code>, all policies are returned. * @return Returns a reference to this object so that method calls can be * chained together. * @see PolicyScopeType */ public ListPoliciesRequest withScope(PolicyScopeType scope) { setScope(scope); return this; } /** * <p> * A flag to filter the results to only the attached policies. * </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned list * contains only the policies that are attached to a user, group, or role. * When <code>OnlyAttached</code> is <code>false</code>, or when the * parameter is not included, all policies are returned. * </p> * * @param onlyAttached * A flag to filter the results to only the attached policies. </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned * list contains only the policies that are attached to a user, * group, or role. When <code>OnlyAttached</code> is * <code>false</code>, or when the parameter is not included, all * policies are returned. */ public void setOnlyAttached(Boolean onlyAttached) { this.onlyAttached = onlyAttached; } /** * <p> * A flag to filter the results to only the attached policies. * </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned list * contains only the policies that are attached to a user, group, or role. * When <code>OnlyAttached</code> is <code>false</code>, or when the * parameter is not included, all policies are returned. * </p> * * @return A flag to filter the results to only the attached policies. </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned * list contains only the policies that are attached to a user, * group, or role. When <code>OnlyAttached</code> is * <code>false</code>, or when the parameter is not included, all * policies are returned. */ public Boolean getOnlyAttached() { return this.onlyAttached; } /** * <p> * A flag to filter the results to only the attached policies. * </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned list * contains only the policies that are attached to a user, group, or role. * When <code>OnlyAttached</code> is <code>false</code>, or when the * parameter is not included, all policies are returned. * </p> * * @param onlyAttached * A flag to filter the results to only the attached policies. </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned * list contains only the policies that are attached to a user, * group, or role. When <code>OnlyAttached</code> is * <code>false</code>, or when the parameter is not included, all * policies are returned. * @return Returns a reference to this object so that method calls can be * chained together. */ public ListPoliciesRequest withOnlyAttached(Boolean onlyAttached) { setOnlyAttached(onlyAttached); return this; } /** * <p> * A flag to filter the results to only the attached policies. * </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned list * contains only the policies that are attached to a user, group, or role. * When <code>OnlyAttached</code> is <code>false</code>, or when the * parameter is not included, all policies are returned. * </p> * * @return A flag to filter the results to only the attached policies. </p> * <p> * When <code>OnlyAttached</code> is <code>true</code>, the returned * list contains only the policies that are attached to a user, * group, or role. When <code>OnlyAttached</code> is * <code>false</code>, or when the parameter is not included, all * policies are returned. */ public Boolean isOnlyAttached() { return this.onlyAttached; } /** * <p> * The path prefix for filtering the results. This parameter is optional. If * it is not included, it defaults to a slash (/), listing all policies. * </p> * * @param pathPrefix * The path prefix for filtering the results. This parameter is * optional. If it is not included, it defaults to a slash (/), * listing all policies. */ public void setPathPrefix(String pathPrefix) { this.pathPrefix = pathPrefix; } /** * <p> * The path prefix for filtering the results. This parameter is optional. If * it is not included, it defaults to a slash (/), listing all policies. * </p> * * @return The path prefix for filtering the results. This parameter is * optional. If it is not included, it defaults to a slash (/), * listing all policies. */ public String getPathPrefix() { return this.pathPrefix; } /** * <p> * The path prefix for filtering the results. This parameter is optional. If * it is not included, it defaults to a slash (/), listing all policies. * </p> * * @param pathPrefix * The path prefix for filtering the results. This parameter is * optional. If it is not included, it defaults to a slash (/), * listing all policies. * @return Returns a reference to this object so that method calls can be * chained together. */ public ListPoliciesRequest withPathPrefix(String pathPrefix) { setPathPrefix(pathPrefix); return this; } /** * <p> * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set it to * the value of the <code>Marker</code> element in the response that you * received to indicate where the next call should start. * </p> * * @param marker * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set * it to the value of the <code>Marker</code> element in the response * that you received to indicate where the next call should start. */ public void setMarker(String marker) { this.marker = marker; } /** * <p> * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set it to * the value of the <code>Marker</code> element in the response that you * received to indicate where the next call should start. * </p> * * @return Use this parameter only when paginating results and only after * you receive a response indicating that the results are truncated. * Set it to the value of the <code>Marker</code> element in the * response that you received to indicate where the next call should * start. */ public String getMarker() { return this.marker; } /** * <p> * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set it to * the value of the <code>Marker</code> element in the response that you * received to indicate where the next call should start. * </p> * * @param marker * Use this parameter only when paginating results and only after you * receive a response indicating that the results are truncated. Set * it to the value of the <code>Marker</code> element in the response * that you received to indicate where the next call should start. * @return Returns a reference to this object so that method calls can be * chained together. */ public ListPoliciesRequest withMarker(String marker) { setMarker(marker); return this; } /** * <p> * Use this only when paginating results to indicate the maximum number of * items you want in the response. If additional items exist beyond the * maximum you specify, the <code>IsTruncated</code> response element is * <code>true</code>. * </p> * <p> * This parameter is optional. If you do not include it, it defaults to 100. * Note that IAM might return fewer results, even when there are more * results available. In that case, the <code>IsTruncated</code> response * element returns <code>true</code> and <code>Marker</code> contains a * value to include in the subsequent call that tells the service where to * continue from. * </p> * * @param maxItems * Use this only when paginating results to indicate the maximum * number of items you want in the response. If additional items * exist beyond the maximum you specify, the <code>IsTruncated</code> * response element is <code>true</code>.</p> * <p> * This parameter is optional. If you do not include it, it defaults * to 100. Note that IAM might return fewer results, even when there * are more results available. In that case, the * <code>IsTruncated</code> response element returns * <code>true</code> and <code>Marker</code> contains a value to * include in the subsequent call that tells the service where to * continue from. */ public void setMaxItems(Integer maxItems) { this.maxItems = maxItems; } /** * <p> * Use this only when paginating results to indicate the maximum number of * items you want in the response. If additional items exist beyond the * maximum you specify, the <code>IsTruncated</code> response element is * <code>true</code>. * </p> * <p> * This parameter is optional. If you do not include it, it defaults to 100. * Note that IAM might return fewer results, even when there are more * results available. In that case, the <code>IsTruncated</code> response * element returns <code>true</code> and <code>Marker</code> contains a * value to include in the subsequent call that tells the service where to * continue from. * </p> * * @return Use this only when paginating results to indicate the maximum * number of items you want in the response. If additional items * exist beyond the maximum you specify, the * <code>IsTruncated</code> response element is <code>true</code> * .</p> * <p> * This parameter is optional. If you do not include it, it defaults * to 100. Note that IAM might return fewer results, even when there * are more results available. In that case, the * <code>IsTruncated</code> response element returns * <code>true</code> and <code>Marker</code> contains a value to * include in the subsequent call that tells the service where to * continue from. */ public Integer getMaxItems() { return this.maxItems; } /** * <p> * Use this only when paginating results to indicate the maximum number of * items you want in the response. If additional items exist beyond the * maximum you specify, the <code>IsTruncated</code> response element is * <code>true</code>. * </p> * <p> * This parameter is optional. If you do not include it, it defaults to 100. * Note that IAM might return fewer results, even when there are more * results available. In that case, the <code>IsTruncated</code> response * element returns <code>true</code> and <code>Marker</code> contains a * value to include in the subsequent call that tells the service where to * continue from. * </p> * * @param maxItems * Use this only when paginating results to indicate the maximum * number of items you want in the response. If additional items * exist beyond the maximum you specify, the <code>IsTruncated</code> * response element is <code>true</code>.</p> * <p> * This parameter is optional. If you do not include it, it defaults * to 100. Note that IAM might return fewer results, even when there * are more results available. In that case, the * <code>IsTruncated</code> response element returns * <code>true</code> and <code>Marker</code> contains a value to * include in the subsequent call that tells the service where to * continue from. * @return Returns a reference to this object so that method calls can be * chained together. */ public ListPoliciesRequest withMaxItems(Integer maxItems) { setMaxItems(maxItems); return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getScope() != null) sb.append("Scope: " + getScope() + ","); if (getOnlyAttached() != null) sb.append("OnlyAttached: " + getOnlyAttached() + ","); if (getPathPrefix() != null) sb.append("PathPrefix: " + getPathPrefix() + ","); if (getMarker() != null) sb.append("Marker: " + getMarker() + ","); if (getMaxItems() != null) sb.append("MaxItems: " + getMaxItems()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListPoliciesRequest == false) return false; ListPoliciesRequest other = (ListPoliciesRequest) obj; if (other.getScope() == null ^ this.getScope() == null) return false; if (other.getScope() != null && other.getScope().equals(this.getScope()) == false) return false; if (other.getOnlyAttached() == null ^ this.getOnlyAttached() == null) return false; if (other.getOnlyAttached() != null && other.getOnlyAttached().equals(this.getOnlyAttached()) == false) return false; if (other.getPathPrefix() == null ^ this.getPathPrefix() == null) return false; if (other.getPathPrefix() != null && other.getPathPrefix().equals(this.getPathPrefix()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; if (other.getMaxItems() == null ^ this.getMaxItems() == null) return false; if (other.getMaxItems() != null && other.getMaxItems().equals(this.getMaxItems()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getScope() == null) ? 0 : getScope().hashCode()); hashCode = prime * hashCode + ((getOnlyAttached() == null) ? 0 : getOnlyAttached() .hashCode()); hashCode = prime * hashCode + ((getPathPrefix() == null) ? 0 : getPathPrefix().hashCode()); hashCode = prime * hashCode + ((getMarker() == null) ? 0 : getMarker().hashCode()); hashCode = prime * hashCode + ((getMaxItems() == null) ? 0 : getMaxItems().hashCode()); return hashCode; } @Override public ListPoliciesRequest clone() { return (ListPoliciesRequest) super.clone(); } }
{ "content_hash": "725820a6344c09ae32d89eb8102c27b0", "timestamp": "", "source": "github", "line_count": 626, "max_line_length": 83, "avg_line_length": 39.56869009584665, "alnum_prop": 0.5931772305207913, "repo_name": "trasa/aws-sdk-java", "id": "a1131d8ff3dc4d746984b9c59d786a2920f0a96b", "size": "25354", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aws-java-sdk-iam/src/main/java/com/amazonaws/services/identitymanagement/model/ListPoliciesRequest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "100011199" }, { "name": "Scilab", "bytes": "2354" } ], "symlink_target": "" }
def merge_sort(m): #The base case is if m is empty or a single element. Then the list is sorted. if len(m)<=1: return m #split the original list up into left and right halves somehow. Shouldn't really matter how left=[] right=[] for i,x in enumerate(m): if i%2==1: left.append(x) else: right.append(x) #merge recursively call merge_sort to eventually get to the base case. left=merge_sort(left) right=merge_sort(right) return merge(left,right) def merge(left,right): result=[] #left and right are guaranteed to be sorted because the output to merge_sort is a sorted list. While both lists still have elements choose the smaller element to come first. while len(left)>0 and len(right)>0: if left[0]<=right[0]: result.append(left.pop(0)) else: result.append(right.pop(0)) #once you exhause one of the left or right lists you can just copy the rest of the list into your result, you know that it will be sorted while len(left)>0: result.append(left.pop(0)) while len(right)>0: result.append(right.pop(0)) return result x=[10,9,8,7,6,5,4,3,2,1,71,72,73,45,65,43,21] print "x" print x print "merge_sort(x)" print merge_sort(x)
{ "content_hash": "9f9b8c892d99a7a5851d6b953d7e0bf8", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 178, "avg_line_length": 30.068181818181817, "alnum_prop": 0.6281179138321995, "repo_name": "alexcasgarcia/CCI", "id": "f13995405c79b224d5b0cb7eaa07a8a9f7ec3fa0", "size": "1416", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SortingAndSearching/MergeSort.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "31235" } ], "symlink_target": "" }
AWS Lambda Microframework ## About AWS Wave AWS Wave is a microframework that makes it easier to develop rest api's using AWS Lambda Functions and API Gateway. It attempts to make the develpment faster by easing common tasks, such as: - Exception handling - Request body deserialization - Response body serialization - Request validation ## Lambda Proxy Integration In order to use AWS Wave all methods defined in the API Gateway must use Request Integration Type:```LAMBDA_PROXY```. A detailed documentation can be found [here](http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html). ## Getting Started ### Instalation ``` npm install aws-wave ``` ### Handling Requests The AWS Wave microframework provides an abstract class called AbstratRequestHandler that handles a Lambda execution call and perform some operations such as request body deserialization, request validation, response body serialization and exception handling. ```javascript const AbstractRequestHandler = require('aws-wave').AbstractRequestHandler; class PostUserHandler extends AbstractRequestHandler { before(event, context) { // perform anything before the execution this.cors('*'); } execute(body, context, callback) { callback({ message: 'Hello from aws-wave' }); } } exports.handler = (event, context, callback) => { const handler = new PostUserHandler(); handler.handleRequest(event, context, callback); } ``` ### The Request / Response Attributes The AbstractRequestHandler class provides methods to access all the request / response attributes and the Lambda environment context as well: Attribute | Method -------------------------------- | ----------------------------------------------------- Request Headers | getRequestHeader("headerName") Response Headers | addResponseHeader("headerName") Raw Request Body | getRawRequestBody() Http Method | getHttpMethod() Resource Path | getPath() Stage Variables | getStageVariable("stageVariableName") Path Parameters | getPathParameter("parameterName") Query String Parameters | getQueryStringParameter("parameterName") Request Context Parameter | getRequestContextParameter("parameterName") ### Request Validation AWS Wave uses [Joi](https://github.com/hapijs/joi) to validate requests. To validate the incoming request a schema should be defined in the class constructor Eg.: ```javascript const Joi = require('joi'); const AbstractRequestHandler = require('aws-wave').AbstractRequestHandler; const schema = Joi.object().keys({ code: Joi.string().required() }); class PhoneConfirmationHandler extends AbstractRequestHandler { constructor() { super(schema); } before(event, context) { this.cors('*'); } execute(body, context, callback) { callback({ message: 'The request body is valid!' }); } } exports.handler = (event, context, callback) => { const handler = new PhoneConfirmationHandler(); handler.handleRequest(event, context, callback); } ``` If any constraint violation occurs an UnprocessableEntityException will be thrown and the http response will be serialized with the error details. Eg.: ```sh curl -X POST http://my-api-gateway-resource/phone-confirmations -d '{"invalidParam": "value"}' ``` I this particular example the server will respond the above request with a http status code 422 and the following response body: ```json { "message": "Unprocessable entity", "errors": [ { "message": "\"code\" is required", "path": "code", "type": "any.required", "context": { "key": "code" } } ] } ``` A detailed documentation of Joi validations can be found [here](https://github.com/hapijs/joi/blob/v10.6.0/API.md). If you want to provide your own request body validation mechanism, the method *resolveRequestBodyValidator* should be overridden: ```javascript const Wave = require('aws-wave'); const RequestBodyValidator = Wave.RequestBodyValidator; const UnprocessableEntityException = Wave.UnprocessableEntityException; class MyCustomValidator extends RequestBodyValidator { validate(entity, schema) { // custom validation here // should throw a HttpException if any constraint is violated throw new UnprocessableEntityException({message: 'Invalid request body'}); } } module.exports = MyCustomValidator; ``` ```javascript const MyCustomValidator = require('my-custom-validator'); const AbstractRequestHandler = require('aws-wave').AbstractRequestHandler; const myCustomSchema = {}; class MyHandler extends AbstractRequestHandler { constructor() { super(myCustomSchema); } before(event, context) { this.cors('*'); } execute(body, context, callback) { callback({ message: 'The request body is valid!' }); } resolveRequestBodyValidator() { return new MyCustomValidator(); } } exports.handler = (event, context, callback) => { const handler = new MyHandler(); handler.handleRequest(event, context, callback); } ``` ### Serialization and Deserialization The current version of AWS Wave supports only JSON serialization/deserialization. The deserialization and serialization strategies are based on two http headers: - **Content-Type** for deserialization - **Accept** for serialization If you want to provide your own request body deserializer, the method *resolveRequestBodyDeserializer* should be overridden: ```javascript const Wave = require('aws-wave'); const BadRequestException = Wave.BadRequestException; const RequestBodyDeserializerStrategy = Wave.RequestBodyDeserializerStrategy; class MyCustomDeserializer extends RequestBodyDeserializerStrategy { deserialize(body) { // custom deserialization here // should throw a HttpException if any error occur throw new BadRequestException({message: 'Invalid request body'}); } } module.exports = MyCustomDeserializer; ``` If you want to provide your own response body serializer, the method *resolveResponseBodySerializer* should be overridden: ```javascript const Wave = require('aws-wave'); const InternalServerErrorException = Wave.InternalServerErrorException; const RequestBodyDeserializerStrategy = Wave.ResponseBodySerializerStrategy; class MyCustomSerializer extends ResponseBodySerializerStrategy { serialize(entity) { // custom serialization here // should throw a HttpException if any error occur throw new InternalServerErrorException({message: 'Unable to serialize the response body'}); } } module.exports = MyCustomSerializer; ``` ### Exception Handling AWS Wave offers a built in exception handler, any HttpException will be serialized as response body and any exception not handled will be serialized as an Internal Server Error. E.g.: ```javascript const Wave = require('aws-wave'); const AbstractRequestHandler = Wave.AbstractRequestHandler; const UnauthorizedException = Wave.UnauthorizedException; class PostUserHandler extends AbstractRequestHandler { before(event, context) { this.cors('*'); } execute(body, context, callback) { // any validation if (body.hasPermission) return callback(new UnauthorizedException({'The user has no permission'})); callback({ message: 'The user has permission'}); } } exports.handler = (event, context, callback) => { const handler = new PostUserHandler(); handler.handleRequest(event, context, callback); } ``` ## License The AWS Wave microframework is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT) .
{ "content_hash": "2920ed0403454bd23cb7fba5b783edd3", "timestamp": "", "source": "github", "line_count": 258, "max_line_length": 258, "avg_line_length": 30.368217054263567, "alnum_prop": 0.7144862795149968, "repo_name": "it-gorillaz/aws-wave", "id": "3a58c5d3b91c1f35554f0367f5df7ad708a5b348", "size": "7846", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "133605" } ], "symlink_target": "" }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/carousel.css"> <link rel="stylesheet" href="css/main.css"> <script src="js/vendor/modernizr-2.6.2.min.js"></script> </head> <body> <!--[if lt IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <!-- Add your site or application content here --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="active navbar-brand" href="index.html">PC/Mac Guide</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li class=""><a href="apple.html">Apple</a></li> <li class=""><a href="pc.html">PC</a></li> <li><a href="about.html">About</a></li> <li><a href="contact.html">Contact</a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div id="wrapper"> <div id="content"> <h1>About This Site</h1> <p> This website acts as a simple guide through the pc industry in the mid 80s. A summary of the events that led to the success of the two major personal computing companies are described here. </p> </div> <div id="sidebar"> <img src="img/altair.jpg"> <div class="caption">The Altair 8008 was the first official personal computer. Most enthusiasts loved this because they were able to experiment with a machine without having to rely on mainframe computers </div> </div> <footer> <p class="pull-right"><a href="#">Back to top</a></p> <p>&copy; 2014, FakeCompany. &middot; <a href="#">Privacy</a> &middot; <a href="#">Terms</a></p> </footer> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> <script src="js/bootstrap.min.js"></script> <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. --> <script> (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]= function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date; e=o.createElement(i);r=o.getElementsByTagName(i)[0]; e.src='//www.google-analytics.com/analytics.js'; r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); ga('create','UA-XXXXX-X');ga('send','pageview'); </script> </body> </html>
{ "content_hash": "3279240b473e8baa5e1ba747072532bd", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 184, "avg_line_length": 47.95402298850575, "alnum_prop": 0.5407478427612655, "repo_name": "JalenMoorer/Triumph-of-the-Nerds", "id": "9c14d07917dd110ced27b37f3b8d70b4f041ccfa", "size": "4172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "about.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10337" }, { "name": "JavaScript", "bytes": "2624" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; namespace NicoNico.Net.Entities.Search { public class Suggestion { [JsonProperty("candidates")] public string[] Candidates { get; set; } } }
{ "content_hash": "7c226ac47b762478a38537d3b584eff0", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 48, "avg_line_length": 20.666666666666668, "alnum_prop": 0.7064516129032258, "repo_name": "drasticactions/niconico.net", "id": "378dc42e973ec2d90b474cbf2d24dc84e76adb5d", "size": "312", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "NicoNico.Net/Entities/Search/Suggestion.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "61617" } ], "symlink_target": "" }
"""BAA URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.contrib import admin from django.conf.urls import url, include from .views import * import interface.views as interface # routers #router = routers.DefaultRouter() #router.register(r'volunteers/$', ) urlpatterns = [ url(r'^$', interface.login_view), url(r'^api-token-auth/', CustomObtainAuthToken.as_view()), url(r'^admin/', include(admin.site.urls)), url(r'^api/', include('api.urls')), url(r'docs/', include('rest_framework_docs.urls')), url(r'^interface/', include('interface.urls')), url(r'^guide/', guide) ]
{ "content_hash": "b48625b0ccdae8ae3ca01fcc312ab3b3", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 77, "avg_line_length": 30.94736842105263, "alnum_prop": 0.6785714285714286, "repo_name": "jumbocodespring2017/bostonathleticsassociation", "id": "fbb00f91e4fa24bcdc6a679a7c2f5964b4388807", "size": "1176", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "back-end/BAA/urls.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "583725" }, { "name": "HTML", "bytes": "24194" }, { "name": "JavaScript", "bytes": "3394213" }, { "name": "Python", "bytes": "67089" } ], "symlink_target": "" }
permalink: /enWhile redirect: / layout: redirect sitemap: false ---
{ "content_hash": "c6a1ab051ead15b6891070ee1ab625be", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 19, "avg_line_length": 13.4, "alnum_prop": 0.746268656716418, "repo_name": "sunnankar/wucorg", "id": "197a97b81e49754db732fd46b3f8e2f10b4b4878", "size": "71", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "redirects/redirects3/enWhile.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "191423" }, { "name": "HTML", "bytes": "2070119" }, { "name": "JavaScript", "bytes": "126181" }, { "name": "PHP", "bytes": "96" }, { "name": "Python", "bytes": "2572" } ], "symlink_target": "" }
/** * @module node-zk-treecache */ /** */ import { validatePath } from "./PathUtils" import { Client, ACL, Id, CreateMode, Exception } from "node-zookeeper-client" const PATH_SEPARATOR = "/" const ANYONE_ID_UNSAFE = new Id("world", "anyone") const OPEN_ACL_UNSAFE = [new ACL(31, ANYONE_ID_UNSAFE)] const EMPTY_CALLBACK = () => { return } const DEFAULT_ACL_PROVIDER: ACLProvider = { getDefaultAcl() { return null }, getAclForPath() { return null } } /** * @private * @param path the path to split */ export function split(path: string): string[] { validatePath(path) return path.split(PATH_SEPARATOR).filter(s => s.length > 0) } export interface ACLProvider { getDefaultAcl(): ACL[] | null getAclForPath(path: string): ACL[] | null } // Verify if we are running ZK 3.5+, in which case we can use the create mode container (code 4) function getCreateMode(asContainers: boolean) { return CreateMode.PERSISTENT } /** * Make sure all the nodes in the path are created. NOTE: Unlike File.mkdirs(), Zookeeper doesn't distinguish * between directories and files. So, every node in the path is created. The data for each node is an empty blob * * @private * @param zkClient the client * @param path path to ensure * @param makeLastNode if true, all nodes are created. If false, only the parent nodes are created * @param aclProvider if not null, the ACL provider to use when creating parent nodes * @param asContainers if true, nodes are created as {@link CreateMode#CONTAINER} (need ZK > 3.5) * @param cb the callback to call after having created the path */ export function mkdirs( zkClient: Client, path: string, makeLastNode: boolean, aclProvider: ACLProvider | null, asContainers: boolean, cb?: (err: Error | Exception, p: string) => void ) { validatePath(path) let s = split(path) if (!makeLastNode) { s.pop() } path = "/" + s.join("/") const mode = getCreateMode(asContainers) aclProvider = aclProvider || DEFAULT_ACL_PROVIDER const acl = aclProvider.getAclForPath(path) || aclProvider.getDefaultAcl() || OPEN_ACL_UNSAFE zkClient.mkdirp(path, acl, mode, cb || EMPTY_CALLBACK) } /** * Given a full path, return the node name. i.e. "/one/two/three" will return "three" * * @private * @param path the path * @return the node */ export function getNodeFromPath(path: string): string { validatePath(path) const last = path.split(PATH_SEPARATOR).pop() if (last === undefined) throw new Error(`Error while validating ${path}, it should have been valid`) return last } /** * Given a parent path and a child node, create a combined full path * * @param parent the parent * @param child the child * @return full path */ export function makePath(parent: string, child: string): string { return [parent.replace(/\/+$/, ""), child.replace(/^\/+/, "")].join("/") }
{ "content_hash": "8a9fca5a5e454e717f09eb0161f84eb0", "timestamp": "", "source": "github", "line_count": 110, "max_line_length": 112, "avg_line_length": 26.418181818181818, "alnum_prop": 0.6782518926359257, "repo_name": "fmonniot/node-zookeeper-treecache", "id": "8e521852fd71206fecd2d6288a883e41ce747a32", "size": "2906", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ZkPaths.ts", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "1003" }, { "name": "TypeScript", "bytes": "98089" } ], "symlink_target": "" }
export function isCommented(cm, nLine, match) { let token = cm.getTokenAt({ line: nLine, ch: match.index }); if (token && token.type) { return token.type === 'comment'; } return false; } export function isLineAfterMain(cm, nLine) { let totalLines = cm.getDoc().size; let voidRE = new RegExp('void main\\s*\\(\\s*[void]*\\)', 'i'); for (let i = 0; i < nLine && i < totalLines; i++) { // Do not start until being inside the main function let voidMatch = voidRE.exec(cm.getLine(i)); if (voidMatch) { return true; } } return false; } export function getVariableType(cm, sVariable) { let nLines = cm.getDoc().size; // Show line where the value of the variable is been asigned let uniformRE = new RegExp('\\s*uniform\\s+(float|vec2|vec3|vec4)\\s+' + sVariable + '\\s*;'); let voidRE = new RegExp('void main\\s*\\(\\s*[void]*\\)', 'i'); let voidIN = false; let constructRE = new RegExp('(float|vec\\d)\\s+(' + sVariable + ')\\s*[;]?', 'i'); for (let i = 0; i < nLines; i++) { if (!voidIN) { // Do not start until being inside the main function let voidMatch = voidRE.exec(cm.getLine(i)); if (voidMatch) { voidIN = true; } else { let uniformMatch = uniformRE.exec(cm.getLine(i)); if (uniformMatch && !isCommented(cm, i, uniformMatch)) { return uniformMatch[1]; } } } else { let constructMatch = constructRE.exec(cm.getLine(i)); if (constructMatch && constructMatch[1] && !isCommented(cm, i, constructMatch)) { return constructMatch[1]; } } } return 'none'; } export function getShaderForTypeVarInLine(cm, sType, sVariable, nLine) { let frag = ''; let offset = 1; for (let i = 0; i < nLine + 1 && i < cm.getDoc().size; i++) { if (cm.getLine(i)) { frag += cm.getLine(i) + '\n'; } } frag += '\tgl_FragColor = '; if (sType === 'float') { frag += 'vec4(vec3(' + sVariable + '),1.)'; } else if (sType === 'vec2') { frag += 'vec4(vec3(' + sVariable + ',0.),1.)'; } else if (sType === 'vec3') { frag += 'vec4(' + sVariable + ',1.)'; } else if (sType === 'vec4') { frag += sVariable; } frag += ';\n}\n'; return frag; } export function getResultRange(test_results) { let min_ms = '10000000.0'; let min_line = 0; let max_ms = '0.0'; let max_line = 0; for (let i in test_results) { if (test_results[i].ms < min_ms) { min_ms = test_results[i].ms; min_line = test_results[i].line; } if (test_results[i].ms > max_ms) { max_ms = test_results[i].ms; max_line = test_results[i].line; } } return { min:{line: min_line, ms: min_ms}, max:{line: max_line, ms: max_ms} }; } export function getMedian(values) { values.sort( function(a,b) {return a - b;} ); var half = Math.floor(values.length/2); if(values.length % 2) return values[half]; else return (values[half-1] + values[half]) / 2.0; } export function getDeltaSum(test_results) { let total = 0.0; for (let i in test_results) { if (test_results[i].delta > 0) { total += test_results[i].delta; } } return total; } export function getHits(test_results) { let total = 0; for (let i in test_results) { if (test_results[i].delta > 0) { total++; } } return total; }
{ "content_hash": "f313190f12675e552983b414b10c52c5", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 98, "avg_line_length": 29.094488188976378, "alnum_prop": 0.516914749661705, "repo_name": "MagnusThor/demolished", "id": "a74f0eec2a20726361f87218923c8fca79019e28", "size": "3696", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/ui/editor/tools/debugging.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "27933" }, { "name": "GLSL", "bytes": "100085" }, { "name": "HTML", "bytes": "4776" }, { "name": "JavaScript", "bytes": "704319" }, { "name": "TypeScript", "bytes": "136891" } ], "symlink_target": "" }
require_relative '../../spec_helper' require_relative 'shared/include' require 'set' describe "Set#===" do it_behaves_like :set_include, :=== it "is an alias for include?" do set = Set.new set.method(:===).should == set.method(:include?) end end
{ "content_hash": "b22f37afdf49bcd022c90c0801bb3a5d", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 52, "avg_line_length": 21.833333333333332, "alnum_prop": 0.6412213740458015, "repo_name": "nobu/rubyspec", "id": "70d392a27dc5f6bc5df60bd2765fbe20e7caaae6", "size": "262", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "library/set/case_compare_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "145966" }, { "name": "Ruby", "bytes": "6187303" }, { "name": "Shell", "bytes": "65" } ], "symlink_target": "" }
/** * The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets. * * @class Pairs */ var Pairs = {}; module.exports = Pairs; var Pair = require('./Pair'); var Common = require('../core/Common'); (function() { /** * Creates a new pairs structure. * @method create * @param {object} options * @return {pairs} A new pairs structure */ Pairs.create = function(options) { return Common.extend({ table: {}, list: [], collisionStart: [], collisionActive: [], collisionEnd: [] }, options); }; /** * Updates pairs given a list of collisions. * @method update * @param {object} pairs * @param {collision[]} collisions * @param {number} timestamp */ Pairs.update = function(pairs, collisions, timestamp) { var pairsList = pairs.list, pairsListLength = pairsList.length, pairsTable = pairs.table, collisionsLength = collisions.length, collisionStart = pairs.collisionStart, collisionEnd = pairs.collisionEnd, collisionActive = pairs.collisionActive, collision, pairIndex, pair, i; // clear collision state arrays, but maintain old reference collisionStart.length = 0; collisionEnd.length = 0; collisionActive.length = 0; for (i = 0; i < pairsListLength; i++) { pairsList[i].confirmedActive = false; } for (i = 0; i < collisionsLength; i++) { collision = collisions[i]; pair = collision.pair; if (pair) { // pair already exists (but may or may not be active) if (pair.isActive) { // pair exists and is active collisionActive.push(pair); } else { // pair exists but was inactive, so a collision has just started again collisionStart.push(pair); } // update the pair Pair.update(pair, collision, timestamp); pair.confirmedActive = true; } else { // pair did not exist, create a new pair pair = Pair.create(collision, timestamp); pairsTable[pair.id] = pair; // push the new pair collisionStart.push(pair); pairsList.push(pair); } } // find pairs that are no longer active var removePairIndex = []; pairsListLength = pairsList.length; for (i = 0; i < pairsListLength; i++) { pair = pairsList[i]; if (!pair.confirmedActive) { Pair.setActive(pair, false, timestamp); collisionEnd.push(pair); if (!pair.collision.bodyA.isSleeping && !pair.collision.bodyB.isSleeping) { removePairIndex.push(i); } } } // remove inactive pairs for (i = 0; i < removePairIndex.length; i++) { pairIndex = removePairIndex[i] - i; pair = pairsList[pairIndex]; pairsList.splice(pairIndex, 1); delete pairsTable[pair.id]; } }; /** * Clears the given pairs structure. * @method clear * @param {pairs} pairs * @return {pairs} pairs */ Pairs.clear = function(pairs) { pairs.table = {}; pairs.list.length = 0; pairs.collisionStart.length = 0; pairs.collisionActive.length = 0; pairs.collisionEnd.length = 0; return pairs; }; })();
{ "content_hash": "690fa120477ec9651a684991b55d8fbd", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 95, "avg_line_length": 29.023076923076925, "alnum_prop": 0.5163000265041081, "repo_name": "BeanSeed/phaser", "id": "2c62cd366730e3c36f3fab0b9e12a6dfaa02723c", "size": "3773", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "src/physics/matter-js/lib/collision/Pairs.js", "mode": "33188", "license": "mit", "language": [ { "name": "GLSL", "bytes": "10989" }, { "name": "JavaScript", "bytes": "8903660" }, { "name": "TypeScript", "bytes": "25049" } ], "symlink_target": "" }
using System; namespace IHomer.GenericRepository.Attributes { [AttributeUsageAttribute(AttributeTargets.Property, Inherited = true, AllowMultiple = false)] public class ParentAttribute : Attribute { } }
{ "content_hash": "5c9493ba90bd49a2e34011db6b7312af", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 97, "avg_line_length": 24.555555555555557, "alnum_prop": 0.751131221719457, "repo_name": "WimAtIHomer/GenericRepository", "id": "e440f931cbd46d9a5c70b6d4e8cd93073055c14e", "size": "223", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/GenericRepository/Attributes/ParentAttribute.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "38560" }, { "name": "PowerShell", "bytes": "49954" } ], "symlink_target": "" }
import React from "react" import styled from 'styled-components'; import Header from "../../components/Header" import FullscreenSlide from "../../components/FullscreenSlide/index" import TeamContent from "./components/TeamContent" import {PALETTE} from "../../services/styleTools" const TeamStyl = styled.div` background-color: ${PALETTE.PRIMARY}; ` const Team = () => { return ( <TeamStyl> <Header/> <TeamContent /> </TeamStyl> ) } export default Team;
{ "content_hash": "8f3beec368bd4d79fcc3539844f958aa", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 68, "avg_line_length": 17.5, "alnum_prop": 0.6775510204081633, "repo_name": "michalsindelar/generace", "id": "cf903ff9d6f52ac62153e4b9e3ed154304c9206b", "size": "499", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "react-ui/src/scenes/Team/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2351" }, { "name": "HTML", "bytes": "73755" }, { "name": "JavaScript", "bytes": "2653" } ], "symlink_target": "" }
package example import ( "fmt" "time" "github.com/dshil/gometer" ) func ExampleWriteToFile() { metrics := gometer.New() metrics.SetFormatter(gometer.NewFormatter("\n")) gometer.StartFileWriter(gometer.FileWriterParams{ FilePath: "test_file", UpdateInterval: time.Second, ErrorHandler: func(err error) { fmt.Println(err) }, }).Stop() }
{ "content_hash": "5a354325342fcec6e1b20ab4cd878375", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 50, "avg_line_length": 17.285714285714285, "alnum_prop": 0.6942148760330579, "repo_name": "dshil/gometer", "id": "28e0672a78e077df0813a80c6fb7e9e8101c69d2", "size": "363", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_examples/write_to_file_test.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "22284" } ], "symlink_target": "" }
namespace persistence { namespace op { template <> StreamableType getStreamableType<hotel::Hotel>() { return StreamableType::Hotel; } template <> StreamableType getStreamableType<hotel::Reservation>() { return StreamableType::Reservation; } template <> StreamableType getStreamableType<hotel::Person>() { return StreamableType::Person; } StreamableType getStreamableType(const StreamableTypePtr& ptr) { return std::visit([](const auto& ptr) { using T = typename std::decay<decltype(*ptr)>::type; return getStreamableType<T>(); }, ptr); } } // namespace op } // namespace persistence
{ "content_hash": "9bf46db407a27fc6365c7ab155837e80", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 110, "avg_line_length": 35.72222222222222, "alnum_prop": 0.6905132192846034, "repo_name": "decden/hotel", "id": "9607278d66ac3f6cf27a606b7a5d5a3457525d18", "size": "683", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "persistence/op/operations.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "330315" }, { "name": "CMake", "bytes": "4998" }, { "name": "Python", "bytes": "569" } ], "symlink_target": "" }
package ru.besttuts.stockwidget.sync; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.HashSet; import java.util.List; import java.util.Set; import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; import ru.besttuts.stockwidget.model.QuoteType; import ru.besttuts.stockwidget.model.Setting; import ru.besttuts.stockwidget.sync.deserializer.YahooMultiQueryDataDeserializer; import ru.besttuts.stockwidget.sync.model.YahooMultiQueryData; import ru.besttuts.stockwidget.util.Utils; import ru.besttuts.stockwidget.util.YahooQueryBuilder; import static ru.besttuts.stockwidget.util.LogUtils.LOGD; import static ru.besttuts.stockwidget.util.LogUtils.LOGE; import static ru.besttuts.stockwidget.util.LogUtils.makeLogTag; /** * Created by roman on 07.01.2015. */ public class RemoteYahooFinanceDataFetcher { private static final String TAG = makeLogTag(RemoteYahooFinanceDataFetcher.class); private String xchangeUrl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20('EURUSD'%2C'USDRUB'%2C'EURRUB'%2C'CNYRUB')%3B&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="; private String quotesUrl = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22GCF15.CMX%22%2C%22PLF15.NYM%22%2C%22PAF15.NYM%22%2C%22SIF15.CMX%22%2C%22HGF15.CMX%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="; private String baseYahooUrlreturnJsonPrepand = "https://query.yahooapis.com/v1/public/yql?q="; private String baseYahooUrlreturnJsonAppend = "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback="; private String yahooFinanceMultiQuery = "SELECT%20*%20FROM%20query.multi%20WHERE%20queries%3D%22%s%3B%22"; private String yahooFinanceXchangeQueryUrl = "select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20("; private String yahooFinanceQuotesQueryUrl = "select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20("; private Set<String> currencyExchangeSet = new HashSet<>(); private Set<String> goodSet = new HashSet<>(); public void populateQuoteSet(int quoteType, String symbol) { switch (quoteType) { case QuoteType.CURRENCY: currencyExchangeSet.add(symbol); break; case QuoteType.GOODS: case QuoteType.INDICES: case QuoteType.STOCK: case QuoteType.QUOTES: // String s = new String(symbol); // if ("^DJI".equals(s)) s = "INDU"; // символ исключение для ^DJI goodSet.add(symbol); break; } } public void populateQuoteSet(List<Setting> settings) { for (Setting setting : settings) { switch (setting.getQuoteType()) { case QuoteType.CURRENCY: currencyExchangeSet.add(setting.getQuoteSymbol()); break; case QuoteType.GOODS: case QuoteType.INDICES: case QuoteType.STOCK: case QuoteType.QUOTES: // String s = new String(setting.getQuoteSymbol()); // if ("^DJI".equals(s)) s = "INDU"; // символ исключение для ^DJI goodSet.add(setting.getQuoteSymbol()); break; } } } public String buildYahooFinanceMultiQuery() { StringBuilder builder = new StringBuilder(); builder.append("SELECT%20*%20FROM%20query.multi%20WHERE%20queries%3D%22"); if (null != currencyExchangeSet && currencyExchangeSet.size() > 0) { builder.append(getYahooFinanceXchangeQuery()); } builder.append(";"); if (null != goodSet && goodSet.size() > 0) { builder.append(getYahooFinanceQuotesQuery()); } builder.append("%3B%22"); return builder.toString(); } public String buildYahooFinanceMultiQueryUrl() { return baseYahooUrlreturnJsonPrepand + buildYahooFinanceMultiQuery() + baseYahooUrlreturnJsonAppend; } public String transformCurrencyExchangeSetToString(){ StringBuilder builder = new StringBuilder(); builder.append("'"); for (String s : currencyExchangeSet) { builder.append(s); builder.append("'%2C'"); } return builder.substring(0, builder.length() - 4); } public String getYahooFinanceXchangeQuery() { return yahooFinanceXchangeQueryUrl + transformCurrencyExchangeSetToString() + ")"; } public String transformQuoteSetToString(){ StringBuilder builder = new StringBuilder(); builder.append("'"); for (String s : goodSet) { builder.append(s); builder.append("'%2C'"); } return builder.substring(0, builder.length() - 4); } public String getYahooFinanceQuotesQuery() { return yahooFinanceQuotesQueryUrl + transformQuoteSetToString() + ")"; } // Convert the InputStream into a string static String convertStreamToString(InputStream is) { java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A"); return s.hasNext() ? s.next() : ""; } public String downloadQuotes() throws IOException { String sUrl = buildYahooFinanceMultiQueryUrl(); LOGD(TAG, "downloadQuotes: " + sUrl); return downloadUrl(sUrl); } public YahooMultiQueryData getYahooMultiQueryData() throws IOException { Gson gson = new GsonBuilder().registerTypeAdapter( YahooMultiQueryData.class, new YahooMultiQueryDataDeserializer()) .create(); // OkHttpClient client = new OkHttpClient.Builder() // .addNetworkInterceptor(new Interceptor() { // @Override // public Response intercept(Chain chain) throws IOException { // Request request = chain.request(); // Request newRequest; // String newUrl = YahooQueryBuilder.HTTP_QUERY_YAHOOAPIS_COM_V1_PUBLIC + "yql?" // + Utils.encodeYahooApiQuery(request.url().query()); // LOGD(TAG, "request.url.query: " + newUrl); // newRequest = request.newBuilder().url(newUrl).build(); // return chain.proceed(newRequest); // } // }) // .build(); Retrofit retrofit = new Retrofit.Builder() // .client(client) .baseUrl(YahooQueryBuilder.HTTP_QUERY_YAHOOAPIS_COM_V1_PUBLIC) .addConverterFactory(GsonConverterFactory.create(gson)) .build(); YahooFinanceService service = retrofit.create(YahooFinanceService.class); String yahooQuery = YahooQueryBuilder.buildYahooFinanceMultiQuery(currencyExchangeSet, goodSet); // String encodedYahooQuery = Utils.encodeYahooApiQuery(yahooQuery); Call<YahooMultiQueryData> callYahooMultiQueryData = service.yahooMultiQueryData(yahooQuery); LOGD(TAG, "(getYahooMultiQueryData): " + callYahooMultiQueryData.request().url()); YahooMultiQueryData data = callYahooMultiQueryData.execute().body(); if(null == data) { LOGE(TAG, "[FAIL] load or parse data from yahoo api: YahooMultiQueryData = " + data); // String newUrl = YahooQueryBuilder.HTTP_QUERY_YAHOOAPIS_COM_V1_PUBLIC + "yql?" + encodedYahooQuery; // LOGD(TAG, "[SUCCESS] load: " + downloadUrl(newUrl)); return new YahooMultiQueryData(); } LOGD(TAG, "[SUCCESS] load or parse data from yahoo api: YahooMultiQueryData = " + data); return data; } public String downloadUrl(String sUrl) throws IOException { InputStream is = null; try { URL url = new URL(sUrl); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setRequestMethod("GET"); conn.setDoInput(true); // Starts the query conn.connect(); int response = conn.getResponseCode(); LOGD(TAG, "The response is: " + response); is = conn.getInputStream(); return convertStreamToString(is); // Makes sure that the InputStream is closed after the app is // finished using it. } finally { if (is != null) { is.close(); } } } }
{ "content_hash": "67ee3895d6173c3feba2702056a78a02", "timestamp": "", "source": "github", "line_count": 218, "max_line_length": 307, "avg_line_length": 41.04587155963303, "alnum_prop": 0.6357845328565043, "repo_name": "romanchekashov/currency-and-stock-widget", "id": "f63321659e02ada3eb3c043aed48dd6b093c08c1", "size": "8986", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "android/src/main/java/ru/besttuts/stockwidget/sync/RemoteYahooFinanceDataFetcher.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "438711" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>quickchick: Not compatible</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.css" rel="stylesheet"> <link href="../../../../../bootstrap-custom.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <script src="../../../../../moment.min.js"></script> <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <body> <div class="container"> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> <div class="navbar-header"> <a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a> </div> <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="../..">clean / released</a></li> <li class="active"><a href="">8.9.1 / quickchick - 1.2.0</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href="../..">« Up</a> <h1> quickchick <small> 1.2.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2020-08-24 17:47:06 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2020-08-24 17:47:06 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-num base Num library distributed with the OCaml compiler base-threads base base-unix base camlp5 7.12 Preprocessor-pretty-printer of OCaml conf-findutils 1 Virtual package relying on findutils conf-m4 1 Virtual package relying on m4 coq 8.9.1 Formal proof management system num 0 The Num library for arbitrary-precision integer and rational arithmetic ocaml 4.05.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.05.0 Official 4.05.0 release ocaml-config 1 OCaml Switch Configuration ocamlfind 1.8.1 A library manager for OCaml # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;leonidas@umd.edu&quot; synopsis: &quot;Randomized Property-Based Testing Plugin for Coq&quot; homepage: &quot;https://github.com/QuickChick/QuickChick&quot; dev-repo: &quot;git+https://github.com/QuickChick/QuickChick.git&quot; bug-reports: &quot;https://github.com/QuickChick/QuickChick/issues&quot; license: &quot;MIT&quot; build: [ make &quot;-j%{jobs}%&quot; ] install: [ make &quot;install&quot; ] depends: [ &quot;ocaml&quot; {&gt;= &quot;4.05.0&quot;} &quot;coq&quot; {&gt;= &quot;8.10&quot; &lt; &quot;8.11~&quot;} &quot;coq-ext-lib&quot; &quot;coq-mathcomp-ssreflect&quot; &quot;ocamlbuild&quot; &quot;ocamlfind&quot; &quot;coq-simple-io&quot; {&gt;= &quot;1.0.0&quot;} ] authors: [ &quot;Leonidas Lampropoulos &lt;&gt;&quot; &quot;Zoe Paraskevopoulou &lt;&gt;&quot; &quot;Maxime Denes &lt;&gt;&quot; &quot;Catalin Hritcu &lt;&gt;&quot; &quot;Benjamin Pierce &lt;&gt;&quot; &quot;Li-yao Xia &lt;&gt;&quot; &quot;Arthur Azevedo de Amorim &lt;&gt;&quot; &quot;Yishuai Li &lt;&gt;&quot; &quot;Antal Spector-Zabusky &lt;&gt;&quot; ] tags: [ &quot;keyword:extraction&quot; &quot;category:Miscellaneous/Coq Extensions&quot; &quot;logpath:QuickChick&quot; ] url { src: &quot;https://github.com/QuickChick/QuickChick/archive/v1.2.0.tar.gz&quot; checksum: &quot;md5=df766e9807b8549576149c635db1c553&quot; } </pre> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Dry install</h2> <p>Dry install with the current Coq version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --show-action coq-quickchick.1.2.0 coq.8.9.1</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.9.1). The following dependencies couldn&#39;t be met: - coq-quickchick -&gt; coq &gt;= 8.10 Your request can&#39;t be satisfied: - No available version of coq satisfies the constraints No solution found, exiting </pre></dd> </dl> <p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-quickchick.1.2.0</code></dd> <dt>Return code</dt> <dd>0</dd> </dl> <h2>Install dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> </dl> <h2>Installation size</h2> <p>No files were installed.</p> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>true</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Missing removes</dt> <dd> none </dd> <dt>Wrong removes</dt> <dd> none </dd> </dl> </div> </div> </div> <hr/> <div class="footer"> <p class="text-center"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "329ff903fccd78161e08d8571dc03aeb", "timestamp": "", "source": "github", "line_count": 180, "max_line_length": 157, "avg_line_length": 39.73888888888889, "alnum_prop": 0.5434083601286174, "repo_name": "coq-bench/coq-bench.github.io", "id": "63c6a81652c286d823b8512fab5a0188dfb9ccd8", "size": "7155", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.05.0-2.0.6/released/8.9.1/quickchick/1.2.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd"> <changeSet author="maxence" id="1437483898513-1"> <addColumn tableName="workload"> <column name="spentworkload" type="FLOAT8(17)"/> </addColumn> </changeSet> <changeSet author="maxence" id="1437649651"> <addColumn tableName="workload"> <column name="lastworkedstep" type="int4"/> </addColumn> </changeSet> </databaseChangeLog>
{ "content_hash": "ae4d69324e8161e2240a1f08072ff5ab", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 254, "avg_line_length": 54.53846153846154, "alnum_prop": 0.6784203102961918, "repo_name": "ghiringh/Wegas", "id": "0250cbd67ba93ef360a8696c86e42d9f4b3b13d6", "size": "709", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wegas-core/src/main/resources/dbchangelogs/1437483880.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "903473" }, { "name": "HTML", "bytes": "195241" }, { "name": "Java", "bytes": "1757507" }, { "name": "JavaScript", "bytes": "4366779" } ], "symlink_target": "" }
namespace engine { class ISimulationManager: virtual public IManager { public: static constexpr IdType TypeId = "ISimulationManager"; public: virtual physx::PxPhysics& physics() = 0; virtual physx::PxScene& scene() = 0; virtual void update() = 0; }; using ISimulationManagerRef = std::shared_ptr<ISimulationManager>; using ISimulationManagerWeakRef = std::weak_ptr<ISimulationManager>; } // namespace engine
{ "content_hash": "0375ab2e7a0aa93b32e9c00b1c6c8943", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 68, "avg_line_length": 22, "alnum_prop": 0.7583732057416268, "repo_name": "DDJV-INF740/GameEngine-src", "id": "7d8d9b187cbb00bfb43e5fd5013f56beeb493bab", "size": "546", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Core/GameManagers/ISimulationManager.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "5156" }, { "name": "C++", "bytes": "230627" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_151) on Thu Dec 05 05:02:11 MST 2019 --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Uses of Class org.wildfly.swarm.config.management.access.constraint.Type (BOM: * : All 2.6.0.Final API)</title> <meta name="date" content="2019-12-05"> <link rel="stylesheet" type="text/css" href="../../../../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Uses of Class org.wildfly.swarm.config.management.access.constraint.Type (BOM: * : All 2.6.0.Final API)"; } } catch(err) { } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.6.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/management/access/constraint/class-use/Type.html" target="_top">Frames</a></li> <li><a href="Type.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h2 title="Uses of Class org.wildfly.swarm.config.management.access.constraint.Type" class="title">Uses of Class<br>org.wildfly.swarm.config.management.access.constraint.Type</h2> </div> <div class="classUseContainer"> <ul class="blockList"> <li class="blockList"> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation"> <caption><span>Packages that use <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Package</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.management.access">org.wildfly.swarm.config.management.access</a></td> <td class="colLast">&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="#org.wildfly.swarm.config.management.access.constraint">org.wildfly.swarm.config.management.access.constraint</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> <li class="blockList"> <ul class="blockList"> <li class="blockList"><a name="org.wildfly.swarm.config.management.access"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a> in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/package-summary.html">org.wildfly.swarm.config.management.access</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/package-summary.html">org.wildfly.swarm.config.management.access</a> that return <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></code></td> <td class="colLast"><span class="typeNameLabel">ApplicationClassificationConstraint.ApplicationClassificationConstraintResources.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.ApplicationClassificationConstraintResources.html#type-java.lang.String-">type</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</code>&nbsp;</td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></code></td> <td class="colLast"><span class="typeNameLabel">SensitivityClassificationConstraint.SensitivityClassificationConstraintResources.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.SensitivityClassificationConstraintResources.html#type-java.lang.String-">type</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/package-summary.html">org.wildfly.swarm.config.management.access</a> that return types with arguments of type <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">ApplicationClassificationConstraint.ApplicationClassificationConstraintResources.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.ApplicationClassificationConstraintResources.html#types--">types</a></span>()</code> <div class="block">Get the list of Type resources</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&gt;</code></td> <td class="colLast"><span class="typeNameLabel">SensitivityClassificationConstraint.SensitivityClassificationConstraintResources.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.SensitivityClassificationConstraintResources.html#types--">types</a></span>()</code> <div class="block">Get the list of Type resources</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/package-summary.html">org.wildfly.swarm.config.management.access</a> with parameters of type <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.html" title="type parameter in ApplicationClassificationConstraint">T</a></code></td> <td class="colLast"><span class="typeNameLabel">ApplicationClassificationConstraint.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.html#type-org.wildfly.swarm.config.management.access.constraint.Type-">type</a></span>(<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&nbsp;value)</code> <div class="block">Add the Type object to the list of subresources</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.html" title="type parameter in SensitivityClassificationConstraint">T</a></code></td> <td class="colLast"><span class="typeNameLabel">SensitivityClassificationConstraint.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.html#type-org.wildfly.swarm.config.management.access.constraint.Type-">type</a></span>(<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&nbsp;value)</code> <div class="block">Add the Type object to the list of subresources</div> </td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Method parameters in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/package-summary.html">org.wildfly.swarm.config.management.access</a> with type arguments of type <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.html" title="type parameter in ApplicationClassificationConstraint">T</a></code></td> <td class="colLast"><span class="typeNameLabel">ApplicationClassificationConstraint.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/ApplicationClassificationConstraint.html#types-java.util.List-">types</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&gt;&nbsp;value)</code> <div class="block">Add all Type objects to this subresource</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.html" title="type parameter in SensitivityClassificationConstraint">T</a></code></td> <td class="colLast"><span class="typeNameLabel">SensitivityClassificationConstraint.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/SensitivityClassificationConstraint.html#types-java.util.List-">types</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;<a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&gt;&nbsp;value)</code> <div class="block">Add all Type objects to this subresource</div> </td> </tr> </tbody> </table> </li> <li class="blockList"><a name="org.wildfly.swarm.config.management.access.constraint"> <!-- --> </a> <h3>Uses of <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a> in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/package-summary.html">org.wildfly.swarm.config.management.access.constraint</a></h3> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation"> <caption><span>Classes in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/package-summary.html">org.wildfly.swarm.config.management.access.constraint</a> with type parameters of type <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code>class&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&lt;T extends <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&lt;T&gt;&gt;</span></code> <div class="block">The application classification constraints by type.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/TypeConsumer.html" title="interface in org.wildfly.swarm.config.management.access.constraint">TypeConsumer</a>&lt;T extends <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&lt;T&gt;&gt;</span></code>&nbsp;</td> </tr> <tr class="altColor"> <td class="colFirst"><code>interface&nbsp;</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/TypeSupplier.html" title="interface in org.wildfly.swarm.config.management.access.constraint">TypeSupplier</a>&lt;T extends <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a>&gt;</span></code>&nbsp;</td> </tr> </tbody> </table> <table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation"> <caption><span>Methods in <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/package-summary.html">org.wildfly.swarm.config.management.access.constraint</a> that return <a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><code><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Type</a></code></td> <td class="colLast"><span class="typeNameLabel">TypeSupplier.</span><code><span class="memberNameLink"><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/TypeSupplier.html#get--">get</a></span>()</code> <div class="block">Constructed instance of Type resource</div> </td> </tr> </tbody> </table> </li> </ul> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../../../overview-summary.html">Overview</a></li> <li><a href="../package-summary.html">Package</a></li> <li><a href="../../../../../../../../org/wildfly/swarm/config/management/access/constraint/Type.html" title="class in org.wildfly.swarm.config.management.access.constraint">Class</a></li> <li class="navBarCell1Rev">Use</li> <li><a href="../../../../../../../../overview-tree.html">Tree</a></li> <li><a href="../../../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">Thorntail API, 2.6.0.Final</div> </div> <div class="subNav"> <ul class="navList"> <li>Prev</li> <li>Next</li> </ul> <ul class="navList"> <li><a href="../../../../../../../../index.html?org/wildfly/swarm/config/management/access/constraint/class-use/Type.html" target="_top">Frames</a></li> <li><a href="Type.html" target="_top">No&nbsp;Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small>Copyright &#169; 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p> </body> </html>
{ "content_hash": "781466a203069446dce61d6a4aedbbe6", "timestamp": "", "source": "github", "line_count": 282, "max_line_length": 624, "avg_line_length": 72.5, "alnum_prop": 0.6861824406945464, "repo_name": "wildfly-swarm/wildfly-swarm-javadocs", "id": "6eda0a0e3f907fbd85b80147f20765e1a132901b", "size": "20445", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "2.6.0.Final/apidocs/org/wildfly/swarm/config/management/access/constraint/class-use/Type.html", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', 'givemecode.core.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), )
{ "content_hash": "a07b68a3848a3f5a70b579f6046ec733", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 58, "avg_line_length": 24.4, "alnum_prop": 0.6967213114754098, "repo_name": "givemecode/givemecode-project", "id": "ff5b52db29976fa3d997246f5f4077ea5bd462bf", "size": "260", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "givemecode/urls.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "147230" }, { "name": "JavaScript", "bytes": "62729" }, { "name": "Python", "bytes": "6007" } ], "symlink_target": "" }
module EventWorld class InstallGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) desc "Copies faye.ru file" def install copy_file "faye.ru", "faye.ru" end end end
{ "content_hash": "48162772cee7cd3c5eccf59473fac7d4", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 58, "avg_line_length": 23.1, "alnum_prop": 0.658008658008658, "repo_name": "lukkry/event_world", "id": "3329adf1e9c4daaf351f54bb98307a46c177fb4d", "size": "231", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/generators/event_world/install/install_generator.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CoffeeScript", "bytes": "987" }, { "name": "JavaScript", "bytes": "719" }, { "name": "Ruby", "bytes": "21348" } ], "symlink_target": "" }
use proc_macro2::{Ident, TokenStream}; use syn::{ parenthesized, parse::{Parse, Parser}, Attribute, LitStr, }; use crate::conversion::{ api::{CppVisibility, DeletedOrDefaulted, Layout, References, SpecialMemberKind, Virtualness}, convert_error::{ConvertErrorWithContext, ErrorContext}, ConvertErrorFromCpp, }; /// The set of all annotations that autocxx_bindgen has added /// for our benefit. #[derive(Debug)] pub(crate) struct BindgenSemanticAttributes(Vec<BindgenSemanticAttribute>); impl BindgenSemanticAttributes { // Remove `bindgen_` attributes. They don't have a corresponding macro defined anywhere, // so they will cause compilation errors if we leave them in. // We may return an error if one of the bindgen attributes shows that the // item can't be processed. pub(crate) fn new_retaining_others(attrs: &mut Vec<Attribute>) -> Self { let metadata = Self::new(attrs); attrs.retain(|a| a.path.segments.last().unwrap().ident != "cpp_semantics"); metadata } pub(crate) fn new(attrs: &[Attribute]) -> Self { Self( attrs .iter() .filter_map(|attr| { if attr.path.segments.last().unwrap().ident == "cpp_semantics" { let r: Result<BindgenSemanticAttribute, syn::Error> = attr.parse_args(); r.ok() } else { None } }) .collect(), ) } /// Some attributes indicate we can never handle a given item. Check for those. pub(crate) fn check_for_fatal_attrs( &self, id_for_context: &Ident, ) -> Result<(), ConvertErrorWithContext> { if self.has_attr("unused_template_param") { Err(ConvertErrorWithContext( ConvertErrorFromCpp::UnusedTemplateParam, Some(ErrorContext::new_for_item(id_for_context.clone())), )) } else if self.get_cpp_visibility() != CppVisibility::Public { Err(ConvertErrorWithContext( ConvertErrorFromCpp::NonPublicNestedType, Some(ErrorContext::new_for_item(id_for_context.clone())), )) } else { Ok(()) } } /// Whether the given attribute is present. pub(super) fn has_attr(&self, attr_name: &str) -> bool { self.0.iter().any(|a| a.is_ident(attr_name)) } /// The C++ visibility of the item. pub(super) fn get_cpp_visibility(&self) -> CppVisibility { if self.has_attr("visibility_private") { CppVisibility::Private } else if self.has_attr("visibility_protected") { CppVisibility::Protected } else { CppVisibility::Public } } /// Whether the item is virtual. pub(super) fn get_virtualness(&self) -> Virtualness { if self.has_attr("pure_virtual") { Virtualness::PureVirtual } else if self.has_attr("bindgen_virtual") { Virtualness::Virtual } else { Virtualness::None } } pub(super) fn get_deleted_or_defaulted(&self) -> DeletedOrDefaulted { if self.has_attr("deleted") { DeletedOrDefaulted::Deleted } else if self.has_attr("defaulted") { DeletedOrDefaulted::Defaulted } else { DeletedOrDefaulted::Neither } } fn parse_if_present<T: Parse>(&self, annotation: &str) -> Option<T> { self.0 .iter() .find(|a| a.is_ident(annotation)) .map(|a| a.parse_args().unwrap()) } fn string_if_present(&self, annotation: &str) -> Option<String> { let ls: Option<LitStr> = self.parse_if_present(annotation); ls.map(|ls| ls.value()) } /// The in-memory layout of the item. pub(super) fn get_layout(&self) -> Option<Layout> { self.parse_if_present("layout") } /// The original C++ name, which bindgen may have changed. pub(super) fn get_original_name(&self) -> Option<String> { self.string_if_present("original_name") } /// Whether this is a move constructor or other special member. pub(super) fn special_member_kind(&self) -> Option<SpecialMemberKind> { self.string_if_present("special_member") .map(|kind| match kind.as_str() { "default_ctor" => SpecialMemberKind::DefaultConstructor, "copy_ctor" => SpecialMemberKind::CopyConstructor, "move_ctor" => SpecialMemberKind::MoveConstructor, "dtor" => SpecialMemberKind::Destructor, "assignment_operator" => SpecialMemberKind::AssignmentOperator, _ => panic!("unexpected special_member_kind"), }) } /// Any reference parameters or return values. pub(super) fn get_reference_parameters_and_return(&self) -> References { let mut results = References::default(); for a in &self.0 { if a.is_ident("ret_type_reference") { results.ref_return = true; } else if a.is_ident("ret_type_rvalue_reference") { results.rvalue_ref_return = true; } else if a.is_ident("arg_type_reference") { let r: Result<Ident, syn::Error> = a.parse_args(); if let Ok(ls) = r { results.ref_params.insert(ls); } } else if a.is_ident("arg_type_rvalue_reference") { let r: Result<Ident, syn::Error> = a.parse_args(); if let Ok(ls) = r { results.rvalue_ref_params.insert(ls); } } } results } } #[derive(Debug)] struct BindgenSemanticAttribute { annotation_name: Ident, body: Option<TokenStream>, } impl BindgenSemanticAttribute { fn is_ident(&self, name: &str) -> bool { self.annotation_name == name } fn parse_args<T: Parse>(&self) -> Result<T, syn::Error> { T::parse.parse2(self.body.as_ref().unwrap().clone()) } } impl Parse for BindgenSemanticAttribute { fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> { let annotation_name: Ident = input.parse()?; if input.peek(syn::token::Paren) { let body_contents; parenthesized!(body_contents in input); Ok(Self { annotation_name, body: Some(body_contents.parse()?), }) } else if !input.is_empty() { Err(input.error("expected nothing")) } else { Ok(Self { annotation_name, body: None, }) } } }
{ "content_hash": "34868a139e345293d3de483e60620e3f", "timestamp": "", "source": "github", "line_count": 197, "max_line_length": 97, "avg_line_length": 34.4263959390863, "alnum_prop": 0.557800058979652, "repo_name": "chromium/chromium", "id": "63a47010a2645de37d952fcdd2d96f5d39797971", "size": "7117", "binary": false, "copies": "7", "ref": "refs/heads/main", "path": "third_party/rust/autocxx_engine/v0_23/crate/src/conversion/parse/bindgen_semantic_attributes.rs", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^<target^>` where ^<target^> is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\qikify.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\qikify.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end
{ "content_hash": "bf3f8ed4fb09c65f124a0aac09ce9a26", "timestamp": "", "source": "github", "line_count": 190, "max_line_length": 79, "avg_line_length": 26.821052631578947, "alnum_prop": 0.6970172684458399, "repo_name": "trela/qikify", "id": "6ab379ff98346612d43035c9574e1ac03b93ca7d", "size": "5096", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/make.bat", "mode": "33188", "license": "mit", "language": [ { "name": "CoffeeScript", "bytes": "8884" }, { "name": "JavaScript", "bytes": "384422" }, { "name": "Python", "bytes": "221116" } ], "symlink_target": "" }
<?php namespace PagesBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; class DefaultController extends Controller { public function menuAction(){ $em = $this->getDoctrine()->getEntityManager(); $pages = $em->getRepository('PagesBundle:Pages')->findAll(); return $this->render('PagesBundle:Default:module/menu.html.twig', array('pages' => $pages)); } public function indexAction($name) { return $this->render('PagesBundle:Default:index.html.twig', array('name' => $name)); } public function pageAction($id){ $em = $this->getDoctrine()->getEntityManager(); $page = $em->getRepository('PagesBundle:Pages')->find($id); return $this->render('FrontOfficeBundle:ecommerce:pagesdynamique.html.twig',array('page'=>$page)); } }
{ "content_hash": "43cd98d36324f2582d60e6ce4882b156", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 106, "avg_line_length": 32.11538461538461, "alnum_prop": 0.665868263473054, "repo_name": "medali1990/BoutiqueInformatique", "id": "4e3f6ca3e30ebbbe3a315d6698c1c2d29309bd9c", "size": "835", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/PagesBundle/Controller/DefaultController.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3606" }, { "name": "CSS", "bytes": "179501" }, { "name": "HTML", "bytes": "147456" }, { "name": "JavaScript", "bytes": "26005" }, { "name": "PHP", "bytes": "150089" } ], "symlink_target": "" }
namespace IGCS::MessageHandler { void addNotification(const string& notificationText) { NamedPipeManager::instance().writeNotification(notificationText); } void logDebug(const char* fmt, ...) { #ifdef _DEBUG va_list args; va_start(args, fmt); const string formattedArgs = Utils::formatStringVa(fmt, args); va_end(args); NamedPipeManager::instance().writeMessage(formattedArgs, false, true); #endif } void logError(const char* fmt, ...) { va_list args; va_start(args, fmt); const string formattedArgs = Utils::formatStringVa(fmt, args); va_end(args); NamedPipeManager::instance().writeMessage(formattedArgs, true, false); } void logLine(const char* fmt, ...) { va_list args; va_start(args, fmt); string format(fmt); format += '\n'; const string formattedArgs = Utils::formatStringVa(fmt, args); va_end(args); NamedPipeManager::instance().writeMessage(formattedArgs); } }
{ "content_hash": "3173cfb5a1a9e7836093be5a80733ee3", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 72, "avg_line_length": 21.558139534883722, "alnum_prop": 0.703344120819849, "repo_name": "FransBouma/InjectableGenericCameraSystem", "id": "4838fff5b60eafb26d3d61ab29de7f550f03623a", "size": "2705", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Cameras/Cyberpunk2077/InjectableGenericCameraSystem/MessageHandler.cpp", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Assembly", "bytes": "446746" }, { "name": "C", "bytes": "2569785" }, { "name": "C#", "bytes": "843174" }, { "name": "C++", "bytes": "16433213" } ], "symlink_target": "" }
using System; namespace Mono.Facebook.Platform { public class Photos { #region "Member Variables" #endregion #region "Constructors" public Photos() { } #endregion } }
{ "content_hash": "a0cae9983ea38c00cbd7a4c4758587b9", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 34, "avg_line_length": 14.8125, "alnum_prop": 0.5316455696202531, "repo_name": "simpleverso/facebook-sharp", "id": "2dac46a0c90dad01b943785d377fdbeba4944ca5", "size": "237", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/Mono.Facebook.Platform/Photos.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "2024" }, { "name": "C#", "bytes": "102212" }, { "name": "CSS", "bytes": "428" }, { "name": "Shell", "bytes": "44" } ], "symlink_target": "" }
% Chapter X \chapter{Learning model parameters from data} % Chapter title \label{Learning model parameters from data} % For referencing the chapter elsewhere, use Figaro provides support for learning model parameters from data. In this section, a special type of compound element will be presented which allows a distribution to be learned from observed evidence. Details are given about the algorithm Figaro provides for learning parameters. Lastly, an example using parameters and learning algorithms to determine the fairness of a set of die rolls is presented. \section{Parameters and parameterized elements} This section discusses elements which are learnable parameters. For clarity, a distinction should be made on the meaning of the word \emph{parameter} in this context. This is different from a method parameter or Scala type parameter. In this section, we use \emph{parameter} to refer to a Figaro element which can be learned from data. There are currently two such types of parameters in Figaro - \texttt{BetaParameter} and \texttt{DirichletParameter}. A customary illustration of parameter learning is to consider the outcomes of a coin flip and determine whether or not the coin is fair. In the case of a \texttt{Flip} element (which is a Bernoulli distribution), the conjugate prior distribution is a Beta distribution. If the coin is not fair, we would expect a prior distribution to have a higher value of alpha or beta (the shape variables of a Beta). First, we will create the conjugate prior distribution of a \texttt{Flip} \begin{flushleft} \texttt{val fairness = BetaParameter(1,1)} \end{flushleft} The element \texttt{fairness} is the parameter we will use to model the bias of our coin. The behavior of a \texttt{BetaParameter} is similar to a normal \texttt{Beta} element, with a few extra methods and properties. Most importantly, we later use it to create a model learned from parameterized elements. Creation of a parameterized element is accomplished in exactly the same way as creating a compound element. \begin{flushleft} \texttt{val f = Flip(fairness)} \end{flushleft} This element models a flip of a coin having the fairness specified by the beta parameter, using a value of \texttt{true} to represent heads and \texttt{false} to represent tails. We have actually created an instance of \texttt{ParameterizedFlip}, which is a special type of compound element. A \texttt{ParameterizedFlip} is created simply by providing a \texttt{BetaParameter} as the argument to \texttt{Flip}. By using a \texttt{ParameterizedFlip}, the evidence we observe on f can be used to learn the value of \texttt{fairness}. Thus, the next step is to provide the data observed from flips of the coin. Values can be observed just as with other elements, by using \texttt{f.observe(true)} or \texttt{f.observe(false)}. We could also use conditions or constraints. \marginpar{This example is found in FairCoin.Scala} As a more detailed example, suppose we have seen 24 heads and 62 tails. One way to represent this data is in a Scala sequence. Note that for readability, the sequence is truncated here. \begin{flushleft} \texttt{val data = Seq('H', 'H', 'H', 'T', 'H', 'H', 'T', 'H', ...} \end{flushleft} The following block of Scala code will iterate through each of the items in the sequence, create a Flip element using the parameter, and observe true or false based on the side of the coin: \begin{flushleft} \texttt{data.foreach \{ d => \newline val f = Flip(fairness) \newline \tab if (d == 'H') \{ \newline \tab f.observe(true) \newline \} else if (d == 'T') \{ \newline \tab f.observe(false) \newline \} \newline \} } \end{flushleft} We have created a parameter, parameterized elements and considered a set of data. Note that each time a parameterize flip is created, it is using the same \texttt{BetaParameter}. It is now desirable to employ a learning mechanism to determine the fairness of the coin, and to create a new element corresponding to the learned value. This is possible by using a learning algorithm. \section{Expectation maximization} A learning algorithm can be used to determine the values of parameterized elements. At the end of the process, a parameter targeted by the learning algorithm can provide a new element according to the observed data. Presently, Figaro provides one learning algorithm, expectation maximization, based on variable elimination to compute sufficient statistics. Recall that expectation maximization is an iterative algorithm consisting of an expectation step and a maximization step. During the expectation step, an estimate is produced for the sufficient statistics of the parameter. The estimates are then used in the maximization step to find the most likely value of the parameter. This continues for a set number of iterations and converges toward the true parameter value. From a practical standpoint, learning a parameter with expectation maximization is very simple. We need only provide the target parameter and, optionally, the number of iterations to the algorithm. The default number of iterations is 10. This can be done in the following way: \begin{flushleft} \texttt{val learningAlgorithm = ExpectationMaximization(fairness) \newline learningAlgorithm.start \newline learningAlgorithm.kill \newline \newline val coin = Flip(fairness.MAPValue) \newline println("The probability of a coin with this fairness showing 'heads' is: ") \newline println(coin.prob) } \end{flushleft} After the algorithm has finished running, we can retrieve an element learned from the parameter by using \texttt{Flip(fairness.MAPValue)}. The element \texttt{coin} is a \texttt{Flip}, where the probability of producing true is determined from the data we observed above. It is important to make a distinction between parameterized elements and learned elements. Parameterized elements are compound elements and serve as our means of supplying data about a parameter. A learned element is an atomic element with arguments learned from the data we have observed. After running the program, we see: \begin{flushleft} \texttt{The probability of a coin with this fairness showing 'heads' is: 0.7159090909090909} \end{flushleft} We may want to make further explorations about the learned model. For instance, if we wanted to know the probability that two flips of this coin show the same side, we could use \begin{flushleft} \texttt{val t1 = Flip(fairness.MAPValue) \newline val t2 = Flip(fairness.MAPValue) \newline val equal = t1 === t2} \end{flushleft} We can then use variable elimination to determine the probability that the coins show the same side: \begin{flushleft} \texttt{val alg = VariableElimination(equal) \newline alg.start() \newline println("The probability of two coins which exhibit this fairness showing the same side is: " + alg.probability(equal, \textbf{true})) \newline alg.kill() } \end{flushleft} This results in the following output: \begin{flushleft} \texttt{The probability of two coins which exhibit this fairness showing the same side is: 0.5932334710743803} \end{flushleft} \section{A second example} In the previous sections, parameter learning was discussed using a Beta parameter. This section will explain the use of Dirichlet parameters. The Dirichlet distribution is a multidimensional generalization of the Beta with a variable number of concentration parameters or alpha values. These values correspond to the weight of each possible outcome in the posterior distribution. In a Dirichlet parameter with two dimensions, the alpha values might again correspond to the outcome of heads and tails, or true and false. Using a higher number of dimensions, we can model a number of different categories or outcomes. Suppose we are given a set of data in which each record represents a roll of two die out of three possible die. The sum of the die is available, as well as which die were selected for the roll. However, the individual outcome of each die is not available. Our task is to learn the fairness of each die. The first step is to define the possible outcomes from a dice roll. This is easily accomplished by using a Scala list: \begin{flushleft} \marginpar{This example is found in FairDice.Scala} \texttt{val outcomes = List(1, 2, 3, 4, 5, 6)} \end{flushleft} Next, we create a parameter representing the fairness of each die: \begin{flushleft} \texttt{val fairness1 = DirichletParameter(1,1,1,1,1,1) \newline val fairness2 = DirichletParameter(1,1,1,1,1,1) \newline val fairness3 = DirichletParameter(1,1,1,1,1,1) \newline val parameters = Seq(fairness1, fairness2, fairness3) } \end{flushleft} Each die is initially assumed to be fair. For convenience, we can place all three parameters in a Scala sequence named \texttt{parameters}. An item this sequence at index i can be accessed with \texttt{parameters(i)}. This sequence will help us to concisely observe the data from which the parameters are learned. We can represent the data in another sequence: \begin{flushleft} \texttt{val data = Seq((2, 3, 8), (1, 3, 7), (1, 2, 3), (1, 2, 3), ...} \end{flushleft} \texttt{data} is a sequence of 50 Scala tuples. The first two values in each tuple indicate which two die were chosen to roll. The third value is the sum of the two die. To model the outcome of the sum, we can use an \texttt{Apply} element with a function which sums the outcome of its arguments. \begin{flushleft} \texttt{def trial(p1: AtomicDirichlet, p2: AtomicDirichlet, result: Int) = \{ \newline \tab val sum = (i1: Int, i2: Int) => i1 + i2 \newline \tab val die1 = Select(p1, outcomes: \_*) \newline \tab val die2 = Select(p2, outcomes: \_*) \newline \tab val t = Apply(die1, die2, sum) \newline \tab t.observe(result) \newline \} } \end{flushleft} The code section above defines a Scala function which accepts two Dirichlet parameters and an integer value. \texttt{val sum = (i1: Int, i2: Int) => i1 + i2} defines a Scala function which accepts two integer values and returns their sum. Next, two Select elements are created and parameterized by the input parameters. Note that the arguments to \texttt{Select} are different from what has been presented previously. Instead of directly enumerating each probability and outcome, we specify a Dirichlet parameter and the list of possible outcomes. The last two lines of \texttt{trial} apply the sum function to the die and observe the result. By calling the \texttt{trial} function for each tuple in the sequence, we can create a model learned from the data. \begin{flushleft} \texttt{data.foreach \{ d => \newline if (d.\_1 == 1 \&\& d.\_2 == 2) \{ \newline \tab trial(parameters(0), parameters(1), d.\_3) \newline \tab \} else if (d.\_1 == 1 \&\& d.\_2 == 3) \{ \newline \tab trial(parameters(0), parameters(2), d.\_3) \newline \} else \{ \newline \tab trial(parameters(1), parameters(2), d.\_3) \newline \} \newline \} } \end{flushleft} Just as in the fair coin example, we create an expectation maximization algorithm and use the list of parameters as input. Additionally, this time we have chosen to raise the number of iterations to 100. \begin{flushleft} \texttt{val numberOfIterations = 100 \newline val algorithm = ExpectationMaximization(numberOfIterations, parameters: \_*) \newline algorithm.start \newline \newline val die1 = Select(fairness1.MAPValue.view(0,fairness1.MAPValue.size).toList, outcomes) \newline val die2 = Select(fairness2.MAPValue.view(0,fairness2.MAPValue.size).toList, outcomes) \newline val die3 = Select(fairness3.MAPValue.view(0,fairness3.MAPValue.size).toList, outcomes) } \end{flushleft} The code block above will retrieve learned elements from the parameters. Note that for a Select, a list of outcomes must be supplied as an argument to along with their corresponding probabilities, which is the array returned by \texttt{MAPValue}. This is because the number of concentration parameters is may vary, and the type of the outcomes is not fixed. Running this code results in the following output, in which we see the model has estimated the probabilities of each value for each die. If one examines the full data declaration in the example code, it is quite easy to see that there are only three observed values of the sum of the die (3, 7 and 8), so the learning algorithm has correctly inferred that the most likely values of the die are 1, 2 and 6, respectively. \begin{flushleft} \texttt{The probabilities of seeing each side of d\_1 are: \newline \tab 0.906250000442371 -> 1 \newline \tab 0.0 -> 2 \newline \tab 0.0 -> 3 \newline \tab 0.0 -> 4 \newline \tab 0.09374999955762903 -> 5 \newline \tab 0.0 -> 6 } \end{flushleft} \begin{flushleft} \texttt{The probabilities of seeing each side of d\_2 are: \newline \tab 0.0 -> 1 \newline \tab 0.9999999996067813 -> 2 \newline \tab 0.0 -> 3 \newline \tab 0.0 -> 4 \newline \tab 0.0 -> 5 \newline \tab 3.9321864899990694E-10 -> 6 } \end{flushleft} \begin{flushleft} \texttt{The probabilities of seeing each side of d\_3 are: \newline \tab 0.0 -> 1 \newline \tab 0.0 -> 2 \newline \tab 0.0 -> 3 \newline \tab 0.0 -> 4 \newline \tab 0.0 -> 5 \newline \tab 1.0 -> 6 } \end{flushleft}
{ "content_hash": "af8fbadaf87ca6a7622ca96f74a4c415", "timestamp": "", "source": "github", "line_count": 223, "max_line_length": 777, "avg_line_length": 58.99103139013453, "alnum_prop": 0.7700494108703915, "repo_name": "wkretschmer/figaro", "id": "0fb8d3d8346b0efbacdea446aa358dc3513c93aa", "size": "13155", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "FigaroLaTeX/Tutorial/Sections/8LearningParams.tex", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
package com.web.common.web.common.util.pay; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import com.web.common.web.common.util.MD5Util; /** * Created by Cyan on 2015/8/20. */ public class Signature { /** * 签名算法 * @param o 签名对象 按字典拼接成 key=value& 字符串, * @param salt 约定的附加key * @return */ public static String getSign(Object o,String salt) { ArrayList<String> list = new ArrayList<String>(); Class<?> cls = o.getClass(); Field[] fields = cls.getDeclaredFields(); for (Field f : fields) { f.setAccessible(true); Object value = null; try { value = f.get(o); } catch (Exception e) { e.printStackTrace(); } if (value != null && value != "") { list.add(f.getName() + "=" + value + "&"); } } int size = list.size(); String[] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append(arrayToSort[i]); } String result = sb.toString(); result += salt; try { result = MD5Util.MD5(result); } catch (Exception ex) { ex.printStackTrace(); } return result; } /** * 功能同上 * @param map * @param salt * @return */ public static String getSignByMap(Map<String, Object> map,String salt) { ArrayList<String> list = new ArrayList<String>(); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getValue() != "") { list.add(entry.getKey() + "=" + entry.getValue() + "&"); } } int size = list.size(); String[] arrayToSort = list.toArray(new String[size]); Arrays.sort(arrayToSort, String.CASE_INSENSITIVE_ORDER); StringBuilder sb = new StringBuilder(); for (int i = 0; i < size; i++) { sb.append(arrayToSort[i]); } String result = sb.toString(); result += salt; try { result = MD5Util.MD5(result); } catch (Exception ex) { ex.printStackTrace(); } return result; } }
{ "content_hash": "f32d446b1b0134f1e45e28edd68e3e99", "timestamp": "", "source": "github", "line_count": 85, "max_line_length": 74, "avg_line_length": 26.44705882352941, "alnum_prop": 0.5591637010676157, "repo_name": "wind-clothes/web-common", "id": "2f5cff55177a3c3a1ae9115f5b44787305407606", "size": "2304", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/web/common/web/common/util/pay/Signature.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "521966" } ], "symlink_target": "" }
var orm = require('orm'); /** * Default options */ var defaults = { table: 'sessions', maxAge: 1000 * 60 * 60 * 24 * 14 // even session cookies should be destroyed, eventually }; function noop() {} module.exports = function(session) { "use strict"; var Store = session.Store || session.session && session.session.Store; /** * Initialize OrmStore with the given `options`. * * @param {ORM} db * @param {Object} options * @api public */ function OrmStore(db, options) { options = options || {}; Store.call(this, options); this.maxAge = options.maxAge || defaults.maxAge; var Session = this.Session = db.define('Session', { sid: { type: 'text', unique: true }, expires: { type: 'date', time: true, index: true }, session: Object }, { table: options.table || defaults.table, hooks: { afterSave: function(success) { Session.find({ expires: orm.lte(new Date()) }).remove(function(err) { if (err) console.error(err); }); } } }); Session.sync(); // TODO callback } /** * Inherit from `Store`. */ require('util').inherits(OrmStore, Store); /** * Attempt to fetch session by the given `sid`. * * @param {String} sid * @param {Function} callback * @api public */ OrmStore.prototype.get = function(sid, callback) { callback = callback || noop; this.Session.one({sid: sid}, function(err, session) { if (err) return callback(err); if (!session) return callback(); if (!session.expires || new Date() < session.expires) { callback(null, session.session); } else { session.remove(callback); } }); }; /** * Commit the given `session` object associated with the given `sid`. * * @param {String} sid * @param {Session} session * @param {Function} callback * @api public */ OrmStore.prototype.set = function(sid, session, callback) { callback = callback || noop; var s = { session: session }; if (session && session.cookie && session.cookie.expires) { s.expires = new Date(session.cookie.expires); } else { s.expires = new Date(Date.now() + this.maxAge); } var Session = this.Session; Session.one({sid: sid}, function(err, session) { if (err) return callback(err); if (session) { session.save(s, function(err) { callback(err); }); } else { s.sid = sid; Session.create(s, function(err) { callback(err); }); } }); }; /** * Destroy the session associated with the given `sid`. * * @param {String} sid * @param {Function} callback * @api public */ OrmStore.prototype.destroy = function(sid, callback) { callback = callback || noop; this.Session.one({sid: sid}, function(err, session) { if (err) return callback(err); if (!session) return callback(); session.remove(callback); }); }; /** * Fetch number of sessions. * * @param {Function} callback * @api public */ OrmStore.prototype.length = function(callback) { this.Session.count(callback); }; /** * Clear all sessions. * * @param {Function} callback * @api public */ OrmStore.prototype.clear = function(callback) { this.Session.all().remove(callback); }; return OrmStore; };
{ "content_hash": "4ba86d5704c196a4bb47bebd48b4e8d0", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 89, "avg_line_length": 20.39873417721519, "alnum_prop": 0.6109215017064846, "repo_name": "kapouer/connect-orm", "id": "8683eaf7de57516f6af9b54aa719dd7b114f27bc", "size": "3336", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "3336" } ], "symlink_target": "" }
class MySortFilterProxyModel; class QCheckBox; class QStandardItemModel; class DVAPI TMessageRepository : public QObject { QStandardItemModel *m_sim; Q_OBJECT public: static TMessageRepository *instance(); TMessageRepository(); QStandardItemModel *getModel() const { return m_sim; } void clear(); public slots: void messageReceived(int, const QString &); signals: void openMessageCenter(); // TMessageRepository emits this signal to indicate that the TMessageViewer should be made visible }; //--------------------------------------------------------------------------------------- class DVAPI TMessageViewer : public QFrame { Q_OBJECT protected: static std::vector<TMessageViewer *> m_tmsgViewers; MySortFilterProxyModel *m_proxyModel; void rowsInserted(const QModelIndex &parent, int start, int end); public: QCheckBox *m_redCheck, *m_greenCheck, *m_yellowCheck; TMessageViewer(QWidget *); static bool isTMsgVisible(); public slots: void onClicked(bool); void refreshFilter(int); };
{ "content_hash": "1303d23bd6feab709f50cb082870103a", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 125, "avg_line_length": 24.634146341463413, "alnum_prop": 0.7059405940594059, "repo_name": "JosefMeixner/opentoonz", "id": "c703f2d0b5f5ac02c049a5f8566e9c5b9c5aa9a5", "size": "1306", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "toonz/sources/include/toonzqt/tmessageviewer.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "1187550" }, { "name": "C++", "bytes": "20189620" }, { "name": "CMake", "bytes": "75036" }, { "name": "CSS", "bytes": "77423" }, { "name": "FLUX", "bytes": "156349" }, { "name": "GLSL", "bytes": "24307" }, { "name": "HTML", "bytes": "62240" }, { "name": "JavaScript", "bytes": "2" }, { "name": "Lua", "bytes": "1882" }, { "name": "Objective-C", "bytes": "229013" }, { "name": "QMake", "bytes": "11328" }, { "name": "Shell", "bytes": "52168" }, { "name": "Smarty", "bytes": "21137" } ], "symlink_target": "" }
"""Basic tests.""" from __future__ import absolute_import, print_function from os.path import dirname, join import pytest from babel.support import NullTranslations, Translations from flask_babelex import Babel, get_locale from invenio_i18n.babel import MultidirDomain, set_locale def test_init(): """Test initialization.""" d = MultidirDomain(paths=[".", ".."], entry_point_group="invenio_i18n.translations") assert d assert d.has_paths() d = MultidirDomain() assert not d.has_paths() def test_merge_translations(app): """Test initialization.""" Babel(app) d = MultidirDomain( paths=[join(dirname(__file__), "translations")], entry_point_group="invenio_i18n.translations", ) with app.test_request_context(): with set_locale("en"): t = d.get_translations() assert isinstance(t, Translations) # Only in tests/translations assert t.gettext("Test string") == "Test string from test" # Only in invenio_i18n/translations assert t.gettext("Block translate %s") % "a" == "Block translate a" # In both - tests/translations overwrites invenio_i18n/translations assert t.gettext("Translate") == "From test catalog" def test_add_nonexisting_path(): """Test add non-existing path.""" d = MultidirDomain() pytest.raises(RuntimeError, d.add_path, "invalidpath") def test_get_translations(): """Test get translations.""" d = MultidirDomain() assert isinstance(d.get_translations(), NullTranslations) def test_get_translations_existing_and_missing_mo(app): """Test get translations for language with existing/missing *.mo files.""" app.config["I18N_LANGUAGES"] = [("de", "German")] Babel(app) d = MultidirDomain(entry_point_group="invenio_i18n.translations") with app.test_request_context(): with set_locale("en"): assert isinstance(d.get_translations(), Translations) with set_locale("de"): assert isinstance(d.get_translations(), NullTranslations) def test_set_locale_no_app_ctx(): """Test get translations when there is no application ctx.""" # Wokring outside request context try: with set_locale("en"): assert False except RuntimeError: pass def test_set_locale(app): """Test get translations for language with existing/missing *.mo files.""" Babel(app) with app.test_request_context(): with set_locale("en"): assert str(get_locale()) == "en" with set_locale("da"): assert str(get_locale()) == "da"
{ "content_hash": "6e5c686169384b51b9c63047dd7509b8", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 88, "avg_line_length": 30.170454545454547, "alnum_prop": 0.6406779661016949, "repo_name": "inveniosoftware/invenio-i18n", "id": "37ec64e136bbcf79bb1d776e8c3aca725bc6ed97", "size": "2890", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/test_babel.py", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2622" }, { "name": "JavaScript", "bytes": "1151" }, { "name": "Python", "bytes": "49781" }, { "name": "Shell", "bytes": "599" } ], "symlink_target": "" }
class Command attr_reader :shell_capture # capture system calls on all commands def `(cmd) capture_shell!(cmd) end def system(cmd) capture_shell!(cmd) end private def capture_shell!(cmd) @shell_capture = cmd # make sure $? is set Kernel::system("echo", "\\c") "mock output" end end class CommandSpecBase < MiniTest::Spec before do @repl = Replicant::REPL.new end def silent(command) def command.output(s) @output = s end def command.output_capture @output end command end end
{ "content_hash": "f6e875af19be9f9f4666ee08853e78e6", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 40, "avg_line_length": 17.09090909090909, "alnum_prop": 0.6312056737588653, "repo_name": "mttkay/replicant", "id": "b24cc62588f3b952c73737ad3dd3c0d7851000fb", "size": "564", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/commands/command_spec_base.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "32250" } ], "symlink_target": "" }
using System; using System.Linq; using System.IO; using System.Text; using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization; using Newtonsoft.Json; namespace Model { /// <summary> /// /// </summary> [DataContract] public class Snapshots : IEquatable<Snapshots> { /// <summary> /// Initializes a new instance of the <see cref="Snapshots" /> class. /// </summary> public Snapshots() { } /// <summary> /// The resource's unique identifier /// </summary> /// <value>The resource's unique identifier</value> [DataMember(Name = "id", EmitDefaultValue = false)] public string Id { get; set; } /// <summary> /// The type of object that has been created /// </summary> /// <value>The type of object that has been created</value> [DataMember(Name = "type", EmitDefaultValue = false)] public string Type { get; set; } /// <summary> /// URL to the object’s representation (absolute path) /// </summary> /// <value>URL to the object’s representation (absolute path)</value> [DataMember(Name = "href", EmitDefaultValue = false)] public string Href { get; set; } /// <summary> /// Array of items in that collection /// </summary> /// <value>Array of items in that collection</value> [DataMember(Name = "items", EmitDefaultValue = false)] public List<Snapshot> Items { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class Snapshots {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Type: ").Append(Type).Append("\n"); sb.Append(" Href: ").Append(Href).Append("\n"); sb.Append(" Items: ").Append(Items).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public string ToJson() { return JsonConvert.SerializeObject(this, Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="obj">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object obj) { // credit: http://stackoverflow.com/a/10454552/677735 return this.Equals(obj as Snapshots); } /// <summary> /// Returns true if Snapshots instances are equal /// </summary> /// <param name="other">Instance of Snapshots to be compared</param> /// <returns>Boolean</returns> public bool Equals(Snapshots other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) return false; return ( this.Id == other.Id || this.Id != null && this.Id.Equals(other.Id) ) && ( this.Type == other.Type || this.Type != null && this.Type.Equals(other.Type) ) && ( this.Href == other.Href || this.Href != null && this.Href.Equals(other.Href) ) && ( this.Items == other.Items || this.Items != null && this.Items.SequenceEqual(other.Items) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { int hash = 41; // Suitable nullity checks etc, of course :) if (this.Id != null) hash = hash * 59 + this.Id.GetHashCode(); if (this.Type != null) hash = hash * 59 + this.Type.GetHashCode(); if (this.Href != null) hash = hash * 59 + this.Href.GetHashCode(); if (this.Items != null) hash = hash * 59 + this.Items.GetHashCode(); return hash; } } } }
{ "content_hash": "09298fcef96f69962e9ce1e45b43fd21", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 77, "avg_line_length": 29.69090909090909, "alnum_prop": 0.49071239028373137, "repo_name": "profitbricks/profitbricks-sdk-net", "id": "a4db6274e7ce3fe80dff6f92a470cf314199f7c8", "size": "4903", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ProfitbricksV2/Model/Snapshots.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "2109880" }, { "name": "Smalltalk", "bytes": "15358" } ], "symlink_target": "" }
require 'bootstrap/colorpicker2/rails/engine'
{ "content_hash": "e885b738ba4e47936bcf637e84ef565f", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 45, "avg_line_length": 46, "alnum_prop": 0.8478260869565217, "repo_name": "slabounty/bootstrap-colorpicker2-rails", "id": "5964e7ba9e6cddb8b855f1c5a4dc26018a87a395", "size": "46", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/bootstrap-colorpicker2-rails.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "775" }, { "name": "CoffeeScript", "bytes": "211" }, { "name": "JavaScript", "bytes": "698" }, { "name": "Ruby", "bytes": "18394" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "6c472b6ca0c6a2285ecba12b4df1e42f", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "7b1f9f1c3aa1e557ea13d79b6881237ded1305b8", "size": "182", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Laurales/Calycanthaceae/Byttneria/Byttneria venezuelensis/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
#include "Talkers.h" // talkers #include "AdServerTalker.h" #include "GoogleTalker.h" #include "QypeTalker.h" namespace Talkers { void setupTalkers( TalkerMap& talkerMap, Talkers& talkers ) { // Setup Google talker Talkers::iterator newTalker = talkers.insert( talkers.end(), new GoogleTalker() ); talkerMap[ ExtService::google_local_search ] = *newTalker; // Setup Qype talker newTalker = talkers.insert( talkers.end(), new QypeTalker() ); talkerMap[ ExtService::qype ] = *newTalker; newTalker = talkers.insert( talkers.end(), new AdServerTalker() ); talkerMap[ ExtService::adserver ] = *newTalker; } } // End namespace Talkers
{ "content_hash": "f6020a04e09621aa7b80b5e3b934e7b6", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 69, "avg_line_length": 25.692307692307693, "alnum_prop": 0.6976047904191617, "repo_name": "wayfinder/Wayfinder-Server", "id": "e2e103b94ffab4d09ea2c6d50e34330893372d97", "size": "2196", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Server/Modules/ExtServiceModule/src/Talkers.cpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "305133" }, { "name": "C++", "bytes": "31013369" }, { "name": "Java", "bytes": "398162" }, { "name": "Perl", "bytes": "1192824" }, { "name": "Python", "bytes": "28913" }, { "name": "R", "bytes": "712964" }, { "name": "Shell", "bytes": "388202" } ], "symlink_target": "" }
<div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title" ng-bind="logBundleTitle"></h4> </div> <div class="panel-body"> <div class="col-sm-12"> <label ng-bind="previewFacilityLabel"></label> <span>: {{ previewBundle.facilityName }}</span> </div> <br/> <p><small><em><span class="text-danger">* indicates expired products</span></em></small></p> <table class="table table-bordered table-condensed" style="font-size: 12px"> <thead> <tr> <th>#</th> <th>Product</th> <th>Batch No.</th> <th>VVM Status</th> <th>Expiry Date</th> <th>Qty</th> </tr> </thead> <tbody> <tr ng-repeat="line in previewBundle.bundleLines" ng-class="getCategoryColor(line.productProfile.category.name)"> <td>{{$index + 1}}</td> <td class="text-center" ng-bind="line.productProfile.name"></td> <td class="text-center" >{{line.batchNo}}</td> <td class="text-center"> <img ng-if="line.VVMStatus.imageSrc" ng-src="images/vvm-icons/{{line.VVMStatus.imageSrc}}" class="vvm-icon-sm"/> <span ng-if="!line.VVMStatus.imageSrc" translate>No VVM Status</span> </td> <td class="text-center"> {{ line.expiryDate | date:'MMM, yyyy' }} <span ng-show="expiredProductAlert(line.expiryDate,previewBundle.receivedOn)" class="text-danger"> * <!--<small> <i class="fa fa-question-circle" tooltip="Expired Product"></i></small>--> </span> </td> <td class="text-center"> <ng-pluralize count="line.quantity" when="{ '0' :'', '1' :' 1 {{ line.productProfile.presentation.uom.name }}', 'other':'{{ (line.quantity/ line.productProfile.presentation.value) }} {{line.productProfile.presentation.uom.name}}s' }"> </ng-pluralize> </td> </tr> </tbody> </table> <div class="btn-group btn-group-justified" ng-if="previewForm === true"> <div class="btn-group"> <button type="button" class="btn btn-lg btn-default" ng-click="showForm()"> <i class="fa fa-chevron-circle-left"></i> <span translate>Back</span> </button> </div> <div class="btn-group"> <button class="btn btn-success btn-lg" ng-click="finalSave()" ng-disabled="isSaving"> <span translate ng-show="!isSaving">Confirm</span> <span ng-show="isSaving">Saving</span> <span><i class="fa " ng-class="{'fa-save':!isSaving, 'fa-spinner fa-spin': isSaving}"></i></span> </button> </div> </div> <div class="" ng-if="preview === true"> <button type="button" class="btn btn-lg btn-default btn-block" ng-click="hidePreview()"> <i class="fa fa-chevron-circle-left"></i> <span translate>Back</span> </button> <br/> </div> </div> </div>
{ "content_hash": "3ca2264dd7412ee26362e5f19e088271", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 150, "avg_line_length": 44.675, "alnum_prop": 0.46698377168438726, "repo_name": "musamusa/move", "id": "3377b996809e06d4adb7f3e0ba85b144cfc6bac6", "size": "3574", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "app/views/bundles/partials/preview-log-bundle.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "24139" }, { "name": "CSS", "bytes": "4595" }, { "name": "HTML", "bytes": "135098" }, { "name": "JavaScript", "bytes": "508340" }, { "name": "Shell", "bytes": "1117" }, { "name": "VimL", "bytes": "2413" } ], "symlink_target": "" }
<?php namespace Xcore\Generator\Tests\Data\AssertMapping\Url; use Doctrine\ORM\Mapping as ORM; /** * Author * * @ORM\Table() * @ORM\Entity */ class Author { use AuthorTrait; }
{ "content_hash": "36cf894c1e74f43a49521d66317e83f7", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 55, "avg_line_length": 10.555555555555555, "alnum_prop": 0.6578947368421053, "repo_name": "XcoreCMS/Generator", "id": "00c4a3946a71bcb4476f9e32c31d7a66bfd36020", "size": "190", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/Data/AssertMapping/Url/Author.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "169495" } ], "symlink_target": "" }
package com.hazelcast.core; import java.util.EventListener; /** * Listener object for listening to lifecycle events of the Hazelcast instance * * @see com.hazelcast.core.LifecycleEvent * @see HazelcastInstance#getLifecycleService() * */ public interface LifecycleListener extends EventListener { /** * Called when instance's state changes. No blocking calls should be made in this method. * @param event the Lifecycle event */ void stateChanged(LifecycleEvent event); }
{ "content_hash": "2b2c733d3433eca0cc43890d207b75ac", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 93, "avg_line_length": 25.15, "alnum_prop": 0.7375745526838966, "repo_name": "lmjacksoniii/hazelcast", "id": "5490d1f44c037b926940af7dfa39d702f56b68a8", "size": "1128", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "hazelcast/src/main/java/com/hazelcast/core/LifecycleListener.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "948" }, { "name": "Java", "bytes": "28952463" }, { "name": "Shell", "bytes": "13259" } ], "symlink_target": "" }
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>basic_stream_socket::get_option</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../../../boost_asio.html" title="Boost.Asio"> <link rel="up" href="../basic_stream_socket.html" title="basic_stream_socket"> <link rel="prev" href="get_io_service.html" title="basic_stream_socket::get_io_service"> <link rel="next" href="get_option/overload1.html" title="basic_stream_socket::get_option (1 of 2 overloads)"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="get_io_service.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../basic_stream_socket.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="get_option/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h4 class="title"> <a name="boost_asio.reference.basic_stream_socket.get_option"></a><a class="link" href="get_option.html" title="basic_stream_socket::get_option">basic_stream_socket::get_option</a> </h4></div></div></div> <p> <a class="indexterm" name="id1209150"></a> Get an option from the socket. </p> <pre class="programlisting"><span class="keyword">void</span> <a class="link" href="get_option/overload1.html" title="basic_stream_socket::get_option (1 of 2 overloads)">get_option</a><span class="special">(</span> <span class="identifier">GettableSocketOption</span> <span class="special">&amp;</span> <span class="identifier">option</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="emphasis"><em>&#187; <a class="link" href="get_option/overload1.html" title="basic_stream_socket::get_option (1 of 2 overloads)">more...</a></em></span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <a class="link" href="get_option/overload2.html" title="basic_stream_socket::get_option (2 of 2 overloads)">get_option</a><span class="special">(</span> <span class="identifier">GettableSocketOption</span> <span class="special">&amp;</span> <span class="identifier">option</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">system</span><span class="special">::</span><span class="identifier">error_code</span> <span class="special">&amp;</span> <span class="identifier">ec</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span> <span class="emphasis"><em>&#187; <a class="link" href="get_option/overload2.html" title="basic_stream_socket::get_option (2 of 2 overloads)">more...</a></em></span> </pre> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2012 Christopher M. Kohlhoff<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="get_io_service.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../basic_stream_socket.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="get_option/overload1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
{ "content_hash": "a11d6a2ad568d554303cd199cc8592b0", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 451, "avg_line_length": 85.03571428571429, "alnum_prop": 0.6535069298614028, "repo_name": "djsedulous/namecoind", "id": "7a4791b7a68ca89549ca677a0bdc1fec9062f503", "size": "4762", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "libs/boost_1_50_0/doc/html/boost_asio/reference/basic_stream_socket/get_option.html", "mode": "33261", "license": "mit", "language": [ { "name": "Assembly", "bytes": "843598" }, { "name": "Awk", "bytes": "90447" }, { "name": "C", "bytes": "19896147" }, { "name": "C#", "bytes": "121901" }, { "name": "C++", "bytes": "132199970" }, { "name": "CSS", "bytes": "336528" }, { "name": "Emacs Lisp", "bytes": "1639" }, { "name": "IDL", "bytes": "11976" }, { "name": "Java", "bytes": "3955488" }, { "name": "JavaScript", "bytes": "22346" }, { "name": "Max", "bytes": "36857" }, { "name": "Objective-C", "bytes": "23505" }, { "name": "Objective-C++", "bytes": "2450" }, { "name": "PHP", "bytes": "55712" }, { "name": "Perl", "bytes": "4194947" }, { "name": "Python", "bytes": "761429" }, { "name": "R", "bytes": "4009" }, { "name": "Rebol", "bytes": "354" }, { "name": "Scheme", "bytes": "6073" }, { "name": "Shell", "bytes": "550004" }, { "name": "Tcl", "bytes": "2268735" }, { "name": "TeX", "bytes": "13404" }, { "name": "TypeScript", "bytes": "5318296" }, { "name": "XSLT", "bytes": "757548" }, { "name": "eC", "bytes": "5079" } ], "symlink_target": "" }
function votes100_fetch100(p) local map100 = {} local qh = dbQuery(handlerConnect, "SELECT * FROM `mapstop100`") local map100_sql = dbPoll(qh,-1) if not map100_sql then return false end for _,row in ipairs(map100_sql) do local name = tostring(row.mapname) local author = tostring(row.author) local resname = tostring(row.mapresourcename) local gamemode = tostring(row.gamemode) local t = {name = name, author = author, resname = resname, gamemode = gamemode} table.insert(map100,t) end table.sort(map100,function(a,b) return tostring(a.name) < tostring(b.name) end) local logged = exports.gc:isPlayerLoggedInGC(p) local castList = {} if logged then local forumid = exports.gc:getPlayerForumID(p) forumid = tostring(forumid) local qh = dbQuery(handlerConnect, "SELECT * FROM `votestop100` WHERE `forumid`=?", forumid) local castList_sql = dbPoll(qh,-1) if not castList_sql then return false end if castList_sql[1] then for _,row in ipairs(castList_sql) do for column in pairs(castList_sql[_]) do if column == "id" or column == "forumid" then else local map = tostring(castList_sql[_][column]) local qh = dbQuery(handlerConnect, "SELECT * FROM `mapstop100` WHERE `mapresourcename`=?", map) local mapInfo = dbPoll(qh,-1) local name local author local resname local gamemode if mapInfo[1] then name = tostring(mapInfo[1].mapname) author = tostring(mapInfo[1].author) resname = tostring(mapInfo[1].mapresourcename) gamemode = tostring(mapInfo[1].gamemode) else name = "" author = "" resname = "" gamemode = "" end local t = {name = name, author = author, resname = resname, gamemode = gamemode} table.insert(castList,t) end end end end end triggerClientEvent(p,"votes100_receiveMap100",resourceRoot,map100,castList) end function votes100_command(p) votes100_fetch100(p) triggerClientEvent(p,"votes100_openCloseGUI",resourceRoot) end --addCommandHandler("vote", votes100_command) function votes100_voteMap(p, resname) local logged = exports.gc:isPlayerLoggedInGC(p) if logged then local forumid = exports.gc:getPlayerForumID(p) forumid = tostring(forumid) local qh = dbQuery(handlerConnect, "SELECT * FROM `votestop100` WHERE `forumid`=?", forumid) local castList_sql = dbPoll(qh,-1) if not castList_sql then return false end if castList_sql[1] then -- player already in database if castList_sql[1].choice1 == resname or castList_sql[1].choice2 == resname or castList_sql[1].choice3 == resname or castList_sql[1].choice4 == resname or castList_sql[1].choice5 == resname then outputChatBox("You already voted for this map", p) else local qh if castList_sql[1].choice1 == "" then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice1`=? WHERE `forumid`=?", resname, forumid) elseif castList_sql[1].choice2 == "" then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice2`=? WHERE `forumid`=?", resname, forumid) elseif castList_sql[1].choice3 == "" then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice3`=? WHERE `forumid`=?", resname, forumid) elseif castList_sql[1].choice4 == "" then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice4`=? WHERE `forumid`=?", resname, forumid) elseif castList_sql[1].choice5 == "" then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice5`=? WHERE `forumid`=?", resname, forumid) else qh = false end if qh == false then outputChatBox("You voted for the maximum number of maps!", p) else if dbFree( qh ) then outputChatBox("Map voted succesfully", p) end end end else -- player not yet in database local qh = dbQuery(handlerConnect, "INSERT INTO `votestop100` (`forumid`, `choice1`) VALUES (?,?)", forumid, resname) if dbFree( qh ) then outputChatBox("Map voted succesfully", p) end end votes100_fetch100(p) else outputChatBox("You're not logged in to Greencoins!", p) end end addEvent("votes100_voteMap", true) addEventHandler("votes100_voteMap", resourceRoot, votes100_voteMap) function votes100_removeMap(p, resname) local logged = exports.gc:isPlayerLoggedInGC(p) if logged then local forumid = exports.gc:getPlayerForumID(p) forumid = tostring(forumid) local qh = dbQuery(handlerConnect, "SELECT * FROM `votestop100` WHERE `forumid`=?", forumid) local castList_sql = dbPoll(qh,-1) if not castList_sql then return false end if castList_sql[1] then local qh if castList_sql[1].choice1 == resname then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice1`=? WHERE `forumid`=?", "", forumid) elseif castList_sql[1].choice2 == resname then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice2`=? WHERE `forumid`=?", "", forumid) elseif castList_sql[1].choice3 == resname then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice3`=? WHERE `forumid`=?", "", forumid) elseif castList_sql[1].choice4 == resname then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice4`=? WHERE `forumid`=?", "", forumid) elseif castList_sql[1].choice5 == resname then qh = dbQuery(handlerConnect, "UPDATE `votestop100` SET `choice5`=? WHERE `forumid`=?", "", forumid) else qh = false end if qh == false then outputChatBox("Error 1", p) else if dbFree( qh ) then outputChatBox("Map removed succesfully", p) votes100_fetch100(p) end end else outputChatBox("Error 2", p) end else outputChatBox("You're not logged in to Greencoins!", p) end end addEvent("votes100_removeMap", true) addEventHandler("votes100_removeMap", resourceRoot, votes100_removeMap) function votes100_sidebar(p) votes100_command(p) end addEvent("votes100_sidebarServer", true) addEventHandler("votes100_sidebarServer", resourceRoot, votes100_sidebar)
{ "content_hash": "02c71cb841f3c7eb0dc591d6943a98b5", "timestamp": "", "source": "github", "line_count": 149, "max_line_length": 197, "avg_line_length": 40.12751677852349, "alnum_prop": 0.6920889780899816, "repo_name": "JarnoVgr/Mr.Green-MTA-Resources", "id": "950e11e4b45efac65ff2264d2b99588d770f126c", "size": "5979", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "resources/[gameplay]/mapstop100/votestop100.lua", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18851" }, { "name": "FLUX", "bytes": "149541" }, { "name": "HLSL", "bytes": "188782" }, { "name": "HTML", "bytes": "84166" }, { "name": "JavaScript", "bytes": "149009" }, { "name": "Lua", "bytes": "3517052" }, { "name": "PHP", "bytes": "50151" } ], "symlink_target": "" }
<!-- Copyright 2014 The Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE fil --> rate-monitor ============ [![Build Status](https://travis-ci.org/joshlf13/rate-monitor.svg?branch=master)](https://travis-ci.org/joshlf13/rate-monitor) A simple rate monitoring command-line utility. Stdin is piped to stdout, and the rate at which data is being read is displayed on stderr. Usage: ``` Usage: rate-monitor [-p] [--B | --kB | --KiB | --MB | --MiB | --GB | --GiB] --B show the rate in B/s --kB show the rate in kB/s --KiB show the rate in KiB/s (this is the default) --MB show the rate in MB/s --MiB show the rate in MiB/s --GB show the rate in GB/s --GiB show the rate in GiB/s -p --progress show the total number of bytes copied in addition to the rate ``` Installation: `go get github.com/joshlf13/rate-monitor`
{ "content_hash": "b2509bd9c3303f6c2acca9d2e7376828", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 137, "avg_line_length": 34.42857142857143, "alnum_prop": 0.6441908713692946, "repo_name": "synful/rate-monitor", "id": "c25ebcf6851a3b5ce9defa928b0cde2ba90e337a", "size": "964", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Go", "bytes": "2423" } ], "symlink_target": "" }
{% extends "admin/base_site.html" %} {% load i18n %} {% block breadcrumbs %} <ul class="breadcrumb"> <li><a href="{% url 'admin:index' %}">{% trans 'Home' %}</a></li> <li>{% trans 'Password reset complete' %}</a> </ul> {% endblock %} {% block title %}{% trans 'Password reset complete' %}{% endblock %} {% block content_title %}<a class="navbar-brand">{% trans 'Password reset complete' %}</a>{% endblock %} {% block content %} <p class="alert alert-success">{% trans "Your password has been set. You may go ahead and log in now." %}</p> <p><a href="{{ login_url }}" class="btn btn-primary">{% trans 'Log in' %}</a></p> {% endblock %}
{ "content_hash": "37cc5bd54551086e4aa28c01615ac5c8", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 110, "avg_line_length": 33.1, "alnum_prop": 0.5861027190332326, "repo_name": "The-Akatsuki/thirdp", "id": "c00acbb54de2265597a646f4168d1c4546ccd9b5", "size": "662", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/templates/registration/password_reset_complete.html", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "196798" }, { "name": "HTML", "bytes": "97337" }, { "name": "JavaScript", "bytes": "11808" }, { "name": "Python", "bytes": "48364" }, { "name": "Shell", "bytes": "549" } ], "symlink_target": "" }
package com.github.btrekkie.reductions.pokemon; import java.util.Arrays; import java.util.List; import com.github.btrekkie.reductions.planar.Point; /** A junction gadget for PokemonProblem, as in I3SatPlanarGadgetFactory.createJunction(). */ public class PokemonJunctionGadget extends PokemonGadget { @Override public PokemonTile[][] tiles() { String[] rows = new String[]{ "* *", " ", " ", "* *"}; return tiles(rows); } @Override public List<Point> ports() { return Arrays.asList(new Point(0, 2), new Point(1, 0), new Point(3, 2), new Point(1, 4)); } }
{ "content_hash": "2d619767f77af40b10f9b4c22ecccfdf", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 97, "avg_line_length": 27.416666666666668, "alnum_prop": 0.6063829787234043, "repo_name": "btrekkie/reductions", "id": "27c428e903e6ad3687dedeb4de076489259335ce", "size": "658", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/github/btrekkie/reductions/pokemon/PokemonJunctionGadget.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "1079432" } ], "symlink_target": "" }
module Lita::Handlers::Karma::Upgrade class Decay extend Lita::Handler::EventRouter namespace "karma" on :loaded, :decay def decay(payload) return unless decay_enabled? && !decay_already_processed? log.debug "Upgrading data to include karma decay." populate_current all_terms.each do |(term, score)| backfill_term(term, score.to_i) end redis.del('support:decay') redis.incr('support:decay_with_negatives') end private def action_class Lita::Handlers::Karma::Action end def add_action(term, user_id, delta, time) return unless decay_enabled? action_class.create(redis, term, user_id, delta, time) end def all_actions redis.zrange(:actions, 0, -1) end def all_terms redis.zrange('terms', 0, -1, with_scores: true) end def backfill_term(term, score) key = "modified:#{term}" total = 0 distributor = config.decay_distributor score_sign = (score <=> 0) modified_counts_for(key).each do |(user_id, count)| count = count.to_i total += count (count - current[term][user_id]).times do |i| action_time = Time.now - distributor.call(decay_interval, i, count) add_action(term, user_id, score_sign, action_time) end end backfill_term_anonymously(score, total, term) end def backfill_term_anonymously(score, total, term) remainder = score.abs - total - current[term][nil] distributor = config.decay_distributor score_sign = (score <=> 0) remainder.times do |i| action_time = Time.now - distributor.call(decay_interval, i, remainder) add_action(term, nil, score_sign, action_time) end end def current @current ||= Hash.new { |h, k| h[k] = Hash.new { |h,k| h[k] = 0 } } end def decay_already_processed? redis.exists('support:decay_with_negatives') end def decay_enabled? config.decay && decay_interval > 0 end def decay_interval config.decay_interval end def modified_counts_for(key) redis.zrange(key, 0, -1, with_scores: true) end def populate_current all_actions.each do |json| action = action_class.from_json(json) current[action.term][action.user_id] += 1 end end end end Lita.register_handler(Lita::Handlers::Karma::Upgrade::Decay)
{ "content_hash": "7b48946d8c371ee6eb41237ef13bb7c7", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 79, "avg_line_length": 23.776699029126213, "alnum_prop": 0.6124948958758677, "repo_name": "erikogan/lita-karma", "id": "533d820d744e3e58ff389985fdac5573c36d3f88", "size": "2449", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/lita/handlers/karma/upgrade/decay.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "37492" } ], "symlink_target": "" }
date: '2016-10-14 16:34 +0200' published: true title: 'Node Version Manager ' category: - Node --- ## Installation First you'll need to make sure your system has a c++ compiler. For OS X, Xcode will work, for Ubuntu, the build-essential and libssl-dev packages work. On OS X, if you have/had a "system" node installed and want to install modules globally, keep in mind that: * When using nvm you do not need sudo to globally install a module with npm -g, so instead of doing `sudo npm install -g grunt`, do instead `npm install -g grunt` * If you have an ~/.npmrc file, make sure it does not contain any prefix settings. * Do not keep your previous "system" node install. This might cause version mismatches. To install or update nvm: ```bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash ``` The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc). Note: On OS X, if you get `nvm: command not found` after running the install script, your system may not have a [.bash_profile file] where the command is set up. Simply create one with `touch ~/.bash_profile` and run the install script again. To verify that nvm has been installed, do: ```bash command -v nvm ``` ## Usage Install the latest release of node: ```bash nvm install node ``` Use the installed version: ```bash nvm use node ``` Or run it: ```bash nvm run node --version ``` Or, you can run any arbitrary command in a subshell with the desired version of node: ```bash nvm exec 4.2 node --version ``` Get the path to the executable to where it was installed: ```bash nvm which 5.0 ``` In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the following special default aliases with nvm install, nvm use, nvm run, nvm exec, nvm which, etc: * node: this installs the latest version of node * iojs: this installs the latest version of io.js * stable: this alias is deprecated, and only truly applies to node v0.12 and earlier. Currently, this is an alias for node. * unstable: this alias points to node v0.11 - the last "unstable" node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability). If you want to use the system-installed version of node, you can use the special default alias "system": ```bash nvm use system nvm run system --version ``` Listing versions: ```bash nvm ls ``` If you want to see what versions are available to install: ```bash nvm ls-remote ``` To restore your PATH, you can deactivate it: ```bash nvm deactivate ``` To set a default Node version to be used in any new shell, use the alias 'default': ```bash nvm alias default node ``` `nvm use` will not, by default, create a "current" symlink. Set $NVM_SYMLINK_CURRENT to "true" to enable this behavior, which is sometimes useful for IDEs. Note that using nvm in multiple shell tabs with this environment variable enabled can cause race conditions.
{ "content_hash": "488b26e5654791fbf99450a04e8ff010", "timestamp": "", "source": "github", "line_count": 104, "max_line_length": 264, "avg_line_length": 29.067307692307693, "alnum_prop": 0.7290770757525636, "repo_name": "develdoe/develdoe.github.io", "id": "93ace2d2789b08078f60105c9fa3c7de75305d1f", "size": "3027", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "_posts/2016-10-14-node-version-manager.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20549" }, { "name": "HTML", "bytes": "1861949" }, { "name": "JavaScript", "bytes": "3720" }, { "name": "Ruby", "bytes": "2717" } ], "symlink_target": "" }
*, *::after, *::before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } html, body { height: 100%; width: 100%; font-family: 'Poiret One', cursive; overflow: hidden; background-color: #000000; } html * { text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.004); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } ul { list-style-type: none; } a:visited, a:link, a:active { text-decoration: none; } main { position: relative; z-index: 2; height: 100vh; -webkit-overflow-scrolling: touch; padding: 200px 5%; background-color: #000000; -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transition: -webkit-transform 0.7s; -moz-transition: -moz-transform 0.7s; transition: transform 0.7s; -webkit-transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99); -moz-transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99); transition-timing-function: cubic-bezier(0.91, 0.01, 0.6, 0.99); } .intro { height: 100%; width: 100%; display: table; position: absolute; top: 0; left: 0; bottom: 0; right: 0; } .intro h2 { font-weight: 600; } .safari .intro { height: 100%; width: 100%; display: table; position: relative; } .intro-body { height: 100%; width: 100%; display: table-cell; vertical-align: middle; color: #dce9e7; font-weight: bold; } .intro-body > h1 { color: #dce9e7; font-size: 60px; font-weight: bolder; } #clockdiv { color: #dce9e7; display: inline-block; font-weight: 600; text-align: center; font-size: 30px; } #clockdiv > div { padding: 10px; border-radius: 3px; background: transparent; display: inline-block; } #clockdiv div > span { padding: 15px; border-radius: 3px; background: transparent; display: inline-block; } .timer { padding-top: 5px; font-size: 16px; color: #ffffff; } .list-inline { padding-top: 50px; } .list-inline > li > a { color: #ffffff; } .list-inline > li:nth-child(1) > a:hover, .list-inline > li:nth-child(1) > a:focus { color: #3b5999; } .list-inline > li:nth-child(2) > a:hover, .list-inline > li:nth-child(2) > a:focus { color: #55acee; } .list-inline > li:nth-child(3) > a:hover, .list-inline > li:nth-child(3) > a:focus { color: #3f729b; } .navigation-is-open main { -webkit-transform: translateX(100%); -moz-transform: translateX(100%); -ms-transform: translateX(100%); -o-transform: translateX(100%); transform: translateX(100%); } .nav-trigger { position: fixed; z-index: 3; left: 5%; top: 20px; height: 54px; width: 54px; background-color: #31A19F; border-radius: 50%; text-indent: 100%; white-space: nowrap; -webkit-transition: -webkit-transform 0.5s; -moz-transition: -moz-transform 0.5s; transition: transform 0.5s; } .nav-trigger .nav-icon { position: absolute; left: 50%; top: 50%; bottom: auto; right: auto; -webkit-transform: translateX(-50%) translateY(-50%); -moz-transform: translateX(-50%) translateY(-50%); -ms-transform: translateX(-50%) translateY(-50%); -o-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); width: 22px; height: 2px; background-color: #ffffff; } .nav-trigger .nav-icon::before, .nav-trigger .nav-icon:after { content: ''; position: absolute; top: 0; right: 0; width: 100%; height: 100%; background-color: inherit; -webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); -o-transform: translateZ(0); transform: translateZ(0); -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transition: -webkit-transform 0.5s, width 0.5s, top 0.3s; -moz-transition: -moz-transform 0.5s, width 0.5s, top 0.3s; transition: transform 0.5s, width 0.5s, top 0.3s; } .nav-trigger .nav-icon::before { -webkit-transform-origin: right top; -moz-transform-origin: right top; -ms-transform-origin: right top; -o-transform-origin: right top; transform-origin: right top; -webkit-transform: translateY(-6px); -moz-transform: translateY(-6px); -ms-transform: translateY(-6px); -o-transform: translateY(-6px); transform: translateY(-6px); } .nav-trigger .nav-icon::after { -webkit-transform-origin: right bottom; -moz-transform-origin: right bottom; -ms-transform-origin: right bottom; -o-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: translateY(6px); -moz-transform: translateY(6px); -ms-transform: translateY(6px); -o-transform: translateY(6px); transform: translateY(6px); } .no-touch .nav-trigger:hover .nav-icon::after { top: 2px; } .no-touch .nav-trigger:hover .nav-icon::before { top: -2px; } .nav-trigger svg { position: absolute; top: 0; left: 0; } .nav-trigger circle { -webkit-transition: stroke-dashoffset 0.4s 0s; -moz-transition: stroke-dashoffset 0.4s 0s; transition: stroke-dashoffset 0.4s 0s; } .navigation-is-open .nav-trigger .nav-icon::after, .navigation-is-open .nav-trigger .nav-icon::before { width: 50%; -webkit-transition: -webkit-transform 0.5s, width 0.5s; -moz-transition: -moz-transform 0.5s, width 0.5s; transition: transform 0.5s, width 0.5s; } .navigation-is-open .nav-trigger .nav-icon::before { -webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); -o-transform: rotate(45deg); transform: rotate(45deg); } .navigation-is-open .nav-trigger .nav-icon::after { -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); } .no-touch .navigation-is-open .nav-trigger:hover .nav-icon::after, .no-touch .navigation-is-open .nav-trigger:hover .nav-icon::before { top: 0; } .navigation-is-open .nav-trigger circle { stroke-width: 2; stroke-dashoffset: 0; overflow-y: scroll; -webkit-transition: stroke-dashoffset 0.4s 0.3s; -moz-transition: stroke-dashoffset 0.4s 0.3s; transition: stroke-dashoffset 0.4s 0.3s; } @media only screen and (min-width: 1170px) { .nav-trigger { top: 40px; } } .nav { position: absolute; z-index: 1; top: 0; left: 0; height: 100vh; width: 100%; overflow: hidden; visibility: hidden; -webkit-transition: visibility 0s 0.7s; -moz-transition: visibility 0s 0.7s; transition: visibility 0s 0.7s; } .nav .navigation-wrapper { height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; -webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); -o-transform: translateZ(0); transform: translateZ(0); -webkit-backface-visibility: hidden; backface-visibility: hidden; -webkit-transform: translateX(-50%); -moz-transform: translateX(-50%); -ms-transform: translateX(-50%); -o-transform: translateX(-50%); transform: translateX(-50%); -webkit-transition: -webkit-transform 0.7s; -moz-transition: -moz-transform 0.7s; transition: transform 0.7s; -webkit-transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78); -moz-transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78); transition-timing-function: cubic-bezier(0.86, 0.01, 0.77, 0.78); } .navigation-is-open .nav { visibility: visible; overflow-y: visible; /*Important*/ -webkit-transition: visibility 0s 0s; -moz-transition: visibility 0s 0s; transition: visibility 0s 0s; } .navigation-is-open .nav .navigation-wrapper { -webkit-transform: translateX(0); -moz-transform: translateX(0); -ms-transform: translateX(0); -o-transform: translateX(0); transform: translateX(0); -webkit-transition: -webkit-transform 0.5s; -moz-transition: -moz-transform 0.5s; transition: transform 0.5s; -webkit-transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78); -moz-transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78); transition-timing-function: cubic-bezier(0.82, 0.01, 0.77, 0.78); } .nav h2 { position: relative; margin-bottom: 1.7em; font-size: 1.3rem; font-weight: 800; color: #FF522B; text-transform: uppercase; } .nav h2::after { content: ''; position: absolute; left: 0; bottom: -20px; height: 1px; width: 60px; background-color: currentColor; } .nav .navbar { z-index: 10; } .nav .primary-nav { float: right; } .nav .primary-nav > li { display: inline-block; padding: 3vw; font-size: 20px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; } .no-touch .nav .primary-nav a { color: rgba(256, 256, 256, 0.6); cursor: pointer; -webkit-transition: all .4s ease-in-out; -moz-transition: all .4s ease-in-out; -ms-transition: all .4s ease-in-out; -o-transition: all .4s ease-in-out; transition: all .4s ease-in-out; } #nav > nav > ul > li > a:hover { color: rgba(256, 256, 256, 1); } .committee-info-body { padding: 10%; } .committee-info-body p { font-size: 20.84px; color: #fff; } .committee-info-body h1 { font-size: 4.9vh; color: #FF522B; font-weight: bold; padding-bottom: 40px; } @media (max-width: 767px) { .nav .navbar { visibility: hidden; margin-top: 12px; height: 2px; } .nav .primary-nav { height: 4px; } .intro-body h2 { display: none; font-size: 0; } .intro-body h1 { font-size: 44px; } #clockdiv div > span { padding: 1px; } #clockdiv > span { font-size: 10px; } .list-inline { padding-top: 30px; } .committee-info-body p { font-size: 12.84px; } .committee-info-body h1 { padding-bottom: 10px; padding-top: 25px; } .nav-trigger { background: transparent; } } .team-info { position: relative; z-index: 5; top: 0; left: 0; height: 100%; display: table; width: 100%; background-color: #03202E; } .team-info-body { display: table-cell; vertical-align: middle; font-size: 3vh; color: #ffffff; padding: 1%; } .team-list { width: 100%; text-align: center; font-weight: bold; margin: 100px auto; padding: 0; list-style: none; padding: 0; text-align: center; } .team-list li { margin: 0%; padding-bottom: 60px; } @media only screen and (min-width: 500px) { .team-list li { float: left; width: 50%; clear: none; margin: 0%; } } @media only screen and (min-width: 800px) { .team-list li { width: 33%; clear: none; } } .avatar { transform: scaleX(0.75); -ms-transform: scaleX(0.75); -webkit-transform: scaleX(0.75); display: block; width: 160px; height: 160px; margin: 0 auto 3em; } .avatar a { display: block; overflow: hidden; transition: all .5s ease-in; } h3 { margin: 0 0 0 0; font-weight: bold; line-height: 1.4em; text-rendering: optimizelegibility; } h3 span { display: block; border: none; color: #9d9d9d; font-size: 0.7em; letter-spacing: 1px; } .team-one-button { height: 150px; width: 180px; border-radius: 50%; border: 5px solid #888; position: relative; -webkit-backface-visibility: hidden; background: url('https://avatars2.githubusercontent.com/u/14110960?v=3&s=96'); background-size: contain; } .sub-one { position: absolute; display: block; top: 72px; left: 72px; background: #000; height: 16px; width: 16px; opacity: 0; border-radius: 50%; -webkit-backface-visibility: hidden; z-index: 1; text-decoration: none; } .sub-one span { position: relative; left: 62.4px; top: -33.6px; opacity: 0; visibility: hidden; } .sub-one.has-focus span { visibility: visible; white-space: nowrap; opacity: 1; transition: opacity 300ms; } .sub-one.sibling-has-focus, .sub-one.sibling-has-focus:before { background: #000; transition: opacity 300ms; border-color: transparent; z-index: 0; } .team-one-button.active { border-color: #FF522B; } .team-one-button.active .sub-one { opacity: 1; height: 48px; width: 48px; cursor: pointer; transition: opacity 300ms, width 300ms, height 300ms, top 300ms cubic-bezier(0, 0.345, 0, 1.505), left 200ms cubic-bezier(0, 0.345, 0, 1.505); } .team-one-button.active .sub-one:hover { color: #555; } .team-one-button.active .one { top: -106.4px; left: 56px; background-color: #0085AE; } .team-one-button.active .two { top: -84.64252557px; left: 137.2px; background-color: #3b5999; } .team-one-button.active .three { top: -25.2px; left: 196.64252557px; background-color: #555555; } /*--------------------- In case we more social icons ------------------------- .team-one-button.active .four { top: 56px; left: 218.4px; } -------------------------------------------------------------------------------*/ .sub-one:before { display: block; height: 100%; width: 100%; color: #888; font-size: 41.28px; text-align: center; line-height: 1.3em; } .sub-one .fa { color: #ffffff; margin-top: 12px; } .about-info { position: relative; top: 0; left: 0; height: 10%; display: table; width: 100%; background-image: repeating-linear-gradient(rgba(3, 32, 46, 0.6), rgba(3, 0, 0, 0.4)), url('../img/msit.jpg'); background-attachment: fixed; background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; } .about-info-body { display: table-cell; vertical-align: middle; font-size: 2vh; color: #ffffff; padding: 5%; margin-bottom: 12%; } .about-info-body p { font-size: 20.84px; padding-bottom: 40px; } .about-info-body h1 { font-size: 4.9vh; color: #FF522B; font-weight: bold; padding-bottom: 40px; } .vision-info { position: relative; z-index: 7; top: 0; left: 0; height: 100%; display: table; width: 100%; background-color: #17465b; } .vision-info-body { padding: 10%; font-size: 2.3vh; color: #ffffff; } .vision-info-body p { font-family: 'Poiret One', cursive; } .vision-info-body h1 { font-size: 5.9vh; color: #FF522B; font-weight: bold; padding-top: 2%; padding-bottom: 40px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .quote { position: absolute; left: 4vw; top: 18vh; z-index: -11; } @media (max-width: 767px) { .quote { left: 4vw; top: 10vh; opacity: 0.8; } } .no-js main { height: 100%; overflow: visible; } .no-js .nav { position: static; visibility: visible; } .no-js .nav .navigation-wrapper { height: auto; width: 100%; overflow: visible; padding: 100px 5%; -webkit-transform: translateX(0); -moz-transform: translateX(0); -ms-transform: translateX(0); -o-transform: translateX(0); transform: translateX(0); } #particles-js { z-index: -1; position: absolute; width: 100%; height: 99.7%; left: 0; top: 0; background-image: repeating-linear-gradient(rgba(3, 32, 46, 0.6), rgba(3, 0, 0, 0.4)), url('../img/background.jpg'); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; } /*--------------------- In case we nedded side nav dots ------------------------- .side-nav { position: fixed; z-index: 9999; right: 50px; top: 50%; width: 14px; display: block; -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); transform: translateY(-50%); } .side-nav a { display: block; position: relative; z-index: 9999; color: transparent; width: 14px; height: 14px; outline: none; margin: 18px 0; border-radius: 50%; border: 1px solid white; transition: 0.2s all linear; } .side-nav a:hover { background-color: white; } -------------------------------------------------------------------------------------*/ #map { width: 100%; height: 60%; } .footer-distributed { background-color: #111; box-shadow: 10px 10px 10px 10px rgba(0, 0, 0, 0.12); box-sizing: border-box; width: 100%; text-align: left; padding: 55px 50px; } .footer-distributed .footer-left, .footer-distributed .footer-center, .footer-distributed .footer-right { display: inline-block; vertical-align: top; } .footer-distributed .footer-left { width: 40%; } .footer-distributed h3 { color: #ffffff; margin: 0; } .footer-distributed h3 span { color: #0f9999; } .footer-distributed .footer-links { color: #ffffff; margin: 20px 0 12px; padding: 0; } .footer-distributed .footer-links a { display: inline-block; line-height: 1.8; text-decoration: none; color: inherit; } .footer-distributed .footer-company-name { color: #8f9296; font-size: 14px; font-weight: bold; margin: 0; } .footer-distributed .footer-center { width: 35%; } .footer-distributed .footer-center i { background-color: #33383b; color: #ffffff; font-size: 25px; width: 38px; height: 38px; border-radius: 50%; text-align: center; line-height: 42px; margin: 10px 15px; vertical-align: middle; } .footer-distributed .footer-center i.fa-envelope { font-size: 17px; line-height: 38px; } .footer-distributed .footer-center p { display: inline-block; color: #ffffff; vertical-align: middle; margin: 0; } .footer-distributed .footer-center p span { display: block; font-weight: bold; font-size: 14px; line-height: 2; } .footer-distributed .footer-center p a { color: #01CBCC; text-decoration: none; } .footer-distributed .footer-right { width: 20%; } .footer-distributed .footer-company-about { line-height: 20px; color: #92999f; font-size: 13px; font-weight: bold; margin: 0; } .footer-distributed .footer-company-about span { display: block; color: #ffffff; font-size: 14px; font-weight: bold; margin-bottom: 20px; } .footer-distributed .footer-icons { margin-top: 25px; } .footer-distributed .footer-icons a { display: inline-block; width: 35px; height: 35px; cursor: pointer; background-color: #33383b; border-radius: 2px; font-size: 20px; color: #ffffff; text-align: center; line-height: 35px; margin-right: 3px; margin-bottom: 5px; } footer .fa:hover { color: #0f9999; } @media (max-width: 880px) { .footer-distributed { font: bold 14px; } .footer-distributed .footer-left, .footer-distributed .footer-center, .footer-distributed .footer-right { display: block; width: 100%; margin-bottom: 40px; text-align: center; } .footer-distributed .footer-center i { margin-left: 5vw; } .footer-distributed div:nth-child(2) { text-align: left; } .footer-distributed .footer-right .footer-icons { text-align: center; } } .slides { padding: 0; width: 100%; height: 100%; display: block; margin: 0 auto; position: relative; } .slides * { user-select: none; -ms-user-select: none; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } .slides input { display: none; } .slide-container { display: block; } .slide { top: 0; opacity: 0; width: 100%; height: 100%; display: block; position: absolute; transform: scale(0); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%; transition: all .7s ease-in-out; } .snav label { width: 100px; height: 100%; display: none; position: absolute; opacity: 0.3; z-index: 9; cursor: pointer; transition: opacity .9s; color: #ffffff; font-size: 106pt; text-align: center; line-height: 680px; font-family: "Varela Round", sans-serif; text-shadow: rgb(119, 119, 119); } .slide:hover + .nav label { opacity: 0.5; } .snav label:hover { opacity: 1; } .nav .next { right: 0; } input:checked + .slide-container .slide { opacity: 1; transform: scale(1); transition: opacity 1s ease-in-out; } input:checked + .slide-container .snav label { display: block; } .nav-dots { width: 100%; bottom: 9px; height: 11px; display: block; position: absolute; text-align: center; } .nav-dots .nav-dot { top: -5px; width: 11px; height: 11px; margin: 0 4px; position: relative; border-radius: 100%; display: inline-block; background-color: rgba(256, 256, 256, 0.4); } .nav-dots .nav-dot:hover { cursor: pointer; background-color: rgba(256, 256, 256, 0.7); } input#img-1:checked ~ .nav-dots label#img-dot-1, input#img-2:checked ~ .nav-dots label#img-dot-2, input#img-3:checked ~ .nav-dots label#img-dot-3, input#img-4:checked ~ .nav-dots label#img-dot-4, input#img-5:checked ~ .nav-dots label#img-dot-5, input#img-6:checked ~ .nav-dots label#img-dot-6 { background: rgba(256, 256, 256, 1); }
{ "content_hash": "023d42706ad33d054951f8e357fd0ec8", "timestamp": "", "source": "github", "line_count": 1068, "max_line_length": 146, "avg_line_length": 20.510299625468164, "alnum_prop": 0.6073955717872632, "repo_name": "manojpandey/msitmun", "id": "a5378adf890b10f323051ea835d150e0f9ba99f3", "size": "21905", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "css/main.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "20660" }, { "name": "HTML", "bytes": "20232" }, { "name": "JavaScript", "bytes": "8018" } ], "symlink_target": "" }
from __future__ import print_function, division, absolute_import import os __version__ = "1.11.0dev" # sciserver release version class SciServerConfig(object): ''' Global configuration for SciServer The sciserver.config contains important parameters for the correct functioning of the SciServer package. Although these parameters must be set/defined by the admin or user before the installation of the package, they can also be accessed and changed on-the-fly while on the python session. - **config.CasJobsRESTUri**: defines the base URL of the CasJobs web API (string). E.g., "https://skyserver.sdss.org/CasJobs/RestApi" - **config.AuthenticationURL**: defines the base URL of the Authentication web service API (string). E.g., "https://portal.sciserver.org/login-portal/keystone/v3/tokens" - **config.SciDriveHost**: defines the base URL of the SciDrive web service API (string). E.g., "https://www.scidrive.org" - **config.SkyQueryUrl**: defines the base URL of the SkyQuery web service API (string). E.g., "http://voservices.net/skyquery/Api/V1" - **config.SkyServerWSurl**: defines the base URL of the SkyServer web service API (string). E.g., "https://skyserver.sdss.org" - **config.DataRelease**: defines the SDSS data release (string), to be used to build the full SkyServer API url along with config.SkyServerWSurl. E.g., "DR13" - **config.KeystoneTokenPath**: defines the local path (string) to the file containing the user's authentication token in the SciServer-Compute environment. E.g., "/home/idies/keystone.token". Unlikely to change since it is hardcoded in SciServer-Compute. - **config.version**: defines the SciServer release version tag (string), to which this package belongs. E.g., "1.11.0" ''' def __init__(self): ''' Initialize the config ''' self.set_paths() self.version = __version__ self.token = None def set_paths(self): ''' Sets the initial paths for SciServer routes ''' # URLs for accessing SciServer web services (API endpoints) self.CasJobsRESTUri = "https://skyserver.sdss.org/CasJobs/RestApi" self.AuthenticationURL = "https://alpha02.sciserver.org/login-portal/keystone/v3/tokens" self.SciDriveHost = "https://www.scidrive.org" self.SkyQueryUrl = "http://voservices.net/skyquery/Api/V1" self.SkyServerWSurl = "https://skyserver.sdss.org" self.DataRelease = "DR13" self.computeURL = 'https://alpha02.sciserver.org/racm' #scitest12.pha.jhu.edu/racm' self.sciserverURL = 'https://alpha02.sciserver.org' # this path to the file containing the user's keystone token is hardcoded in the sciserver-compute environment self.idiesPath = 'home/idies' self.KeystoneTokenPath = os.path.join(self.idiesPath, 'keystone.token') self.computeWorkspace = os.path.join(self.idiesPath, 'workspace') def isSciServerComputeEnvironment(self): """ Checks whether the library is being run within the SciServer-Compute environment. Returns: iscompute (bool): True if the library is being run within the SciServer-Compute environment, and False if not. """ return os.path.isfile(self.KeystoneTokenPath) def get_token(self): ''' Get a token from the sciserver environment Determines if a user is inside the compute system or not and either uses auth.getToken() or auth.login(). Sets the token into the config ''' if not self.token: from sciserver.authentication import Authentication auth = Authentication() if self.isSciServerComputeEnvironment(): self.token = auth.getToken() else: self.token = auth.login() return self.token # create the config object config = SciServerConfig()
{ "content_hash": "b20b03999f69ec965103f3f9f19b016c", "timestamp": "", "source": "github", "line_count": 99, "max_line_length": 118, "avg_line_length": 41.35353535353536, "alnum_prop": 0.6548607718612603, "repo_name": "havok2063/SciScript-Python", "id": "02984451d97925ff59ed8cd5639eda5a59141109", "size": "4324", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "python/sciserver/__init__.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "130245" } ], "symlink_target": "" }
require 'spec_helper' class Disabling include Singleton include CanTango::Config::Permits::Disabling end class CanTango::Permit::Mine < CanTango::Permit::UserType end CanTango.config do |c| c.permits.register_permit CanTango::Permit::Mine end describe CanTango::Config::Permits::Disabling do subject { Disabling.new } describe 'disable_for :type, [name1, name2]' do before do Disabling.disable_for :user_type, [:mine] end end describe 'disable_for :type => [name1, name2]' do before do Disabling.disable_for :user_type => [:mine] end end describe 'disabled_for type' do pending end describe 'disabled' do pending end end
{ "content_hash": "ed52c11f442546fdc56b67b6ca2cb781", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 57, "avg_line_length": 18.236842105263158, "alnum_prop": 0.6897546897546898, "repo_name": "kristianmandrup/cantango-permits", "id": "620814f9fda1fd029a01cdf461ad83e785cd1ae8", "size": "693", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/cantango/config/permits/disabling_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "107721" } ], "symlink_target": "" }
import exportDialogTemplate from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph as pg import pyqtgraph.exporters as exporters class ExportDialog(QtGui.QWidget): def __init__(self, scene): QtGui.QWidget.__init__(self) self.setVisible(False) self.setWindowTitle("Export") self.shown = False self.currentExporter = None self.scene = scene self.selectBox = QtGui.QGraphicsRectItem() self.selectBox.setPen(pg.mkPen('y', width=3, style=QtCore.Qt.DashLine)) self.selectBox.hide() self.scene.addItem(self.selectBox) self.ui = exportDialogTemplate.Ui_Form() self.ui.setupUi(self) self.ui.closeBtn.clicked.connect(self.close) self.ui.exportBtn.clicked.connect(self.exportClicked) self.ui.itemTree.currentItemChanged.connect(self.exportItemChanged) self.ui.formatList.currentItemChanged.connect(self.exportFormatChanged) def show(self, item=None): if item is not None: while not isinstance(item, pg.ViewBox) and not isinstance(item, pg.PlotItem) and item is not None: item = item.parentItem() self.updateItemList(select=item) self.setVisible(True) self.activateWindow() self.raise_() self.selectBox.setVisible(True) if not self.shown: self.shown = True vcenter = self.scene.getViewWidget().geometry().center() self.setGeometry(vcenter.x()-self.width()/2, vcenter.y()-self.height()/2, self.width(), self.height()) def updateItemList(self, select=None): self.ui.itemTree.clear() si = QtGui.QTreeWidgetItem(["Entire Scene"]) si.gitem = self.scene self.ui.itemTree.addTopLevelItem(si) self.ui.itemTree.setCurrentItem(si) si.setExpanded(True) for child in self.scene.items(): if child.parentItem() is None: self.updateItemTree(child, si, select=select) def updateItemTree(self, item, treeItem, select=None): si = None if isinstance(item, pg.ViewBox): si = QtGui.QTreeWidgetItem(['ViewBox']) elif isinstance(item, pg.PlotItem): si = QtGui.QTreeWidgetItem(['Plot']) if si is not None: si.gitem = item treeItem.addChild(si) treeItem = si if si.gitem is select: self.ui.itemTree.setCurrentItem(si) for ch in item.childItems(): self.updateItemTree(ch, treeItem, select=select) def exportItemChanged(self, item, prev): if item is None: return if item.gitem is self.scene: newBounds = self.scene.views()[0].viewRect() else: newBounds = item.gitem.sceneBoundingRect() self.selectBox.setRect(newBounds) self.selectBox.show() self.updateFormatList() def updateFormatList(self): current = self.ui.formatList.currentItem() if current is not None: current = str(current.text()) self.ui.formatList.clear() self.exporterClasses = {} gotCurrent = False for exp in exporters.listExporters(): self.ui.formatList.addItem(exp.Name) self.exporterClasses[exp.Name] = exp if exp.Name == current: self.ui.formatList.setCurrentRow(self.ui.formatList.count()-1) gotCurrent = True if not gotCurrent: self.ui.formatList.setCurrentRow(0) def exportFormatChanged(self, item, prev): if item is None: self.currentExporter = None self.ui.paramTree.clear() return expClass = self.exporterClasses[str(item.text())] exp = expClass(item=self.ui.itemTree.currentItem().gitem) params = exp.parameters() if params is None: self.ui.paramTree.clear() else: self.ui.paramTree.setParameters(params) self.currentExporter = exp def exportClicked(self): self.selectBox.hide() self.currentExporter.export() def close(self): self.selectBox.setVisible(False) self.setVisible(False)
{ "content_hash": "79660ee7fb7295fe37503bebdfb5b034", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 114, "avg_line_length": 35.184, "alnum_prop": 0.5904956798544793, "repo_name": "robertsj/poropy", "id": "72809d448eecd2e5388ebc7aef477e4c47b8d5ec", "size": "4398", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pyqtgraph/GraphicsScene/exportDialog.py", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "689595" }, { "name": "FORTRAN", "bytes": "287686" }, { "name": "JavaScript", "bytes": "54100" }, { "name": "Objective-C", "bytes": "1752" }, { "name": "Python", "bytes": "1731311" }, { "name": "Racket", "bytes": "340" } ], "symlink_target": "" }
#ifndef _LINUX_ACPI_H #define _LINUX_ACPI_H #include <linux/errno.h> #include <linux/ioport.h> /* for struct resource */ #include <linux/device.h> #ifdef CONFIG_ACPI #ifndef _LINUX #define _LINUX #endif #include <linux/list.h> #include <linux/mod_devicetable.h> #include <acpi/acpi.h> #include <acpi/acpi_bus.h> #include <acpi/acpi_drivers.h> #include <acpi/acpi_numa.h> #include <acpi/acpi_io.h> #include <asm/acpi.h> static inline acpi_handle acpi_device_handle(struct acpi_device *adev) { return adev ? adev->handle : NULL; } #define ACPI_COMPANION(dev) ((dev)->acpi_node.companion) #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) static inline void acpi_preset_companion(struct device *dev, struct acpi_device *parent, u64 addr) { ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL)); } static inline const char *acpi_dev_name(struct acpi_device *adev) { return dev_name(&adev->dev); } enum acpi_irq_model_id { ACPI_IRQ_MODEL_PIC = 0, ACPI_IRQ_MODEL_IOAPIC, ACPI_IRQ_MODEL_IOSAPIC, ACPI_IRQ_MODEL_PLATFORM, ACPI_IRQ_MODEL_COUNT }; extern enum acpi_irq_model_id acpi_irq_model; enum acpi_interrupt_id { ACPI_INTERRUPT_PMI = 1, ACPI_INTERRUPT_INIT, ACPI_INTERRUPT_CPEI, ACPI_INTERRUPT_COUNT }; #define ACPI_SPACE_MEM 0 enum acpi_address_range_id { ACPI_ADDRESS_RANGE_MEMORY = 1, ACPI_ADDRESS_RANGE_RESERVED = 2, ACPI_ADDRESS_RANGE_ACPI = 3, ACPI_ADDRESS_RANGE_NVS = 4, ACPI_ADDRESS_RANGE_COUNT }; /* Table Handlers */ typedef int (*acpi_tbl_table_handler)(struct acpi_table_header *table); typedef int (*acpi_tbl_entry_handler)(struct acpi_subtable_header *header, const unsigned long end); #ifdef CONFIG_ACPI_INITRD_TABLE_OVERRIDE void acpi_initrd_override(void *data, size_t size); #else static inline void acpi_initrd_override(void *data, size_t size) { } #endif char * __acpi_map_table (unsigned long phys_addr, unsigned long size); void __acpi_unmap_table(char *map, unsigned long size); int early_acpi_boot_init(void); int acpi_boot_init (void); void acpi_boot_table_init (void); int acpi_mps_check (void); int acpi_numa_init (void); int acpi_table_init (void); int acpi_table_parse(char *id, acpi_tbl_table_handler handler); int __init acpi_table_parse_entries(char *id, unsigned long table_size, int entry_id, acpi_tbl_entry_handler handler, unsigned int max_entries); int acpi_table_parse_madt(enum acpi_madt_type id, acpi_tbl_entry_handler handler, unsigned int max_entries); int acpi_parse_mcfg (struct acpi_table_header *header); void acpi_table_print_madt_entry (struct acpi_subtable_header *madt); /* the following four functions are architecture-dependent */ void acpi_numa_slit_init (struct acpi_table_slit *slit); void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa); void acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa); int acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma); void acpi_numa_arch_fixup(void); #ifdef CONFIG_ACPI_HOTPLUG_CPU /* Arch dependent functions for cpu hotplug support */ int acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu); int acpi_unmap_lsapic(int cpu); #endif /* CONFIG_ACPI_HOTPLUG_CPU */ int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base); int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base); void acpi_irq_stats_init(void); extern u32 acpi_irq_handled; extern u32 acpi_irq_not_handled; extern int sbf_port; extern unsigned long acpi_realmode_flags; int acpi_register_gsi (struct device *dev, u32 gsi, int triggering, int polarity); int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); int acpi_isa_irq_to_gsi (unsigned isa_irq, u32 *gsi); #ifdef CONFIG_X86_IO_APIC extern int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity); #else #define acpi_get_override_irq(gsi, trigger, polarity) (-1) #endif /* * This function undoes the effect of one call to acpi_register_gsi(). * If this matches the last registration, any IRQ resources for gsi * are freed. */ void acpi_unregister_gsi (u32 gsi); struct pci_dev; int acpi_pci_irq_enable (struct pci_dev *dev); void acpi_penalize_isa_irq(int irq, int active); void acpi_pci_irq_disable (struct pci_dev *dev); extern int ec_read(u8 addr, u8 *val); extern int ec_write(u8 addr, u8 val); extern int ec_transaction(u8 command, const u8 *wdata, unsigned wdata_len, u8 *rdata, unsigned rdata_len); extern acpi_handle ec_get_handle(void); #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) typedef void (*wmi_notify_handler) (u32 value, void *context); extern acpi_status wmi_evaluate_method(const char *guid, u8 instance, u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out); extern acpi_status wmi_query_block(const char *guid, u8 instance, struct acpi_buffer *out); extern acpi_status wmi_set_block(const char *guid, u8 instance, const struct acpi_buffer *in); extern acpi_status wmi_install_notify_handler(const char *guid, wmi_notify_handler handler, void *data); extern acpi_status wmi_remove_notify_handler(const char *guid); extern acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out); extern bool wmi_has_guid(const char *guid); #endif /* CONFIG_ACPI_WMI */ #define ACPI_VIDEO_OUTPUT_SWITCHING 0x0001 #define ACPI_VIDEO_DEVICE_POSTING 0x0002 #define ACPI_VIDEO_ROM_AVAILABLE 0x0004 #define ACPI_VIDEO_BACKLIGHT 0x0008 #define ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR 0x0010 #define ACPI_VIDEO_BACKLIGHT_FORCE_VIDEO 0x0020 #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VENDOR 0x0040 #define ACPI_VIDEO_OUTPUT_SWITCHING_FORCE_VIDEO 0x0080 #define ACPI_VIDEO_BACKLIGHT_DMI_VENDOR 0x0100 #define ACPI_VIDEO_BACKLIGHT_DMI_VIDEO 0x0200 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VENDOR 0x0400 #define ACPI_VIDEO_OUTPUT_SWITCHING_DMI_VIDEO 0x0800 #if defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle); extern long acpi_is_video_device(acpi_handle handle); extern void acpi_video_dmi_promote_vendor(void); extern void acpi_video_dmi_demote_vendor(void); extern int acpi_video_backlight_support(void); extern int acpi_video_display_switch_support(void); #else static inline long acpi_video_get_capabilities(acpi_handle graphics_dev_handle) { return 0; } static inline long acpi_is_video_device(acpi_handle handle) { return 0; } static inline void acpi_video_dmi_promote_vendor(void) { } static inline void acpi_video_dmi_demote_vendor(void) { } static inline int acpi_video_backlight_support(void) { return 0; } static inline int acpi_video_display_switch_support(void) { return 0; } #endif /* defined(CONFIG_ACPI_VIDEO) || defined(CONFIG_ACPI_VIDEO_MODULE) */ extern int acpi_blacklisted(void); extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d); extern void acpi_osi_setup(char *str); #ifdef CONFIG_ACPI_NUMA int acpi_get_pxm(acpi_handle handle); int acpi_get_node(acpi_handle *handle); #else static inline int acpi_get_pxm(acpi_handle handle) { return 0; } static inline int acpi_get_node(acpi_handle *handle) { return 0; } #endif extern int acpi_paddr_to_node(u64 start_addr, u64 size); extern int pnpacpi_disabled; #define PXM_INVAL (-1) bool acpi_dev_resource_memory(struct acpi_resource *ares, struct resource *res); bool acpi_dev_resource_io(struct acpi_resource *ares, struct resource *res); bool acpi_dev_resource_address_space(struct acpi_resource *ares, struct resource *res); bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares, struct resource *res); unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable); bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index, struct resource *res); struct resource_list_entry { struct list_head node; struct resource res; }; void acpi_dev_free_resource_list(struct list_head *list); int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, int (*preproc)(struct acpi_resource *, void *), void *preproc_data); int acpi_check_resource_conflict(const struct resource *res); int acpi_check_region(resource_size_t start, resource_size_t n, const char *name); int acpi_resources_are_enforced(void); #ifdef CONFIG_HIBERNATION void __init acpi_no_s4_hw_signature(void); #endif #ifdef CONFIG_PM_SLEEP void __init acpi_old_suspend_ordering(void); void __init acpi_nvs_nosave(void); void __init acpi_nvs_nosave_s3(void); #endif /* CONFIG_PM_SLEEP */ struct acpi_osc_context { char *uuid_str; /* UUID string */ int rev; struct acpi_buffer cap; /* list of DWORD capabilities */ struct acpi_buffer ret; /* free by caller if success */ }; acpi_status acpi_str_to_uuid(char *str, u8 *uuid); acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); /* Indexes into _OSC Capabilities Buffer (DWORDs 2 & 3 are device-specific) */ #define OSC_QUERY_DWORD 0 /* DWORD 1 */ #define OSC_SUPPORT_DWORD 1 /* DWORD 2 */ #define OSC_CONTROL_DWORD 2 /* DWORD 3 */ /* _OSC Capabilities DWORD 1: Query/Control and Error Returns (generic) */ #define OSC_QUERY_ENABLE 0x00000001 /* input */ #define OSC_REQUEST_ERROR 0x00000002 /* return */ #define OSC_INVALID_UUID_ERROR 0x00000004 /* return */ #define OSC_INVALID_REVISION_ERROR 0x00000008 /* return */ #define OSC_CAPABILITIES_MASK_ERROR 0x00000010 /* return */ /* Platform-Wide Capabilities _OSC: Capabilities DWORD 2: Support Field */ #define OSC_SB_PAD_SUPPORT 0x00000001 #define OSC_SB_PPC_OST_SUPPORT 0x00000002 #define OSC_SB_PR3_SUPPORT 0x00000004 #define OSC_SB_HOTPLUG_OST_SUPPORT 0x00000008 #define OSC_SB_APEI_SUPPORT 0x00000010 #define OSC_SB_CPC_SUPPORT 0x00000020 extern bool osc_sb_apei_support_acked; /* PCI Host Bridge _OSC: Capabilities DWORD 2: Support Field */ #define OSC_PCI_EXT_CONFIG_SUPPORT 0x00000001 #define OSC_PCI_ASPM_SUPPORT 0x00000002 #define OSC_PCI_CLOCK_PM_SUPPORT 0x00000004 #define OSC_PCI_SEGMENT_GROUPS_SUPPORT 0x00000008 #define OSC_PCI_MSI_SUPPORT 0x00000010 #define OSC_PCI_SUPPORT_MASKS 0x0000001f /* PCI Host Bridge _OSC: Capabilities DWORD 3: Control Field */ #define OSC_PCI_EXPRESS_NATIVE_HP_CONTROL 0x00000001 #define OSC_PCI_SHPC_NATIVE_HP_CONTROL 0x00000002 #define OSC_PCI_EXPRESS_PME_CONTROL 0x00000004 #define OSC_PCI_EXPRESS_AER_CONTROL 0x00000008 #define OSC_PCI_EXPRESS_CAPABILITY_CONTROL 0x00000010 #define OSC_PCI_CONTROL_MASKS 0x0000001f extern acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 *mask, u32 req); /* Enable _OST when all relevant hotplug operations are enabled */ #if defined(CONFIG_ACPI_HOTPLUG_CPU) && \ defined(CONFIG_ACPI_HOTPLUG_MEMORY) && \ defined(CONFIG_ACPI_CONTAINER) #define ACPI_HOTPLUG_OST #endif /* _OST Source Event Code (OSPM Action) */ #define ACPI_OST_EC_OSPM_SHUTDOWN 0x100 #define ACPI_OST_EC_OSPM_EJECT 0x103 #define ACPI_OST_EC_OSPM_INSERTION 0x200 /* _OST General Processing Status Code */ #define ACPI_OST_SC_SUCCESS 0x0 #define ACPI_OST_SC_NON_SPECIFIC_FAILURE 0x1 #define ACPI_OST_SC_UNRECOGNIZED_NOTIFY 0x2 /* _OST OS Shutdown Processing (0x100) Status Code */ #define ACPI_OST_SC_OS_SHUTDOWN_DENIED 0x80 #define ACPI_OST_SC_OS_SHUTDOWN_IN_PROGRESS 0x81 #define ACPI_OST_SC_OS_SHUTDOWN_COMPLETED 0x82 #define ACPI_OST_SC_OS_SHUTDOWN_NOT_SUPPORTED 0x83 /* _OST Ejection Request (0x3, 0x103) Status Code */ #define ACPI_OST_SC_EJECT_NOT_SUPPORTED 0x80 #define ACPI_OST_SC_DEVICE_IN_USE 0x81 #define ACPI_OST_SC_DEVICE_BUSY 0x82 #define ACPI_OST_SC_EJECT_DEPENDENCY_BUSY 0x83 #define ACPI_OST_SC_EJECT_IN_PROGRESS 0x84 /* _OST Insertion Request (0x200) Status Code */ #define ACPI_OST_SC_INSERT_IN_PROGRESS 0x80 #define ACPI_OST_SC_DRIVER_LOAD_FAILURE 0x81 #define ACPI_OST_SC_INSERT_NOT_SUPPORTED 0x82 extern void acpi_early_init(void); extern int acpi_nvs_register(__u64 start, __u64 size); extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), void *data); const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, const struct device *dev); static inline bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { return !!acpi_match_device(drv->acpi_match_table, dev); } int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *); int acpi_device_modalias(struct device *, char *, int); #define ACPI_PTR(_ptr) (_ptr) #else /* !CONFIG_ACPI */ #define acpi_disabled 1 #define ACPI_COMPANION(dev) (NULL) #define ACPI_COMPANION_SET(dev, adev) do { } while (0) #define ACPI_HANDLE(dev) (NULL) static inline const char *acpi_dev_name(struct acpi_device *adev) { return NULL; } static inline void acpi_early_init(void) { } static inline int early_acpi_boot_init(void) { return 0; } static inline int acpi_boot_init(void) { return 0; } static inline void acpi_boot_table_init(void) { return; } static inline int acpi_mps_check(void) { return 0; } static inline int acpi_check_resource_conflict(struct resource *res) { return 0; } static inline int acpi_check_region(resource_size_t start, resource_size_t n, const char *name) { return 0; } struct acpi_table_header; static inline int acpi_table_parse(char *id, int (*handler)(struct acpi_table_header *)) { return -ENODEV; } static inline int acpi_nvs_register(__u64 start, __u64 size) { return 0; } static inline int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *), void *data) { return 0; } struct acpi_device_id; static inline const struct acpi_device_id *acpi_match_device( const struct acpi_device_id *ids, const struct device *dev) { return NULL; } static inline bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { return false; } static inline int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) { return -ENODEV; } static inline int acpi_device_modalias(struct device *dev, char *buf, int size) { return -ENODEV; } #define ACPI_PTR(_ptr) (NULL) #endif /* !CONFIG_ACPI */ #ifdef CONFIG_ACPI void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 pm1a_ctrl, u32 pm1b_ctrl)); acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control); void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state, u32 val_a, u32 val_b)); acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b); #ifdef CONFIG_X86 void arch_reserve_mem_area(acpi_physical_address addr, size_t size); #else static inline void arch_reserve_mem_area(acpi_physical_address addr, size_t size) { } #endif /* CONFIG_X86 */ #else #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0) #endif #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME) int acpi_dev_runtime_suspend(struct device *dev); int acpi_dev_runtime_resume(struct device *dev); int acpi_subsys_runtime_suspend(struct device *dev); int acpi_subsys_runtime_resume(struct device *dev); #else static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; } static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; } static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; } static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; } #endif #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP) int acpi_dev_suspend_late(struct device *dev); int acpi_dev_resume_early(struct device *dev); int acpi_subsys_prepare(struct device *dev); int acpi_subsys_suspend_late(struct device *dev); int acpi_subsys_resume_early(struct device *dev); #else static inline int acpi_dev_suspend_late(struct device *dev) { return 0; } static inline int acpi_dev_resume_early(struct device *dev) { return 0; } static inline int acpi_subsys_prepare(struct device *dev) { return 0; } static inline int acpi_subsys_suspend_late(struct device *dev) { return 0; } static inline int acpi_subsys_resume_early(struct device *dev) { return 0; } #endif #if defined(CONFIG_ACPI) && defined(CONFIG_PM) struct acpi_device *acpi_dev_pm_get_node(struct device *dev); int acpi_dev_pm_attach(struct device *dev, bool power_on); void acpi_dev_pm_detach(struct device *dev, bool power_off); #else static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev) { return NULL; } static inline int acpi_dev_pm_attach(struct device *dev, bool power_on) { return -ENODEV; } static inline void acpi_dev_pm_detach(struct device *dev, bool power_off) {} #endif #ifdef CONFIG_ACPI __printf(3, 4) void acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...); #else /* !CONFIG_ACPI */ static inline __printf(3, 4) void acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} #endif /* !CONFIG_ACPI */ /* * acpi_handle_<level>: Print message with ACPI prefix and object path * * These interfaces acquire the global namespace mutex to obtain an object * path. In interrupt context, it shows the object path as <n/a>. */ #define acpi_handle_emerg(handle, fmt, ...) \ acpi_handle_printk(KERN_EMERG, handle, fmt, ##__VA_ARGS__) #define acpi_handle_alert(handle, fmt, ...) \ acpi_handle_printk(KERN_ALERT, handle, fmt, ##__VA_ARGS__) #define acpi_handle_crit(handle, fmt, ...) \ acpi_handle_printk(KERN_CRIT, handle, fmt, ##__VA_ARGS__) #define acpi_handle_err(handle, fmt, ...) \ acpi_handle_printk(KERN_ERR, handle, fmt, ##__VA_ARGS__) #define acpi_handle_warn(handle, fmt, ...) \ acpi_handle_printk(KERN_WARNING, handle, fmt, ##__VA_ARGS__) #define acpi_handle_notice(handle, fmt, ...) \ acpi_handle_printk(KERN_NOTICE, handle, fmt, ##__VA_ARGS__) #define acpi_handle_info(handle, fmt, ...) \ acpi_handle_printk(KERN_INFO, handle, fmt, ##__VA_ARGS__) /* REVISIT: Support CONFIG_DYNAMIC_DEBUG when necessary */ #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG) #define acpi_handle_debug(handle, fmt, ...) \ acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__) #else #define acpi_handle_debug(handle, fmt, ...) \ ({ \ if (0) \ acpi_handle_printk(KERN_DEBUG, handle, fmt, ##__VA_ARGS__); \ 0; \ }) #endif #endif /*_LINUX_ACPI_H*/
{ "content_hash": "014eb456e4e5dd6afde64d7def007e39", "timestamp": "", "source": "github", "line_count": 605, "max_line_length": 82, "avg_line_length": 30.512396694214875, "alnum_prop": 0.7252437703141928, "repo_name": "lokeshjindal15/pd-gem5", "id": "1151a1dcfe41d950339bef27d8f9b12fa40d5c68", "size": "19444", "binary": false, "copies": "95", "ref": "refs/heads/master", "path": "kernel_dvfs/linux-linaro-tracking-gem5/include/linux/acpi.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Assembly", "bytes": "10138943" }, { "name": "Awk", "bytes": "19269" }, { "name": "C", "bytes": "469972635" }, { "name": "C++", "bytes": "18163034" }, { "name": "CMake", "bytes": "2202" }, { "name": "Clojure", "bytes": "333" }, { "name": "Emacs Lisp", "bytes": "1969" }, { "name": "Groff", "bytes": "63956" }, { "name": "HTML", "bytes": "136898" }, { "name": "Hack", "bytes": "2489" }, { "name": "Java", "bytes": "3096" }, { "name": "Jupyter Notebook", "bytes": "1231954" }, { "name": "Lex", "bytes": "59257" }, { "name": "M4", "bytes": "52982" }, { "name": "Makefile", "bytes": "1453704" }, { "name": "Objective-C", "bytes": "1315749" }, { "name": "Perl", "bytes": "716374" }, { "name": "Perl6", "bytes": "3727" }, { "name": "Protocol Buffer", "bytes": "3246" }, { "name": "Python", "bytes": "4102365" }, { "name": "Scilab", "bytes": "21433" }, { "name": "Shell", "bytes": "512873" }, { "name": "SourcePawn", "bytes": "4687" }, { "name": "UnrealScript", "bytes": "10556" }, { "name": "Visual Basic", "bytes": "2884" }, { "name": "XS", "bytes": "1239" }, { "name": "Yacc", "bytes": "121715" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <ListView android:id="@+id/list_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:entries="@array/list"> </ListView> </LinearLayout>
{ "content_hash": "1a55b39bf0d605e1df9fcdc30c2f1cd3", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 72, "avg_line_length": 33.53846153846154, "alnum_prop": 0.6788990825688074, "repo_name": "yuitang/First-Code", "id": "7b971b334cfc924ef2d6bad65028b286e3e42d06", "size": "436", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Chapter4/MyFragmentTest/app/src/main/res/layout/left_fragment.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "54039" } ], "symlink_target": "" }
function indexedGetter(obj, index) { if (index < 0) index = Math.max(0, index + obj.length); return obj[index]; } module.exports = (Bluebird) => { Bluebird.prototype.get = function get(prop) { return Bluebird.resolve((async () => { const value = await this; const isIndex = (typeof prop === "number"); if (!isIndex) { return value[prop] } else { return indexedGetter(value, prop) } })()); }; Bluebird.get = (promise, prop) => Bluebird.resolve(promise).get(prop); };
{ "content_hash": "dda7261447f5df5ce21d6f624a84b233", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 74, "avg_line_length": 29.5, "alnum_prop": 0.5322033898305085, "repo_name": "benjamingr/bluebird-api", "id": "e0a6ed09afcc131f24a4cfab93353b5f5f229490", "size": "590", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "promiseFns/get.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "287239" } ], "symlink_target": "" }
from __future__ import unicode_literals from indico.modules.events.management.views import WPEventManagement from indico.modules.events.views import WPConferenceDisplayBase, WPSimpleEventDisplayBase from indico.web.views import WPJinjaMixin class WPManageSurvey(WPEventManagement): template_prefix = 'events/surveys/' sidemenu_option = 'surveys' bundles = ('module_events.surveys.js', 'module_events.surveys.css') class WPSurveyResults(WPManageSurvey): pass class DisplaySurveyMixin(WPJinjaMixin): template_prefix = 'events/surveys/' base_class = None def _get_body(self, params): return WPJinjaMixin._get_page_content(self, params) class WPDisplaySurveyConference(DisplaySurveyMixin, WPConferenceDisplayBase): template_prefix = 'events/surveys/' base_class = WPConferenceDisplayBase menu_entry_name = 'surveys' bundles = ('module_events.surveys.js', 'module_events.surveys.css') class WPDisplaySurveySimpleEvent(DisplaySurveyMixin, WPSimpleEventDisplayBase): template_prefix = 'events/surveys/' base_class = WPSimpleEventDisplayBase bundles = ('module_events.surveys.js', 'module_events.surveys.css')
{ "content_hash": "c8b1513eb086e1e51896c6462cc9d819", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 89, "avg_line_length": 32.72222222222222, "alnum_prop": 0.764855687606112, "repo_name": "mic4ael/indico", "id": "725e0d47bf85430486820914991f9f2ad4ddc735", "size": "1392", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "indico/modules/events/surveys/views.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "553825" }, { "name": "HTML", "bytes": "1375160" }, { "name": "JavaScript", "bytes": "1852830" }, { "name": "Mako", "bytes": "1340" }, { "name": "Python", "bytes": "4612709" }, { "name": "Shell", "bytes": "2665" }, { "name": "TeX", "bytes": "23292" }, { "name": "XSLT", "bytes": "1504" } ], "symlink_target": "" }