Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      JSON parse error: Missing a closing quotation mark in string. in row 1075
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 145, in _generate_tables
                  dataset = json.load(f)
                File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
                  return loads(fp.read(),
                File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
                  return _default_decoder.decode(s)
                File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
                  raise JSONDecodeError("Extra data", s, end)
              json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 1599)
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1995, in _prepare_split_single
                  for _, table in generator:
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 148, in _generate_tables
                  raise e
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/packaged_modules/json/json.py", line 122, in _generate_tables
                  pa_table = paj.read_json(
                File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
                File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
                File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
              pyarrow.lib.ArrowInvalid: JSON parse error: Missing a closing quotation mark in string. in row 1075
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1529, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1154, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1027, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1122, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1882, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 2038, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

text
string
meta
dict
QueryBuilder.setDefaults({ lang: { "add_rule": "Add rule", "add_group": "Add group", "delete_rule": "Delete", "delete_group": "Delete", "and_condition": "AND", "or_condition": "OR", "filter_select_placeholder": "------", "operator_equal": "equal", "operator_not_equal": "not equal", "operator_in": "in", "operator_not_in": "not in", "operator_less": "less", "operator_less_or_equal": "less or equal", "operator_greater": "greater", "operator_greater_or_equal": "greater or equal", "operator_begins_with": "begins with", "operator_not_begins_with": "doesn't begin with", "operator_contains": "contains", "operator_not_contains": "doesn't contain", "operator_ends_with": "ends with", "operator_not_ends_with": "doesn't end with", "operator_is_empty": "is empty", "operator_is_not_empty": "is not empty", "operator_is_null": "is null", "operator_is_not_null": "is not null" }});
{ "content_hash": "660d2ec59756ad5b60fb3a78a8432457", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 51, "avg_line_length": 30.933333333333334, "alnum_prop": 0.634698275862069, "repo_name": "elucidat/jQuery-QueryBuilder", "id": "eb1518036df237375190c2f13f2620f8c4c4d994", "size": "928", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "i18n/en.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2037" }, { "name": "JavaScript", "bytes": "37502" } ] }
namespace DecoratorPattern { using System; public abstract class EventService : IEventService { public abstract decimal Cost { get; } } }
{ "content_hash": "bddeb0ca26498ac70a9cc1d1af85fe4b", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 54, "avg_line_length": 18.22222222222222, "alnum_prop": 0.6585365853658537, "repo_name": "marianamn/Telerik-Academy-Activities", "id": "073a6adffd1e39d730c0875fad7e28806867c9d3", "size": "166", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Homeworks/13. Design patterns/02. Structural Patterns/StructuralPatterns/DecoratorPattern/EventService.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "1385995" }, { "name": "CSS", "bytes": "215904" }, { "name": "HTML", "bytes": "211998" }, { "name": "JavaScript", "bytes": "564294" }, { "name": "XSLT", "bytes": "4123" } ] }
package de.element34.sbteclipsify import scala.xml._ /** * Base class for classpathentry filters. */ trait Filter { def pattern: String def name: String def mkString = """%s="%s"""" format (name, pattern) def toMetaData = new UnprefixedAttribute(name, pattern, Node.NoAttributes) } /** * Defines a include pattern for a classpath entry. <br /> * e.g.: <code>&lt;classpathentry kind="src" path="src/" including="*.scala" /&gt;</code> */ case class IncludeFilter(pattern: String) extends Filter { val name = "including" } /** * Defines a exclude pattern for a classpath entry. <br /> * e.g.: <code>&lt;classpathentry kind="src" path="src/" excluding="*.scala" /&gt;</code> */ case class ExcludeFilter(pattern: String) extends Filter { val name = "excluding" } /** * Combines <code>IncludeFilter</code> and <code>ExcludeFilter</code> for use in a <code>ClasspathEntry</code> */ case class FilterChain(inc: Option[IncludeFilter], ex: Option[ExcludeFilter]) { /** * Generates the actual markup for a classpathentry */ def mkString: String = inc.map(_.mkString).getOrElse("") + ex.map(_.mkString).getOrElse("") def toMetaData = inc.map(_.toMetaData).getOrElse(Node.NoAttributes) append ex.map(_.toMetaData).getOrElse(Node.NoAttributes) } /** * Companion object for <code>FilterChain</code> to provide convenience method for their creation. */ object FilterChain { def apply(inc: IncludeFilter, ex: ExcludeFilter) = new FilterChain(Some(inc), Some(ex)) def apply(inc: IncludeFilter) = new FilterChain(Some(inc), None) def apply(ex: ExcludeFilter) = new FilterChain(None, Some(ex)) } /** * Special type designating an empty <code>FilterChain</code> */ object EmptyFilter extends FilterChain(None, None)
{ "content_hash": "b83a205ed634aa0ad3747c7f9b24027e", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 125, "avg_line_length": 32.679245283018865, "alnum_prop": 0.7118937644341802, "repo_name": "musk/SbtEclipsify", "id": "a58d27840c669abf8678b28a86cc00838f5a2cde", "size": "3334", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/de/element34/sbteclipsify/Filter.scala", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Scala", "bytes": "37731" } ] }
import { NgModule } from '@angular/core'; import { AngularDragonDirective } from './directive/angular-dragon.directive'; export * from './directive/angular-dragon.directive'; export var AngularDraggableModule = (function () { function AngularDragonModule() { } AngularDragonModule.decorators = [ { type: NgModule, args: [{ declarations: [ AngularDragonDirective ], exports: [ AngularDragonDirective ] },] }, ]; AngularDragonModule.ctorParameters = function () { return []; }; return AngularDragonModule; }()); //# sourceMappingURL=index.js.map
{ "content_hash": "ccbd6ae9acd5a23b5514185536b07c36", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 78, "avg_line_length": 35.95, "alnum_prop": 0.5632823365785814, "repo_name": "silvandiepen/angular-dragon", "id": "0a8c081ba0b1b19130b9b3b52db018f3b970a6e8", "size": "719", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dist/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "315" } ] }
package org.opensingular.requirement.module.wicket.view.form; import org.apache.commons.lang3.math.NumberUtils; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.opensingular.form.util.diff.DocumentDiff; import org.opensingular.form.wicket.panel.diff.DiffVisualizer; import org.opensingular.lib.wicket.util.bootstrap.layout.BSGrid; import org.opensingular.lib.wicket.util.bootstrap.layout.BSLabel; import org.opensingular.lib.wicket.util.bootstrap.layout.BSRow; import org.opensingular.lib.wicket.util.datatable.BSDataTable; import org.opensingular.lib.wicket.util.output.BOutputPanel; import org.opensingular.requirement.module.service.FormRequirementService; import org.opensingular.requirement.module.service.SingularDiffService; import org.opensingular.requirement.module.wicket.view.template.ServerTemplate; import org.opensingular.requirement.module.wicket.view.util.ActionContext; import org.opensingular.requirement.module.wicket.view.util.ModuleButtonFactory; import javax.inject.Inject; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Optional; import static org.opensingular.lib.wicket.util.util.Shortcuts.$m; public class DiffFormPage extends ServerTemplate { public static final String CURRENT_FORM_VERSION_ID = "cfv"; public static final String PREVIOUS_FORM_VERSION_ID = "pfv"; public static final String CURRENT_REQUIREMENT_ID = "cr"; public static final String PREVIOUS_REQUIREMENT_ID = "pr"; @Inject protected FormRequirementService formRequirementService; @Inject protected SingularDiffService singularDiffService; private ActionContext config; protected BSDataTable<DocumentDiff, String> table; protected SingularDiffService.DiffSummary diffSummary; protected BSGrid contentGrid = new BSGrid("content"); public DiffFormPage(ActionContext config) { this.config = config; } @Override protected void onConfigure() { super.onConfigure(); Optional<Long> requirementId = config.getRequirementId(); Optional<String> formVersionId = config.getParam(CURRENT_FORM_VERSION_ID); Optional<String> currentRequirementId = config.getParam(CURRENT_REQUIREMENT_ID); Optional<String> previousRequirementId = config.getParam(PREVIOUS_REQUIREMENT_ID); if (formVersionId.isPresent()) { Long current = Long.valueOf(formVersionId.get()); Long previous = config.getParam(PREVIOUS_FORM_VERSION_ID).map(NumberUtils::toLong).orElse(null); diffSummary = singularDiffService.diffFormVersions(current, previous); } else if (currentRequirementId.isPresent() && previousRequirementId.isPresent()) { Long current = Long.valueOf(currentRequirementId.get()); Long previous = Long.valueOf(previousRequirementId.get()); diffSummary = singularDiffService.diffRequirementsLastMainForms(current, previous); } else if (requirementId.isPresent()) { diffSummary = singularDiffService.diffFromPrevious(requirementId.get()); } if (diffSummary != null) { add(contentGrid); adicionarDatas(diffSummary.getPreviousFormVersionDate(), diffSummary.getCurrentFormVersionDate()); add(new DiffVisualizer("diff", diffSummary.getDiff())); } } private void adicionarDatas(Date originalDate, Date newerDate) { BSRow container = contentGrid.newRow(); appendDate(container, "Data da modificação anterior:", originalDate); appendDate(container, "Data da modificação atual:", newerDate); contentGrid.newRow().newCol(2) .newFormGroup() .appendLabel(new BSLabel("label", $m.ofValue(""))) .appendComponent(id -> new ModuleButtonFactory(config).getViewVersionButton(id, diffSummary.getPreviousFormVersionId())); } private void appendDate(BSRow container, String fieldLabel, Date data) { container.newCol(2) .newFormGroup() .appendLabel(new BSLabel("label", fieldLabel)) .appendTag("div", new BOutputPanel("data", $m.ofValue(new SimpleDateFormat("dd/MM/yyyy HH:mm").format(data)))); } @Override protected IModel<String> getContentTitle() { return new Model<>(); } @Override protected IModel<String> getContentSubtitle() { return new Model<>(); } @Override protected boolean isWithMenu() { return false; } }
{ "content_hash": "3ddf0f961707d77b4449d96e9f69182d", "timestamp": "", "source": "github", "line_count": 117, "max_line_length": 137, "avg_line_length": 39.256410256410255, "alnum_prop": 0.7121706945351622, "repo_name": "opensingular/singular-server", "id": "2ad0418c91879303f9049e9018aa0fa7fc6b973d", "size": "5243", "binary": false, "copies": "1", "ref": "refs/heads/feature_1.9.x", "path": "requirement/requirement-module/src/main/java/org/opensingular/requirement/module/wicket/view/form/DiffFormPage.java", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "2626" }, { "name": "FreeMarker", "bytes": "4395" }, { "name": "HTML", "bytes": "41081" }, { "name": "Java", "bytes": "2107557" }, { "name": "JavaScript", "bytes": "2853" }, { "name": "SQLPL", "bytes": "461" } ] }
import { Identity } from './identity'; import { React, ko_if, ko_ifnot, ko_foreach } from "kjsx"; export default class ConfirmViewModel<TKey> { constructor(private props: { id: TKey, ["code*"]: string, identity: Identity<TKey>, onConfirm: () => void }) { var accountId = props.id; var code: string = props['code*']; props.identity.services.authentication.confirmEmail({ userId: accountId, code: code }).then(() => { this.props.identity.account().emailConfirmed = true; this.props.onConfirm(); }); } public render() { return <div></div>; } }
{ "content_hash": "b30ac5542c38d1a0cd9d85c6ac0f89b5", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 114, "avg_line_length": 36.94117647058823, "alnum_prop": 0.5955414012738853, "repo_name": "folkelib/folke-identity", "id": "35b8fd4491b22d448145bcc582fce6fbfab2aa16", "size": "628", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "identity-confirm.tsx", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "241" }, { "name": "TypeScript", "bytes": "34048" } ] }
#include <stdio.h> #include <assert.h> #include <errno.h> #include <stdlib.h> #include <utils/util.h> #include <platsupport/timer.h> #include <platsupport/mach/epit.h> #include <platsupport/plat/timer.h> #include "../../stubtimer.h" /* EPIT CONTROL REGISTER BITS */ typedef enum { /* * This bit enables the EPIT. */ EN = 0, /* * By setting this bit, then when EPIT is disabled (EN=0), then * both Main Counter and Prescaler Counter freeze their count at * current count values. */ ENMOD = 1, /* * This bit enables the generation of interrupt when a compare * event occurs */ OCIEN = 2, /* * This bit is cleared by hardware reset. It controls whether the * counter runs in free running mode OR set and forget mode. */ RLD = 3, /* * Bits 4 - 15 determine the prescaler value by which the clock is divided * before it goes into the counter. * * The prescaler used is the value in these bits + 1. ie: * * 0x00 divide by 1 * 0x01 divide by 2 * 0x10 divide by 3 * . * . * . * 0xFFF divide by 4096 * */ PRESCALER = 4, /* * This bit controls the counter data when the modulus register is * written. When this bit is set, all writes to the load register * will overwrite the counter contents and the counter will * subsequently start counting down from the programmed value. */ IOVW = 17, /* * These bits select the clock input used to run the counter. After * reset, the system functional clock is selected. The input clock * can also be turned off if these bits are set to 00. This field * value should only be changed when the EPIT is disabled. */ CLKSRC = 24 } epit_control_reg; enum IPGConstants { IPG_CLK = 1, IPG_CLK_HIGHFREQ = 2, IPG_CLK_32K = 3 }; /* Memory map for EPIT (Enhanced Periodic Interrupt Timer). */ struct epit_map { /* epit control register */ uint32_t epitcr; /* epit status register */ uint32_t epitsr; /* epit load register */ uint32_t epitlr; /* epit compare register */ uint32_t epitcmpr; /* epit counter register */ uint32_t epitcnt; }; typedef enum { PERIODIC, ONESHOT } epit_mode_t; typedef struct epit { volatile struct epit_map *epit_map; uint64_t counter_start; int mode; uint32_t irq; uint32_t prescaler; } epit_t; static int epit_timer_start(const pstimer_t *timer) { epit_t *epit = (epit_t*) timer->data; /* Enable EPIT. */ epit->epit_map->epitcr |= 1; return 0; } static int epit_timer_stop(const pstimer_t *timer) { epit_t *epit = (epit_t*) timer->data; /* Disable timer irq. */ epit->epit_map->epitcr &= ~(BIT(EN)); return 0; } static int configure_epit(const pstimer_t *timer, uint64_t ns) { epit_t *epit = (epit_t*) timer->data; /* Set counter modulus - this effectively sets the timeouts to us but doesn't * overflow as fast. */ uint64_t counterValue = (uint64_t) (IPG_FREQ / (epit->prescaler + 1)) * (ns / 1000ULL); if (counterValue >= (1ULL << 32)) { ZF_LOGE("ns too high %llu\n", ns); /* Counter too large to be stored in 32 bits. */ return EINVAL; } epit->counter_start = ns; /* hardware has a race condition where the epitlr won't be set properly * - keep trying until it works */ epit->epit_map->epitlr = counterValue; while (epit->epit_map->epitlr != counterValue) { epit->epit_map->epitlr = counterValue; } /* turn it on (just in case it was off) */ epit->epit_map->epitcr |= BIT(EN); return 0; } static int epit_periodic(const pstimer_t *timer, uint64_t ns) { epit_t *epit = (epit_t*) timer->data; epit->mode = PERIODIC; return configure_epit(timer, ns); } static int epit_oneshot_relative(const pstimer_t *timer, uint64_t ns) { epit_t *epit = (epit_t*) timer->data; epit->mode = ONESHOT; return configure_epit(timer, ns); } static void epit_handle_irq(const pstimer_t *timer, uint32_t irq) { epit_t *epit = (epit_t*) timer->data; assert(irq == epit->irq); if (epit->epit_map->epitsr) { epit->epit_map->epitsr = 1; if (epit->mode != PERIODIC) { /* disable the epit if we don't want it to be periodic */ /* this has to be done as the epit is configured to * reload the timer value after irq - this isn't desired * if we are periodic */ epit->epit_map->epitcr &= ~(BIT(EN)); } } } static uint64_t epit_get_time(const pstimer_t *timer) { epit_t *epit = (epit_t*) timer->data; uint64_t value; /* read the epit */ value = epit->epit_map->epitcnt; uint64_t ns = (value / (uint64_t)IPG_FREQ) * NS_IN_US * (epit->prescaler + 1); return epit->counter_start - ns; } static uint32_t epit_get_nth_irq(const pstimer_t *timer, uint32_t n) { epit_t *epit = (epit_t*) timer->data; if (n == 0) { return epit->irq; } return 0; } static pstimer_t singleton_timer; static epit_t singleton_epit; pstimer_t * epit_get_timer(epit_config_t *config) { /* check the irq */ if (config->irq != EPIT1_INTERRUPT && config->irq != EPIT2_INTERRUPT) { fprintf(stderr, "Invalid irq %u for epit, expected %u or %u\n", config->irq, EPIT1_INTERRUPT, EPIT2_INTERRUPT); return NULL; } pstimer_t *timer = &singleton_timer; epit_t *epit = &singleton_epit; timer->properties.upcounter = false; timer->properties.timeouts = true; timer->properties.relative_timeouts = true; timer->properties.absolute_timeouts = false; timer->properties.periodic_timeouts = true; timer->properties.bit_width = 32; timer->properties.irqs = 1; timer->data = (void *) epit; timer->start = epit_timer_start; timer->stop = epit_timer_stop; timer->get_time = epit_get_time; timer->oneshot_absolute = stub_timer_timeout; timer->oneshot_relative = epit_oneshot_relative; timer->periodic = epit_periodic; timer->handle_irq = epit_handle_irq; timer->get_nth_irq = epit_get_nth_irq; epit->irq = config->irq; epit->epit_map = (volatile struct epit_map*)config->vaddr; epit->prescaler = config->prescaler; /* Disable EPIT. */ epit->epit_map->epitcr = 0; /* Configure EPIT. */ epit->epit_map->epitcr = (IPG_CLK << CLKSRC) | /* Clock source = IPG */ (config->prescaler << PRESCALER) | /* Set the prescaler */ BIT(IOVW) | /* Overwrite counter immediately on write */ BIT(RLD) | /* Reload counter from modulus register on overflow */ BIT(OCIEN) | /* Enable interrupt on comparison event */ BIT(ENMOD) | /* Count from modulus on restart */ 0; /* Interrupt when compare with 0. */ epit->epit_map->epitcmpr = 0; return timer; }
{ "content_hash": "26e3ecb971b73737a45a742a7bade648", "timestamp": "", "source": "github", "line_count": 279, "max_line_length": 94, "avg_line_length": 25.42652329749104, "alnum_prop": 0.5990978291513955, "repo_name": "agacek/util_libs", "id": "a2a4296a309d8d95373d871280a00285a2cdb9ae", "size": "7328", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "libplatsupport/src/mach/imx/epit.c", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "1822206" }, { "name": "C++", "bytes": "183624" }, { "name": "HTML", "bytes": "182131" }, { "name": "Makefile", "bytes": "5983" }, { "name": "Python", "bytes": "1759" } ] }
"use strict"; const tester = require("cli-tester"); const read = require("@modular-css/test-utils/read.js")(__dirname); const cli = require.resolve("../cli.js"); describe("/cli.js", () => { afterAll(() => require("shelljs").rm("-rf", "./packages/cli/test/output")); it("should show help with no args", async () => { const out = await tester( cli ); expect(out.code).toBe(2); expect(out.stdout).toMatchSnapshot(); }); it("should default to outputting to stdout", async () => { const out = await tester( cli, "./packages/cli/test/specimens/simple.css" ); expect(out.code).toBe(0); expect(out.stdout).toMatchSnapshot(); }); it("should support outputting to a file (--out)", async () => { const out = await tester( cli, "--out=./packages/cli/test/output/simple.css", "./packages/cli/test/specimens/simple.css" ); expect(out.code).toBe(0); expect(read("simple.css")).toMatchSnapshot(); }); it("should support outputting compositions to a file (--json)", async () => { const out = await tester( cli, "--json=./packages/cli/test/output/classes.json", "./packages/cli/test/specimens/simple.css" ); expect(out.code).toBe(0); expect(read("classes.json")).toMatchSnapshot(); }); it("should return the correct error code on invalid CSS", async () => { const out = await tester( cli, "./packages/cli/test/specimens/invalid.css" ); expect(out.code).toBe(1); expect(out.stderr).toMatch("Invalid composes reference"); }); it("should support disabling url() rewriting (--no-rewrite)", async () => { const out = await tester( cli, "--no-rewrite", "--out=./packages/cli/test/output/no-rewrite.css", "./packages/cli/test/specimens/no-rewrite.css" ); expect(out.code).toBe(0); expect(read("no-rewrite.css")).toMatchSnapshot(); }); });
{ "content_hash": "cb197c6eaffbe1455dfc83c636c515aa", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 81, "avg_line_length": 29.10810810810811, "alnum_prop": 0.5436397400185701, "repo_name": "tivac/modular-css", "id": "8ca9a424482cf2be0a0c27c17047d14ce26f8912", "size": "2154", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "packages/cli/test/cli.test.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "326619" }, { "name": "PEG.js", "bytes": "3514" } ] }
It is a simple Swift converter from arabic numbers to roman numbers and from roman numbers to arabic. The supported range of the converted numbers is from 1 to 3999. ####How to use it? Grab four files from the ArabicRomanNumerals directory and add it to your project. Example arabic to roman conversion: ```swift var resultRomanNumber = try! ArabicToRoman.romanNumberFromArabicNumber(1689) ``` Example roman to arabic conversion: ```swift var resultArabicNumber = try! RomanToArabic.arabicNumberFromRomanNumber("MMcDXcvIi") ``` It's also demonstrated in the playground inside of the example project. Don't run the Xcode project because nothing (interesting) will happen. Just find `ArabsAndRomansPlayground.playground` and try different numbers. ####Why there are only numbers from 1 to 3999 supported? Because the number zero ["does not have its own Roman numeral"](https://en.wikipedia.org/wiki/Roman_numerals#Zero). Part of the number 4000 is in turn represented by 'V with bar over it' which is not an ASCII character. This also applies to other numbers greater than 4000 - hence the limit. ####Licence MIT
{ "content_hash": "f21025dceaeab58a90111dac379c1de6", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 291, "avg_line_length": 58.68421052631579, "alnum_prop": 0.7901345291479821, "repo_name": "bagofstars/ArabicRomanNumerals", "id": "0612b64fca9080dedf1bd98453aa4274c720a082", "size": "1154", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "41604" }, { "name": "Ruby", "bytes": "185" }, { "name": "Shell", "bytes": "8322" }, { "name": "Swift", "bytes": "214131" } ] }
var canvas = null; var context = null; var analogTimer = null; var digitalTimer = null; var currentDate = null; var hourHandLength = 70; var minuteHandLength = 100; var secondsHandLength = 100; var centerX = 150, centerY = 150; var incrementAngleHour = Math.PI / 6; var incrementAngleMinute = Math.PI/30; var incrementAngleSeconds = Math.PI/30; /* define positions for LED segments for a digital clock. The arrays represent * [x1,y1,x2,y2] where (x1,y1) is the start position of the segment and (x2,y2) * is the end position */ var ledHr1 = { "seg1": [100, 110, 115, 110], "seg2": [115, 112, 115, 150], "seg3": [115, 152, 115, 188], "seg4": [100, 190, 115, 190], "seg5": [100, 152, 100, 188], "seg6": [100, 112, 100, 150], "seg7": [100, 150, 115, 150] }; var ledHr2 = { "seg1": [125, 110, 140, 110], "seg2": [140, 112, 140, 150], "seg3": [140, 152, 140, 188], "seg4": [125, 190, 140, 190], "seg5": [125, 152, 125, 188], "seg6": [125, 112, 125, 150], "seg7": [125, 150, 140, 150] }; var ledMin1 = { "seg1": [160, 110, 175, 110], "seg2": [175, 112, 175, 150], "seg3": [175, 152, 175, 188], "seg4": [160, 190, 175, 190], "seg5": [160, 152, 160, 188], "seg6": [160, 112, 160, 150], "seg7": [160, 150, 175, 150] }; var ledMin2 = { "seg1": [185, 110, 200, 110], "seg2": [200, 112, 200, 150], "seg3": [200, 152, 200, 188], "seg4": [185, 190, 200, 190], "seg5": [185, 152, 185, 188], "seg6": [185, 112, 185, 150], "seg7": [185, 150, 200, 150] }; /* define a map to identify the segments to be drawn for a digit to be displayed in a digital clock. */ var map = { "draw0": [1, 2, 3, 4, 5, 6], "draw1": [2, 3], "draw2": [1, 2, 7, 5, 4], "draw3": [1, 2, 7, 3, 4], "draw4": [6, 7, 2, 3], "draw5": [1, 6, 7, 3, 4], "draw6": [1, 6, 5, 4, 3, 7], "draw7": [1, 2, 3], "draw8": [1, 2, 3, 4, 5, 6, 7], "draw9": [7, 6, 1, 2, 3, 4] }; /* this function initializes the canvas and the context */ function initializeCanvasAndContext(){ if (!canvas) { canvas = document.getElementById("mycanvas"); } if (context) { context.clearRect(0, 0, 300, 300); } else { context = canvas.getContext("2d"); } } /* this function is called to begin drawing an analog clock and to clear context * and redraw the clock elements every second. */ function drawAnalogClock() { initializeCanvasAndContext(); document.getElementById("analogButton").disabled = true; document.getElementById("digitalButton").disabled = false; if(digitalTimer){ window.clearInterval(digitalTimer); } analogTimer = window.setInterval(function() { if (context) context.clearRect(0, 0, 300, 300); drawAnalogClockBody(); drawSecondHand(); drawMinuteHand(); drawHourHand(); }, 1000); } /* this function draws the analog clock body, background gradient and the digits. * */ function drawAnalogClockBody() { context.beginPath(); context.arc(centerX, centerY, 125, 0, 2 * Math.PI, false); context.lineWidth = 8; context.closePath(); var grd = context.createRadialGradient(75, 50, 5, 90, 60, 100); grd.addColorStop(0, "gray"); grd.addColorStop(1, "black"); context.fillStyle = grd; context.fill(); context.stroke(); context.save(); context.fillStyle = 'red'; context.font = "20px Calibri"; context.fillText("12", 140, 45); context.fillText("3", 255, 155); context.fillText("6", 150, 265); context.fillText("9", 35, 155); context.restore(); } /* this function draws the hour hand of the analog clock */ function drawHourHand() { currentDate = new Date(); var hour = currentDate.getHours() % 12; var min = Math.floor(currentDate.getMinutes() / 12); var r_end_angle = hour * incrementAngleHour + (3 * Math.PI / 2) + (Math.PI / 30 * min); var endx = centerX + Math.cos(r_end_angle) * hourHandLength; var endy = centerY + Math.sin(r_end_angle) * hourHandLength; context.save(); context.beginPath(); context.moveTo(centerX, centerY); context.lineTo(endx, endy); context.closePath(); context.lineWidth = 4; context.strokeStyle = 'white'; context.stroke(); context.restore(); } /* this function draws the minute hand of the analog clock */ function drawMinuteHand() { currentDate = new Date(); var min = currentDate.getMinutes() % 60; var r_end_angle = min * incrementAngleMinute + (3 * Math.PI / 2); var endx = centerX + Math.cos(r_end_angle) * minuteHandLength; var endy = centerY + Math.sin(r_end_angle) * minuteHandLength; context.save(); context.beginPath(); context.moveTo(centerX, centerY); context.lineTo(endx, endy); context.closePath(); context.lineWidth = 4; context.strokeStyle = 'white'; context.stroke(); context.restore(); } /* this function draws the seconds hand of the analog clock */ function drawSecondHand() { currentDate = new Date(); var sec = currentDate.getSeconds() % 60; var r_end_angle = sec * incrementAngleSeconds + (3 * Math.PI / 2); var endx = centerX + Math.cos(r_end_angle) * secondsHandLength; var endy = centerY + Math.sin(r_end_angle) * secondsHandLength; context.save(); context.beginPath(); context.moveTo(centerX, centerY); context.lineTo(endx, endy); context.lineWidth = 2; context.strokeStyle = '#DDDDDD'; context.closePath(); context.stroke(); context.beginPath(); context.arc(centerX, centerY, 5, 0, 2 * Math.PI, false); context.closePath(); context.fillStyle = "white"; context.fill(); context.restore(); } /* this function is called to begin drawing a digital clock and to clear context * and redraw the clock elements every second. */ function drawDigitalClock() { initializeCanvasAndContext(); document.getElementById("analogButton").disabled = false; document.getElementById("digitalButton").disabled = true; if(analogTimer){ window.clearInterval(analogTimer); } digitalTimer = window.setInterval(function() { if (context) context.clearRect(0, 0, 300, 300); drawDigitalClockBody(); drawSecondsBlinker(); drawMinutes(); drawHours(); }, 1000); } /* this function draws the digital clock body and the background gradient. */ function drawDigitalClockBody() { context.beginPath(); context.arc(100, 150, 50, Math.PI, 3 * Math.PI / 2, false); context.lineTo(200, 100); context.arc(200, 150, 50, 3 * Math.PI / 2, 0, false); context.arc(200, 150, 50, 0, Math.PI / 2, false); context.lineTo(100, 200); context.arc(100, 150, 50, Math.PI / 2, Math.PI, false); context.closePath(); context.lineWidth = 8; var grd = context.createLinearGradient(0, 0, 150, 0); grd.addColorStop(0, "gray"); grd.addColorStop(1, "black"); context.fillStyle = grd; context.fill(); context.stroke(); } /* this function draws the seconds dots that blink in the digital clock */ function drawSecondsBlinker() { context.save(); context.fillStyle = '#FF0000'; context.beginPath(); context.arc(centerX, centerY-10, 2.5, 0, 2 * Math.PI, false); context.arc(centerX, centerY+10, 2.5, 0, 2 * Math.PI, false); context.closePath(); context.fill(); var timer = window.setInterval(function() { context.save(); context.fillStyle = 'black'; context.beginPath(); context.arc(centerX, centerY-10, 2.5, 0, 2 * Math.PI, false); context.arc(centerX, centerY+10, 2.5, 0, 2 * Math.PI, false); context.closePath(); context.fill(); context.restore(); window.clearInterval(timer); }, 500); context.restore(); } /* this function gets the minutes and calls calculateAndDrawDigits() to draw * them*/ function drawMinutes() { currentDate = new Date(); var mins = currentDate.getMinutes(); calculateAndDrawDigits(mins, "MINS"); } /* this function gets the hours and calls calculateAndDrawDigits() to draw them * */ function drawHours() { currentDate = new Date(); var hour = currentDate.getHours(); calculateAndDrawDigits(hour,"HOURS"); } /* calculates the digits to be drawn in the digital clock * and calls the drawDigits() function to draw them */ function calculateAndDrawDigits(val, denomination){ if (val === 0) { drawDigits(0, denomination, 0); drawDigits(1, denomination, 0); } else if (val <= 9) { drawDigits(0, denomination, 0); drawDigits(1, denomination, val); } else { drawDigits(0, denomination, Math.floor(val / 10)); drawDigits(1, denomination, val % 10); } } /* this function draws the digits inside the digital clock using the LED segment * positions and map for each digit */ function drawDigits(position, denomination, val) { var pointsmap = null; if (position === 0) { if (denomination === "HOURS") { pointsmap = ledHr1; } else { pointsmap = ledMin1; } } else { if (denomination === "HOURS") { pointsmap = ledHr2; } else { pointsmap = ledMin2; } } var usemap = eval("map.draw" + val); context.save(); context.lineWidth = 6; for (var i = 0; i < usemap.length; i++) { var ledNum = usemap[i]; var points = eval("pointsmap.seg" + ledNum); var xAdjustTip = 0; var yAdjustTip = 0; if(ledNum === 1|| ledNum === 4 || ledNum === 7){ //horizontal segments xAdjustTip = 3; yAdjustTip = 0; } else{ //vertical segments xAdjustTip = 0; yAdjustTip = 3; } context.beginPath(); context.moveTo(points[0], points[1]); context.lineTo(points[0]-yAdjustTip+xAdjustTip,points[1]+yAdjustTip-xAdjustTip); context.lineTo(points[0]+yAdjustTip+xAdjustTip,points[1]+yAdjustTip+xAdjustTip); context.closePath(); context.fillStyle = 'red'; context.fill(); context.beginPath(); context.moveTo(points[0]+xAdjustTip, points[1]+yAdjustTip); context.lineTo(points[2]-xAdjustTip, points[3]-yAdjustTip); context.closePath(); context.shadowColor = 'red'; context.strokeStyle = '#FF0000'; context.stroke(); context.beginPath(); context.moveTo(points[2], points[3]); context.lineTo(points[2]+yAdjustTip-xAdjustTip,points[3]-yAdjustTip+xAdjustTip); context.lineTo(points[2]-yAdjustTip-xAdjustTip, points[3]-yAdjustTip-xAdjustTip); context.closePath(); context.fill(); } context.restore(); }
{ "content_hash": "a5f576b762707859b146c1481a780f87", "timestamp": "", "source": "github", "line_count": 367, "max_line_length": 91, "avg_line_length": 29.719346049046322, "alnum_prop": 0.6066746126340882, "repo_name": "hetalv985/Clocks", "id": "a75787256acefbda1413f628c30544e1d7925df9", "size": "12164", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "js/hvclocks.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "12164" } ] }
package edu.hm.hafner.analysis.parser.dry; import java.io.IOException; import org.junit.jupiter.api.Test; import edu.hm.hafner.analysis.Issue; import edu.hm.hafner.analysis.IssueBuilder; import edu.hm.hafner.util.SerializableTest; import static org.assertj.core.api.Assertions.*; /** * Tests the class {@link DuplicationGroup}. * * @author Ullrich Hafner */ class DuplicationGroupTest extends SerializableTest<DuplicationGroup> { /** * Serializes an code duplication to a file. Use this method in case the properties have been changed and the * readResolve method has been adapted accordingly so that the old serialization still can be read. * * @param args * not used * * @throws IOException * if the file could not be written */ public static void main(final String... args) throws IOException { new DuplicationGroupTest().createSerializationFile(); } private static final String SERIALIZATION_NAME = "dry.ser"; private static final String CODE_FRAGMENT = "fragment"; @Override protected DuplicationGroup createSerializable() { DuplicationGroup group = new DuplicationGroup(); IssueBuilder builder = new IssueBuilder(); group.add(builder.setAdditionalProperties(group).setFileName("1").build()); group.add(builder.setAdditionalProperties(group).setFileName("2").build()); return group; } /** * Verifies that saved serialized format (from a previous release) still can be resolved with the current * implementation of {@link DuplicationGroup}. */ @Test void shouldReadIssueFromOldSerialization() { byte[] restored = readAllBytes(SERIALIZATION_NAME); assertThatSerializableCanBeRestoredFrom(restored); } @Test void shouldBeEmptyWhenCreated() { DuplicationGroup group = new DuplicationGroup(); assertThat(group.getCodeFragment()).isEmpty(); assertThat(group.getDuplications()).isEmpty(); } @Test void shouldNotOverwriteFragmentOnceItHasBeenSet() { DuplicationGroup group = new DuplicationGroup(); assertThat(group.getCodeFragment()).isEmpty(); group.setCodeFragment(CODE_FRAGMENT); assertThat(group.getCodeFragment()).isEqualTo(CODE_FRAGMENT); group.setCodeFragment("other"); assertThat(group.getCodeFragment()).isEqualTo(CODE_FRAGMENT); DuplicationGroup groupWithFragment = new DuplicationGroup(CODE_FRAGMENT); assertThat(groupWithFragment.getCodeFragment()).isEqualTo(CODE_FRAGMENT); groupWithFragment.setCodeFragment("other"); assertThat(groupWithFragment.getCodeFragment()).isEqualTo(CODE_FRAGMENT); } @Test void shouldReferenceAllDuplications() { DuplicationGroup group = new DuplicationGroup(CODE_FRAGMENT); assertThat(group.getDuplications()).isEmpty(); IssueBuilder builder = new IssueBuilder(); Issue first = builder.setAdditionalProperties(group).build(); Issue second = builder.setAdditionalProperties(group).build(); group.add(first); group.add(second); assertThat(group.getDuplications()).containsExactly(first, second); assertThat(first.getAdditionalProperties()).isEqualTo(second.getAdditionalProperties()); } }
{ "content_hash": "f5785a023fd3c44826f6d6472eb62b14", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 113, "avg_line_length": 33.52, "alnum_prop": 0.7007756563245824, "repo_name": "mschmidae/analysis-model", "id": "26e29b6aca33a4182e9a092fd748949931575c4d", "size": "3352", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/edu/hm/hafner/analysis/parser/dry/DuplicationGroupTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "15318" }, { "name": "Java", "bytes": "914880" }, { "name": "Shell", "bytes": "110" } ] }
<!DOCTYPE html> <html lang="en"> <head prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# website: http://ogp.me/ns/website#"> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="description" content=""> <meta property="og:title" content="Coreos"> <meta property="og:type" content="website"> <meta property="og:description" content=""> <meta property="og:url" content="https://kalbas.it/tags/coreos/"> <meta property="og:site_name" content="kalbasit"> <meta name="generator" content="Hugo 0.50" /> <title>Coreos &middot; kalbasit</title> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://kalbas.it/css/style.css"> <link href="https://kalbas.it/index.xml" rel="alternate" type="application/rss+xml" title="kalbasit" /> <link rel="icon" href="https://kalbas.it/favicon.ico" /> </head> <body> <nav class="navbar navbar-default navbar-fixed-top visible-xs"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="https://kalbas.it/">Wael Nasreddine</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li><a href="https://kalbas.it/about/">About</a></li> <li><a href="https://kalbas.it/post/">Blog</a></li> <li><a href="https://kalbas.it/tags/">Tags</a></li> </ul> </div> </div> </nav> <div class="container-fluid"> <div class="row"> <div id="menu" class="hidden-xs col-sm-4 col-md-3 col-lg-2 col-xl-2"> <div id="menu-content" class="vertical-align"> <h1 class="text-center"><a href="https://kalbas.it/">Wael Nasreddine</a></h1> <small class="text-center center-block">Father - Entreprenur - Architect - Engineer</small> <img id="profile-pic" src="https://kalbas.it//img/me.jpg" alt="My Picture" class="img-circle center-block"> <div id="social" class="text-center"> <a href="https://github.com/kalbasit"><i class="fa fa-github fa-2x"></i></a> <a href="https://twitter.com/kalbasit"><i class="fa fa-twitter fa-2x"></i></a> <a href="https://www.linkedin.com/in/kalbasit"><i class="fa fa-linkedin fa-2x"></i></a> <a href="mailto:me@kalbas.it"><i class="fa fa-envelope-o fa-2x"></i></a> </div> <div id="links" class="text-center"> <a href="https://kalbas.it/about/">About</a> <a href="https://kalbas.it/post/">Blog</a> <a href="https://kalbas.it/tags/">Tags</a> </div> </div> </div> <div id="content" class="col-xs-12 col-sm-8 col-md-9 col-lg-10 col-xl-10"> <div class="row"> <div id="post" class="col-sm-offset-1 col-sm-10 col-md-10 col-lg-9 col-xl-9"> <article> <header> <h1>Coreos</a></h1> </header> <ul> <li><a href="https://kalbas.it/2016/08/21/setup-a-website-on-aws-with-coreos-and-docker/">Setup a website on AWS with CoreOS and Docker</a></li> </ul> </article> </div> </div> </div> </div> </div> </div> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-82839578-2', 'auto'); ga('send', 'pageview'); window.baseURL = "https:\/\/kalbas.it\/"; </script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js"></script> <script src="https://kalbas.it//js/App.js"></script> </body> </html>
{ "content_hash": "17c5008cf6d2f900467c3835e3585934", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 145, "avg_line_length": 30.65714285714286, "alnum_prop": 0.6169617893755824, "repo_name": "kalbasit/kalbas.it", "id": "e36777ebb9eeeb8db95d2051716be4ad4990130b", "size": "4292", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/tags/coreos/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5975" }, { "name": "HTML", "bytes": "1020572" }, { "name": "JavaScript", "bytes": "256" }, { "name": "Nix", "bytes": "12177" }, { "name": "Shell", "bytes": "1076" } ] }
li.collapsible_menu { position: relative; } li.collapsible_menu ul.submenu { margin: 0 auto !important; width: 93%; } li.collapsible_menu span.arrow { background-repeat: no-repeat; cursor: pointer; height: 7px; position: absolute; right: 10px; top: 13px; width: 11px; background-image: url("../../images/refinerycms-mailing/icons/up.gif"); } li.collapsible_menu.closed span.arrow { background-image: url("../../images/refinerycms-mailing/icons/down.gif"); } .field.newsletters ul { float: left; width: 99%; border: 1px solid #7F9DB9; list-style: none; margin: 0; padding: 0.4% 0.5%; } .field.newsletters li { float: left; margin-right: 12px; } .field.newsletters ul label { display: inline; } .email_icon { background: url("../../images/refinerycms-mailing/icons/email.png"); } .email_add_icon { background: url("../../images/refinerycms-mailing/icons/email_add.png"); } .email_go_icon { background: url("../../images/refinerycms-mailing/icons/email_go.png"); } .layers_icon { background: url("../../images/refinerycms-mailing/icons/layers.png"); } .layout_icon { background: url("../../images/refinerycms-mailing/icons/layout.png"); } .layout_add_icon { background: url("../../images/refinerycms-mailing/icons/layout_add.png"); } .newspaper_icon { background: url("../../images/refinerycms-mailing/icons/newspaper.png"); } .newspaper_add_icon { background: url("../../images/refinerycms-mailing/icons/newspaper_add.png"); } .newspaper_go_icon { background: url("../../images/refinerycms-mailing/icons/newspaper_go.png"); } .subscribers_icon { background: url("../../images/refinerycms-mailing/icons/group.png"); } #subscribers li.subscriber form { display: none;} #subscribers li form h3 { margin: 0; } #subscribers li form label { display: inline !important; margin-top: 5px; } #page_part_editors iframe { width: 99%; border: 1px solid #7F9DB9; line-height: 20px; padding: 0.4% 0.5%; } iframe#body_preview_frame, iframe#html_body_preview_frame { height: 400px; }
{ "content_hash": "b16eee65fc35d265c359bf3afb2ec6a2", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 100, "avg_line_length": 30.08955223880597, "alnum_prop": 0.6964285714285714, "repo_name": "beyama/refinerycms-mailings", "id": "e55355ef9b07d988d9f12d213cb755c87a98c5e2", "size": "2016", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/stylesheets/refinery/refinerycms-mailings.css", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "899" }, { "name": "Ruby", "bytes": "35753" } ] }
import Vue = require("vue"); import { ComponentOptions, PluginFunction } from "vue"; type Component = ComponentOptions<Vue> | typeof Vue; type Dictionary<T> = { [key: string]: T }; export type RouterMode = "hash" | "history" | "abstract"; export type RawLocation = string | Location; export type RedirectOption = RawLocation | ((to: Route) => RawLocation); export type NavigationGuard = ( to: Route, from: Route, next: (to?: RawLocation | false | ((vm: Vue) => any) | void) => void ) => any declare class VueRouter { constructor (options?: RouterOptions); app: Vue; mode: RouterMode; currentRoute: Route; beforeEach (guard: NavigationGuard): void; afterEach (hook: (to: Route, from: Route) => any): void; push (location: RawLocation): void; replace (location: RawLocation): void; go (n: number): void; back (): void; forward (): void; getMatchedComponentes (): Component; static install: PluginFunction<never>; } export interface RouterOptions { routes?: RouteConfig[]; mode?: RouterMode; base?: string; linkActiveClass?: string; scrollBehavior?: ( to: Route, from: Route, savedPosition: { x: number, y: number } | undefined ) => { x: number, y: number } | { selector: string } | void; } export interface RouteConfig { path: string; name?: string; component?: Component; components?: Dictionary<Component>; redirect?: RedirectOption; alias?: string | string[]; children?: RouteConfig[]; meta?: any; beforeEnter?: NavigationGuard; } export interface RouteRecord { path: string; components: Dictionary<Component>; instances: Dictionary<Vue>; name?: string; parent?: RouteRecord; redirect?: RedirectOption; matchAs?: string; meta: any; beforeEnter?: ( route: Route, redirect: (location: RawLocation) => void, next: () => void ) => any; } export interface Location { name?: string; path?: string; hash?: string; query?: Dictionary<string>; params?: Dictionary<string>; } export interface Route { path: string; name?: string; hash: string; query: Dictionary<string>; params: Dictionary<string>; fullPath: string; matched: RouteRecord[]; redirectedFrom?: string; meta?: any; }
{ "content_hash": "00093f6452b6b45a1cb75094e6fc3ca3", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 72, "avg_line_length": 23.827956989247312, "alnum_prop": 0.6705776173285198, "repo_name": "smajohusic/simple-app-with-vue", "id": "c73b7ace8ffd4ca02ce138c49f5b2991f9667aeb", "size": "2216", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "node_modules/vue-router/types/router.d.ts", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "553" }, { "name": "HTML", "bytes": "11064" }, { "name": "JavaScript", "bytes": "10214" }, { "name": "PHP", "bytes": "82359" } ] }
def longest_string(list_of_words) longest = list_of_words[0] list_of_words.each do |x| if longest.length < x.length longest = x end end return longest end
{ "content_hash": "33f111bde7c050afdc720f0ce7370f8f", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 33, "avg_line_length": 19.555555555555557, "alnum_prop": 0.6590909090909091, "repo_name": "aattsai/phase-0", "id": "a778394270378b3825cd7fbc60ce4d90d0e3a42c", "size": "563", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "week-4/longest-string/my_solution.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3468" }, { "name": "HTML", "bytes": "20291" }, { "name": "JavaScript", "bytes": "47633" }, { "name": "Ruby", "bytes": "107346" } ] }
package org.consumersunion.stories.survey.client.application.stories.ui; import org.consumersunion.stories.common.client.util.HtmlSanitizerUtil; import org.consumersunion.stories.common.shared.service.datatransferobject.StorySummary; import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.dom.client.BrowserEvents; import com.google.gwt.safehtml.client.SafeHtmlTemplates; import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.inject.Inject; public class StoryCell extends AbstractCell<StorySummary> { public interface Template extends SafeHtmlTemplates { @Template("<div class=\"cu-story-summary-view-main-container\">" + "<div class=\"cu-story-summary-view-title-label\">{0}</div>" + "<div class=\"cu-story-summary-view-summary-text-label\">{1}</div>" + "<div class=\"cu-story-summary-view-summary-submitter-label\">{2}</div>" + "</div>") SafeHtml storyTemplate(SafeHtml title, SafeHtml summary, SafeHtml submitter); } private final Template template; private final HtmlSanitizerUtil htmlSanitizerUtil; @Inject StoryCell( Template template, HtmlSanitizerUtil htmlSanitizerUtil) { super(BrowserEvents.CLICK); this.template = template; this.htmlSanitizerUtil = htmlSanitizerUtil; } public void render(Context context, StorySummary value, SafeHtmlBuilder sb) { SafeHtml safeTitle = SafeHtmlUtils.fromString(value.getTitle()); SafeHtml safeSummary = htmlSanitizerUtil.sanitize(value.getSummary()); SafeHtml safeSubmitter = SafeHtmlUtils.fromString(value.getAuthor()); sb.append(template.storyTemplate(safeTitle, safeSummary, safeSubmitter)); } }
{ "content_hash": "2d6952310eb5e7e7c4fa2d75e8c55c3e", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 102, "avg_line_length": 43.395348837209305, "alnum_prop": 0.7288317256162915, "repo_name": "stori-es/stori_es", "id": "88091df264f5b1cfbc45973abfbc2eb99a0c34b9", "size": "1866", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "dashboard/src/main/java/org/consumersunion/stories/survey/client/application/stories/ui/StoryCell.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "881308" }, { "name": "Gherkin", "bytes": "32367" }, { "name": "HTML", "bytes": "23540" }, { "name": "Java", "bytes": "4906774" }, { "name": "JavaScript", "bytes": "656583" }, { "name": "PLpgSQL", "bytes": "4417" }, { "name": "Python", "bytes": "65709" }, { "name": "SQLPL", "bytes": "83603" }, { "name": "Shell", "bytes": "110846" } ] }
<body> <header> <div class="headerpanel"> <div class="logopanel"> <h4><a href="<?php echo base_url();?>admin/home">MY TOFAH</a></h4> </div> <!-- logopanel --> <div class="headerbar"> <a id="menuToggle" class="menutoggle"><i class="fa fa-bars"></i></a> <div class="header-right"> <ul class="headermenu"> <li> <div class="btn-group"> <button type="button" class="btn btn-logged" data-toggle="dropdown"><img src="<?php echo base_url();?>ui/img/logo.png" alt="" />Welcome, Admin<span class="caret"></span> </button> <ul class="dropdown-menu pull-right"> <li><a href="javascript:void(0);"><i class="glyphicon glyphicon-user"></i> My Profile</a></li> <li><a href="javascript:void(0);"><i class="glyphicon glyphicon-cog"></i> Account Settings</a></li> <li><a href="<?php echo base_url();?>login/logout"><i class="glyphicon glyphicon-log-out"></i> Log Out</a></li> </ul> </div> </li> </ul> </div> <!-- header-right --> </div> <!-- headerbar --> </div> <!-- header--> </header> <section> <div class="leftpanel"> <div class="leftpanelinner"> <!-- ################## LEFT PANEL PROFILE ################## --> <div class="media leftpanel-profile"> <div class="media-left"> <a href="javascript:void(0);"> <img src="<?php echo base_url();?>ui/images/photos/loggeduser.png" alt="" class="media-object img-circle"> </a> </div> <div class="media-body"> <h4 class="media-heading">Admin</h4> <span>Dashboard</span> </div> </div> <!-- leftpanel-profile --> <ul class="nav nav-tabs nav-justified nav-sidebar"> <li class="tooltips active" data-toggle="tooltip" title="Main Menu"><a data-toggle="tab" data-target="#mainmenu"><i class="tooltips fa fa-ellipsis-h"></i></a></li> <li class="tooltips" data-toggle="tooltip" title="Log Out"><a href="<?php echo base_url();?>login/logout"><i class="fa fa-sign-out"></i></a></li> </ul> <div class="tab-content"> <!-- ################# MAIN MENU ################### --> <div class="tab-pane active" id="mainmenu"> <h5 class="sidebar-title">Favorites</h5> <ul class="nav nav-pills nav-stacked nav-quirk"> <li <?php if(isset($segment)){if($segment == 'home'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/home"><i class="fa fa-home"></i> <span>Dashboard</span></a></li> </ul> <h5 class="sidebar-title">Main Menu</h5> <ul class="nav nav-pills nav-stacked nav-quirk"> <li class="nav-parent <?php if(isset($segment)){if($segment == 'user_list'){?>active<?php }} ?>"><a href="javascript:void(0);"><i class="fa fa-th-list"></i> <span>User Management</span></a> <ul class="children"> <li <?php if(isset($segment)){if($segment == 'user_list'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/user_list">Users</a></li> </ul> </li> <li class="nav-parent <?php if(isset($basesegment)){if($basesegment == 'cms'){?>active<?php }} ?>"><a href="javascript:void(0);"><i class="fa fa-th-list"></i> <span>Content management</span></a> <ul class="children"> <li <?php if(isset($segment)){if($segment == 'aboutUs'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/cms/aboutUs">About us</a></li> <li <?php if(isset($segment)){if($segment == 'user_list'){?>class="active"<?php }} ?>><a href="javascript:void(0);">Pressroom / News Management</a></li> <li <?php if(isset($segment)){if($segment == 'contactUs'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/cms/contactUs">Contact us</a></li> </ul> </li> <li class="nav-parent <?php if(isset($basesegment)){if($basesegment == 'blog'){?>active<?php }} ?>"><a href="javascript:void(0);"><i class="fa fa-th-list"></i> <span>Blogs Managment</span></a> <ul class="children"> <li <?php if(isset($segment)){if($segment == 'index'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/blog/index">All Blogs</a></li> <li <?php if(isset($segment)){if($segment == 'add'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/blog/add">Add New</a></li> <li <?php if(isset($segment)){if($segment == 'category'){?>class="active"<?php }} ?>><a href="<?php echo base_url();?>admin/blog/category">Categories</a></li> </ul> </li> </ul> </div> <!-- tab-pane --> </div> <!-- tab-content --> </div> <!-- leftpanelinner --> </div> <!-- leftpanel -->
{ "content_hash": "2326bf8659a6fe5e52cc95f1ad2b9106", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 194, "avg_line_length": 52.45161290322581, "alnum_prop": 0.5297252972529726, "repo_name": "imonkteck/mytofah", "id": "81f7ac03b309c3abb6c4c6f552be1a1869c1c5bb", "size": "4878", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "application/views/admin/head/navigation.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "553" }, { "name": "CSS", "bytes": "925994" }, { "name": "HTML", "bytes": "37590" }, { "name": "JavaScript", "bytes": "3845262" }, { "name": "PHP", "bytes": "1914758" } ] }
set -e cd doc haxe build_doc.hxml || { cd ..; echo "build_doc failed"; exit 1; } cd .. rm thx.core.zip zip -r thx.core.zip src doc/ImportCore.hx test extraParams.hxml haxelib.json LICENSE README.md -x "*/\.*" haxelib submit thx.core.zip
{ "content_hash": "d19cc600598ea54c4a69097aa4634fa6", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 105, "avg_line_length": 33.857142857142854, "alnum_prop": 0.6962025316455697, "repo_name": "ciscoheat/thx.core", "id": "ba78fb5273b7bffe057567837856bf0cc0bb3bcf", "size": "247", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "submit.sh", "mode": "33261", "license": "mit", "language": [ { "name": "Haxe", "bytes": "231101" }, { "name": "Shell", "bytes": "247" } ] }
#pragma once #include <credentials/CertificateValidityPolicy.h> namespace chip { namespace Credentials { class StrictCertificateValidityPolicyExample : public CertificateValidityPolicy { public: ~StrictCertificateValidityPolicyExample() {} /** * @brief * * This certificate validity policy is strict in that it rejects all * certificates if any of wall clock time or last known good time show * them to be invalid. This policy also rejects certificates if time * is unknown. * * @param cert CHIP Certificate for which we are evaluating validity * @param depth the depth of the certificate in the chain, where the leaf is at depth 0 * @return CHIP_NO_ERROR if CHIPCert should accept the certificate; an appropriate CHIP_ERROR if it should be rejected */ CHIP_ERROR ApplyCertificateValidityPolicy(const ChipCertificateData * cert, uint8_t depth, CertificateValidityResult result) override { switch (result) { case CertificateValidityResult::kValid: case CertificateValidityResult::kNotExpiredAtLastKnownGoodTime: return CHIP_NO_ERROR; case CertificateValidityResult::kNotYetValid: return CHIP_ERROR_CERT_NOT_VALID_YET; case CertificateValidityResult::kExpiredAtLastKnownGoodTime: case CertificateValidityResult::kTimeUnknown: case CertificateValidityResult::kExpired: return CHIP_ERROR_CERT_EXPIRED; default: return CHIP_ERROR_INVALID_ARGUMENT; } } }; } // namespace Credentials } // namespace chip
{ "content_hash": "860a1036ee3022cc45c84ad0b3794648", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 122, "avg_line_length": 35.170212765957444, "alnum_prop": 0.6896551724137931, "repo_name": "project-chip/connectedhomeip", "id": "a8d63aba99e93e5c696a1290f168f5b3c6fc71f3", "size": "2293", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/credentials/examples/StrictCertificateValidityPolicyExample.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1759301" }, { "name": "C++", "bytes": "19104548" }, { "name": "CMake", "bytes": "140510" }, { "name": "Dockerfile", "bytes": "50353" }, { "name": "Emacs Lisp", "bytes": "1042" }, { "name": "Java", "bytes": "167719" }, { "name": "JavaScript", "bytes": "2106" }, { "name": "Jinja", "bytes": "22322" }, { "name": "Objective-C", "bytes": "930838" }, { "name": "Objective-C++", "bytes": "435348" }, { "name": "Python", "bytes": "1931007" }, { "name": "Shell", "bytes": "195843" }, { "name": "Tcl", "bytes": "311" }, { "name": "ZAP", "bytes": "584219" } ] }
package jetbrains.buildServer.nuget.tests.server.entity; import jetbrains.buildServer.BaseTestCase; import org.jdom.JDOMException; import org.jetbrains.annotations.NotNull; import org.odata4j.core.OAtomEntity; import java.io.IOException; import java.io.PrintWriter; import java.util.*; /** * Created by Eugene Petrenko (eugene.petrenko@gmail.com) * Date: 30.12.11 17:57 */ public class EntityGenerator extends BaseTestCase { public static void main(String[] args) throws IOException, JDOMException { new MetadataLoaderTest().test_feed_api_not_changed(); final String entity = "PackageEntityImpl"; final String ientityV2 = "PackageEntityV2"; final String ientityV3 = "PackageEntityV3"; final String ientityV4 = "PackageEntityV4"; final MetadataParseResult V2 = XmlFeedParsers.loadBeans_v3(); final MetadataParseResult V3 = XmlFeedParsers.loadBeans_v4(); final MetadataParseResult V4 = XmlFeedParsers.loadBeans_v5(); new EntityInterfaceGenerator(ientityV2, V2.getKey(), V2.getData()).generateSimpleBean(); new EntityInterfaceGenerator(ientityV3, V3.getKey(), V3.getData()).generateSimpleBean(); new EntityInterfaceGenerator(ientityV4, V4.getKey(), V4.getData()).generateSimpleBean(); final Set<MetadataBeanProperty> data = new LinkedHashSet<MetadataBeanProperty>(); data.addAll(V2.getData()); data.addAll(V3.getData()); data.addAll(V4.getData()); new EntityBeanGenerator(entity, Arrays.asList(ientityV2, ientityV3, ientityV4), data).generateSimpleBean(); } private static class EntityBeanGenerator extends BeanGenerator { private final Collection<String> myIentities; private final Set<String> myExplicit = new HashSet<String>(Arrays.asList( "NormalizedVersion", "Created", "LastEdited", "Published", "GalleryDetailsUrl", "Summary", "Title", "VersionDownloadCount", "DownloadCount" )); private EntityBeanGenerator(String entityName, List<String> ientity, Collection<MetadataBeanProperty> properties) { super(entityName, properties); myIentities = ientity; } @NotNull @Override protected Collection<String> getImplements() { final List<String> result = new ArrayList<String>(); result.addAll(myIentities); result.add(OAtomEntity.class.getSimpleName()); return result; } @Override protected void generateAfterContent(@NotNull PrintWriter wr) { super.generateAfterContent(wr); for (MetadataBeanProperty property : myProperties) { String path = property.getAtomPath(); if (path == null) continue; path = path.substring("Syndication".length()).replace("AuthorName", "Author"); wr.println(); wr.println(" public final " + property.getType().getCanonicalJavaType().getName() + " getAtomEntity" + path + "() {"); wr.println(" return get" + property.getName() + "();"); wr.println(" }"); wr.println(); } } @Override protected void generateProperty(@NotNull final PrintWriter w, @NotNull final MetadataBeanProperty p) { if (myExplicit.contains(p.getName())) return; super.generateProperty(w, p); } } private static class EntityInterfaceGenerator extends MethodsGenerator { private final Collection<MetadataBeanProperty> myKeys; private EntityInterfaceGenerator(String entityName, Collection<MetadataBeanProperty> keys, Collection<MetadataBeanProperty> properties) { super(entityName, properties); myKeys = keys; } @Override protected void generateAfterContent(@NotNull PrintWriter wr) { wr.println(); wr.println(" String[] KeyPropertyNames = new String[] {"); for (MetadataBeanProperty property : myKeys) { wr.println(" \"" + property.getName() + "\", "); } wr.println(" };"); wr.println(); wr.println(); } @Override protected String getTypeKind() { return "interface"; } @Override protected String getExtendsString() { return ""; } @NotNull @Override protected String generatePropertyModifier(@NotNull MetadataBeanProperty p) { return ""; } @Override protected void generatePropertyBody(@NotNull PrintWriter wr, @NotNull MetadataBeanProperty p) { wr.println(";"); } @Override protected void generateBeforeContent(@NotNull PrintWriter wr) { } } }
{ "content_hash": "4e5c16a93a396d3e8ef9eb61d2643de1", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 141, "avg_line_length": 33.57857142857143, "alnum_prop": 0.6522016592214422, "repo_name": "JetBrains/teamcity-nuget-support", "id": "2125c019007f28d39671d8a32fc2f467428dbd12", "size": "5315", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nuget-tests/src/jetbrains/buildServer/nuget/tests/server/entity/EntityGenerator.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "241591" }, { "name": "CSS", "bytes": "837" }, { "name": "Java", "bytes": "1740135" }, { "name": "JavaScript", "bytes": "6080" }, { "name": "Kotlin", "bytes": "303770" } ] }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "efb29f0661722673b0609169d7ec84ce", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "4cadcc99df2eccf0685b1acfd083639f9c1cf351", "size": "185", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Coleostephus/Coleostephus myconis/ Syn. Chrysanthemum hybridum/README.md", "mode": "33188", "license": "apache-2.0", "language": [] }
import {browser, element, by} from 'protractor'; export class PwaPage { public navigateTo() { return browser.get('/'); } public getParagraphText() { return element(by.css('app-root h1')).getText(); } }
{ "content_hash": "29fba63f031013ed35ea75c6a66e6cf0", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 56, "avg_line_length": 18.307692307692307, "alnum_prop": 0.5966386554621849, "repo_name": "Centroida/angular-pwa", "id": "fba742ec60c2338be4287d442bf17888ecc64c41", "size": "301", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "e2e/app.po.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3657" }, { "name": "HTML", "bytes": "6739" }, { "name": "JavaScript", "bytes": "2734" }, { "name": "TypeScript", "bytes": "27893" } ] }
package org.springframework.boot.autoconfigure.orm.jpa; import java.sql.SQLException; import java.util.Map; import javax.sql.DataSource; import org.hibernate.cfg.AvailableSettings; import org.junit.After; import org.junit.Test; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy; import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy; import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Configuration; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; /** * Tests for {@link JpaProperties}. * * @author Stephane Nicoll */ public class JpaPropertiesTests { private AnnotationConfigApplicationContext context; @After public void close() { HibernateVersion.setRunning(null); if (this.context != null) { this.context.close(); } } @Test public void hibernate4NoCustomNamingStrategy() throws Exception { JpaProperties properties = load(HibernateVersion.V4); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties).contains(entry("hibernate.ejb.naming_strategy", SpringNamingStrategy.class.getName())); assertThat(hibernateProperties).doesNotContainKeys( "hibernate.implicit_naming_strategy", "hibernate.physical_naming_strategy"); } @Test public void hibernate4CustomNamingStrategy() throws Exception { JpaProperties properties = load(HibernateVersion.V4, "spring.jpa.hibernate.naming.strategy:" + "org.hibernate.cfg.EJB3NamingStrategy"); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties).contains(entry("hibernate.ejb.naming_strategy", "org.hibernate.cfg.EJB3NamingStrategy")); assertThat(hibernateProperties).doesNotContainKeys( "hibernate.implicit_naming_strategy", "hibernate.physical_naming_strategy"); } @Test public void hibernate4CustomNamingStrategyViaJpaProperties() throws Exception { JpaProperties properties = load(HibernateVersion.V4, "spring.jpa.properties.hibernate.ejb.naming_strategy:" + "org.hibernate.cfg.EJB3NamingStrategy"); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); String actual = hibernateProperties.get("hibernate.ejb.naming_strategy"); // You can't override this one from spring.jpa.properties because it has an // opinionated default assertThat(actual).isNotEqualTo("org.hibernate.cfg.EJB3NamingStrategy"); } @Test public void hibernate5NoCustomNamingStrategy() throws Exception { JpaProperties properties = load(HibernateVersion.V5); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties).doesNotContainKeys( "hibernate.ejb.naming_strategy", "hibernate.implicit_naming_strategy"); assertThat(hibernateProperties).containsEntry( "hibernate.physical_naming_strategy", SpringPhysicalNamingStrategy.class.getName()); } @Test public void hibernate5CustomNamingStrategies() throws Exception { JpaProperties properties = load(HibernateVersion.V5, "spring.jpa.hibernate.naming.implicit-strategy:com.example.Implicit", "spring.jpa.hibernate.naming.physical-strategy:com.example.Physical"); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties).contains( entry("hibernate.implicit_naming_strategy", "com.example.Implicit"), entry("hibernate.physical_naming_strategy", "com.example.Physical")); assertThat(hibernateProperties) .doesNotContainKeys("hibernate.ejb.naming_strategy"); } @Test public void hibernate5CustomNamingStrategiesViaJpaProperties() throws Exception { JpaProperties properties = load(HibernateVersion.V5, "spring.jpa.properties.hibernate.implicit_naming_strategy:com.example.Implicit", "spring.jpa.properties.hibernate.physical_naming_strategy:com.example.Physical"); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); // You can override them as we don't provide any default assertThat(hibernateProperties).contains( entry("hibernate.implicit_naming_strategy", "com.example.Implicit"), entry("hibernate.physical_naming_strategy", "com.example.Physical")); assertThat(hibernateProperties) .doesNotContainKeys("hibernate.ejb.naming_strategy"); } @Test public void useNewIdGeneratorMappingsDefaultHibernate4() throws Exception { JpaProperties properties = load(HibernateVersion.V4); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties) .doesNotContainKey(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS); } @Test public void useNewIdGeneratorMappingsDefaultHibernate5() throws Exception { JpaProperties properties = load(HibernateVersion.V5); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties) .containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "false"); } @Test public void useNewIdGeneratorMappingsTrue() throws Exception { JpaProperties properties = load(HibernateVersion.V5, "spring.jpa.hibernate.use-new-id-generator-mappings:true"); Map<String, String> hibernateProperties = properties .getHibernateProperties(mockStandaloneDataSource()); assertThat(hibernateProperties) .containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true"); } @SuppressWarnings("unchecked") private DataSource mockStandaloneDataSource() throws SQLException { DataSource ds = mock(DataSource.class); given(ds.getConnection()).willThrow(SQLException.class); return ds; } private JpaProperties load(HibernateVersion hibernateVersion, String... environment) { HibernateVersion.setRunning(hibernateVersion); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); EnvironmentTestUtils.addEnvironment(ctx, environment); ctx.register(TestConfiguration.class); ctx.refresh(); this.context = ctx; return this.context.getBean(JpaProperties.class); } @Configuration @EnableConfigurationProperties(JpaProperties.class) static class TestConfiguration { } }
{ "content_hash": "4fa089bfb33946f8400db9a6a35ae300", "timestamp": "", "source": "github", "line_count": 174, "max_line_length": 87, "avg_line_length": 38.86206896551724, "alnum_prop": 0.7944395149364093, "repo_name": "izeye/spring-boot", "id": "aa7e44f5e152692eb3080248356d763d0c0ba035", "size": "7382", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/JpaPropertiesTests.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "6954" }, { "name": "CSS", "bytes": "5769" }, { "name": "FreeMarker", "bytes": "2116" }, { "name": "Groovy", "bytes": "44968" }, { "name": "HTML", "bytes": "69819" }, { "name": "Java", "bytes": "9172430" }, { "name": "JavaScript", "bytes": "37789" }, { "name": "Ruby", "bytes": "1305" }, { "name": "SQLPL", "bytes": "40170" }, { "name": "Shell", "bytes": "20385" }, { "name": "Smarty", "bytes": "3276" }, { "name": "XSLT", "bytes": "33894" } ] }
package com.example.kuan.yweather.db; import org.litepal.crud.DataSupport; /** * Created by kuan on 2017/7/18. */ public class Province extends DataSupport{ int id; String provinceName; int provinceCode; public int getId() { return id; } public String getProvinceName() { return provinceName; } public int getProvinceCode() { return provinceCode; } public void setId(int id) { this.id = id; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public void setProvinceCode(int provinceCode) { this.provinceCode = provinceCode; } }
{ "content_hash": "4eb3585af5c82b8c73544074e720f0d0", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 54, "avg_line_length": 18.513513513513512, "alnum_prop": 0.635036496350365, "repo_name": "mocheng119/Ywether", "id": "db270e42715b058e47edf67012edd58091910d23", "size": "685", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/example/kuan/yweather/db/Province.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "32063" } ] }
crm.set_tag_list_event = function(controller, asset, asset_id) { var extra_supertag_options = $H({ onAdd: function(tag, el){ // Check that the tag is not being added more than twice (case INSENSITIVE) var alreadyAdded = (fbtaglist.bits.values().findAll(function(s){return s.toLowerCase() == tag.toLowerCase() }).length > 1); if(alreadyAdded){ // turn off the onDispose hook for this call to .dispose() var onDisposeHook = fbtaglist.options.get('onDispose'); fbtaglist.options.set('onDispose', function(el){}); fbtaglist.dispose(el); fbtaglist.options.set('onDispose', onDisposeHook); } else { // load the supertag form fields if not already loaded. crm.load_supertag_fields(controller, tag, asset_id); }; }, onDispose: function(tag){ // remove the supertag form fields if they were loaded. tag = tag.toLowerCase(); var form_id = loadedSupertagForms.get(tag); if(form_id){ $(form_id).remove(); loadedSupertagForms.unset(tag); }; } }); fbtaglist.options.update(extra_supertag_options); }; //---------------------------------------------------------------------------- // AJAX loads the form fields for each super_tag crm.load_supertag_fields = function(controller, tags, asset_id) { new Ajax.Request('/' + controller + '/super_tags', { asynchronous : true, evalScripts:true, method:'get', parameters: { tags : tags, asset_id : asset_id, collapsed : "no" } }); }; //---------------------------------------------------------------------------- // Fires an 'onclick' event on all '.close' buttons in the DOM. // (closes any current edit forms) crm.close_all_forms = function() { $$('.close').each(function(el){el.onclick();}); }; // Initialize the hash to store which supertag forms have been loaded. // {'supertag' => 'div element id'} var loadedSupertagForms = new Hash();
{ "content_hash": "a82ef194c3d607371c9341a666b93c9d", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 131, "avg_line_length": 38.471698113207545, "alnum_prop": 0.5664541441883276, "repo_name": "crossroads/crm_super_tags", "id": "d420fdc713d69fef6a72b414745ea1a0a8464fd6", "size": "2204", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "public/javascripts/crm_supertags.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "9084" }, { "name": "Ruby", "bytes": "63122" } ] }
'use strict'; // Configuring the Discoverycentermenus module angular.module('discoverycentermenus').run(['Menus', '$translate', '$rootScope', function (Menus, $translate, $rootScope) { $rootScope.$on('$translateChangeSuccess', function () { $translate(['MENU_DISCOVERYCENTERMENU', 'MENU_DISCOVERYCENTERMENU_MANAGE', 'MENU_DISCOVERYCENTERMENU_EXPORT']).then(function (translations) { // Remove the menu item Menus.removeMenuItem('topbar', 'discoverycentermenus'); // Add the discoverycentermenus dropdown item Menus.addMenuItem('topbar', { title: translations.MENU_DISCOVERYCENTERMENU, state: 'discoverycentermenus', type: 'dropdown', roles: ['*'] }); // Add the dropdown manage item Menus.addSubMenuItem('topbar', 'discoverycentermenus', { title: translations.MENU_DISCOVERYCENTERMENU_MANAGE, state: 'discoverycentermenus.manage', roles: ['user'] }); // Add the dropdown export item Menus.addSubMenuItem('topbar', 'discoverycentermenus', { title: translations.MENU_DISCOVERYCENTERMENU_EXPORT, state: 'discoverycentermenus.export', roles: ['*'] }); }); }); } ]);
{ "content_hash": "dea2e41d551e0e7b19de7692ae27026d", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 147, "avg_line_length": 36.51428571428571, "alnum_prop": 0.6291079812206573, "repo_name": "couldhll/AMS", "id": "52f34c6061a391ad741b41da6b6875fb972e3aa1", "size": "1278", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "modules/discoverycentermenus/client/config/discoverycentermenus.client.config.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "2495" }, { "name": "HTML", "bytes": "63612" }, { "name": "JavaScript", "bytes": "618150" }, { "name": "Shell", "bytes": "685" } ] }
Chess.makeUI(); Chess.showBoard();
{ "content_hash": "140e13a21ce8879b24c24dd7d2088e8e", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 18, "avg_line_length": 17, "alnum_prop": 0.7352941176470589, "repo_name": "capnmidnight/seanmcbeth.com", "id": "65691a5f5b89f2f0f461c2285b5b9daedf5bf32e", "size": "34", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Personal Site/wwwroot/archive/html5/web-chess/startup.js", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "14318" }, { "name": "CSS", "bytes": "11774" }, { "name": "HTML", "bytes": "222314" }, { "name": "JavaScript", "bytes": "116366" }, { "name": "PHP", "bytes": "11632" }, { "name": "PowerShell", "bytes": "3162" }, { "name": "Rich Text Format", "bytes": "5457" }, { "name": "Shell", "bytes": "2758" }, { "name": "TypeScript", "bytes": "87061" } ] }
:host { display: block; position: relative; } polyfill-next-selector { content: ':host > *'; } ::content > * { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } polyfill-next-selector { content: ':host > *:not(.core-selected):not([animate])'; } ::content > *:not(.core-selected):not([animate]) { display: none !important; }
{ "content_hash": "60ae938d0ce38f189b507068fae35657", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 60, "avg_line_length": 14.615384615384615, "alnum_prop": 0.5684210526315789, "repo_name": "pwentrys/app_factory", "id": "fa8ffeb95b33c76ff0db11f88d217fdb2e0ed364", "size": "911", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "resources/static/bower_components/core-animated-pages/core-animated-pages.css", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "29795" }, { "name": "HTML", "bytes": "18857" }, { "name": "JavaScript", "bytes": "1204704" }, { "name": "Python", "bytes": "29355" } ] }
typedef const struct __CTTypesetter* CTTypesetterRef; CORETEXT_EXPORT const CFStringRef kCTTypesetterOptionDisableBidiProcessing; CORETEXT_EXPORT const CFStringRef kCTTypesetterOptionForcedEmbeddingLevel; CORETEXT_EXPORT CTTypesetterRef CTTypesetterCreateWithAttributedString(CFAttributedStringRef string); CORETEXT_EXPORT CTTypesetterRef CTTypesetterCreateWithAttributedStringAndOptions(CFAttributedStringRef string, CFDictionaryRef options) STUB_METHOD; CORETEXT_EXPORT CTLineRef CTTypesetterCreateLine(CTTypesetterRef typesetter, CFRange stringRange) STUB_METHOD; CORETEXT_EXPORT CTLineRef CTTypesetterCreateLineWithOffset(CTTypesetterRef typesetter, CFRange stringRange, double offset); CORETEXT_EXPORT CFIndex CTTypesetterSuggestLineBreak(CTTypesetterRef typesetter, CFIndex startIndex, double width) STUB_METHOD; CORETEXT_EXPORT CFIndex CTTypesetterSuggestLineBreakWithOffset(CTTypesetterRef typesetter, CFIndex startIndex, double width, double offset); CORETEXT_EXPORT CFIndex CTTypesetterSuggestClusterBreak(CTTypesetterRef typesetter, CFIndex startIndex, double width) STUB_METHOD; CORETEXT_EXPORT CFIndex CTTypesetterSuggestClusterBreakWithOffset(CTTypesetterRef typesetter, CFIndex startIndex, double width, double offset) STUB_METHOD; CORETEXT_EXPORT CFTypeID CTTypesetterGetTypeID() STUB_METHOD;
{ "content_hash": "f0339400ce8a7e41fca9c7dc928f5be1", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 140, "avg_line_length": 88.33333333333333, "alnum_prop": 0.7314465408805031, "repo_name": "yweijiang/WinObjC", "id": "0965292bd033644c3d4e989fe8909fd2ab2757a2", "size": "2568", "binary": false, "copies": "3", "ref": "refs/heads/develop", "path": "include/CoreText/CTTypesetter.h", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "2091" }, { "name": "C", "bytes": "6765120" }, { "name": "C#", "bytes": "132853" }, { "name": "C++", "bytes": "3486330" }, { "name": "Lex", "bytes": "4667" }, { "name": "M", "bytes": "77709" }, { "name": "Objective-C", "bytes": "8071565" }, { "name": "Objective-C++", "bytes": "9789562" }, { "name": "PowerShell", "bytes": "15625" }, { "name": "Python", "bytes": "7658" }, { "name": "Yacc", "bytes": "9740" } ] }
//------------------------------------------------------------------------------ // <auto-generated> // Этот код создан программой. // Исполняемая версия:4.0.30319.42000 // // Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае // повторной генерации кода. // </auto-generated> //------------------------------------------------------------------------------ namespace TranslatorApk.Resources.Files { using System; /// <summary> /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д. /// </summary> // Этот класс создан автоматически классом StronglyTypedResourceBuilder // с помощью такого средства, как ResGen или Visual Studio. // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen // с параметром /str или перестройте свой проект VS. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class FileResources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal FileResources() { } /// <summary> /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TranslatorApk.Resources.Files.FileResources", typeof(FileResources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Перезаписывает свойство CurrentUICulture текущего потока для всех /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } /// <summary> /// Ищет локализованную строку, похожую на ab-&gt;ge ///aa-&gt;et ///af-&gt;za ///ak-&gt;gh ///sq-&gt;al ///am-&gt;et ///ar-&gt;ae ///an-&gt;es ///hy-&gt;am ///as-&gt;in ///av-&gt;az ///ay-&gt;bo ///az-&gt;az ///bm-&gt;ml ///ba-&gt;ru ///eu-&gt;es ///be-&gt;by ///bn-&gt;bd ///bh-&gt;in ///bi-&gt;vu ///bs-&gt;ba ///br-&gt;fr ///bg-&gt;bg ///my-&gt;mm ///ca-&gt;es ///ch-&gt;gu ///ce-&gt;ru ///ny-&gt;mw ///zh-&gt;cn ///cv-&gt;ru ///kw-&gt;gb ///co-&gt;fr ///cr-&gt;ca ///hr-&gt;hr ///cs-&gt;cz ///da-&gt;dk ///dv-&gt;mv ///nl-&gt;nl ///dz-&gt;bt ///en-&gt;gb ///et-&gt;ee ///ee-&gt;gh ///fo-&gt;fo ///fj-&gt;fj ///fi-&gt;fi ///fr-&gt;fr ///ff-&gt;sn ///gl-&gt;es ///gd-&gt;gb ///gv-&gt;im ///ka-&gt;ge ///de-&gt;de ///el-&gt;gr ///kl-&gt;dk ///gn-&gt;py ///gu-&gt;in ///ht-&gt;ht ///ha-&gt;ng ///he-&gt;il ///hz-&gt;na ///hi-&gt;in ///ho-&gt;pg ///hu-&gt;hu ///is-&gt;is /// [остаток строки не уместился]&quot;;. /// </summary> internal static string language_iso_to_country_iso { get { return ResourceManager.GetString("language_iso_to_country_iso", resourceCulture); } } } }
{ "content_hash": "ab272b1bae89d6327d1dd625f0ad45b0", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 192, "avg_line_length": 33.6764705882353, "alnum_prop": 0.5220524017467248, "repo_name": "And42/TranslatorApk", "id": "707b5503ec223c5e8296b603d28cd0ca9a667678", "size": "5148", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "App/Resources/Files/FileResources.Designer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "432660" }, { "name": "PowerShell", "bytes": "3849" } ] }
#pragma once #include "numerics/davenport_q_method.hpp" #include <vector> #include "geometry/r3x3_matrix.hpp" #include "geometry/r3_element.hpp" #include "numerics/fixed_arrays.hpp" #include "numerics/matrix_computations.hpp" #include "quantities/quantities.hpp" namespace principia { namespace numerics { namespace internal_davenport_q_method { using geometry::KroneckerProduct; using geometry::Quaternion; using geometry::R3Element; using geometry::R3x3Matrix; using quantities::Infinity; template<typename FromFrame, typename ToFrame, typename Weight> Rotation<FromFrame, ToFrame> DavenportQMethod( std::vector<Vector<double, FromFrame>> const& a, std::vector<Vector<double, ToFrame>> const& b, std::vector<Weight> const& weights) { std::int64_t const size = a.size(); CHECK_EQ(size, b.size()); CHECK_EQ(size, weights.size()); // Compute the attitude profile matrix. R3x3Matrix<Weight> B; for (int i = 0; i < size; ++i) { auto const w_b_ᵗa = weights[i] * KroneckerProduct(b[i].coordinates(), a[i].coordinates()); B += w_b_ᵗa; } R3Element<Weight> const z{B(1, 2) - B(2, 1), B(2, 0) - B(0, 2), B(0, 1) - B(1, 0)}; auto const S = B + B.Transpose(); auto const μ = B.Trace(); // Form the K matrix. FixedMatrix<Weight, 4, 4> K; for (int i = 0; i < 3; ++i) { for (int j = 0; j < 3; ++j) { K(i, j) = S(i, j); if (i == j) { K(i, j) -= μ; } } } for (int i = 0; i < 3; ++i) { K(3, i) = z[i]; K(i, 3) = z[i]; } K(3, 3) = μ; // Compute its eigensystem. auto const eigensystem = ClassicalJacobi(K, /*max_iterations=*/20); auto const& eigenvalues = eigensystem.eigenvalues; auto const& rotation = eigensystem.rotation; // Find the most positive eigenvalue and the corresponding eigenvector; auto most_positive_eigenvalue = -Infinity<Weight>; Quaternion eigenvector; for (int i = 0; i < eigenvalues.size(); ++i) { if (eigenvalues[i] > most_positive_eigenvalue) { most_positive_eigenvalue = eigenvalues[i]; eigenvector = Quaternion( rotation(3, i), R3Element<double>(rotation(0, i), rotation(1, i), rotation(2, i))); } } // The conjugation is because [And17] uses active rotations, but our rotations // are passive. return Rotation<FromFrame, ToFrame>(eigenvector.Conjugate()); } } // namespace internal_davenport_q_method } // namespace numerics } // namespace principia
{ "content_hash": "7c94fe86e541b0886c1dadb31b5319ff", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 80, "avg_line_length": 29.593023255813954, "alnum_prop": 0.6204322200392928, "repo_name": "pleroy/Principia", "id": "5b35b1d498e283ba6cf319f14cf2a8b734cce414", "size": "2552", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "numerics/davenport_q_method_body.hpp", "mode": "33188", "license": "mit", "language": [ { "name": "Awk", "bytes": "3540" }, { "name": "C", "bytes": "783" }, { "name": "C#", "bytes": "420881" }, { "name": "C++", "bytes": "6934920" }, { "name": "Fortran", "bytes": "2234" }, { "name": "Makefile", "bytes": "18476" }, { "name": "Mathematica", "bytes": "383635" }, { "name": "PowerShell", "bytes": "11669" }, { "name": "Shell", "bytes": "6320" } ] }
<?php $loader->import("config.php"); if (file_exists(__DIR__ . '/security_local.php')) { $loader->import("security_local.php"); } else { $loader->import("security.php"); } //Twig Configuration $container->loadFromExtension('twig', array( 'cache' => false, 'debug' => '%kernel.debug%', 'strict_variables' => '%kernel.debug%' )); $container->loadFromExtension('framework', array( "router" => array( "resource" => "%kernel.root_dir%/config/routing_dev.php", "strict_requirements" => true ), "profiler" => array( "only_exceptions" => false ) )); $container->loadFromExtension("web_profiler", array( "toolbar" => true, "intercept_redirects" => false )); $container->loadFromExtension("monolog", array( 'channels' => array( 'mautic', ), "handlers" => array( "main" => array( "formatter" => "mautic.monolog.fulltrace.formatter", "type" => "rotating_file", "path" => "%kernel.logs_dir%/%kernel.environment%.php", "level" => "debug", "channels" => array( "!mautic" ), "max_files" => 7 ), "console" => array( "type" => "console", "bubble" => false ), "mautic" => array( "formatter" => "mautic.monolog.fulltrace.formatter", "type" => "rotating_file", "path" => "%kernel.logs_dir%/mautic_%kernel.environment%.php", "level" => "debug", 'channels' => array( 'mautic', ), "max_files" => 7 ) ) )); // Allow overriding config without a requiring a full bundle or hacks if (file_exists(__DIR__ . '/config_override.php')) { $loader->import("config_override.php"); } // Allow local settings without committing to git such as swift mailer delivery address overrides if (file_exists(__DIR__ . '/config_local.php')) { $loader->import("config_local.php"); }
{ "content_hash": "dcb3cdff084c9e6c7b28293570d8f78e", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 97, "avg_line_length": 29.291666666666668, "alnum_prop": 0.5120910384068279, "repo_name": "rcdelfin/mautic", "id": "6eb2b30037ab8d8cbd19cc83fa7df571df57e55a", "size": "2109", "binary": false, "copies": "5", "ref": "refs/heads/staging", "path": "app/config/config_dev.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3767" }, { "name": "CSS", "bytes": "1350177" }, { "name": "HTML", "bytes": "178411" }, { "name": "JavaScript", "bytes": "4614102" }, { "name": "PHP", "bytes": "8287715" } ] }
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__char_alloca_memmove_53d.c Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml Template File: sources-sink-53d.tmpl.c */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buffer * GoodSource: Set data pointer to the allocated memory buffer * Sink: memmove * BadSink : Copy string to data using memmove * Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files * * */ #include "std_testcase.h" #include <wchar.h> /* all the sinks are the same, we just want to know where the hit originated if a tool flags one */ #ifndef OMITBAD void CWE124_Buffer_Underwrite__char_alloca_memmove_53d_badSink(char * data) { { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memmove(data, source, 100*sizeof(char)); /* Ensure the destination buffer is null terminated */ data[100-1] = '\0'; printLine(data); } } #endif /* OMITBAD */ #ifndef OMITGOOD /* goodG2B uses the GoodSource with the BadSink */ void CWE124_Buffer_Underwrite__char_alloca_memmove_53d_goodG2BSink(char * data) { { char source[100]; memset(source, 'C', 100-1); /* fill with 'C's */ source[100-1] = '\0'; /* null terminate */ /* POTENTIAL FLAW: Possibly copying data to memory before the destination buffer */ memmove(data, source, 100*sizeof(char)); /* Ensure the destination buffer is null terminated */ data[100-1] = '\0'; printLine(data); } } #endif /* OMITGOOD */
{ "content_hash": "6c602e391e6bcc6415d0b7c5114a3938", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 156, "avg_line_length": 33.241379310344826, "alnum_prop": 0.6441908713692946, "repo_name": "maurer/tiamat", "id": "c180a38007c379896a83c74d4601554b912ece3b", "size": "1928", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "samples/Juliet/testcases/CWE124_Buffer_Underwrite/s01/CWE124_Buffer_Underwrite__char_alloca_memmove_53d.c", "mode": "33188", "license": "mit", "language": [] }
using System; using System.Collections.Generic; using NUnit.Framework; using Atspi; namespace AtSpiTest { [TestFixture] public class HypertextTest : Base { Accessible frame = null; Hypertext hypertext = null; public HypertextTest () { frame = GetFrame ("DocumentTest.exe", "DocumentTest"); hypertext = frame.QueryHypertext (); Assert.IsNotNull (hypertext, "frame.QueryHypertext"); } #region Test [Test] public void Hypertext () { Assert.AreEqual (2, hypertext.NLinks, "NLinks"); Assert.AreEqual (1, hypertext.GetLinkIndex (60), "GetLinkIndex"); } [Test] public void Hyperlink () { Assert.IsNull (hypertext.GetLink (-1), "GetLink (-1)"); Assert.IsNull (hypertext.GetLink (2), "GetLink (2)"); Hyperlink link = hypertext.GetLink (0); Assert.IsNotNull (link, "GetLink"); Assert.AreEqual ( 5, link.StartIndex, "StartIndex"); Assert.AreEqual (26, link.EndIndex, "EndIndex"); Assert.AreEqual ("http://www.novell.com", link.GetURI (0), "Uri"); Assert.AreEqual (string.Empty, link.GetURI (1), "Uri (1)"); Assert.AreEqual (string.Empty, link.GetURI (-1), "Uri (-1)"); Accessible obj = link.GetObject (-1); Assert.IsNull (obj, "GetObject (-1)"); obj = link.GetObject (2); Assert.IsNull (obj, "GetObject (2)"); obj = link.GetObject (0); Assert.IsNotNull (obj, "GetObject"); Action action = obj.QueryAction (); Assert.IsNotNull (action, "GetObject.QueryAction"); Assert.IsTrue (action.DoAction (0), "DoAction"); link = hypertext.GetLink (1); Assert.IsNotNull (link, "GetLink (1)"); Assert.AreEqual (55, link.StartIndex, "StartIndex"); Assert.AreEqual (76, link.EndIndex, "EndIndex"); Assert.AreEqual ("http://www.google.com", link.GetURI (0), "Uri"); Accessible obj2 = link.GetObject (0); Assert.IsNotNull (obj, "GetObject"); Assert.AreNotEqual (obj, obj2, "GetObject for second link should not be the same as for the first link"); } #endregion } }
{ "content_hash": "e046a0376301cd1ec174ae53fc2f62ae", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 108, "avg_line_length": 29.87878787878788, "alnum_prop": 0.6698782961460447, "repo_name": "mono/at-spi-sharp", "id": "f8b5f2fc424be61c426d5f820c0d61ed2ab76e8e", "size": "3187", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/at-spi-sharp/HypertextTest.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "212263" }, { "name": "Python", "bytes": "12814" }, { "name": "Shell", "bytes": "3069" } ] }
package com.artursworld.reactiontest.model.entity; import java.util.Date; // TODO: delete not used? public class Attempt { private long reactionTime; private boolean isValid; private Date creationDate; private Date reactionGameDateId; public long getReactionTime() { return reactionTime; } public void setReactionTime(long reactionTime) { this.reactionTime = reactionTime; } public boolean isValid() { return isValid; } public void setValid(boolean valid) { isValid = valid; } public Date getCreationDate() { return creationDate; } public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } public Date getReactionGameDateId() { return reactionGameDateId; } public void setReactionGameDateId(Date reactionGameDateId) { this.reactionGameDateId = reactionGameDateId; } @Override public String toString() { return Attempt.class.getSimpleName() +"[reactionGameDateId=" + this.getReactionGameDateId() + ", isValid="+this.isValid+", reactionTime=" + this.reactionTime + "]"; } }
{ "content_hash": "fbceba1a58797cff3d8662b6d4074030", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 172, "avg_line_length": 23.979591836734695, "alnum_prop": 0.6706382978723404, "repo_name": "lidox/reaction-test", "id": "03a8427cf19eb7558cb83f7d6e73fb9474b9e891", "size": "1175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ReactionTest/app/src/main/java/com/artursworld/reactiontest/model/entity/Attempt.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "664202" }, { "name": "R", "bytes": "25985" } ] }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_22) on Sun Aug 26 15:15:26 EDT 2012 --> <TITLE> OutlineEffect (Slick Util - LWJGL Utilities extracted from Slick) </TITLE> <META NAME="date" CONTENT="2012-08-26"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="OutlineEffect (Slick Util - LWJGL Utilities extracted from Slick)"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/OutlineEffect.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/newdawn/slick/font/effects/GradientEffect.html" title="class in org.newdawn.slick.font.effects"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/newdawn/slick/font/effects/OutlineWobbleEffect.html" title="class in org.newdawn.slick.font.effects"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/newdawn/slick/font/effects/OutlineEffect.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="OutlineEffect.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> org.newdawn.slick.font.effects</FONT> <BR> Class OutlineEffect</H2> <PRE> java.lang.Object <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>org.newdawn.slick.font.effects.OutlineEffect</B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect</A>, <A HREF="../../../../../org/newdawn/slick/font/effects/Effect.html" title="interface in org.newdawn.slick.font.effects">Effect</A></DD> </DL> <DL> <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineWobbleEffect.html" title="class in org.newdawn.slick.font.effects">OutlineWobbleEffect</A>, <A HREF="../../../../../org/newdawn/slick/font/effects/OutlineZigzagEffect.html" title="class in org.newdawn.slick.font.effects">OutlineZigzagEffect</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>OutlineEffect</B><DT>extends java.lang.Object<DT>implements <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect</A></DL> </PRE> <P> Strokes glyphs with an outline. <P> <P> <DL> <DT><B>Author:</B></DT> <DD>Nathan Sweet <misc@n4te.com></DD> </DL> <HR> <P> <!-- ======== NESTED CLASS SUMMARY ======== --> <A NAME="nested_class_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Nested Class Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="nested_classes_inherited_from_class_org.newdawn.slick.font.effects.ConfigurableEffect"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Nested classes/interfaces inherited from interface org.newdawn.slick.font.effects.<A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect</A></B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.Value.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect.Value</A></CODE></TD> </TR> </TABLE> &nbsp; <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#OutlineEffect()">OutlineEffect</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default constructor for injection</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#OutlineEffect(int, java.awt.Color)">OutlineEffect</A></B>(int&nbsp;width, java.awt.Color&nbsp;color)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create a new effect to draw the outline of the text</TD> </TR> </TABLE> &nbsp; <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)">draw</A></B>(java.awt.image.BufferedImage&nbsp;image, java.awt.Graphics2D&nbsp;g, <A HREF="../../../../../org/newdawn/slick/UnicodeFont.html" title="class in org.newdawn.slick">UnicodeFont</A>&nbsp;unicodeFont, <A HREF="../../../../../org/newdawn/slick/font/Glyph.html" title="class in org.newdawn.slick.font">Glyph</A>&nbsp;glyph)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called to draw the effect.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.awt.Color</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#getColor()">getColor</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the colour of the outline being drawn</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#getJoin()">getJoin</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the join type as indicated by @see BasicStroke</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.awt.Stroke</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#getStroke()">getStroke</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the stroke being used to draw the outline</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.util.List</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#getValues()">getValues</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the list of <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.Value.html" title="interface in org.newdawn.slick.font.effects"><CODE>ConfigurableEffect.Value</CODE></A>s for this effect.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;float</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#getWidth()">getWidth</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Get the width of the outline being drawn</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#setColor(java.awt.Color)">setColor</A></B>(java.awt.Color&nbsp;color)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the colour of the outline being drawn</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#setJoin(int)">setJoin</A></B>(int&nbsp;join)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets how the corners of the outline are drawn.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#setStroke(java.awt.Stroke)">setStroke</A></B>(java.awt.Stroke&nbsp;stroke)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the stroke to use for the outline.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#setValues(java.util.List)">setValues</A></B>(java.util.List&nbsp;values)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the list of <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.Value.html" title="interface in org.newdawn.slick.font.effects"><CODE>ConfigurableEffect.Value</CODE></A>s for this effect.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#setWidth(int)">setWidth</A></B>(int&nbsp;width)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the width of the outline.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>&nbsp;java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../../../org/newdawn/slick/font/effects/OutlineEffect.html#toString()">toString</A></B>()</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="OutlineEffect()"><!-- --></A><H3> OutlineEffect</H3> <PRE> public <B>OutlineEffect</B>()</PRE> <DL> <DD>Default constructor for injection <P> </DL> <HR> <A NAME="OutlineEffect(int, java.awt.Color)"><!-- --></A><H3> OutlineEffect</H3> <PRE> public <B>OutlineEffect</B>(int&nbsp;width, java.awt.Color&nbsp;color)</PRE> <DL> <DD>Create a new effect to draw the outline of the text <P> <DL> <DT><B>Parameters:</B><DD><CODE>width</CODE> - The width of the outline<DD><CODE>color</CODE> - The colour of the outline</DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)"><!-- --></A><H3> draw</H3> <PRE> public void <B>draw</B>(java.awt.image.BufferedImage&nbsp;image, java.awt.Graphics2D&nbsp;g, <A HREF="../../../../../org/newdawn/slick/UnicodeFont.html" title="class in org.newdawn.slick">UnicodeFont</A>&nbsp;unicodeFont, <A HREF="../../../../../org/newdawn/slick/font/Glyph.html" title="class in org.newdawn.slick.font">Glyph</A>&nbsp;glyph)</PRE> <DL> <DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/Effect.html#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)">Effect</A></CODE></B></DD> <DD>Called to draw the effect. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/font/effects/Effect.html#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)">draw</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/Effect.html" title="interface in org.newdawn.slick.font.effects">Effect</A></CODE></DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>image</CODE> - The image to draw into<DD><CODE>g</CODE> - The graphics context to use for applying the effect<DD><CODE>unicodeFont</CODE> - The font being rendered<DD><CODE>glyph</CODE> - The particular glyph being rendered<DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/font/effects/Effect.html#draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)"><CODE>Effect.draw(java.awt.image.BufferedImage, java.awt.Graphics2D, org.newdawn.slick.UnicodeFont, org.newdawn.slick.font.Glyph)</CODE></A></DL> </DD> </DL> <HR> <A NAME="getWidth()"><!-- --></A><H3> getWidth</H3> <PRE> public float <B>getWidth</B>()</PRE> <DL> <DD>Get the width of the outline being drawn <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The width of the outline being drawn</DL> </DD> </DL> <HR> <A NAME="setWidth(int)"><!-- --></A><H3> setWidth</H3> <PRE> public void <B>setWidth</B>(int&nbsp;width)</PRE> <DL> <DD>Sets the width of the outline. The glyphs will need padding so the outline doesn't get clipped. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>width</CODE> - The width of the outline being drawn</DL> </DD> </DL> <HR> <A NAME="getColor()"><!-- --></A><H3> getColor</H3> <PRE> public java.awt.Color <B>getColor</B>()</PRE> <DL> <DD>Get the colour of the outline being drawn <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The colour of the outline being drawn</DL> </DD> </DL> <HR> <A NAME="setColor(java.awt.Color)"><!-- --></A><H3> setColor</H3> <PRE> public void <B>setColor</B>(java.awt.Color&nbsp;color)</PRE> <DL> <DD>Set the colour of the outline being drawn <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>color</CODE> - The colour of the outline to draw</DL> </DD> </DL> <HR> <A NAME="getJoin()"><!-- --></A><H3> getJoin</H3> <PRE> public int <B>getJoin</B>()</PRE> <DL> <DD>Get the join type as indicated by @see BasicStroke <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The join type between segments in the outline</DL> </DD> </DL> <HR> <A NAME="getStroke()"><!-- --></A><H3> getStroke</H3> <PRE> public java.awt.Stroke <B>getStroke</B>()</PRE> <DL> <DD>Get the stroke being used to draw the outline <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Returns:</B><DD>The stroke being used to draw the outline</DL> </DD> </DL> <HR> <A NAME="setStroke(java.awt.Stroke)"><!-- --></A><H3> setStroke</H3> <PRE> public void <B>setStroke</B>(java.awt.Stroke&nbsp;stroke)</PRE> <DL> <DD>Sets the stroke to use for the outline. If this is set, the other outline settings are ignored. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>stroke</CODE> - The stroke to be used to draw the outline</DL> </DD> </DL> <HR> <A NAME="setJoin(int)"><!-- --></A><H3> setJoin</H3> <PRE> public void <B>setJoin</B>(int&nbsp;join)</PRE> <DL> <DD>Sets how the corners of the outline are drawn. This is usually only noticeable at large outline widths. <P> <DD><DL> </DL> </DD> <DD><DL> <DT><B>Parameters:</B><DD><CODE>join</CODE> - One of: <CODE>BasicStroke.JOIN_BEVEL</CODE>, <CODE>BasicStroke.JOIN_MITER</CODE>, <CODE>BasicStroke.JOIN_ROUND</CODE></DL> </DD> </DL> <HR> <A NAME="toString()"><!-- --></A><H3> toString</H3> <PRE> public java.lang.String <B>toString</B>()</PRE> <DL> <DD><DL> <DT><B>Overrides:</B><DD><CODE>toString</CODE> in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> <DT><B>See Also:</B><DD><CODE>Object.toString()</CODE></DL> </DD> </DL> <HR> <A NAME="getValues()"><!-- --></A><H3> getValues</H3> <PRE> public java.util.List <B>getValues</B>()</PRE> <DL> <DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#getValues()">ConfigurableEffect</A></CODE></B></DD> <DD>Returns the list of <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.Value.html" title="interface in org.newdawn.slick.font.effects"><CODE>ConfigurableEffect.Value</CODE></A>s for this effect. This list is not typically backed by the effect, so changes to the values will not take affect until <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#setValues(java.util.List)"><CODE>ConfigurableEffect.setValues(List)</CODE></A> is called. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#getValues()">getValues</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect</A></CODE></DL> </DD> <DD><DL> <DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#getValues()"><CODE>ConfigurableEffect.getValues()</CODE></A></DL> </DD> </DL> <HR> <A NAME="setValues(java.util.List)"><!-- --></A><H3> setValues</H3> <PRE> public void <B>setValues</B>(java.util.List&nbsp;values)</PRE> <DL> <DD><B>Description copied from interface: <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#setValues(java.util.List)">ConfigurableEffect</A></CODE></B></DD> <DD>Sets the list of <A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.Value.html" title="interface in org.newdawn.slick.font.effects"><CODE>ConfigurableEffect.Value</CODE></A>s for this effect. <P> <DD><DL> <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#setValues(java.util.List)">setValues</A></CODE> in interface <CODE><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html" title="interface in org.newdawn.slick.font.effects">ConfigurableEffect</A></CODE></DL> </DD> <DD><DL> <DT><B>See Also:</B><DD><A HREF="../../../../../org/newdawn/slick/font/effects/ConfigurableEffect.html#setValues(java.util.List)"><CODE>ConfigurableEffect.setValues(java.util.List)</CODE></A></DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/OutlineEffect.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../../org/newdawn/slick/font/effects/GradientEffect.html" title="class in org.newdawn.slick.font.effects"><B>PREV CLASS</B></A>&nbsp; &nbsp;<A HREF="../../../../../org/newdawn/slick/font/effects/OutlineWobbleEffect.html" title="class in org.newdawn.slick.font.effects"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html?org/newdawn/slick/font/effects/OutlineEffect.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="OutlineEffect.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> <i>Copyright &#169; 2006 New Dawn Software. All Rights Reserved.</i> </BODY> </HTML>
{ "content_hash": "c2fd48dd25912d078d9a0ee7a037b467", "timestamp": "", "source": "github", "line_count": 591, "max_line_length": 609, "avg_line_length": 43.88324873096447, "alnum_prop": 0.6340466550992867, "repo_name": "dxiao/PPBunnies", "id": "d35ff76dca689edb2aba8d341be89bb46183ae8f", "size": "25935", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "slick/trunk/Slick/javadoc-util/org/newdawn/slick/font/effects/OutlineEffect.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1420" }, { "name": "GLSL", "bytes": "2454" }, { "name": "HTML", "bytes": "15369548" }, { "name": "Java", "bytes": "2574972" }, { "name": "Shell", "bytes": "2301" } ] }
<div class="tile-picker"> <img src="{{url}}" class=""/> <div class="selection"></div> </div>
{ "content_hash": "f8729bf9b855d95d79740017b1f91b4a", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 33, "avg_line_length": 25.25, "alnum_prop": 0.5445544554455446, "repo_name": "justindujardin/pow-edit", "id": "0b965f820c15a291d681ae927033290747149323", "size": "101", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "source/editor/directives/tileSetTilePicker.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "40092" }, { "name": "JavaScript", "bytes": "8774" }, { "name": "TypeScript", "bytes": "193177" } ] }
require "drb" require "fileutils" require "tempfile" require "pathname" require "rubybench/dsl/channel" module Rubybench module CLI class Runner attr_reader :opts, :server, :socket_path, :pid, :ruby def self.load_path @load_path ||= Pathname.new(__FILE__).parent.dirname end def initialize(ruby, opts) @ruby = ruby @opts = opts @socket_path = make_tmp_file @pid = nil end def start! file execute! file timeout = Time.now + 3 end def invoke(task) end def stop! timeout = Time.now + 2 if alive? shutdown! end while timeout > Time.now if alive? sleep 0.1 else return true end end # Seems like worker is still running kill! if alive? end def running? return !!Process.kill(0, self.pid) rescue Errno::ESRCH return false end def kill! if running? Process.kill("INT", self.pid) wait(self.pid) end end private def execute! file settings = { #out: :close } command = "#{executable} #{arguments(file).join}" @pid = spawn(command) Process.detach pid end def make_tmp_file file = Tempfile.new('drb_socket') path = file.path file.close file.unlink return path end # TODO: Not even close to real executable discovery method def executable if opts.rvm? "rvm-exec" else ruby.to_s end end def arguments(file) args = [load_path.join, load_helpers.join, require_bootstrap.join, file, socket_path].map(&:to_s) if opts.rvm? args = ["#{ruby} ruby #{args.join(' ')}"] end args end def load_path ["-I", self.class.load_path] end def load_helpers ["-I", self.class.load_path.join("../helpers")] end def require_bootstrap ["-r", "rubybench/dsl/bootstrap"] end def server_uri "drbunix://#{socket_path}" end def disconnected!(reason) puts "Error: Unable to connect to worker process" puts "\tReason: #{reason}" puts "\tPath: #{server_uri}" puts "\tPid: #{pid}" puts "\tRunning: #{alive?}" puts exit 1 end end end end
{ "content_hash": "c4bb629972c5a315f68cbfb5969cd280", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 105, "avg_line_length": 18.669117647058822, "alnum_prop": 0.5084679007483262, "repo_name": "rubybench/rubybench-dsl", "id": "257a1da579126ddcdbe262c51d84d6c605bb3c38", "size": "2557", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/rubybench/cli/runner.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "32696" } ] }
from sovrin_client.cli.constants import \ CLIENT_GRAMS_CLIENT_WITH_DID_FORMATTED_REG_EX, \ CLIENT_GRAMS_CLIENT_ADD_FORMATTED_REG_EX, SEND_NYM_FORMATTED_REG_EX, \ GET_NYM_FORMATTED_REG_EX, \ GET_ATTR_FORMATTED_REG_EX, GET_SCHEMA_FORMATTED_REG_EX, \ GET_CLAIM_DEF_FORMATTED_REG_EX, \ ADD_ATTRIB_FORMATTED_REG_EX, SEND_SCHEMA_FORMATTED_REG_EX, \ ADD_GENESIS_FORMATTED_REG_EX, \ INIT_ATTR_REPO_FORMATTED_REG_EX, ADD_ATTRS_FORMATTED_REG_EX, \ ADD_ATTRS_PROVER_FORMATTED_REG_EX, CONNECT_FORMATTED_REG_EX, \ SHOW_FILE_FORMATTED_REG_EX, LOAD_FILE_FORMATTED_REG_EX, \ SHOW_LINK_FORMATTED_REG_EX, SYNC_LINK_FORMATTED_REG_EX, \ ACCEPT_LINK_FORMATTED_REG_EX, SHOW_CLAIM_FORMATTED_REG_EX, \ LIST_CLAIMS_FORMATTED_REG_EX, REQUEST_CLAIM_FORMATTED_REG_EX, \ SET_ATTRIBUTE_FORMATTED_REG_EX, SHOW_PROOF_REQ_FORMATTED_REG_EX, \ SEND_CLAIM_DEF_FORMATTED_REG_EX, SEND_PROOF_FORMATTED_REG_EX, \ PING_TARGET_FORMATTED_REG_EX, SEND_NODE_FORMATTED_REG_EX, \ SEND_POOL_UPG_FORMATTED_REG_EX, DISCONNECT_FORMATTED_REG_EX, \ NEW_ID_FORMATTED_REG_EX, SEND_PROOF_REQ_FORMATTED_REG_EX, \ REQ_AVAIL_CLAIMS_FORMATTED_REG_EX, LIST_LINKS_FORMATTED_REG_EX, SEND_POOL_CONFIG_FORMATTED_REG_EX, \ CHANGE_CURENT_KEY_FORMATTED_REG_EX # SHOW_CLAIM_REQ_FORMATTED_REG_EX def getNewClientGrams(): # TODO: Why do we have to manually pipe each regex except the last # one? Fix this return [ ADD_GENESIS_FORMATTED_REG_EX, # Regex for `new client steward with DID <nym>` CLIENT_GRAMS_CLIENT_WITH_DID_FORMATTED_REG_EX, # Regex for `client steward add TRUST ANCHOR bob` or `client steward # add user bob` CLIENT_GRAMS_CLIENT_ADD_FORMATTED_REG_EX, SEND_NYM_FORMATTED_REG_EX, GET_NYM_FORMATTED_REG_EX, ADD_ATTRIB_FORMATTED_REG_EX, GET_ATTR_FORMATTED_REG_EX, SEND_SCHEMA_FORMATTED_REG_EX, GET_SCHEMA_FORMATTED_REG_EX, SEND_CLAIM_DEF_FORMATTED_REG_EX, GET_CLAIM_DEF_FORMATTED_REG_EX, INIT_ATTR_REPO_FORMATTED_REG_EX, ADD_ATTRS_FORMATTED_REG_EX, SHOW_LINK_FORMATTED_REG_EX, SHOW_FILE_FORMATTED_REG_EX, LOAD_FILE_FORMATTED_REG_EX, ADD_ATTRS_PROVER_FORMATTED_REG_EX, CONNECT_FORMATTED_REG_EX, DISCONNECT_FORMATTED_REG_EX, SYNC_LINK_FORMATTED_REG_EX, ACCEPT_LINK_FORMATTED_REG_EX, # SHOW_CLAIM_REQ_FORMATTED_REG_EX, SHOW_PROOF_REQ_FORMATTED_REG_EX, SHOW_CLAIM_FORMATTED_REG_EX, LIST_CLAIMS_FORMATTED_REG_EX, LIST_LINKS_FORMATTED_REG_EX, REQUEST_CLAIM_FORMATTED_REG_EX, SET_ATTRIBUTE_FORMATTED_REG_EX, PING_TARGET_FORMATTED_REG_EX, SEND_PROOF_FORMATTED_REG_EX, SEND_NODE_FORMATTED_REG_EX, SEND_POOL_UPG_FORMATTED_REG_EX, SEND_POOL_CONFIG_FORMATTED_REG_EX, REQ_AVAIL_CLAIMS_FORMATTED_REG_EX, NEW_ID_FORMATTED_REG_EX, SEND_PROOF_REQ_FORMATTED_REG_EX, REQ_AVAIL_CLAIMS_FORMATTED_REG_EX, CHANGE_CURENT_KEY_FORMATTED_REG_EX ] NEXT_COMMANDS_TO_TRY_TEXT = "Try Next:" USAGE_TEXT = "Usage:"
{ "content_hash": "ff6bf6cf6cf0a92ea5c63e4061029a16", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 104, "avg_line_length": 42.567567567567565, "alnum_prop": 0.6692063492063492, "repo_name": "keenondrums/sovrin-node", "id": "e315374c609cda5475a39a464f3213e8de489bc1", "size": "3150", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "sovrin_client/cli/helper.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "3195" }, { "name": "Python", "bytes": "1088655" }, { "name": "Rust", "bytes": "25532" }, { "name": "Shell", "bytes": "15720" } ] }
// Copyright (c) 1994 James Clark // See the file COPYING for copying permission. #ifndef IListBase_INCLUDED #define IListBase_INCLUDED 1 #include "Link.h" #include "Boolean.h" #ifdef SP_NAMESPACE namespace SP_NAMESPACE { #endif class SP_API IListBase { public: IListBase(); IListBase(Link *); void append(Link *); void insert(Link *); Link *head() const; Boolean empty() const; Link *get(); void remove(Link *); void swap(IListBase &); void clear(); private: Link *head_; friend class IListIterBase; }; inline IListBase::IListBase() : head_(0) { } inline IListBase::IListBase(Link *head) : head_(head) { } inline void IListBase::insert(Link *p) { p->next_ = head_; head_ = p; } inline Link *IListBase::head() const { return head_; } inline Boolean IListBase::empty() const { return head_ == 0; } inline Link *IListBase::get() { Link *tem = head_; head_ = head_->next_; return tem; } inline void IListBase::swap(IListBase &list) { Link *tem = head_; head_ = list.head_; list.head_ = tem; } #ifdef SP_NAMESPACE } #endif #endif /* not IListBase_INCLUDED */
{ "content_hash": "fbb8a5ff0d55bf6bdad5ddb525d13212", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 47, "avg_line_length": 13.8875, "alnum_prop": 0.6579657965796579, "repo_name": "Distrotech/OpenSP", "id": "5e4abc2001d1c2c60b05769474719bb1cabc60aa", "size": "1111", "binary": false, "copies": "9", "ref": "refs/heads/master", "path": "include/IListBase.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "832564" }, { "name": "C++", "bytes": "1753393" }, { "name": "Clean", "bytes": "27080" }, { "name": "Perl", "bytes": "14033" }, { "name": "Shell", "bytes": "270694" } ] }
<?php /** * Install theme administration panel. * * @package WordPress * @subpackage Administration */ /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); require( ABSPATH . 'wp-admin/includes/theme-install.php' ); wp_reset_vars( array( 'tab' ) ); if ( ! current_user_can('install_themes') ) wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) ); if ( is_multisite() && ! is_network_admin() ) { wp_redirect( network_admin_url( 'theme-install.php' ) ); exit(); } $title = __( 'Add Themes' ); $parent_file = 'themes.php'; if ( ! is_network_admin() ) { $submenu_file = 'themes.php'; } $installed_themes = search_theme_directories(); foreach ( $installed_themes as $k => $v ) { if ( false !== strpos( $k, '/' ) ) { unset( $installed_themes[ $k ] ); } } wp_localize_script( 'theme', '_wpThemeSettings', array( 'themes' => false, 'settings' => array( 'isInstall' => true, 'canInstall' => current_user_can( 'install_themes' ), 'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null, 'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ) ), 'l10n' => array( 'addNew' => __( 'Add New Theme' ), 'search' => __( 'Search Themes' ), 'searchPlaceholder' => __( 'Search themes...' ), // placeholder (no ellipsis) 'upload' => __( 'Upload Theme' ), 'back' => __( 'Back' ), 'error' => __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), 'themesFound' => __( 'Number of Themes found: %d' ), 'noThemesFound' => __( 'No themes found. Try a different search.' ), 'collapseSidebar' => __( 'Collapse Sidebar' ), 'expandSidebar' => __( 'Expand Sidebar' ), ), 'installedThemes' => array_keys( $installed_themes ), ) ); wp_enqueue_script( 'theme' ); if ( $tab ) { /** * Fires before each of the tabs are rendered on the Install Themes page. * * The dynamic portion of the hook name, `$tab`, refers to the current * theme install tab. Possible values are 'dashboard', 'search', 'upload', * 'featured', 'new', or 'updated'. * * @since 2.8.0 */ do_action( "install_themes_pre_{$tab}" ); } $help_overview = '<p>' . sprintf(__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s" target="_blank">WordPress.org Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'), 'https://wordpress.org/themes/') . '</p>' . '<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' . '<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' . '<p>' . __('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your <code>/wp-content/themes</code> directory.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'overview', 'title' => __('Overview'), 'content' => $help_overview ) ); $help_installing = '<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' . '<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>'; get_current_screen()->add_help_tab( array( 'id' => 'installing', 'title' => __('Previewing and Installing'), 'content' => $help_installing ) ); get_current_screen()->set_help_sidebar( '<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes" target="_blank">Documentation on Adding New Themes</a>') . '</p>' . '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' ); include(ABSPATH . 'wp-admin/admin-header.php'); ?> <div class="wrap"> <h1><?php echo esc_html( $title ); /** * Filter the tabs shown on the Add Themes screen. * * This filter is for backwards compatibility only, for the suppression * of the upload tab. * * @since 2.8.0 * * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'. */ $tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) ); if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) { echo ' <a href="#" class="upload page-title-action">' . __( 'Upload Theme' ) . '</a>'; echo ' <a href="#" class="browse-themes page-title-action">' . _x( 'Browse', 'themes' ) . '</a>'; } ?></h1> <div class="upload-theme"> <?php install_themes_upload(); ?> </div> <h2 class="screen-reader-text"><?php _e( 'Filter themes list' ); ?></h2> <div class="wp-filter"> <div class="filter-count"> <span class="count theme-count"></span> </div> <ul class="filter-links"> <li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li> <li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li> <li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li> <li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li> </ul> <a class="drawer-toggle" href="#"><?php _e( 'Feature Filter' ); ?></a> <div class="search-form"></div> <div class="favorites-form"> <?php $user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' ); update_user_meta( get_current_user_id(), 'wporg_favorites', $user ); ?> <p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p> <p> <label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label> <input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" /> <input type="button" class="button button-secondary favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" /> </p> </div> <div class="filter-drawer"> <div class="buttons"> <a class="apply-filters button button-secondary" href="#"><?php _e( 'Apply Filters' ); ?><span></span></a> <a class="clear-filters button button-secondary" href="#"><?php _e( 'Clear' ); ?></a> </div> <?php $feature_list = get_theme_feature_list(); foreach ( $feature_list as $feature_name => $features ) { echo '<fieldset class="filter-group">'; $feature_name = esc_html( $feature_name ); echo '<legend>' . $feature_name . '</legend>'; echo '<div class="filter-group-feature">'; foreach ( $features as $feature => $feature_name ) { $feature = esc_attr( $feature ); echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> '; echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label><br>'; } echo '</div>'; echo '</fieldset>'; } ?> <div class="filtered-by"> <span><?php _e( 'Filtering by:' ); ?></span> <div class="tags"></div> <a href="#"><?php _e( 'Edit' ); ?></a> </div> </div> </div> <h2 class="screen-reader-text"><?php _e( 'Themes list' ); ?></h2> <div class="theme-browser content-filterable"></div> <div class="theme-install-overlay wp-full-overlay expanded"></div> <p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p> <span class="spinner"></span> <?php if ( $tab ) { /** * Fires at the top of each of the tabs on the Install Themes page. * * The dynamic portion of the hook name, `$tab`, refers to the current * theme install tab. Possible values are 'dashboard', 'search', 'upload', * 'featured', 'new', or 'updated'. * * @since 2.8.0 * * @param int $paged Number of the current page of results being viewed. */ do_action( "install_themes_{$tab}", $paged ); } ?> </div> <script id="tmpl-theme" type="text/template"> <# if ( data.screenshot_url ) { #> <div class="theme-screenshot"> <img src="{{ data.screenshot_url }}" alt="" /> </div> <# } else { #> <div class="theme-screenshot blank"></div> <# } #> <span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span> <div class="theme-author"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></div> <h3 class="theme-name">{{ data.name }}</h3> <div class="theme-actions"> <a class="button button-primary" href="{{ data.install_url }}"><?php esc_html_e( 'Install' ); ?></a> <a class="button button-secondary preview install-theme-preview" href="#"><?php esc_html_e( 'Preview' ); ?></a> </div> <# if ( data.installed ) { #> <div class="theme-installed"><?php _ex( 'Already Installed', 'theme' ); ?></div> <# } #> </script> <script id="tmpl-theme-preview" type="text/template"> <div class="wp-full-overlay-sidebar"> <div class="wp-full-overlay-header"> <a href="#" class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></a> <a href="#" class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></a> <a href="#" class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></a> <# if ( data.installed ) { #> <a href="#" class="button button-primary theme-install disabled"><?php _ex( 'Installed', 'theme' ); ?></a> <# } else { #> <a href="{{ data.install_url }}" class="button button-primary theme-install"><?php _e( 'Install' ); ?></a> <# } #> </div> <div class="wp-full-overlay-sidebar-content"> <div class="install-theme-info"> <h3 class="theme-name">{{ data.name }}</h3> <span class="theme-by"><?php printf( __( 'By %s' ), '{{ data.author }}' ); ?></span> <img class="theme-screenshot" src="{{ data.screenshot_url }}" alt="" /> <div class="theme-details"> <# if ( data.rating ) { #> <div class="theme-rating"> {{{ data.stars }}} <span class="num-ratings" aria-hidden="true">({{ data.num_ratings }})</span> </div> <# } else { #> <span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span> <# } #> <div class="theme-version"><?php printf( __( 'Version: %s' ), '{{ data.version }}' ); ?></div> <div class="theme-description">{{{ data.description }}}</div> </div> </div> </div> <div class="wp-full-overlay-footer"> <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> <span class="collapse-sidebar-arrow"></span> <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> </button> </div> </div> <div class="wp-full-overlay-main"> <iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>" /> </div> </script> <?php include(ABSPATH . 'wp-admin/admin-footer.php');
{ "content_hash": "e82cc12b2f425b853f9f5889f1d9c50c", "timestamp": "", "source": "github", "line_count": 284, "max_line_length": 508, "avg_line_length": 42.394366197183096, "alnum_prop": 0.6137873754152824, "repo_name": "oconn270/oconn270.github.io", "id": "af038262c9943f67b40c0c1ab9c77b7ab8b15313", "size": "12040", "binary": false, "copies": "7", "ref": "refs/heads/master", "path": "blog/wp-admin/theme-install.php", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ApacheConf", "bytes": "616" }, { "name": "CSS", "bytes": "2105455" }, { "name": "HTML", "bytes": "41119" }, { "name": "JavaScript", "bytes": "2014413" }, { "name": "PHP", "bytes": "9926088" } ] }
import json import datetime from nameko.events import EventDispatcher, event_handler from statsd import StatsClient class FeesService: name = "fees_service" statsd = StatsClient('statsd-agent', 8125, prefix='simplebank-demo.fees') @event_handler("market_service", "order_placed") @statsd.timer('charge_fee') def charge_fee(self, payload): print("[{}] {} received order_placed event ... charging fee".format( payload, self.name))
{ "content_hash": "18a2238696d90aa3539bc9853b35b08e", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 76, "avg_line_length": 31.0625, "alnum_prop": 0.6579476861167002, "repo_name": "morganjbruce/microservices-in-action", "id": "ede843aeb21b48b3e3cc32128c9c17e45c313ba0", "size": "497", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chapter-7/feature/fees/app.py", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "5454" }, { "name": "Groovy", "bytes": "3962" }, { "name": "JavaScript", "bytes": "368" }, { "name": "Python", "bytes": "75781" }, { "name": "Ruby", "bytes": "1518" }, { "name": "Shell", "bytes": "1851" } ] }
require "tmpdir" require "digest/md5" require "benchmark" require "rubygems" require "language_pack" require "language_pack/base" require "language_pack/ruby_version" require "language_pack/helpers/node_installer" require "language_pack/helpers/jvm_installer" require "language_pack/version" # base Ruby Language Pack. This is for any base ruby app. class LanguagePack::Ruby < LanguagePack::Base NAME = "ruby" LIBYAML_VERSION = "0.1.6" LIBYAML_PATH = "libyaml-#{LIBYAML_VERSION}" BUNDLER_VERSION = "1.11.2" BUNDLER_GEM_PATH = "bundler-#{BUNDLER_VERSION}" RBX_BASE_URL = "http://binaries.rubini.us/heroku" NODE_BP_PATH = "vendor/node/bin" # detects if this is a valid Ruby app # @return [Boolean] true if it's a Ruby app def self.use? instrument "ruby.use" do File.exist?("Gemfile") end end def self.bundler @@bundler ||= LanguagePack::Helpers::BundlerWrapper.new.install end def bundler self.class.bundler end def initialize(build_path, cache_path=nil) super(build_path, cache_path) @fetchers[:mri] = LanguagePack::Fetcher.new(VENDOR_URL, @stack) @fetchers[:rbx] = LanguagePack::Fetcher.new(RBX_BASE_URL, @stack) @node_installer = LanguagePack::NodeInstaller.new(@stack) @jvm_installer = LanguagePack::JvmInstaller.new(slug_vendor_jvm, @stack) end def name "Ruby" end def default_addons instrument "ruby.default_addons" do add_dev_database_addon end end def default_config_vars instrument "ruby.default_config_vars" do vars = { "LANG" => env("LANG") || "en_US.UTF-8" } ruby_version.jruby? ? vars.merge({ "JAVA_OPTS" => default_java_opts, "JRUBY_OPTS" => default_jruby_opts }) : vars end end def default_process_types instrument "ruby.default_process_types" do { "rake" => "bundle exec rake", "console" => "bundle exec irb" } end end def best_practice_warnings if bundler.has_gem?("asset_sync") warn(<<-WARNING) You are using the `asset_sync` gem. See https://devcenter.heroku.com/articles/please-do-not-use-asset-sync for more information. WARNING end end def compile instrument 'ruby.compile' do # check for new app at the beginning of the compile new_app? Dir.chdir(build_path) remove_vendor_bundle install_ruby install_jvm setup_language_pack_environment setup_export setup_profiled allow_git do install_bundler_in_app build_bundler post_bundler create_database_yml install_binaries run_assets_precompile_rake_task run_direct_copy_to_s3_task end best_practice_warnings super end end private # the base PATH environment variable to be used # @return [String] the resulting PATH def default_path # need to remove bin/ folder since it links # to the wrong --prefix ruby binstubs # breaking require. This only applies to Ruby 1.9.2 and 1.8.7. safe_binstubs = binstubs_relative_paths - ["bin"] paths = [ ENV["PATH"], "bin", system_paths, ] paths.unshift("#{slug_vendor_jvm}/bin") if ruby_version.jruby? paths.unshift(safe_binstubs) paths.join(":") end def binstubs_relative_paths [ "bin", bundler_binstubs_path, "#{slug_vendor_base}/bin" ] end def system_paths "/usr/local/bin:/usr/bin:/bin" end # the relative path to the bundler directory of gems # @return [String] resulting path def slug_vendor_base instrument 'ruby.slug_vendor_base' do if @slug_vendor_base @slug_vendor_base elsif ruby_version.ruby_version == "1.8.7" @slug_vendor_base = "vendor/bundle/1.8" else @slug_vendor_base = run_no_pipe(%q(ruby -e "require 'rbconfig';puts \"vendor/bundle/#{RUBY_ENGINE}/#{RbConfig::CONFIG['ruby_version']}\"")).chomp error "Problem detecting bundler vendor directory: #{@slug_vendor_base}" unless $?.success? @slug_vendor_base end end end # the relative path to the vendored ruby directory # @return [String] resulting path def slug_vendor_ruby "vendor/#{ruby_version.version_without_patchlevel}" end # the relative path to the vendored jvm # @return [String] resulting path def slug_vendor_jvm "vendor/jvm" end # the absolute path of the build ruby to use during the buildpack # @return [String] resulting path def build_ruby_path "/tmp/#{ruby_version.version_without_patchlevel}" end # fetch the ruby version from bundler # @return [String, nil] returns the ruby version if detected or nil if none is detected def ruby_version instrument 'ruby.ruby_version' do return @ruby_version if @ruby_version new_app = !File.exist?("vendor/heroku") last_version_file = "buildpack_ruby_version" last_version = nil last_version = @metadata.read(last_version_file).chomp if @metadata.exists?(last_version_file) @ruby_version = LanguagePack::RubyVersion.new(bundler.ruby_version, is_new: new_app, last_version: last_version) return @ruby_version end end # default JAVA_OPTS # return [String] string of JAVA_OPTS def default_java_opts "-Xss512k -XX:+UseCompressedOops -Dfile.encoding=UTF-8" end def set_jvm_max_heap <<-EOF case $(ulimit -u) in 256) # 1X Dyno JVM_MAX_HEAP=384 ;; 512) # 2X Dyno JVM_MAX_HEAP=768 ;; 16384) # IX Dyno JVM_MAX_HEAP=2048 ;; 32768) # PX Dyno JVM_MAX_HEAP=5120 ;; esac EOF end def set_java_mem <<-EOF if ! [[ "${JAVA_OPTS}" == *-Xmx* ]]; then export JAVA_MEM=${JAVA_MEM:--Xmx${JVM_MAX_HEAP:-384}m} fi EOF end def set_default_web_concurrency <<-EOF case $(ulimit -u) in 256) export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-512} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-2} ;; 512) export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-1024} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-4} ;; 16384) export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-2560} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-8} ;; 32768) export HEROKU_RAM_LIMIT_MB=${HEROKU_RAM_LIMIT_MB:-6144} export WEB_CONCURRENCY=${WEB_CONCURRENCY:-16} ;; *) ;; esac EOF end # default JRUBY_OPTS # return [String] string of JRUBY_OPTS def default_jruby_opts "-Xcompile.invokedynamic=false" end # default Java Xmx # return [String] string of Java Xmx def default_java_mem "-Xmx${JVM_MAX_HEAP:-384}m" end # sets up the environment variables for the build process def setup_language_pack_environment instrument 'ruby.setup_language_pack_environment' do if ruby_version.jruby? ENV["PATH"] += ":bin" ENV["JAVA_MEM"] = run(<<-SHELL).chomp #{set_jvm_max_heap} echo #{default_java_mem} SHELL ENV["JRUBY_OPTS"] = env('JRUBY_BUILD_OPTS') || env('JRUBY_OPTS') end setup_ruby_install_env ENV["PATH"] += ":#{node_preinstall_bin_path}" if node_js_installed? # TODO when buildpack-env-args rolls out, we can get rid of # ||= and the manual setting below config_vars = default_config_vars.each do |key, value| ENV[key] ||= value end ENV["GEM_PATH"] = slug_vendor_base ENV["GEM_HOME"] = slug_vendor_base ENV["PATH"] = default_path end end # Sets up the environment variables for subsequent processes run by # muiltibuildpack. We can't use profile.d because $HOME isn't set up def setup_export instrument 'ruby.setup_export' do paths = ENV["PATH"].split(":") set_export_override "GEM_PATH", "#{build_path}/#{slug_vendor_base}:$GEM_PATH" set_export_default "LANG", "en_US.UTF-8" set_export_override "PATH", paths.map { |path| /^\/.*/ !~ path ? "#{build_path}/#{path}" : path }.join(":") if ruby_version.jruby? add_to_export set_jvm_max_heap add_to_export set_java_mem set_export_default "JAVA_OPTS", default_java_opts set_export_default "JRUBY_OPTS", default_jruby_opts end end end # sets up the profile.d script for this buildpack def setup_profiled instrument 'setup_profiled' do set_env_default "LANG", "en_US.UTF-8" set_env_override "GEM_PATH", "$HOME/#{slug_vendor_base}:$GEM_PATH" set_env_override "PATH", binstubs_relative_paths.map {|path| "$HOME/#{path}" }.join(":") + ":$PATH" set_env_override "PATH", "$HOME/vendor/bin:$PATH" set_env_override "LD_LIBRARY_PATH", "$HOME/vendor/ffmpeg/lib:$HOME/vendor/sox/lib:$LD_LIBRARY_PATH" add_to_profiled set_default_web_concurrency if env("SENSIBLE_DEFAULTS") if ruby_version.jruby? add_to_profiled set_jvm_max_heap add_to_profiled set_java_mem set_env_default "JAVA_OPTS", default_java_opts set_env_default "JRUBY_OPTS", default_jruby_opts end end end # install the vendored ruby # @return [Boolean] true if it installs the vendored ruby and false otherwise def install_ruby instrument 'ruby.install_ruby' do return false unless ruby_version if ruby_version.build? FileUtils.mkdir_p(build_ruby_path) Dir.chdir(build_ruby_path) do ruby_vm = "ruby" instrument "ruby.fetch_build_ruby" do @fetchers[:mri].fetch_untar("#{ruby_version.version.sub(ruby_vm, "#{ruby_vm}-build")}.tgz") end end end FileUtils.mkdir_p(slug_vendor_ruby) Dir.chdir(slug_vendor_ruby) do instrument "ruby.fetch_ruby" do if ruby_version.rbx? file = "#{ruby_version.version}.tar.bz2" sha_file = "#{file}.sha1" @fetchers[:rbx].fetch(file) @fetchers[:rbx].fetch(sha_file) expected_checksum = File.read(sha_file).chomp actual_checksum = Digest::SHA1.file(file).hexdigest error <<-ERROR_MSG unless expected_checksum == actual_checksum RBX Checksum for #{file} does not match. Expected #{expected_checksum} but got #{actual_checksum}. Please try pushing again in a few minutes. ERROR_MSG run("tar jxf #{file}") FileUtils.mv(Dir.glob("app/#{slug_vendor_ruby}/*"), ".") FileUtils.rm_rf("app") FileUtils.rm(file) FileUtils.rm(sha_file) else @fetchers[:mri].fetch_untar("#{ruby_version.version}.tgz") end end end app_bin_dir = "bin" FileUtils.mkdir_p app_bin_dir run("ln -s ruby #{slug_vendor_ruby}/bin/ruby.exe") Dir["#{slug_vendor_ruby}/bin/*"].each do |vendor_bin| run("ln -s ../#{vendor_bin} #{app_bin_dir}") end @metadata.write("buildpack_ruby_version", ruby_version.version) topic "Using Ruby version: #{ruby_version.version}" if !ruby_version.set warn(<<-WARNING) You have not declared a Ruby version in your Gemfile. To set your Ruby version add this line to your Gemfile: #{ruby_version.to_gemfile} # See https://devcenter.heroku.com/articles/ruby-versions for more information. WARNING end end true rescue LanguagePack::Fetcher::FetchError => error if ruby_version.jruby? message = <<ERROR An error occurred while installing Ruby #{ruby_version.version} For supported Ruby versions see https://devcenter.heroku.com/articles/ruby-support#supported-runtimes Note: Only JRuby 1.7.13 and newer are supported on Cedar-14 #{error.message} ERROR else message = <<ERROR An error occurred while installing Ruby #{ruby_version.version} For supported Ruby versions see https://devcenter.heroku.com/articles/ruby-support#supported-runtimes Note: Only the most recent version of Ruby 2.1 is supported on Cedar-14 #{error.message} ERROR end error message end def new_app? @new_app ||= !File.exist?("vendor/heroku") end # vendors JVM into the slug for JRuby def install_jvm(forced = false) instrument 'ruby.install_jvm' do if ruby_version.jruby? || forced @jvm_installer.install(ruby_version.engine_version, forced) end end end # find the ruby install path for its binstubs during build # @return [String] resulting path or empty string if ruby is not vendored def ruby_install_binstub_path @ruby_install_binstub_path ||= if ruby_version.build? "#{build_ruby_path}/bin" elsif ruby_version "#{slug_vendor_ruby}/bin" else "" end end # setup the environment so we can use the vendored ruby def setup_ruby_install_env instrument 'ruby.setup_ruby_install_env' do ENV["PATH"] = "#{ruby_install_binstub_path}:#{ENV["PATH"]}" if ruby_version.jruby? ENV['JAVA_OPTS'] = default_java_opts end end end # installs vendored gems into the slug def install_bundler_in_app instrument 'ruby.install_language_pack_gems' do FileUtils.mkdir_p(slug_vendor_base) Dir.chdir(slug_vendor_base) do |dir| `cp -R #{bundler.bundler_path}/. .` end end end # default set of binaries to install # @return [Array] resulting list def binaries add_node_js_binary end # vendors binaries into the slug def install_binaries instrument 'ruby.install_binaries' do binaries.each {|binary| install_binary(binary) } Dir["bin/*"].each {|path| run("chmod +x #{path}") } end end # vendors individual binary into the slug # @param [String] name of the binary package from S3. # Example: https://s3.amazonaws.com/language-pack-ruby/node-0.4.7.tgz, where name is "node-0.4.7" def install_binary(name) bin_dir = "bin" FileUtils.mkdir_p bin_dir Dir.chdir(bin_dir) do |dir| if name.match(/^node\-/) @node_installer.install else @fetchers[:buildpack].fetch_untar("#{name}.tgz") end end end # removes a binary from the slug # @param [String] relative path of the binary on the slug def uninstall_binary(path) FileUtils.rm File.join('bin', File.basename(path)), :force => true end def load_default_cache? new_app? && ruby_version.default? end # loads a default bundler cache for new apps to speed up initial bundle installs def load_default_cache instrument "ruby.load_default_cache" do if false # load_default_cache? puts "New app detected loading default bundler cache" patchlevel = run("ruby -e 'puts RUBY_PATCHLEVEL'").chomp cache_name = "#{LanguagePack::RubyVersion::DEFAULT_VERSION}-p#{patchlevel}-default-cache" @fetchers[:buildpack].fetch_untar("#{cache_name}.tgz") end end end # install libyaml into the LP to be referenced for psych compilation # @param [String] tmpdir to store the libyaml files def install_libyaml(dir) instrument 'ruby.install_libyaml' do FileUtils.mkdir_p dir Dir.chdir(dir) do |dir| @fetchers[:buildpack].fetch_untar("#{LIBYAML_PATH}.tgz") end end end # remove `vendor/bundle` that comes from the git repo # in case there are native ext. # users should be using `bundle pack` instead. # https://github.com/heroku/heroku-buildpack-ruby/issues/21 def remove_vendor_bundle if File.exists?("vendor/bundle") warn(<<-WARNING) Removing `vendor/bundle`. Checking in `vendor/bundle` is not supported. Please remove this directory and add it to your .gitignore. To vendor your gems with Bundler, use `bundle pack` instead. WARNING FileUtils.rm_rf("vendor/bundle") end end def bundler_binstubs_path "vendor/bundle/bin" end # runs bundler to install the dependencies def build_bundler instrument 'ruby.build_bundler' do log("bundle") do bundle_without = env("BUNDLE_WITHOUT") || "development:test" bundle_bin = "bundle" bundle_command = "#{bundle_bin} install --without #{bundle_without} --path vendor/bundle --binstubs #{bundler_binstubs_path}" bundle_command << " -j4" if File.exist?("#{Dir.pwd}/.bundle/config") warn(<<-WARNING, inline: true) You have the `.bundle/config` file checked into your repository It contains local state like the location of the installed bundle as well as configured git local gems, and other settings that should not be shared between multiple checkouts of a single repo. Please remove the `.bundle/` folder from your repo and add it to your `.gitignore` file. https://devcenter.heroku.com/articles/bundler-configuration WARNING end if bundler.windows_gemfile_lock? warn(<<-WARNING, inline: true) Removing `Gemfile.lock` because it was generated on Windows. Bundler will do a full resolve so native gems are handled properly. This may result in unexpected gem versions being used in your app. In rare occasions Bundler may not be able to resolve your dependencies at all. https://devcenter.heroku.com/articles/bundler-windows-gemfile WARNING log("bundle", "has_windows_gemfile_lock") File.unlink("Gemfile.lock") else # using --deployment is preferred if we can bundle_command += " --deployment" end topic("Installing dependencies using bundler #{bundler.version}") load_bundler_cache bundler_output = "" bundle_time = nil Dir.mktmpdir("libyaml-") do |tmpdir| libyaml_dir = "#{tmpdir}/#{LIBYAML_PATH}" install_libyaml(libyaml_dir) # need to setup compile environment for the psych gem yaml_include = File.expand_path("#{libyaml_dir}/include").shellescape yaml_lib = File.expand_path("#{libyaml_dir}/lib").shellescape pwd = Dir.pwd bundler_path = "#{pwd}/#{slug_vendor_base}/gems/#{BUNDLER_GEM_PATH}/lib" # we need to set BUNDLE_CONFIG and BUNDLE_GEMFILE for # codon since it uses bundler. env_vars = { "BUNDLE_GEMFILE" => "#{pwd}/Gemfile", "BUNDLE_CONFIG" => "#{pwd}/.bundle/config", "CPATH" => noshellescape("#{yaml_include}:$CPATH"), "CPPATH" => noshellescape("#{yaml_include}:$CPPATH"), "LIBRARY_PATH" => noshellescape("#{yaml_lib}:$LIBRARY_PATH"), "RUBYOPT" => syck_hack, "NOKOGIRI_USE_SYSTEM_LIBRARIES" => "true" } env_vars["BUNDLER_LIB_PATH"] = "#{bundler_path}" if ruby_version.ruby_version == "1.8.7" puts "Running: #{bundle_command}" instrument "ruby.bundle_install" do bundle_time = Benchmark.realtime do bundler_output << pipe("#{bundle_command} --no-clean", out: "2>&1", env: env_vars, user_env: true) end end end if $?.success? puts "Bundle completed (#{"%.2f" % bundle_time}s)" log "bundle", :status => "success" puts "Cleaning up the bundler cache." instrument "ruby.bundle_clean" do # Only show bundle clean output when not using default cache if load_default_cache? run("#{bundle_bin} clean > /dev/null", user_env: true) else pipe("#{bundle_bin} clean", out: "2> /dev/null", user_env: true) end end @bundler_cache.store # Keep gem cache out of the slug FileUtils.rm_rf("#{slug_vendor_base}/cache") else log "bundle", :status => "failure" error_message = "Failed to install gems via Bundler." puts "Bundler Output: #{bundler_output}" if bundler_output.match(/An error occurred while installing sqlite3/) error_message += <<ERROR Detected sqlite3 gem which is not supported on Heroku. https://devcenter.heroku.com/articles/sqlite3 ERROR end error error_message end end end end def post_bundler instrument "ruby.post_bundler" do Dir[File.join(slug_vendor_base, "**", ".git")].each do |dir| FileUtils.rm_rf(dir) end bundler.clean end end # RUBYOPT line that requires syck_hack file # @return [String] require string if needed or else an empty string def syck_hack instrument "ruby.syck_hack" do syck_hack_file = File.expand_path(File.join(File.dirname(__FILE__), "../../vendor/syck_hack")) rv = run_stdout('ruby -e "puts RUBY_VERSION"').chomp # < 1.9.3 includes syck, so we need to use the syck hack if Gem::Version.new(rv) < Gem::Version.new("1.9.3") "-r#{syck_hack_file}" else "" end end end # writes ERB based database.yml for Rails. The database.yml uses the DATABASE_URL from the environment during runtime. def create_database_yml instrument 'ruby.create_database_yml' do return false unless File.directory?("config") return false if bundler.has_gem?('activerecord') && bundler.gem_version('activerecord') >= Gem::Version.new('4.1.0.beta1') log("create_database_yml") do topic("Writing config/database.yml to read from DATABASE_URL") File.open("config/database.yml", "w") do |file| file.puts <<-DATABASE_YML <% require 'cgi' require 'uri' begin uri = URI.parse(ENV["DATABASE_URL"]) rescue URI::InvalidURIError raise "Invalid DATABASE_URL" end raise "No RACK_ENV or RAILS_ENV found" unless ENV["RAILS_ENV"] || ENV["RACK_ENV"] def attribute(name, value, force_string = false) if value value_string = if force_string '"' + value + '"' else value end "\#{name}: \#{value_string}" else "" end end adapter = uri.scheme adapter = "postgresql" if adapter == "postgres" database = (uri.path || "").split("/")[1] username = uri.user password = uri.password host = uri.host port = uri.port params = CGI.parse(uri.query || "") %> <%= ENV["RAILS_ENV"] || ENV["RACK_ENV"] %>: <%= attribute "adapter", adapter %> <%= attribute "database", database %> <%= attribute "username", username %> <%= attribute "password", password, true %> <%= attribute "host", host %> <%= attribute "port", port %> <% params.each do |key, value| %> <%= key %>: <%= value.first %> <% end %> DATABASE_YML end end end end def rake @rake ||= begin rake_gem_available = bundler.has_gem?("rake") || ruby_version.rake_is_vendored? raise_on_fail = bundler.gem_version('railties') && bundler.gem_version('railties') > Gem::Version.new('3.x') rake = LanguagePack::Helpers::RakeRunner.new(rake_gem_available) rake.load_rake_tasks!({ env: rake_env }, raise_on_fail) rake end end def rake_env if database_url { "DATABASE_URL" => database_url } else {} end.merge(user_env_hash) end def database_url env("DATABASE_URL") if env("DATABASE_URL") end # executes the block with GIT_DIR environment variable removed since it can mess with the current working directory git thinks it's in # @param [block] block to be executed in the GIT_DIR free context def allow_git(&blk) git_dir = ENV.delete("GIT_DIR") # can mess with bundler blk.call ENV["GIT_DIR"] = git_dir end # decides if we need to enable the dev database addon # @return [Array] the database addon if the pg gem is detected or an empty Array if it isn't. def add_dev_database_addon bundler.has_gem?("pg") ? ['heroku-postgresql'] : [] end # decides if we need to install the node.js binary # @note execjs will blow up if no JS RUNTIME is detected and is loaded. # @return [Array] the node.js binary path if we need it or an empty Array def add_node_js_binary bundler.has_gem?('execjs') && node_not_preinstalled? ? [@node_installer.binary_path] : [] end # checks if node.js is installed via the official heroku-buildpack-nodejs using multibuildpack # @return String if it's detected and false if it isn't def node_preinstall_bin_path return @node_preinstall_bin_path if defined?(@node_preinstall_bin_path) legacy_path = "#{Dir.pwd}/#{NODE_BP_PATH}" path = run("which node") if path && $?.success? @node_preinstall_bin_path = path elsif run("#{legacy_path}/node -v") && $?.success? @node_preinstall_bin_path = legacy_path else @node_preinstall_bin_path = false end end alias :node_js_installed? :node_preinstall_bin_path def node_not_preinstalled? !node_js_installed? end def run_assets_precompile_rake_task instrument 'ruby.run_assets_precompile_rake_task' do precompile = rake.task("assets:precompile") return true unless precompile.is_defined? topic "Precompiling assets" precompile.invoke(env: rake_env) if precompile.success? puts "Asset precompilation completed (#{"%.2f" % precompile.time}s)" else precompile_fail(precompile.output) end end end def precompile_fail(output) log "assets_precompile", :status => "failure" msg = "Precompiling assets failed.\n" if output.match(/(127\.0\.0\.1)|(org\.postgresql\.util)/) msg << "Attempted to access a nonexistent database:\n" msg << "https://devcenter.heroku.com/articles/pre-provision-database\n" end error msg end def bundler_cache "vendor/bundle" end def load_bundler_cache instrument "ruby.load_bundler_cache" do cache.load "vendor" full_ruby_version = run_stdout(%q(ruby -v)).chomp rubygems_version = run_stdout(%q(gem -v)).chomp heroku_metadata = "vendor/heroku" old_rubygems_version = nil ruby_version_cache = "ruby_version" buildpack_version_cache = "buildpack_version" bundler_version_cache = "bundler_version" rubygems_version_cache = "rubygems_version" stack_cache = "stack" old_bundler_version = @metadata.read(bundler_version_cache).chomp if @metadata.exists?(bundler_version_cache) old_rubygems_version = @metadata.read(ruby_version_cache).chomp if @metadata.exists?(ruby_version_cache) old_stack = @metadata.read(stack_cache).chomp if @metadata.exists?(stack_cache) old_stack ||= DEFAULT_LEGACY_STACK if old_bundler_version && old_bundler_version != BUNDLER_VERSION puts(<<-WARNING) Your app was upgraded to bundler #{ BUNDLER_VERSION }. Previously you had a successful deploy with bundler #{ old_bundler_version }. If you see problems related to the bundler version please refer to: https://devcenter.heroku.com/articles/bundler-version WARNING end stack_change = old_stack != @stack convert_stack = @bundler_cache.old? @bundler_cache.convert_stack(stack_change) if convert_stack if !new_app? && stack_change puts "Purging Cache. Changing stack from #{old_stack} to #{@stack}" purge_bundler_cache(old_stack) elsif !new_app? && !convert_stack @bundler_cache.load end # fix bug from v37 deploy if File.exists?("vendor/ruby_version") puts "Broken cache detected. Purging build cache." cache.clear("vendor") FileUtils.rm_rf("vendor/ruby_version") purge_bundler_cache # fix bug introduced in v38 elsif !@metadata.exists?(buildpack_version_cache) && @metadata.exists?(ruby_version_cache) puts "Broken cache detected. Purging build cache." purge_bundler_cache elsif (@bundler_cache.exists? || @bundler_cache.old?) && @metadata.exists?(ruby_version_cache) && full_ruby_version != @metadata.read(ruby_version_cache).chomp puts "Ruby version change detected. Clearing bundler cache." puts "Old: #{@metadata.read(ruby_version_cache).chomp}" puts "New: #{full_ruby_version}" purge_bundler_cache end # fix git gemspec bug from Bundler 1.3.0+ upgrade if File.exists?(bundler_cache) && !@metadata.exists?(bundler_version_cache) && !run("find vendor/bundle/*/*/bundler/gems/*/ -name *.gemspec").include?("No such file or directory") puts "Old bundler cache detected. Clearing bundler cache." purge_bundler_cache end # fix for https://github.com/heroku/heroku-buildpack-ruby/issues/86 if (!@metadata.exists?(rubygems_version_cache) || (old_rubygems_version == "2.0.0" && old_rubygems_version != rubygems_version)) && @metadata.exists?(ruby_version_cache) && @metadata.read(ruby_version_cache).chomp.include?("ruby 2.0.0p0") puts "Updating to rubygems #{rubygems_version}. Clearing bundler cache." purge_bundler_cache end # fix for https://github.com/sparklemotion/nokogiri/issues/923 if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 76 puts "Fixing nokogiri install. Clearing bundler cache." puts "See https://github.com/sparklemotion/nokogiri/issues/923." purge_bundler_cache end # recompile nokogiri to use new libyaml if @metadata.exists?(buildpack_version_cache) && (bv = @metadata.read(buildpack_version_cache).sub('v', '').to_i) && bv != 0 && bv <= 99 && bundler.has_gem?("psych") puts "Need to recompile psych for CVE-2013-6393. Clearing bundler cache." puts "See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=737076." purge_bundler_cache end FileUtils.mkdir_p(heroku_metadata) @metadata.write(ruby_version_cache, full_ruby_version, false) @metadata.write(buildpack_version_cache, BUILDPACK_VERSION, false) @metadata.write(bundler_version_cache, BUNDLER_VERSION, false) @metadata.write(rubygems_version_cache, rubygems_version, false) @metadata.write(stack_cache, @stack, false) @metadata.save end end def purge_bundler_cache(stack = nil) instrument "ruby.purge_bundler_cache" do @bundler_cache.clear(stack) # need to reinstall language pack gems install_bundler_in_app end end end
{ "content_hash": "2ca95cdc6b76067c2723b52b522e6819", "timestamp": "", "source": "github", "line_count": 940, "max_line_length": 185, "avg_line_length": 32.26276595744681, "alnum_prop": 0.6378474626570383, "repo_name": "markaschneider/heroku-buildpack-ruby-ffmpeg-sox", "id": "265a2082cb64cfb9338824c441bbfc8c7975e20f", "size": "30327", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/language_pack/ruby.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "124622" }, { "name": "Shell", "bytes": "8272" } ] }
End of preview.

No dataset card yet

Downloads last month
6