hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
860c398f394d3bf68c3208c2c7c40bf1db02cdfc | 10,249 | java | Java | src/main/java/com/github/netty/protocol/servlet/util/FilterMapper.java | wangzihaogithub/spring-boot-protocol | 3079149006ba97bb9056beb2eec97d40da41c068 | [
"Apache-2.0"
] | 73 | 2019-03-01T14:42:14.000Z | 2021-12-19T07:02:32.000Z | src/main/java/com/github/netty/protocol/servlet/util/FilterMapper.java | dwlcrr/spring-boot-protocol | 258e58d2fa6fd89a49e46924a04e07c29cdb8b77 | [
"Apache-2.0"
] | 10 | 2019-11-12T02:57:03.000Z | 2022-02-25T07:21:31.000Z | src/main/java/com/github/netty/protocol/servlet/util/FilterMapper.java | dwlcrr/spring-boot-protocol | 258e58d2fa6fd89a49e46924a04e07c29cdb8b77 | [
"Apache-2.0"
] | 39 | 2019-03-08T09:20:27.000Z | 2022-03-31T08:29:21.000Z | package com.github.netty.protocol.servlet.util;
import javax.servlet.DispatcherType;
import javax.servlet.ServletContext;
import java.util.*;
/**
* Filter mapping
*
* @author wangzihao
* Created on 2017-08-25 11:32.
*/
public class FilterMapper<T> {
private String rootPath;
private final AntPathMatcher antPathMatcher = new AntPathMatcher();
private final Object lock = new Object();
/**
* The set of filter mappings for this application, in the order they
* were defined in the deployment descriptor with additional mappings
* added via the {@link ServletContext} possibly both before and after
* those defined in the deployment descriptor.
*/
private Element<T>[] array = new Element[0];
/**
* Filter mappings added via {@link ServletContext} may have to be
* inserted before the mappings in the deployment descriptor but must be
* inserted in the order the {@link ServletContext} methods are called.
* This isn't an issue for the mappings added after the deployment
* descriptor - they are just added to the end - but correctly the
* adding mappings before the deployment descriptor mappings requires
* knowing where the last 'before' mapping was added.
*/
private int insertPoint = 0;
public FilterMapper() {
this.antPathMatcher.setCachePatterns(Boolean.TRUE);
}
public void clear(){
synchronized (lock) {
array = new Element[0];
}
}
/**
* Add a filter mapping at the end of the current set of filter
* mappings.
*
* @param filterMap
* The filter mapping to be added
*/
private void add(Element filterMap) {
synchronized (lock) {
Element[] results = Arrays.copyOf(array, array.length + 1);
results[array.length] = filterMap;
array = results;
}
}
/**
* Add a filter mapping before the mappings defined in the deployment
* descriptor but after any other mappings added via this method.
*
* @param filterMap
* The filter mapping to be added
*/
private void addBefore(Element filterMap) {
synchronized (lock) {
Element[] results = new Element[array.length + 1];
System.arraycopy(array, 0, results, 0, insertPoint);
System.arraycopy(array, insertPoint, results, insertPoint + 1,
array.length - insertPoint);
results[insertPoint] = filterMap;
array = results;
insertPoint++;
}
}
/**
* Remove a filter mapping.
*
* @param filterMap The filter mapping to be removed
*/
public void remove(Element filterMap) {
synchronized (lock) {
// Make sure this filter mapping is currently present
int n = -1;
for (int i = 0; i < array.length; i++) {
if (array[i] == filterMap) {
n = i;
break;
}
}
if (n < 0) {
return;
}
// Remove the specified filter mapping
Element[] results = new Element[array.length - 1];
System.arraycopy(array, 0, results, 0, n);
System.arraycopy(array, n + 1, results, n, (array.length - 1)
- n);
array = results;
if (n < insertPoint) {
insertPoint--;
}
}
}
public void setRootPath(String rootPath) {
while (rootPath.startsWith("/")){
rootPath = rootPath.substring(1);
}
rootPath = "/" + rootPath;
synchronized (lock) {
Element<T>[] newElements = new Element[array.length];
for (int i = 0; i < this.array.length; i++) {
Element<T> source = array[i];
Element<T> element = new Element<>(rootPath, source.originalPattern, source.object, source.objectName, source.dispatcherTypes);
newElements[i] = element;
}
this.rootPath = rootPath;
this.array = newElements;
}
}
/**
* Add mapping
* @param urlPattern urlPattern
* @param object object
* @param objectName objectName
* @param isMatchAfter isMatchAfter
* @param dispatcherTypes dispatcherTypes
* @throws IllegalArgumentException IllegalArgumentException
*/
public void addMapping(String urlPattern, T object, String objectName,boolean isMatchAfter,EnumSet<DispatcherType> dispatcherTypes) throws IllegalArgumentException {
Objects.requireNonNull(urlPattern);
Element<T> element = new Element<>(rootPath, urlPattern, object, objectName,dispatcherTypes);
if(isMatchAfter){
add(element);
}else {
addBefore(element);
}
}
/**
* Gets a servlet path
* @param absoluteUri An absolute path
* @return servlet path
*/
public String getServletPath(String absoluteUri) {
for (Element<T> element : array) {
if(antPathMatcher.match(element.pattern,absoluteUri,"*")){
return element.servletPath;
}
}
return absoluteUri;
}
/**
* Gets a mapping object
* @param absoluteUri An absolute path
* @return T object
*/
public Element<T> getMappingObjectByUri(String absoluteUri) {
if(!absoluteUri.isEmpty() && absoluteUri.charAt(absoluteUri.length() - 1) == '/'){
absoluteUri = absoluteUri.substring(0,absoluteUri.length()-1);
}
for (Element<T> element : this.array) {
if(antPathMatcher.match(element.pattern,absoluteUri,"*")){
return element;
}
}
return null;
}
/**
* Add multiple mapping objects
* @param list add in list
* @param dispatcherType current dispatcherType
* @param absoluteUri An absolute path
*/
public void addMappingObjectsByUri(String absoluteUri, DispatcherType dispatcherType, List<Element<T>> list) {
if(!absoluteUri.isEmpty() && absoluteUri.charAt(absoluteUri.length() - 1) == '/'){
absoluteUri = absoluteUri.substring(0,absoluteUri.length()-1);
}
for (Element<T> element : this.array) {
if(element.dispatcherTypes != null && !element.dispatcherTypes.contains(dispatcherType)){
continue;
}
if(antPathMatcher.match(element.pattern,absoluteUri,"*")){
list.add(element);
}
}
}
public static class Element<T> {
String pattern;
String originalPattern;
T object;
String objectName;
String servletPath;
String rootPath;
boolean wildcardPatternFlag;
boolean allPatternFlag;
boolean defaultFlag;
EnumSet<DispatcherType> dispatcherTypes;
public Element(String objectName,T object){
this.objectName = objectName;
this.object = object;
}
public Element(String rootPath,String originalPattern, T object, String objectName,EnumSet<DispatcherType> dispatcherTypes) {
this.dispatcherTypes = dispatcherTypes;
this.allPatternFlag = "/".equals(originalPattern)
|| "/*".equals(originalPattern)
|| "*".equals(originalPattern)
|| "/**".equals(originalPattern);
if(rootPath != null){
this.pattern = rootPath.concat(originalPattern);
}else {
this.pattern = originalPattern;
}
if(pattern.endsWith("/")){
do {
pattern = pattern.substring(0,pattern.length() -1);
}while(pattern.endsWith("/"));
pattern = pattern + "/*";
}
this.rootPath = rootPath;
this.originalPattern = originalPattern;
this.object = object;
this.objectName = objectName;
StringJoiner joiner = new StringJoiner("/");
String[] pattens = pattern.split("/");
for(int i=0; i<pattens.length; i++){
String path = pattens[i];
if(path.contains("*")){
wildcardPatternFlag = true;
if(i == pattens.length - 1) {
continue;
}
}
joiner.add(path);
}
this.defaultFlag = "default".equals(this.objectName);
this.servletPath = joiner.toString();
}
public EnumSet<DispatcherType> getDispatcherTypes() {
return dispatcherTypes;
}
public T getObject() {
return object;
}
public String getObjectName() {
return objectName;
}
public String getPattern() {
return pattern;
}
public String getServletPath() {
return servletPath;
}
@Override
public boolean equals(Object obj) {
return this == obj;
}
@Override
public int hashCode() {
return System.identityHashCode(this);
}
@Override
public String toString() {
return "Element{" +
"pattern='" + pattern + '\'' +
", objectName='" + objectName + '\'' +
'}';
}
}
public static void main(String[] args) {
FilterMapper<Object> urlMapper = new FilterMapper<>();
urlMapper.addMapping("/t/","","default",false,null);
urlMapper.addMapping("/t/","","1",false,null);
urlMapper.addMapping("/t/","","2",false,null);
urlMapper.addMapping("/*","","3",false,null);
urlMapper.addMapping("/*.do","","4",false,null);
// urlMapper.setRootPath("test");
Element<Object> e1 = urlMapper.getMappingObjectByUri("/t/a/d");
assert Objects.equals("1", e1.objectName);
Element<Object> e2 = urlMapper.getMappingObjectByUri("/a");
assert Objects.equals("3", e2.objectName);
}
} | 33.06129 | 169 | 0.561128 |
fb929017ecbdb697332c3d454a0491a9e6b309ca | 415 | java | Java | src/main/java/com/github/siphon/Main.java | tamada/siphon | 341adfb0bf551c7590bca5c59a2583be86c44ce1 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/siphon/Main.java | tamada/siphon | 341adfb0bf551c7590bca5c59a2583be86c44ce1 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/siphon/Main.java | tamada/siphon | 341adfb0bf551c7590bca5c59a2583be86c44ce1 | [
"Apache-2.0"
] | null | null | null | package com.github.siphon;
public class Main {
private Siphon siphon;
public Main(String[] args){
Options options = parseOptions(args);
siphon = new Siphon(options);
siphon.perform();
}
public Options parseOptions(String[] args){
return Options.parse(args);
}
public static void main(String[] args){
new Main(args);
}
}
| 18.863636 | 48 | 0.575904 |
04cdc67e9c4eecbca483c4f69d36616b0b1e0024 | 1,159 | java | Java | core/src/com/desertkun/brainout/common/msg/client/editor2/MultipleBlocksMsg.java | eSquire-qq/BrainOut | 9eb082af8bea531b628dc7a0640effaf3b550998 | [
"MIT"
] | 31 | 2022-03-20T18:52:44.000Z | 2022-03-28T17:40:28.000Z | core/src/com/desertkun/brainout/common/msg/client/editor2/MultipleBlocksMsg.java | strelokuser/brainout | d56fdfb6481879be1a289f040aefdbb2085ab266 | [
"MIT"
] | 4 | 2022-03-21T19:23:21.000Z | 2022-03-30T04:48:20.000Z | core/src/com/desertkun/brainout/common/msg/client/editor2/MultipleBlocksMsg.java | strelokuser/brainout | d56fdfb6481879be1a289f040aefdbb2085ab266 | [
"MIT"
] | 15 | 2022-03-20T23:34:29.000Z | 2022-03-31T11:31:45.000Z | package com.desertkun.brainout.common.msg.client.editor2;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Queue;
import com.desertkun.brainout.common.msg.ModeMessage;
import com.desertkun.brainout.content.block.Block;
public class MultipleBlocksMsg extends BlockMessage
{
public int[] x;
public int[] y;
public String block;
public static class Point
{
private final int x;
private final int y;
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
public int getY()
{
return y;
}
public int getX()
{
return x;
}
}
public MultipleBlocksMsg() {}
public MultipleBlocksMsg(String dimension, Block block, Queue<Point> points)
{
super(dimension);
this.block = block != null ? block.getID() : null;
this.x = new int[points.size];
this.y = new int[points.size];
int i = 0;
for (Point point : points)
{
this.x[i] = point.x;
this.y[i] = point.y;
i++;
}
}
}
| 19.316667 | 80 | 0.544435 |
5220970f23f5f09de34b36fae93ab27e3e6805e9 | 937 | go | Go | pkg/sshfs/identityserver.go | ibadi-id/csi-sshfs | 39c885282d4ab2f99fbff0eccd912a9d2be15cf6 | [
"Apache-2.0"
] | 6 | 2021-04-02T06:01:01.000Z | 2022-02-09T20:02:45.000Z | pkg/sshfs/identityserver.go | ibadi-id/csi-sshfs | 39c885282d4ab2f99fbff0eccd912a9d2be15cf6 | [
"Apache-2.0"
] | null | null | null | pkg/sshfs/identityserver.go | ibadi-id/csi-sshfs | 39c885282d4ab2f99fbff0eccd912a9d2be15cf6 | [
"Apache-2.0"
] | 1 | 2022-01-19T09:18:37.000Z | 2022-01-19T09:18:37.000Z | package sshfs
import (
"context"
"github.com/container-storage-interface/spec/lib/go/csi"
)
func NewIdentityServer(driverInstance DriverInstance) *IdentityServer {
return &IdentityServer{
Driver: &driverInstance,
}
}
type IdentityServer struct {
Driver *DriverInstance
}
func (ids *IdentityServer) GetPluginInfo(ctx context.Context, request *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error) {
return &csi.GetPluginInfoResponse{
Name: ids.Driver.csiDriverName,
VendorVersion: ids.Driver.version,
}, nil
}
func (ids *IdentityServer) GetPluginCapabilities(ctx context.Context, request *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error) {
return &csi.GetPluginCapabilitiesResponse{Capabilities: ids.Driver.capPlugin}, nil
}
func (ids *IdentityServer) Probe(ctx context.Context, request *csi.ProbeRequest) (*csi.ProbeResponse, error) {
return &csi.ProbeResponse{}, nil
}
| 29.28125 | 158 | 0.781217 |
818b08452dc93d8ad4baaf3392aeb6802dc7dbc6 | 21,135 | rs | Rust | src/dac/dac1cfg0.rs | lucasbrendel/xmc4500 | dae11a5e59f30088e0be6d90c7fbdf6388ed2215 | [
"MIT"
] | 1 | 2019-09-21T14:14:35.000Z | 2019-09-21T14:14:35.000Z | src/dac/dac1cfg0.rs | xmc-rs/xmc4500 | d6cff7aa46850a0d3d17fd934c315baab30facf9 | [
"MIT"
] | 8 | 2019-09-14T17:01:32.000Z | 2022-03-02T10:25:45.000Z | src/dac/dac1cfg0.rs | xmc-rs/xmc4500 | d6cff7aa46850a0d3d17fd934c315baab30facf9 | [
"MIT"
] | null | null | null | #[doc = "Register `DAC1CFG0` reader"]
pub struct R(crate::R<DAC1CFG0_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DAC1CFG0_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DAC1CFG0_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<DAC1CFG0_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `DAC1CFG0` writer"]
pub struct W(crate::W<DAC1CFG0_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<DAC1CFG0_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<DAC1CFG0_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<DAC1CFG0_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `FREQ` reader - Integer Frequency Divider Value"]
pub struct FREQ_R(crate::FieldReader<u32, u32>);
impl FREQ_R {
pub(crate) fn new(bits: u32) -> Self {
FREQ_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FREQ_R {
type Target = crate::FieldReader<u32, u32>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `FREQ` writer - Integer Frequency Divider Value"]
pub struct FREQ_W<'a> {
w: &'a mut W,
}
impl<'a> FREQ_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !0x000f_ffff) | (value as u32 & 0x000f_ffff);
self.w
}
}
#[doc = "Enables and sets the Mode for DAC1\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum MODE_A {
#[doc = "0: disable/switch-off DAC"]
VALUE1 = 0,
#[doc = "1: Single Value Mode"]
VALUE2 = 1,
#[doc = "2: Data Mode"]
VALUE3 = 2,
#[doc = "3: Patgen Mode"]
VALUE4 = 3,
#[doc = "4: Noise Mode"]
VALUE5 = 4,
#[doc = "5: Ramp Mode"]
VALUE6 = 5,
#[doc = "6: na"]
VALUE7 = 6,
#[doc = "7: na"]
VALUE8 = 7,
}
impl From<MODE_A> for u8 {
#[inline(always)]
fn from(variant: MODE_A) -> Self {
variant as _
}
}
#[doc = "Field `MODE` reader - Enables and sets the Mode for DAC1"]
pub struct MODE_R(crate::FieldReader<u8, MODE_A>);
impl MODE_R {
pub(crate) fn new(bits: u8) -> Self {
MODE_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> MODE_A {
match self.bits {
0 => MODE_A::VALUE1,
1 => MODE_A::VALUE2,
2 => MODE_A::VALUE3,
3 => MODE_A::VALUE4,
4 => MODE_A::VALUE5,
5 => MODE_A::VALUE6,
6 => MODE_A::VALUE7,
7 => MODE_A::VALUE8,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == MODE_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == MODE_A::VALUE2
}
#[doc = "Checks if the value of the field is `VALUE3`"]
#[inline(always)]
pub fn is_value3(&self) -> bool {
**self == MODE_A::VALUE3
}
#[doc = "Checks if the value of the field is `VALUE4`"]
#[inline(always)]
pub fn is_value4(&self) -> bool {
**self == MODE_A::VALUE4
}
#[doc = "Checks if the value of the field is `VALUE5`"]
#[inline(always)]
pub fn is_value5(&self) -> bool {
**self == MODE_A::VALUE5
}
#[doc = "Checks if the value of the field is `VALUE6`"]
#[inline(always)]
pub fn is_value6(&self) -> bool {
**self == MODE_A::VALUE6
}
#[doc = "Checks if the value of the field is `VALUE7`"]
#[inline(always)]
pub fn is_value7(&self) -> bool {
**self == MODE_A::VALUE7
}
#[doc = "Checks if the value of the field is `VALUE8`"]
#[inline(always)]
pub fn is_value8(&self) -> bool {
**self == MODE_A::VALUE8
}
}
impl core::ops::Deref for MODE_R {
type Target = crate::FieldReader<u8, MODE_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `MODE` writer - Enables and sets the Mode for DAC1"]
pub struct MODE_W<'a> {
w: &'a mut W,
}
impl<'a> MODE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: MODE_A) -> &'a mut W {
self.bits(variant.into())
}
#[doc = "disable/switch-off DAC"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(MODE_A::VALUE1)
}
#[doc = "Single Value Mode"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(MODE_A::VALUE2)
}
#[doc = "Data Mode"]
#[inline(always)]
pub fn value3(self) -> &'a mut W {
self.variant(MODE_A::VALUE3)
}
#[doc = "Patgen Mode"]
#[inline(always)]
pub fn value4(self) -> &'a mut W {
self.variant(MODE_A::VALUE4)
}
#[doc = "Noise Mode"]
#[inline(always)]
pub fn value5(self) -> &'a mut W {
self.variant(MODE_A::VALUE5)
}
#[doc = "Ramp Mode"]
#[inline(always)]
pub fn value6(self) -> &'a mut W {
self.variant(MODE_A::VALUE6)
}
#[doc = "na"]
#[inline(always)]
pub fn value7(self) -> &'a mut W {
self.variant(MODE_A::VALUE7)
}
#[doc = "na"]
#[inline(always)]
pub fn value8(self) -> &'a mut W {
self.variant(MODE_A::VALUE8)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x07 << 20)) | ((value as u32 & 0x07) << 20);
self.w
}
}
#[doc = "Selects between signed and unsigned DAC1 mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SIGN_A {
#[doc = "0: DAC expects unsigned input data"]
VALUE1 = 0,
#[doc = "1: DAC expects signed input data"]
VALUE2 = 1,
}
impl From<SIGN_A> for bool {
#[inline(always)]
fn from(variant: SIGN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SIGN` reader - Selects between signed and unsigned DAC1 mode"]
pub struct SIGN_R(crate::FieldReader<bool, SIGN_A>);
impl SIGN_R {
pub(crate) fn new(bits: bool) -> Self {
SIGN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SIGN_A {
match self.bits {
false => SIGN_A::VALUE1,
true => SIGN_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == SIGN_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == SIGN_A::VALUE2
}
}
impl core::ops::Deref for SIGN_R {
type Target = crate::FieldReader<bool, SIGN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SIGN` writer - Selects between signed and unsigned DAC1 mode"]
pub struct SIGN_W<'a> {
w: &'a mut W,
}
impl<'a> SIGN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SIGN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "DAC expects unsigned input data"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(SIGN_A::VALUE1)
}
#[doc = "DAC expects signed input data"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(SIGN_A::VALUE2)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23);
self.w
}
}
#[doc = "Field `FIFOIND` reader - Current write position inside the data FIFO"]
pub struct FIFOIND_R(crate::FieldReader<u8, u8>);
impl FIFOIND_R {
pub(crate) fn new(bits: u8) -> Self {
FIFOIND_R(crate::FieldReader::new(bits))
}
}
impl core::ops::Deref for FIFOIND_R {
type Target = crate::FieldReader<u8, u8>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Indicate if the FIFO is empty\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FIFOEMP_A {
#[doc = "0: FIFO not empty"]
VALUE1 = 0,
#[doc = "1: FIFO empty"]
VALUE2 = 1,
}
impl From<FIFOEMP_A> for bool {
#[inline(always)]
fn from(variant: FIFOEMP_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `FIFOEMP` reader - Indicate if the FIFO is empty"]
pub struct FIFOEMP_R(crate::FieldReader<bool, FIFOEMP_A>);
impl FIFOEMP_R {
pub(crate) fn new(bits: bool) -> Self {
FIFOEMP_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> FIFOEMP_A {
match self.bits {
false => FIFOEMP_A::VALUE1,
true => FIFOEMP_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == FIFOEMP_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == FIFOEMP_A::VALUE2
}
}
impl core::ops::Deref for FIFOEMP_R {
type Target = crate::FieldReader<bool, FIFOEMP_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Indicate if the FIFO is full\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FIFOFUL_A {
#[doc = "0: FIFO not full"]
VALUE1 = 0,
#[doc = "1: FIFO full"]
VALUE2 = 1,
}
impl From<FIFOFUL_A> for bool {
#[inline(always)]
fn from(variant: FIFOFUL_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `FIFOFUL` reader - Indicate if the FIFO is full"]
pub struct FIFOFUL_R(crate::FieldReader<bool, FIFOFUL_A>);
impl FIFOFUL_R {
pub(crate) fn new(bits: bool) -> Self {
FIFOFUL_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> FIFOFUL_A {
match self.bits {
false => FIFOFUL_A::VALUE1,
true => FIFOFUL_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == FIFOFUL_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == FIFOFUL_A::VALUE2
}
}
impl core::ops::Deref for FIFOFUL_R {
type Target = crate::FieldReader<bool, FIFOFUL_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Enable sign output of DAC1 pattern generator\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SIGNEN_A {
#[doc = "0: disable"]
VALUE1 = 0,
#[doc = "1: enable"]
VALUE2 = 1,
}
impl From<SIGNEN_A> for bool {
#[inline(always)]
fn from(variant: SIGNEN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SIGNEN` reader - Enable sign output of DAC1 pattern generator"]
pub struct SIGNEN_R(crate::FieldReader<bool, SIGNEN_A>);
impl SIGNEN_R {
pub(crate) fn new(bits: bool) -> Self {
SIGNEN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SIGNEN_A {
match self.bits {
false => SIGNEN_A::VALUE1,
true => SIGNEN_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == SIGNEN_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == SIGNEN_A::VALUE2
}
}
impl core::ops::Deref for SIGNEN_R {
type Target = crate::FieldReader<bool, SIGNEN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SIGNEN` writer - Enable sign output of DAC1 pattern generator"]
pub struct SIGNEN_W<'a> {
w: &'a mut W,
}
impl<'a> SIGNEN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SIGNEN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "disable"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(SIGNEN_A::VALUE1)
}
#[doc = "enable"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(SIGNEN_A::VALUE2)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 29)) | ((value as u32 & 0x01) << 29);
self.w
}
}
#[doc = "Enable DAC1 service request interrupt generation\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SREN_A {
#[doc = "0: disable"]
VALUE1 = 0,
#[doc = "1: enable"]
VALUE2 = 1,
}
impl From<SREN_A> for bool {
#[inline(always)]
fn from(variant: SREN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `SREN` reader - Enable DAC1 service request interrupt generation"]
pub struct SREN_R(crate::FieldReader<bool, SREN_A>);
impl SREN_R {
pub(crate) fn new(bits: bool) -> Self {
SREN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SREN_A {
match self.bits {
false => SREN_A::VALUE1,
true => SREN_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == SREN_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == SREN_A::VALUE2
}
}
impl core::ops::Deref for SREN_R {
type Target = crate::FieldReader<bool, SREN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
#[doc = "Field `SREN` writer - Enable DAC1 service request interrupt generation"]
pub struct SREN_W<'a> {
w: &'a mut W,
}
impl<'a> SREN_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SREN_A) -> &'a mut W {
self.bit(variant.into())
}
#[doc = "disable"]
#[inline(always)]
pub fn value1(self) -> &'a mut W {
self.variant(SREN_A::VALUE1)
}
#[doc = "enable"]
#[inline(always)]
pub fn value2(self) -> &'a mut W {
self.variant(SREN_A::VALUE2)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
self.w
}
}
#[doc = "RUN indicates the current DAC1 operation status\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RUN_A {
#[doc = "0: DAC1 channel disabled"]
VALUE1 = 0,
#[doc = "1: DAC1 channel in operation"]
VALUE2 = 1,
}
impl From<RUN_A> for bool {
#[inline(always)]
fn from(variant: RUN_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Field `RUN` reader - RUN indicates the current DAC1 operation status"]
pub struct RUN_R(crate::FieldReader<bool, RUN_A>);
impl RUN_R {
pub(crate) fn new(bits: bool) -> Self {
RUN_R(crate::FieldReader::new(bits))
}
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RUN_A {
match self.bits {
false => RUN_A::VALUE1,
true => RUN_A::VALUE2,
}
}
#[doc = "Checks if the value of the field is `VALUE1`"]
#[inline(always)]
pub fn is_value1(&self) -> bool {
**self == RUN_A::VALUE1
}
#[doc = "Checks if the value of the field is `VALUE2`"]
#[inline(always)]
pub fn is_value2(&self) -> bool {
**self == RUN_A::VALUE2
}
}
impl core::ops::Deref for RUN_R {
type Target = crate::FieldReader<bool, RUN_A>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl R {
#[doc = "Bits 0:19 - Integer Frequency Divider Value"]
#[inline(always)]
pub fn freq(&self) -> FREQ_R {
FREQ_R::new((self.bits & 0x000f_ffff) as u32)
}
#[doc = "Bits 20:22 - Enables and sets the Mode for DAC1"]
#[inline(always)]
pub fn mode(&self) -> MODE_R {
MODE_R::new(((self.bits >> 20) & 0x07) as u8)
}
#[doc = "Bit 23 - Selects between signed and unsigned DAC1 mode"]
#[inline(always)]
pub fn sign(&self) -> SIGN_R {
SIGN_R::new(((self.bits >> 23) & 0x01) != 0)
}
#[doc = "Bits 24:25 - Current write position inside the data FIFO"]
#[inline(always)]
pub fn fifoind(&self) -> FIFOIND_R {
FIFOIND_R::new(((self.bits >> 24) & 0x03) as u8)
}
#[doc = "Bit 26 - Indicate if the FIFO is empty"]
#[inline(always)]
pub fn fifoemp(&self) -> FIFOEMP_R {
FIFOEMP_R::new(((self.bits >> 26) & 0x01) != 0)
}
#[doc = "Bit 27 - Indicate if the FIFO is full"]
#[inline(always)]
pub fn fifoful(&self) -> FIFOFUL_R {
FIFOFUL_R::new(((self.bits >> 27) & 0x01) != 0)
}
#[doc = "Bit 29 - Enable sign output of DAC1 pattern generator"]
#[inline(always)]
pub fn signen(&self) -> SIGNEN_R {
SIGNEN_R::new(((self.bits >> 29) & 0x01) != 0)
}
#[doc = "Bit 30 - Enable DAC1 service request interrupt generation"]
#[inline(always)]
pub fn sren(&self) -> SREN_R {
SREN_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 31 - RUN indicates the current DAC1 operation status"]
#[inline(always)]
pub fn run(&self) -> RUN_R {
RUN_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:19 - Integer Frequency Divider Value"]
#[inline(always)]
pub fn freq(&mut self) -> FREQ_W {
FREQ_W { w: self }
}
#[doc = "Bits 20:22 - Enables and sets the Mode for DAC1"]
#[inline(always)]
pub fn mode(&mut self) -> MODE_W {
MODE_W { w: self }
}
#[doc = "Bit 23 - Selects between signed and unsigned DAC1 mode"]
#[inline(always)]
pub fn sign(&mut self) -> SIGN_W {
SIGN_W { w: self }
}
#[doc = "Bit 29 - Enable sign output of DAC1 pattern generator"]
#[inline(always)]
pub fn signen(&mut self) -> SIGNEN_W {
SIGNEN_W { w: self }
}
#[doc = "Bit 30 - Enable DAC1 service request interrupt generation"]
#[inline(always)]
pub fn sren(&mut self) -> SREN_W {
SREN_W { w: self }
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "DAC1 Configuration Register 0\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dac1cfg0](index.html) module"]
pub struct DAC1CFG0_SPEC;
impl crate::RegisterSpec for DAC1CFG0_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [dac1cfg0::R](R) reader structure"]
impl crate::Readable for DAC1CFG0_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [dac1cfg0::W](W) writer structure"]
impl crate::Writable for DAC1CFG0_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets DAC1CFG0 to value 0"]
impl crate::Resettable for DAC1CFG0_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0
}
}
| 29.476987 | 418 | 0.565507 |
bca52694892f5babce283ad8c0938a6516fad3ee | 13,863 | asm | Assembly | rop/rop.asm | cosmincojocar/syssec | 2ebaabefd3b21a3361608af145ca52ebcd13c94f | [
"Apache-2.0"
] | 1 | 2016-01-02T08:28:21.000Z | 2016-01-02T08:28:21.000Z | rop/rop.asm | coding-freedom/syssec | 2ebaabefd3b21a3361608af145ca52ebcd13c94f | [
"Apache-2.0"
] | null | null | null | rop/rop.asm | coding-freedom/syssec | 2ebaabefd3b21a3361608af145ca52ebcd13c94f | [
"Apache-2.0"
] | null | null | null |
rop: file format elf32-i386
Disassembly of section .init:
08048358 <_init>:
8048358: 53 push %ebx
8048359: 83 ec 08 sub $0x8,%esp
804835c: e8 df 00 00 00 call 8048440 <__x86.get_pc_thunk.bx>
8048361: 81 c3 eb 15 00 00 add $0x15eb,%ebx
8048367: 8b 83 fc ff ff ff mov -0x4(%ebx),%eax
804836d: 85 c0 test %eax,%eax
804836f: 74 05 je 8048376 <_init+0x1e>
8048371: e8 5a 00 00 00 call 80483d0 <__gmon_start__@plt>
8048376: 83 c4 08 add $0x8,%esp
8048379: 5b pop %ebx
804837a: c3 ret
Disassembly of section .plt:
08048380 <printf@plt-0x10>:
8048380: ff 35 50 99 04 08 pushl 0x8049950
8048386: ff 25 54 99 04 08 jmp *0x8049954
804838c: 00 00 add %al,(%eax)
...
08048390 <printf@plt>:
8048390: ff 25 58 99 04 08 jmp *0x8049958
8048396: 68 00 00 00 00 push $0x0
804839b: e9 e0 ff ff ff jmp 8048380 <_init+0x28>
080483a0 <fgets@plt>:
80483a0: ff 25 5c 99 04 08 jmp *0x804995c
80483a6: 68 08 00 00 00 push $0x8
80483ab: e9 d0 ff ff ff jmp 8048380 <_init+0x28>
080483b0 <strcpy@plt>:
80483b0: ff 25 60 99 04 08 jmp *0x8049960
80483b6: 68 10 00 00 00 push $0x10
80483bb: e9 c0 ff ff ff jmp 8048380 <_init+0x28>
080483c0 <puts@plt>:
80483c0: ff 25 64 99 04 08 jmp *0x8049964
80483c6: 68 18 00 00 00 push $0x18
80483cb: e9 b0 ff ff ff jmp 8048380 <_init+0x28>
080483d0 <__gmon_start__@plt>:
80483d0: ff 25 68 99 04 08 jmp *0x8049968
80483d6: 68 20 00 00 00 push $0x20
80483db: e9 a0 ff ff ff jmp 8048380 <_init+0x28>
080483e0 <strlen@plt>:
80483e0: ff 25 6c 99 04 08 jmp *0x804996c
80483e6: 68 28 00 00 00 push $0x28
80483eb: e9 90 ff ff ff jmp 8048380 <_init+0x28>
080483f0 <__libc_start_main@plt>:
80483f0: ff 25 70 99 04 08 jmp *0x8049970
80483f6: 68 30 00 00 00 push $0x30
80483fb: e9 80 ff ff ff jmp 8048380 <_init+0x28>
08048400 <setuid@plt>:
8048400: ff 25 74 99 04 08 jmp *0x8049974
8048406: 68 38 00 00 00 push $0x38
804840b: e9 70 ff ff ff jmp 8048380 <_init+0x28>
Disassembly of section .text:
08048410 <_start>:
8048410: 31 ed xor %ebp,%ebp
8048412: 5e pop %esi
8048413: 89 e1 mov %esp,%ecx
8048415: 83 e4 f0 and $0xfffffff0,%esp
8048418: 50 push %eax
8048419: 54 push %esp
804841a: 52 push %edx
804841b: 68 80 86 04 08 push $0x8048680
8048420: 68 20 86 04 08 push $0x8048620
8048425: 51 push %ecx
8048426: 56 push %esi
8048427: 68 3c 85 04 08 push $0x804853c
804842c: e8 bf ff ff ff call 80483f0 <__libc_start_main@plt>
8048431: f4 hlt
8048432: 66 90 xchg %ax,%ax
8048434: 66 90 xchg %ax,%ax
8048436: 66 90 xchg %ax,%ax
8048438: 66 90 xchg %ax,%ax
804843a: 66 90 xchg %ax,%ax
804843c: 66 90 xchg %ax,%ax
804843e: 66 90 xchg %ax,%ax
08048440 <__x86.get_pc_thunk.bx>:
8048440: 8b 1c 24 mov (%esp),%ebx
8048443: c3 ret
8048444: 66 90 xchg %ax,%ax
8048446: 66 90 xchg %ax,%ax
8048448: 66 90 xchg %ax,%ax
804844a: 66 90 xchg %ax,%ax
804844c: 66 90 xchg %ax,%ax
804844e: 66 90 xchg %ax,%ax
08048450 <deregister_tm_clones>:
8048450: b8 87 99 04 08 mov $0x8049987,%eax
8048455: 2d 84 99 04 08 sub $0x8049984,%eax
804845a: 83 f8 06 cmp $0x6,%eax
804845d: 76 1a jbe 8048479 <deregister_tm_clones+0x29>
804845f: b8 00 00 00 00 mov $0x0,%eax
8048464: 85 c0 test %eax,%eax
8048466: 74 11 je 8048479 <deregister_tm_clones+0x29>
8048468: 55 push %ebp
8048469: 89 e5 mov %esp,%ebp
804846b: 83 ec 14 sub $0x14,%esp
804846e: 68 84 99 04 08 push $0x8049984
8048473: ff d0 call *%eax
8048475: 83 c4 10 add $0x10,%esp
8048478: c9 leave
8048479: f3 c3 repz ret
804847b: 90 nop
804847c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
08048480 <register_tm_clones>:
8048480: b8 84 99 04 08 mov $0x8049984,%eax
8048485: 2d 84 99 04 08 sub $0x8049984,%eax
804848a: c1 f8 02 sar $0x2,%eax
804848d: 89 c2 mov %eax,%edx
804848f: c1 ea 1f shr $0x1f,%edx
8048492: 01 d0 add %edx,%eax
8048494: d1 f8 sar %eax
8048496: 74 1b je 80484b3 <register_tm_clones+0x33>
8048498: ba 00 00 00 00 mov $0x0,%edx
804849d: 85 d2 test %edx,%edx
804849f: 74 12 je 80484b3 <register_tm_clones+0x33>
80484a1: 55 push %ebp
80484a2: 89 e5 mov %esp,%ebp
80484a4: 83 ec 10 sub $0x10,%esp
80484a7: 50 push %eax
80484a8: 68 84 99 04 08 push $0x8049984
80484ad: ff d2 call *%edx
80484af: 83 c4 10 add $0x10,%esp
80484b2: c9 leave
80484b3: f3 c3 repz ret
80484b5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
80484b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
080484c0 <__do_global_dtors_aux>:
80484c0: 80 3d a4 99 04 08 00 cmpb $0x0,0x80499a4
80484c7: 75 13 jne 80484dc <__do_global_dtors_aux+0x1c>
80484c9: 55 push %ebp
80484ca: 89 e5 mov %esp,%ebp
80484cc: 83 ec 08 sub $0x8,%esp
80484cf: e8 7c ff ff ff call 8048450 <deregister_tm_clones>
80484d4: c6 05 a4 99 04 08 01 movb $0x1,0x80499a4
80484db: c9 leave
80484dc: f3 c3 repz ret
80484de: 66 90 xchg %ax,%ax
080484e0 <frame_dummy>:
80484e0: b8 5c 98 04 08 mov $0x804985c,%eax
80484e5: 8b 10 mov (%eax),%edx
80484e7: 85 d2 test %edx,%edx
80484e9: 75 05 jne 80484f0 <frame_dummy+0x10>
80484eb: eb 93 jmp 8048480 <register_tm_clones>
80484ed: 8d 76 00 lea 0x0(%esi),%esi
80484f0: ba 00 00 00 00 mov $0x0,%edx
80484f5: 85 d2 test %edx,%edx
80484f7: 74 f2 je 80484eb <frame_dummy+0xb>
80484f9: 55 push %ebp
80484fa: 89 e5 mov %esp,%ebp
80484fc: 83 ec 14 sub $0x14,%esp
80484ff: 50 push %eax
8048500: ff d2 call *%edx
8048502: 83 c4 10 add $0x10,%esp
8048505: c9 leave
8048506: e9 75 ff ff ff jmp 8048480 <register_tm_clones>
0804850b <print_test>:
804850b: 55 push %ebp
804850c: 89 e5 mov %esp,%ebp
804850e: 8b 45 08 mov 0x8(%ebp),%eax
8048511: 8b 00 mov (%eax),%eax
8048513: 50 push %eax
8048514: 68 a0 86 04 08 push $0x80486a0
8048519: e8 72 fe ff ff call 8048390 <printf@plt>
804851e: 83 c4 08 add $0x8,%esp
8048521: 90 nop
8048522: c9 leave
8048523: c3 ret
08048524 <cpybuf>:
8048524: 55 push %ebp
8048525: 89 e5 mov %esp,%ebp
8048527: 83 ec 14 sub $0x14,%esp
804852a: ff 75 08 pushl 0x8(%ebp)
804852d: 8d 45 ec lea -0x14(%ebp),%eax
8048530: 50 push %eax
8048531: e8 7a fe ff ff call 80483b0 <strcpy@plt>
8048536: 83 c4 08 add $0x8,%esp
8048539: 90 nop
804853a: c9 leave
804853b: c3 ret
0804853c <main>:
804853c: 55 push %ebp
804853d: 89 e5 mov %esp,%ebp
804853f: 83 7d 08 02 cmpl $0x2,0x8(%ebp)
8048543: 74 1d je 8048562 <main+0x26>
8048545: 8b 45 0c mov 0xc(%ebp),%eax
8048548: 8b 00 mov (%eax),%eax
804854a: 50 push %eax
804854b: 68 b6 86 04 08 push $0x80486b6
8048550: e8 3b fe ff ff call 8048390 <printf@plt>
8048555: 83 c4 08 add $0x8,%esp
8048558: b8 01 00 00 00 mov $0x1,%eax
804855d: e9 bb 00 00 00 jmp 804861d <main+0xe1>
8048562: 6a 00 push $0x0
8048564: e8 97 fe ff ff call 8048400 <setuid@plt>
8048569: 83 c4 04 add $0x4,%esp
804856c: 68 c9 86 04 08 push $0x80486c9
8048571: e8 1a fe ff ff call 8048390 <printf@plt>
8048576: 83 c4 04 add $0x4,%esp
8048579: a1 a0 99 04 08 mov 0x80499a0,%eax
804857e: 50 push %eax
804857f: 6a 14 push $0x14
8048581: 68 a8 99 04 08 push $0x80499a8
8048586: e8 15 fe ff ff call 80483a0 <fgets@plt>
804858b: 83 c4 0c add $0xc,%esp
804858e: 68 a8 99 04 08 push $0x80499a8
8048593: e8 48 fe ff ff call 80483e0 <strlen@plt>
8048598: 83 c4 04 add $0x4,%esp
804859b: 83 e8 01 sub $0x1,%eax
804859e: 0f b6 80 a8 99 04 08 movzbl 0x80499a8(%eax),%eax
80485a5: 3c 0a cmp $0xa,%al
80485a7: 74 1b je 80485c4 <main+0x88>
80485a9: 68 a8 99 04 08 push $0x80499a8
80485ae: e8 2d fe ff ff call 80483e0 <strlen@plt>
80485b3: 83 c4 04 add $0x4,%esp
80485b6: 83 e8 01 sub $0x1,%eax
80485b9: 0f b6 80 a8 99 04 08 movzbl 0x80499a8(%eax),%eax
80485c0: 3c 0d cmp $0xd,%al
80485c2: 75 17 jne 80485db <main+0x9f>
80485c4: 68 a8 99 04 08 push $0x80499a8
80485c9: e8 12 fe ff ff call 80483e0 <strlen@plt>
80485ce: 83 c4 04 add $0x4,%esp
80485d1: 83 e8 01 sub $0x1,%eax
80485d4: c6 80 a8 99 04 08 00 movb $0x0,0x80499a8(%eax)
80485db: 68 a8 99 04 08 push $0x80499a8
80485e0: 68 e2 86 04 08 push $0x80486e2
80485e5: e8 a6 fd ff ff call 8048390 <printf@plt>
80485ea: 83 c4 08 add $0x8,%esp
80485ed: 8b 45 0c mov 0xc(%ebp),%eax
80485f0: 83 c0 04 add $0x4,%eax
80485f3: 8b 00 mov (%eax),%eax
80485f5: 50 push %eax
80485f6: e8 29 ff ff ff call 8048524 <cpybuf>
80485fb: 83 c4 04 add $0x4,%esp
80485fe: 68 fb 86 04 08 push $0x80486fb
8048603: e8 b8 fd ff ff call 80483c0 <puts@plt>
8048608: 83 c4 04 add $0x4,%esp
804860b: 68 80 99 04 08 push $0x8049980
8048610: e8 f6 fe ff ff call 804850b <print_test>
8048615: 83 c4 04 add $0x4,%esp
8048618: b8 00 00 00 00 mov $0x0,%eax
804861d: c9 leave
804861e: c3 ret
804861f: 90 nop
08048620 <__libc_csu_init>:
8048620: 55 push %ebp
8048621: 57 push %edi
8048622: 56 push %esi
8048623: 53 push %ebx
8048624: e8 17 fe ff ff call 8048440 <__x86.get_pc_thunk.bx>
8048629: 81 c3 23 13 00 00 add $0x1323,%ebx
804862f: 83 ec 0c sub $0xc,%esp
8048632: 8b 6c 24 20 mov 0x20(%esp),%ebp
8048636: 8d b3 0c ff ff ff lea -0xf4(%ebx),%esi
804863c: e8 17 fd ff ff call 8048358 <_init>
8048641: 8d 83 08 ff ff ff lea -0xf8(%ebx),%eax
8048647: 29 c6 sub %eax,%esi
8048649: c1 fe 02 sar $0x2,%esi
804864c: 85 f6 test %esi,%esi
804864e: 74 25 je 8048675 <__libc_csu_init+0x55>
8048650: 31 ff xor %edi,%edi
8048652: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
8048658: 83 ec 04 sub $0x4,%esp
804865b: ff 74 24 2c pushl 0x2c(%esp)
804865f: ff 74 24 2c pushl 0x2c(%esp)
8048663: 55 push %ebp
8048664: ff 94 bb 08 ff ff ff call *-0xf8(%ebx,%edi,4)
804866b: 83 c7 01 add $0x1,%edi
804866e: 83 c4 10 add $0x10,%esp
8048671: 39 f7 cmp %esi,%edi
8048673: 75 e3 jne 8048658 <__libc_csu_init+0x38>
8048675: 83 c4 0c add $0xc,%esp
8048678: 5b pop %ebx
8048679: 5e pop %esi
804867a: 5f pop %edi
804867b: 5d pop %ebp
804867c: c3 ret
804867d: 8d 76 00 lea 0x0(%esi),%esi
08048680 <__libc_csu_fini>:
8048680: f3 c3 repz ret
Disassembly of section .fini:
08048684 <_fini>:
8048684: 53 push %ebx
8048685: 83 ec 08 sub $0x8,%esp
8048688: e8 b3 fd ff ff call 8048440 <__x86.get_pc_thunk.bx>
804868d: 81 c3 bf 12 00 00 add $0x12bf,%ebx
8048693: 83 c4 08 add $0x8,%esp
8048696: 5b pop %ebx
8048697: c3 ret
| 43.870253 | 75 | 0.506817 |
df19613cd9467f37237dafbbd96d0d43d1680641 | 7,671 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i3-7100_9_0x84_notsx.log_21829_1361.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i3-7100_9_0x84_notsx.log_21829_1361.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_ht_zr_un_/i3-7100_9_0x84_notsx.log_21829_1361.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xd88b, %rax
clflush (%rax)
nop
nop
nop
nop
nop
inc %r8
mov (%rax), %r12w
nop
nop
nop
nop
nop
cmp $43449, %rcx
lea addresses_WC_ht+0x31d3, %rsi
lea addresses_WC_ht+0x5a8b, %rdi
nop
nop
and %r11, %r11
mov $115, %rcx
rep movsw
nop
nop
nop
nop
cmp $21519, %rsi
lea addresses_normal_ht+0xe803, %rsi
nop
nop
nop
sub $17786, %r11
movw $0x6162, (%rsi)
and $16048, %rsi
lea addresses_WT_ht+0x69ab, %r12
nop
nop
nop
nop
xor $49980, %rcx
mov (%r12), %r8
add %r12, %r12
lea addresses_normal_ht+0xf17b, %r8
nop
nop
nop
and $40038, %rdi
movb (%r8), %r11b
nop
nop
nop
nop
nop
sub %rax, %rax
lea addresses_WT_ht+0x8d0b, %r12
nop
nop
nop
nop
sub %r11, %r11
mov (%r12), %edi
cmp %rdi, %rdi
lea addresses_WC_ht+0x188b, %rdi
nop
nop
add $6064, %r8
mov (%rdi), %ax
nop
and %rcx, %rcx
lea addresses_UC_ht+0x1cc8b, %rsi
lea addresses_A_ht+0x268b, %rdi
nop
nop
add $4175, %r12
mov $48, %rcx
rep movsw
nop
add $48646, %r11
lea addresses_normal_ht+0x508b, %rsi
nop
nop
nop
inc %r8
movups (%rsi), %xmm7
vpextrq $0, %xmm7, %r12
nop
nop
nop
nop
add $17840, %r11
lea addresses_normal_ht+0x20b, %rsi
lea addresses_WT_ht+0x1d89a, %rdi
clflush (%rsi)
nop
add $13802, %r12
mov $66, %rcx
rep movsb
nop
nop
nop
nop
nop
and $1828, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r15
push %r8
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0x1098e, %r8
nop
cmp %rcx, %rcx
mov $0x5152535455565758, %r11
movq %r11, %xmm4
vmovups %ymm4, (%r8)
nop
nop
dec %r14
// Load
lea addresses_normal+0x1ec8b, %r11
nop
xor %rbx, %rbx
mov (%r11), %r8d
nop
nop
nop
inc %r15
// Store
lea addresses_normal+0x15d87, %r14
nop
nop
nop
nop
inc %rbx
movl $0x51525354, (%r14)
nop
nop
nop
nop
nop
xor $47221, %r15
// REPMOV
lea addresses_normal+0x48b, %rsi
lea addresses_RW+0xd48b, %rdi
nop
nop
nop
sub $6275, %r15
mov $82, %rcx
rep movsb
nop
nop
nop
nop
nop
cmp $37456, %rdi
// Faulty Load
lea addresses_RW+0xd48b, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
inc %r8
vmovaps (%rbx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %r14
lea oracles, %rdi
and $0xff, %r14
shlq $12, %r14
mov (%rdi,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r15
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_RW', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'src': {'type': 'addresses_normal', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_RW', 'congruent': 0, 'same': True}, 'OP': 'REPM'}
[Faulty Load]
{'src': {'type': 'addresses_RW', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 2, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 8, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'d6': 6, '48': 214, '03': 2, '22': 1, '47': 1, '02': 57, '8b': 333, '00': 21212, 'a8': 1, '6c': 1, 'ab': 1}
00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 48 00 00 00 48 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 48 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8b 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 32.367089 | 2,999 | 0.653109 |
9c2d542181ce07c39e7d6154ff6c1b7426f586e2 | 3,152 | js | JavaScript | packages/web-pdm-lib/es/tree/index.js | nonobabaya/web-pdm | 27617b0bb6fbf8f2e682df40f9457126b6a15a3f | [
"Apache-2.0"
] | 175 | 2020-03-16T03:23:42.000Z | 2022-03-28T08:55:02.000Z | packages/web-pdm-lib/es/tree/index.js | nonobabaya/web-pdm | 27617b0bb6fbf8f2e682df40f9457126b6a15a3f | [
"Apache-2.0"
] | 20 | 2020-06-30T04:52:20.000Z | 2021-11-12T02:26:56.000Z | packages/web-pdm-lib/es/tree/index.js | nonobabaya/web-pdm | 27617b0bb6fbf8f2e682df40f9457126b6a15a3f | [
"Apache-2.0"
] | 46 | 2020-04-09T02:05:38.000Z | 2022-03-15T10:51:47.000Z | import "antd/es/tree/style/css";
import _Tree from "antd/es/tree";
import "antd/es/dropdown/style/css";
import _Dropdown from "antd/es/dropdown";
import "antd/es/menu/style/css";
import _Menu from "antd/es/menu";
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useState, useCallback } from 'react'; // import 'antd/dist/antd.less'
import './style.scss'; // const click = () => alert()
var OptionBuilder = function OptionBuilder(_ref) {
var data = _ref.data;
var title = data.title,
_data$options = data.options,
options = _data$options === void 0 ? [] : _data$options;
var _useState = useState(false),
_useState2 = _slicedToArray(_useState, 2),
showMenu = _useState2[0],
setShowMenu = _useState2[1];
var onShowMenu = useCallback(function (val) {
return function () {
setShowMenu(val);
};
}, []);
var menu = /*#__PURE__*/React.createElement(_Menu, null, options.map(function (option) {
return /*#__PURE__*/React.createElement(_Menu.Item, {
key: option
}, /*#__PURE__*/React.createElement("a", {
onClick: option.click
}, option.title));
}));
return /*#__PURE__*/React.createElement("div", {
className: 'tree-node-title',
onMouseEnter: onShowMenu(true),
onMouseLeave: onShowMenu(false)
}, /*#__PURE__*/React.createElement("span", {
className: 'tree-node-title-title'
}, title), !!options.length && showMenu && /*#__PURE__*/React.createElement(_Dropdown, {
overlay: menu
}, /*#__PURE__*/React.createElement("span", {
className: 'tree-node-title-options'
}, "...")));
}; // alert()
_Tree['OptionBuilder'] = OptionBuilder;
export var Tree = _Tree; | 50.83871 | 489 | 0.65514 |
51ca2060008b6ee01bd98f66cad66c7197f8dbbc | 2,736 | dart | Dart | lib/database/database_scripts.dart | mpgamelas/clear_diary | a3d023c986062e650a518f81a28f8aad516d1438 | [
"MIT"
] | null | null | null | lib/database/database_scripts.dart | mpgamelas/clear_diary | a3d023c986062e650a518f81a28f8aad516d1438 | [
"MIT"
] | null | null | null | lib/database/database_scripts.dart | mpgamelas/clear_diary | a3d023c986062e650a518f81a28f8aad516d1438 | [
"MIT"
] | null | null | null |
import 'package:clear_diary/database/contract/entry_tag_contract.dart';
import 'package:clear_diary/database/contract/log_contract.dart';
import 'package:clear_diary/database/contract/tag_contract.dart';
import 'contract/entry_contract.dart';
///Map with the scripts used for each schema version
final Map<int, List<String>> migrationScripts = {
1: [createTableEntry, createTableTag, createTableEntryTag],
2: [createTableLogger],
};
final List<String> configureScripts = [
pragmaCaseInsensitive,
pragmaForeignKeys,
];
const String createTableEntry = '''
CREATE TABLE IF NOT EXISTS ${EntryContract.entry_table} (
${EntryContract.idColumn} INTEGER PRIMARY KEY,
${EntryContract.dateCreatedColumn} INTEGER NOT NULL,
${EntryContract.dateModifedColumn} INTEGER NOT NULL,
${EntryContract.dateAssignedColumn} INTEGER,
${EntryContract.titleColumn} TEXT,
${EntryContract.bodyColumn} TEXT
);
''';
const String createTableTag =
'''CREATE TABLE IF NOT EXISTS ${TagContract.tags_table} (
${TagContract.tagIdColumn} INTEGER PRIMARY KEY,
${TagContract.tagDateCreatedColumn} INTEGER NOT NULL,
${TagContract.tagDateModifiedColumn} INTEGER NOT NULL,
${TagContract.tagColumn} TEXT NOT NULL,
UNIQUE(${TagContract.tagColumn})
);''';
const String createTableEntryTag =
'''CREATE TABLE IF NOT EXISTS ${EntryTagContract.entry_tag_table} (
${EntryContract.idColumn} INTEGER NOT NULL,
${TagContract.tagIdColumn} INTEGER NOT NULL,
FOREIGN KEY(${EntryContract.idColumn}) REFERENCES ${EntryContract.entry_table}(${EntryContract.idColumn})
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN KEY(${TagContract.tagIdColumn}) REFERENCES ${TagContract.tags_table}(${TagContract.tagIdColumn})
ON UPDATE CASCADE
ON DELETE CASCADE,
UNIQUE(${EntryContract.idColumn}, ${TagContract.tagIdColumn})
);
''';
const String createTableLogger =
'''CREATE TABLE IF NOT EXISTS ${LogContract.table} (
${LogContract.idColumn} INTEGER PRIMARY KEY,
${LogContract.debugColumn} TEXT,
${LogContract.exceptionColumn} TEXT,
${LogContract.stackColumn} TEXT,
${LogContract.dateColumn} INTEGER NOT NULL,
${LogContract.levelColumn} INTEGER NOT NULL
);''';
///So that the LIKE operator in SQL is case sensitive.
const String pragmaCaseInsensitive = '''PRAGMA case_sensitive_like = TRUE''';
///So that foreign keys are used.
const String pragmaForeignKeys = '''PRAGMA foreign_keys = ON;''';
| 40.235294 | 117 | 0.669225 |
83af567f1017409dd8765f71b7576379ab4d5f84 | 567 | rs | Rust | noodles-bam/src/record/cigar/ops.rs | natir/noodles | 1ab5e60693ede58d800f247cd8ea3f561210e38e | [
"MIT"
] | 201 | 2020-05-04T22:00:28.000Z | 2022-03-31T16:51:19.000Z | noodles-bam/src/record/cigar/ops.rs | kamenchunathan/noodles | aa3282a2c958b30123831416ec1a2312f5d809f7 | [
"MIT"
] | 75 | 2020-07-22T08:32:12.000Z | 2022-03-23T21:03:46.000Z | noodles-bam/src/record/cigar/ops.rs | kamenchunathan/noodles | aa3282a2c958b30123831416ec1a2312f5d809f7 | [
"MIT"
] | 28 | 2018-12-02T19:12:30.000Z | 2022-03-31T15:07:13.000Z | use std::{io, slice};
use super::Op;
/// An iterator over the operations of a CIGAR.
///
/// This is created by calling [`super::Cigar::ops`].
pub struct Ops<'a>(slice::Iter<'a, u32>);
impl<'a> Ops<'a> {
pub(crate) fn new(cigar: &'a [u32]) -> Self {
Self(cigar.iter())
}
}
impl<'a> Iterator for Ops<'a> {
type Item = io::Result<Op>;
fn next(&mut self) -> Option<Self::Item> {
self.0
.next()
.copied()
.map(|n| Op::try_from(n).map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e)))
}
}
| 21.807692 | 96 | 0.534392 |
74e2f15f715062d5ed59d9f3190db034ae2ccee7 | 776 | dart | Dart | lib/repository/internal/settings_local_repository.dart | jhomlala/logstf | aa2e67263a6f4eafdd8a9ff89792960d3be9c836 | [
"Apache-2.0"
] | 3 | 2019-08-29T22:38:12.000Z | 2020-10-23T14:57:24.000Z | lib/repository/internal/settings_local_repository.dart | jhomlala/logstf | aa2e67263a6f4eafdd8a9ff89792960d3be9c836 | [
"Apache-2.0"
] | null | null | null | lib/repository/internal/settings_local_repository.dart | jhomlala/logstf | aa2e67263a6f4eafdd8a9ff89792960d3be9c836 | [
"Apache-2.0"
] | 2 | 2021-10-13T09:29:03.000Z | 2021-11-07T16:43:55.000Z | import 'dart:convert';
import 'package:logstf/model/internal/app_settings.dart';
import 'package:logstf/utils/app_const.dart';
import 'package:shared_preferences/shared_preferences.dart';
class SettingsLocalRepository {
Future<AppSettings> getAppSettings() async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
String appSettingsJson = prefs.getString(AppConst.settingsKey);
if (appSettingsJson != null) {
return AppSettings.fromJson(json.decode(appSettingsJson));
} else {
return null;
}
}
void saveAppSettings(AppSettings appSettings) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString(AppConst.settingsKey, json.encode(appSettings.toJson()));
}
}
| 33.73913 | 83 | 0.759021 |
2843e49f24c41728b2dfc05c4b635a1c6471a305 | 4,148 | cpp | C++ | vrclient_x64/vrclient_x64/cppIVRCompositor_IVRCompositor_007.cpp | SSYSS000/Proton | 79ddcc55688fffae9a74f230d825b1dbd6db82a9 | [
"MIT",
"BSD-3-Clause"
] | 17,337 | 2018-08-21T21:43:27.000Z | 2022-03-31T18:06:05.000Z | vrclient_x64/vrclient_x64/cppIVRCompositor_IVRCompositor_007.cpp | SSYSS000/Proton | 79ddcc55688fffae9a74f230d825b1dbd6db82a9 | [
"MIT",
"BSD-3-Clause"
] | 5,641 | 2018-08-21T22:40:50.000Z | 2022-03-31T23:58:40.000Z | vrclient_x64/vrclient_x64/cppIVRCompositor_IVRCompositor_007.cpp | SSYSS000/Proton | 79ddcc55688fffae9a74f230d825b1dbd6db82a9 | [
"MIT",
"BSD-3-Clause"
] | 910 | 2018-08-21T22:54:53.000Z | 2022-03-29T17:35:31.000Z | #include "vrclient_private.h"
#include "vrclient_defs.h"
#include "openvr_v0.9.8/openvr.h"
using namespace vr;
extern "C" {
#include "struct_converters.h"
}
#include "cppIVRCompositor_IVRCompositor_007.h"
#ifdef __cplusplus
extern "C" {
#endif
uint32_t cppIVRCompositor_IVRCompositor_007_GetLastError(void *linux_side, char * pchBuffer, uint32_t unBufferSize)
{
return ((IVRCompositor*)linux_side)->GetLastError((char *)pchBuffer, (uint32_t)unBufferSize);
}
void cppIVRCompositor_IVRCompositor_007_SetVSync(void *linux_side, bool bVSync)
{
((IVRCompositor*)linux_side)->SetVSync((bool)bVSync);
}
bool cppIVRCompositor_IVRCompositor_007_GetVSync(void *linux_side)
{
return ((IVRCompositor*)linux_side)->GetVSync();
}
void cppIVRCompositor_IVRCompositor_007_SetGamma(void *linux_side, float fGamma)
{
((IVRCompositor*)linux_side)->SetGamma((float)fGamma);
}
float cppIVRCompositor_IVRCompositor_007_GetGamma(void *linux_side)
{
return ((IVRCompositor*)linux_side)->GetGamma();
}
vr::VRCompositorError cppIVRCompositor_IVRCompositor_007_WaitGetPoses(void *linux_side, TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount)
{
return ((IVRCompositor*)linux_side)->WaitGetPoses((vr::TrackedDevicePose_t *)pRenderPoseArray, (uint32_t)unRenderPoseArrayCount, (vr::TrackedDevicePose_t *)pGamePoseArray, (uint32_t)unGamePoseArrayCount);
}
vr::VRCompositorError cppIVRCompositor_IVRCompositor_007_Submit(void *linux_side, Hmd_Eye eEye, GraphicsAPIConvention eTextureType, void * pTexture, VRTextureBounds_t * pBounds)
{
return ((IVRCompositor*)linux_side)->Submit((vr::Hmd_Eye)eEye, (vr::GraphicsAPIConvention)eTextureType, (void *)pTexture, (const vr::VRTextureBounds_t *)pBounds);
}
void cppIVRCompositor_IVRCompositor_007_ClearLastSubmittedFrame(void *linux_side)
{
((IVRCompositor*)linux_side)->ClearLastSubmittedFrame();
}
bool cppIVRCompositor_IVRCompositor_007_GetFrameTiming(void *linux_side, winCompositor_FrameTiming_098 * pTiming, uint32_t unFramesAgo)
{
Compositor_FrameTiming lin;
bool _ret;
if(pTiming)
struct_Compositor_FrameTiming_098_win_to_lin(pTiming, &lin);
_ret = ((IVRCompositor*)linux_side)->GetFrameTiming(pTiming ? &lin : nullptr, (uint32_t)unFramesAgo);
if(pTiming)
struct_Compositor_FrameTiming_098_lin_to_win(&lin, pTiming);
return _ret;
}
void cppIVRCompositor_IVRCompositor_007_FadeToColor(void *linux_side, float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground)
{
((IVRCompositor*)linux_side)->FadeToColor((float)fSeconds, (float)fRed, (float)fGreen, (float)fBlue, (float)fAlpha, (bool)bBackground);
}
void cppIVRCompositor_IVRCompositor_007_FadeGrid(void *linux_side, float fSeconds, bool bFadeIn)
{
((IVRCompositor*)linux_side)->FadeGrid((float)fSeconds, (bool)bFadeIn);
}
void cppIVRCompositor_IVRCompositor_007_CompositorBringToFront(void *linux_side)
{
((IVRCompositor*)linux_side)->CompositorBringToFront();
}
void cppIVRCompositor_IVRCompositor_007_CompositorGoToBack(void *linux_side)
{
((IVRCompositor*)linux_side)->CompositorGoToBack();
}
void cppIVRCompositor_IVRCompositor_007_CompositorQuit(void *linux_side)
{
((IVRCompositor*)linux_side)->CompositorQuit();
}
bool cppIVRCompositor_IVRCompositor_007_IsFullscreen(void *linux_side)
{
return ((IVRCompositor*)linux_side)->IsFullscreen();
}
void cppIVRCompositor_IVRCompositor_007_SetTrackingSpace(void *linux_side, TrackingUniverseOrigin eOrigin)
{
((IVRCompositor*)linux_side)->SetTrackingSpace((vr::TrackingUniverseOrigin)eOrigin);
}
vr::TrackingUniverseOrigin cppIVRCompositor_IVRCompositor_007_GetTrackingSpace(void *linux_side)
{
return ((IVRCompositor*)linux_side)->GetTrackingSpace();
}
uint32_t cppIVRCompositor_IVRCompositor_007_GetCurrentSceneFocusProcess(void *linux_side)
{
return ((IVRCompositor*)linux_side)->GetCurrentSceneFocusProcess();
}
bool cppIVRCompositor_IVRCompositor_007_CanRenderScene(void *linux_side)
{
return ((IVRCompositor*)linux_side)->CanRenderScene();
}
#ifdef __cplusplus
}
#endif
| 35.452991 | 229 | 0.801591 |
0bb89e9bc4b11618566c516b525db418c9d0a1b7 | 742 | py | Python | 079_039_189/ngram_2/get_10_summary.py | Aditya-AS/Question-Answering-System | 22c3fe549c03a3b5ba1f86befef3c9f91278d3fc | [
"MIT"
] | null | null | null | 079_039_189/ngram_2/get_10_summary.py | Aditya-AS/Question-Answering-System | 22c3fe549c03a3b5ba1f86befef3c9f91278d3fc | [
"MIT"
] | null | null | null | 079_039_189/ngram_2/get_10_summary.py | Aditya-AS/Question-Answering-System | 22c3fe549c03a3b5ba1f86befef3c9f91278d3fc | [
"MIT"
] | null | null | null | """
Sanjay Reddy S-2013A7PS189P
Aditya Sarma -2013A7PS079P
Vamsi T -2013A7PS039P
Artificial Intelligence Term Project
"""
import pickle
import BeautifulSoup
import re
import boto
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from google import search
def get_10_summary(query, source="google"):
"""
This function returns the first ten (or less, if 10 are not present) summaries when the query (a string) is run on the source (here google).
The return type is a beautifulSoup module's object and is similar to a list
"""
result = search(query) #calls query on google
#print "---------------------------" + str(type(results)) + "---------------------------"
return result
| 25.586207 | 144 | 0.669811 |
f50d5070c0c19b1acf4d73e650b4a661961df657 | 754 | cpp | C++ | Event/window/EventTarget.cpp | Krozark/SFML-Event | c39cf1a0f505f8c12fe12d8e9af1686839b22a84 | [
"BSD-2-Clause"
] | 1 | 2017-12-25T21:12:35.000Z | 2017-12-25T21:12:35.000Z | Event/window/EventTarget.cpp | Krozark/SFML-Event | c39cf1a0f505f8c12fe12d8e9af1686839b22a84 | [
"BSD-2-Clause"
] | null | null | null | Event/window/EventTarget.cpp | Krozark/SFML-Event | c39cf1a0f505f8c12fe12d8e9af1686839b22a84 | [
"BSD-2-Clause"
] | null | null | null | #include "EventTarget.hpp"
#include "../event/EventManager.hpp"
using namespace sf;
namespace event
{
EventTarget::~EventTarget()
{
int size = events.size();
for (int i=0;i<size;++i)
delete events[i];
};
void EventTarget::doEvents()
{
Event event; // gestion des évenements
int size = events.size();
for (int i=0;i<size;++i)
if (events[i]->test())
events[i]->execute(event);
size = momentEvents.size();
while(this->pollEvent(event))
{
for (int i=0;i<size;++i)
if (*momentEvents[i] == event)
{
momentEvents[i]->execute(event);
//break;
}
}
};
};
| 18.85 | 48 | 0.486737 |
7a06142acfb8619f192d2886b80ba84dea3ae70d | 778 | rb | Ruby | spec/models/search_result_spec.rb | hpi-swt2/compass-portal | b818855e86730a491b76fe3c411f3ef8e7e8dd9b | [
"MIT"
] | 17 | 2021-11-19T12:39:29.000Z | 2022-01-08T17:53:35.000Z | spec/models/search_result_spec.rb | hpi-swt2/compass-portal | b818855e86730a491b76fe3c411f3ef8e7e8dd9b | [
"MIT"
] | 255 | 2021-11-22T14:20:01.000Z | 2022-02-18T14:22:00.000Z | spec/models/search_result_spec.rb | hpi-swt2/compass-portal | b818855e86730a491b76fe3c411f3ef8e7e8dd9b | [
"MIT"
] | 1 | 2021-11-26T14:42:57.000Z | 2021-11-26T14:42:57.000Z | require 'rails_helper'
RSpec.describe SearchResult, type: :model do
# Returns a SearchResult instance that's not saved
let(:search_result) { build :search_result }
describe "creation using a factory" do
it "creates a valid object" do
expect(search_result).to be_valid
end
it "sets a title" do
expect(search_result.title).not_to be_blank
end
it "is not persistent" do
expect(search_result.persisted?).to be false
end
it "responds correctly to a position query" do
expect(search_result.position_set?).to be false
search_result_with_location = build :search_result, location_longitude: 52.394163, location_latitude: 13.132283
expect(search_result_with_location.position_set?).to be true
end
end
end
| 27.785714 | 117 | 0.726221 |
3947fd3bc69bd062b5ee46783f0f34972381c019 | 157 | kt | Kotlin | app/src/main/java/com/android/virgilsecurity/ethreenexmodemo/data/model/auth/NexmoResponses.kt | VirgilSecurity/demo-nexmo-chat-e3kit-android | d9f6979bbaa39a8653a700e3be18ad31c51dc482 | [
"BSD-3-Clause"
] | 11 | 2019-06-03T03:25:28.000Z | 2021-03-11T21:22:31.000Z | app/src/main/java/com/android/virgilsecurity/ethreenexmodemo/data/model/auth/NexmoResponses.kt | VirgilSecurity/demo-nexmo-chat-e3kit-android | d9f6979bbaa39a8653a700e3be18ad31c51dc482 | [
"BSD-3-Clause"
] | 13 | 2019-04-03T13:12:12.000Z | 2021-12-15T07:52:55.000Z | app/src/main/java/com/android/virgilsecurity/ethreenexmodemo/data/model/auth/NexmoResponses.kt | VirgilSecurity/demo-nexmo-chat-e3kit-android | d9f6979bbaa39a8653a700e3be18ad31c51dc482 | [
"BSD-3-Clause"
] | 2 | 2019-09-06T13:43:52.000Z | 2019-12-02T15:18:45.000Z | package com.android.virgilsecurity.ethreenexmodemo.data.model.auth
/**
* AuthResponses
*/
data class CreateUserResponse(val id: String, val href: String) | 22.428571 | 66 | 0.783439 |
dac9bf685b12161ab8e1b1c66b7ced1ddea740cd | 1,575 | dart | Dart | lib/src/morphic/rendering/constraints.dart | mzimmerm/flutter_charts | 8f9935d897f2519c6df391fd8161d9134d1760b4 | [
"BSD-2-Clause-FreeBSD"
] | 233 | 2017-11-03T17:48:13.000Z | 2022-03-30T01:27:53.000Z | lib/src/morphic/rendering/constraints.dart | mzimmerm/flutter_charts | 8f9935d897f2519c6df391fd8161d9134d1760b4 | [
"BSD-2-Clause-FreeBSD"
] | 36 | 2017-11-05T18:55:41.000Z | 2022-01-31T18:25:20.000Z | lib/src/morphic/rendering/constraints.dart | mzimmerm/flutter_charts | 8f9935d897f2519c6df391fd8161d9134d1760b4 | [
"BSD-2-Clause-FreeBSD"
] | 46 | 2017-11-29T16:35:36.000Z | 2022-03-01T06:45:05.000Z | /// Defines how a container [layout] should expand the container in a direction.
///
/// Direction can be "width" or "height".
/// Generally,
/// - If direction style is [TryFill], the container should use all
/// available length in the direction (that is, [width] or [height].
/// This is intended to fill a predefined
/// available length, such as when showing X axis labels
/// - If direction style is [GrowDoNotFill], container should use as much space
/// as needed in the direction, but stop "well before" the available length.
/// The "well before" is not really defined here.
/// This is intended to for example layout Y axis in X direction,
/// where we want to put the data container to the right of the Y labels.
/// - If direction style is [Unused], the [layout] should fail on attempted
/// looking at such
///
class LayoutExpansion {
final double width;
final double height;
LayoutExpansion({
required this.width,
required this.height,
bool used = true,
}) {
if (used && width <= 0.0) {
throw StateError('Invalid width $width');
}
if (used && height <= 0.0) {
throw StateError('Invalid height $height');
}
}
/// Named constructor for unused expansion
LayoutExpansion.unused()
: this(
width: -1.0,
height: -1.0,
used: false,
);
LayoutExpansion cloneWith({
double? width,
double? height,
}) {
height ??= this.height;
width ??= this.width;
return LayoutExpansion(width: width, height: height);
}
}
| 30.882353 | 81 | 0.63619 |
2f37a77819c1b039d9531c2bf688db8ddb47b9b9 | 1,229 | java | Java | src/main/java/ca/gc/collectionscanada/gcwa/web/admin/api/CollectionResource.java | gcwa/gcwa-present | d8cad932df33f7a49485efd90b8fc9b72a2abc5a | [
"MIT"
] | null | null | null | src/main/java/ca/gc/collectionscanada/gcwa/web/admin/api/CollectionResource.java | gcwa/gcwa-present | d8cad932df33f7a49485efd90b8fc9b72a2abc5a | [
"MIT"
] | null | null | null | src/main/java/ca/gc/collectionscanada/gcwa/web/admin/api/CollectionResource.java | gcwa/gcwa-present | d8cad932df33f7a49485efd90b8fc9b72a2abc5a | [
"MIT"
] | null | null | null | package ca.gc.collectionscanada.gcwa.web.admin.api;
import ca.gc.collectionscanada.gcwa.domain.Collection;
import ca.gc.collectionscanada.gcwa.domain.CollectionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/admin/api")
public class CollectionResource {
@Autowired
private CollectionRepository collectionRepository;
@RequestMapping(value = "/collections", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<Collection> getAllCollections() {
return collectionRepository.findAll();
}
@RequestMapping(value = "/collections/subcategory/{id:\\d+}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public List<Collection> getAllCollectionsForSubcategory(@PathVariable("id") long id) {
return collectionRepository.findAllBySubcategory_Id(id);
}
}
| 39.645161 | 138 | 0.799837 |
e49a6443de820a891bd90fab2cda93a2e6714a8c | 2,161 | go | Go | cache/relations.go | lukasmartinelli-alt/imposm3 | 54bcfedf72bd78f2c08387eb4570484bc8665bef | [
"Apache-2.0",
"MIT"
] | 2 | 2016-09-14T11:17:56.000Z | 2020-02-09T04:12:27.000Z | cache/relations.go | lukasmartinelli-alt/imposm3 | 54bcfedf72bd78f2c08387eb4570484bc8665bef | [
"Apache-2.0",
"MIT"
] | null | null | null | cache/relations.go | lukasmartinelli-alt/imposm3 | 54bcfedf72bd78f2c08387eb4570484bc8665bef | [
"Apache-2.0",
"MIT"
] | 2 | 2017-08-15T14:46:07.000Z | 2019-01-14T09:00:39.000Z | package cache
import (
"github.com/jmhodges/levigo"
"github.com/omniscale/imposm3/cache/binary"
"github.com/omniscale/imposm3/element"
)
type RelationsCache struct {
cache
}
func newRelationsCache(path string) (*RelationsCache, error) {
cache := RelationsCache{}
cache.options = &globalCacheOptions.Relations
err := cache.open(path)
if err != nil {
return nil, err
}
return &cache, err
}
func (p *RelationsCache) PutRelation(relation *element.Relation) error {
if relation.Id == SKIP {
return nil
}
keyBuf := idToKeyBuf(relation.Id)
data, err := binary.MarshalRelation(relation)
if err != nil {
return err
}
return p.db.Put(p.wo, keyBuf, data)
}
func (p *RelationsCache) PutRelations(rels []element.Relation) error {
batch := levigo.NewWriteBatch()
defer batch.Close()
for _, rel := range rels {
if rel.Id == SKIP {
continue
}
if len(rel.Tags) == 0 {
continue
}
keyBuf := idToKeyBuf(rel.Id)
data, err := binary.MarshalRelation(&rel)
if err != nil {
return err
}
batch.Put(keyBuf, data)
}
return p.db.Write(p.wo, batch)
}
func (p *RelationsCache) Iter() chan *element.Relation {
rels := make(chan *element.Relation)
go func() {
ro := levigo.NewReadOptions()
ro.SetFillCache(false)
it := p.db.NewIterator(ro)
// we need to Close the iter before closing the
// chan (and thus signaling that we are done)
// to avoid race where db is closed before the iterator
defer close(rels)
defer it.Close()
it.SeekToFirst()
for ; it.Valid(); it.Next() {
rel, err := binary.UnmarshalRelation(it.Value())
if err != nil {
panic(err)
}
rel.Id = idFromKeyBuf(it.Key())
rels <- rel
}
}()
return rels
}
func (p *RelationsCache) GetRelation(id int64) (*element.Relation, error) {
keyBuf := idToKeyBuf(id)
data, err := p.db.Get(p.ro, keyBuf)
if err != nil {
return nil, err
}
if data == nil {
return nil, NotFound
}
relation, err := binary.UnmarshalRelation(data)
if err != nil {
return nil, err
}
relation.Id = id
return relation, err
}
func (p *RelationsCache) DeleteRelation(id int64) error {
keyBuf := idToKeyBuf(id)
return p.db.Delete(p.wo, keyBuf)
}
| 21.186275 | 75 | 0.671448 |
7be840dfa51c02a65dec8ca01a52535430ef08be | 110 | css | CSS | frontend/src/components/LoggedInBanner/LoggedInBanner.css | dwayne314/react-basics | e7c4f4529794416667a3a604733fdf20e40205ea | [
"MIT"
] | null | null | null | frontend/src/components/LoggedInBanner/LoggedInBanner.css | dwayne314/react-basics | e7c4f4529794416667a3a604733fdf20e40205ea | [
"MIT"
] | 1 | 2021-09-02T09:41:06.000Z | 2021-09-02T09:41:06.000Z | frontend/src/components/LoggedInBanner/LoggedInBanner.css | dwayne314/react-basics | e7c4f4529794416667a3a604733fdf20e40205ea | [
"MIT"
] | null | null | null | .logged-in-banner {
width: 100%;
height: 2px;
background-color: gold;
color: white;
position: absolute;
} | 15.714286 | 24 | 0.690909 |
3eeb23a7076e730a9103161b7fd436f614c10702 | 17,003 | swift | Swift | SilverbackFramework/Bit.swift | cotkjaer/SilverbackFramework | 9af50eba55bbc7277b601932e45352a162ad3477 | [
"MIT"
] | 1 | 2015-10-23T15:44:35.000Z | 2015-10-23T15:44:35.000Z | SilverbackFramework/Bit.swift | cotkjaer/SilverbackFramework | 9af50eba55bbc7277b601932e45352a162ad3477 | [
"MIT"
] | null | null | null | SilverbackFramework/Bit.swift | cotkjaer/SilverbackFramework | 9af50eba55bbc7277b601932e45352a162ad3477 | [
"MIT"
] | null | null | null | //
// Bit.swift
// SilverbackFramework
//
// Created by Christian Otkjær on 03/09/15.
// Copyright © 2015 Christian Otkjær. All rights reserved.
//
import Foundation
public enum BytesCount
{
case Fixed(Int)
case VariableInt
case VariableByte
}
public protocol BytesConvertible
{
var bytes: [UInt8] { get }
static var bytesCount: BytesCount { get }
init?(bytes: [UInt8])
}
public extension NSMutableData
{
func appendBytesConvertible<B:BytesConvertible>(bytesConvertible: B)
{
var bytes = bytesConvertible.bytes
switch B.bytesCount
{
case .Fixed(let count):
if count != bytes.count { debugPrint("strange mismatch in bytes produced vs. bytes to write") }
case .VariableInt:
appendInt(bytesConvertible.bytes.count)
case .VariableByte:
appendByte(UInt8(bytesConvertible.bytes.count & 0xFF))
}
appendBytes(&bytes, length: bytes.count)
}
}
public extension NSData
{
func readBytesConvertible<B:BytesConvertible>(inout location: Int) throws -> B
{
let cachedLocation = location
do
{
var bytesToRead:Int = 0
switch B.bytesCount
{
case .Fixed(let count):
bytesToRead = count
case .VariableInt:
bytesToRead = try readInt(&location)
case .VariableByte:
bytesToRead = Int(try readByte(&location))
}
let bytes = try readBytes(&location, count: bytesToRead)
if let b = B(bytes: bytes)
{
return b
}
else
{
throw BytesError.MalformedBytes
}
}
catch let e
{
location = cachedLocation
throw e
}
}
}
func bitsizeof<T>(_: T.Type) -> Int { return sizeof(T) * 8 }
private let BitSizeOfInt = bitsizeof(Int)
private let BitSizeOfByte = bitsizeof(UInt8)
let UInt8BitOneMasks = Array<UInt8>(arrayLiteral: 0b10000000, 0b01000000, 0b00100000, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000001)
extension UInt8
{
func indexIsValid(index: Int) -> Bool
{
return index >= 0 && index < BitSizeOfByte
}
subscript(index: Int) -> Bit
{
get
{
guard indexIsValid(index) else { return .Zero }
return ( self & UInt8BitOneMasks[index] ) > 0 ? .One : .Zero
}
set(bit)
{
guard indexIsValid(index) else { return }
switch (self[index], bit)
{
// case (.One, .One) :
// debugPrint("already sat")
// case (.Zero, .Zero):
// debugPrint("already unsat")
case (.Zero, .One):
self |= UInt8BitOneMasks[index]
case (.One, .Zero):
self &= ~UInt8BitOneMasks[index]
case (_, _):
break
}
}
}
mutating func setBit(index: Int, _ bit: Bit)
{
self[index] = bit
}
func getBit(index: Int) -> Bit
{
return self[index]
}
//
// func indexIsValid(index: Int) -> Bool
// {
// return index >= 0 && index < BitSizeOfByte
// }
//
// subscript(index: Int) -> Bit
// {
//
// get
// {
// assert(indexIsValid(index), "Index out of range")
// return getBit(index)
// }
//
// set
// {
// assert(indexIsValid(index), "Index out of range")
// setBit(index, newValue)
// }
// }
//
// mutating func setBit(index: Int, _ bit: Bit)
// {
// switch bit
// {
// case .One:
// self |= UInt8BitOneMasks[index]
//
// case .Zero:
// self &= UInt8BitZeroMasks[index]
// }
// }
//
// func getBit(index: Int) -> Bit
// {
// return ( self & UInt8BitOneMasks[index] ) > 0 ? .One : .Zero
// }
}
//let IntBitZeroMasks = Array<UInt8>(arrayLiteral: 0b01111111, 0b10111111, 0b11011111, 0b11101111, 0b11110111, 0b11111011, 0b11111101, 0b11111110)
public extension Int
{
init(bits:[Bit])
{
var int = 0
for var i = 0; i < bits.count; i++
{
int[BitSizeOfInt - (1 + i)] = bits[i]
}
self = int
}
func bits(count: Int) -> [Bit]
{
var bits = Array<Bit>(count: count, repeatedValue: .Zero)
for var i = 0; i < count; i++
{
bits[i] = self[BitSizeOfInt - (1 + i)]
}
return bits
}
}
let IntBitOneMasks = Array(0..<BitSizeOfInt).reverse().map({ Int(1) << $0 })
public extension Int
{
private func indexIsValid(index: Int) -> Bool
{
return index >= 0 && index < BitSizeOfInt
}
subscript(index: Int) -> Bit
{
get
{
guard indexIsValid(index) else { return .Zero }
return ( self & IntBitOneMasks[index] ) > 0 ? .One : .Zero
}
set(bit)
{
guard indexIsValid(index) else { return }
switch (self[index], bit)
{
// case (.One, .One) :
// debugPrint("already sat")
// case (.Zero, .Zero):
// debugPrint("already unsat")
case (.Zero, .One):
self |= IntBitOneMasks[index]
case (.One, .Zero):
self &= ~IntBitOneMasks[index]
case (_, _):
break
}
}
}
internal mutating func setBit(index: Int, _ bit: Bit)
{
self[index] = bit
}
internal func getBit(index: Int) -> Bit
{
return self[index]
}
}
public func getBit(index: Int, number: Int) -> Bit
{
let size = sizeof(Int) * 8
guard index >= 0 && index < size else { return .Zero }
var mask : Int = 1
mask <<= (size - 1) - index
return (number & mask) > 0 ? .One : .Zero
}
/// Protocol for objects that know how to read and write themselves to a BitBuffer
public protocol Bitable
{
// static func read() throws -> Self
init(buffer:BitBuffer) throws
func write(buffer: BitBuffer)
}
public enum BitsConvertibleBitsCount
{
case Static(Int)
case Variable(Int)
}
public protocol BitsConvertible
{
static var bitsCount: BitsConvertibleBitsCount { get }
init?(bits:[Bit])
var bits: [Bit] { get }
}
public extension BitBuffer
{
// private func doRead<B:BitsConvertible>(type: B.Type) throws -> B
// {
// let bitsCount : Int
//
// switch B.bitsCount
// {
// case .Static(let count): bitsCount = count
// case .Variable(let count): bitsCount = try readInt(count)
// }
//
// if let b = B(bits: try readBits(bitsCount))
// {
// return b
// }
//
// throw BitBuffer.Error.MalformedBits(B)
// }
public func read<B:BitsConvertible>(type: B.Type? = nil) throws -> B
{
let bitsCount : Int
switch B.bitsCount
{
case .Static(let count): bitsCount = count
case .Variable(let count): bitsCount = try readInt(count)
}
if let b = B(bits: try readBits(bitsCount))
{
return b
}
throw BitBuffer.Error.MalformedBits(B)
}
public func readOptional<B:BitsConvertible>(type: B.Type? = nil) throws -> B?
{
if try readBool()
{
return try read(B)
}
return nil
}
public func write(bitable: BitsConvertible)
{
write(bitable.bits)
}
public func writeOptional(bitable: BitsConvertible?)
{
write(bitable != nil)
if let b = bitable
{
write(b)
}
}
}
public class BitBuffer
{
public enum Error: ErrorType
{
case OutOfBounds(Int, Int)
case MalformedBits(Any.Type)
}
private var bitsAsBytes : Array<UInt8>
private var writeIndex : Int = 0
private var writeByteIndex : Int { return writeIndex / BitSizeOfByte }
private var writeBitIndex : Int { return writeIndex % BitSizeOfByte }
private var readIndex : Int = 0
private var readByteIndex : Int { return readIndex / BitSizeOfByte }
private var readBitIndex : Int { return readIndex % BitSizeOfByte }
var available : Int { return writeIndex - readIndex }
var free : Int { return bitsAsBytes.count * 8 - available }
public init(capacity: Int = BitSizeOfInt)
{
bitsAsBytes = Array<UInt8>(count: max(1, capacity / 8), repeatedValue: 0)
}
func extend()
{
bitsAsBytes += Array<UInt8>(count: max(1, bitsAsBytes.count), repeatedValue: 0)
}
func reset()
{
writeIndex = 0
readIndex = 0
}
public func write(bit: Bit)
{
writeBit(bit)
}
public func writeBit(bit: Bit)
{
let byteIndex = writeByteIndex
let bitIndex = writeBitIndex
writeIndex++
while byteIndex >= bitsAsBytes.count
{
extend()
}
bitsAsBytes[byteIndex].setBit(bitIndex, bit)
}
public func write(bits: [Bit])
{
for bit in bits
{
write(bit)
}
}
func peekBit() throws -> Bit
{
guard available > 0 else { throw Error.OutOfBounds(1, available) }
return bitsAsBytes[readByteIndex][readBitIndex]
}
public func readBit() throws -> Bit
{
defer { readIndex++ ; if readIndex >= writeIndex { reset() } }
return try peekBit()
}
public func readBits(count: Int) throws -> [Bit]
{
guard count > 0 else { return [] }
var bits = Array<Bit>(count: count, repeatedValue: Bit.Zero)
for var i = 0; i < count; i++
{
bits[i] = try readBit()
}
return bits
}
func peekByteAt(peekIndex: Int) -> UInt8
{
var byte : UInt8 = 0
for var offset = 0;
offset < BitSizeOfByte && peekIndex + offset < writeIndex;
offset++
{
let peekByteIndex = (peekIndex + offset) / BitSizeOfByte
let peekBitIndex = (peekIndex + offset) % BitSizeOfByte
byte[offset] = bitsAsBytes[peekByteIndex][peekBitIndex]
}
return byte
}
public var bytes : [UInt8]
{
var bytes = Array<UInt8>()
for var index = readIndex;
index < writeIndex;
index += BitSizeOfByte
{
bytes.append(peekByteAt(index))
}
return bytes
}
public func readBool() throws -> Bool
{
return try readBit() == .One
}
public func writeBool(bool: Bool)
{
writeBit(bool ? .One : .Zero)
}
public func write(bool: Bool)
{
writeBool(bool)
}
public func writeInt(integer: Int, bits: Int = BitSizeOfInt, signed: Bool = false)
{
guard bits > 0 else { return }
if signed
{
writeBit(integer < 0 ? .One : .Zero)
}
let indexMax = BitSizeOfInt
for index in (indexMax - bits).stride(to: indexMax, by: 1)
{
writeBit(integer[index])
}
}
public func writeOptionalInt(integer: Int?, bits: Int = BitSizeOfInt, signed: Bool = false)
{
if let i = integer
{
write(true)
writeInt(i, bits: bits, signed: signed)
}
else
{
write(false)
}
}
public func readInt(bits: Int = BitSizeOfInt, signed: Bool = false) throws -> Int
{
guard bits <= available else { throw Error.OutOfBounds(bits, bits - available) }
var workingInteger = Int(0)
if signed
{
if try readBit() == .One
{
workingInteger = -1
}
}
for index in (BitSizeOfInt - bits).stride(to: BitSizeOfInt, by: 1) //stride(from: BitSizeOfInt - bits, to: BitSizeOfInt, by: 1)
{
workingInteger[index] = try readBit()
}
return workingInteger
}
public func readOptionalInt(bits: Int = BitSizeOfInt, signed: Bool = false) throws -> Int?
{
if try readBool()
{
return try readInt(bits, signed: signed)
}
return nil
}
public func writeString(string: String)
{
let stringBytes = Array<UInt8>(string.utf8)
writeInt(stringBytes.count * BitSizeOfByte) // Write bits count, NOT bytes-count
for byte in stringBytes
{
for index in 0 ..< BitSizeOfByte
{
writeBit(byte[index])
}
}
}
public func readString() throws -> String
{
let length = try readInt(BitSizeOfInt)
guard length <= available else { throw Error.OutOfBounds(length, length - available) }
var stringBytes = Array<UInt8>(count: length / BitSizeOfByte, repeatedValue: 0)
for var index = 0; index < length; index++
{
stringBytes[index / BitSizeOfByte][index % BitSizeOfByte] = try readBit()
}
if let string = String(bytes: stringBytes, encoding: NSUTF8StringEncoding)
{
return string
}
throw Error.MalformedBits(String)
}
public func readDouble() throws -> Double
{
let doubleString = try readString()
if let double = Double(doubleString)
{
return double
}
throw Error.MalformedBits(Double)
}
public func writeDouble(double: Double)
{
writeString("\(double)")
}
public func writeDate(date: NSDate)
{
writeDouble(date.timeIntervalSinceReferenceDate)
}
public func readDate() throws -> NSDate
{
let timeintervalSinceRefereceDate = try readDouble()
return NSDate(timeIntervalSinceReferenceDate: timeintervalSinceRefereceDate)
}
public func read<B:Bitable>(type: B.Type) throws -> B
{
return try B(buffer: self)
}
public func readOptional<B:Bitable>(type: B.Type) throws -> B?
{
if try readBool()
{
return try B(buffer: self)
}
return nil
}
public func write(bitable: Bitable)
{
bitable.write(self)
}
public func writeOptional(bitable: Bitable?)
{
writeBool(bitable != nil)
bitable?.write(self)
}
}
extension BitBuffer: CustomDebugStringConvertible
{
public var debugDescription : String
{
// let readIndexString = "".join(Array<String>(count: readIndex, repeatedValue: "-")) + "^"
let bitStrings = bitsAsBytes[readByteIndex...writeByteIndex].map { String($0, radix: 2, paddedToSize: 8) }
let bitsString = bitStrings.joinWithSeparator("")
let range = Range(start: readBitIndex, end:(bitsString.characters.count - (BitSizeOfByte - writeBitIndex)))
// bitsString[range]
// let writeIndexString = "".join(Array<String>(count: writeIndex, repeatedValue: "-")) + "v"
return "(a:\(available), r:\(self.readBitIndex) [\(bitsString[range])] w:\(writeBitIndex)"
}
}
//MARK: (NS)Data
extension BitBuffer
{
public convenience init(data: NSData)
{
let byteCount = data.length
self.init(capacity: byteCount * BitSizeOfByte)
data.getBytes(&bitsAsBytes, length: byteCount)
writeIndex = byteCount * BitSizeOfByte
}
var data: NSData
{
return NSData(bytes: bytes)
}
}
extension NSData
{
public convenience init(var bytes: [UInt8])
{
self.init(bytes:&bytes, length:bytes.count)
}
}
| 24.049505 | 146 | 0.506558 |
5d035096ca22b954ce07e5e57375bdefdb4369fd | 3,618 | dart | Dart | lib/src/views/collection_screens/collection_photos_screen.dart | nodemov/FlutSplash | 430548899decaa08c1cf3181227592fbe5fcb710 | [
"Unlicense"
] | 16 | 2021-04-08T03:37:19.000Z | 2022-02-08T17:01:13.000Z | lib/src/views/collection_screens/collection_photos_screen.dart | nodemov/FlutSplash | 430548899decaa08c1cf3181227592fbe5fcb710 | [
"Unlicense"
] | 2 | 2021-04-17T20:09:17.000Z | 2021-12-27T09:11:28.000Z | lib/src/views/collection_screens/collection_photos_screen.dart | nodemov/FlutSplash | 430548899decaa08c1cf3181227592fbe5fcb710 | [
"Unlicense"
] | 7 | 2021-04-15T12:49:51.000Z | 2021-09-24T02:42:15.000Z | import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:future_progress_dialog/future_progress_dialog.dart';
import 'package:get/get.dart';
import '../../helpers/chrome_custom_tabs.dart';
import '../../helpers/keys.dart';
import '../../models/collection/collection.dart';
class CollectionPhotos extends StatefulWidget {
const CollectionPhotos({Key? key}) : super(key: key);
@override
_CollectionPhotosState createState() => _CollectionPhotosState();
}
class _CollectionPhotosState extends State<CollectionPhotos> {
Dio dio = Dio();
List<PreviewPhoto> photos = Get.arguments[0];
String collectionID = Get.arguments[1];
String userName = Get.arguments[2];
String collName = Get.arguments[3];
Future<Map<String, dynamic>> _getCollResultDetail(String imageID) async {
var response = await dio.get(
'https://api.unsplash.com/photos/$imageID?client_id=$unsplashApiClientID');
Map<String, dynamic> imageData = response.data;
return imageData;
}
@override
Widget build(BuildContext context) {
var photosList = photos;
return Scaffold(
appBar: AppBar(
title: Text(
collName,
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
actions: [
IconButton(
icon: Icon(Icons.open_in_new_rounded),
onPressed: () {
openCustomTab('https://unsplash.com/collections/$collectionID');
},
)
],
iconTheme: IconThemeData(color: Colors.black),
),
body: Container(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Padding(
padding: EdgeInsets.all(10),
child: StaggeredGridView.countBuilder(
physics: ScrollPhysics(),
itemBuilder: (BuildContext context, int index) {
return Container(
height: MediaQuery.of(context).size.height * 0.75,
width: MediaQuery.of(context).size.width * 0.50,
margin: EdgeInsets.all(8),
child: InkWell(
onTap: () async {
var imgID = photosList[index].id!;
var resultDetails = await showDialog(
context: context,
builder: (context) =>
FutureProgressDialog(_getCollResultDetail(imgID)),
);
await Get.toNamed(
'/image/info',
arguments: resultDetails,
);
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(photosList[index].urls.small),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(5),
),
),
),
);
},
staggeredTileBuilder: (int index) =>
StaggeredTile.count(2, index.isEven ? 3 : 1.5),
shrinkWrap: true,
itemCount: photosList.length,
mainAxisSpacing: 1,
crossAxisSpacing: 1,
crossAxisCount: 4,
),
),
),
),
);
}
}
| 34.132075 | 83 | 0.532338 |
e81b76e914225086b74942a85a02002d60703457 | 14,840 | cpp | C++ | libraries/inverse/dipoleFit/guess_data.cpp | Andrey1994/mne-cpp | 6264b1107b9447b7db64309f73f09e848fd198c4 | [
"BSD-3-Clause"
] | 2 | 2021-11-16T19:38:12.000Z | 2021-11-18T20:52:08.000Z | libraries/inverse/dipoleFit/guess_data.cpp | Andrey1994/mne-cpp | 6264b1107b9447b7db64309f73f09e848fd198c4 | [
"BSD-3-Clause"
] | null | null | null | libraries/inverse/dipoleFit/guess_data.cpp | Andrey1994/mne-cpp | 6264b1107b9447b7db64309f73f09e848fd198c4 | [
"BSD-3-Clause"
] | 1 | 2021-11-16T19:39:01.000Z | 2021-11-16T19:39:01.000Z | //=============================================================================================================
/**
* @file guess_data.cpp
* @author Lorenz Esch <lesch@mgh.harvard.edu>;
* Matti Hamalainen <msh@nmr.mgh.harvard.edu>;
* Christoph Dinh <chdinh@nmr.mgh.harvard.edu>
* @version dev
* @date December, 2016
*
* @section LICENSE
*
* Copyright (C) 2016, Lorenz Esch, Matti Hamalainen, Christoph Dinh. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that
* the following conditions are met:
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of MNE-CPP authors nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*
* @brief Definition of the GuessData Class.
*
*/
//*************************************************************************************************************
//=============================================================================================================
// INCLUDES
//=============================================================================================================
#include "guess_data.h"
#include "dipole_fit_data.h"
#include "dipole_forward.h"
#include <mne/c/mne_surface_old.h>
#include <mne/c/mne_source_space_old.h>
#include <fiff/fiff_stream.h>
#include <fiff/fiff_tag.h>
#include <QFile>
//*************************************************************************************************************
//=============================================================================================================
// USED NAMESPACES
//=============================================================================================================
using namespace Eigen;
using namespace FIFFLIB;
using namespace MNELIB;
using namespace FWDLIB;
using namespace INVERSELIB;
//ToDo remove later on
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef FAIL
#define FAIL -1
#endif
#ifndef OK
#define OK 0
#endif
#define X_16 0
#define Y_16 1
#define Z_16 2
#define VEC_COPY_16(to,from) {\
(to)[X_16] = (from)[X_16];\
(to)[Y_16] = (from)[Y_16];\
(to)[Z_16] = (from)[Z_16];\
}
#define MALLOC_16(x,t) (t *)malloc((x)*sizeof(t))
#define REALLOC_16(x,y,t) (t *)((x == NULL) ? malloc((y)*sizeof(t)) : realloc((x),(y)*sizeof(t)))
#define ALLOC_CMATRIX_16(x,y) mne_cmatrix_16((x),(y))
static void matrix_error_16(int kind, int nr, int nc)
{
if (kind == 1)
printf("Failed to allocate memory pointers for a %d x %d matrix\n",nr,nc);
else if (kind == 2)
printf("Failed to allocate memory for a %d x %d matrix\n",nr,nc);
else
printf("Allocation error for a %d x %d matrix\n",nr,nc);
if (sizeof(void *) == 4) {
printf("This is probably because you seem to be using a computer with 32-bit architecture.\n");
printf("Please consider moving to a 64-bit platform.");
}
printf("Cannot continue. Sorry.\n");
exit(1);
}
float **mne_cmatrix_16(int nr,int nc)
{
int i;
float **m;
float *whole;
m = MALLOC_16(nr,float *);
if (!m) matrix_error_16(1,nr,nc);
whole = MALLOC_16(nr*nc,float);
if (!whole) matrix_error_16(2,nr,nc);
for(i=0;i<nr;i++)
m[i] = whole + i*nc;
return m;
}
#define FREE_16(x) if ((char *)(x) != NULL) free((char *)(x))
#define FREE_CMATRIX_16(m) mne_free_cmatrix_16((m))
void mne_free_cmatrix_16 (float **m)
{
if (m) {
FREE_16(*m);
FREE_16(m);
}
}
void fromFloatEigenMatrix_16(const Eigen::MatrixXf& from_mat, float **& to_mat, const int m, const int n)
{
for ( int i = 0; i < m; ++i)
for ( int j = 0; j < n; ++j)
to_mat[i][j] = from_mat(i,j);
}
void fromFloatEigenMatrix_16(const Eigen::MatrixXf& from_mat, float **& to_mat)
{
fromFloatEigenMatrix_16(from_mat, to_mat, from_mat.rows(), from_mat.cols());
}
//int
void fromIntEigenMatrix_16(const Eigen::MatrixXi& from_mat, int **&to_mat, const int m, const int n)
{
for ( int i = 0; i < m; ++i)
for ( int j = 0; j < n; ++j)
to_mat[i][j] = from_mat(i,j);
}
void fromIntEigenMatrix_16(const Eigen::MatrixXi& from_mat, int **&to_mat)
{
fromIntEigenMatrix_16(from_mat, to_mat, from_mat.rows(), from_mat.cols());
}
//*************************************************************************************************************
//=============================================================================================================
// DEFINE MEMBER METHODS
//=============================================================================================================
GuessData::GuessData()
: rr(NULL)
, guess_fwd(NULL)
, nguess(0)
{
}
//*************************************************************************************************************
//GuessData::GuessData(const GuessData& p_GuessData)
//{
//}
//*************************************************************************************************************
GuessData::GuessData(const QString &guessname, const QString &guess_surfname, float mindist, float exclude, float grid, DipoleFitData *f)
{
MneSourceSpaceOld* *sp = NULL;
int nsp = 0;
// GuessData* res = new GuessData();
int k,p;
float guessrad = 0.080;
MneSourceSpaceOld* guesses = NULL;
dipoleFitFuncs orig;
if (!guessname.isEmpty()) {
/*
* Read the guesses and transform to the appropriate coordinate frame
*/
if (MneSurfaceOrVolume::mne_read_source_spaces(guessname,&sp,&nsp) == FAIL)
goto bad;
if (nsp != 1) {
printf("Incorrect number of source spaces in guess file");
for (k = 0; k < nsp; k++)
delete sp[k];
FREE_16(sp);
goto bad;
}
fprintf(stderr,"Read guesses from %s\n",guessname.toUtf8().constData());
guesses = sp[0]; FREE_16(sp);
}
else {
MneSurfaceOld* inner_skull = NULL;
int free_inner_skull = FALSE;
float r0[3];
VEC_COPY_16(r0,f->r0);
FiffCoordTransOld::fiff_coord_trans_inv(r0,f->mri_head_t,TRUE);
if (f->bem_model) {
fprintf(stderr,"Using inner skull surface from the BEM (%s)...\n",f->bemname.toUtf8().constData());
if ((inner_skull = f->bem_model->fwd_bem_find_surface(FIFFV_BEM_SURF_ID_BRAIN)) == NULL)
goto bad;
}
else if (!guess_surfname.isEmpty()) {
fprintf(stderr,"Reading inner skull surface from %s...\n",guess_surfname.toUtf8().data());
if ((inner_skull = MneSurfaceOrVolume::read_bem_surface(guess_surfname,FIFFV_BEM_SURF_ID_BRAIN,TRUE,NULL)) == NULL)
goto bad;
free_inner_skull = TRUE;
}
if ((guesses = (MneSourceSpaceOld*)FwdBemModel::make_guesses(inner_skull,guessrad,r0,grid,exclude,mindist)) == NULL)
goto bad;
if (free_inner_skull)
delete inner_skull;
}
if (MneSurfaceOrVolume::mne_transform_source_spaces_to(f->coord_frame,f->mri_head_t,&guesses,1) != OK)
goto bad;
fprintf(stderr,"Guess locations are now in %s coordinates.\n",FiffCoordTransOld::mne_coord_frame_name(f->coord_frame));
this->nguess = guesses->nuse;
this->rr = ALLOC_CMATRIX_16(guesses->nuse,3);
for (k = 0, p = 0; k < guesses->np; k++)
if (guesses->inuse[k]) {
VEC_COPY_16(this->rr[p],guesses->rr[k]);
p++;
}
delete guesses; guesses = NULL;
fprintf(stderr,"Go through all guess source locations...");
this->guess_fwd = MALLOC_16(this->nguess,DipoleForward*);
for (k = 0; k < this->nguess; k++)
this->guess_fwd[k] = NULL;
/*
* Compute the guesses using the sphere model for speed
*/
orig = f->funcs;
if (f->fit_mag_dipoles)
f->funcs = f->mag_dipole_funcs;
else
f->funcs = f->sphere_funcs;
for (k = 0; k < this->nguess; k++) {
if ((this->guess_fwd[k] = DipoleFitData::dipole_forward_one(f,this->rr[k],NULL)) == NULL)
goto bad;
#ifdef DEBUG
sing = this->guess_fwd[k]->sing;
printf("%f %f %f\n",sing[0],sing[1],sing[2]);
#endif
}
f->funcs = orig;
fprintf(stderr,"[done %d sources]\n",p);
return;
// return res;
bad : {
if(guesses)
delete guesses;
return;
// return NULL;
}
}
//*************************************************************************************************************
GuessData::GuessData(const QString &guessname, const QString &guess_surfname, float mindist, float exclude, float grid, DipoleFitData *f, char *guess_save_name)
{
MneSourceSpaceOld* *sp = NULL;
int nsp = 0;
GuessData* res = NULL;
int k,p;
float guessrad = 0.080f;
MneSourceSpaceOld* guesses = NULL;
if (!guessname.isEmpty()) {
/*
* Read the guesses and transform to the appropriate coordinate frame
*/
if (MneSurfaceOrVolume::mne_read_source_spaces(guessname,&sp,&nsp) == FIFF_FAIL)
goto bad;
if (nsp != 1) {
qCritical("Incorrect number of source spaces in guess file");
for (k = 0; k < nsp; k++)
delete sp[k];
FREE_16(sp);
goto bad;
}
printf("Read guesses from %s\n",guessname.toUtf8().constData());
guesses = sp[0]; FREE_16(sp);
}
else {
MneSurfaceOld* inner_skull = NULL;
int free_inner_skull = FALSE;
float r0[3];
VEC_COPY_16(r0,f->r0);
FiffCoordTransOld::fiff_coord_trans_inv(r0,f->mri_head_t,TRUE);
if (f->bem_model) {
printf("Using inner skull surface from the BEM (%s)...\n",f->bemname.toUtf8().constData());
if ((inner_skull = f->bem_model->fwd_bem_find_surface(FIFFV_BEM_SURF_ID_BRAIN)) == NULL)
goto bad;
}
else if (!guess_surfname.isEmpty()) {
printf("Reading inner skull surface from %s...\n",guess_surfname.toUtf8().data());
if ((inner_skull = MneSurfaceOrVolume::read_bem_surface(guess_surfname,FIFFV_BEM_SURF_ID_BRAIN,TRUE,NULL)) == NULL)
goto bad;
free_inner_skull = TRUE;
}
if ((guesses = (MneSourceSpaceOld*)FwdBemModel::make_guesses(inner_skull,guessrad,r0,grid,exclude,mindist)) == NULL)
goto bad;
if (free_inner_skull)
delete inner_skull;
}
/*
* Save the guesses for future use
*/
if (guesses->nuse == 0) {
qCritical("No active guess locations remaining.");
goto bad;
}
if (guess_save_name) {
printf("###################DEBUG writing source spaces not yet implemented.");
// if (mne_write_source_spaces(guess_save_name,&guesses,1,FALSE) != OK)
// goto bad;
// printf("Wrote guess locations to %s\n",guess_save_name);
}
/*
* Transform the guess locations to the appropriate coordinate frame
*/
if (MneSurfaceOrVolume::mne_transform_source_spaces_to(f->coord_frame,f->mri_head_t,&guesses,1) != OK)
goto bad;
printf("Guess locations are now in %s coordinates.\n",FiffCoordTransOld::mne_coord_frame_name(f->coord_frame));
res = new GuessData();
this->nguess = guesses->nuse;
this->rr = ALLOC_CMATRIX_16(guesses->nuse,3);
for (k = 0, p = 0; k < guesses->np; k++)
if (guesses->inuse[k]) {
VEC_COPY_16(this->rr[p],guesses->rr[k]);
p++;
}
if(guesses)
delete guesses;
guesses = NULL;
this->guess_fwd = MALLOC_16(this->nguess,DipoleForward*);
for (k = 0; k < this->nguess; k++)
this->guess_fwd[k] = NULL;
/*
* Compute the guesses using the sphere model for speed
*/
if (!this->compute_guess_fields(f))
goto bad;
return;
// return res;
bad : {
if(guesses)
delete guesses;
delete res;
return;
// return NULL;
}
}
//*************************************************************************************************************
GuessData::~GuessData()
{
FREE_CMATRIX_16(rr);
if (guess_fwd) {
for (int k = 0; k < nguess; k++)
delete guess_fwd[k];
FREE_16(guess_fwd);
}
return;
}
//*************************************************************************************************************
bool GuessData::compute_guess_fields(DipoleFitData* f)
{
dipoleFitFuncs orig = NULL;
if (!f) {
qCritical("Data missing in compute_guess_fields");
return false;
}
if (!f->noise) {
qCritical("Noise covariance missing in compute_guess_fields");
return false;
}
printf("Go through all guess source locations...");
orig = f->funcs;
if (f->fit_mag_dipoles)
f->funcs = f->mag_dipole_funcs;
else
f->funcs = f->sphere_funcs;
for (int k = 0; k < this->nguess; k++) {
if ((this->guess_fwd[k] = DipoleFitData::dipole_forward_one(f,this->rr[k],this->guess_fwd[k])) == NULL){
if (orig)
f->funcs = orig;
return false;
}
#ifdef DEBUG
sing = this->guess_fwd[k]->sing;
printf("%f %f %f\n",sing[0],sing[1],sing[2]);
#endif
}
f->funcs = orig;
printf("[done %d sources]\n",this->nguess);
return true;
}
| 31.709402 | 160 | 0.538544 |
2dea399438bba3ee6dbc39add1048b8fcadb6231 | 612 | dart | Dart | lib/app/modules/usefulcontacts/domain/entities/usefulcontact.dart | DataLabIFPE/arretadas | d1a3293f201c46c0e8b588fa42819aa389c76bb5 | [
"MIT"
] | 2 | 2021-08-02T18:48:04.000Z | 2022-01-06T00:05:57.000Z | lib/app/modules/usefulcontacts/domain/entities/usefulcontact.dart | DataLabIFPE/arretadas | d1a3293f201c46c0e8b588fa42819aa389c76bb5 | [
"MIT"
] | 6 | 2021-06-30T08:07:05.000Z | 2021-06-30T08:08:29.000Z | lib/app/modules/usefulcontacts/domain/entities/usefulcontact.dart | DataLabIFPE/arretadas | d1a3293f201c46c0e8b588fa42819aa389c76bb5 | [
"MIT"
] | null | null | null | import 'dart:convert';
class Usefulcontact {
String id;
String name;
String number;
Usefulcontact({required this.id, required this.name, required this.number});
Map<String, dynamic> toMap() {
return {
'_id': id,
'name': name,
'number': number,
};
}
factory Usefulcontact.fromMap(Map<String, dynamic> map) {
return Usefulcontact(
id: map['_id'],
name: map['name'],
number: map['number'],
);
}
String toJson() => json.encode(toMap());
factory Usefulcontact.fromJson(String source) =>
Usefulcontact.fromMap(json.decode(source));
}
| 19.741935 | 78 | 0.620915 |
cf25dc525c3f3a22b746ee6c3424b6cb5511cb18 | 827 | lua | Lua | Assets/Lua/UI/LuaTest2.lua | z1246584501/LuaAndAB | 985b5e10218dbdd4bc998b7f64f3e36cf500385f | [
"MIT"
] | null | null | null | Assets/Lua/UI/LuaTest2.lua | z1246584501/LuaAndAB | 985b5e10218dbdd4bc998b7f64f3e36cf500385f | [
"MIT"
] | null | null | null | Assets/Lua/UI/LuaTest2.lua | z1246584501/LuaAndAB | 985b5e10218dbdd4bc998b7f64f3e36cf500385f | [
"MIT"
] | 1 | 2020-03-20T00:20:04.000Z | 2020-03-20T00:20:04.000Z | require "Common.define"
require "Common.globe"
LuaTest2 = {};
local this = LuaTest2;
local GameObject = UnityEngine.GameObject;
function LuaTest2:awake(obj)
print("这是LuaTest2");
StartCoroutine(function() this:loadIE(); end);
end
--协成
function LuaTest2:loadIE()
--找到物体,修改值
local go = GameObject.Find("Canvas/Button/Text");
print(go);
--获取该物体的组件
local text = go:GetComponent(typeof(UnityEngine.UI.Text));
text.text = "Lua脚本修改的";
Yield(0);
Yield(null);
WaitForFixedUpdate();
WaitForSeconds(1);
print("11");
WaitForSeconds(1);
print("22");
local x = 1;
while x<10 do
WaitForSeconds(1);
print(x);
x = x+1;
text.text = "周忠年0000:"..x;
end
for i=1,10 do
WaitForSeconds(1);
print(i);
text.text = "周忠年3333:"..i;
end
end
function LuaTest2.Init(object)
this:awake(object);
end
return LuaTest2; | 16.215686 | 59 | 0.685611 |
4ae95c1d9ca43b724ee7dbaf07ff9901868d8911 | 1,801 | asm | Assembly | src/aux-gfx.asm | maciejmalecki/trex64 | 3871ddaf56a106dc91bfd5b26b178d0f7b20d765 | [
"MIT"
] | 11 | 2021-07-02T12:31:30.000Z | 2022-03-04T06:35:03.000Z | src/aux-gfx.asm | maciejmalecki/trex64 | 3871ddaf56a106dc91bfd5b26b178d0f7b20d765 | [
"MIT"
] | 105 | 2020-04-14T10:33:16.000Z | 2022-03-13T15:10:05.000Z | src/aux-gfx.asm | maciejmalecki/trex64 | 3871ddaf56a106dc91bfd5b26b178d0f7b20d765 | [
"MIT"
] | null | null | null | /*
MIT License
Copyright (c) 2021 Maciej Malecki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#import "_segments.asm"
#importonce
.filenamespace c64lib
.var titleAttrs = LoadBinary("charset/game-logo-attr.bin")
.var titleMap = LoadBinary("charset/game-logo-map.bin")
.segment AuxGfx
beginOfTitleAttr:
.fill titleAttrs.getSize(), titleAttrs.get(i)
endOfTitleAttr:
beginOfTitleMap:
.fill titleMap.getSize(), titleMap.get(i) + 128
endOfTitleMap:
beginOfAuthorColorRainbow:
.byte LIGHT_BLUE, BLUE, LIGHT_BLUE, LIGHT_BLUE, LIGHT_BLUE, WHITE, WHITE, WHITE, WHITE, LIGHT_BLUE, LIGHT_BLUE
endOfAuthorColorRainbow:
beginOfAuthor2ColorRainbow:
.byte BLACK, DARK_GREY, DARK_GREY, GREY, GREY, LIGHT_GREY, LIGHT_GREY, WHITE, LIGHT_GREY, GREY,DARK_GREY
endOfAuthor2ColorRainbow:
| 40.022222 | 112 | 0.780677 |
7075f30e9751c946ff9fb78c7bad4664807a4af0 | 131 | h | C | PodXiuCaiAllSDK/XiuCaiAllSDK.framework/Headers/ssl.h | chengyakun11/PodXiuCaiAllSDK | c4ae5c79accf33aba5a878a55384be286798fc23 | [
"MIT"
] | null | null | null | PodXiuCaiAllSDK/XiuCaiAllSDK.framework/Headers/ssl.h | chengyakun11/PodXiuCaiAllSDK | c4ae5c79accf33aba5a878a55384be286798fc23 | [
"MIT"
] | null | null | null | PodXiuCaiAllSDK/XiuCaiAllSDK.framework/Headers/ssl.h | chengyakun11/PodXiuCaiAllSDK | c4ae5c79accf33aba5a878a55384be286798fc23 | [
"MIT"
] | null | null | null | version https://git-lfs.github.com/spec/v1
oid sha256:2ebba604db7d1e696ccb33b394e8d10592b782af4489eb99aaffcadc163fc55d
size 103173
| 32.75 | 75 | 0.885496 |
915651d65e4b02e454e28305eac1245545d4e801 | 22,034 | html | HTML | doc/method_list.html | ULL-ESIT-LPP-1819/tdd-alu0101038490 | cd5b54f93873466519f59d3a0cf30155bde7da8c | [
"MIT"
] | null | null | null | doc/method_list.html | ULL-ESIT-LPP-1819/tdd-alu0101038490 | cd5b54f93873466519f59d3a0cf30155bde7da8c | [
"MIT"
] | null | null | null | doc/method_list.html | ULL-ESIT-LPP-1819/tdd-alu0101038490 | cd5b54f93873466519f59d3a0cf30155bde7da8c | [
"MIT"
] | 1 | 2020-01-06T20:01:31.000Z | 2020-01-06T20:01:31.000Z | <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
<title>Method List</title>
<base id="base_target" target="_parent" />
</head>
<body>
<div id="content">
<div class="fixed_header">
<h1 id="full_list_header">Method List</h1>
<div id="full_list_nav">
<span><a target="_self" href="class_list.html">
Classes
</a></span>
<span><a target="_self" href="method_list.html">
Methods
</a></span>
<span><a target="_self" href="file_list.html">
Files
</a></span>
</div>
<div id="search">Search: <input type="text" /></div>
</div>
<ul id="full_list" class="method">
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#<=>-instance_method" title="Etiqueta#<=> (method)">#<=></a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#<=>-instance_method" title="Paciente#<=> (method)">#<=></a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#almidon-instance_method" title="Etiqueta#almidon (method)">#almidon</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#almidonPorPorcion-instance_method" title="Etiqueta#almidonPorPorcion (method)">#almidonPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Individuo.html#apellidos-instance_method" title="Individuo#apellidos (method)">#apellidos</a></span>
<small>Individuo</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#azucares-instance_method" title="Etiqueta#azucares (method)">#azucares</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#azucaresPorPorcion-instance_method" title="Etiqueta#azucaresPorPorcion (method)">#azucaresPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#bicipital-instance_method" title="Paciente#bicipital (method)">#bicipital</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#cadera-instance_method" title="Paciente#cadera (method)">#cadera</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#cantidadPorPorcion-instance_method" title="Etiqueta#cantidadPorPorcion (method)">#cantidadPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#cintura-instance_method" title="Paciente#cintura (method)">#cintura</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#dividirEnPorciones-instance_method" title="Etiqueta#dividirEnPorciones (method)">#dividirEnPorciones</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#each-instance_method" title="List#each (method)">#each</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Individuo.html#edad-instance_method" title="Individuo#edad (method)">#edad</a></span>
<small>Individuo</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#fibraAlimentaria-instance_method" title="Etiqueta#fibraAlimentaria (method)">#fibraAlimentaria</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#fibraAlimentariaPorPorcion-instance_method" title="Etiqueta#fibraAlimentariaPorPorcion (method)">#fibraAlimentariaPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#grasa-instance_method" title="Paciente#grasa (method)">#grasa</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasas-instance_method" title="Etiqueta#grasas (method)">#grasas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasMonoinsaturadas-instance_method" title="Etiqueta#grasasMonoinsaturadas (method)">#grasasMonoinsaturadas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasMonoinsaturadasPorPorcion-instance_method" title="Etiqueta#grasasMonoinsaturadasPorPorcion (method)">#grasasMonoinsaturadasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasPoliinsaturadas-instance_method" title="Etiqueta#grasasPoliinsaturadas (method)">#grasasPoliinsaturadas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasPoliinsaturadasPorPorcion-instance_method" title="Etiqueta#grasasPoliinsaturadasPorPorcion (method)">#grasasPoliinsaturadasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasPorPorcion-instance_method" title="Etiqueta#grasasPorPorcion (method)">#grasasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasSaturadas-instance_method" title="Etiqueta#grasasSaturadas (method)">#grasasSaturadas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#grasasSaturadasPorPorcion-instance_method" title="Etiqueta#grasasSaturadasPorPorcion (method)">#grasasSaturadasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="List.html#head-instance_method" title="List#head (method)">#head</a></span>
<small>List</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#hidratosDeCarbono-instance_method" title="Etiqueta#hidratosDeCarbono (method)">#hidratosDeCarbono</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#hidratosDeCarbonoPorPorcion-instance_method" title="Etiqueta#hidratosDeCarbonoPorPorcion (method)">#hidratosDeCarbonoPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#imc-instance_method" title="Paciente#imc (method)">#imc</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#imc_s-instance_method" title="Paciente#imc_s (method)">#imc_s</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#initialize-instance_method" title="List#initialize (method)">#initialize</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#initialize-instance_method" title="Etiqueta#initialize (method)">#initialize</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#initialize-instance_method" title="Paciente#initialize (method)">#initialize</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Individuo.html#initialize-instance_method" title="Individuo#initialize (method)">#initialize</a></span>
<small>Individuo</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#insert-instance_method" title="List#insert (method)">#insert</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="List.html#isEmpty-instance_method" title="List#isEmpty (method)">#isEmpty</a></span>
<small>List</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#mediaBicipital-instance_method" title="Paciente#mediaBicipital (method)">#mediaBicipital</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#mediaSubescapular-instance_method" title="Paciente#mediaSubescapular (method)">#mediaSubescapular</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#mediaSuprailiaco-instance_method" title="Paciente#mediaSuprailiaco (method)">#mediaSuprailiaco</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#mediaTricipital-instance_method" title="Paciente#mediaTricipital (method)">#mediaTricipital</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#minerales-instance_method" title="Etiqueta#minerales (method)">#minerales</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#mineralesPorPorcion-instance_method" title="Etiqueta#mineralesPorPorcion (method)">#mineralesPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List/Node.html#next-instance_method" title="List::Node#next (method)">#next</a></span>
<small>List::Node</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#nombre-instance_method" title="Etiqueta#nombre (method)">#nombre</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Individuo.html#nombre-instance_method" title="Individuo#nombre (method)">#nombre</a></span>
<small>Individuo</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#peso-instance_method" title="Paciente#peso (method)">#peso</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#plieguesCutaneos-instance_method" title="Paciente#plieguesCutaneos (method)">#plieguesCutaneos</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#polialcoholes-instance_method" title="Etiqueta#polialcoholes (method)">#polialcoholes</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#polialcoholesPorPorcion-instance_method" title="Etiqueta#polialcoholesPorPorcion (method)">#polialcoholesPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="List.html#pop_back-instance_method" title="List#pop_back (method)">#pop_back</a></span>
<small>List</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#pop_front-instance_method" title="List#pop_front (method)">#pop_front</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeAzucares-instance_method" title="Etiqueta#porcentajeAzucares (method)">#porcentajeAzucares</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeGrasas-instance_method" title="Etiqueta#porcentajeGrasas (method)">#porcentajeGrasas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeHidratos-instance_method" title="Etiqueta#porcentajeHidratos (method)">#porcentajeHidratos</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeProteinas-instance_method" title="Etiqueta#porcentajeProteinas (method)">#porcentajeProteinas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeSal-instance_method" title="Etiqueta#porcentajeSal (method)">#porcentajeSal</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeSaturadas-instance_method" title="Etiqueta#porcentajeSaturadas (method)">#porcentajeSaturadas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porcentajeValorEnergetico-instance_method" title="Etiqueta#porcentajeValorEnergetico (method)">#porcentajeValorEnergetico</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#porciones-instance_method" title="Etiqueta#porciones (method)">#porciones</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="List/Node.html#prev-instance_method" title="List::Node#prev (method)">#prev</a></span>
<small>List::Node</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#proteinas-instance_method" title="Etiqueta#proteinas (method)">#proteinas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#proteinasPorPorcion-instance_method" title="Etiqueta#proteinasPorPorcion (method)">#proteinasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#push_back-instance_method" title="List#push_back (method)">#push_back</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="List.html#push_front-instance_method" title="List#push_front (method)">#push_front</a></span>
<small>List</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#rcc-instance_method" title="Paciente#rcc (method)">#rcc</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#rcc_s-instance_method" title="Paciente#rcc_s (method)">#rcc_s</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#remove-instance_method" title="List#remove (method)">#remove</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#sal-instance_method" title="Etiqueta#sal (method)">#sal</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#salPorPorcion-instance_method" title="Etiqueta#salPorPorcion (method)">#salPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Individuo.html#sexo-instance_method" title="Individuo#sexo (method)">#sexo</a></span>
<small>Individuo</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#size-instance_method" title="List#size (method)">#size</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#subescapular-instance_method" title="Paciente#subescapular (method)">#subescapular</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Paciente.html#suprailiaco-instance_method" title="Paciente#suprailiaco (method)">#suprailiaco</a></span>
<small>Paciente</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#suprail%C3%ADaco-instance_method" title="Paciente#suprailíaco (method)">#suprailíaco</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List.html#tail-instance_method" title="List#tail (method)">#tail</a></span>
<small>List</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#talla-instance_method" title="Paciente#talla (method)">#talla</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#to_s-instance_method" title="Etiqueta#to_s (method)">#to_s</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#to_s-instance_method" title="Paciente#to_s (method)">#to_s</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Individuo.html#to_s-instance_method" title="Individuo#to_s (method)">#to_s</a></span>
<small>Individuo</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Paciente.html#tricipital-instance_method" title="Paciente#tricipital (method)">#tricipital</a></span>
<small>Paciente</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#valorEnergeticoEnKJ-instance_method" title="Etiqueta#valorEnergeticoEnKJ (method)">#valorEnergeticoEnKJ</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#valorEnergeticoEnKcal-instance_method" title="Etiqueta#valorEnergeticoEnKcal (method)">#valorEnergeticoEnKcal</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="List/Node.html#value-instance_method" title="List::Node#value (method)">#value</a></span>
<small>List::Node</small>
</div>
</li>
<li class="even ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#vitaminas-instance_method" title="Etiqueta#vitaminas (method)">#vitaminas</a></span>
<small>Etiqueta</small>
</div>
</li>
<li class="odd ">
<div class="item">
<span class='object_link'><a href="Etiqueta.html#vitaminasPorPorcion-instance_method" title="Etiqueta#vitaminasPorPorcion (method)">#vitaminasPorPorcion</a></span>
<small>Etiqueta</small>
</div>
</li>
</ul>
</div>
</body>
</html>
| 30.101093 | 205 | 0.629709 |
9de79497890e4f9c757bed89b6ac4c69caedf858 | 1,109 | asm | Assembly | libsrc/sprites/software/sp1/spectrum/tiles/SP1PSPUSH.asm | andydansby/z88dk-mk2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | 1 | 2020-09-15T08:35:49.000Z | 2020-09-15T08:35:49.000Z | libsrc/sprites/software/sp1/spectrum/tiles/SP1PSPUSH.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/sprites/software/sp1/spectrum/tiles/SP1PSPUSH.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ; subroutine for writing registers to "struct sp1_pss"
; 02.2008 aralbrec
; sinclair spectrum version
XLIB SP1PSPUSH
; enter : hl = & struct sp1_pss to write to
; e = flags
; b = current x coordinate (relative to bounds rect IY)
; c = current y coordinate (relative to bounds rect IY)
; de' = current struct sp1_update *
; b' = current attribute mask
; c' = current colour
; ix = visit function
; iy = bounds rectangle
.SP1PSPUSH
ld a,iyl
ld (hl),a
inc hl
ld a,iyh
ld (hl),a ; write bounds rectangle
inc hl
ld (hl),e ; write flags
inc hl
ld (hl),b ; write x coord
inc hl
ld (hl),c ; write y coord
inc hl
push hl
exx
pop hl
ld (hl),b ; write attr mask
inc hl
ld (hl),c ; write attr
inc hl
ld (hl),e
inc hl
ld (hl),d ; write struct sp1_update
inc hl
ld a,ixl
ld (hl),a
inc hl
ld a,ixh
ld (hl),a ; write visit function
ret
| 22.632653 | 64 | 0.514878 |
904b20d74e0440aceaed8d8fdaef24bc6d3c3b84 | 243 | py | Python | conf.py | Zephor5/seccode_recognize | b78cff0753fc5d524f3c9e36269b3681408ac78c | [
"Apache-2.0"
] | null | null | null | conf.py | Zephor5/seccode_recognize | b78cff0753fc5d524f3c9e36269b3681408ac78c | [
"Apache-2.0"
] | null | null | null | conf.py | Zephor5/seccode_recognize | b78cff0753fc5d524f3c9e36269b3681408ac78c | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
import os
__author__ = 'zephor'
ROOT = os.path.abspath(os.path.dirname(__file__))
DATA_RAW = os.path.join(ROOT, 'data_raw/')
DATA_PREPROCESSED = os.path.join(ROOT, 'data_prep/')
DATA_NAMED = os.path.join(ROOT, 'data_named/')
| 22.090909 | 52 | 0.72428 |
4a047792c57137494fda9ef1d50f6a09bc518fe4 | 2,183 | cpp | C++ | src/dsfml/audio/SoundStream.cpp | baby636/DSFML | d4c11c10d159c8da3b467df7dd78956086c59f2a | [
"Zlib"
] | 1 | 2021-06-22T07:33:48.000Z | 2021-06-22T07:33:48.000Z | src/dsfml/audio/SoundStream.cpp | baby636/DSFML | d4c11c10d159c8da3b467df7dd78956086c59f2a | [
"Zlib"
] | null | null | null | src/dsfml/audio/SoundStream.cpp | baby636/DSFML | d4c11c10d159c8da3b467df7dd78956086c59f2a | [
"Zlib"
] | 1 | 2021-06-22T07:33:46.000Z | 2021-06-22T07:33:46.000Z | #include<SFML/Audio/SoundStream.hpp>
#include<new>
typedef sf::SoundStream::Chunk sfSoundStreamChunk;
typedef sf::Time sfTime;
class sfSoundStream;
// Function to get back in D.
bool __dsfml_sfSoundStream_getDataCallback(sfSoundStream* soundStream, sfSoundStreamChunk* data);
void __dsfml_sfSoundStream_seekCallback(sfSoundStream* soundStream, sfTime timeOffset);
class sfSoundStream : public sf::SoundStream {
public:
sfSoundStream() : sf::SoundStream() {}
void Initialize(unsigned int channelsCount, unsigned int sampleRate) {
sf::SoundStream::Initialize(channelsCount, sampleRate);
}
private :
bool OnGetData(Chunk& data) {
return __dsfml_sfSoundStream_getDataCallback(this, &data);
}
void OnSeek(sf::Time timeOffset) {
__dsfml_sfSoundStream_seekCallback(this, timeOffset);
}
};
void sfSoundStream_Create(sfSoundStream* soundStream) {
new(soundStream) sfSoundStream();
}
void sfSoundStream_Destroy(sfSoundStream* soundStream) {
soundStream->~sfSoundStream();
}
void sfSoundStream_Initialize(sfSoundStream* soundStream, unsigned int channelsCount, unsigned int sampleRate) {
soundStream->Initialize(channelsCount, sampleRate);
}
void sfSoundStream_Play(sfSoundStream* soundStream) {
soundStream->Play();
}
void sfSoundStream_Pause(sfSoundStream* soundStream) {
soundStream->Pause();
}
void sfSoundStream_Stop(sfSoundStream* soundStream) {
soundStream->Stop();
}
sf::Uint32 sfSoundStream_GetChannelCount(const sfSoundStream* soundStream) {
soundStream->GetChannelCount();
}
sf::Uint32 sfSoundStream_GetSampleRate(const sfSoundStream* soundStream) {
soundStream->GetSampleRate();
}
sf::SoundSource::Status sfSoundStream_GetStatus(const sfSoundStream* soundStream) {
soundStream->GetStatus();
}
void sfSoundStream_SetPlayingOffset(sfSoundStream* soundStream, sfTime timeOffset) {
soundStream->SetPlayingOffset(timeOffset);
}
sfTime sfSoundStream_GetPlayingOffset(const sfSoundStream* soundStream) {
return soundStream->GetPlayingOffset();
}
void sfSoundStream_SetLoop(sfSoundStream* soundStream, bool loop) {
soundStream->SetLoop(loop);
}
bool sfSoundStream_GetLoop(const sfSoundStream* soundStream) {
return soundStream->GetLoop();
}
| 26.621951 | 112 | 0.798901 |
f08a085c491a3252a90b285be7754ae1b79a0b4d | 1,558 | dart | Dart | generators/mobx/templates/lib/modules/administration/services/admin_services.dart | bhangun/generator-jhipster-flutter | 2ae6703d4b2a2a991a1e05214dd7fd871c4c2963 | [
"Apache-2.0"
] | 23 | 2019-02-26T13:51:42.000Z | 2021-09-15T14:26:42.000Z | generators/mobx/templates/lib/modules/administration/services/admin_services.dart | bhangun/generator-jhipster-flutter | 2ae6703d4b2a2a991a1e05214dd7fd871c4c2963 | [
"Apache-2.0"
] | 7 | 2019-07-08T13:51:26.000Z | 2019-12-17T19:11:41.000Z | generators/mobx/templates/lib/modules/administration/services/admin_services.dart | bhangun/generator-jhipster-flutter | 2ae6703d4b2a2a991a1e05214dd7fd871c4c2963 | [
"Apache-2.0"
] | 5 | 2019-05-21T22:31:05.000Z | 2021-07-21T13:25:50.000Z |
//import 'package:f_logs/f_logs.dart';
class AdminServices {
/* static Future<Health> systemHealth() async {
var data = await RestServices.fetch('management/health');
//FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future systemMetrics() async {
var data = await RestServices.fetch('management/jhimetrics');
// FLog.info(text:data.toString());
return Meters.fromJson(data);
}
static Future systemThreadDump() async {
var data = await RestServices.fetch('management/threaddump');
//FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future getLoggers() async {
var data = await RestServices.fetch('management/loggers');
// FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future changeLogLevel(name, configuredLevel) async {
var data = await RestServices.fetch('management/loggers/' + name);
//FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future getConfigurations() async {
var data = await RestServices.fetch('management/configprops');
//FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future getEnv() async {
var data = await RestServices.fetch('management/env');
//FLog.info(text:data.toString());
return Health.fromJson(data);
}
static Future getAudits(page, size, sort, fromDate, toDate) async {
return await RestServices.fetch(
'management/audits?page=$page&size=$size&sort=$sort');
} */
}
| 29.396226 | 71 | 0.684211 |
a96719bb2c0f059ade2eafa06416703712b7dcc2 | 253 | swift | Swift | IVCalc/IVCalc/IVPMCollectionViewCell.swift | lozy219/IVCalc | dbd1b6dcd6d5f5c2c666a46eb581704b2cdabb45 | [
"MIT"
] | 1 | 2016-08-26T16:02:23.000Z | 2016-08-26T16:02:23.000Z | IVCalc/IVCalc/IVPMCollectionViewCell.swift | lozy219/IVCalc | dbd1b6dcd6d5f5c2c666a46eb581704b2cdabb45 | [
"MIT"
] | null | null | null | IVCalc/IVCalc/IVPMCollectionViewCell.swift | lozy219/IVCalc | dbd1b6dcd6d5f5c2c666a46eb581704b2cdabb45 | [
"MIT"
] | null | null | null | //
// IVPMCollectionViewCell.swift
// IVCalc
//
// Created by Lei Mingyu on 24/7/16.
// Copyright © 2016 mingyu. All rights reserved.
//
import UIKit
class IVPMCollectionViewCell: UICollectionViewCell {
@IBOutlet var imageView: UIImageView!
}
| 18.071429 | 52 | 0.72332 |
04ab22fa47d401f7c8185533e64607ab9e0e0d3c | 5,833 | java | Java | SocialNetwork/Server/src/main/java/kl/socialnetwork/web/controllers/RelationshipController.java | kostadinlambov/social-network | fcd1d64bac2e24b44f3fde7975de3647e014f092 | [
"MIT"
] | 13 | 2019-04-01T15:04:01.000Z | 2022-03-22T08:59:16.000Z | SocialNetwork/Server/src/main/java/kl/socialnetwork/web/controllers/RelationshipController.java | kostadinlambov/social-network | fcd1d64bac2e24b44f3fde7975de3647e014f092 | [
"MIT"
] | 1 | 2022-02-10T19:19:13.000Z | 2022-02-10T19:19:13.000Z | SocialNetwork/Server/src/main/java/kl/socialnetwork/web/controllers/RelationshipController.java | kostadinlambov/Social-Network-Custom-Webpack-Config | e5e5f769e3fc3121cc4a91c7e4531bf255e6bfa3 | [
"MIT"
] | 8 | 2021-04-09T12:25:07.000Z | 2022-03-23T02:06:39.000Z | package kl.socialnetwork.web.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
import kl.socialnetwork.domain.models.serviceModels.RelationshipServiceModel;
import kl.socialnetwork.domain.models.viewModels.relationship.FriendsAllViewModel;
import kl.socialnetwork.domain.models.viewModels.relationship.FriendsCandidatesViewModel;
import kl.socialnetwork.services.RelationshipService;
import kl.socialnetwork.utils.responseHandler.exceptions.CustomException;
import kl.socialnetwork.utils.responseHandler.successResponse.SuccessResponse;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static kl.socialnetwork.utils.constants.ResponseMessageConstants.*;
@RestController
@RequestMapping(value = "/relationship")
public class RelationshipController {
private final RelationshipService relationshipService;
private final ModelMapper modelMapper;
private final ObjectMapper objectMapper;
@Autowired
public RelationshipController(RelationshipService relationshipService, ModelMapper modelMapper, ObjectMapper objectMapper) {
this.relationshipService = relationshipService;
this.modelMapper = modelMapper;
this.objectMapper = objectMapper;
}
@GetMapping(value = "/friends/{id}")
public List<FriendsAllViewModel> findAllFriends(@PathVariable String id) throws Exception {
List<RelationshipServiceModel> allFriends = this.relationshipService.findAllUserRelationshipsWithStatus(id);
List<FriendsAllViewModel> friendsAllViewModels = allFriends.stream().map(relationshipServiceModel -> {
if (!relationshipServiceModel.getUserOne().getId().equals(id)) {
return this.modelMapper.map(relationshipServiceModel.getUserOne(), FriendsAllViewModel.class);
}
return this.modelMapper.map(relationshipServiceModel.getUserTwo(), FriendsAllViewModel.class);
}).collect(Collectors.toList());
return friendsAllViewModels;
}
@PostMapping(value = "/addFriend")
public ResponseEntity addFriend(@RequestBody Map<String, Object> body) throws Exception {
String loggedInUserId = (String) body.get("loggedInUserId");
String friendCandidateId = (String) body.get("friendCandidateId");
boolean result = this.relationshipService.createRequestForAddingFriend(loggedInUserId, friendCandidateId);
if (result) {
SuccessResponse successResponse = new SuccessResponse(LocalDateTime.now(), SUCCESSFUL_FRIEND_REQUEST_SUBMISSION_MESSAGE, "", true);
return new ResponseEntity<>(this.objectMapper.writeValueAsString(successResponse), HttpStatus.OK);
}
throw new CustomException(SERVER_ERROR_MESSAGE);
}
@PostMapping(value = "/removeFriend")
public ResponseEntity removeFriend(@RequestBody Map<String, Object> body) throws Exception {
String loggedInUserId = (String) body.get("loggedInUserId");
String friendToRemoveId = (String) body.get("friendToRemoveId");
boolean result = this.relationshipService.removeFriend(loggedInUserId, friendToRemoveId);
if (result) {
SuccessResponse successResponse = new SuccessResponse(LocalDateTime.now(), SUCCESSFUL_FRIEND_REMOVE_MESSAGE, "", true);
return new ResponseEntity<>(this.objectMapper.writeValueAsString(successResponse), HttpStatus.OK);
}
throw new CustomException(SERVER_ERROR_MESSAGE);
}
@PostMapping(value = "/acceptFriend")
public ResponseEntity acceptFriend(@RequestBody Map<String, Object> body) throws Exception {
String loggedInUserId = (String) body.get("loggedInUserId");
String friendToAcceptId = (String) body.get("friendToAcceptId");
boolean result = this.relationshipService.acceptFriend(loggedInUserId, friendToAcceptId);
if (result) {
SuccessResponse successResponse = new SuccessResponse(LocalDateTime.now(), SUCCESSFUL_ADDED_FRIEND_MESSAGE, "", true);
return new ResponseEntity<>(this.objectMapper.writeValueAsString(successResponse), HttpStatus.OK);
}
throw new CustomException(SERVER_ERROR_MESSAGE);
}
@PostMapping(value = "/cancelRequest")
public ResponseEntity cancelFriendshipRequest(@RequestBody Map<String, Object> body) throws Exception {
String loggedInUserId = (String) body.get("loggedInUserId");
String friendToRejectId = (String) body.get("friendToRejectId");
boolean result = this.relationshipService.cancelFriendshipRequest(loggedInUserId, friendToRejectId);
if (result) {
SuccessResponse successResponse = new SuccessResponse(LocalDateTime.now(), SUCCESSFUL_REJECT_FRIEND_REQUEST_MESSAGE, "", true);
return new ResponseEntity<>(this.objectMapper.writeValueAsString(successResponse), HttpStatus.OK);
}
throw new CustomException(SERVER_ERROR_MESSAGE);
}
@PostMapping(value = "/search", produces = "application/json")
public List<FriendsCandidatesViewModel> searchUsers(@RequestBody Map<String, Object> body) {
String loggedInUserId = (String) body.get("loggedInUserId");
String search = (String) body.get("search");
return this.relationshipService.searchUsers(loggedInUserId, search);
}
@GetMapping(value = "/findFriends/{id}", produces = "application/json")
public List<FriendsCandidatesViewModel> findAllNotFriends(@PathVariable String id) {
return this.relationshipService.findAllFriendCandidates(id);
}
}
| 45.929134 | 143 | 0.749871 |
598e16afd369a0157cb3ad88aa79d768457af45c | 1,801 | cpp | C++ | src/common.cpp | ycsoft/navigate | 3cb23e75adeb639552735fc28b65d7413300163c | [
"MIT"
] | 15 | 2015-08-27T14:06:48.000Z | 2021-03-04T18:32:08.000Z | src/common.cpp | ycsoft/navigate | 3cb23e75adeb639552735fc28b65d7413300163c | [
"MIT"
] | 2 | 2015-09-06T09:45:10.000Z | 2015-09-16T04:42:11.000Z | src/common.cpp | ycsoft/navigate | 3cb23e75adeb639552735fc28b65d7413300163c | [
"MIT"
] | 8 | 2015-08-27T13:04:27.000Z | 2020-09-27T03:13:58.000Z |
#include <cmath>
#include "common.h"
/*!
* \brief 转换double型数据的字节序
* \param x
*/
void toDouble(real &x)
{
charDouble cd;
cd.db = x;
char c[REAL_TYPE_SIZE] = {0};
int tpsize = REAL_TYPE_SIZE;
for ( int i = 0; i < tpsize; ++i)
c[i] = cd.c[tpsize-i-1];
x = *(real*)c;
}
/*!
* \brief 转换int型数据字节序
* \param x
*/
void toBigEndian(int& x)
{
x = ( (x & 0x000000ff) << 24 ) | ( (x & 0x0000ff00) << 8)
| ((x & 0x00ff0000) >> 8) | ( (x & 0xff000000) >> 24);
}
/*!
* \brief 将楼层点编号,转换为楼宇全局编号
* \param floorCode
* \param floorNubmer
* \return
*/
int floorPCodeToGlobePCode(int floorCode, int floorNumber)
{
if (floorCode < 0)
{
return floorCode;
}
if (floorNumber < 0)
{
return GLOBAL_FLOOR_CODE_BASE * floorNumber - floorCode;
}
else
{
return GLOBAL_FLOOR_CODE_BASE * floorNumber + floorCode;
}
}
/*!
* \brief 从全局点编号得到楼层的自然序号
* \param globePointCode 全局点编号
* \return 楼层自然序号
*/
int globePointToFloorNumber(int globePointCode)
{
return globePointCode / GLOBAL_FLOOR_CODE_BASE;
}
// split the string
vector<string> split(string str, string pattern)
{
string::size_type pos;
vector<string> result;
str += pattern;//扩展字符串以方便操作
size_t size=str.size();
for(size_t i = 0; i < size; i++)
{
pos = str.find(pattern,i);
if (pos < size)
{
std::string s=str.substr(i, pos-i);
result.push_back(s);
i = pos+pattern.size() - 1;
}
}
return result;
}
// 计算两点的距离
double calTwoPointDistance(double x1, double y1, double x2, double y2)
{
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
//template< typename T>
//bool isInVector(T &value, vector<T> dest)
//{
//}
| 18.377551 | 70 | 0.566907 |
13d7ac24699a9ec5922aadaf66fbcfbcdb4b8858 | 278 | asm | Assembly | programs/oeis/073/A073521.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/073/A073521.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/073/A073521.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A073521: The set of 16 consecutive primes with the property that they form a 4 X 4 magic square with the smallest magic constant (258).
; 31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101
add $0,9
seq $0,98090 ; Numbers k such that 2k-3 is prime.
sub $0,17
mul $0,2
add $0,31
| 30.888889 | 137 | 0.708633 |
94145e6a4e5723d5ad8142788b450e0011bcbfbd | 1,882 | ps1 | PowerShell | NDESAppPoolKeyPermissions.ps1 | Sleepw4lker/NDESmanualInstallation | 912ee1c6931560951c2d957779001080ad84246b | [
"MIT"
] | null | null | null | NDESAppPoolKeyPermissions.ps1 | Sleepw4lker/NDESmanualInstallation | 912ee1c6931560951c2d957779001080ad84246b | [
"MIT"
] | null | null | null | NDESAppPoolKeyPermissions.ps1 | Sleepw4lker/NDESmanualInstallation | 912ee1c6931560951c2d957779001080ad84246b | [
"MIT"
] | null | null | null | <#
.SYNOPSIS
Identifies all Enrollment Agent Certificates in the Machine Context and grants Read Permission to the SCEP Application Pool
Useful when using custom NDES Service Certificates in Combination with the Built-In Application Pool Identity
.Notes
AUTHOR: Uwe Gradenegger
#Requires -Version 3.0
#>
[cmdletbinding()]
param()
begin {
New-Variable `
-Option Constant `
-Name szOID_ENROLLMENT_AGENT `
-Value "1.3.6.1.4.1.311.20.2.1"
}
process {
Get-ChildItem Cert:\LocalMachine\My |
Where-Object { $_.EnhancedKeyUsageList.ObjectId -match $szOID_ENROLLMENT_AGENT } |
ForEach-Object -Process {
$CertificateObject = $_
$PrivateKeyObject = [System.Security.Cryptography.X509Certificates.RSACertificateExtensions]::GetRSAPrivateKey($CertificateObject)
$KeyFileName = $PrivateKeyObject.key.UniqueName
$KeyFilePath = "$env:ALLUSERSPROFILE\Microsoft\Crypto\RSA\MachineKeys\$KeyFileName"
Try {
$KeyAcl = Get-Acl -Path $KeyFilePath
}
Catch {
Write-Error -Message "Getting Privatee Key Permissions on Certificate $($CertificateObject.Thumbprint) failed."
return
}
$AclEntry = New-Object System.Security.AccessControl.FileSystemAccessRule(
"IIS AppPool\SCEP",
'Read',
'None',
'None',
'Allow'
)
$KeyAcl.AddAccessRule($AclEntry)
Try {
Set-Acl -Path $KeyFilePath -AclObject $KeyAcl
}
Catch {
Write-Error -Message "Setting Privatee Key Permissions on Certificate $($CertificateObject.Thumbprint) failed."
return
}
# Returning the processed Certificate just to see that something has happened
$CertificateObject
}
}
end {} | 27.676471 | 138 | 0.632306 |
dddca0cb2873dd5bf289923716a688677bc38d31 | 3,217 | c | C | 4_World/Plugins/PluginBase/AdminTools/AdminTools.c | MMusto/VPP-Admin-Tools | 927cd16f254a47ed03c632e112eb8c09eff7795e | [
"0BSD"
] | 1 | 2020-10-02T22:09:49.000Z | 2020-10-02T22:09:49.000Z | 4_World/Plugins/PluginBase/AdminTools/AdminTools.c | MMusto/VPP-Admin-Tools | 927cd16f254a47ed03c632e112eb8c09eff7795e | [
"0BSD"
] | null | null | null | 4_World/Plugins/PluginBase/AdminTools/AdminTools.c | MMusto/VPP-Admin-Tools | 927cd16f254a47ed03c632e112eb8c09eff7795e | [
"0BSD"
] | null | null | null | class AdminTools extends PluginBase
{
void AdminTools()
{
//---RPC's-----
//GetRPCManager().AddRPC( "RPC_AdminTools", "AttachTo", this, SingeplayerExecutionType.Server );
GetRPCManager().AddRPC( "RPC_AdminTools", "DeleteObject", this, SingeplayerExecutionType.Server );
GetRPCManager().AddRPC( "RPC_AdminTools", "TeleportToPosition", this, SingeplayerExecutionType.Server );
GetRPCManager().AddRPC( "RPC_AdminTools", "ToggleFreeCam", this, SingeplayerExecutionType.Server );
//-------------
}
void DeleteObject(CallType type, ParamsReadContext ctx, PlayerIdentity sender, Object target)
{
if (type == CallType.Server)
{
if (!GetPermissionManager().VerifyPermission(sender.GetPlainId(), "DeleteObjectAtCrosshair")) return;
if (target)
{
GetGame().ObjectDelete(target);
GetSimpleLogger().Log(string.Format("Player Name[%1] GUID[%2] Just deleted an object!",sender.GetPlainId(), sender.GetName()));
}
}
}
void AttachTo(CallType type, ParamsReadContext ctx, PlayerIdentity sender, Object target)
{
Param1< Object > data; //Caries player
if ( !ctx.Read( data ) && !data.param1) return;
auto relativeLocalPos = target.CoordToLocal( data.param1.GetPosition() );
auto playerObj = PlayerBase.Cast( data.param1 );
if( playerObj ){
vector pLocalSpaceMatrix[ 4 ];
pLocalSpaceMatrix[ 3 ] = relativeLocalPos;
playerObj.LinkToLocalSpaceOf( target, pLocalSpaceMatrix );
return;
}
//Attach other non player objects using AddChild
data.param1.SetPosition( relativeLocalPos );
target.AddChild( data.param1, -1, false );
}
void TeleportToPosition( CallType type, ParamsReadContext ctx, PlayerIdentity sender, Object target )
{
Param1<vector> data;
if ( !ctx.Read( data ) ) return;
if (type == CallType.Server)
{
if (!GetPermissionManager().VerifyPermission(sender.GetPlainId(), "TeleportToCrosshair")) return;
autoptr PlayerBase pb = GetPermissionManager().GetPlayerBaseByID(sender.GetPlainId());
if (pb == null) return;
if (pb.IsInVehicle())
{
autoptr Transport transportVeh = pb.GetCommand_Vehicle().GetTransport();
if (transportVeh != null)
{
vector vehTransform[4];
transportVeh.GetTransform(vehTransform);
vehTransform[3] = data.param1;
transportVeh.MoveInTime(vehTransform, 0.1);
}
}else{
pb.SetPosition(data.param1);
}
GetSimpleLogger().Log(string.Format("Player Name[%1] GUID[%2] Teleported to crosshair position! [%3]",sender.GetPlainId(), sender.GetName(), data.param1));
}
}
void ToggleFreeCam(CallType type, ParamsReadContext ctx, PlayerIdentity sender, Object target)
{
if (type == CallType.Server && sender != null)
{
if (!GetPermissionManager().VerifyPermission(sender.GetPlainId(), "FreeCamera")) return;
GetRPCManager().SendRPC( "RPC_HandleFreeCam", "HandleFreeCam", new Param1<bool>(true), true, sender);
GetSimpleLogger().Log(string.Format("Player Name[%1] GUID[%2] Toggled Freecam!",sender.GetPlainId(), sender.GetName()));
}
}
} | 39.231707 | 158 | 0.665838 |
1d7cb5c413d19b5ab273a4ec334566030f98a4f3 | 14,668 | asm | Assembly | programs/99_bottles_of_beer.asm | lucaspiller/dcpu16-ide | a0b3b52d803c22c7c5b1aa04e5549b3c3dd09f58 | [
"MIT"
] | 1 | 2019-01-27T21:05:54.000Z | 2019-01-27T21:05:54.000Z | programs/99_bottles_of_beer.asm | lucaspiller/dcpu16-ide | a0b3b52d803c22c7c5b1aa04e5549b3c3dd09f58 | [
"MIT"
] | null | null | null | programs/99_bottles_of_beer.asm | lucaspiller/dcpu16-ide | a0b3b52d803c22c7c5b1aa04e5549b3c3dd09f58 | [
"MIT"
] | null | null | null | ; generated by esotope-bfc (DCPU branch)
SET A, mem
SET [A], 0
SET [A+1], 23
SET [A+2], 0
SET [A+3], 0
:L0
IFE [A+1], 0
SET PC, L1
SET PUSH, 6
ADD PEEK, [A+1]
ADD [A+2], POP
ADD [A+3], [A+1]
SET PUSH, 90
ADD PEEK, [A+2]
SET [A+1], POP
SET PUSH, 65535
ADD PEEK, [A+3]
SET [A+2], POP
SET [A+3], 0
ADD A, 1
SET PC, L0
:L1
ADD [A+2], 9
SET PUSH, 3
SET B, [A+2]
MUL B, 9
ADD PEEK, B
SET [A+1], POP
ADD [A+3], 6
SET PUSH, 65534
SET B, [A+3]
SHL B, 3
ADD PEEK, B
SET [A+2], POP
SET PUSH, 65534
ADD PEEK, [A+2]
SET [A+3], POP
ADD [A+4], [A+2]
SET [A+2], [A+4]
ADD [A+5], 4
SET PUSH, 0
SET B, [A+5]
SHL B, 3
ADD PEEK, B
SET [A+4], POP
SET [A+5], 10
ADD [A+6], 9
SET PUSH, 0
SET B, [A+6]
MUL B, 11
ADD PEEK, B
ADD [A+7], POP
SET [A+6], 0
:L2
IFE [A+7], 0
SET PC, L3
ADD [A+8], [A+7]
ADD [A+9], [A+7]
ADD [A+10], [A+7]
SET [A+7], [A+8]
SET [A+8], 0
:L4
IFE [A+10], 0
SET PC, L5
ADD [A+11], [A+10]
ADD [A+12], [A+10]
SET [A+10], [A+12]
SET [A+12], 0
IFE [A+11], 0
SET PC, L6
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L7
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L8
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L9
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L10
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L11
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L12
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L13
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L14
SUB [A+11], 1
SUB [A+10], 1
IFE [A+11], 0
SET PC, L15
SUB [A+10], 1
ADD [A+8], 1
SUB [A+9], 10
SET [A+11], 0
:L15
SET [A+11], 0
:L14
SET [A+11], 0
:L13
SET [A+11], 0
:L12
SET [A+11], 0
:L11
SET [A+11], 0
:L10
SET [A+11], 0
:L9
SET [A+11], 0
:L8
SET [A+11], 0
:L7
SET [A+11], 0
:L6
SET [A+11], 0
SET PC, L4
:L5
:L16
IFE [A+8], 0
SET PC, L17
ADD [A+10], 12
SET PUSH, 0
SET B, [A+10]
SHL B, 2
ADD PEEK, B
ADD [A+8], POP
SET PUSH, 0
SET B, [A+10]
SHL B, 2
ADD PEEK, B
ADD [A+9], POP
SET [A+10], 0
:L18
IFE [A+8], 0
SET PC, L19
SET B, [A+8]
JSR putc
SET [A+8], 0
ADD A, 1
SET PC, L18
:L19
SUB A, 2
SET PC, L16
:L17
IFE [A+9], 0
SET PC, L20
ADD [A+8], 6
SET PUSH, 0
SET B, [A+8]
SHL B, 3
ADD PEEK, B
ADD [A+9], POP
SET [A+8], 0
SET B, [A+9]
JSR putc
SET [A+9], 0
:L20
SET [A+9], 0
SET B, [A+4]
JSR putc
SET B, [A+65535]
JSR putc
:L21
IFE [A+65535], 0
SET PC, L22
SUB A, 1
SET PC, L21
:L22
SET B, [A+8]
JSR putc
SET B, [A+3]
JSR putc
SET B, [A+3]
JSR putc
SET B, [A+11]
JSR putc
SET B, [A+18]
JSR putc
:L23
IFE [A+18], 0
SET PC, L24
ADD A, 1
SET PC, L23
:L24
ADD [A+20], [A+19]
ADD [A+21], [A+19]
SET [A+19], [A+20]
SET [A+20], 0
IFE [A+21], 0
SET PC, L25
SUB [A+21], 1
IFE [A+21], 0
SET PC, L26
SET [A+21], 0
ADD [A+20], 0x73
SET B, [A+20]
JSR putc
SET [A+20], 0
:L26
SET [A+21], 0
:L25
SET [A+21], 0
SET B, [A+16]
JSR putc
:L27
IFE [A+16], 0
SET PC, L28
SUB A, 1
SET PC, L27
:L28
SET B, [A+25]
JSR putc
SET B, [A+34]
JSR putc
:L29
IFE [A+34], 0
SET PC, L30
ADD A, 1
SET PC, L29
:L30
SET B, [A+32]
JSR putc
SET B, [A+27]
JSR putc
SET B, [A+24]
JSR putc
SET B, [A+24]
JSR putc
:L31
IFE [A+24], 0
SET PC, L32
SUB A, 1
SET PC, L31
:L32
SET B, [A+30]
JSR putc
:L33
IFE [A+30], 0
SET PC, L34
ADD A, 1
SET PC, L33
:L34
SET B, [A+28]
JSR putc
:L35
IFE [A+28], 0
SET PC, L36
SUB A, 1
SET PC, L35
:L36
SET B, [A+37]
JSR putc
SET B, [A+38]
JSR putc
:L37
IFE [A+38], 0
SET PC, L38
ADD A, 1
SET PC, L37
:L38
SET B, [A+36]
JSR putc
:L39
IFE [A+36], 0
SET PC, L40
SUB A, 1
SET PC, L39
:L40
SET B, [A+40]
JSR putc
SET B, [A+52]
JSR putc
SET B, [A+55]
JSR putc
:L41
IFE [A+55], 0
SET PC, L42
ADD A, 1
SET PC, L41
:L42
SET B, [A+53]
JSR putc
:L43
IFE [A+53], 0
SET PC, L44
SUB A, 1
SET PC, L43
:L44
SET B, [A+54]
JSR putc
:L45
IFE [A+54], 0
SET PC, L46
ADD A, 1
SET PC, L45
:L46
SET B, [A+48]
JSR putc
SET B, [A+37]
JSR putc
SET B, [A+37]
JSR putc
:L47
IFE [A+37], 0
SET PC, L48
ADD A, 1
SET PC, L47
:L48
SET B, [A+34]
JSR putc
SET B, [A+35]
JSR putc
:L49
IFE [A+35], 0
SET PC, L50
ADD A, 1
SET PC, L49
:L50
ADD [A+37], [A+36]
ADD [A+38], [A+36]
ADD [A+39], [A+36]
SET [A+36], [A+37]
SET [A+37], 0
:L51
IFE [A+39], 0
SET PC, L52
ADD [A+40], [A+39]
ADD [A+41], [A+39]
SET [A+39], [A+41]
SET [A+41], 0
IFE [A+40], 0
SET PC, L53
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L54
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L55
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L56
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L57
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L58
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L59
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L60
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L61
SUB [A+40], 1
SUB [A+39], 1
IFE [A+40], 0
SET PC, L62
SUB [A+39], 1
ADD [A+37], 1
SUB [A+38], 10
SET [A+40], 0
:L62
SET [A+40], 0
:L61
SET [A+40], 0
:L60
SET [A+40], 0
:L59
SET [A+40], 0
:L58
SET [A+40], 0
:L57
SET [A+40], 0
:L56
SET [A+40], 0
:L55
SET [A+40], 0
:L54
SET [A+40], 0
:L53
SET [A+40], 0
SET PC, L51
:L52
:L63
IFE [A+37], 0
SET PC, L64
ADD [A+39], 12
SET PUSH, 0
SET B, [A+39]
SHL B, 2
ADD PEEK, B
ADD [A+37], POP
SET PUSH, 0
SET B, [A+39]
SHL B, 2
ADD PEEK, B
ADD [A+38], POP
SET [A+39], 0
:L65
IFE [A+37], 0
SET PC, L66
SET B, [A+37]
JSR putc
SET [A+37], 0
ADD A, 1
SET PC, L65
:L66
SUB A, 2
SET PC, L63
:L64
IFE [A+38], 0
SET PC, L67
ADD [A+37], 6
SET PUSH, 0
SET B, [A+37]
SHL B, 3
ADD PEEK, B
ADD [A+38], POP
SET [A+37], 0
SET B, [A+38]
JSR putc
SET [A+38], 0
:L67
SET [A+38], 0
SET B, [A+33]
JSR putc
SET B, [A+28]
JSR putc
:L68
IFE [A+28], 0
SET PC, L69
SUB A, 1
SET PC, L68
:L69
SET B, [A+37]
JSR putc
SET B, [A+32]
JSR putc
SET B, [A+32]
JSR putc
SET B, [A+40]
JSR putc
SET B, [A+47]
JSR putc
:L70
IFE [A+47], 0
SET PC, L71
ADD A, 1
SET PC, L70
:L71
ADD [A+49], [A+48]
ADD [A+50], [A+48]
SET [A+48], [A+49]
SET [A+49], 0
IFE [A+50], 0
SET PC, L72
SUB [A+50], 1
IFE [A+50], 0
SET PC, L73
SET [A+50], 0
ADD [A+49], 0x73
SET B, [A+49]
JSR putc
SET [A+49], 0
:L73
SET [A+50], 0
:L72
SET [A+50], 0
SET B, [A+45]
JSR putc
:L74
IFE [A+45], 0
SET PC, L75
SUB A, 1
SET PC, L74
:L75
SET B, [A+54]
JSR putc
SET B, [A+63]
JSR putc
:L76
IFE [A+63], 0
SET PC, L77
ADD A, 1
SET PC, L76
:L77
SET B, [A+61]
JSR putc
SET B, [A+56]
JSR putc
SET B, [A+53]
JSR putc
SET B, [A+53]
JSR putc
:L78
IFE [A+53], 0
SET PC, L79
SUB A, 1
SET PC, L78
:L79
SET B, [A+59]
JSR putc
:L80
IFE [A+59], 0
SET PC, L81
ADD A, 1
SET PC, L80
:L81
SET B, [A+55]
JSR putc
SET B, [A+58]
JSR putc
SET B, [A+54]
JSR putc
SET B, [A+53]
JSR putc
SET B, [A+43]
JSR putc
SET B, [A+49]
JSR putc
:L82
IFE [A+49], 0
SET PC, L83
ADD A, 1
SET PC, L82
:L83
SET B, [A+47]
JSR putc
:L84
IFE [A+47], 0
SET PC, L85
SUB A, 1
SET PC, L84
:L85
SET B, [A+56]
JSR putc
SET B, [A+57]
JSR putc
SET B, [A+66]
JSR putc
:L86
IFE [A+66], 0
SET PC, L87
ADD A, 1
SET PC, L86
:L87
SET B, [A+64]
JSR putc
SET B, [A+57]
JSR putc
:L88
IFE [A+57], 0
SET PC, L89
SUB A, 1
SET PC, L88
:L89
SET B, [A+66]
JSR putc
:L90
IFE [A+66], 0
SET PC, L91
SUB A, 1
SET PC, L90
:L91
SET B, [A+67]
JSR putc
SET B, [A+76]
JSR putc
:L92
IFE [A+76], 0
SET PC, L93
ADD A, 1
SET PC, L92
:L93
SET B, [A+74]
JSR putc
SET B, [A+70]
JSR putc
SET B, [A+57]
JSR putc
:L94
IFE [A+57], 0
SET PC, L95
ADD A, 1
SET PC, L94
:L95
SET B, [A+48]
JSR putc
:L96
IFE [A+48], 0
SET PC, L97
ADD A, 1
SET PC, L96
:L97
SET B, [A+46]
JSR putc
:L98
IFE [A+46], 0
SET PC, L99
SUB A, 1
SET PC, L98
:L99
SET B, [A+54]
JSR putc
:L100
IFE [A+54], 0
SET PC, L101
ADD A, 1
SET PC, L100
:L101
SET B, [A+48]
JSR putc
:L102
IFE [A+48], 0
SET PC, L103
SUB A, 1
SET PC, L102
:L103
SET B, [A+53]
JSR putc
SET B, [A+53]
JSR putc
:L104
IFE [A+53], 0
SET PC, L105
ADD A, 1
SET PC, L104
:L105
SET B, [A+51]
JSR putc
SET B, [A+39]
JSR putc
:L106
IFE [A+39], 0
SET PC, L107
SUB A, 1
SET PC, L106
:L107
SET B, [A+43]
JSR putc
:L108
IFE [A+43], 0
SET PC, L109
ADD A, 1
SET PC, L108
:L109
SET B, [A+41]
JSR putc
SET B, [A+37]
JSR putc
:L110
IFE [A+37], 0
SET PC, L111
SUB A, 1
SET PC, L110
:L111
SET B, [A+43]
JSR putc
SET B, [A+46]
JSR putc
SET B, [A+40]
JSR putc
SET B, [A+47]
JSR putc
SET B, [A+57]
JSR putc
:L112
IFE [A+57], 0
SET PC, L113
ADD A, 1
SET PC, L112
:L113
SET B, [A+54]
JSR putc
SET B, [A+55]
JSR putc
SUB [A+58], 1
ADD [A+59], [A+58]
ADD [A+60], [A+58]
ADD [A+61], [A+58]
SET [A+58], [A+59]
SET [A+59], 0
:L114
IFE [A+61], 0
SET PC, L115
ADD [A+62], [A+61]
ADD [A+63], [A+61]
SET [A+61], [A+63]
SET [A+63], 0
IFE [A+62], 0
SET PC, L116
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L117
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L118
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L119
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L120
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L121
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L122
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L123
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L124
SUB [A+62], 1
SUB [A+61], 1
IFE [A+62], 0
SET PC, L125
SUB [A+61], 1
ADD [A+59], 1
SUB [A+60], 10
SET [A+62], 0
:L125
SET [A+62], 0
:L124
SET [A+62], 0
:L123
SET [A+62], 0
:L122
SET [A+62], 0
:L121
SET [A+62], 0
:L120
SET [A+62], 0
:L119
SET [A+62], 0
:L118
SET [A+62], 0
:L117
SET [A+62], 0
:L116
SET [A+62], 0
SET PC, L114
:L115
:L126
IFE [A+59], 0
SET PC, L127
ADD [A+61], 12
SET PUSH, 0
SET B, [A+61]
SHL B, 2
ADD PEEK, B
ADD [A+59], POP
SET PUSH, 0
SET B, [A+61]
SHL B, 2
ADD PEEK, B
ADD [A+60], POP
SET [A+61], 0
:L128
IFE [A+59], 0
SET PC, L129
SET B, [A+59]
JSR putc
SET [A+59], 0
ADD A, 1
SET PC, L128
:L129
SUB A, 2
SET PC, L126
:L127
IFE [A+60], 0
SET PC, L130
ADD [A+59], 6
SET PUSH, 0
SET B, [A+59]
SHL B, 3
ADD PEEK, B
ADD [A+60], POP
SET [A+59], 0
SET B, [A+60]
JSR putc
SET [A+60], 0
:L130
SET [A+60], [A+58]
ADD [A+59], [A+58]
SET [A+58], [A+59]
SET [A+59], 1
IFE [A+60], 0
SET PC, L131
SUB [A+59], 1
SET [A+60], 0
:L131
SET [A+60], 0
:L132
IFE [A+59], 0
SET PC, L133
SUB [A+59], 1
:L134
IFE [A+56], 0
SET PC, L135
SUB A, 1
SET PC, L134
:L135
SET B, [A+66]
JSR putc
SET B, [A+65]
JSR putc
:L136
IFE [A+65], 0
SET PC, L137
ADD A, 1
SET PC, L136
:L137
SET B, [A+63]
JSR putc
:L138
IFE [A+63], 0
SET PC, L139
SUB A, 1
SET PC, L138
:L139
SET B, [A+74]
JSR putc
SET B, [A+72]
JSR putc
SET B, [A+69]
JSR putc
:L140
IFE [A+69], 0
SET PC, L141
ADD A, 1
SET PC, L140
:L141
SET B, [A+59]
JSR putc
:L142
IFE [A+59], 0
SET PC, L143
ADD A, 1
SET PC, L142
:L143
ADD A, 2
SET PC, L132
:L133
SET B, [A+55]
JSR putc
SET B, [A+50]
JSR putc
:L144
IFE [A+50], 0
SET PC, L145
SUB A, 1
SET PC, L144
:L145
SET B, [A+59]
JSR putc
SET B, [A+54]
JSR putc
SET B, [A+54]
JSR putc
SET B, [A+62]
JSR putc
SET B, [A+69]
JSR putc
:L146
IFE [A+69], 0
SET PC, L147
ADD A, 1
SET PC, L146
:L147
ADD [A+71], [A+70]
ADD [A+72], [A+70]
SET [A+70], [A+71]
SET [A+71], 1
IFE [A+72], 0
SET PC, L148
SUB [A+72], 1
SUB [A+71], 1
IFE [A+72], 0
SET PC, L149
ADD [A+71], 1
SET [A+72], 0
:L149
SET [A+72], 0
:L148
SET [A+72], 0
IFE [A+71], 0
SET PC, L150
ADD [A+71], 8
SET PUSH, 2
SET B, [A+71]
MUL B, 13
SUB PEEK, B
SUB [A+72], POP
SET [A+71], 0
SET B, [A+72]
JSR putc
SET [A+72], 0
:L150
SET [A+71], 0
SET B, [A+67]
JSR putc
:L151
IFE [A+67], 0
SET PC, L152
SUB A, 1
SET PC, L151
:L152
SET B, [A+76]
JSR putc
SET B, [A+85]
JSR putc
:L153
IFE [A+85], 0
SET PC, L154
ADD A, 1
SET PC, L153
:L154
SET B, [A+83]
JSR putc
SET B, [A+78]
JSR putc
SET B, [A+75]
JSR putc
SET B, [A+75]
JSR putc
:L155
IFE [A+75], 0
SET PC, L156
SUB A, 1
SET PC, L155
:L156
SET B, [A+81]
JSR putc
:L157
IFE [A+81], 0
SET PC, L158
ADD A, 1
SET PC, L157
:L158
SET B, [A+79]
JSR putc
:L159
IFE [A+79], 0
SET PC, L160
SUB A, 1
SET PC, L159
:L160
SET B, [A+88]
JSR putc
SET B, [A+89]
JSR putc
:L161
IFE [A+89], 0
SET PC, L162
ADD A, 1
SET PC, L161
:L162
SET B, [A+87]
JSR putc
:L163
IFE [A+87], 0
SET PC, L164
SUB A, 1
SET PC, L163
:L164
SET B, [A+91]
JSR putc
SET B, [A+103]
JSR putc
SET B, [A+106]
JSR putc
:L165
IFE [A+106], 0
SET PC, L166
ADD A, 1
SET PC, L165
:L166
SET B, [A+104]
JSR putc
:L167
IFE [A+104], 0
SET PC, L168
SUB A, 1
SET PC, L167
:L168
SET B, [A+105]
JSR putc
:L169
IFE [A+105], 0
SET PC, L170
ADD A, 1
SET PC, L169
:L170
SET B, [A+99]
JSR putc
SET B, [A+88]
JSR putc
SET B, [A+88]
JSR putc
:L171
IFE [A+88], 0
SET PC, L172
ADD A, 1
SET PC, L171
:L172
SET B, [A+84]
JSR putc
SET B, [A+87]
JSR putc
SET B, [A+87]
JSR putc
ADD A, 82
SET PC, L2
:L3
SUB PC, 1
:screenoff
DAT 0
:newline
SET C, [screenoff]
AND C, 0xffe0
ADD C, 0x20
SET [screenoff], C
IFG 0x180, C
SET PC, POP
:scroll
SET C, 0
:scroll_loop
SET [C+0x8000], [C+0x8020]
ADD C, 1
IFG 0x160, C
SET PC, scroll_loop
:scroll_loop2
SET [C+0x8000], 0
ADD C, 1
IFG 0x180, C
SET PC, scroll_loop2
SUB [screenoff], 0x20
SET PC, POP
:putc
IFE B, 10
SET PC, newline
IFG [screenoff], 0x17e
JSR scroll
SET C, [screenoff]
BOR B, 0xf000
SET [C+0x8000], B
ADD C, 1
SET [screenoff], C
SET PC, POP
:mem
DAT 0 ; the start of memory
| 13.456881 | 42 | 0.500205 |
3427021918a85bcc8b0711d8f85b3c599fd75fc4 | 3,096 | lua | Lua | data/scripts/getmissingstrings.lua | GuLiPing-Hz/Dontstarve_m | c2f12c8c2b79ed6d5762b130f5702d70bc020596 | [
"MIT"
] | 4 | 2019-11-18T08:13:29.000Z | 2021-04-02T00:08:35.000Z | data/scripts/getmissingstrings.lua | GuLiPing-Hz/Dontstarve_m | c2f12c8c2b79ed6d5762b130f5702d70bc020596 | [
"MIT"
] | null | null | null | data/scripts/getmissingstrings.lua | GuLiPing-Hz/Dontstarve_m | c2f12c8c2b79ed6d5762b130f5702d70bc020596 | [
"MIT"
] | 2 | 2019-08-04T07:12:15.000Z | 2019-12-24T03:34:16.000Z | package.path = "c:\\DoNotStarve_Branches\\DLC\\data\\scripts\\?.lua;c:\\DoNotStarve_Branches\\DLC\\data\\scripts\\prefabs\\?.lua;"..package.path
local IGNORED_KEYWORDS =
{
"BLUEPRINTS",
"PUPPET",
"PLACER",
"FX",
"PILLAR",
"HERD",
"HUD",
"CHARACTERS",
"FISSURE",
"DEBUG",
"_MED",
"_NORMAL",
"_SHORT",
"_TALL",
"_LOW",
"WORLDS",
}
local function GenerateFile(missingStrings)
local outfile = io.open("MISSINGSTRINGS.lua", "w")
if outfile then
outfile:write(missingStrings)
outfile:close()
end
end
local function GenIndentString(num)
local str = ""
for i = 1, num or 0 do
str = str.."\t"
end
return str
end
local function TableToString(key, table, numIndent)
local indt = GenIndentString(numIndent)
local str = ""
str = str..GenIndentString(numIndent - 1)..key..' = '..'\n'..GenIndentString(numIndent - 1)..'{\n'
for k,v in pairs(table) do
if type(v) == "string" then
str = str..GenIndentString(numIndent)..k..' = '..'"'..v..'",\n'
elseif type(v) == "table" then
str = str..TableToString(k, v, numIndent + 1)
end
end
str = str..GenIndentString(numIndent - 1)..'},\n'
return str
end
function GetPrefabsFromFile( fileName )
local fn, r = loadfile(fileName)
assert(fn, "Could not load file ".. fileName)
if type(fn) == "string" then
assert(false, "Error loading file "..fileName.."\n"..fn)
end
assert( type(fn) == "function", "Prefab file doesn't return a callable chunk: "..fileName)
local ret = {fn()}
return ret
end
local function GetMissingStrings(prefabs, character)
local success, speechFile = pcall(require, "speech_"..character)
if not success then
return nil
end
--print(speechFile)
local missingStrings = nil
for k,v in pairs(prefabs) do
if v and not speechFile.DESCRIBE[v] or (speechFile.DESCRIBE[v] and speechFile.DESCRIBE[v] == "") then
if not missingStrings then
missingStrings = {}
end
missingStrings[v] = ""
end
end
if missingStrings then
return missingStrings
end
end
local function LookForIgnoredKeywords(str)
for k,v in pairs(IGNORED_KEYWORDS) do
local IGNORED_KEYWORD, COUNT = string.gsub(string.upper(str), "("..string.upper(v)..")", "")
if COUNT > 0 then
return true
end
end
end
local function MakePrefabsTable()
local ret = {}
for k,v in pairs(PREFABFILES) do
local prefabs = GetPrefabsFromFile(v)
for l,m in pairs(prefabs) do
if type(m) == "table" then
local name = m.name or nil
if name then
if not LookForIgnoredKeywords(m.path or "SAFEWORD") then
name = string.upper(name)
ret[name] = name
end
else
print("Prefab without name in file: "..v)
end
end
end
end
-- for k,v in pairs(ret) do
-- if LookForIgnoredKeywords(k) then
-- ret[k] = nil
-- end
-- end
return ret
end
local function TestStrings()
local str = ""
local completePrefabList = MakePrefabsTable()
local table = {}
for k,v in pairs(CHARACTERLIST) do
local tbl = GetMissingStrings(completePrefabList, v)
table[v] = tbl
end
GenerateFile(TableToString("Missing Strings", table, 0))
end
TestStrings() | 21.351724 | 144 | 0.669897 |
23ad1323a26295df4e820c79cc1d2c5e17d5b5e9 | 95 | asm | Assembly | src/native/third_party/isa-l/igzip/igzip_body_02.asm | eshelmarc/noobaa-core | a1db60038170f253ebc7049860b652999bea9d25 | [
"Apache-2.0"
] | 178 | 2019-05-07T21:09:12.000Z | 2022-03-24T06:17:51.000Z | src/native/third_party/isa-l/igzip/igzip_body_02.asm | eshelmarc/noobaa-core | a1db60038170f253ebc7049860b652999bea9d25 | [
"Apache-2.0"
] | 761 | 2019-05-13T09:35:59.000Z | 2022-03-31T18:18:06.000Z | src/native/third_party/isa-l/igzip/igzip_body_02.asm | eshelmarc/noobaa-core | a1db60038170f253ebc7049860b652999bea9d25 | [
"Apache-2.0"
] | 57 | 2019-05-30T13:41:29.000Z | 2022-02-20T17:13:01.000Z | %define ARCH 02
%ifndef COMPARE_TYPE
%define COMPARE_TYPE 2
%endif
%include "igzip_body.asm"
| 11.875 | 25 | 0.778947 |
d8e7dfe279d80fc70e313ea493e93d731fb58539 | 2,047 | swift | Swift | GaugesDemo/GaugesDemoTests/FuelGaugeTabTests.swift | iOSObjects/Gauges | 54655468d62d2829a9f83dc828e3c51c5ea8e746 | [
"MIT"
] | null | null | null | GaugesDemo/GaugesDemoTests/FuelGaugeTabTests.swift | iOSObjects/Gauges | 54655468d62d2829a9f83dc828e3c51c5ea8e746 | [
"MIT"
] | null | null | null | GaugesDemo/GaugesDemoTests/FuelGaugeTabTests.swift | iOSObjects/Gauges | 54655468d62d2829a9f83dc828e3c51c5ea8e746 | [
"MIT"
] | null | null | null | //
// FuelGaugeTabTests.swift
// GaugesDemo
//
// Created by Ron Lisle on 4/5/15.
// Copyright (c) 2015 Ron Lisle. All rights reserved.
//
import UIKit
import XCTest
import FuelGaugeKit
class FuelGaugeTabTests: XCTestCase {
var vc: FuelGaugeViewController!
override func setUp() {
super.setUp()
let storyboard = UIStoryboard(name: "Main", bundle: NSBundle(forClass: self.dynamicType))
vc = storyboard.instantiateViewControllerWithIdentifier("FuelVC") as! FuelGaugeViewController
let dummy = vc.view // force loading subviews and setting outlets
vc.viewDidLoad()
}
func testFirstViewControllerLoaded() {
XCTAssertNotNil(vc, "FirstViewController not found")
}
func testSliderCreated() {
let slider = vc.slider
XCTAssertNotNil(slider, "Slider not created or connected")
}
func testEmptyButtonCreated() {
let emptyButton = vc.emptyButton
XCTAssertNotNil(emptyButton, "Empty button not created or connected")
}
func testFullButtonCreated() {
let fullButton = vc.fullButton
XCTAssertNotNil(fullButton, "Full button not created or connected")
}
func testEmptyButtonSetsSliderToZero() {
vc.emptyPressed(vc.emptyButton)
let level = vc.slider.value
XCTAssertEqualWithAccuracy(level, 0.0, 0.0001, "Slider s/b zero but is \(level)")
}
func testFullButtonSetsSliderToOne() {
vc.fullPressed(vc.fullButton)
let level = vc.slider.value
XCTAssertEqualWithAccuracy(level, 1.0, 0.0001, "Slider s/b 1.0 but is \(level)")
}
func testFuelGaugeViewCreated() {
let fuelGauge = vc.fuelGauge
XCTAssertNotNil(fuelGauge, "Fuel gauge view not created or connected")
}
func testThatFuelGaugeViewSubclassesFuelGaugeKit() {
let fuelGauge = vc.fuelGauge
XCTAssert(fuelGauge is FuelGaugeView, "Fuel gauge view not a subclass of FuelGaugeView")
}
}
| 28.830986 | 101 | 0.659502 |
d2402070bdf10f2eab2be2ffb4d673ad2a43df56 | 2,432 | html | HTML | assets/samples/13_form/01_controls/10_buttons_image.html | sefalbe/agenda_pixxels | 38eb18d8ccf4698546fffcb41ff19669b45c1c8b | [
"MIT"
] | null | null | null | assets/samples/13_form/01_controls/10_buttons_image.html | sefalbe/agenda_pixxels | 38eb18d8ccf4698546fffcb41ff19669b45c1c8b | [
"MIT"
] | null | null | null | assets/samples/13_form/01_controls/10_buttons_image.html | sefalbe/agenda_pixxels | 38eb18d8ccf4698546fffcb41ff19669b45c1c8b | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="../../../codebase/webix.css?v=7.1.4" type="text/css" charset="utf-8">
<script src="../../../codebase/webix.js?v=7.1.4" type="text/javascript" charset="utf-8"></script>
<title>Image Button ('button')</title>
</head>
<body>
<div id="data_container" style="width:885px;height:345px;margin:20px"></div>
<script>
webix.ui({
container:"data_container",
rows:[
{template:"type: image", type:"header", css:"webix_dark"},
{cols:[
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_secondary", align:"center" },
{ view:"button", label:"Play", image:"./play.png", type:"image" }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_primary", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_primary", type:"image" }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_transparent", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_transparent", type:"image" }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_danger", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_danger", type:"image" }
]}
]},
{template:"type: imageTop", type:"header", css:"webix_dark"},
{cols:[
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_secondary", align:"center" },
{ view:"button", label:"Play", image:"./play.png", type:"imageTop", height:54 }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_primary", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_primary", type:"imageTop", height:54 }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_transparent", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_transparent", type:"imageTop", height:54 }
]},
{view:"form", width:220, scroll:false, elements:[
{ view:"label", label:"webix_danger", align:"center" },
{ view:"button", label:"Play", image:"./play.png", css:"webix_danger", type:"imageTop", height:54 }
]}
]},
]
});
</script>
</body>
</html> | 42.666667 | 111 | 0.593339 |
bf7056622c708533a9a31be7aa26d90f42354aa3 | 204 | kt | Kotlin | compiler/testData/writeFlags/function/deprecatedFlag/setter.kt | VISTALL/consulo-kotlin | 6b565de6042440386e6d0302d14824353e926848 | [
"Apache-2.0"
] | null | null | null | compiler/testData/writeFlags/function/deprecatedFlag/setter.kt | VISTALL/consulo-kotlin | 6b565de6042440386e6d0302d14824353e926848 | [
"Apache-2.0"
] | null | null | null | compiler/testData/writeFlags/function/deprecatedFlag/setter.kt | VISTALL/consulo-kotlin | 6b565de6042440386e6d0302d14824353e926848 | [
"Apache-2.0"
] | null | null | null | class MyClass() {
var test = 1
@deprecated("") set(i: Int) { test = i }
}
// TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: MyClass, setTest
// FLAGS: ACC_DEPRECATED, ACC_PUBLIC, ACC_FINAL
| 20.4 | 48 | 0.656863 |
f031e85ceed23e8e51db2d63b055188c4a82beb9 | 1,249 | js | JavaScript | lib/2016/04.js | alvaro-cuesta/aoc-js | d3ceb17cff385bd08b724521ece8be791af647a5 | [
"0BSD"
] | 2 | 2020-12-05T16:46:51.000Z | 2021-12-05T20:53:59.000Z | lib/2016/04.js | alvaro-cuesta/aoc-js | d3ceb17cff385bd08b724521ece8be791af647a5 | [
"0BSD"
] | 8 | 2020-07-21T12:49:21.000Z | 2020-12-05T13:30:01.000Z | lib/2016/04.js | alvaro-cuesta/aoc-js | d3ceb17cff385bd08b724521ece8be791af647a5 | [
"0BSD"
] | null | null | null | const R = require('ramda')
const { sortedFrequency } = require('../utils')
const parseRoom = (str) => {
const match = str.match(/^([a-z-]+)-(\d+)\[([a-z]{5})\]$/)
if (match === null) {
console.error(str)
throw new Error('Invalid room match')
}
return {
name: match[1],
sector: parseInt(match[2], 10),
checksum: match[3],
}
}
const isValidRoom = ({ name, checksum }) => {
const occurrences = sortedFrequency(name.replace(/-/g, ''))
const mostFrequent = R.pipe(
R.take(5),
R.map(R.nth(0)),
R.join(''),
)(occurrences)
return mostFrequent === checksum
}
const parseInput = (input) =>
input.trim().split('\n').map(parseRoom).filter(isValidRoom)
const part1 = (input) =>
parseInput(input).reduce((sum, { sector }) => sum + sector, 0)
const ALPHABET = 'abcdefghijklmnopqrstuvwxyz'
const decipherName = ({ name, sector }) =>
name
.split('')
.map((x) => {
if (x === '-') return ' '
return ALPHABET[(ALPHABET.indexOf(x) + sector) % ALPHABET.length]
})
.join('')
const part2 = (input) =>
parseInput(input).find((x) => decipherName(x) === 'northpole object storage')
.sector
module.exports = {
parseRoom,
isValidRoom,
part1,
decipherName,
part2,
}
| 20.816667 | 79 | 0.592474 |
6b1f9b8b35a3eb11eddfbadef8e37837013a4b0f | 906 | html | HTML | labboard/templates/sensor_card.html | wbs306/LabBoard | d79eca6d9bc3c73e7532ce8baef7eac87a3cb626 | [
"MIT"
] | null | null | null | labboard/templates/sensor_card.html | wbs306/LabBoard | d79eca6d9bc3c73e7532ce8baef7eac87a3cb626 | [
"MIT"
] | null | null | null | labboard/templates/sensor_card.html | wbs306/LabBoard | d79eca6d9bc3c73e7532ce8baef7eac87a3cb626 | [
"MIT"
] | null | null | null | {% macro get_card(name, title, unit) %}
<div class="card" id={{ name + "-card" }}>
<div class="card-body">
<div class="card-info">
<h5 class="card-title">{{ title }}</h5>
<p class="card-text">{{ sensor_data[name][-1] }} <span>{{ unit }}</span></p>
</div>
<div class="line-chart"></div>
</div>
</div>
{% endmacro %}
{{ get_card("temperature", "温度", "°C") }}
{{ get_card("humidity", "湿度", "%") }}
<script src={{ url_for("static", filename="sensor_card.js") }}></script>
<script>
let data = {{ sensor_data["temperature"] | safe }};
setGraphic("#temperature-card", data, {
"fill": "#ff980030",
"line": "#ff9800",
"line_width": 3,
"linecap": "round"
});
data = {{ sensor_data["humidity"] | safe }};
setGraphic("#humidity-card", data, {
"fill": "#3366cc30",
"line": "#3366cc",
"line_width": 3,
"linecap": "round"
});
</script> | 28.3125 | 82 | 0.539735 |
802a60c6163822ec9a60db43fb998b707106bd7d | 1,463 | java | Java | src/main/java/com/fh/controller/base/BaseController.java | hehanpeng/ssm-store | cdc8852ad230b134eaf911f3a9552390163de1aa | [
"Apache-2.0"
] | null | null | null | src/main/java/com/fh/controller/base/BaseController.java | hehanpeng/ssm-store | cdc8852ad230b134eaf911f3a9552390163de1aa | [
"Apache-2.0"
] | null | null | null | src/main/java/com/fh/controller/base/BaseController.java | hehanpeng/ssm-store | cdc8852ad230b134eaf911f3a9552390163de1aa | [
"Apache-2.0"
] | null | null | null | package com.fh.controller.base;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.ModelAndView;
import com.fh.entity.Page;
import com.fh.util.Logger;
import com.fh.util.PageData;
import com.fh.util.UuidUtil;
/**
* @author FH Q313596790
* 修改时间:2015、12、11
*/
public class BaseController {
protected Logger logger = Logger.getLogger(this.getClass());
private static final long serialVersionUID = 6357869213649815390L;
/** new PageData对象
* @return
*/
public PageData getPageData(){
return new PageData(this.getRequest());
}
/**得到ModelAndView
* @return
*/
public ModelAndView getModelAndView(){
return new ModelAndView();
}
/**得到request对象
* @return
*/
public HttpServletRequest getRequest() {
HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
return request;
}
/**得到32位的uuid
* @return
*/
public String get32UUID(){
return UuidUtil.get32UUID();
}
/**得到分页列表的信息
* @return
*/
public Page getPage(){
return new Page();
}
public static void logBefore(Logger logger, String interfaceName){
logger.info("");
logger.info("start");
logger.info(interfaceName);
}
public static void logAfter(Logger logger){
logger.info("end");
logger.info("");
}
}
| 20.041096 | 116 | 0.729323 |
83f7b9e059f3b017088225b4cdf18f45762ecf82 | 3,318 | java | Java | src/test/java/org/apache/hadoop/squashfs/table/IdTableGeneratorTest.java | ccondit-target/squashfs-tools | d53380c374ba758fba014e7e29fda2ee500a4ab5 | [
"Apache-2.0"
] | null | null | null | src/test/java/org/apache/hadoop/squashfs/table/IdTableGeneratorTest.java | ccondit-target/squashfs-tools | d53380c374ba758fba014e7e29fda2ee500a4ab5 | [
"Apache-2.0"
] | null | null | null | src/test/java/org/apache/hadoop/squashfs/table/IdTableGeneratorTest.java | ccondit-target/squashfs-tools | d53380c374ba758fba014e7e29fda2ee500a4ab5 | [
"Apache-2.0"
] | null | null | null | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.squashfs.table;
import static org.junit.Assert.assertEquals;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.apache.hadoop.squashfs.metadata.MetadataBlockRef;
import org.apache.hadoop.squashfs.metadata.MetadataWriter;
import org.apache.hadoop.squashfs.test.MetadataTestUtils;
public class IdTableGeneratorTest {
IdTableGenerator gen;
@Before
public void setUp() {
gen = new IdTableGenerator();
}
@Test
public void addingDuplicateEntriesResultsInSingleMapping() {
int id = gen.addUidGid(1000);
assertEquals("wrong id", id, gen.addUidGid(1000));
assertEquals("wrong count", 1, gen.getIdCount());
}
@Test
public void saveEmptyEntryWritesNoData() throws Exception {
MetadataWriter writer = new MetadataWriter();
List<MetadataBlockRef> refs = gen.save(writer);
assertEquals("wrong refs size", 0, refs.size());
byte[] ser = MetadataTestUtils.saveMetadataBlock(writer);
assertEquals("wrong data size", 0, ser.length);
}
@Test
public void saveSingleEntryWritesOneRef() throws Exception {
gen.addUidGid(1000);
MetadataWriter writer = new MetadataWriter();
List<MetadataBlockRef> refs = gen.save(writer);
assertEquals("wrong refs size", 1, refs.size());
assertEquals("wrong location", 0, refs.get(0).getLocation());
assertEquals("wrong offset", (short) 0, refs.get(0).getOffset());
byte[] ser = MetadataTestUtils.saveMetadataBlock(writer);
byte[] decoded = MetadataTestUtils.decodeMetadataBlock(ser);
IntBuffer ib = ByteBuffer.wrap(decoded).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
assertEquals("wrong id", 1000, ib.get());
}
@Test
public void saveAllPossibleEntriesShouldWork() throws Exception {
for (int i = 0; i < 65536; i++) {
gen.addUidGid(100_000 + i);
}
MetadataWriter writer = new MetadataWriter();
List<MetadataBlockRef> refs = gen.save(writer);
System.out.println(refs);
assertEquals("wrong refs size", 32, refs.size());
byte[] ser = MetadataTestUtils.saveMetadataBlock(writer);
byte[] decoded = MetadataTestUtils.decodeMetadataBlocks(ser);
IntBuffer ib = ByteBuffer.wrap(decoded).order(ByteOrder.LITTLE_ENDIAN).asIntBuffer();
for (int i = 0; i < 65536; i++) {
assertEquals(String.format("wrong id for entry %d", i), 100_000 + i, ib.get());
}
}
@Test
public void toStringShouldNotFail() {
gen.addUidGid(1000);
System.out.println(gen.toString());
}
}
| 30.722222 | 87 | 0.739301 |
8b11fa826b62dcdd98ef71e14bf1bde49f75c5b1 | 1,338 | kt | Kotlin | app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/mikroblog/entry/EntryDetailModule.kt | rnickson/WykopMobilny | 457aff4a3188a5da9b52b24b4f8ba65f0eb8e35d | [
"MIT"
] | 193 | 2017-07-21T20:51:41.000Z | 2022-02-25T15:54:51.000Z | app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/mikroblog/entry/EntryDetailModule.kt | rnickson/WykopMobilny | 457aff4a3188a5da9b52b24b4f8ba65f0eb8e35d | [
"MIT"
] | 125 | 2017-07-21T19:50:11.000Z | 2022-01-06T11:07:35.000Z | app/src/main/kotlin/io/github/feelfreelinux/wykopmobilny/ui/modules/mikroblog/entry/EntryDetailModule.kt | rnickson/WykopMobilny | 457aff4a3188a5da9b52b24b4f8ba65f0eb8e35d | [
"MIT"
] | 80 | 2017-07-21T19:22:32.000Z | 2022-01-06T08:30:36.000Z | package io.github.feelfreelinux.wykopmobilny.ui.modules.mikroblog.entry
import dagger.Module
import dagger.Provides
import io.github.feelfreelinux.wykopmobilny.api.entries.EntriesApi
import io.github.feelfreelinux.wykopmobilny.base.Schedulers
import io.github.feelfreelinux.wykopmobilny.ui.fragments.entries.EntriesInteractor
import io.github.feelfreelinux.wykopmobilny.ui.fragments.entrycomments.EntryCommentInteractor
import io.github.feelfreelinux.wykopmobilny.ui.modules.NewNavigator
import io.github.feelfreelinux.wykopmobilny.ui.modules.NewNavigatorApi
import io.github.feelfreelinux.wykopmobilny.utils.wykop_link_handler.WykopLinkHandler
import io.github.feelfreelinux.wykopmobilny.utils.wykop_link_handler.WykopLinkHandlerApi
@Module
class EntryDetailModule {
@Provides
fun providesEntryDetailPresenter(
schedulers: Schedulers,
entriesApi: EntriesApi,
entriesInteractor: EntriesInteractor,
commentInteractor: EntryCommentInteractor
) = EntryDetailPresenter(schedulers, entriesApi, entriesInteractor, commentInteractor)
@Provides
fun provideNavigator(activity: EntryActivity): NewNavigatorApi = NewNavigator(activity)
@Provides
fun provideLinkHandler(activity: EntryActivity, navigator: NewNavigatorApi): WykopLinkHandlerApi = WykopLinkHandler(activity, navigator)
} | 44.6 | 140 | 0.834828 |
a496731b3f135839e48a141545a9be6c9a7b0999 | 1,966 | dart | Dart | LayoutTests/fast/css/pseudo-target-indirect-sibling-002_t01.dart | tvolkert/co19 | 435727789062a45da3d20da09024651fdeb8cafe | [
"BSD-3-Clause"
] | null | null | null | LayoutTests/fast/css/pseudo-target-indirect-sibling-002_t01.dart | tvolkert/co19 | 435727789062a45da3d20da09024651fdeb8cafe | [
"BSD-3-Clause"
] | null | null | null | LayoutTests/fast/css/pseudo-target-indirect-sibling-002_t01.dart | tvolkert/co19 | 435727789062a45da3d20da09024651fdeb8cafe | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
*/
/**
* @description This test passes if it does not find the element whose id is
* "first", because even though it has a sibling whose id matches the fragment
* of the url of this test, that sibling comes after, not before the "first"
* element.
*/
import "dart:html";
import "../../testcommon.dart";
main() {
var style = new Element.html('''
<style>
div.class { background-color: red; }
:hover {background-color:blue; }
:target~#first { background-color: green; }
</style>
''', treeSanitizer: new NullTreeSanitizer());
document.head.append(style);
document.body.setInnerHtml('''
<p id="description"></p>
<div tabindex=1" id="first" class="class"></div>
<div tabindex=2" id="second" class="class"></div>
<div tabindex=3" id="third" class="class"></div>
<div tabindex=4" id="fourth" class="class"></div>
<div id="console"></div>
''', treeSanitizer: new NullTreeSanitizer());
hashchange(_) {
var el = document.getElementById("first");
shouldBe(getComputedStyle(el, null).getPropertyValue('background-color'), 'rgb(255, 0, 0)');
el = document.getElementById("second");
shouldBe(getComputedStyle(el, null).getPropertyValue('background-color'), 'rgb(255, 0, 0)');
el = document.getElementById("third");
shouldBe(getComputedStyle(el, null).getPropertyValue('background-color'), 'rgb(255, 0, 0)');
el = document.getElementById("fourth");
shouldBe(getComputedStyle(el, null).getPropertyValue('background-color'), 'rgb(255, 0, 0)');
asyncEnd();
}
document.body.onHashChange.listen(hashchange);
asyncStart();
//if (window.location.hash.indexOf("second") == -1) {
window.location.hash = "#second";
//}
}
| 34.491228 | 96 | 0.657172 |
900a966c00545f326c55f248930563ead2cd7c24 | 483 | go | Go | cache_content_rectangle.go | dmellstrom/gofpdf | 02f30504ac9f7e8452ecedccff1ec2b259c58909 | [
"MIT"
] | 4 | 2019-06-26T16:21:33.000Z | 2019-09-07T03:35:04.000Z | cache_content_rectangle.go | dmellstrom/gofpdf | 02f30504ac9f7e8452ecedccff1ec2b259c58909 | [
"MIT"
] | 2 | 2019-04-23T16:15:07.000Z | 2019-06-19T21:11:06.000Z | cache_content_rectangle.go | dmellstrom/gofpdf | 02f30504ac9f7e8452ecedccff1ec2b259c58909 | [
"MIT"
] | 5 | 2019-03-12T11:43:39.000Z | 2019-06-19T20:59:38.000Z | package gofpdf
import (
"fmt"
"io"
)
type cacheContentRectangle struct {
pageHeight float64
x float64
y float64
width float64
height float64
style string
}
func (c *cacheContentRectangle) write(w io.Writer, protection *PDFProtection) error {
h := c.pageHeight
x := c.x
y := c.y
width := c.width
height := c.height
op := parseStyle(c.style)
fmt.Fprintf(w, "%0.2f %0.2f %0.2f %0.2f re %s\n", x, h-y, width, height, op)
return nil
}
| 16.655172 | 85 | 0.6294 |
f7036d83b1e536e7a68be500bce7a356903301ac | 1,005 | h | C | third_party/blink/renderer/core/frame/is_input_pending_options.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5 | 2020-12-17T06:55:53.000Z | 2021-09-30T13:06:58.000Z | third_party/blink/renderer/core/frame/is_input_pending_options.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-05-04T15:22:19.000Z | 2021-05-10T13:49:25.000Z | third_party/blink/renderer/core/frame/is_input_pending_options.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 8 | 2020-09-30T10:06:31.000Z | 2022-03-29T21:17:21.000Z | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_IS_INPUT_PENDING_OPTIONS_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_IS_INPUT_PENDING_OPTIONS_H_
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
namespace blink {
class IsInputPendingOptionsInit;
class IsInputPendingOptions : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
static IsInputPendingOptions* Create(
const IsInputPendingOptionsInit* options_init);
explicit IsInputPendingOptions(bool include_continuous);
bool includeContinuous() const { return include_continuous_; }
void setIncludeContinuous(bool include_continuous) {
include_continuous_ = include_continuous;
}
private:
bool include_continuous_;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_FRAME_IS_INPUT_PENDING_OPTIONS_H_
| 28.714286 | 76 | 0.8199 |
0183671f448f5cc4654f3da0f6171737d1f427ee | 2,630 | dart | Dart | third_party/dart-pkg/pub/matcher/lib/src/interfaces.dart | bleonard252-forks/pangolin-mobile | 392df6c8a66d39f31d0e2512caf3d31ae40c758f | [
"Apache-2.0"
] | null | null | null | third_party/dart-pkg/pub/matcher/lib/src/interfaces.dart | bleonard252-forks/pangolin-mobile | 392df6c8a66d39f31d0e2512caf3d31ae40c758f | [
"Apache-2.0"
] | null | null | null | third_party/dart-pkg/pub/matcher/lib/src/interfaces.dart | bleonard252-forks/pangolin-mobile | 392df6c8a66d39f31d0e2512caf3d31ae40c758f | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// To decouple the reporting of errors, and allow for extensibility of
// matchers, we make use of some interfaces.
/// Matchers build up their error messages by appending to
/// Description objects. This interface is implemented by
/// StringDescription. This interface is unlikely to need
/// other implementations, but could be useful to replace in
/// some cases - e.g. language conversion.
abstract class Description {
int get length;
/// Change the value of the description.
Description replace(String text);
/// This is used to add arbitrary text to the description.
Description add(String text);
/// This is used to add a meaningful description of a value.
Description addDescriptionOf(value);
/// This is used to add a description of an [Iterable] [list],
/// with appropriate [start] and [end] markers and inter-element [separator].
Description addAll(String start, String separator, String end, Iterable list);
}
/// [expect] Matchers must implement/extend the Matcher class.
/// The base Matcher class has a generic implementation of [describeMismatch]
/// so this does not need to be provided unless a more clear description is
/// required. The other two methods ([matches] and [describe])
/// must always be provided as they are highly matcher-specific.
abstract class Matcher {
const Matcher();
/// This does the matching of the actual vs expected values.
/// [item] is the actual value. [matchState] can be supplied
/// and may be used to add details about the mismatch that are too
/// costly to determine in [describeMismatch].
bool matches(item, Map matchState);
/// This builds a textual description of the matcher.
Description describe(Description description);
/// This builds a textual description of a specific mismatch. [item]
/// is the value that was tested by [matches]; [matchState] is
/// the [Map] that was passed to and supplemented by [matches]
/// with additional information about the mismatch, and [mismatchDescription]
/// is the [Description] that is being built to decribe the mismatch.
/// A few matchers make use of the [verbose] flag to provide detailed
/// information that is not typically included but can be of help in
/// diagnosing failures, such as stack traces.
Description describeMismatch(
item, Description mismatchDescription, Map matchState, bool verbose) =>
mismatchDescription;
}
| 44.576271 | 80 | 0.739924 |
e292efb1ce61037b011ef72337d4f0f36311623f | 2,128 | swift | Swift | LifeGameWidget/TimelineEntryGenerator.swift | jds655-Lambda-iOS/SwiftUI-LifeGame | d7b909e9e940c5ab3e53a3e3eaf9164c9124faa2 | [
"MIT"
] | null | null | null | LifeGameWidget/TimelineEntryGenerator.swift | jds655-Lambda-iOS/SwiftUI-LifeGame | d7b909e9e940c5ab3e53a3e3eaf9164c9124faa2 | [
"MIT"
] | null | null | null | LifeGameWidget/TimelineEntryGenerator.swift | jds655-Lambda-iOS/SwiftUI-LifeGame | d7b909e9e940c5ab3e53a3e3eaf9164c9124faa2 | [
"MIT"
] | null | null | null | //
// EntryGenerator.swift
// LifeGameApp
//
// Created by Yusuke Hosonuma on 2020/09/12.
//
import Foundation
import Combine
import WidgetKit
import FirebaseAuth
import FirebaseFirestore
final class TimelineEntryGenerator {
static let shared = TimelineEntryGenerator()
private let patternService: PatternService = .shared
private var cancellables: [AnyCancellable] = []
func generate(for family: WidgetFamily, times: Int, staredOnly: Bool, completion: @escaping ([Entry]) -> Void) {
let displayCount = family.displayCount
let totalCount = displayCount * times
candidatePatternURLs(staredOnly: staredOnly)
.map { $0.shuffled().prefix(totalCount) }
.flatMap { urls in
Publishers.MergeMany(
urls.map { self.patternService.fetch(from: $0) }
)
}
.collect()
.map { $0.compactMap { $0 } }
.sink { item in
let entries = self.generateEntries(from: item, displayCount: displayCount, times: times)
completion(entries)
}
.store(in: &cancellables)
}
// MARK: Private
private func generateEntries(from items: [PatternItem], displayCount: Int, times: Int) -> [Entry] {
let currentDate = Date()
let entries: [Entry] = items
.group(by: displayCount)
.prefix(times)
.enumerated()
.map { offset, items in
let entryDate = Calendar.current.date(byAdding: .minute, value: offset, to: currentDate)!
let data = items.map(BoardData.init)
return Entry(date: entryDate, relevance: data)
}
return entries
}
private func candidatePatternURLs(staredOnly: Bool) -> AnyPublisher<[URL], Never> {
let publisher = staredOnly
? patternService.staredPatternURLs()
: patternService.patternURLs()
return publisher
.map { $0.map(\.url) }
.eraseToAnyPublisher()
}
}
| 31.294118 | 116 | 0.577538 |
81eae9cb111ab7563a831de468af20a2c71af3c3 | 516 | asm | Assembly | oeis/132/A132373.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/132/A132373.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/132/A132373.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A132373: Expansion of c(6*x^2)/(1-x*c(6*x^2)), where c(x) is the g.f. of A000108.
; Submitted by Jamie Morken(s4)
; 1,1,7,13,91,205,1435,3565,24955,65821,460747,1265677,8859739,25066621,175466347,507709165,3553964155,10466643805,73266506635,218878998733,1532152991131,4631531585341,32420721097387,98980721277613,692865048943291,2133274258946845
mov $2,1
mov $3,$0
mov $4,1
mov $5,1
lpb $3
mul $2,$3
div $2,$4
sub $3,1
max $3,1
add $4,1
trn $5,$2
mul $5,6
add $5,$2
lpe
mov $0,$5
mul $0,6
sub $0,5
| 23.454545 | 230 | 0.697674 |
8091a569d070d491a483d5f469f1358a6750895c | 2,845 | java | Java | src/main/java/quek/undergarden/world/UndergardenDimension.java | bernie-g/The-Undergarden | a5b48dd536a485731bf4ed027463cdb18957dd56 | [
"MIT"
] | null | null | null | src/main/java/quek/undergarden/world/UndergardenDimension.java | bernie-g/The-Undergarden | a5b48dd536a485731bf4ed027463cdb18957dd56 | [
"MIT"
] | null | null | null | src/main/java/quek/undergarden/world/UndergardenDimension.java | bernie-g/The-Undergarden | a5b48dd536a485731bf4ed027463cdb18957dd56 | [
"MIT"
] | null | null | null | package quek.undergarden.world;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.provider.SingleBiomeProviderSettings;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.storage.WorldInfo;
import quek.undergarden.biome.provider.UndergardenBiomeProvider;
import quek.undergarden.biome.provider.UndergardenBiomeProviderSettings;
import quek.undergarden.registry.UndergardenBiomes;
import quek.undergarden.registry.UndergardenDimensions;
import quek.undergarden.world.gen.UndergardenChunkGenerator;
import quek.undergarden.world.gen.UndergardenGenerationSettings;
import quek.undergarden.world.layer.UndergardenSingleBiomeProvider;
import javax.annotation.Nullable;
public class UndergardenDimension extends Dimension {
public UndergardenDimension(World world, DimensionType dimensionType) {
super(world, dimensionType, 0);
}
public static boolean isTheUndergarden(@Nullable World world) {
if (world == null) return false;
return world.dimension.getType().getModType() == UndergardenDimensions.UNDERGARDEN.get();
}
@Override
public ChunkGenerator<?> createChunkGenerator() {
UndergardenGenerationSettings undergardenGenerationSettings = new UndergardenGenerationSettings();
UndergardenBiomeProviderSettings settings = new UndergardenBiomeProviderSettings();
WorldInfo worldInfo = this.world.getWorldInfo();
settings.setWorldInfo(worldInfo);
UndergardenBiomeProvider provider = new UndergardenBiomeProvider(settings);
return new UndergardenChunkGenerator(world, provider, undergardenGenerationSettings);
}
@Nullable
@Override
public BlockPos findSpawn(ChunkPos chunkPosIn, boolean checkValid) {
return null;
}
@Nullable
@Override
public BlockPos findSpawn(int posX, int posZ, boolean checkValid) {
return null;
}
@Override
public float calculateCelestialAngle(long worldTime, float partialTicks) {
return 0.5F;
}
@Override
public boolean isSurfaceWorld() {
return false;
}
@Override
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return new Vec3d(.101, .105, .094);
}
@Override
public boolean canRespawnHere() {
return false;
}
@Override
public boolean doesXZShowFog(int x, int z) {
return false;
}
@Override
public boolean shouldMapSpin(String entity, double x, double z, double rotation) {
return true;
}
}
| 32.329545 | 106 | 0.749736 |
b64979e42eac410452e84a0f7dea9c408bba6d40 | 422 | kt | Kotlin | cache/src/main/kotlin/world/gregs/voidps/cache/config/data/UnderlayDefinition.kt | jarryd229/void | 890a1a7467309503737325ee3d25e6fb0cd2e197 | [
"BSD-3-Clause"
] | 14 | 2021-01-21T19:02:27.000Z | 2021-10-15T02:50:43.000Z | cache/src/main/kotlin/world/gregs/voidps/cache/config/data/UnderlayDefinition.kt | jarryd229/void | 890a1a7467309503737325ee3d25e6fb0cd2e197 | [
"BSD-3-Clause"
] | 163 | 2021-01-30T00:34:02.000Z | 2022-03-26T20:43:04.000Z | cache/src/main/kotlin/world/gregs/voidps/cache/config/data/UnderlayDefinition.kt | jarryd229/void | 890a1a7467309503737325ee3d25e6fb0cd2e197 | [
"BSD-3-Clause"
] | 8 | 2021-03-27T20:38:06.000Z | 2022-03-15T17:24:36.000Z | package world.gregs.voidps.cache.config.data
import world.gregs.voidps.cache.Definition
data class UnderlayDefinition(
override var id: Int = -1,
var colour: Int = 0,
var texture: Int = -1,
var scale: Int = 512,
var blockShadow: Boolean = true,
var aBoolean2892: Boolean = true,
var hue: Int = 0,
var saturation: Int = 0,
var lightness: Int = 0,
var chroma: Int = 0
) : Definition | 26.375 | 44 | 0.656398 |
2f279cb51a399ad2e1c63ee95aab4a032e06cf50 | 6,431 | java | Java | questionnaire-mainapp/src/dk/silverbullet/telemed/questionnaire/node/LungMonitorDeviceNode.java | matebestek/opentele-client-android | f63520fa9d4d0e800b2e6120258ff22884b4a1b2 | [
"Apache-2.0"
] | null | null | null | questionnaire-mainapp/src/dk/silverbullet/telemed/questionnaire/node/LungMonitorDeviceNode.java | matebestek/opentele-client-android | f63520fa9d4d0e800b2e6120258ff22884b4a1b2 | [
"Apache-2.0"
] | null | null | null | questionnaire-mainapp/src/dk/silverbullet/telemed/questionnaire/node/LungMonitorDeviceNode.java | matebestek/opentele-client-android | f63520fa9d4d0e800b2e6120258ff22884b4a1b2 | [
"Apache-2.0"
] | null | null | null | package dk.silverbullet.telemed.questionnaire.node;
import com.google.gson.annotations.Expose;
import dk.silverbullet.telemed.device.DeviceInitialisationException;
import dk.silverbullet.telemed.device.vitalographlungmonitor.LungMeasurement;
import dk.silverbullet.telemed.device.vitalographlungmonitor.LungMonitorController;
import dk.silverbullet.telemed.device.vitalographlungmonitor.LungMonitorListener;
import dk.silverbullet.telemed.device.vitalographlungmonitor.VitalographLungMonitorController;
import dk.silverbullet.telemed.questionnaire.Questionnaire;
import dk.silverbullet.telemed.questionnaire.R;
import dk.silverbullet.telemed.questionnaire.element.TextViewElement;
import dk.silverbullet.telemed.questionnaire.element.TwoButtonElement;
import dk.silverbullet.telemed.questionnaire.expression.Variable;
import dk.silverbullet.telemed.questionnaire.expression.VariableLinkFailedException;
import dk.silverbullet.telemed.utils.Util;
import java.util.Map;
public class LungMonitorDeviceNode extends DeviceNode implements LungMonitorListener {
@Expose
private Variable<Float> fev1;
@Expose
private Variable<Float> fev6;
@Expose
private Variable<Float> fev1Fev6Ratio;
@Expose
private Variable<Float> fef2575;
@Expose
private Variable<Boolean> goodTest;
@Expose
private Variable<Integer> softwareVersion;
@Expose
String text;
private TextViewElement statusText;
private TextViewElement fev1DisplayText;
private TextViewElement fev6DisplayText;
private TwoButtonElement be;
private LungMonitorController controller;
public LungMonitorDeviceNode(Questionnaire questionnaire, String nodeName) {
super(questionnaire, nodeName);
}
@Override
public void enter() {
clearElements();
addElement(new TextViewElement(this, text));
statusText = new TextViewElement(this);
setStatusText(Util.getString(R.string.lung_monitor_connect, questionnaire));
addElement(statusText);
fev1DisplayText = new TextViewElement(this);
addElement(fev1DisplayText);
fev6DisplayText = new TextViewElement(this);
addElement(fev6DisplayText);
be = new TwoButtonElement(this);
be.setLeftNextNode(getNextFailNode());
be.setLeftText(Util.getString(R.string.default_omit, questionnaire));
be.hideRightButton();
addElement(be);
super.enter();
try {
controller = createController();
} catch (DeviceInitialisationException e) {
setStatusText(Util.getString(R.string.lung_monitor_could_not_connect, questionnaire));
}
}
protected LungMonitorController createController() throws DeviceInitialisationException {
return VitalographLungMonitorController.create(this);
}
@Override
public void linkVariables(Map<String, Variable<?>> variablePool) throws VariableLinkFailedException {
super.linkVariables(variablePool);
fev1 = Util.linkVariable(variablePool, fev1);
fev6 = Util.linkVariable(variablePool, fev6, true);
fev1Fev6Ratio = Util.linkVariable(variablePool, fev1Fev6Ratio, true);
fef2575 = Util.linkVariable(variablePool, fef2575, true);
goodTest = Util.linkVariable(variablePool, goodTest);
softwareVersion = Util.linkVariable(variablePool, softwareVersion, true);
}
@Override
public void deviceLeave() {
if (controller != null) {
controller.close();
controller = null;
}
}
@Override
public void connected() {
setStatusText(Util.getString(R.string.lung_monitor_perform_test, questionnaire));
}
@Override
public void permanentProblem() {
setStatusText(Util.getString(R.string.lung_monitor_permanent_problem, questionnaire));
}
@Override
public void temporaryProblem() {
setStatusText(Util.getString(R.string.lung_monitor_temporary_problem, questionnaire));
}
@Override
public void measurementReceived(final String systemId, final LungMeasurement measurement) {
questionnaire.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (measurement.isGoodTest()) {
statusText.setText(Util.getString(R.string.lung_monitor_measurement_received, questionnaire));
setDeviceIdString(systemId);
setVariableValue(fev1, measurement.getFev1());
setVariableValue(fev6, measurement.getFev6());
setVariableValue(fev1Fev6Ratio, measurement.getFev1Fev6Ratio());
setVariableValue(fef2575, measurement.getFef2575());
setVariableValue(goodTest, measurement.isGoodTest());
setVariableValue(softwareVersion, measurement.getSoftwareVersion());
controller.close();
controller = null;
be.setRightNextNode(getNextNode());
be.setRightText(Util.getString(R.string.default_proceed, questionnaire));
} else {
statusText.setText(Util.getString(R.string.lung_monitor_bad_measurement, questionnaire));
}
fev1DisplayText.setText(String.format("FEV1: %.2f", measurement.getFev1()));
}
});
}
private <T> void setVariableValue(Variable<T> variable, T value) {
if (variable != null) {
variable.setValue(value);
}
}
private void setStatusText(final String text) {
questionnaire.getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
statusText.setText(text);
}
});
}
public void setFev1(Variable<Float> fev1) {
this.fev1 = fev1;
}
public void setFev6(Variable<Float> fev6) {
this.fev6 = fev6;
}
public void setFev1Fev6Ratio(Variable<Float> fev1Fev6Ratio) {
this.fev1Fev6Ratio = fev1Fev6Ratio;
}
public void setFef2575(Variable<Float> fef2575) {
this.fef2575 = fef2575;
}
public void setGoodTest(Variable<Boolean> goodTest) {
this.goodTest = goodTest;
}
public void setSoftwareVersion(Variable<Integer> softwareVersion) {
this.softwareVersion = softwareVersion;
}
}
| 34.951087 | 114 | 0.683097 |
5a8efbd9fd7f988395eaf7f67cff7718dfe3f12c | 7,551 | html | HTML | doc/html/boostbook/dtd/function.html | boostpro/boost-release | 017a2654a11f50e7f1c4a662aec2cf3cd9d4fb1c | [
"BSL-1.0"
] | 3 | 2015-01-03T23:52:29.000Z | 2021-02-22T17:41:27.000Z | doc/html/boostbook/dtd/function.html | boostpro/boost-release | 017a2654a11f50e7f1c4a662aec2cf3cd9d4fb1c | [
"BSL-1.0"
] | null | null | null | doc/html/boostbook/dtd/function.html | boostpro/boost-release | 017a2654a11f50e7f1c4a662aec2cf3cd9d4fb1c | [
"BSL-1.0"
] | 3 | 2016-11-08T01:56:40.000Z | 2021-11-21T09:02:49.000Z | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>BoostBook element function</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../reference.html" title="Reference">
<link rel="prev" href="source.html" title="BoostBook element source">
<link rel="next" href="macroname.html" title="BoostBook element macroname">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="source.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="macroname.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boostbook.dtd.function"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">
BoostBook element <code class="sgmltag-element">function</code></span></h2>
<p>function — Declares a function</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv">function ::=
(<a class="link" href="template.html" title="BoostBook element template">template</a>?, <a class="link" href="type.html" title="BoostBook element type">type</a>, <a class="link" href="parameter.html" title="BoostBook element parameter">parameter</a>*, <a class="link" href="purpose.html" title="BoostBook element purpose">purpose</a>?, <a class="link" href="description.html" title="BoostBook element description">description</a>?, <a class="link" href="requires.html" title="BoostBook element requires">requires</a>?, <a class="link" href="effects.html" title="BoostBook element effects">effects</a>?, <a class="link" href="postconditions.html" title="BoostBook element postconditions">postconditions</a>?, <a class="link" href="returns.html" title="BoostBook element returns">returns</a>?, <a class="link" href="throws.html" title="BoostBook element throws">throws</a>?, <a class="link" href="complexity.html" title="BoostBook element complexity">complexity</a>?, <a class="link" href="notes.html" title="BoostBook element notes">notes</a>?, <a class="link" href="rationale.html" title="BoostBook element rationale">rationale</a>?)
</div>
<div class="refsection">
<a name="id3922636"></a><h2>Description</h2>
<p>BoostBook functions are documented by specifying the
function's interface (e.g., its C++ signature) and its
behavior. Constructors, destructors, member functions, and free
functions all use the same documentation method, although the
top-level tags differ.</p>
<p>The behavior of functions in BoostBook is documenting using a
style similar to that of the C++ standard, with clauses describing
the requirements, effects, postconditions, exception behavior, and
return values of functions.</p>
<p>The following example illustrates some constructors and a
destructor for <code class="computeroutput"><a class="link" href="../../boost/any.html" title="Class any">boost::any</a></code>. Note that one of
the constructors takes a single parameter whose name is "other" and
whose type, <code class="computeroutput">const any&</code> is contained in the
<paramtype> element; any number of parameters may be specified
in this way.</p>
<pre class="programlisting"><class name="any">
<constructor>
<postconditions><para><this->empty()></para></postconditions>
</constructor>
<constructor>
<parameter name="other">
<paramtype>const <classname>any</classname>&amp;</paramtype>
</parameter>
<effects>
<simpara> Copy constructor that copies
content of <code>other</code> into the new instance,
so that any content is equivalent in both type and value to the
content of <code>other</code>, or empty if
<code>other</code> is
empty.
</simpara>
</effects>
<throws>
<simpara>May fail with a
<classname>std::bad_alloc</classname> exception or any
exceptions arising from the copy constructor of the
contained type.
</simpara>
</throws>
</constructor>
<destructor>
<effects><simpara>Releases any and all resources used in
management of instance.</simpara></effects>
<throws><simpara>Nothing.</simpara></throws>
</destructor>
</class></pre>
</div>
<div class="refsection">
<a name="id3922691"></a><h2>Attributes</h2>
<div class="informaltable"><table class="table">
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<thead><tr>
<th>Name</th>
<th>Type</th>
<th>Value</th>
<th>Purpose</th>
</tr></thead>
<tbody>
<tr>
<td>last-revision</td>
<td>#IMPLIED</td>
<td>CDATA</td>
<td>Set to $Date: 2009-10-10 15:53:46 +0100 (Sat, 10 Oct 2009) $ to keep "last revised" information in sync with CVS changes</td>
</tr>
<tr>
<td>specifiers</td>
<td>#IMPLIED</td>
<td>CDATA</td>
<td>The specifiers for this function, e.g., inline, static, etc.</td>
</tr>
<tr>
<td>name</td>
<td>#REQUIRED</td>
<td>CDATA</td>
<td>The name of the element being declared to referenced</td>
</tr>
<tr>
<td>id</td>
<td>#IMPLIED</td>
<td>CDATA</td>
<td>A global identifier for this element</td>
</tr>
<tr>
<td>xml:base</td>
<td>#IMPLIED</td>
<td>CDATA</td>
<td>Implementation detail used by XIncludes</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2003-2005 Douglas Gregor<p>Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
<a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="source.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../reference.html"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="macroname.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
| 49.032468 | 1,135 | 0.674745 |
575e4c4fd14e09250d095ca066251fad58c3a305 | 2,122 | swift | Swift | Top10iOSDev/Top10iOSDevTests/Requirement Cache/Helpers/RequirementStoreSpy.swift | rombiddle/Top10iOSDeveloper | ea7483315b3ca747c81c6b5a58a67762e5b9495c | [
"MIT"
] | null | null | null | Top10iOSDev/Top10iOSDevTests/Requirement Cache/Helpers/RequirementStoreSpy.swift | rombiddle/Top10iOSDeveloper | ea7483315b3ca747c81c6b5a58a67762e5b9495c | [
"MIT"
] | null | null | null | Top10iOSDev/Top10iOSDevTests/Requirement Cache/Helpers/RequirementStoreSpy.swift | rombiddle/Top10iOSDeveloper | ea7483315b3ca747c81c6b5a58a67762e5b9495c | [
"MIT"
] | null | null | null | //
// RequirementStoreSpy.swift
// Top10iOSDevTests
//
// Created by Romain Brunie on 04/02/2021.
//
import Foundation
import Top10iOSDev
class RequirementStoreSpy: RequirementStore {
enum ReceivedMessage: Equatable {
case deleteCachedRequirements
case insert([LocalRequirementCategory])
case retrieve
}
private(set) var receivedMessages = [ReceivedMessage]()
private var deletionCompletions = [DeletionCompletion]()
private var insertionCompletions = [InsertionCompletion]()
private var retrievalCompletions = [RetrievalCompletion]()
func deleteCachedRequirements(completion: @escaping DeletionCompletion) {
deletionCompletions.append(completion)
receivedMessages.append(.deleteCachedRequirements)
}
func completeDeletion(with error: Error, at index: Int = 0) {
deletionCompletions[index](.failure(error))
}
func completeDeletionSuccessfully(at index: Int = 0) {
deletionCompletions[index](.success(()))
}
func completeInsertion(with error: Error, at index: Int = 0) {
insertionCompletions[index](.failure(error))
}
func completeInsertionSuccessfully(at index: Int = 0) {
insertionCompletions[index](.success(()))
}
func insert(_ items: [LocalRequirementCategory], completion: @escaping InsertionCompletion) {
insertionCompletions.append(completion)
receivedMessages.append(.insert(items))
}
func retrieve(completion: @escaping RetrievalCompletion) {
retrievalCompletions.append(completion)
receivedMessages.append(.retrieve)
}
func completeRetrieval(with error: Error, at index: Int = 0) {
retrievalCompletions[index](.failure(error))
}
func completeRetrievalWithEmptyCache(at index: Int = 0) {
retrievalCompletions[index](.success(.none))
}
func completeRetrieval(with requirements: [LocalRequirementCategory], at index: Int = 0) {
retrievalCompletions[index](.success(CachedRequirements(requirements: requirements)))
}
}
| 31.671642 | 97 | 0.690858 |
0cab395492740b9b3d338ab6d9a913dcbe6912e1 | 1,327 | py | Python | src/pages/random.py | jojo935/Kemono2 | bdfaf0ab2dd3c2c4a04805feea8e9fb6193cbd9b | [
"BSD-3-Clause"
] | null | null | null | src/pages/random.py | jojo935/Kemono2 | bdfaf0ab2dd3c2c4a04805feea8e9fb6193cbd9b | [
"BSD-3-Clause"
] | null | null | null | src/pages/random.py | jojo935/Kemono2 | bdfaf0ab2dd3c2c4a04805feea8e9fb6193cbd9b | [
"BSD-3-Clause"
] | null | null | null | from flask import Blueprint, redirect, url_for, g
from ..utils.utils import make_cache_key
from ..internals.cache.redis import get_conn
from ..internals.cache.flask_cache import cache
from ..internals.database.database import get_cursor
from ..lib.artist import get_artist, get_random_artist_keys
from ..lib.post import get_post, get_random_posts_keys
from ..lib.ab_test import get_ab_variant
from ..utils.utils import get_value
import random as rand
random = Blueprint('random', __name__)
@random.route('/posts/random')
def random_post():
post = get_random_post()
if post is None:
return redirect('back')
return redirect(url_for('post.get', service = post['service'], artist_id = post['user'], post_id = post['id']))
@random.route('/artists/random')
def random_artist():
artist = get_random_artist()
if artist is None:
return redirect('back')
return redirect(url_for('artists.get', service = artist['service'], artist_id = artist['id']))
def get_random_post():
post_keys = get_random_posts_keys(1000)
if len(post_keys) == 0:
return None
return rand.choice(post_keys)
def get_random_artist():
artists = get_random_artist_keys(1000)
if len(artists) == 0:
return None
return rand.choice(artists)
| 30.159091 | 116 | 0.699322 |
bb3351b6dac01b494ed46eb1382b2970823449b4 | 847 | swift | Swift | collector/NewEntry/NewEntry.swift | gabecoelho/collector | 210709f7b5a80f628b171ea8e1ee78997dab754f | [
"Apache-2.0"
] | null | null | null | collector/NewEntry/NewEntry.swift | gabecoelho/collector | 210709f7b5a80f628b171ea8e1ee78997dab754f | [
"Apache-2.0"
] | null | null | null | collector/NewEntry/NewEntry.swift | gabecoelho/collector | 210709f7b5a80f628b171ea8e1ee78997dab754f | [
"Apache-2.0"
] | null | null | null | //
// NewEntry.swift
// collector
//
// Created by Gabriel Coelho on 1/26/20.
// Copyright © 2020 Gabe. All rights reserved.
//
import SwiftUI
struct NewEntry: View {
var types = ["Category", "Item"]
@State private var selectedTypes = 0
var body: some View {
NavigationView {
Form {
Section {
Picker(selection: $selectedTypes, label: Text("Type")) {
ForEach(0 ..< types.count) {
Text(self.types[$0])
}
.pickerStyle(WheelPickerStyle())
}
}
}
.navigationBarTitle("Create New")
}
}
}
struct NewEntry_Previews: PreviewProvider {
static var previews: some View {
NewEntry()
}
}
| 21.717949 | 76 | 0.475797 |
683977ef114a1a63a96758a021affde540d2beaf | 4,503 | html | HTML | public/fullcalendar/index.html | Ex70/redimensiona-bitacora | d3244509cddf60878a32308cf964507059f70ace | [
"MIT"
] | null | null | null | public/fullcalendar/index.html | Ex70/redimensiona-bitacora | d3244509cddf60878a32308cf964507059f70ace | [
"MIT"
] | null | null | null | public/fullcalendar/index.html | Ex70/redimensiona-bitacora | d3244509cddf60878a32308cf964507059f70ace | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8' />
<link href='lib/main.css' rel='stylesheet' />
<style>
html,body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
#calendar{
max-width: 900px;
margin: 40px auto;
}
</style>
<!-- CSS de Bootstrap -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<!-- JS de Bootstrap -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
<!-- Código de fullcalendar -->
<script src='lib/main.js'></script>
<!-- Funcionalidad de fullcalendar -->
<script>
document.addEventListener('DOMContentLoaded', function() {
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
initialView: 'dayGridMonth',
locale: 'es',
headerToolbar: {
left: 'prev,next today Miboton',
center: 'title',
right: 'dayGridMonth,timeGridWeek,timeGridDay'
},
customButtons: {
Miboton: {
text: 'Botón',
click: function() {
alert('¡Hola Mundo!');
$('#exampleModal').modal('toggle');
}
}
},
dateClick: function(info) {
$('#exampleModal').modal();
console.log(info);
// alert('Date: ' + info.dateStr);
// alert('Resource ID: ' + info.resource.id);
calendar.addEvent({title: "Evento x", date:info.dateStr})
},
eventClick: function(info){
console.log(info);
console.log(info.event.title);
console.log(info.event.start);
console.log(info.event.extendedProps.descripcion);
},
events: [
{
id: 'a',
title: 'Evento 1',
start: '2020-10-26 12:30:00',
descripcion: "Descripciòn del evento 1"
}
]
});
calendar.setOption('locale', 'es');
calendar.render();
});
</script>
</head>
<body>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<div id='calendar'></div>
</body>
</html> | 42.885714 | 218 | 0.465023 |
83e17047a1db8c5bdaa34e0416db82e42c126c8c | 682 | java | Java | src/test/java/playground/tests/exceptions/JupiterBeforeTestError.java | xvik/spock-junit5 | d0b955e50872dcc582a710faf9581637f9b97e7d | [
"MIT"
] | null | null | null | src/test/java/playground/tests/exceptions/JupiterBeforeTestError.java | xvik/spock-junit5 | d0b955e50872dcc582a710faf9581637f9b97e7d | [
"MIT"
] | 3 | 2022-02-16T00:13:19.000Z | 2022-03-18T02:50:46.000Z | src/test/java/playground/tests/exceptions/JupiterBeforeTestError.java | xvik/spock-junit5 | d0b955e50872dcc582a710faf9581637f9b97e7d | [
"MIT"
] | null | null | null | package playground.tests.exceptions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import ru.vyarus.spock.jupiter.support.ActionHolder;
import ru.vyarus.spock.jupiter.support.LifecycleExtension;
import ru.vyarus.spock.jupiter.support.LifecycleExtension2;
import ru.vyarus.spock.jupiter.support.exceptions.BeforeTestError;
/**
* @author Vyacheslav Rusakov
* @since 01.01.2022
*/
@Disabled
@ExtendWith({LifecycleExtension.class, BeforeTestError.class, LifecycleExtension2.class})
public class JupiterBeforeTestError {
@Test
void sampleTest() {
ActionHolder.add("test.body");
}
}
| 28.416667 | 89 | 0.785924 |
75cbcf1fed4a340e8a1ad03781a734a9814e3822 | 211 | asm | Assembly | data/mapHeaders/lab2.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/mapHeaders/lab2.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/mapHeaders/lab2.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | Lab2_h:
db LAB ; tileset
db CINNABAR_LAB_2_HEIGHT, CINNABAR_LAB_2_WIDTH ; dimensions (y, x)
dw Lab2Blocks, Lab2TextPointers, Lab2Script ; blocks, texts, scripts
db $00 ; connections
dw Lab2Object ; objects
| 30.142857 | 69 | 0.772512 |
7d3bc3964a200a4711b8e5c6812a846c03414070 | 1,828 | html | HTML | TwoOne.html | Cunhahs/TwoOne | 8b615b39ebfd1017d13ae0f9eca0e7927ab8c1d0 | [
"MIT"
] | null | null | null | TwoOne.html | Cunhahs/TwoOne | 8b615b39ebfd1017d13ae0f9eca0e7927ab8c1d0 | [
"MIT"
] | null | null | null | TwoOne.html | Cunhahs/TwoOne | 8b615b39ebfd1017d13ae0f9eca0e7927ab8c1d0 | [
"MIT"
] | null | null | null | <html lang="pt-br">
<head>
<link href="TwoOne.css" rel="stylesheet">
<meta charset="utf-8" />
<title>Jogo 21</title>
</head>
<body>
<!-- Musica de fundo -->
<div class="musicas">
<audio autoplay>
<source src="musica/musicaFundo.mp3">
</audio>
</div>
<!-- Titulo Tema -->
<h1>Jogo 21</h1>
<!--Voltar para o menu principal-->
<div class="menuPrincipal">
<a class="linkMenu" href="\\SRVPM01\Profiles$\henrique.souza\Documents\TrabalhoPWTwoOne\trabalho\BlackJack-main\index.html">
<h2>Menu Principal</h2>
</a>
</div>
<!-- Div exibe informações durante o jogo -->
<div class="caixaDeTexto" id="caixaDeTexto">
<p class="palavraPressione"> Pressione 'Novo Jogo' para começar!</p>
</div>
<!-- Div exibe "Novo Jogo" -->
<div class="caixaMain" id="novoJogo">
<button id="jogar"><p class="palavraPressione">Novo Jogo</p></button>
</div>
<!-- Div exibe Pedir e Pular ao decorrer do jogo -->
<div class="caixaMain hidden" id="caixaMain">
<button id="pedir">Pedir</button>
<button id="passar">Passar</button>
</div>
<!-- Tebela mostra jogo e seus acontecimentos de cartas -->
<table>
<tr>
<th id="caixaJog">
Jogador
</th>
<th id="caixaOp">
Oponente
</th>
</tr>
<tr>
<td class="cartas" id="primaria"></td>
<td class="cartas" id="secundaria"></td>
</tr>
</table>
<!-- Div exibe número de: Vitória ou Derrota -->
<div id="contador" class="caixaMain">
<p class="palavraVED">Vitória 😀: 0</p>
<p class="palavraVED">Derrota 😒: 0</p>
</div>
<script src="TwoOne.js"></script>
</body>
</html> | 25.041096 | 132 | 0.53884 |
dd9be26c3b407a083ad3776718ed200cee88286c | 15,249 | php | PHP | app/Http/Controllers/v1/BangumiController.php | falstack/hentai | 476a8c14c6d05b94d372fb01b3399856d48b6b4c | [
"MIT"
] | 2 | 2020-05-10T05:38:52.000Z | 2020-10-09T13:29:12.000Z | app/Http/Controllers/v1/BangumiController.php | falstack/hentai | 476a8c14c6d05b94d372fb01b3399856d48b6b4c | [
"MIT"
] | 1 | 2020-05-31T16:19:57.000Z | 2020-05-31T16:19:57.000Z | app/Http/Controllers/v1/BangumiController.php | falstack/hentai | 476a8c14c6d05b94d372fb01b3399856d48b6b4c | [
"MIT"
] | 2 | 2020-05-27T12:11:05.000Z | 2020-06-04T16:36:19.000Z | <?php
namespace App\Http\Controllers\v1;
use App\Http\Controllers\Controller;
use App\Http\Modules\Counter\BangumiLikeCounter;
use App\Http\Modules\Counter\BangumiPatchCounter;
use App\Http\Repositories\BangumiRepository;
use App\Http\Repositories\IdolRepository;
use App\Http\Repositories\PinRepository;
use App\Http\Repositories\UserRepository;
use App\Models\Bangumi;
use App\Models\BangumiSerialization;
use App\Models\Search;
use App\Services\Spider\BangumiSource;
use App\Services\Spider\Query;
use Carbon\Carbon;
use Carbon\Exceptions\Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
class BangumiController extends Controller
{
public function all(Request $request)
{
$curPage = $request->get('cur_page') ?: 0;
$toPage = $request->get('to_page') ?: 1;
$take = $request->get('take') ?: 100;
$start = ($toPage - 1) * $take;
$count = ($toPage - $curPage) * $take;
$ids = Bangumi
::orderBy('id', 'DESC')
->skip($start)
->take($count)
->pluck('id');
$bangumiRepository = new BangumiRepository();
$list = $bangumiRepository->list($ids);
$total = Bangumi::count();
return $this->resOK([
'result' => $list,
'total' => $total
]);
}
public function show(Request $request)
{
$slug = $request->get('slug');
if (!$slug)
{
return $this->resErrBad();
}
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (!$bangumi)
{
return $this->resErrNotFound();
}
return $this->resOK($bangumi);
}
public function patch(Request $request)
{
$slug = $request->get('slug');
$bangumiRepository = new BangumiRepository();
$data = $bangumiRepository->item($slug);
if (is_null($data))
{
return $this->resErrNotFound();
}
$bangumiPatchCounter = new BangumiPatchCounter();
$patch = $bangumiPatchCounter->all($slug);
$patch['rule'] = $bangumiRepository->rule($slug);
$user = $request->user();
if (!$user)
{
return $this->resOK($patch);
}
$bangumiLikeCounter = new BangumiLikeCounter();
$patch['is_liked'] = $bangumiLikeCounter->has($user->id, slug2id($slug));
return $this->resOK($patch);
}
public function rank250(Request $request)
{
$page = $request->get('page') ?: 1;
$take = $request->get('take') ?: 10;
$bangumiRepository = new BangumiRepository();
$idsObj = $bangumiRepository->rank($page - 1, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$idsObj['result'] = $bangumiRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function hot100(Request $request)
{
$page = $request->get('page') ?: 1;
$take = $request->get('take') ?: 10;
$bangumiRepository = new BangumiRepository();
$idsObj = $bangumiRepository->hot($page - 1, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$idsObj['result'] = $bangumiRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function release()
{
$bangumiRepository = new BangumiRepository();
$result = $bangumiRepository->release();
return $this->resOK([
'no_more' => true,
'result' => $result,
'total' => 0
]);
}
public function score(Request $request)
{
}
public function liker(Request $request)
{
$slug = $request->get('slug');
$page = $request->get('page') ?: 1;
$take = $request->get('take') ?: 10;
$bangumiRepository = new BangumiRepository();
$idsObj = $bangumiRepository->likeUsers($slug, $page - 1, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$userRepository = new UserRepository();
$idsObj['result'] = $userRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function recommendedPins(Request $request)
{
$seenIds = $request->get('seen_ids') ? explode(',', $request->get('seen_ids')) : [];
$take = $request->get('take') ?: 10;
$bangumiRepository = new BangumiRepository();
$idsObj = $bangumiRepository->recommended_pin($seenIds, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$pinRepository = new PinRepository();
$idsObj['result'] = $pinRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function pins(Request $request)
{
$validator = Validator::make($request->all(), [
'slug' => 'required|string',
'is_up' => 'required|integer',
'sort' => ['required', Rule::in(['newest', 'hottest', 'active'])],
'time' => ['required', Rule::in(['3-day', '7-day', '30-day', 'all'])]
]);
if ($validator->fails())
{
return $this->resErrParams($validator);
}
$slug = $request->get('slug');
$sort = $request->get('sort');
$time = $request->get('time');
$take = $request->get('take') ?: 10;
$isUp = $request->get('is_up');
if ($sort === 'newest')
{
$specId = $request->get('last_id');
}
else
{
$specId = $request->get('seen_ids') ? explode(',', $request->get('seen_ids')) : [];
}
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (is_null($bangumi))
{
return $this->resOK([
'result' => [],
'total' => 0,
'no_more' => true
]);
}
$idsObj = $bangumiRepository->pins($slug, $sort, $isUp, $specId, $time, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$pinRepository = new PinRepository();
$idsObj['result'] = $pinRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function relation(Request $request)
{
$slug = $request->get('slug');
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (!$bangumi)
{
return $this->resErrNotFound();
}
$result = [
'parent' => null,
'children' => []
];
if ($bangumi->is_parent)
{
$childrenSlug = Bangumi
::where('parent_slug', $bangumi->slug)
->pluck('slug')
->toArray();
$result['children'] = $bangumiRepository->list($childrenSlug);
}
if ($bangumi->parent_slug)
{
$result['parent'] = $bangumiRepository->item($bangumi->parent_slug);
}
return $this->resOK($result);
}
public function idols(Request $request)
{
$slug = $request->get('slug');
$page = $request->get('page') ?: 1;
$take = $request->get('take') ?: 20;
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (!$bangumi)
{
return $this->resErrNotFound();
}
$idsObj = $bangumiRepository->idol_slugs($slug, $page - 1, $take);
if (empty($idsObj['result']))
{
return $this->resOK($idsObj);
}
$idolRepository = new IdolRepository();
$idsObj['result'] = $idolRepository->list($idsObj['result']);
return $this->resOK($idsObj);
}
public function fetch(Request $request)
{
$sourceId = $request->get('source_id');
$hasBangumi = Bangumi
::where('source_id', $sourceId)
->first();
if ($hasBangumi)
{
return $this->resErrBad($hasBangumi->slug);
}
$query = new Query();
$info = $query->getBangumiDetail($sourceId);
return $this->resOK($info);
}
public function create(Request $request)
{
$user = $request->user();
if (!$user->is_admin)
{
return $this->resErrRole();
}
$bangumiSource = new BangumiSource();
$bangumi = $bangumiSource->importBangumi([
'id' => $request->get('id'),
'name' => $request->get('name'),
'alias' => $request->get('alias'),
'intro' => $request->get('intro'),
'avatar' => $request->get('avatar'),
'type' => $request->get('type') ?: 0
]);
if (is_null($bangumi))
{
return $this->resErrServiceUnavailable();
}
return $this->resOK($bangumi->slug);
}
public function fetchIdols(Request $request)
{
$slug = $request->get('slug');
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (!$bangumi)
{
return $this->resErrNotFound();
}
$bangumiSource = new BangumiSource();
$bangumiSource->moveBangumiIdol($bangumi->slug, $bangumi->source_id);
$bangumiRepository->idol_slugs($slug, 0, 0, true);
return $this->resNoContent();
}
public function updateProfile(Request $request)
{
$user = $request->user();
if ($user->cant('update_bangumi'))
{
return $this->resErrRole();
}
$avatar = $request->get('avatar');
$title = $request->get('name');
$alias = $request->get('alias');
$intro = $request->get('intro');
$slug = $request->get('slug');
$bangumiRepository = new BangumiRepository();
$bangumi = $bangumiRepository->item($slug);
if (!$bangumi)
{
return $this->resErrNotFound();
}
array_push($alias, $title);
$alias = implode('|', array_unique($alias));
Bangumi
::where('slug', $slug)
->update([
'avatar' => $avatar,
'title' => $title,
'intro' => $intro,
'alias' => $alias
]);
Search
::where('slug', $slug)
->where('type', 4)
->update([
'text' => str_replace('|', ',', $alias)
]);
$bangumiRepository->item($slug, true);
return $this->resNoContent();
}
public function updateAsParent(Request $request)
{
$user = $request->user();
if ($user->cant('update_bangumi'))
{
return $this->resErrRole();
}
$bangumiSlug = $request->get('bangumi_slug');
$bangumi = Bangumi
::where('slug', $bangumiSlug)
->first();
$bangumi->update([
'is_parent' => $request->get('result') ?: true
]);
$bangumiRepository = new BangumiRepository();
$bangumiRepository->item($bangumiSlug, true);
return $this->resNoContent();
}
public function updateAsChild(Request $request)
{
$user = $request->user();
if ($user->cant('update_bangumi'))
{
return $this->resErrRole();
}
$parentSlug = $request->get('parent_slug');
$childSlug = $request->get('child_slug');
$parent = Bangumi
::where('slug', $parentSlug)
->first();
if (!$parent)
{
return $this->resErrNotFound();
}
$child = Bangumi
::where('slug', $childSlug)
->first();
if (!$child)
{
return $this->resErrBad();
}
$bangumiRepository = new BangumiRepository();
$child->update([
'parent_slug' => $parent->slug
]);
$bangumiRepository->item($childSlug, true);
if (!$parent->is_parent)
{
Bangumi
::where('slug', $parentSlug)
->update([
'is_parent' => true
]);
$bangumiRepository->item($parentSlug, true);
}
return $this->resNoContent();
}
public function allSerialization(Request $request)
{
$site = $request->get('site', 0);
if (0 == $site) {
$serializations = BangumiSerialization::get();
} else {
$serializations = BangumiSerialization::where('site', $site)->get();
}
$site = [
1 => 'bilibili',
2 => 'acfun',
3 => '爱奇艺',
4 => '腾讯视频',
5 => '芒果 tv',
];
$data = [];
foreach ($serializations as $serialization) {
$data[] = [
'id' => $serialization->id,
'title' => sprintf("%s - %s", $serialization->title, $site[$serialization->site]),
];
}
return $this->resOK($data);
}
public function bangumiList(Request $request)
{
$bangumis = Bangumi::with('serialization')->paginate(15);
return $this->resOK($bangumis);
}
public function setBangumiSerializing(Request $request)
{
$bangumiId = $request->get('bangumi_id');
$serializationId = $request->get('serialization_id');
$bangumi = null;
$serialization = null;
try {
$bangumi = Bangumi::where('id', $bangumiId)->firstOrFail();
$serialization = BangumiSerialization::where('id', $serializationId)->firstOrFail();
} catch (\Exception $e) {
var_dump($e);
return $this->resErrNotFound();
}
$bangumi['serialization_status'] = $serialization['status'];
$bangumi['serialization_id'] = $serialization['id'];
$serialization['bangumi_id'] = $bangumi['id'];
try {
DB::beginTransaction();
$bangumi->save();
} catch (\Exception $e) {
DB::rollBack();
}
return $this->resOK();
}
public function timeline(Request $request)
{
$bangumiRepository = new BangumiRepository();
$bangumis = $bangumiRepository->bangumiWithSerialization();
$serializations = [
0 => [],
1 => [],
2 => [],
3 => [],
4 => [],
5 => [],
6 => [],
];
foreach ($bangumis as $bangumi) {
$broadcastTime = Carbon::createFromFormat("Y-m-d H:i:s", $bangumi['serialization']['broadcast_time'], 'Asia/Shanghai');
$serializations[$broadcastTime->dayOfWeek][] = $bangumi;
}
return $this->resOK($serializations);
}
}
| 26.846831 | 131 | 0.509083 |
333f04815d6b91a9aecb08e2ae2b856466ac52aa | 1,032 | asm | Assembly | programs/oeis/115/A115364.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/115/A115364.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/115/A115364.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A115364: a(n) = A000217(A001511(n)), where A001511 is one more than the 2-adic valuation of n, and A000217(n) is the n-th triangular number, binomial(n+1, 2).
; 1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,21,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,28,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,21,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,36,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,21,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,28,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,21,1,3,1,6,1,3,1,10,1,3,1,6,1,3,1,15,1,3,1,6,1,3,1,10,1,3
mov $19,$0
mov $21,2
lpb $21
clr $0,19
mov $0,$19
sub $21,1
add $0,$21
lpb $0
add $3,4
mov $18,$0
lpb $18
add $2,$3
sub $18,1
lpe
div $0,2
lpe
mov $1,$2
mov $22,$21
lpb $22
mov $20,$1
sub $22,1
lpe
lpe
lpb $19
mov $19,0
sub $20,$1
lpe
mov $1,$20
sub $1,4
div $1,4
add $1,1
| 29.485714 | 532 | 0.537791 |
2f0d47e3f06c4f033e999d4b198a67ce4c5e2186 | 3,844 | java | Java | app/src/main/java/demo/example/com/customarrayadapter/PickerActivityFragmentOld.java | guyfeigin/birds | 6a822e187758ab696d20bd28c7642a49a048a215 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/demo/example/com/customarrayadapter/PickerActivityFragmentOld.java | guyfeigin/birds | 6a822e187758ab696d20bd28c7642a49a048a215 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/demo/example/com/customarrayadapter/PickerActivityFragmentOld.java | guyfeigin/birds | 6a822e187758ab696d20bd28c7642a49a048a215 | [
"Apache-2.0"
] | null | null | null | package demo.example.com.customarrayadapter;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
import com.larswerkman.lobsterpicker.LobsterPicker;
import java.util.ArrayList;
import java.util.List;
/**
* A placeholder fragment containing a simple view.
*/
public class PickerActivityFragmentOld extends Fragment implements AdapterView.OnItemSelectedListener {
LobsterPicker lobsterPicker;
boolean userSelect = false;
boolean loaded = false;
View rootView;
//private SharedPreferences mPrefs;
public PickerActivityFragmentOld() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_picker, container, false);
// Spinner element
addSpinnerColors();
addSpinnerAreas();
if(savedInstanceState == null || !savedInstanceState.containsKey("spinnerColor")) {
}
else {
//Spinner spinner = (Spinner) rootView.findViewById(R.id.spinnerColor);
//spinner.setSelection(3);
}
Spinner spinner =(Spinner) rootView.findViewById(R.id.spinnerColor);;
spinner.setSelection(3);
return rootView;
}
private void addSpinnerColors(){
Spinner spinner = (Spinner) rootView.findViewById(R.id.spinnerColor);
// Spinner click listener
spinner.setOnItemSelectedListener(this);
// Spinner Drop down elements
List<String> categories = new ArrayList<String>();
categories.add("הכל");
categories.add("שחור");
categories.add("לבן");
categories.add("אדום");
categories.add("צהוב");
categories.add("ירוק");
categories.add("כחול");
// Creating adapter for spinner
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, categories);
// Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner
spinner.setAdapter(dataAdapter);
}
private void addSpinnerAreas(){
Spinner spinner = (Spinner) rootView.findViewById(R.id.spinnerAreas);
// Create an ArrayAdapter using the string array and a default spinner layout
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(),
R.array.areas, android.R.layout.simple_spinner_item);
// Specify the layout to use when the list of choices appears
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner
spinner.setAdapter(adapter);
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// On selecting a spinner item
if (loaded) {
String item = parent.getItemAtPosition(position).toString();
// Showing selected spinner item
Toast.makeText(parent.getContext(), "Selected: " + item, Toast.LENGTH_LONG).show();
Intent returnIntent = new Intent();
returnIntent.putExtra("SelectedColor", item);
getActivity().setResult(getActivity().RESULT_OK, returnIntent);
// getActivity().finish();
}
loaded=true;
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
public void testAddtoGit(){}
}
| 34.630631 | 133 | 0.684183 |
defee51294e00bddda86983d6dd640dbb5759cc9 | 14,281 | rs | Rust | src/core/lightdistrib.rs | mlunnay/rs_illume | a7e88118d829d24e35673df8a1f49a3b870a36e6 | [
"BSD-3-Clause"
] | 2 | 2019-12-27T19:33:28.000Z | 2021-05-16T03:23:03.000Z | src/core/lightdistrib.rs | mlunnay/rs_illume | a7e88118d829d24e35673df8a1f49a3b870a36e6 | [
"BSD-3-Clause"
] | null | null | null | src/core/lightdistrib.rs | mlunnay/rs_illume | a7e88118d829d24e35673df8a1f49a3b870a36e6 | [
"BSD-3-Clause"
] | null | null | null | use super::pbrt::Float;
use super::geometry::{Bounding3, Bounds3f, Point2f, Point3f, Point3i, Vector3f, Normal3f};
use super::sampling::Distribution1D;
use super::scene::Scene;
use super::integrator::compute_light_power_distribution;
use super::low_discrepancy::radical_inverse;
use super::interaction::SimpleInteraction;
use super::medium::MediumInterface;
use super::light::VisibilityTester;
use super::stats_accumulator::StatsAccumulator;
use super::profiler::Profiler;
use std::sync::{Arc, /* RwLock ,*/ atomic::{AtomicU64, Ordering}};
use parking_lot::RwLock;
use num::clamp;
/// LightDistribution defines a general interface for classes that provide
/// probability distributions for sampling light sources at a given point in
/// space.
pub trait LightDistribution {
/// Given a point |p| in space, this method returns a (hopefully
/// effective) sampling distribution for light sources at that point.
fn lookup(&self, p: &Point3f) -> Arc<Distribution1D>;
}
/// The simplest possible implementation of LightDistribution: this returns
/// a uniform distribution over all light sources, ignoring the provided
/// point. This approach works well for very simple scenes, but is quite
/// ineffective for scenes with more than a handful of light sources. (This
/// was the sampling method originally used for the PathIntegrator and the
/// VolPathIntegrator in the printed book, though without the
/// UniformLightDistribution class.)
pub struct UniformLightDistribution {
distrib: Arc<Distribution1D>
}
impl UniformLightDistribution {
pub fn new(scene: &Scene) -> UniformLightDistribution {
let mut prob: Vec<Float> = vec![1.0 as Float; scene.lights.len()];
UniformLightDistribution {
distrib: Arc::new(Distribution1D::new(&prob))
}
}
}
impl LightDistribution for UniformLightDistribution {
fn lookup(&self, p: &Point3f) -> Arc<Distribution1D> {
self.distrib.clone()
}
}
/// PowerLightDistribution returns a distribution with sampling probability
/// proportional to the total emitted power for each light. (It also ignores
/// the provided point |p|.) This approach works well for scenes where
/// there the most powerful lights are also the most important contributors
/// to lighting in the scene, but doesn't do well if there are many lights
/// and if different lights are relatively important in some areas of the
/// scene and unimportant in others. (This was the default sampling method
/// used for the BDPT integrator and MLT integrator in the printed book,
/// though also without the PowerLightDistribution class.)
pub struct PowerLightDistribution {
distrib: Arc<Distribution1D>
}
impl PowerLightDistribution {
pub fn new(scene: &Scene) -> PowerLightDistribution {
let distrib = if let Some(d) = compute_light_power_distribution(scene) {
d
} else {
Arc::new(Distribution1D::new(&Vec::<Float>::new()))
};
PowerLightDistribution {
distrib
}
}
}
impl LightDistribution for PowerLightDistribution {
fn lookup(&self, p: &Point3f) -> Arc<Distribution1D> {
self.distrib.clone()
}
}
/// A spatially-varying light distribution that adjusts the probability of
/// sampling a light source based on an estimate of its contribution to a
/// region of space. A fixed voxel grid is imposed over the scene bounds
/// and a sampling distribution is computed as needed for each voxel.
pub struct SpatialLightDistribution<'a> {
scene: &'a Scene,
n_voxels: [u32; 3],
hash_table: Arc<Vec<HashEntry>>
}
// Voxel coordinates are packed into a uint64_t for hash table lookups;
// 10 bits are allocated to each coordinate. invalidPackedPos is an impossible
// packed coordinate value, which we use to represent
const INVALID_PACKED_POS: u64 = 0xffffffffffffffff;
impl<'a> SpatialLightDistribution<'a> {
/// Create a new SpatialLightDistribution.
/// default max_voxels size is 64.
pub fn new(scene: &'a Scene, max_voxels: usize) -> SpatialLightDistribution {
// Compute the number of voxels so that the widest scene bounding box
// dimension has maxVoxels voxels and the other dimensions have a number
// of voxels so that voxels are roughly cube shaped.
let b = scene.world_bound();
let diag = b.diagonal();
let bmax = diag[b.maximum_extent()];
let mut n_voxels = [0_u32; 3];
for i in 0..3 {
n_voxels[i] = ((diag[i] / bmax * max_voxels as Float).round() as u32).max(1);
// In the Lookup() method, we require that 20 or fewer bits be
// sufficient to represent each coordinate value. It's fairly hard
// to imagine that this would ever be a problem.
assert!(n_voxels[i] < 1 << 20);
}
let hash_table_size = (4 * n_voxels[0] * n_voxels[1] * n_voxels[2]) as usize;
let hash_table: Vec<HashEntry> = Vec::with_capacity(hash_table_size);
for i in 0..hash_table_size {
hash_table.push(HashEntry {
packed_pos: AtomicU64::new(INVALID_PACKED_POS),
distribution: RwLock::new(None)
});
}
info!("SpatialLightDistribution: scene bounds {}, vexel res ({}, {}, {})", b, n_voxels[0], n_voxels[1], n_voxels[2]);
SpatialLightDistribution {
scene,
n_voxels,
hash_table: Arc::new(hash_table)
}
}
fn compute_distribution(&self, pi: &Point3i) -> Distribution1D {
StatsAccumulator::instance().report_counter(String::from("SpatialLightDistribution/Distributions created"), 1);
StatsAccumulator::instance().report_ratio(String::from("SpatialLightDistribution/Lookups per distribution"), 0, 1);
// Compute the world-space bounding box of the voxel corresponding to
// |pi|.
let p0 = Point3f::new(
pi[0] as Float / self.n_voxels[0] as Float,
pi[1] as Float / self.n_voxels[1] as Float,
pi[2] as Float / self.n_voxels[2] as Float,
);
let p1 = Point3f::new(
pi[0] as Float + 1.0 / self.n_voxels[0] as Float,
pi[1] as Float + 1.0 / self.n_voxels[1] as Float,
pi[2] as Float + 1.0 / self.n_voxels[2] as Float,
);
let voxel_bounds = Bounds3f::new(self.scene.world_bound().lerp(&p0),
self.scene.world_bound().lerp(&p1)
);
// Compute the sampling distribution. Sample a number of points inside
// voxelBounds using a 3D Halton sequence; at each one, sample each
// light source and compute a weight based on Li/pdf for the light's
// sample (ignoring visibility between the point in the voxel and the
// point on the light source) as an approximation to how much the light
// is likely to contribute to illumination in the voxel.
let n_samples: usize = 128;
let mut light_contrib = vec![0.0 as Float; self.scene.lights.len()];
for i in 0..n_samples {
let po = voxel_bounds.lerp(&Point3f::new(
radical_inverse(0, i as u64), radical_inverse(1, i as u64), radical_inverse(2, i as u64)
));
let mut intr = Box::new(SimpleInteraction::new(po, 0.0, Vector3f::default(), Vector3f::new(1.0, 0.0, 0.0), Normal3f::default()));
intr.medium_interface = Some(Arc::new(MediumInterface::default()));
// Use the next two Halton dimensions to sample a point on the
// light source.
let u = Point2f::new(radical_inverse(3, i as u64), radical_inverse(4, i as u64));
for j in 0..self.scene.lights.len() {
let mut pdf: Float = 0.0;
let mut wi = Vector3f::default();
let mut vis = VisibilityTester::default();
let li = self.scene.lights[j].sample_li(intr, &u, &mut wi, &mut pdf, &mut vis);
if pdf > 0.0 {
// TODO: look at tracing shadow rays / computing beam
// transmittance. Probably shouldn't give those full weight
// but instead e.g. have an occluded shadow ray scale down
// the contribution by 10 or something.
light_contrib[j] += li.y() / pdf;
}
}
}
// We don't want to leave any lights with a zero probability; it's
// possible that a light contributes to points in the voxel even though
// we didn't find such a point when sampling above. Therefore, compute
// a minimum (small) weight and ensure that all lights are given at
// least the corresponding probability.
let sum_contrib = light_contrib.iter().sum();
let avg_contrib = sum_contrib / (n_samples + light_contrib.len()) as Float;
let min_contrib = if avg_contrib > 0.0 { 0.001 * avg_contrib } else { 1.0 };
for i in 0..light_contrib.len() {
vlog!(2, "Voxel pi = {}, light {} contrib = {}", pi, i, light_contrib[i]);
light_contrib[i] = light_contrib[i].max(min_contrib);
}
info!("Initialized light distribution in voxel pi= {}, avgContrib = {}", pi, avg_contrib);
// Compute a sampling distribution from the accumulated contributions.
Distribution1D::new(&light_contrib)
}
}
impl<'a> LightDistribution for SpatialLightDistribution<'a> {
fn lookup(&self, p: &Point3f) -> Arc<Distribution1D> {
let _p = Profiler::instance().profile("SpatialLightDistribution lookup");
StatsAccumulator::instance().report_ratio(String::from("SpatialLightDistribution/Lookups per distribution"), 1, 0);
// First, compute integer voxel coordinates for the given point |p|
// with respect to the overall voxel grid.
let offset = self.scene.world_bound().offset(p);
let mut pi = Point3i::default();
for i in 0..3_usize {
// The clamp should almost never be necessary, but is there to be
// robust to computed intersection points being slightly outside
// the scene bounds due to floating-point roundoff error.
pi[i as u8] = clamp((offset[i as u8] * self.n_voxels[i] as Float) as i32, 0, self.n_voxels[i] as i32 - 1);
}
// Pack the 3D integer voxel coordinates into a single 64-bit value.
let packed_pos = ((pi[0] as u64) << 40) | ((pi[0] as u64) << 20) | pi[2] as u64;
assert_ne!(packed_pos, INVALID_PACKED_POS);
// Compute a hash value from the packed voxel coordinates. We could
// just take packedPos mod the hash table size, but since packedPos
// isn't necessarily well distributed on its own, it's worthwhile to do
// a little work to make sure that its bits values are individually
// fairly random. For details of and motivation for the following, see:
// http://zimbry.blogspot.ch/2011/09/better-bit-mixing-improving-on.html
let mut hash = packed_pos;
hash ^= hash >> 31;
hash *= 0x7fb5d329728ea185;
hash ^= hash >> 27;
hash *= 0x81dadef4bc2dd44d;
hash ^= hash >> 33;
hash %= self.hash_table.len() as u64;
assert!(hash >= 0);
// Now, see if the hash table already has an entry for the voxel. We'll
// use quadratic probing when the hash table entry is already used for
// another value; step stores the square root of the probe step.
let mut step: u64 = 1;
let mut n_probes: usize = 0;
loop {
n_probes += 1;
let mut entry = &self.hash_table[hash as usize];
// Does the hash table entry at offset |hash| match the current point?
let entry_packed_pos = entry.packed_pos.load(Ordering::Acquire);
if entry_packed_pos == packed_pos {
// Yes! Most of the time, there should already by a light
// sampling distribution available.
// this differs from the C++ code as the RwLock should ensure that
// the hash_table entries distribution is created.
// It also means we cant profile the spin lock.
// let option: Option<Arc<Distribution1D>> = entry.distribution.read().unwrap();
if let Some(dist) = *entry.distribution.read() {
return dist.clone();
};
} else if entry_packed_pos != INVALID_PACKED_POS {
// The hash table entry we're checking has already been
// allocated for another voxel. Advance to the next entry with
// quadratic probing.
hash += step * step;
if hash >= self.hash_table.len() as u64 {
hash %= self.hash_table.len() as u64;
}
step += 1;
} else {
// We have found an invalid entry. (Though this may have
// changed since the load into entryPackedPos above.) Use an
// atomic compare/exchange to try to claim this entry for the
// current position.
let invalid = INVALID_PACKED_POS;
if entry.packed_pos.compare_exchange_weak(invalid, packed_pos, Ordering::SeqCst, Ordering::Relaxed).is_ok() {
// Success; we've claimed this position for this voxel's
// distribution. Now compute the sampling distribution and
// add it to the hash table. As long as packedPos has been
// set but the entry's distribution pointer is nullptr, any
// other threads looking up the distribution for this voxel
// will spin wait until the distribution pointer is
// written.
let dist = Arc::new(self.compute_distribution(&pi));
let mut distribution = entry.distribution.write();
*distribution = Some(dist.clone());
return dist;
}
}
}
}
}
#[derive(Debug)]
struct HashEntry {
packed_pos: AtomicU64,
distribution: RwLock<Option<Arc<Distribution1D>>>
} | 47.762542 | 141 | 0.625797 |
0b4cc6aa957df616a9c14313fa9b9ee7ec6d0837 | 1,434 | py | Python | calculators/static_dipolar_couplings/dcc.py | jlorieau/nmr | 15224342a9277da8b02e10027644c86ac3769db1 | [
"MIT"
] | null | null | null | calculators/static_dipolar_couplings/dcc.py | jlorieau/nmr | 15224342a9277da8b02e10027644c86ac3769db1 | [
"MIT"
] | null | null | null | calculators/static_dipolar_couplings/dcc.py | jlorieau/nmr | 15224342a9277da8b02e10027644c86ac3769db1 | [
"MIT"
] | null | null | null | from math import pi
u0 = 4.*pi*1E-7 # T m /A
hbar = 1.0545718E-34 # J s
# 1 T = kg s^-2 A-1 = J A^-1 m^-2
g = {
'1H' : 267.513E6, # rad T^-1 s^-1
'13C': 67.262E6,
'15N': -27.116E6,
'e': 176086E6
}
# nuc_i, nuc_j: nucleus string. ex: '1H'
# r_ij: distance in Angstroms
DCC = lambda nuc_i, nuc_j, r_ij: -1.*(u0*g[nuc_i]*g[nuc_j]*hbar)/(4.*pi*(r_ij*1E-10)**3)
print('-'*30)
print('1H-15N (1.02A): {:> 8.1f} Hz'.format(DCC('1H','15N', 1.02)/(2.*pi), 'Hz'))
print('1H-15N (1.04A): {:> 8.1f} Hz'.format(DCC('1H','15N', 1.04)/(2.*pi), 'Hz'))
print('-'*30)
print('1H-13C (1.1A): {:> 8.1f} Hz'.format(DCC('1H','13C', 1.1)/(2.*pi), 'Hz'))
print('-'*30)
print('1H-1H (1.00A): {:> 8.1f} Hz'.format(DCC('1H','1H', 1.0)/(2.*pi), 'Hz'))
print('1H-1H (2.4A): {:> 8.1f} Hz'.format(DCC('1H','1H', 2.4)/(2.*pi), 'Hz'))
print('1H-1H (2.8A): {:> 8.1f} Hz'.format(DCC('1H','1H', 2.8)/(2.*pi), 'Hz'))
print('-'*30)
print('13C-13C (1.53A): {:> 8.1f} Hz'.format(DCC('13C','13C', 1.53)/(2.*pi), 'Hz'))
print('-'*30)
print('1H-e (1A): {:> 8.1f} MHz'.format(DCC('1H','e', 1.0)/(1E6*2.*pi), 'Hz'))
print('1H-e (5A): {:> 8.1f} kHz'.format(DCC('1H','e', 5.0)/(1E3*2.*pi), 'Hz'))
print('1H-e (10A): {:> 8.1f} kHz'.format(DCC('1H','e', 10.0)/(1E3*2.*pi), 'Hz'))
print('1H-e (50A): {:> 8.1f} kHz'.format(DCC('1H','e', 50.0)/(1E3*2.*pi), 'Hz'))
print('1H-e (100A): {:> 8.1f} Hz'.format(DCC('1H','e', 100.0)/(2.*pi), 'Hz'))
print('-'*30)
| 34.142857 | 89 | 0.502092 |
83e16444b1f88a74415b03a5a9cedc72b977d320 | 2,775 | java | Java | src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/PendingSound.java | OreCruncher/BetterRain | 315a8418c7d21fd29e873973c27a1e37c176fc90 | [
"Unlicense",
"MIT"
] | 25 | 2015-12-21T05:48:08.000Z | 2021-11-13T10:25:27.000Z | src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/PendingSound.java | OreCruncher/BetterRain | 315a8418c7d21fd29e873973c27a1e37c176fc90 | [
"Unlicense",
"MIT"
] | 136 | 2015-12-18T21:47:51.000Z | 2021-01-31T20:21:23.000Z | src/main/java/org/blockartistry/mod/DynSurround/client/footsteps/mcpackage/implem/PendingSound.java | OreCruncher/BetterRain | 315a8418c7d21fd29e873973c27a1e37c176fc90 | [
"Unlicense",
"MIT"
] | 13 | 2016-01-31T09:35:50.000Z | 2021-11-13T10:25:29.000Z | /*
* This file is part of Dynamic Surroundings, licensed under the MIT License (MIT).
*
* Copyright (c) OreCruncher
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem;
import org.blockartistry.mod.DynSurround.client.footsteps.engine.interfaces.IOptions;
import org.blockartistry.mod.DynSurround.client.footsteps.engine.interfaces.ISoundPlayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class PendingSound {
private final Object location;
private final String soundName;
private final float volume;
private final float pitch;
private final IOptions options;
private final long timeToPlay;
private final long maximum;
public PendingSound(final Object location, final String soundName, final float volume, final float pitch,
final IOptions options, final long timeToPlay, final long maximum) {
this.location = location;
this.soundName = soundName;
this.volume = volume;
this.pitch = pitch;
this.options = options;
this.timeToPlay = timeToPlay;
this.maximum = maximum;
}
/**
* Play the sound stored in this pending sound.
*
* @param player
*/
public void playSound(final ISoundPlayer player) {
player.playSound(this.location, this.soundName, this.volume, this.pitch, this.options);
}
/**
* Returns the time after which this sound plays.
*
* @return
*/
public long getTimeToPlay() {
return this.timeToPlay;
}
/**
* Get the maximum delay of this sound, for threshold purposes. If the value
* is negative, the sound will not be skippable.
*
* @return
*/
public long getMaximumBase() {
return this.maximum;
}
}
| 33.433735 | 106 | 0.754595 |
da1212bc397ddcdcfde423cda47d094dcb50bd40 | 281 | kt | Kotlin | core/src/main/java/com/trivago/core/network/ErrorResponse.kt | aldefy/trivago | 59ef8857d0cdf9ac50836a25bc61273a30ca5928 | [
"MIT"
] | 1 | 2021-06-25T08:50:23.000Z | 2021-06-25T08:50:23.000Z | core/src/main/java/com/trivago/core/network/ErrorResponse.kt | aldefy/trivago | 59ef8857d0cdf9ac50836a25bc61273a30ca5928 | [
"MIT"
] | null | null | null | core/src/main/java/com/trivago/core/network/ErrorResponse.kt | aldefy/trivago | 59ef8857d0cdf9ac50836a25bc61273a30ca5928 | [
"MIT"
] | null | null | null | package com.trivago.core.network
import com.google.gson.annotations.SerializedName
data class ErrorResponse(
@SerializedName("errors")
val errors: List<Any>?,
@SerializedName("message")
val message: String?,
@SerializedName("status")
val status: String?
) | 23.416667 | 49 | 0.718861 |
b04acbddac298d7bc355edd23580f803b4acedf9 | 32,780 | html | HTML | docs/global.html | collinhover/impactplusplus | 06c590bf38ef9ff8f0c639fb36973c82ea93bc48 | [
"MIT"
] | 71 | 2015-01-02T17:00:23.000Z | 2021-11-25T03:13:53.000Z | docs/global.html | markwinap/impactplusplus | bbab5022f0259a9dee67b08a06f383fff7523943 | [
"MIT"
] | 8 | 2015-01-09T01:05:34.000Z | 2020-09-13T18:58:22.000Z | docs/global.html | markwinap/impactplusplus | bbab5022f0259a9dee67b08a06f383fff7523943 | [
"MIT"
] | 36 | 2015-01-13T07:45:14.000Z | 2021-11-09T02:07:12.000Z | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Impact++ / Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="scripts/html5shiv.js"> </script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/main.css">
</head>
<body data-spy="scroll" data-target="#navdoc">
<div id="header">
<div class="container">
<div id="logo">
<a href="index.html"><img src="img/logo_impactplusplus_128.png"></a>
<a href='http://github.com/collinhover/impactplusplus/' id="forkBtn">
<img src="img/fork_impactplusplus.png" alt="Fork me on GitHub">
</a>
</div>
</div>
</div>
<div id="docs" class="container">
<div class="row">
<div class="span2">
<nav id="mainnav">
<div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navTutorialsCollapse">Tutorials</button><div id="navTutorialsCollapse" class="collapse"><ul class="nav nav-list"><li id="navTutorials" class="nav-header hidden-phone">Tutorials</li><li><a href="tutorial-Started.html">1. Getting Started</a></li><li><a href="tutorial-Player.html">2. Player</a></li><li><a href="tutorial-Character.html">3. Character</a></li><li><a href="tutorial-Camera.html">4. Camera</a></li><li><a href="tutorial-UI.html">5. UI</a></li><li><a href="tutorial-Pathfinding.html">6. Pathfinding</a></li><li><a href="tutorial-Creatures.html">7. Creatures</a></li><li><a href="tutorial-Lighting.html">8. Lighting</a></li><li><a href="tutorial-Conversations.html">9. Conversations</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navAbilitiesCollapse">Abilities</button><div id="navAbilitiesCollapse" class="collapse"><ul class="nav nav-list"><li id="navAbilities" class="nav-header hidden-phone">Abilities</li><li><a href="ig.Ability.html">Ability</a></li><li><a href="ig.AbilityDamage.html">AbilityDamage</a></li><li><a href="ig.AbilityGlow.html">AbilityGlow</a></li><li><a href="ig.AbilityGlowToggle.html">AbilityGlowToggle</a></li><li><a href="ig.AbilityInteract.html">AbilityInteract</a></li><li><a href="ig.AbilityMelee.html">AbilityMelee</a></li><li><a href="ig.AbilityMimic.html">AbilityMimic</a></li><li><a href="ig.AbilityShoot.html">AbilityShoot</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navAbstractitiesCollapse">Abstractities</button><div id="navAbstractitiesCollapse" class="collapse"><ul class="nav nav-list"><li id="navAbstractities" class="nav-header hidden-phone">Abstractities</li><li><a href="ig.Character.html">Character</a></li><li><a href="ig.Creature.html">Creature</a></li><li><a href="ig.Demo.html">Demo</a></li><li><a href="ig.Door.html">Door</a></li><li><a href="ig.DoorTriggered.html">DoorTriggered</a></li><li><a href="ig.DoorUsable.html">DoorUsable</a></li><li><a href="ig.Effect.html">Effect</a></li><li><a href="ig.Lever.html">Lever</a></li><li><a href="ig.Particle.html">Particle</a></li><li><a href="ig.ParticleFast.html">ParticleFast</a></li><li><a href="ig.Player.html">Player</a></li><li><a href="ig.Projectile.html">Projectile</a></li><li><a href="ig.Shape.html">Shape</a></li><li><a href="ig.Spawner.html">Spawner</a></li><li><a href="ig.SpawnerCharacter.html">SpawnerCharacter</a></li><li><a href="ig.SpawnerFast.html">SpawnerFast</a></li><li><a href="ig.Tutorial.html">Tutorial</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navCoreCollapse">Core</button><div id="navCoreCollapse" class="collapse"><ul class="nav nav-list"><li id="navCore" class="nav-header hidden-phone">Core</li><li><a href="ig.html">ig</a></li><li><a href="ig.CONFIG.html">CONFIG</a></li><li><a href="ig.CONFIG_USER.html">CONFIG_USER</a></li><li><a href="ig.EntityExtended.COLLIDES.html">COLLIDES</a></li><li><a href="ig.EntityExtended.GROUP.html">GROUP</a></li><li><a href="ig.EntityExtended.PERFORMANCE.html">PERFORMANCE</a></li><li><a href="ig.EntityExtended.TYPE.html">TYPE</a></li><li><a href="ig.Font.FONTS.html">FONTS</a></li><li><a href="ig.AnimationExtended.html">AnimationExtended</a></li><li><a href="ig.AnimationSheet.html">AnimationSheet</a></li><li><a href="ig.BackgroundMapExtended.html">BackgroundMapExtended</a></li><li><a href="ig.Camera.html">Camera</a></li><li><a href="ig.CollisionMap.html">CollisionMap</a></li><li><a href="ig.EntityExtended.html">EntityExtended</a></li><li><a href="ig.Font.html">Font</a></li><li><a href="ig.GameExtended.html">GameExtended</a></li><li><a href="ig.Hierarchy.html">Hierarchy</a></li><li><a href="ig.Image.html">Image</a></li><li><a href="ig.ImageDrawing.html">ImageDrawing</a></li><li><a href="ig.Input.html">Input</a></li><li><a href="ig.InputPoint.html">InputPoint</a></li><li><a href="ig.Layer.html">Layer</a></li><li><a href="ig.LoaderExtended.html">LoaderExtended</a></li><li><a href="ig.PathfindingMap.html">PathfindingMap</a></li><li><a href="ig.PlayerManager.html">PlayerManager</a></li><li><a href="ig.System.html">System</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navEntitiesCollapse">Entities</button><div id="navEntitiesCollapse" class="collapse"><ul class="nav nav-list"><li id="navEntities" class="nav-header hidden-phone">Entities</li><li><a href="ig.EntityAbilityActivate.html">EntityAbilityActivate</a></li><li><a href="ig.EntityAbilityEnable.html">EntityAbilityEnable</a></li><li><a href="ig.EntityAbilityUpgrade.html">EntityAbilityUpgrade</a></li><li><a href="ig.EntityCameraAtmosphere.html">EntityCameraAtmosphere</a></li><li><a href="ig.EntityCameraFollow.html">EntityCameraFollow</a></li><li><a href="ig.EntityCameraShake.html">EntityCameraShake</a></li><li><a href="ig.EntityCheckpoint.html">EntityCheckpoint</a></li><li><a href="ig.EntityConversation.html">EntityConversation</a></li><li><a href="ig.EntityDemoHold.html">EntityDemoHold</a></li><li><a href="ig.EntityDemoSwipe.html">EntityDemoSwipe</a></li><li><a href="ig.EntityDemoTap.html">EntityDemoTap</a></li><li><a href="ig.EntityDestructable.html">EntityDestructable</a></li><li><a href="ig.EntityDestructableCollide.html">EntityDestructableCollide</a></li><li><a href="ig.EntityDestructableDamage.html">EntityDestructableDamage</a></li><li><a href="ig.EntityDirection.html">EntityDirection</a></li><li><a href="ig.EntityDummy.html">EntityDummy</a></li><li><a href="ig.EntityEffectElectricity.html">EntityEffectElectricity</a></li><li><a href="ig.EntityEffectPow.html">EntityEffectPow</a></li><li><a href="ig.EntityEventDefense.html">EntityEventDefense</a></li><li><a href="ig.EntityExplosion.html">EntityExplosion</a></li><li><a href="ig.EntityLava.html">EntityLava</a></li><li><a href="ig.EntityLevelchange.html">EntityLevelchange</a></li><li><a href="ig.EntityLight.html">EntityLight</a></li><li><a href="ig.EntityNarrative.html">EntityNarrative</a></li><li><a href="ig.EntityPain.html">EntityPain</a></li><li><a href="ig.EntityPainInstagib.html">EntityPainInstagib</a></li><li><a href="ig.EntityParticleColor.html">EntityParticleColor</a></li><li><a href="ig.EntityParticleDebris.html">EntityParticleDebris</a></li><li><a href="ig.EntityShapeClimbable.html">EntityShapeClimbable</a></li><li><a href="ig.EntityShapeClimbableOneWay.html">EntityShapeClimbableOneWay</a></li><li><a href="ig.EntityShapeSolid.html">EntityShapeSolid</a></li><li><a href="ig.EntitySlime.html">EntitySlime</a></li><li><a href="ig.EntitySwitch.html">EntitySwitch</a></li><li><a href="ig.EntityText.html">EntityText</a></li><li><a href="ig.EntityTrigger.html">EntityTrigger</a></li><li><a href="ig.EntityTriggerConstant.html">EntityTriggerConstant</a></li><li><a href="ig.EntityTriggerController.html">EntityTriggerController</a></li><li><a href="ig.EntityTriggerFunction.html">EntityTriggerFunction</a></li><li><a href="ig.EntityTriggerInput.html">EntityTriggerInput</a></li><li><a href="ig.EntityTriggerKill.html">EntityTriggerKill</a></li><li><a href="ig.EntityTriggerProperty.html">EntityTriggerProperty</a></li><li><a href="ig.EntityTriggerReverse.html">EntityTriggerReverse</a></li><li><a href="ig.EntityTriggerReverseConstant.html">EntityTriggerReverseConstant</a></li><li><a href="ig.EntityTutorialHold.html">EntityTutorialHold</a></li><li><a href="ig.EntityTutorialSwipe.html">EntityTutorialSwipe</a></li><li><a href="ig.EntityTutorialTap.html">EntityTutorialTap</a></li><li><a href="ig.EntityVoid.html">EntityVoid</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navHelpersCollapse">Helpers</button><div id="navHelpersCollapse" class="collapse"><ul class="nav nav-list"><li id="navHelpers" class="nav-header hidden-phone">Helpers</li><li><a href="ig.pathfinding.html">pathfinding</a></li><li><a href="ig.TWEEN.html">TWEEN</a></li><li><a href="ig.utils.html">utils</a></li><li><a href="ig.utilscolor.html">utilscolor</a></li><li><a href="ig.utilsdraw.html">utilsdraw</a></li><li><a href="ig.utilsintersection.html">utilsintersection</a></li><li><a href="ig.utilsmath.html">utilsmath</a></li><li><a href="ig.utilstile.html">utilstile</a></li><li><a href="ig.utilsvector2.html">utilsvector2</a></li><li><a href="ig.xhr.html">xhr</a></li><li><a href="ig.PathNode.html">PathNode</a></li><li><a href="ig.Preloader.html">Preloader</a></li><li><a href="ig.Signal.html">Signal</a></li><li><a href="ig.TWEEN.Tween.html">Tween</a></li></ul></div></div><div class="mainnav-list"><button class="btn btn-link btn-collapse visible-phone nav-header" data-toggle="collapse" data-target="#navUiCollapse">Ui</button><div id="navUiCollapse" class="collapse"><ul class="nav nav-list"><li id="navUi" class="nav-header hidden-phone">Ui</li><li><a href="ig.UIButton.html">UIButton</a></li><li><a href="ig.UIElement.html">UIElement</a></li><li><a href="ig.UIInteractive.html">UIInteractive</a></li><li><a href="ig.UIMeter.html">UIMeter</a></li><li><a href="ig.UIOverlay.html">UIOverlay</a></li><li><a href="ig.UIOverlayPause.html">UIOverlayPause</a></li><li><a href="ig.UIText.html">UIText</a></li><li><a href="ig.UITextBox.html">UITextBox</a></li><li><a href="ig.UITextBubble.html">UITextBubble</a></li><li><a href="ig.UIToggle.html">UIToggle</a></li><li><a href="ig.UITogglePause.html">UITogglePause</a></li><li><a href="ig.UIToggleVolume.html">UIToggleVolume</a></li><li><a href="ig.UITracker.html">UITracker</a></li></ul></div></div>
</nav>
</div>
<div class="span10">
<div id="maincontent">
<ul class="breadcrumb"><li><a href="https://github.com/collinhover/impactplusplus/">Impact++</a><span class="divider">/</span></li></ul>
<div class="row">
<div id="maincontentColumn8" class="span8">
<section id="doc">
<header id="overview">
<div class="hero-unit">
<h1>
</h1>
<div class="container-overview">
<dl class="details dl-horizontal">
</dl>
</div>
</div>
</header>
<article>
<div id="members" class="subsection">
<h3 class="subsection-title page-header">Members</h3>
<dl>
<dt >
<h4 class="name" id="ignoreSystemScale"><span class="type-signature"></span>ignoreSystemScale<span class="type-signature"> :Boolean</span></h4>
</dt>
<dd >
<p class="description">
Whether fonts should ignore system scale.
<span class="alert"><strong>IMPORTANT:</strong> when true, fonts will not scale dynamically with view and instead will be fixed in size. This is usually ideal.</span>
</p>
<dl class="details dl-horizontal">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="unstyled dummy"><li>ig.CONFIG.FONT.IGNORE_SYSTEM_SCALE</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L57" target="_blank">font.js, line 57</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="onResized"><span class="type-signature"></span>onResized<span class="type-signature"> :<a href="ig.Signal.html">ig.Signal</a></span></h4>
</dt>
<dd >
<p class="description">
Signal dispatched when system is resized.
<br>- created on init.
</p>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/plusplus.js#L177" target="_blank">plusplus.js, line 177</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="scale"><span class="type-signature"></span>scale<span class="type-signature"> :Number</span></h4>
</dt>
<dd >
<p class="description">
Scale that overrides system scale when <a href="ig.Font.html#ignoreSystemScale">ig.Font#ignoreSystemScale</a> is true.
</p>
<dl class="details dl-horizontal">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="unstyled dummy"><li>ig.CONFIG.FONT.SCALE</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L28" target="_blank">font.js, line 28</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="scaleMax"><span class="type-signature"></span>scaleMax<span class="type-signature"> :Number</span></h4>
</dt>
<dd >
<p class="description">
Maximum value of <a href="ig.Font.html#scale">ig.Font#scale</a>.
</p>
<dl class="details dl-horizontal">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="unstyled dummy"><li>ig.CONFIG.FONT.SCALE_MAX</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L49" target="_blank">font.js, line 49</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="scaleMin"><span class="type-signature"></span>scaleMin<span class="type-signature"> :Number</span></h4>
</dt>
<dd >
<p class="description">
Minimum value of <a href="ig.Font.html#scale">ig.Font#scale</a>.
</p>
<dl class="details dl-horizontal">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="unstyled dummy"><li>ig.CONFIG.FONT.SCALE_MIN</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L42" target="_blank">font.js, line 42</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="scaleOfSystemScale"><span class="type-signature"></span>scaleOfSystemScale<span class="type-signature"> :Number</span></h4>
</dt>
<dd >
<p class="description">
Scale of system scale.
</p>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L35" target="_blank">font.js, line 35</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="size"><span class="type-signature"></span>size<span class="type-signature"> :Number</span></h4>
</dt>
<dd >
<p class="description">
Size of system based on minimum of width and height.
</p>
<dl class="details dl-horizontal">
<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="unstyled dummy"><li>240</li></ul></dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/plusplus.js#L170" target="_blank">plusplus.js, line 170</a>
</li></ul></dd>
</dl>
</dd>
</dl>
</div>
<hr>
<div id="methods" class="subsection">
<h3 class="subsection-title page-header">Methods</h3>
<dl>
<dt >
<h4 class="name" id="init">
<span class="type-signature"></span>init<span class="signature">(canvasId, fps, width, height, scale)</span><span class="type-signature"></span>
</h4>
</dt>
<dd >
<p class="description">
Initializes system and creates extra properties such as resize signal
</p>
<span class="label">Parameters:</span>
<table class="params table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>canvasId</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>fps</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/plusplus.js#L187" target="_blank">plusplus.js, line 187</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="multilineForWidth">
<span class="type-signature"></span>multilineForWidth<span class="signature">(text, width)</span><span class="type-signature"> → {String}</span>
</h4>
</dt>
<dd >
<p class="description">
Inserts newlines (\n) into text where necessary to keep text within width.
<br>- this breaks by words at the last space, rather than breaking by char
</p>
<span class="label">Parameters:</span>
<table class="params table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L66" target="_blank">font.js, line 66</a>
</li></ul></dd>
</dl>
<span class="label">Returns:</span>
<div class="param-desc">
<span class="type-signature">{
<span class="param-type">String</span>
}</span>
line from text
</div>
</dd>
<dt >
<h4 class="name" id="overflowForHeight">
<span class="type-signature"></span>overflowForHeight<span class="signature">(text, height)</span><span class="type-signature"> → {Object}</span>
</h4>
</dt>
<dd >
<p class="description">
Splits text into display and overflow based on height.
</p>
<span class="label">Parameters:</span>
<table class="params table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>text</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/font.js#L107" target="_blank">font.js, line 107</a>
</li></ul></dd>
</dl>
<span class="label">Returns:</span>
<div class="param-desc">
<span class="type-signature">{
<span class="param-type">Object</span>
}</span>
object with showing and overflowing properties.
</div>
</dd>
<dt >
<h4 class="name" id="resize">
<span class="type-signature"></span>resize<span class="signature">(width, height, scale, <span class="optional">force</span>)</span><span class="type-signature"></span>
</h4>
</dt>
<dd >
<p class="description">
Resizes system and dispatches resize signal.
</p>
<span class="label">Parameters:</span>
<table class="params table table-bordered">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>width</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>height</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>scale</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>force</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">whether to force global resize (only do this when absolutely necessary).</td>
</tr>
</tbody>
</table>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/plusplus.js#L234" target="_blank">plusplus.js, line 234</a>
</li></ul></dd>
</dl>
</dd>
<dt >
<h4 class="name" id="run">
<span class="type-signature"></span>run<span class="signature">()</span><span class="type-signature"></span>
</h4>
</dt>
<dd >
<p class="description">
Runs system, accounting for maximum framerate.
</p>
<dl class="details dl-horizontal">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="unstyled dummy"><li>
<a href="https://github.com/collinhover/impactplusplus/tree/master/lib/plusplus/core/plusplus.js#L205" target="_blank">plusplus.js, line 205</a>
</li></ul></dd>
</dl>
</dd>
</dl>
</div>
</article>
</section>
</div>
<div id="maincontentColumn2" class="span2">
<div id="navdocs" class="hidden-phone"><div id="navdoc"><ul class="nav nav-list sidenav"><li class="nav-header">undefined</li><li><a href="#docs"><div class="icon-chevron-left pull-left"></div> Overview</a></li><li><a href="#members" type="button"><div class="icon-chevron-left pull-left"></div> Members</a></li><li><a href="#methods" type="button"><div class="icon-chevron-left pull-left"></div> Methods</a></li></ul></div><ul class="nav nav-list sidenav"><li class="nav-header"><img src="img/logo_impactplusplus_25.png"> Impact++</li><li><a href="#navTutorials" class="mainnavLink">Tutorials</a></li><li><a href="#navAbilities" class="mainnavLink">Abilities</a></li><li><a href="#navAbstractities" class="mainnavLink">Abstractities</a></li><li><a href="#navCore" class="mainnavLink">Core</a></li><li><a href="#navEntities" class="mainnavLink">Entities</a></li><li><a href="#navHelpers" class="mainnavLink">Helpers</a></li><li><a href="#navUi" class="mainnavLink">Ui</a></li></ul></div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<p class="muted">Impact++ created and maintained by <a href="http://twitter.com/collinhover" target="_blank">@collinhover</a> / <a href="http://collinhover.com/" target="_blank">collinhover.com</a></p>
<p class="muted">Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a></p>
</footer>
<script src="scripts/linenumber.js"> </script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="scripts/jquery-1.9.1.min.js"><\/script>')</script>
<script src="scripts/bootstrap.min.js"> </script>
<script src="scripts/main.js"> </script>
</body>
</html> | 22.163624 | 9,938 | 0.523764 |
f07eec804d533d3b03eb1442655922fd39f8fdb2 | 6,457 | py | Python | sstcam_sandbox/d190717_alpha/plot_wobble_animation_goldfish.py | watsonjj/CHECLabPySB | 91330d3a6f510a392f635bd7f4abd2f77871322c | [
"BSD-3-Clause"
] | null | null | null | sstcam_sandbox/d190717_alpha/plot_wobble_animation_goldfish.py | watsonjj/CHECLabPySB | 91330d3a6f510a392f635bd7f4abd2f77871322c | [
"BSD-3-Clause"
] | null | null | null | sstcam_sandbox/d190717_alpha/plot_wobble_animation_goldfish.py | watsonjj/CHECLabPySB | 91330d3a6f510a392f635bd7f4abd2f77871322c | [
"BSD-3-Clause"
] | 1 | 2021-03-30T09:46:56.000Z | 2021-03-30T09:46:56.000Z | from CHECLabPy.plotting.setup import Plotter
from CHECLabPy.plotting.camera import CameraImage
from CHECLabPy.utils.files import create_directory
from CHECLabPy.utils.mapping import get_ctapipe_camera_geometry
from sstcam_sandbox import get_plot, get_data
from os.path import join
from matplotlib import pyplot as plt
from tqdm import tqdm
import numpy as np
import pandas as pd
import warnings
from CHECOnsky.calib import obtain_cleaning_mask
from CHECLabPy.calib import TimeCalibrator
from mpl_toolkits.axes_grid1 import make_axes_locatable
from IPython import embed
def colorbar(mappable, label):
ax = mappable.axes
fig = ax.figure
divider = make_axes_locatable(ax)
_ = divider.append_axes("right", size="10%", pad=0.15)
cax = divider.append_axes("right", size="10%", pad=0.15)
return fig.colorbar(mappable, label=label, cax=cax, aspect=20)
class CameraMovie(Plotter):
def __init__(self, mapping, output_path):
super().__init__()
self.fig = plt.figure(figsize=(8, 3))
self.ax_goldfish = self.fig.add_axes([0, 0, 0.4, 1])
self.ax_image = self.fig.add_axes([0.4, 0, 0.4, 1])
self.ax_cb = self.fig.add_axes([0.68, 0, 0.15, 1])
self.ax_image.patch.set_alpha(0)
self.ax_cb.patch.set_alpha(0)
self.ax_cb.axis('off')
self.ci_image = CameraImage.from_mapping(mapping, ax=self.ax_image)
self.ci_image.add_colorbar(
"Pixel Amplitude (p.e.)", ax=self.ax_cb, pad=-0.5
)
self.ci_goldfish = CameraImage.from_mapping(mapping, ax=self.ax_goldfish)
self.output_path = output_path
self.source_point_image = None
self.source_point_goldfish = None
self.source_label_image = None
self.source_label_goldfish = None
self.alpha_line = None
self.timestamp = None
self.iframe = 0
def set_source_position(self, x_src, y_src):
offset = 0.004
if self.source_point_image is None:
self.source_point_image, = self.ax_image.plot(
x_src, y_src, 'x', c='red'
)
self.source_label_image = self.ax_image.text(
x_src+offset, y_src+offset, "Mrk421", color='red', size=10
)
else:
self.source_point_image.set_xdata(x_src)
self.source_point_image.set_ydata(y_src)
self.source_label_image.set_position((x_src+offset, y_src+offset))
if self.source_point_goldfish is None:
self.source_point_goldfish, = self.ax_goldfish.plot(
x_src, y_src, 'x', c='red'
)
self.source_label_goldfish = self.ax_goldfish.text(
x_src+offset, y_src+offset, "Mrk421", color='red', size=10
)
else:
self.source_point_goldfish.set_xdata(x_src)
self.source_point_goldfish.set_ydata(y_src)
self.source_label_goldfish.set_position((x_src+offset, y_src+offset))
def set_timestamp(self, timestamp):
timestamp_str = str(timestamp)
timestamp_len = len(timestamp_str)
missing = 29 - timestamp_len
timestamp_str += "0" * missing
if self.timestamp is None:
self.timestamp = self.fig.text(
0.4, -0.1, timestamp_str, horizontalalignment='center', size=12
)
else:
self.timestamp.set_text(timestamp_str)
def set_image(self, image, min_=None, max_=None):
self.ci_image.image = image
self.ci_image.set_limits_minmax(min_, max_)
def set_goldfish(self, slice, min_=None, max_=None):
self.ci_goldfish.image = slice
self.ci_goldfish.set_limits_minmax(min_, max_)
def set_alpha_line(self, cog_x, cog_y, psi):
y_min, y_max = self.ax_image.get_ylim()
x_min = cog_x - (cog_y - y_min) / np.tan(psi)
x_max = cog_x - (cog_y - y_max) / np.tan(psi)
if self.alpha_line is None:
self.alpha_line, = self.ax_image.plot(
[x_min, x_max], [y_min, y_max], ls="--", c='red'
)
else:
self.alpha_line.set_xdata([x_min, x_max])
self.alpha_line.set_ydata([y_min, y_max])
def save_frame(self):
path = self.output_path.format(self.iframe)
self.fig.savefig(path, bbox_inches='tight')
self.iframe += 1
def main():
path = get_data("d190717_alpha/wobble.h5")
with pd.HDFStore(path, mode='r') as store:
df = store['data'].loc[::4]
mapping = store['mapping']
with warnings.catch_warnings():
warnings.simplefilter('ignore', UserWarning)
mapping.metadata = store.get_storer('mapping').attrs.metadata
tc = TimeCalibrator()
geom = get_ctapipe_camera_geometry(mapping)
n_row = df.index.size
p_camera = CameraMovie(mapping, get_plot(
"d190717_alpha/wobble_animation_goldfish/frames/{:04d}.png"
))
for _, row in tqdm(df.iterrows(), total=n_row):
timestamp = row['timestamp']
iobs = row['iobs']
iev = row['iev']
x_src = row['x_src']
y_src = row['y_src']
dl1 = row['dl1'].values
time = row['dl1_pulse_time'].values
r1 = row['r1']
x_cog = row['x_cog']
y_cog = row['y_cog']
psi = row['psi']
p_camera.set_source_position(x_src, y_src)
n_pixels, n_samples = r1.shape
shifted = tc(r1)
mask = obtain_cleaning_mask(geom, dl1, time)
if not mask.any():
msg = f"No pixels survived cleaning for: RUN {iobs} IEV {iev}"
print(msg)
continue
# raise ValueError(msg)
dl1_ma = np.ma.masked_array(dl1, mask=~mask)
min_pixel = dl1_ma.argmin()
max_pixel = dl1_ma.argmax()
min_image = -4
max_image = 0.7 * dl1.max()
min_gf = shifted[max_pixel, :20].min()
max_gf = shifted[max_pixel].max() * 0.8
st = int(np.min(time[mask]) - 3)
et = int(np.max(time[mask]) + 6)
st = st if st > 0 else 0
et = et if et < n_samples else n_samples
# embed()
p_camera.set_image(dl1, min_image, max_image)
for t in range(st, et, 3):
slice_ = shifted[:, t]
p_camera.set_timestamp(timestamp + pd.Timedelta(f"{t}ns"))
p_camera.set_goldfish(slice_, min_gf, max_gf)
p_camera.save_frame()
if __name__ == '__main__':
main()
| 34.715054 | 81 | 0.61654 |
506f796893abec4cdab4cff8567e5238870b48e8 | 653 | html | HTML | validator/testdata/amp4ads_feature_tests/noscript.html | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 16,831 | 2015-10-07T13:08:48.000Z | 2022-03-31T12:52:40.000Z | validator/testdata/amp4ads_feature_tests/noscript.html | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 27,413 | 2015-10-07T12:41:00.000Z | 2022-03-31T23:41:02.000Z | validator/testdata/amp4ads_feature_tests/noscript.html | becca-bailey/amphtml | 7049bdef2b53aa55368a743c06f8ea3c3f54eaaa | [
"Apache-2.0"
] | 5,001 | 2015-10-07T12:42:26.000Z | 2022-03-31T08:39:56.000Z | <!--
Test Description:
This tests that <noscript> tags are disallowed in A4A, which differs from AMP.
-->
<!doctype html>
<html ⚡4ads>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1">
<style amp4ads-boilerplate>body{visibility:hidden}</style>
<script async src="https://cdn.ampproject.org/amp4ads-v0.js"></script>
</head>
<body>
<!-- Invalid -->
<noscript></noscript>
<!-- Invalid -->
<img src="https://example.com/">
<!-- Invalid -->
<noscript>
<img src="https://example.com/">
</noscript>
<noscript>
<video></video>
<audio></audio>
</noscript>
</body>
</html>
| 23.321429 | 80 | 0.633997 |
22ac1fc1d83e2c898e631dd48ae78eb654961113 | 70 | html | HTML | application/static/govuk_elements/views/snippets/buttons_button_disabled.html | crossgovernmentservices/people | 8f7bd50394d887e3ea89c95336fb129cdf168259 | [
"MIT"
] | null | null | null | application/static/govuk_elements/views/snippets/buttons_button_disabled.html | crossgovernmentservices/people | 8f7bd50394d887e3ea89c95336fb129cdf168259 | [
"MIT"
] | null | null | null | application/static/govuk_elements/views/snippets/buttons_button_disabled.html | crossgovernmentservices/people | 8f7bd50394d887e3ea89c95336fb129cdf168259 | [
"MIT"
] | null | null | null | <button class="button" disabled="disabled">Save and continue</button>
| 35 | 69 | 0.771429 |
0b981aa5022edff599d322472216d44e0175088a | 1,390 | swift | Swift | Instagram/CaptionViewController.swift | madelio/Instagram | f7e6bec3391ccd5b85079aea116b734c86fae03a | [
"Apache-2.0"
] | null | null | null | Instagram/CaptionViewController.swift | madelio/Instagram | f7e6bec3391ccd5b85079aea116b734c86fae03a | [
"Apache-2.0"
] | null | null | null | Instagram/CaptionViewController.swift | madelio/Instagram | f7e6bec3391ccd5b85079aea116b734c86fae03a | [
"Apache-2.0"
] | null | null | null | //
// CaptionViewController.swift
// Instagram
//
// Created by Madel Asistio on 3/14/17.
// Copyright © 2017 Madel Asistio. All rights reserved.
//
import UIKit
protocol CaptionDelegate: class {
func addCaption(_ caption: String)
}
class CaptionViewController: UIViewController {
@IBOutlet weak var captionField: UITextView!
var img: UIImage!
weak var delegate: CaptionDelegate?
override func viewDidLoad() {
super.viewDidLoad()
captionField!.layer.borderWidth = 1
captionField!.layer.borderColor = UIColor.black.cgColor
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func addCaption(_ sender: Any) {
print("caption added")
self.dismiss(animated: true, completion: nil)
self.delegate?.addCaption(captionField.text)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
| 25.272727 | 106 | 0.664748 |
26716a85df09f66dc7811d26c735065d9bdb6e07 | 1,127 | java | Java | src/main/java/info/itsthesky/disky3/core/skript/properties/channels/ChannelChannels.java | SkyCraft78/DiSky3 | cc1fcfc8f18061c030a47f4c9caf67abf9a27691 | [
"MIT"
] | 8 | 2021-09-10T21:29:15.000Z | 2022-01-07T00:06:56.000Z | src/main/java/info/itsthesky/disky3/core/skript/properties/channels/ChannelChannels.java | SkyCraft78/DiSky3 | cc1fcfc8f18061c030a47f4c9caf67abf9a27691 | [
"MIT"
] | 61 | 2021-09-19T10:51:56.000Z | 2021-12-30T02:27:36.000Z | src/main/java/info/itsthesky/disky3/core/skript/properties/channels/ChannelChannels.java | SkyCraft78/DiSky3 | cc1fcfc8f18061c030a47f4c9caf67abf9a27691 | [
"MIT"
] | 13 | 2021-09-19T20:02:32.000Z | 2022-02-21T05:30:01.000Z | package info.itsthesky.disky3.core.skript.properties.channels;
import info.itsthesky.disky3.api.skript.MultiplyPropertyExpression;
import net.dv8tion.jda.api.entities.Category;
import net.dv8tion.jda.api.entities.TextChannel;
import org.bukkit.event.Event;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ChannelChannels extends MultiplyPropertyExpression<Category, TextChannel> {
static {
register(
ChannelChannels.class,
TextChannel.class,
"[discord] channel[s]",
"category"
);
}
@Override
public @NotNull Class<? extends TextChannel> getReturnType() {
return TextChannel.class;
}
@Override
protected String getPropertyName() {
return "channels";
}
@Override
protected TextChannel[] convert(Category t) {
return t.getTextChannels().toArray(new TextChannel[0]);
}
@Override
public @NotNull String toString(@Nullable Event e, boolean debug) {
return "channels of " + getExpr().toString(e, debug);
}
}
| 26.833333 | 88 | 0.673469 |
5b1977b40d33283e3e459bac1004bf1a80a4ea99 | 5,176 | cpp | C++ | server/Epoll.cpp | thales-vogso/web-socket | 4bcbfed6a0191302682efb9b473efbcac65ed7f3 | [
"Apache-2.0"
] | null | null | null | server/Epoll.cpp | thales-vogso/web-socket | 4bcbfed6a0191302682efb9b473efbcac65ed7f3 | [
"Apache-2.0"
] | null | null | null | server/Epoll.cpp | thales-vogso/web-socket | 4bcbfed6a0191302682efb9b473efbcac65ed7f3 | [
"Apache-2.0"
] | null | null | null | /****************************************************************************
* @Copyright(c) 2015,Vogso
* @desc 服务端
* @date 2015-10-9
* @author minamoto
* @E-mail jiangtai@wushuang.me
* @file Epoll.cpp
******************************************************************************/
#include "Epoll.h"
#include <pthread.h>
#include <iostream>
#include <sstream>
#include <stdlib.h>
#include <stdio.h>
#include "Message.h"
using namespace std;
bool Epoll::serviceFlag = true;
std::map<int, Client*> Epoll::_clients;
Epoll::Epoll(int port)
{
_server = new Server();
_server->launch(port);
create();
}
Epoll::Epoll()
{
_server = new Server();
_server->launch();
create();
}
Epoll::~Epoll()
{
}
void Epoll::run()
{
wait();
}
bool Epoll::create(){
int fd = _server->getFileDescripto();
_evt.events = EPOLLIN | EPOLLET; //对读感兴趣,边沿触发
_epfd = epoll_create(EPOLL_SIZE); //创建一个epoll描述符,并将监听socket加入epoll
_evt.data.fd = fd;
int res = epoll_ctl(_epfd, EPOLL_CTL_ADD, fd, &_evt);
return res != -1;
}
bool Epoll::wait(){
while(serviceFlag)
{
int num = epoll_wait(_epfd, _events, EPOLL_SIZE, EPOLL_RUN_TIMEOUT);
for(int i = 0; i < num ; i++)
{
if(_events[i].data.fd == _server->getFileDescripto()) //新的连接到来,将连接添加到epoll中,并发送欢迎消息
{
Client* client = new Client();
client->connect(_server->getFileDescripto());
addClient(client);
_evt.data.fd = client->getFileDescripto();
epoll_ctl(_epfd, EPOLL_CTL_ADD, client->getFileDescripto(), &_evt);
std::cout << "Welcome to seChat! You ID is: Client " << client->getID() << std::endl;
}
else // 有消息需要读取
{
handle(_events[i].data.fd); //注意:这里并没有调用epoll_ctl重新设置socket的事件类型,但还是可以继续收到客户端发送过来的信息
}
}
}
_server->shut();
::close(_epfd);
return true;
}
bool Epoll::handle(int id){
Client* client = _clients[id];
if(client->setHeader()) {
std::stringstream msg;
msg << "Welcome to seChat! You ID is: Client " << client->getID() << "\r\n";
//client->send(msg.str());
return true;
}
std::string msg = client->receive();
//std::cout << "recv is \r\n" << msg << std::endl;
if(msg == "-1" || msg == "0"){
delClient(client);
}else{
checkMessage(client, msg);
}
return true;
}
void Epoll::checkMessage(Client* client, std::string msg){
Json::Value obj,oops,data,user,target;
Json::Reader reader;
Client* take;
if(!reader.parse(msg, obj)){
std::cout << "json error" << std::endl;
return;
}
user["id"] = client->getID();
user["name"] = client->getName();
std::cout << "code is " << obj["code"].asInt() << std::endl;
switch (obj["code"].asInt()){
case Message::cEnter:
oops["code"] = Message::sEnter;
client->setName(obj["data"].asString());
user["name"] = client->getName();
data["user"] = user;
data["list"] = getJsonClientList();
oops["data"] = data;
sendToAll(oops.toStyledString());
break;
case Message::cRename:
oops["code"] = Message::sRename;
data["user"] = user;
client->setName(obj["data"].asString());
target["id"] = client->getID();
target["name"] = client->getName();
data["target"] = target;
oops["data"] = data;
sendToAll(oops.toStyledString());
break;
case Message::cChat:
oops["code"] = Message::sChat;
data["user"] = user;
data["content"] = obj["data"]["content"].asString();
oops["data"] = data;
sendToAll(oops.toStyledString());
break;
case Message::cWhisper:
take = getClientByID(atoi(obj["data"]["id"].asString().c_str()));
if(!take) return;
oops["code"] = Message::sWhisper;
data["user"] = user;
target["id"] = take->getID();
target["name"] = take->getName();
data["target"] = target;
data["content"] = obj["data"]["content"].asString();
oops["data"] = data;
take->send(oops.toStyledString());
client->send(oops.toStyledString());
break;
default:
break;
};
}
void Epoll::addClient(Client* client)
{
_clients[client->getFileDescripto()] = client;
std::cout<<"Now "<<_clients.size()<<" users..";
std::cout<<"New User: "<<client->getID()<<" ip :"<<client->getAddress()<<" "<<client->getPort()<<std::endl;
}
void Epoll::delClient(Client* client)
{
Json::Value oops,data,user;
user["id"] = client->getID();
user["name"] = client->getName();
_clients.erase(_clients.find(client->getFileDescripto()));
oops["code"] = Message::sLeave;
data["user"] = user;
data["list"] = getJsonClientList();
oops["data"] = data;
sendToAll(oops.toStyledString());
}
void Epoll::sendToAll(std::string msg){
for(std::map<int, Client*>::iterator it = _clients.begin();it != _clients.end(); it++){
Client* client = it->second;
client->send(msg);
}
}
Client* Epoll::getClientByID(int id){
for(std::map<int, Client*>::iterator it = _clients.begin();it != _clients.end(); it++){
Client* client = it->second;
if(id == client->getID()){
return client;
}
}
return NULL;
}
Json::Value Epoll::getJsonClientList(){
Json::Value list;
for(std::map<int, Client*>::iterator it = _clients.begin();it != _clients.end(); it++){
Client* client = it->second;
Json::Value single;
single["id"] = client->getID();
single["name"] = client->getName();
list.append(single);
}
return list;
}
| 25.623762 | 108 | 0.61051 |
04a99e53aa28d2ae56e9afa1bffc25ee9e1c13a5 | 2,929 | java | Java | admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/persistence/validation/GlobalPropertyValidator.java | hyysguyang/BroadleafCommerce | 6cde6aa865820c4065ad48ec4d3cba1ca7cdb55a | [
"Apache-2.0"
] | 1 | 2015-10-11T07:51:09.000Z | 2015-10-11T07:51:09.000Z | admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/persistence/validation/GlobalPropertyValidator.java | hyysguyang/BroadleafCommerce | 6cde6aa865820c4065ad48ec4d3cba1ca7cdb55a | [
"Apache-2.0"
] | 11 | 2020-06-15T21:05:08.000Z | 2022-02-01T01:01:29.000Z | admin/broadleaf-open-admin-platform/src/main/java/org/broadleafcommerce/openadmin/server/service/persistence/validation/GlobalPropertyValidator.java | roclesy1983/s4DzKNuwXTrivXXiQWnklw | 9b131a1a3c09e67e7841fdf85a715c5e8de0b4b5 | [
"Apache-2.0"
] | 2 | 2016-03-09T18:30:15.000Z | 2016-06-03T10:03:03.000Z | /*
* #%L
* BroadleafCommerce Open Admin Platform
* %%
* Copyright (C) 2009 - 2013 Broadleaf Commerce
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package org.broadleafcommerce.openadmin.server.service.persistence.validation;
import org.broadleafcommerce.common.presentation.ValidationConfiguration;
import org.broadleafcommerce.openadmin.dto.BasicFieldMetadata;
import org.broadleafcommerce.openadmin.dto.Entity;
import org.broadleafcommerce.openadmin.dto.FieldMetadata;
import org.broadleafcommerce.openadmin.server.service.persistence.module.BasicPersistenceModule;
import java.io.Serializable;
import java.util.Map;
/**
* Analagous to {@link PropertyValidator} except this does not attempt to use any {@link ValidationConfiguration} from an
* {@link AdminPresentation} annotation. These global validators will execute on every field of every entity that is
* attempted to be populated by the admin
*
* @author Phillip Verheyden (phillipuniverse)
* @see {@link PropertyValidator}
* @see {@link EntityValidatorService#getGlobalEntityValidators()}
* @see {@link BasicPersistenceModule#createPopulatedInstance(Serializable, Entity, Map, Boolean)}
*/
public interface GlobalPropertyValidator {
/**
* Validates a property for an entity
*
* @param entity Entity DTO of the entity attempting to save
* @param instance actual object representation of <b>entity</b>. This can be cast to entity interfaces (like Sku or
* Product)
* @param entityFieldMetadata complete field metadata for all properties in <b>entity</b>
* @param propertyMetadata {@link BasicFieldMetadata} corresponding to the property that is being valid
* @param propertyName the property name of the value attempting to be saved (could be a sub-entity obtained via dot
* notation like 'defaultSku.name')
* @param value the value attempted to be saved
* @return <b>true</b> if this passes validation, <b>false</b> otherwise.
*/
public PropertyValidationResult validate(Entity entity,
Serializable instance,
Map<String, FieldMetadata> entityFieldMetadata,
BasicFieldMetadata propertyMetadata,
String propertyName,
String value);
}
| 45.061538 | 121 | 0.705019 |
ece5993b078cd53c77ff1286bc4e16eda8e30e25 | 1,463 | dart | Dart | lib/data/remote/model/list_restoran_model.dart | mazhuda/Restoran | b369608aa7268aedfc58f618419242e8a3112c56 | [
"BSD-3-Clause"
] | null | null | null | lib/data/remote/model/list_restoran_model.dart | mazhuda/Restoran | b369608aa7268aedfc58f618419242e8a3112c56 | [
"BSD-3-Clause"
] | null | null | null | lib/data/remote/model/list_restoran_model.dart | mazhuda/Restoran | b369608aa7268aedfc58f618419242e8a3112c56 | [
"BSD-3-Clause"
] | null | null | null | import 'package:equatable/equatable.dart';
class RestoranListModel extends Equatable {
final bool error;
final String message;
final int count;
final int found;
final List<RestoranModel> restorans;
RestoranListModel(
{this.restorans, this.error, this.message, this.count, this.found});
@override
List<Object> get props => [restorans, error, message, count, found];
factory RestoranListModel.fromJson(Map<String, dynamic> json) =>
RestoranListModel(
error: json['error'],
message: json['message'] ?? "",
count: json['count'] ?? 0,
found: json['found'] ?? 0,
restorans: List<RestoranModel>.from(json['restaurants']
.map((restoran) => RestoranModel.fromJson(restoran))),
);
}
class RestoranModel extends Equatable {
final String id;
final String name;
final String description;
final String pictureId;
final String city;
final double rating;
RestoranModel(
{this.id,
this.name,
this.description,
this.pictureId,
this.city,
this.rating});
@override
List<Object> get props => [id, name, description, pictureId, city, rating];
factory RestoranModel.fromJson(Map<String, dynamic> json) => RestoranModel(
id: json['id'],
name: json['name'],
description: json['description'],
pictureId: json['pictureId'],
city: json['city'],
rating: json['rating'].toDouble(),
);
}
| 26.6 | 77 | 0.641832 |
e99fb22f36b65119c992b49ba44c4551c5ce2ecd | 5,612 | go | Go | service/ram/api_op_AcceptResourceShareInvitation.go | alrs/aws-sdk-go-v2 | 6029e75f2dda11b1846bc045f5bf4e6729a0fb06 | [
"Apache-2.0"
] | null | null | null | service/ram/api_op_AcceptResourceShareInvitation.go | alrs/aws-sdk-go-v2 | 6029e75f2dda11b1846bc045f5bf4e6729a0fb06 | [
"Apache-2.0"
] | 1 | 2020-07-10T17:27:38.000Z | 2020-07-10T17:27:38.000Z | service/ram/api_op_AcceptResourceShareInvitation.go | alrs/aws-sdk-go-v2 | 6029e75f2dda11b1846bc045f5bf4e6729a0fb06 | [
"Apache-2.0"
] | null | null | null | // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ram
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awsutil"
"github.com/aws/aws-sdk-go-v2/private/protocol"
)
type AcceptResourceShareInvitationInput struct {
_ struct{} `type:"structure"`
// A unique, case-sensitive identifier that you provide to ensure the idempotency
// of the request.
ClientToken *string `locationName:"clientToken" type:"string"`
// The Amazon Resource Name (ARN) of the invitation.
//
// ResourceShareInvitationArn is a required field
ResourceShareInvitationArn *string `locationName:"resourceShareInvitationArn" type:"string" required:"true"`
}
// String returns the string representation
func (s AcceptResourceShareInvitationInput) String() string {
return awsutil.Prettify(s)
}
// Validate inspects the fields of the type to determine if they are valid.
func (s *AcceptResourceShareInvitationInput) Validate() error {
invalidParams := aws.ErrInvalidParams{Context: "AcceptResourceShareInvitationInput"}
if s.ResourceShareInvitationArn == nil {
invalidParams.Add(aws.NewErrParamRequired("ResourceShareInvitationArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
}
return nil
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s AcceptResourceShareInvitationInput) MarshalFields(e protocol.FieldEncoder) error {
e.SetValue(protocol.HeaderTarget, "Content-Type", protocol.StringValue("application/json"), protocol.Metadata{})
if s.ClientToken != nil {
v := *s.ClientToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "clientToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ResourceShareInvitationArn != nil {
v := *s.ResourceShareInvitationArn
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "resourceShareInvitationArn", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
return nil
}
type AcceptResourceShareInvitationOutput struct {
_ struct{} `type:"structure"`
// A unique, case-sensitive identifier that you provide to ensure the idempotency
// of the request.
ClientToken *string `locationName:"clientToken" type:"string"`
// Information about the invitation.
ResourceShareInvitation *ResourceShareInvitation `locationName:"resourceShareInvitation" type:"structure"`
}
// String returns the string representation
func (s AcceptResourceShareInvitationOutput) String() string {
return awsutil.Prettify(s)
}
// MarshalFields encodes the AWS API shape using the passed in protocol encoder.
func (s AcceptResourceShareInvitationOutput) MarshalFields(e protocol.FieldEncoder) error {
if s.ClientToken != nil {
v := *s.ClientToken
metadata := protocol.Metadata{}
e.SetValue(protocol.BodyTarget, "clientToken", protocol.QuotedValue{ValueMarshaler: protocol.StringValue(v)}, metadata)
}
if s.ResourceShareInvitation != nil {
v := s.ResourceShareInvitation
metadata := protocol.Metadata{}
e.SetFields(protocol.BodyTarget, "resourceShareInvitation", v, metadata)
}
return nil
}
const opAcceptResourceShareInvitation = "AcceptResourceShareInvitation"
// AcceptResourceShareInvitationRequest returns a request value for making API operation for
// AWS Resource Access Manager.
//
// Accepts an invitation to a resource share from another AWS account.
//
// // Example sending a request using AcceptResourceShareInvitationRequest.
// req := client.AcceptResourceShareInvitationRequest(params)
// resp, err := req.Send(context.TODO())
// if err == nil {
// fmt.Println(resp)
// }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/ram-2018-01-04/AcceptResourceShareInvitation
func (c *Client) AcceptResourceShareInvitationRequest(input *AcceptResourceShareInvitationInput) AcceptResourceShareInvitationRequest {
op := &aws.Operation{
Name: opAcceptResourceShareInvitation,
HTTPMethod: "POST",
HTTPPath: "/acceptresourceshareinvitation",
}
if input == nil {
input = &AcceptResourceShareInvitationInput{}
}
req := c.newRequest(op, input, &AcceptResourceShareInvitationOutput{})
return AcceptResourceShareInvitationRequest{Request: req, Input: input, Copy: c.AcceptResourceShareInvitationRequest}
}
// AcceptResourceShareInvitationRequest is the request type for the
// AcceptResourceShareInvitation API operation.
type AcceptResourceShareInvitationRequest struct {
*aws.Request
Input *AcceptResourceShareInvitationInput
Copy func(*AcceptResourceShareInvitationInput) AcceptResourceShareInvitationRequest
}
// Send marshals and sends the AcceptResourceShareInvitation API request.
func (r AcceptResourceShareInvitationRequest) Send(ctx context.Context) (*AcceptResourceShareInvitationResponse, error) {
r.Request.SetContext(ctx)
err := r.Request.Send()
if err != nil {
return nil, err
}
resp := &AcceptResourceShareInvitationResponse{
AcceptResourceShareInvitationOutput: r.Request.Data.(*AcceptResourceShareInvitationOutput),
response: &aws.Response{Request: r.Request},
}
return resp, nil
}
// AcceptResourceShareInvitationResponse is the response type for the
// AcceptResourceShareInvitation API operation.
type AcceptResourceShareInvitationResponse struct {
*AcceptResourceShareInvitationOutput
response *aws.Response
}
// SDKResponseMetdata returns the response metadata for the
// AcceptResourceShareInvitation request.
func (r *AcceptResourceShareInvitationResponse) SDKResponseMetdata() *aws.Response {
return r.response
}
| 34.012121 | 136 | 0.779579 |
90f9c03634989b6e979817f410dcaba2efb5d028 | 286 | go | Go | internal/mmf/harness.go | rmb938/open-match | 6dd23ff6ada9bb7ac23a248c22fa81b2982d8f2d | [
"Apache-2.0"
] | null | null | null | internal/mmf/harness.go | rmb938/open-match | 6dd23ff6ada9bb7ac23a248c22fa81b2982d8f2d | [
"Apache-2.0"
] | null | null | null | internal/mmf/harness.go | rmb938/open-match | 6dd23ff6ada9bb7ac23a248c22fa81b2982d8f2d | [
"Apache-2.0"
] | null | null | null | package mmf
import (
"log"
api "github.com/GoogleCloudPlatform/open-match/internal/pb"
"github.com/spf13/viper"
)
func Run(fnArgs *api.Arguments, cfg *viper.Viper, mmlogic api.MmLogicClient) error {
log.Printf("Function called!\n")
log.Printf("args: %v", &fnArgs)
return nil
}
| 19.066667 | 84 | 0.723776 |
6948ac55363a9390dcf684c2f0575c8e6ac6b8cf | 1,945 | swift | Swift | Sources/swift-format/Frontend/ConfigurationLoader.swift | caldrian/swift-format | 3e924a83fc24e81c5d7fdd5f93da3fedb49872b0 | [
"Apache-2.0"
] | 1,538 | 2019-07-09T23:44:46.000Z | 2022-03-31T13:10:49.000Z | Sources/swift-format/Frontend/ConfigurationLoader.swift | caldrian/swift-format | 3e924a83fc24e81c5d7fdd5f93da3fedb49872b0 | [
"Apache-2.0"
] | 110 | 2019-07-22T15:30:36.000Z | 2022-03-22T20:33:08.000Z | Sources/swift-format/Frontend/ConfigurationLoader.swift | caldrian/swift-format | 3e924a83fc24e81c5d7fdd5f93da3fedb49872b0 | [
"Apache-2.0"
] | 136 | 2019-07-10T21:21:05.000Z | 2022-03-26T10:47:42.000Z | //===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
import Foundation
import SwiftFormatConfiguration
/// Loads formatter configurations, caching them in memory so that multiple operations in the same
/// directory do not repeatedly hit the file system.
struct ConfigurationLoader {
/// The cache of previously loaded configurations.
private var cache = [String: Configuration]()
/// Returns the configuration found by searching in the directory (and ancestor directories)
/// containing the given `.swift` source file.
///
/// If no configuration file was found during the search, this method returns nil.
///
/// - Throws: If a configuration file was found but an error occurred loading it.
mutating func configuration(forSwiftFileAt url: URL) throws -> Configuration? {
guard let configurationFileURL = Configuration.url(forConfigurationFileApplyingTo: url)
else {
return nil
}
return try configuration(at: configurationFileURL)
}
/// Returns the configuration associated with the configuration file at the given URL.
///
/// - Throws: If an error occurred loading the configuration.
mutating func configuration(at url: URL) throws -> Configuration {
let cacheKey = url.absoluteURL.standardized.path
if let cachedConfiguration = cache[cacheKey] {
return cachedConfiguration
}
let configuration = try Configuration(contentsOf: url)
cache[cacheKey] = configuration
return configuration
}
}
| 38.9 | 98 | 0.680206 |
1362244c879c83046adc9cf7d50281bd250b38e9 | 446 | swift | Swift | Cenima/Sources/Cenima/Model/Popular+CoreDataProperties.swift | iAppStore/My-Apps-Info | 7b0ed71d60e065012d81eb333f4a6a1767153b35 | [
"MIT"
] | 14 | 2020-12-09T08:53:39.000Z | 2021-12-07T09:15:44.000Z | Cenima/Sources/Cenima/Model/Popular+CoreDataProperties.swift | iAppStore/My-Apps-Info | 7b0ed71d60e065012d81eb333f4a6a1767153b35 | [
"MIT"
] | null | null | null | Cenima/Sources/Cenima/Model/Popular+CoreDataProperties.swift | iAppStore/My-Apps-Info | 7b0ed71d60e065012d81eb333f4a6a1767153b35 | [
"MIT"
] | 8 | 2020-12-10T05:59:26.000Z | 2022-01-03T07:49:21.000Z | //
// Popular+CoreDataProperties.swift
// Cenima
//
// Created by mohammad mugish on 21/02/21.
//
//
import Foundation
import CoreData
extension Popular {
@nonobjc public class func fetchRequest() -> NSFetchRequest<Popular> {
return NSFetchRequest<Popular>(entityName: "Popular")
}
@NSManaged public var popularMovie: [CustomObject]?
@NSManaged public var timeStamp: Date?
}
extension Popular : Identifiable {
}
| 17.153846 | 74 | 0.701794 |
2410ac683da3488047d17c3bb0d0345bd9859e40 | 2,037 | lua | Lua | buffer.lua | thenumbernine/lua-gl | 64b4846971f1dfd40f9ca3dc938dae5806d96f78 | [
"MIT"
] | 5 | 2016-05-10T06:42:56.000Z | 2021-11-25T12:44:30.000Z | buffer.lua | thenumbernine/lua-gl | 64b4846971f1dfd40f9ca3dc938dae5806d96f78 | [
"MIT"
] | null | null | null | buffer.lua | thenumbernine/lua-gl | 64b4846971f1dfd40f9ca3dc938dae5806d96f78 | [
"MIT"
] | 1 | 2017-06-22T01:27:37.000Z | 2017-06-22T01:27:37.000Z | local ffi = require 'ffi'
local gl = require 'gl'
local class = require 'ext.class'
local table = require 'ext.table'
ffi.cdef[[
typedef struct gl_buffer_ptr_t {
GLuint ptr[1];
} gl_buffer_ptr_t;
]]
local gl_buffer_ptr_t = ffi.metatype('gl_buffer_ptr_t', {
__gc = function(buffer)
if buffer.ptr[0] ~= 0 then
gl.glDeleteBuffers(1, buffer.ptr)
buffer.ptr[0] = 0
end
end,
})
local Buffer = class()
--[[
args:
size
data (optional)
usage
my js version has dim and count instead of size, then just size = dim * count
this makes it more compatible with GLProgram:setAttr(buffer)
instead of only GLProgram:setAttr(attr)
--]]
function Buffer:init(args)
self.idPtr = gl_buffer_ptr_t()
gl.glGenBuffers(1, self.idPtr.ptr)
self.id = self.idPtr.ptr[0]
assert(args, "expected args")
if args.data then
self:setData(args)
elseif args.size then
local empty = ffi.new('uint8_t[?]', args.size)
self:setData(table(args, {data=empty}))
end
end
function Buffer:bind()
gl.glBindBuffer(self.target, self.id)
end
function Buffer:unbind()
gl.glBindBuffer(self.target, 0)
end
--[[
args:
size
data
usage
my js version has 'keep' for saving args.data ... I'll just make it default
--]]
function Buffer:setData(args)
local size = args.size
local data = args.data
if type(data) == 'table' then
local n = #data
size = size or n * ffi.sizeof'float'
local numFloats = math.floor(size / ffi.sizeof'float')
local cdata = ffi.new('float[?]', numFloats)
for i=1,math.min(numFloats, n) do
cdata[i-1] = data[i]
end
data = cdata
end
-- mind you, this is saving the cdata, even if you :setData() with Lua data ...
self.data = data
self.size = size
self.usage = args.usage or gl.GL_STATIC_DRAW
self:bind()
gl.glBufferData(self.target, self.size, self.data, self.usage)
self:unbind()
end
function Buffer:updateData(offset, size, data)
offset = offset or 0
size = size or self.size
data = data or self.data
self:bind()
gl.glBufferSubData(self.target, offset, size, data)
self:unbind()
end
return Buffer
| 21.903226 | 81 | 0.702995 |
4059b03f2eaf877ebc090e86ae6968097b4a0513 | 2,540 | py | Python | matcher/conll_load.py | yama-yuki/skeletal-amr | 783e61a7e67584444a8468fc62e45e505b4d6dcb | [
"MIT"
] | null | null | null | matcher/conll_load.py | yama-yuki/skeletal-amr | 783e61a7e67584444a8468fc62e45e505b4d6dcb | [
"MIT"
] | null | null | null | matcher/conll_load.py | yama-yuki/skeletal-amr | 783e61a7e67584444a8468fc62e45e505b4d6dcb | [
"MIT"
] | null | null | null | from spacy.tokens import Doc
def convert(cols, matched_token_idx):
#temp_path = os.path.join(this_dir,'temp.conllu')
matched_i = [list(map(lambda x: str(x+1), matched)) for matched in matched_token_idx]
for matched in matched_i:
cols = change_head(matched, cols)
return cols
def change_head(matched, cols):
new_cols = []
comp,be = matched[0],matched[1]
dep_comp = cols[int(comp)-1][7]
dep_be = cols[int(be)-1][7]
head_comp = cols[int(comp)-1][6]
for j,col in enumerate(cols):
col_i, head_i, dep = str(j+1), col[6], col[7]
if head_i == comp:
col[6] = be
if col_i == be:
col[6], col[7] = head_comp, dep_comp
elif col_i == comp:
col[6], col[7] = be, dep_be
new_cols.append(col)
return new_cols
def conll_list_to_doc(vocab, conll):
## conll_list for a single sentence
## [['12', '31', '31', 'NUM', 'CD', 'NumType=Card', '13', 'nummod', '_', 'start_char=242|end_char=244'], ['13', 'October', 'October', 'PROPN', 'NNP', 'Number=Sing', '10', 'obl', '_', 'start_char=245|end_char=252']]
words, spaces, tags, poses, morphs, lemmas = [], [], [], [], [], []
heads, deps = [], []
for i in range(len(conll)):
line = conll[i]
parts = line
id_, word, lemma, pos, tag, morph, head, dep, _, misc = parts
if "." in id_ or "-" in id_:
continue
if "SpaceAfter=No" in misc:
spaces.append(False)
else:
spaces.append(True)
id_ = int(id_) - 1
head = (int(head) - 1) if head not in ("0", "_") else id_
tag = pos if tag == "_" else tag
morph = morph if morph != "_" else ""
dep = "ROOT" if dep == "root" else dep
words.append(word)
lemmas.append(lemma)
poses.append(pos)
tags.append(tag)
morphs.append(morph)
heads.append(head)
deps.append(dep)
doc = Doc(vocab, words=words, spaces=spaces)
for i in range(len(doc)):
doc[i].tag_ = tags[i]
doc[i].pos_ = poses[i]
doc[i].dep_ = deps[i]
doc[i].lemma_ = lemmas[i]
doc[i].head = doc[heads[i]]
doc.is_parsed = True
doc.is_tagged = True
return doc
'''
##legacy
def process(doc):
text = str(doc)
doc.is_parsed = True
doc.is_tagged = True
token_list = [token.text for token in doc]
return text, doc, token_list
''' | 29.195402 | 219 | 0.533465 |
32699dc274b29bb35364be6c23142dc4ea8b876f | 214 | dart | Dart | lib/data/appstate/DetailPageState.dart | jims57/seal_note | af2134805a6b04ad0b523642c3d9407979bb9bea | [
"Apache-2.0"
] | 1 | 2021-02-03T03:25:06.000Z | 2021-02-03T03:25:06.000Z | lib/data/appstate/DetailPageState.dart | jims57/seal_note | af2134805a6b04ad0b523642c3d9407979bb9bea | [
"Apache-2.0"
] | 651 | 2020-09-25T03:12:54.000Z | 2022-03-29T03:44:03.000Z | lib/data/appstate/DetailPageState.dart | jims57/seal_note | af2134805a6b04ad0b523642c3d9407979bb9bea | [
"Apache-2.0"
] | null | null | null | import 'package:flutter/cupertino.dart';
import 'package:seal_note/data/appstate/GlobalState.dart';
class DetailPageChangeNotifier extends ChangeNotifier {
void refreshDetailPage() {
notifyListeners();
}
} | 26.75 | 58 | 0.785047 |
1dbbe0fe66da8033abcca59a0ac00c032a7e7d17 | 232 | swift | Swift | Common/VT100/TerminalInputProtocol.swift | bzxy/NewTerm | 2fe50ec142117a5586a7c76043d2b37defed18b3 | [
"Apache-2.0"
] | 242 | 2015-02-01T10:30:45.000Z | 2022-03-28T20:33:42.000Z | Common/VT100/TerminalInputProtocol.swift | bzxy/NewTerm | 2fe50ec142117a5586a7c76043d2b37defed18b3 | [
"Apache-2.0"
] | 62 | 2015-01-06T06:21:16.000Z | 2022-03-24T10:09:50.000Z | Common/VT100/TerminalInputProtocol.swift | bzxy/NewTerm | 2fe50ec142117a5586a7c76043d2b37defed18b3 | [
"Apache-2.0"
] | 61 | 2015-01-06T08:50:12.000Z | 2021-11-23T23:47:04.000Z | //
// TerminalInputProtocol.swift
// NewTerm Common
//
// Created by Adam Demasi on 20/6/19.
//
public protocol TerminalInputProtocol: AnyObject {
func receiveKeyboardInput(data: Data)
var applicationCursor: Bool { get }
}
| 15.466667 | 50 | 0.724138 |
cf72c17847b09de66f3c0fb820f14a38bb0e740f | 164 | sql | SQL | Homework/DBFundamentals/Databases Basics/07.Subqueries and JOINs/Exercises/Exercises/p16.CountriesWithoutAnyMountains.sql | GitHarr/SoftUni | 1c51efc70a97a1be17e2590a9243d01a9be343aa | [
"MIT"
] | null | null | null | Homework/DBFundamentals/Databases Basics/07.Subqueries and JOINs/Exercises/Exercises/p16.CountriesWithoutAnyMountains.sql | GitHarr/SoftUni | 1c51efc70a97a1be17e2590a9243d01a9be343aa | [
"MIT"
] | null | null | null | Homework/DBFundamentals/Databases Basics/07.Subqueries and JOINs/Exercises/Exercises/p16.CountriesWithoutAnyMountains.sql | GitHarr/SoftUni | 1c51efc70a97a1be17e2590a9243d01a9be343aa | [
"MIT"
] | null | null | null | SELECT COUNT(c.CountryCode) AS [CountryCode]
FROM Countries AS c
LEFT OUTER JOIN MountainsCountries AS m ON c.CountryCode = m.CountryCode
WHERE m.MountainId IS NULL | 41 | 72 | 0.817073 |
af7e8bb6a6d8ed0fba53d5a05efd6582e8770e8a | 545 | rb | Ruby | lib/yogo/example/dynamic/project_remix.rb | yogo/yogo-project | 3acfcec8701a74170661f4764e8993e77de05824 | [
"MIT"
] | null | null | null | lib/yogo/example/dynamic/project_remix.rb | yogo/yogo-project | 3acfcec8701a74170661f4764e8993e77de05824 | [
"MIT"
] | null | null | null | lib/yogo/example/dynamic/project_remix.rb | yogo/yogo-project | 3acfcec8701a74170661f4764e8993e77de05824 | [
"MIT"
] | null | null | null | require 'yogo/datamapper/dynamic/stored/configuration'
class ProjectRemix
include ::DataMapper::Resource
property :id, UUID, :key => true, :default => lambda { Yogo::Configuration.random_uuid }
property :name, String, :required => true
without_auto_validations do
remix n, 'Yogo::DataMapper::Dynamic::Stored::Configuration', :as => :model_configurations, :model => 'ProjectModelConfiguration'
enhance :configuration do
property :project_id, UUID
end
end
end # ProjectRemix
| 32.058824 | 132 | 0.678899 |
0214b85ffa3bc2fb5c8da24a2b2bd326fca47888 | 200 | sql | SQL | sql/_01_object/_05_serial/_002_with_option/cases/1005.sql | Zhaojia2019/cubrid-testcases | 475a828e4d7cf74aaf2611fcf791a6028ddd107d | [
"BSD-3-Clause"
] | 9 | 2016-03-24T09:51:52.000Z | 2022-03-23T10:49:47.000Z | sql/_01_object/_05_serial/_002_with_option/cases/1005.sql | Zhaojia2019/cubrid-testcases | 475a828e4d7cf74aaf2611fcf791a6028ddd107d | [
"BSD-3-Clause"
] | 173 | 2016-04-13T01:16:54.000Z | 2022-03-16T07:50:58.000Z | sql/_01_object/_05_serial/_002_with_option/cases/1005.sql | Zhaojia2019/cubrid-testcases | 475a828e4d7cf74aaf2611fcf791a6028ddd107d | [
"BSD-3-Clause"
] | 38 | 2016-03-24T17:10:31.000Z | 2021-10-30T22:55:45.000Z | -- [er]create a serial with an constraint error of start with keyword
CREATE SERIAL ddl_0001_serial
INCREMENT BY -1
MAXVALUE 10000000
START WITH -2
MINVALUE -1000;
DROP SERIAL ddl_0001_serial; | 15.384615 | 70 | 0.78 |
59a35180424946a5bf47a24bb1393df420006317 | 2,180 | cpp | C++ | src/actflame.cpp | PegasusEpsilon/Barony | 6311f7e5da4835eaea65a95b5cc258409bb0dfa4 | [
"FTL",
"Zlib",
"MIT"
] | 373 | 2016-06-28T06:56:46.000Z | 2022-03-23T02:32:54.000Z | src/actflame.cpp | PegasusEpsilon/Barony | 6311f7e5da4835eaea65a95b5cc258409bb0dfa4 | [
"FTL",
"Zlib",
"MIT"
] | 361 | 2016-07-06T19:09:25.000Z | 2022-03-26T14:14:19.000Z | src/actflame.cpp | PegasusEpsilon/Barony | 6311f7e5da4835eaea65a95b5cc258409bb0dfa4 | [
"FTL",
"Zlib",
"MIT"
] | 129 | 2016-06-29T09:02:49.000Z | 2022-01-23T09:56:06.000Z | /*-------------------------------------------------------------------------------
BARONY
File: actflame.cpp
Desc: behavior function for flame particles
Copyright 2013-2016 (c) Turning Wheel LLC, all rights reserved.
See LICENSE for details.
-------------------------------------------------------------------------------*/
#include "main.hpp"
#include "game.hpp"
#include "collision.hpp"
#include "entity.hpp"
/*-------------------------------------------------------------------------------
act*
The following function describes an entity behavior. The function
takes a pointer to the entity that uses it as an argument.
-------------------------------------------------------------------------------*/
#define FLAME_LIFE my->skill[0]
#define FLAME_VELX my->vel_x
#define FLAME_VELY my->vel_y
#define FLAME_VELZ my->vel_z
void actFlame(Entity* my)
{
if ( FLAME_LIFE <= 0 )
{
list_RemoveNode(my->mynode);
return;
}
my->x += FLAME_VELX;
my->y += FLAME_VELY;
my->z += FLAME_VELZ;
FLAME_LIFE--;
}
/*-------------------------------------------------------------------------------
spawnFlame
Spawns a flame particle for the entity supplied as an argument
-------------------------------------------------------------------------------*/
Entity* spawnFlame(Entity* parentent, Sint32 sprite )
{
Entity* entity;
double vel;
entity = newEntity(sprite, 1, map.entities, nullptr); // flame particle
if ( intro )
{
entity->setUID(0);
}
entity->x = parentent->x;
entity->y = parentent->y;
entity->z = parentent->z;
entity->sizex = 6;
entity->sizey = 6;
entity->yaw = (rand() % 360) * PI / 180.0;
entity->pitch = (rand() % 360) * PI / 180.0;
entity->roll = (rand() % 360) * PI / 180.0;
vel = (rand() % 10) / 10.0;
entity->vel_x = vel * cos(entity->yaw) * .1;
entity->vel_y = vel * sin(entity->yaw) * .1;
entity->vel_z = -.25;
entity->skill[0] = 5;
entity->flags[NOUPDATE] = true;
entity->flags[PASSABLE] = true;
entity->flags[SPRITE] = true;
entity->flags[BRIGHT] = true;
entity->flags[UNCLICKABLE] = true;
entity->behavior = &actFlame;
if ( multiplayer != CLIENT )
{
entity_uids--;
}
entity->setUID(-3);
return entity;
}
| 24.494382 | 81 | 0.516514 |
0a9ab7c8b7643ed44baaa2bc48ffa11bb606ffa9 | 4,344 | go | Go | logger.go | khorevaa/logos | 4b8d8ec92db34ee5aeea5b955820cc5abd9d3415 | [
"MIT"
] | 3 | 2021-02-01T15:01:54.000Z | 2021-11-08T10:45:37.000Z | logger.go | khorevaa/logos | 4b8d8ec92db34ee5aeea5b955820cc5abd9d3415 | [
"MIT"
] | 1 | 2021-08-12T08:03:35.000Z | 2021-08-12T08:03:35.000Z | logger.go | khorevaa/logos | 4b8d8ec92db34ee5aeea5b955820cc5abd9d3415 | [
"MIT"
] | null | null | null | package logos
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
"sync"
"sync/atomic"
"time"
)
var _ Logger = (*warpLogger)(nil)
var _ SugaredLogger = (*warpLogger)(nil)
func newLogger(name string, logger *zap.Logger) *warpLogger {
l := &warpLogger{
Name: name,
defLogger: logger,
mu: sync.RWMutex{},
emitLevel: InfoLevel,
}
l.SetUsedAt(time.Now())
return l
}
type warpLogger struct {
Name string
defLogger *zap.Logger
sugaredLogger *zap.SugaredLogger
mu sync.RWMutex
emitLevel zapcore.Level
_usedAt uint32 // atomic
_locked uint32
_lockWait sync.WaitGroup
}
func (l *warpLogger) Sugar() SugaredLogger {
l.initSugaredLogger()
return l
}
func (l *warpLogger) Debug(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Debug(msg, fields...)
}
func (l *warpLogger) Info(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Info(msg, fields...)
}
func (l *warpLogger) Warn(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Warn(msg, fields...)
}
func (l *warpLogger) Error(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Error(msg, fields...)
}
func (l *warpLogger) Fatal(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Fatal(msg, fields...)
}
func (l *warpLogger) Panic(msg string, fields ...Field) {
l.checkLock()
l.defLogger.Panic(msg, fields...)
}
func (l *warpLogger) DPanic(msg string, fields ...Field) {
l.checkLock()
l.defLogger.DPanic(msg, fields...)
}
func (l *warpLogger) Debugf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Debugf(format, args...)
}
func (l *warpLogger) Infof(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Infof(format, args...)
}
func (l *warpLogger) Warnf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Warnf(format, args...)
}
func (l *warpLogger) Errorf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Errorf(format, args...)
}
func (l *warpLogger) Fatalf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Fatalf(format, args...)
}
func (l *warpLogger) Panicf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.Panicf(format, args...)
}
func (l *warpLogger) DPanicf(format string, args ...interface{}) {
l.checkLock()
l.sugaredLogger.DPanicf(format, args...)
}
func (l *warpLogger) Debugw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Debugw(msg, keysAndValues...)
}
func (l *warpLogger) Infow(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Infow(msg, keysAndValues...)
}
func (l *warpLogger) Warnw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Warnw(msg, keysAndValues...)
}
func (l *warpLogger) Errorw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Errorw(msg, keysAndValues...)
}
func (l *warpLogger) Fatalw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Fatalw(msg, keysAndValues...)
}
func (l *warpLogger) Panicw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.Panicw(msg, keysAndValues...)
}
func (l *warpLogger) DPanicw(msg string, keysAndValues ...interface{}) {
l.checkLock()
l.sugaredLogger.DPanicw(msg, keysAndValues...)
}
func (l *warpLogger) Sync() error {
return l.defLogger.Sync()
}
func (l *warpLogger) Desugar() Logger {
return l
}
func (l *warpLogger) UsedAt() time.Time {
unix := atomic.LoadUint32(&l._usedAt)
return time.Unix(int64(unix), 0)
}
func (l *warpLogger) SetUsedAt(tm time.Time) {
atomic.StoreUint32(&l._usedAt, uint32(tm.Unix()))
}
func (l *warpLogger) initSugaredLogger() {
if l.sugaredLogger == nil {
l.sugaredLogger = l.defLogger.Sugar()
}
}
func (l *warpLogger) updateLogger(logger *zap.Logger) {
l.lock()
defer l.unlock()
_ = l.Sync()
l.defLogger = logger
if l.sugaredLogger != nil {
l.sugaredLogger = l.defLogger.Sugar()
}
}
func (l *warpLogger) lock() {
l.mu.Lock()
atomic.StoreUint32(&l._locked, 1)
l._lockWait.Add(1)
}
func (l *warpLogger) unlock() {
atomic.StoreUint32(&l._locked, 0)
l._lockWait.Done()
l.mu.Unlock()
}
func (l *warpLogger) checkLock() {
if l.locked() {
l._lockWait.Wait()
}
}
func (l *warpLogger) locked() bool {
return atomic.LoadUint32(&l._locked) == 1
}
| 19.926606 | 72 | 0.681169 |
af4f3c142c2599b74d66b61fbb0d5a0654276335 | 425 | ps1 | PowerShell | Examples/MergeWorkSheet/MergeCSV.ps1 | edwardmjackson/ImportExcel | 5629536f155806d1456e00f8165441542bfe164f | [
"Apache-2.0"
] | 1 | 2019-12-10T13:19:29.000Z | 2019-12-10T13:19:29.000Z | Examples/MergeWorkSheet/MergeCSV.ps1 | edwardmjackson/ImportExcel | 5629536f155806d1456e00f8165441542bfe164f | [
"Apache-2.0"
] | null | null | null | Examples/MergeWorkSheet/MergeCSV.ps1 | edwardmjackson/ImportExcel | 5629536f155806d1456e00f8165441542bfe164f | [
"Apache-2.0"
] | 1 | 2021-04-09T11:50:53.000Z | 2021-04-09T11:50:53.000Z | try {Import-Module $PSScriptRoot\..\..\ImportExcel.psd1} catch {throw ; return}
$xlFile = "$env:TEMP\mw.xlsx"
Remove-Item $xlFile -ErrorAction Ignore
$leftCsv = @"
MyProp1,MyProp2,Length
a,b,10
c,d,20
"@ | ConvertFrom-Csv
$rightCsv = @"
MyProp1,MyProp2,Length
a,b,10
c,d,21
"@ | ConvertFrom-Csv
Merge-Worksheet -OutputFile $xlFile -ReferenceObject $leftCsv -DifferenceObject $rightCsv -Key Length -Show | 22.368421 | 107 | 0.701176 |
802a94f1a4a4f466097ca1470445b17730dcb8b2 | 8,253 | java | Java | CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/AttributeList.java | hydra41/constellation | b0fb5f5a9b6a627e34612d3d602ab115a5e9c806 | [
"Apache-2.0"
] | null | null | null | CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/AttributeList.java | hydra41/constellation | b0fb5f5a9b6a627e34612d3d602ab115a5e9c806 | [
"Apache-2.0"
] | null | null | null | CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/AttributeList.java | hydra41/constellation | b0fb5f5a9b6a627e34612d3d602ab115a5e9c806 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2019 Australian Signals Directorate
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package au.gov.asd.tac.constellation.plugins.importexport.delimited;
import au.gov.asd.tac.constellation.graph.Attribute;
import au.gov.asd.tac.constellation.plugins.importexport.delimited.translator.AttributeTranslator;
import au.gov.asd.tac.constellation.plugins.importexport.delimited.translator.DefaultAttributeTranslator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;
import javafx.geometry.Point2D;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
/**
* An AttributeList is a UI element that can hold all the available attributes
* for a given graph element. At present, three of these are used to hold the
* source node, destination node and transaction attributes in the UI and
* provide a place from which the user can drag these attributes onto columns.
* Attributes are represented with in the AttributeList by
* {@link AttributeNode}s.
*
* @author sirius
*/
public class AttributeList extends VBox {
private final RunPane runPane;
final ImportController importController;
private final AttributeType attributeType;
private final Map<String, AttributeNode> attributeNodes;
private Set<Integer> keys;
public AttributeList(final ImportController importController, final RunPane runPane, final AttributeType attributeType) {
this.runPane = runPane;
this.importController = importController;
this.attributeType = attributeType;
attributeNodes = new HashMap<>();
keys = new HashSet<>();
setAlignment(Pos.CENTER);
setMinSize(50, 100);
setSpacing(1);
setPadding(new Insets(2));
setFillWidth(true);
setAlignment(Pos.TOP_CENTER);
}
public AttributeType getAttributeType() {
return attributeType;
}
public RunPane getRunPane() {
return runPane;
}
public AttributeNode getAttributeNode(final String label) {
return attributeNodes.get(label);
}
private void createAttribute(Attribute attribute) {
final AttributeNode attributeNode = new AttributeNode(this, attribute, keys.contains(attribute.getId()));
attributeNodes.put(attribute.getName(), attributeNode);
attributeNode.setOnMousePressed((final MouseEvent t) -> {
if (t.isPrimaryButtonDown()) {
runPane.setDraggingOffset(new Point2D(t.getX(), t.getY()));
final Point2D location = runPane.sceneToLocal(t.getSceneX(), t.getSceneY());
// If the attribute node is currently assigned to a column then remove it.
final ImportTableColumn currentColumn = attributeNode.getColumn();
if (currentColumn != null) {
currentColumn.setAttributeNode(null);
runPane.validate(currentColumn);
}
attributeNode.setColumn(null);
runPane.getChildren().add(attributeNode);
attributeNode.setManaged(false);
attributeNode.setLayoutX(location.getX() - runPane.getDraggingOffset().getX());
attributeNode.setLayoutY(location.getY() - runPane.getDraggingOffset().getY());
runPane.setDraggingAttributeNode(attributeNode);
runPane.handleAttributeMoved(t.getSceneX(), t.getSceneY());
}
});
// Add the new attributeNode to the list in the correct place
// to maintain the sorted order.
ObservableList<Node> children = getChildren();
for (int i = 0; i < children.size(); i++) {
if (attributeNode.compareTo((AttributeNode) children.get(i)) <= 0) {
children.add(i, attributeNode);
return;
}
}
children.add(attributeNode);
}
public void deleteAttributeNode(AttributeNode attributeNode) {
final ImportTableColumn currentColumn = attributeNode.getColumn();
if (currentColumn != null) {
currentColumn.setAttributeNode(null);
runPane.validate(currentColumn);
}
attributeNode.setColumn(null);
importController.deleteAttribute(attributeNode.getAttribute());
}
public void deleteAttribute(Attribute attribute) {
AttributeNode attributeNode = attributeNodes.remove(attribute.getName());
if (attributeNode != null) {
ImportTableColumn column = attributeNode.getColumn();
if (column == null) {
getChildren().remove(attributeNode);
} else {
column.setAttributeNode(null);
}
}
}
public void addAttributeNode(AttributeNode attributeNode) {
final ObservableList<Node> children = getChildren();
for (int i = 0; i < children.size(); i++) {
if (attributeNode.compareTo((AttributeNode) children.get(i)) <= 0) {
children.add(i, attributeNode);
attributeNode.setColumn(null);
return;
}
}
children.add(attributeNode);
attributeNode.setColumn(null);
}
public void setDisplayedAttributes(Map<String, Attribute> attributes, Set<Integer> keys) {
this.keys = keys;
// Remove all attributes that no longer exist.
Iterator<Entry<String, AttributeNode>> i = attributeNodes.entrySet().iterator();
while (i.hasNext()) {
Entry<String, AttributeNode> entry = i.next();
if (!attributes.containsKey(entry.getKey())) {
AttributeNode attributeNode = entry.getValue();
ImportTableColumn column = attributeNode.getColumn();
if (column == null) {
getChildren().remove(attributeNode);
} else {
column.setAttributeNode(null);
}
i.remove();
}
}
for (Attribute attribute : attributes.values()) {
AttributeNode attributeNode = attributeNodes.get(attribute.getName());
if (attributeNode == null) {
createAttribute(attribute);
} else {
attributeNode.setAttribute(attribute, keys.contains(attribute.getId()));
// Show the default value
attributeNode.updateDefaultValue();
}
}
}
/**
* Create an {@code ImportDefinition} from attributes modified on the
* attribute list
*
* @param importDefinition the {@link ImportDefinition} that will hold the
* new {@link ImportAttributeDefinition}s.
*/
public void createDefinition(ImportDefinition importDefinition) {
for (AttributeNode attributeNode : attributeNodes.values()) {
if (attributeNode.getColumn() == null) {
String defaultValue = attributeNode.getDefaultValue();
AttributeTranslator translator = attributeNode.getTranslator();
if (defaultValue != null || (translator != null && !(translator instanceof DefaultAttributeTranslator))) {
ImportAttributeDefinition attributeDefinition = new ImportAttributeDefinition(defaultValue, attributeNode.getAttribute(), attributeNode.getTranslator(), attributeNode.getTranslatorParameters());
importDefinition.addDefinition(attributeType, attributeDefinition);
}
}
}
}
}
| 38.565421 | 214 | 0.647886 |
fba3260843f4810af8c514f2e572cc335fcd5efe | 954 | java | Java | spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java | elmarquez/spring-data-mock | db7ddf5204c17917798ed902673f0c9824aab153 | [
"MIT"
] | null | null | null | spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java | elmarquez/spring-data-mock | db7ddf5204c17917798ed902673f0c9824aab153 | [
"MIT"
] | null | null | null | spring-data-mock/src/main/java/com/mmnaseri/utils/spring/data/dsl/factory/OperationHandlers.java | elmarquez/spring-data-mock | db7ddf5204c17917798ed902673f0c9824aab153 | [
"MIT"
] | null | null | null | package com.mmnaseri.utils.spring.data.dsl.factory;
import com.mmnaseri.utils.spring.data.proxy.NonDataOperationHandler;
import com.mmnaseri.utils.spring.data.proxy.impl.NonDataOperationInvocationHandler;
/**
* Lets us define the operation handlers
*
* @author Milad Naseri (mmnaseri@programmer.net)
* @since 1.0 (4/8/16)
*/
@SuppressWarnings("WeakerAccess")
public interface OperationHandlers extends FallbackKeyGenerator {
/**
* Sets the invocation handler used for handling non-data-related operations
* @param invocationHandler the invocation handler
* @return the rest of the configuration
*/
FallbackKeyGenerator withOperationHandlers(NonDataOperationInvocationHandler invocationHandler);
/**
* Registers an operation handler
* @param handler the handler
* @return the rest of the configuration
*/
OperationHandlersAnd withOperationHandler(NonDataOperationHandler handler);
}
| 31.8 | 100 | 0.756813 |
4a7393c23ca5565bd3f624f6e4b5f289fe6cddf9 | 1,684 | cs | C# | test/EntityFramework.Relational.Tests/RelationalObjectArrayValueReaderTest.cs | craiggwilson/EntityFramework | e172882e1e039b61fa980e4466baa049f8ac94b1 | [
"Apache-2.0"
] | 1 | 2020-07-22T02:11:52.000Z | 2020-07-22T02:11:52.000Z | test/EntityFramework.Relational.Tests/RelationalObjectArrayValueReaderTest.cs | MikaelEliasson/EntityFramework | 897a3bfb402e6c7ec51e759618aae6ef0231825b | [
"Apache-2.0"
] | null | null | null | test/EntityFramework.Relational.Tests/RelationalObjectArrayValueReaderTest.cs | MikaelEliasson/EntityFramework | 897a3bfb402e6c7ec51e759618aae6ef0231825b | [
"Apache-2.0"
] | null | null | null | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Data.Common;
using Moq;
using Xunit;
namespace Microsoft.Data.Entity.Relational.Tests
{
public class RelationalObjectArrayValueReaderTest
{
[Fact]
public void IsNull_returns_true_for_DBNull()
{
var reader = new RelationalObjectArrayValueReader(CreateDataReader(DBNull.Value, "Smokey"));
Assert.True(reader.IsNull(0));
Assert.False(reader.IsNull(1));
}
[Fact]
public void Can_read_value()
{
var reader = new RelationalObjectArrayValueReader(CreateDataReader(77, "Smokey"));
Assert.Equal(77, reader.ReadValue<int>(0));
Assert.Equal("Smokey", reader.ReadValue<string>(1));
}
[Fact]
public void Can_get_count()
{
var reader = new RelationalObjectArrayValueReader(CreateDataReader(77, "Smokey"));
Assert.Equal(2, reader.Count);
}
private static DbDataReader CreateDataReader(params object[] values)
{
var readerMock = new Mock<DbDataReader>();
readerMock.Setup(m => m.FieldCount).Returns(2);
readerMock.Setup(m => m.GetValues(It.IsAny<object[]>()))
.Callback<object[]>(b =>
{
b[0] = values[0];
b[1] = values[1];
});
var dataReader = readerMock.Object;
return dataReader;
}
}
}
| 30.618182 | 111 | 0.581354 |
5c413f26a84caf79ad526a1890662e171d3920a6 | 3,451 | h | C | modules/monkey/native/bbgc.h | DrCox85/monkey2Ex | 5f19ad01a200b9259a16371c3a37cc2cf6a92c95 | [
"Zlib"
] | 140 | 2016-03-13T03:01:25.000Z | 2022-02-06T09:47:04.000Z | modules/monkey/native/bbgc.h | DrCox85/monkey2Ex | 5f19ad01a200b9259a16371c3a37cc2cf6a92c95 | [
"Zlib"
] | 469 | 2016-05-15T07:01:56.000Z | 2020-05-29T23:58:59.000Z | modules/monkey/native/bbgc.h | DrCox85/monkey2Ex | 5f19ad01a200b9259a16371c3a37cc2cf6a92c95 | [
"Zlib"
] | 72 | 2016-03-13T10:17:54.000Z | 2020-02-24T05:40:02.000Z |
#ifndef BB_GC_H
#define BB_GC_H
#ifdef BB_THREADS
#error "Wrong gc header"
#endif
#include "bbtypes.h"
#include "bbfunction.h"
#ifndef NDEBUG
#define BBGC_VALIDATE( P ) \
if( (P) && ((P)->state!=0 && (P)->state!=1 && (P)->state!=2) ){ \
printf( "BBGC_VALIDATE failed: %p %s %i\n",(P),(P)->typeName(),(P)->state ); \
fflush( stdout ); \
abort(); \
}
#else
#define BBGC_VALIDATE( P )
#endif
struct bbGCNode;
struct bbGCFiber;
struct bbGCFrame;
struct bbGCRoot;
struct bbGCTmp;
namespace bbGC{
extern int markedBit;
extern int unmarkedBit;
extern bbGCRoot *roots;
extern bbGCTmp *freeTmps;
extern bbGCNode *markQueue;
extern bbGCNode *unmarkedList;
extern bbGCFiber *fibers;
extern bbGCFiber *currentFiber;
void init();
void suspend();
void resume();
void retain( bbGCNode *p );
void release( bbGCNode *p );
void setDebug( bool debug );
void setTrigger( size_t trigger );
void *malloc( size_t size );
size_t mallocSize( void *p );
void free( void *p );
void collect();
// bbGCNode *alloc( size_t size );
}
struct bbGCNode{
bbGCNode *succ;
bbGCNode *pred;
char pad[2];
char state; //0=lonely, 1/2=marked/unmarked; 3=destroyed
char flags; //1=finalize
bbGCNode(){
}
void gcNeedsFinalize(){
flags|=1;
}
virtual ~bbGCNode(){
}
virtual void gcFinalize(){
}
virtual void gcMark(){
}
virtual void dbEmit(){
}
virtual const char *typeName()const{
return "bbGCNode";
}
};
struct bbGCFiber{
bbGCFiber *succ;
bbGCFiber *pred;
bbGCFrame *frames;
bbGCNode *ctoring;
bbGCTmp *tmps;
bbFunction<void()> entry;
bbGCFiber():succ( this ),pred( this ),frames( nullptr ),ctoring( nullptr ),tmps( nullptr ){
}
void link(){
succ=bbGC::fibers;
pred=bbGC::fibers->pred;
bbGC::fibers->pred=this;
pred->succ=this;
}
void unlink(){
pred->succ=succ;
succ->pred=pred;
}
};
struct bbGCFrame{
bbGCFrame *succ;
bbGCFrame():succ( bbGC::currentFiber->frames ){
bbGC::currentFiber->frames=this;
}
~bbGCFrame(){
bbGC::currentFiber->frames=succ;
}
virtual void gcMark(){
}
};
struct bbGCRoot{
bbGCRoot *succ;
bbGCRoot():succ( bbGC::roots ){
bbGC::roots=this;
}
virtual void gcMark(){
}
};
struct bbGCTmp{
bbGCTmp *succ;
bbGCNode *node;
};
namespace bbGC{
inline void insert( bbGCNode *p,bbGCNode *succ ){
p->succ=succ;
p->pred=succ->pred;
p->pred->succ=p;
succ->pred=p;
}
inline void remove( bbGCNode *p ){
p->pred->succ=p->succ;
p->succ->pred=p->pred;
}
inline void enqueue( bbGCNode *p ){
BBGC_VALIDATE( p )
if( !p || p->state!=unmarkedBit ) return;
remove( p );
p->succ=markQueue;
markQueue=p;
p->state=markedBit;
}
inline void pushTmp( bbGCNode *p ){
BBGC_VALIDATE( p );
bbGCTmp *tmp=freeTmps;
if( tmp ) freeTmps=tmp->succ; else tmp=new bbGCTmp;
tmp->succ=currentFiber->tmps;
currentFiber->tmps=tmp;
tmp->node=p;
}
inline void popTmps( int n ){
while( n-- ){
bbGCTmp *tmp=currentFiber->tmps;
currentFiber->tmps=tmp->succ;
tmp->succ=freeTmps;
freeTmps=tmp;
}
}
template<class T> T *tmp( T *p ){
pushTmp( p );
return p;
}
inline void beginCtor( bbGCNode *p ){
p->succ=currentFiber->ctoring;
currentFiber->ctoring=p;
p->state=0;
p->flags=0;
}
inline void endCtor( bbGCNode *p ){
currentFiber->ctoring=p->succ;
p->succ=markQueue;
markQueue=p;
p->state=markedBit;
}
}
template<class T> void bbGCMark( T const& ){
}
#endif
| 15.337778 | 92 | 0.646479 |