code
stringlengths 3
1.01M
| repo_name
stringlengths 5
116
| path
stringlengths 3
311
| language
stringclasses 30
values | license
stringclasses 15
values | size
int64 3
1.01M
|
|---|---|---|---|---|---|
import time
import json
import tornado.httpclient
http_client = tornado.httpclient.HTTPClient()
class HTTPServiceProxy(object):
def __init__(self, host='localhost', port=6999, cache_timeout=5.0):
self._host = host
self._port = port
self._cache_timeout = cache_timeout
self._cache = {}
self._cache_time = {}
def get(self, *path):
print 'http://%s:%d/%s' % (self._host, self._port, '/'.join(path))
if path in self._cache and \
self._cache_time[path] + self._cache_timeout > time.time():
return self._cache[path]
try:
response = http_client.fetch('http://%s:%d/%s' % (self._host, self._port, '/'.join(path)))
self._cache[path] = response.body
self._cache_time[path] = time.time()
return response.body
except tornado.httpclient.HTTPError as e:
if path in self._cache:
del self._cache[path]
return None
def post(self, *path, **kwargs):
url = 'http://%s:%d/%s' % (self._host, self._port, '/'.join(path))
print url
try:
request = tornado.httpclient.HTTPRequest(url, method='POST', body=json.dumps(kwargs))
response = http_client.fetch(request)
return response.body
except tornado.httpclient.HTTPError as e:
return None
class MonitorProxy(HTTPServiceProxy):
"""
Proxy object for the challenge monitor service.
"""
def __init__(self):
super(MonitorProxy, self).__init__(host='localhost', port=6999, cache_timeout=0.0)
@property
def challenges(self):
return json.loads(self.get('list'))
@property
def visible_challenges(self):
return json.loads(self.get('list_visible'))
def status(self, challenge):
try:
return json.loads(self.get('status')).get(challenge, None)
except TypeError:
return None
def show(self, challenge):
self.post('show', challenge)
def hide(self, challenge):
self.post('hide', challenge)
def start(self, challenge):
self.post('start', challenge)
def stop(self, challenge):
self.post('stop', challenge)
def metadata(self, challenge):
try:
return json.loads(self.get('metadata', challenge))
except TypeError:
return None
def fetch_file(self, challenge, filename):
return self.get('static_files', challenge, filename)
monitor = MonitorProxy()
class AuthProxy(HTTPServiceProxy):
"""
Proxy object for the user authentication serivce.
"""
def __init__(self, host='127.0.0.1', port=6998, cache_timeout=1.0):
super(AuthProxy, self).__init__(host='localhost', port=6998, cache_timeout=1.0)
@property
def users(self):
return json.loads(self.get('list'))
def create_user(self, user):
self.post('create_user', user)
def is_admin(self, user):
try:
return json.loads(self.post('get_tag', user, key='is_admin', default='false'))
except (ValueError, TypeError):
return False
def is_playing(self, user):
try:
return json.loads(self.post('get_tag', user, key='is_playing', default='true'))
except (ValueError, TypeError):
return False
def set_password(self, user, password):
self.post('set_password', user, password=password)
def check_password(self, user, password):
try:
return json.loads(self.post('check_password', user, password=password))
except TypeError:
return False
def set_tag(self, user, key, value):
self.post('set_tag', user, key=key, value=json.dumps(value))
def get_tag(self, user, key, default=''):
return self.post('get_tag', user, key=key, default=default)
auth = AuthProxy()
class ScoreboardProxy(HTTPServiceProxy):
"""
Proxy object for the scoreboard service.
"""
def __init__(self, host='127.0.0.1', port=6997, cache_timeout=1.0):
super(ScoreboardProxy, self).__init__(host='localhost', port=6997, cache_timeout=1.0)
def capture(self, user, challenge):
self.post('capture', challenge, user=user)
def get_captures_by_user(self, user):
return json.loads(self.get('get_captures_by_user', user))
def get_captures_by_challenge(self, challenge):
return json.loads(self.get('get_captures_by_challenge', challenge))
scoreboard = ScoreboardProxy()
|
nickbjohnson4224/greyhat-crypto-ctf-2014
|
frontend/services.py
|
Python
|
mit
| 4,564
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Sol.Services.Containers.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}
|
zenontrujillo/sol-server
|
sol-server/src/Sol.Services.Containers/Controllers/ValuesController.cs
|
C#
|
mit
| 935
|
use crate::codec::{FramedIo, Message, ZmqFramedRead, ZmqFramedWrite};
use crate::fair_queue::QueueInner;
use crate::util::PeerIdentity;
use crate::{
MultiPeerBackend, SocketBackend, SocketEvent, SocketOptions, SocketType, ZmqError, ZmqResult,
};
use async_trait::async_trait;
use crossbeam::queue::SegQueue;
use dashmap::DashMap;
use futures::channel::mpsc;
use futures::SinkExt;
use parking_lot::Mutex;
use std::sync::Arc;
pub(crate) struct Peer {
pub(crate) send_queue: ZmqFramedWrite,
}
pub(crate) struct GenericSocketBackend {
pub(crate) peers: DashMap<PeerIdentity, Peer>,
fair_queue_inner: Option<Arc<Mutex<QueueInner<ZmqFramedRead, PeerIdentity>>>>,
pub(crate) round_robin: SegQueue<PeerIdentity>,
socket_type: SocketType,
socket_options: SocketOptions,
pub(crate) socket_monitor: Mutex<Option<mpsc::Sender<SocketEvent>>>,
}
impl GenericSocketBackend {
pub(crate) fn with_options(
fair_queue_inner: Option<Arc<Mutex<QueueInner<ZmqFramedRead, PeerIdentity>>>>,
socket_type: SocketType,
options: SocketOptions,
) -> Self {
Self {
peers: DashMap::new(),
fair_queue_inner,
round_robin: SegQueue::new(),
socket_type,
socket_options: options,
socket_monitor: Mutex::new(None),
}
}
pub(crate) async fn send_round_robin(&self, message: Message) -> ZmqResult<PeerIdentity> {
// In normal scenario this will always be only 1 iteration
// There can be special case when peer has disconnected and his id is still in
// RR queue This happens because SegQueue don't have an api to delete
// items from queue. So in such case we'll just pop item and skip it if
// we don't have a matching peer in peers map
loop {
let next_peer_id = match self.round_robin.pop() {
Ok(peer) => peer,
Err(_) => match message {
Message::Greeting(_) => panic!("Sending greeting is not supported"),
Message::Command(_) => panic!("Sending commands is not supported"),
Message::Message(m) => {
return Err(ZmqError::ReturnToSender {
reason: "Not connected to peers. Unable to send messages",
message: m,
})
}
},
};
let send_result = match self.peers.get_mut(&next_peer_id) {
Some(mut peer) => peer.send_queue.send(message).await,
None => continue,
};
return match send_result {
Ok(()) => {
self.round_robin.push(next_peer_id.clone());
Ok(next_peer_id)
}
Err(e) => {
self.peer_disconnected(&next_peer_id);
Err(e.into())
}
};
}
}
}
impl SocketBackend for GenericSocketBackend {
fn socket_type(&self) -> SocketType {
self.socket_type
}
fn socket_options(&self) -> &SocketOptions {
&self.socket_options
}
fn shutdown(&self) {
self.peers.clear();
}
fn monitor(&self) -> &Mutex<Option<mpsc::Sender<SocketEvent>>> {
&self.socket_monitor
}
}
#[async_trait]
impl MultiPeerBackend for GenericSocketBackend {
async fn peer_connected(self: Arc<Self>, peer_id: &PeerIdentity, io: FramedIo) {
let (recv_queue, send_queue) = io.into_parts();
self.peers.insert(peer_id.clone(), Peer { send_queue });
self.round_robin.push(peer_id.clone());
match &self.fair_queue_inner {
None => {}
Some(inner) => {
inner.lock().insert(peer_id.clone(), recv_queue);
}
};
}
fn peer_disconnected(&self, peer_id: &PeerIdentity) {
self.peers.remove(peer_id);
match &self.fair_queue_inner {
None => {}
Some(inner) => {
inner.lock().remove(peer_id);
}
};
}
}
|
zeromq/zmq.rs
|
src/backend.rs
|
Rust
|
mit
| 4,145
|
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Unit tests for gclient.py.
See gclient_smoketest.py for integration tests.
"""
import Queue
import copy
import logging
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import gclient
import gclient_utils
import gclient_scm
from testing_support import trial_dir
def write(filename, content):
"""Writes the content of a file and create the directories as needed."""
filename = os.path.abspath(filename)
dirname = os.path.dirname(filename)
if not os.path.isdir(dirname):
os.makedirs(dirname)
with open(filename, 'w') as f:
f.write(content)
class SCMMock(object):
def __init__(self, unit_test, name, url):
self.unit_test = unit_test
self.name = name
self.url = url
def RunCommand(self, command, options, args, file_list):
self.unit_test.assertEquals('None', command)
self.unit_test.processed.put((self.name, self.url))
def FullUrlForRelativeUrl(self, url):
return self.url + url
# pylint: disable=no-self-use
def DoesRemoteURLMatch(self, _):
return True
def GetActualRemoteURL(self, _):
return self.url
class GclientTest(trial_dir.TestCase):
def setUp(self):
super(GclientTest, self).setUp()
self.processed = Queue.Queue()
self.previous_dir = os.getcwd()
os.chdir(self.root_dir)
# Manual mocks.
self._old_createscm = gclient.Dependency.CreateSCM
gclient.Dependency.CreateSCM = self._createscm
self._old_sys_stdout = sys.stdout
sys.stdout = gclient.gclient_utils.MakeFileAutoFlush(sys.stdout)
sys.stdout = gclient.gclient_utils.MakeFileAnnotated(sys.stdout)
def tearDown(self):
self.assertEquals([], self._get_processed())
gclient.Dependency.CreateSCM = self._old_createscm
sys.stdout = self._old_sys_stdout
os.chdir(self.previous_dir)
super(GclientTest, self).tearDown()
def _createscm(self, parsed_url, root_dir, name, out_fh=None, out_cb=None):
self.assertTrue(parsed_url.startswith('svn://example.com/'), parsed_url)
self.assertTrue(root_dir.startswith(self.root_dir), root_dir)
return SCMMock(self, name, parsed_url)
def testDependencies(self):
self._dependencies('1')
def testDependenciesJobs(self):
self._dependencies('1000')
def _dependencies(self, jobs):
"""Verifies that dependencies are processed in the right order.
e.g. if there is a dependency 'src' and another 'src/third_party/bar', that
bar isn't fetched until 'src' is done.
Args:
|jobs| is the number of parallel jobs simulated.
"""
parser = gclient.OptionParser()
options, args = parser.parse_args(['--jobs', jobs])
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
' { "name": "bar", "url": "svn://example.com/bar" },\n'
' { "name": "bar/empty", "url": "svn://example.com/bar_empty" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "foo/dir1": "/dir1",\n'
# This one will depend on dir1/dir2 in bar.
' "foo/dir1/dir2/dir3": "/dir1/dir2/dir3",\n'
' "foo/dir1/dir2/dir3/dir4": "/dir1/dir2/dir3/dir4",\n'
'}')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
# There is two foo/dir1/dir2. This one is fetched as bar/dir1/dir2.
' "foo/dir1/dir2": "/dir1/dir2",\n'
'}')
write(
os.path.join('bar/empty', 'DEPS'),
'deps = {\n'
'}')
obj = gclient.GClient.LoadCurrentConfig(options)
self._check_requirements(obj.dependencies[0], {})
self._check_requirements(obj.dependencies[1], {})
obj.RunOnDeps('None', args)
actual = self._get_processed()
first_3 = [
('bar', 'svn://example.com/bar'),
('bar/empty', 'svn://example.com/bar_empty'),
('foo', 'svn://example.com/foo'),
]
if jobs != 1:
# We don't care of the ordering of these items except that bar must be
# before bar/empty.
self.assertTrue(
actual.index(('bar', 'svn://example.com/bar')) <
actual.index(('bar/empty', 'svn://example.com/bar_empty')))
self.assertEquals(first_3, sorted(actual[0:3]))
else:
self.assertEquals(first_3, actual[0:3])
self.assertEquals(
[
('foo/dir1', 'svn://example.com/foo/dir1'),
('foo/dir1/dir2', 'svn://example.com/bar/dir1/dir2'),
('foo/dir1/dir2/dir3', 'svn://example.com/foo/dir1/dir2/dir3'),
('foo/dir1/dir2/dir3/dir4',
'svn://example.com/foo/dir1/dir2/dir3/dir4'),
],
actual[3:])
self.assertEquals(3, len(obj.dependencies))
self.assertEquals('foo', obj.dependencies[0].name)
self.assertEquals('bar', obj.dependencies[1].name)
self.assertEquals('bar/empty', obj.dependencies[2].name)
self._check_requirements(
obj.dependencies[0],
{
'foo/dir1': ['bar', 'bar/empty', 'foo'],
'foo/dir1/dir2/dir3':
['bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2'],
'foo/dir1/dir2/dir3/dir4':
[ 'bar', 'bar/empty', 'foo', 'foo/dir1', 'foo/dir1/dir2',
'foo/dir1/dir2/dir3'],
})
self._check_requirements(
obj.dependencies[1],
{
'foo/dir1/dir2': ['bar', 'bar/empty', 'foo', 'foo/dir1'],
})
self._check_requirements(
obj.dependencies[2],
{})
self._check_requirements(
obj,
{
'foo': [],
'bar': [],
'bar/empty': ['bar'],
})
def _check_requirements(self, solution, expected):
for dependency in solution.dependencies:
e = expected.pop(dependency.name)
a = sorted(dependency.requirements)
self.assertEquals(e, a, (dependency.name, e, a))
self.assertEquals({}, expected)
def _get_processed(self):
"""Retrieves the item in the order they were processed."""
items = []
try:
while True:
items.append(self.processed.get_nowait())
except Queue.Empty:
pass
return items
def testAutofix(self):
# Invalid urls causes pain when specifying requirements. Make sure it's
# auto-fixed.
url = 'proto://host/path/@revision'
d = gclient.Dependency(
None, 'name', url, url, None, None, None,
None, '', True, False, None, True)
self.assertEquals('proto://host/path@revision', d.url)
def testStr(self):
parser = gclient.OptionParser()
options, _ = parser.parse_args([])
obj = gclient.GClient('foo', options)
obj.add_dependencies_and_close(
[
gclient.Dependency(
obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
gclient.Dependency(
obj, 'bar', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
],
[])
obj.dependencies[0].add_dependencies_and_close(
[
gclient.Dependency(
obj.dependencies[0], 'foo/dir1', 'raw_url', 'url', None, None, None,
None, 'DEPS', True, False, None, True),
],
[])
# Make sure __str__() works fine.
# pylint: disable=protected-access
obj.dependencies[0]._file_list.append('foo')
str_obj = str(obj)
self.assertEquals(263, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
def testHooks(self):
topdir = self.root_dir
gclient_fn = os.path.join(topdir, '.gclient')
fh = open(gclient_fn, 'w')
print >> fh, 'solutions = [{"name":"top","url":"svn://example.com/top"}]'
fh.close()
subdir_fn = os.path.join(topdir, 'top')
os.mkdir(subdir_fn)
deps_fn = os.path.join(subdir_fn, 'DEPS')
fh = open(deps_fn, 'w')
hooks = [{'pattern':'.', 'action':['cmd1', 'arg1', 'arg2']}]
print >> fh, 'hooks = %s' % repr(hooks)
fh.close()
fh = open(os.path.join(subdir_fn, 'fake.txt'), 'w')
print >> fh, 'bogus content'
fh.close()
os.chdir(topdir)
parser = gclient.OptionParser()
options, _ = parser.parse_args([])
options.force = True
client = gclient.GClient.LoadCurrentConfig(options)
work_queue = gclient_utils.ExecutionQueue(options.jobs, None, False)
for s in client.dependencies:
work_queue.enqueue(s)
work_queue.flush({}, None, [], options=options, patch_refs={})
self.assertEqual(
[h.action for h in client.GetHooks(options)],
[tuple(x['action']) for x in hooks])
def testCustomHooks(self):
topdir = self.root_dir
gclient_fn = os.path.join(topdir, '.gclient')
fh = open(gclient_fn, 'w')
extra_hooks = [{'name': 'append', 'pattern':'.', 'action':['supercmd']}]
print >> fh, ('solutions = [{"name":"top","url":"svn://example.com/top",'
'"custom_hooks": %s},' ) % repr(extra_hooks + [{'name': 'skip'}])
print >> fh, '{"name":"bottom","url":"svn://example.com/bottom"}]'
fh.close()
subdir_fn = os.path.join(topdir, 'top')
os.mkdir(subdir_fn)
deps_fn = os.path.join(subdir_fn, 'DEPS')
fh = open(deps_fn, 'w')
hooks = [{'pattern':'.', 'action':['cmd1', 'arg1', 'arg2']}]
hooks.append({'pattern':'.', 'action':['cmd2', 'arg1', 'arg2']})
skip_hooks = [
{'name': 'skip', 'pattern':'.', 'action':['cmd3', 'arg1', 'arg2']}]
skip_hooks.append(
{'name': 'skip', 'pattern':'.', 'action':['cmd4', 'arg1', 'arg2']})
print >> fh, 'hooks = %s' % repr(hooks + skip_hooks)
fh.close()
# Make sure the custom hooks for that project don't affect the next one.
subdir_fn = os.path.join(topdir, 'bottom')
os.mkdir(subdir_fn)
deps_fn = os.path.join(subdir_fn, 'DEPS')
fh = open(deps_fn, 'w')
sub_hooks = [{'pattern':'.', 'action':['response1', 'yes1', 'yes2']}]
sub_hooks.append(
{'name': 'skip', 'pattern':'.', 'action':['response2', 'yes', 'sir']})
print >> fh, 'hooks = %s' % repr(sub_hooks)
fh.close()
fh = open(os.path.join(subdir_fn, 'fake.txt'), 'w')
print >> fh, 'bogus content'
fh.close()
os.chdir(topdir)
parser = gclient.OptionParser()
options, _ = parser.parse_args([])
options.force = True
client = gclient.GClient.LoadCurrentConfig(options)
work_queue = gclient_utils.ExecutionQueue(options.jobs, None, False)
for s in client.dependencies:
work_queue.enqueue(s)
work_queue.flush({}, None, [], options=options, patch_refs={})
self.assertEqual(
[h.action for h in client.GetHooks(options)],
[tuple(x['action']) for x in hooks + extra_hooks + sub_hooks])
def testTargetOS(self):
"""Verifies that specifying a target_os pulls in all relevant dependencies.
The target_os variable allows specifying the name of an additional OS which
should be considered when selecting dependencies from a DEPS' deps_os. The
value will be appended to the _enforced_os tuple.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' }]\n'
'target_os = ["baz"]')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "foo/dir1": "/dir1",'
'}\n'
'deps_os = {\n'
' "unix": { "foo/dir2": "/dir2", },\n'
' "baz": { "foo/dir3": "/dir3", },\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = "unix"
obj = gclient.GClient.LoadCurrentConfig(options)
self.assertEqual(['baz', 'unix'], sorted(obj.enforced_os))
def testTargetOsWithTargetOsOnly(self):
"""Verifies that specifying a target_os and target_os_only pulls in only
the relevant dependencies.
The target_os variable allows specifying the name of an additional OS which
should be considered when selecting dependencies from a DEPS' deps_os. With
target_os_only also set, the _enforced_os tuple will be set to only the
target_os value.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' }]\n'
'target_os = ["baz"]\n'
'target_os_only = True')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "foo/dir1": "/dir1",'
'}\n'
'deps_os = {\n'
' "unix": { "foo/dir2": "/dir2", },\n'
' "baz": { "foo/dir3": "/dir3", },\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = "unix"
obj = gclient.GClient.LoadCurrentConfig(options)
self.assertEqual(['baz'], sorted(obj.enforced_os))
def testTargetOsOnlyWithoutTargetOs(self):
"""Verifies that specifying a target_os_only without target_os_only raises
an exception.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' }]\n'
'target_os_only = True')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "foo/dir1": "/dir1",'
'}\n'
'deps_os = {\n'
' "unix": { "foo/dir2": "/dir2", },\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = "unix"
exception_raised = False
try:
gclient.GClient.LoadCurrentConfig(options)
except gclient_utils.Error:
exception_raised = True
self.assertTrue(exception_raised)
def testTargetOsInDepsFile(self):
"""Verifies that specifying a target_os value in a DEPS file pulls in all
relevant dependencies.
The target_os variable in a DEPS file allows specifying the name of an
additional OS which should be considered when selecting dependencies from a
DEPS' deps_os. The value will be appended to the _enforced_os tuple.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' },\n'
' { "name": "bar",\n'
' "url": "svn://example.com/bar",\n'
' }]\n')
write(
os.path.join('foo', 'DEPS'),
'target_os = ["baz"]\n'
'deps_os = {\n'
' "unix": { "foo/unix": "/unix", },\n'
' "baz": { "foo/baz": "/baz", },\n'
' "jaz": { "foo/jaz": "/jaz", },\n'
'}')
write(
os.path.join('bar', 'DEPS'),
'deps_os = {\n'
' "unix": { "bar/unix": "/unix", },\n'
' "baz": { "bar/baz": "/baz", },\n'
' "jaz": { "bar/jaz": "/jaz", },\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = 'unix'
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEqual(['unix'], sorted(obj.enforced_os))
self.assertEquals(
[
('bar', 'svn://example.com/bar'),
('bar/unix', 'svn://example.com/bar/unix'),
('foo', 'svn://example.com/foo'),
('foo/baz', 'svn://example.com/foo/baz'),
('foo/unix', 'svn://example.com/foo/unix'),
],
sorted(self._get_processed()))
def testTargetOsForHooksInDepsFile(self):
"""Verifies that specifying a target_os value in a DEPS file runs the right
entries in hooks_os.
"""
write(
'DEPS',
'hooks = [\n'
' {\n'
' "name": "a",\n'
' "pattern": ".",\n'
' "action": [ "python", "do_a" ],\n'
' },\n'
']\n'
'\n'
'hooks_os = {\n'
' "blorp": ['
' {\n'
' "name": "b",\n'
' "pattern": ".",\n'
' "action": [ "python", "do_b" ],\n'
' },\n'
' ],\n'
'}\n')
write(
'.gclient',
'solutions = [\n'
' { "name": ".",\n'
' "url": "svn://example.com/",\n'
' }]\n')
# Test for an OS not in hooks_os.
parser = gclient.OptionParser()
options, args = parser.parse_args(['--jobs', '1'])
options.deps_os = 'zippy'
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', args)
self.assertEqual(['zippy'], sorted(obj.enforced_os))
all_hooks = [h.action for h in obj.GetHooks(options)]
self.assertEquals(
[('.', 'svn://example.com/'),],
sorted(self._get_processed()))
self.assertEquals(all_hooks,
[('python', 'do_a')])
# Test for OS that has extra hooks in hooks_os.
parser = gclient.OptionParser()
options, args = parser.parse_args(['--jobs', '1'])
options.deps_os = 'blorp'
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', args)
self.assertEqual(['blorp'], sorted(obj.enforced_os))
all_hooks = [h.action for h in obj.GetHooks(options)]
self.assertEquals(
[('.', 'svn://example.com/'),],
sorted(self._get_processed()))
self.assertEquals(all_hooks,
[('python', 'do_a'),
('python', 'do_b')])
def testUpdateWithOsDeps(self):
"""Verifies that complicated deps_os constructs result in the
correct data also with multple operating systems. Also see
testDepsOsOverrideDepsInDepsFile."""
test_data = [
# Tuples of deps, deps_os, os_list and expected_deps.
(
# OS with no overrides at all.
{'foo': 'default_foo'},
{'os1': { 'foo': None } },
['os2'],
{'foo': 'default_foo'}
),
(
# One OS wants to add a module.
{'foo': 'default_foo'},
{'os1': { 'bar': 'os1_bar' }},
['os1'],
{'foo': 'default_foo',
'bar': {'should_process': True, 'url': 'os1_bar'}}
),
(
# One OS wants to add a module. One doesn't care.
{'foo': 'default_foo'},
{'os1': { 'bar': 'os1_bar' }},
['os1', 'os2'],
{'foo': 'default_foo',
'bar': {'should_process': True, 'url': 'os1_bar'}}
),
(
# Two OSes want to add a module with the same definition.
{'foo': 'default_foo'},
{'os1': { 'bar': 'os12_bar' },
'os2': { 'bar': 'os12_bar' }},
['os1', 'os2'],
{'foo': 'default_foo',
'bar': {'should_process': True, 'url': 'os12_bar'}}
),
(
# One OS doesn't need module, one OS wants the default.
{'foo': 'default_foo'},
{'os1': { 'foo': None },
'os2': {}},
['os1', 'os2'],
{'foo': 'default_foo'}
),
(
# OS doesn't need module.
{'foo': 'default_foo'},
{'os1': { 'foo': None } },
['os1'],
{'foo': 'default_foo'}
),
(
# No-op override. Regression test for http://crbug.com/735418 .
{'foo': 'default_foo'},
{'os1': { 'foo': 'default_foo' } },
[],
{'foo': {'should_process': True, 'url': 'default_foo'}}
),
]
for deps, deps_os, target_os_list, expected_deps in test_data:
orig_deps = copy.deepcopy(deps)
result = gclient.Dependency.MergeWithOsDeps(
deps, deps_os, target_os_list, False)
self.assertEqual(result, expected_deps)
self.assertEqual(deps, orig_deps)
def testUpdateWithOsDepsInvalid(self):
test_data = [
# Tuples of deps, deps_os, os_list.
(
# OS wants a different version of module.
{'foo': 'default_foo'},
{'os1': { 'foo': 'os1_foo'} },
['os1'],
),
(
# One OS doesn't need module, another OS wants a special version.
{'foo': 'default_foo'},
{'os1': { 'foo': None },
'os2': { 'foo': 'os2_foo'}},
['os1', 'os2'],
),
]
for deps, deps_os, target_os_list in test_data:
with self.assertRaises(gclient_utils.Error):
gclient.Dependency.MergeWithOsDeps(deps, deps_os, target_os_list, False)
def testLateOverride(self):
"""Verifies expected behavior of LateOverride."""
url = "git@github.com:dart-lang/spark.git"
d = gclient.Dependency(None, 'name', 'raw_url', 'url',
None, None, None, None, '', True, False, None, True)
late_url = d.LateOverride(url)
self.assertEquals(url, late_url)
def testDepsOsOverrideDepsInDepsFile(self):
"""Verifies that a 'deps_os' path cannot override a 'deps' path. Also
see testUpdateWithOsDeps above.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo",\n'
' "url": "svn://example.com/foo",\n'
' },]\n')
write(
os.path.join('foo', 'DEPS'),
'target_os = ["baz"]\n'
'deps = {\n'
' "foo/src": "/src",\n' # This path is to be overridden by similar path
# in deps_os['unix'].
'}\n'
'deps_os = {\n'
' "unix": { "foo/unix": "/unix",'
' "foo/src": "/src_unix"},\n'
' "baz": { "foo/baz": "/baz",\n'
' "foo/src": None},\n'
' "jaz": { "foo/jaz": "/jaz", },\n'
'}')
parser = gclient.OptionParser()
options, _ = parser.parse_args(['--jobs', '1'])
options.deps_os = 'unix'
obj = gclient.GClient.LoadCurrentConfig(options)
with self.assertRaises(gclient_utils.Error):
obj.RunOnDeps('None', [])
self.assertEqual(['unix'], sorted(obj.enforced_os))
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
],
sorted(self._get_processed()))
def testRecursionOverride(self):
"""Verifies gclient respects the |recursion| var syntax.
We check several things here:
- |recursion| = 3 sets recursion on the foo dep to exactly 3
(we pull /fizz, but not /fuzz)
- pulling foo/bar at recursion level 1 (in .gclient) is overriden by
a later pull of foo/bar at recursion level 2 (in the dep tree)
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
' { "name": "foo/bar", "url": "svn://example.com/bar" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursion = 3')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
' "fizz": "/fizz",\n'
'}')
write(
os.path.join('fizz', 'DEPS'),
'deps = {\n'
' "fuzz": "/fuzz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
],
self._get_processed())
def testRecursedepsOverride(self):
"""Verifies gclient respects the |recursedeps| var syntax.
This is what we mean to check here:
- |recursedeps| = [...] on 2 levels means we pull exactly 3 deps
(up to /fizz, but not /fuzz)
- pulling foo/bar with no recursion (in .gclient) is overriden by
a later pull of foo/bar with recursion (in the dep tree)
- pulling foo/tar with no recursion (in .gclient) is no recursively
pulled (taz is left out)
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
' { "name": "foo/bar", "url": "svn://example.com/bar" },\n'
' { "name": "foo/tar", "url": "svn://example.com/tar" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursedeps = ["bar"]')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}\n'
'recursedeps = ["baz"]')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
' "fizz": "/fizz",\n'
'}')
write(
os.path.join('fizz', 'DEPS'),
'deps = {\n'
' "fuzz": "/fuzz",\n'
'}')
write(
os.path.join('tar', 'DEPS'),
'deps = {\n'
' "taz": "/taz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('foo/tar', 'svn://example.com/tar'),
],
sorted(self._get_processed()))
def testRecursedepsOverrideWithRelativePaths(self):
"""Verifies gclient respects |recursedeps| with relative paths."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'use_relative_paths = True\n'
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursedeps = ["bar"]')
write(
os.path.join('foo/bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
' "fizz": "/fizz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/foo/bar'),
('foo/baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
def testRelativeRecursion(self):
"""Verifies that nested use_relative_paths is always respected."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'use_relative_paths = True\n'
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursedeps = ["bar"]')
write(
os.path.join('foo/bar', 'DEPS'),
'use_relative_paths = True\n'
'deps = {\n'
' "baz": "/baz",\n'
'}')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
' "fizz": "/fizz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/foo/bar'),
('foo/bar/baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
def testRecursionOverridesRecursedeps(self):
"""Verifies gclient respects |recursion| over |recursedeps|.
|recursion| is set in a top-level DEPS file. That value is meant
to affect how many subdeps are parsed via recursion.
|recursedeps| is set in each DEPS file to control whether or not
to recurse into the immediate next subdep.
This test verifies that if both syntaxes are mixed in a DEPS file,
we disable |recursedeps| support and only obey |recursion|.
Since this setting is evaluated per DEPS file, recursed DEPS
files will each be re-evaluated according to the per DEPS rules.
So a DEPS that only contains |recursedeps| could then override any
previous |recursion| setting. There is extra processing to ensure
this does not happen.
For this test to work correctly, we need to use a DEPS chain that
only contains recursion controls in the top DEPS file.
In foo, |recursion| and |recursedeps| are specified. When we see
|recursion|, we stop trying to use |recursedeps|.
There are 2 constructions of DEPS here that are key to this test:
(1) In foo, if we used |recursedeps| instead of |recursion|, we
would also pull in bar. Since bar's DEPS doesn't contain any
recursion statements, we would stop processing at bar.
(2) In fizz, if we used |recursedeps| at all, we should pull in
fuzz.
We expect to keep going past bar (satisfying 1) and we don't
expect to pull in fuzz (satisfying 2).
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
' { "name": "foo/bar", "url": "svn://example.com/bar" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursion = 3\n'
'recursedeps = ["bar"]')
write(
os.path.join('bar', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
write(
os.path.join('baz', 'DEPS'),
'deps = {\n'
' "fizz": "/fizz",\n'
'}')
write(
os.path.join('fizz', 'DEPS'),
'deps = {\n'
' "fuzz": "/fuzz",\n'
'}\n'
'recursedeps = ["fuzz"]')
write(
os.path.join('fuzz', 'DEPS'),
'deps = {\n'
' "tar": "/tar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('foo/bar', 'svn://example.com/bar'),
('bar', 'svn://example.com/foo/bar'),
# Deps after this would have been skipped if we were obeying
# |recursedeps|.
('baz', 'svn://example.com/foo/bar/baz'),
('fizz', 'svn://example.com/foo/bar/baz/fizz'),
# And this dep would have been picked up if we were obeying
# |recursedeps|.
# 'svn://example.com/foo/bar/baz/fuzz',
],
self._get_processed())
def testRecursedepsAltfile(self):
"""Verifies gclient respects the |recursedeps| var syntax with overridden
target DEPS file.
This is what we mean to check here:
- Naming an alternate DEPS file in recursedeps pulls from that one.
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo" },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}\n'
'recursedeps = [("bar", "DEPS.alt")]')
write(os.path.join('bar', 'DEPS'), 'ERROR ERROR ERROR')
write(
os.path.join('bar', 'DEPS.alt'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/foo/bar'),
('baz', 'svn://example.com/foo/bar/baz'),
],
self._get_processed())
def testGitDeps(self):
"""Verifies gclient respects a .DEPS.git deps file.
Along the way, we also test that if both DEPS and .DEPS.git are present,
that gclient does not read the DEPS file. This will reliably catch bugs
where gclient is always hitting the wrong file (DEPS).
"""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', '.DEPS.git'),
'deps = {\n'
' "bar": "/bar",\n'
'}')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "baz": "/baz",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/foo/bar'),
],
self._get_processed())
def testGitDepsFallback(self):
"""Verifies gclient respects fallback to DEPS upon missing deps file."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
self.assertEquals(
[
('foo', 'svn://example.com/foo'),
('bar', 'svn://example.com/foo/bar'),
],
self._get_processed())
def testDepsFromNotAllowedHostsUnspecified(self):
"""Verifies gclient works fine with DEPS without allowed_hosts."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'deps = {\n'
' "bar": "/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
dep = obj.dependencies[0]
self.assertEquals([], dep.findDepsFromNotAllowedHosts())
self.assertEquals(frozenset(), dep.allowed_hosts)
self._get_processed()
def testDepsFromNotAllowedHostsOK(self):
"""Verifies gclient works fine with DEPS with proper allowed_hosts."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', '.DEPS.git'),
'allowed_hosts = ["example.com"]\n'
'deps = {\n'
' "bar": "svn://example.com/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
dep = obj.dependencies[0]
self.assertEquals([], dep.findDepsFromNotAllowedHosts())
self.assertEquals(frozenset(['example.com']), dep.allowed_hosts)
self._get_processed()
def testDepsFromNotAllowedHostsBad(self):
"""Verifies gclient works fine with DEPS with proper allowed_hosts."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', '.DEPS.git'),
'allowed_hosts = ["other.com"]\n'
'deps = {\n'
' "bar": "svn://example.com/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
obj.RunOnDeps('None', [])
dep = obj.dependencies[0]
self.assertEquals(frozenset(['other.com']), dep.allowed_hosts)
self.assertEquals([dep.dependencies[0]], dep.findDepsFromNotAllowedHosts())
self._get_processed()
def testDepsParseFailureWithEmptyAllowedHosts(self):
"""Verifies gclient fails with defined but empty allowed_hosts."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'allowed_hosts = []\n'
'deps = {\n'
' "bar": "/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
try:
obj.RunOnDeps('None', [])
self.fail()
except gclient_utils.Error, e:
self.assertIn('allowed_hosts must be', str(e))
finally:
self._get_processed()
def testDepsParseFailureWithNonIterableAllowedHosts(self):
"""Verifies gclient fails with defined but non-iterable allowed_hosts."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'allowed_hosts = None\n'
'deps = {\n'
' "bar": "/bar",\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
obj = gclient.GClient.LoadCurrentConfig(options)
try:
obj.RunOnDeps('None', [])
self.fail()
except gclient_utils.Error, e:
self.assertIn('allowed_hosts must be', str(e))
finally:
self._get_processed()
def testCreatesCipdDependencies(self):
"""Verifies something."""
write(
'.gclient',
'solutions = [\n'
' { "name": "foo", "url": "svn://example.com/foo",\n'
' "deps_file" : ".DEPS.git",\n'
' },\n'
']')
write(
os.path.join('foo', 'DEPS'),
'vars = {\n'
' "lemur_version": "version:1234",\n'
'}\n'
'deps = {\n'
' "bar": {\n'
' "packages": [{\n'
' "package": "lemur",\n'
' "version": Var("lemur_version"),\n'
' }],\n'
' "dep_type": "cipd",\n'
' }\n'
'}')
options, _ = gclient.OptionParser().parse_args([])
options.validate_syntax = True
obj = gclient.GClient.LoadCurrentConfig(options)
self.assertEquals(1, len(obj.dependencies))
sol = obj.dependencies[0]
sol._condition = 'some_condition'
sol.ParseDepsFile()
self.assertEquals(1, len(sol.dependencies))
dep = sol.dependencies[0]
self.assertIsInstance(dep, gclient.CipdDependency)
self.assertEquals(
'https://chrome-infra-packages.appspot.com/lemur@version:1234',
dep.url)
def testSameDirAllowMultipleCipdDeps(self):
"""Verifies gclient allow multiple cipd deps under same directory."""
parser = gclient.OptionParser()
options, _ = parser.parse_args([])
obj = gclient.GClient('foo', options)
cipd_root = gclient_scm.CipdRoot(
os.path.join(self.root_dir, 'dir1'), 'https://example.com')
obj.add_dependencies_and_close(
[
gclient.Dependency(
obj, 'foo', 'raw_url', 'url', None, None, None, None, 'DEPS', True,
False, None, True),
],
[])
obj.dependencies[0].add_dependencies_and_close(
[
gclient.CipdDependency(obj.dependencies[0], 'foo',
{'package': 'foo_package',
'version': 'foo_version'},
cipd_root, None, True, False,
'fake_condition', True),
gclient.CipdDependency(obj.dependencies[0], 'foo',
{'package': 'bar_package',
'version': 'bar_version'},
cipd_root, None, True, False,
'fake_condition', True),
],
[])
dep0 = obj.dependencies[0].dependencies[0]
dep1 = obj.dependencies[0].dependencies[1]
self.assertEquals('https://example.com/foo_package@foo_version', dep0.url)
self.assertEquals('https://example.com/bar_package@bar_version', dep1.url)
if __name__ == '__main__':
sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout)
sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout, include_zero=True)
sys.stderr = gclient_utils.MakeFileAutoFlush(sys.stderr)
sys.stderr = gclient_utils.MakeFileAnnotated(sys.stderr, include_zero=True)
logging.basicConfig(
level=[logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG][
min(sys.argv.count('-v'), 3)],
format='%(relativeCreated)4d %(levelname)5s %(module)13s('
'%(lineno)d) %(message)s')
unittest.main()
|
Shouqun/node-gn
|
tools/depot_tools/tests/gclient_test.py
|
Python
|
mit
| 40,396
|
module Liquid
# Context keeps the variable stack and resolves variables, as well as keywords
#
# context['variable'] = 'testing'
# context['variable'] #=> 'testing'
# context['true'] #=> true
# context['10.2232'] #=> 10.2232
#
# context.stack do
# context['bob'] = 'bobsen'
# end
#
# context['bob'] #=> nil class Context
class Context
attr_reader :scopes, :errors, :registers, :environments
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false)
@environments = [environments].flatten
@scopes = [(outer_scope || {})]
@registers = registers
@errors = []
@rethrow_errors = rethrow_errors
squash_instance_assigns_with_environments
end
def strainer
@strainer ||= Strainer.create(self)
end
# Adds filters to this context.
#
# Note that this does not register the filters with the main Template object. see <tt>Template.register_filter</tt>
# for that
def add_filters(filters)
filters = [filters].flatten.compact
filters.each do |f|
raise ArgumentError, "Expected module but got: #{f.class}" unless f.is_a?(Module)
strainer.extend(f)
end
end
def handle_error(e)
errors.push(e)
raise if @rethrow_errors || !e.is_a?(Liquid::Error)
case e
when SyntaxError
"Liquid syntax error: #{e.message}"
else
"Liquid error: #{e.message}"
end
end
def invoke(method, *args)
if strainer.respond_to?(method)
strainer.__send__(method, *args)
else
args.first
end
end
# Push new local scope on the stack. use <tt>Context#stack</tt> instead
def push(new_scope={})
raise StackLevelError, "Nesting too deep" if @scopes.length > 100
@scopes.unshift(new_scope)
end
# Merge a hash of variables in the current local scope
def merge(new_scopes)
@scopes[0].merge!(new_scopes)
end
# Pop from the stack. use <tt>Context#stack</tt> instead
def pop
raise ContextError if @scopes.size == 1
@scopes.shift
end
# Pushes a new local scope on the stack, pops it at the end of the block
#
# Example:
# context.stack do
# context['var'] = 'hi'
# end
#
# context['var] #=> nil
def stack(new_scope={},&block)
result = nil
push(new_scope)
begin
result = yield
ensure
pop
end
result
end
def clear_instance_assigns
@scopes[0] = {}
end
# Only allow String, Numeric, Hash, Array, Proc, Boolean or <tt>Liquid::Drop</tt>
def []=(key, value)
@scopes[0][key] = value
end
def [](key)
resolve(key)
end
def has_key?(key)
resolve(key) != nil
end
private
# Look up variable, either resolve directly after considering the name. We can directly handle
# Strings, digits, floats and booleans (true,false).
# If no match is made we lookup the variable in the current scope and
# later move up to the parent blocks to see if we can resolve the variable somewhere up the tree.
# Some special keywords return symbols. Those symbols are to be called on the rhs object in expressions
#
# Example:
# products == empty #=> products.empty?
def resolve(key)
case key
when nil, 'nil', 'null', ''
nil
when 'true'
true
when 'false'
false
when 'blank'
:blank?
when 'empty' # Single quoted strings
:empty?
when /^'(.*)'$/ # Double quoted strings
$1.to_s
when /^"(.*)"$/ # Integer and floats
$1.to_s
when /^(\d+)$/ # Ranges
$1.to_i
when /^\((\S+)\.\.(\S+)\)$/ # Floats
(resolve($1).to_i..resolve($2).to_i)
when /^(\d[\d\.]+)$/
$1.to_f
else
variable(key)
end
end
# Fetches an object starting at the local scope and then moving up the hierachy
def find_variable(key)
scope = @scopes.find { |s| s.has_key?(key) }
if scope.nil?
@environments.each do |e|
if variable = lookup_and_evaluate(e, key)
scope = e
break
end
end
end
scope ||= @environments.last || @scopes.last
variable ||= lookup_and_evaluate(scope, key)
variable = variable.to_liquid
variable.context = self if variable.respond_to?(:context=)
return variable
end
# Resolves namespaced queries gracefully.
#
# Example
# @context['hash'] = {"name" => 'tobi'}
# assert_equal 'tobi', @context['hash.name']
# assert_equal 'tobi', @context['hash["name"]']
def variable(markup)
parts = markup.scan(VariableParser)
square_bracketed = /^\[(.*)\]$/
first_part = parts.shift
if first_part =~ square_bracketed
first_part = resolve($1)
end
if object = find_variable(first_part)
parts.each do |part|
part = resolve($1) if part_resolved = (part =~ square_bracketed)
# If object is a hash- or array-like object we look for the
# presence of the key and if its available we return it
if object.respond_to?(:[]) and
((object.respond_to?(:has_key?) and object.has_key?(part)) or
(object.respond_to?(:fetch) and part.is_a?(Integer)))
# if its a proc we will replace the entry with the proc
res = lookup_and_evaluate(object, part)
object = res.to_liquid
# Some special cases. If the part wasn't in square brackets and
# no key with the same name was found we interpret following calls
# as commands and call them on the current object
elsif !part_resolved and object.respond_to?(part) and ['size', 'first', 'last'].include?(part)
object = object.send(part.intern).to_liquid
# No key was present with the desired value and it wasn't one of the directly supported
# keywords either. The only thing we got left is to return nil
else
return nil
end
# If we are dealing with a drop here we have to
object.context = self if object.respond_to?(:context=)
end
end
object
end # variable
def lookup_and_evaluate(obj, key)
if (value = obj[key]).is_a?(Proc) && obj.respond_to?(:[]=)
obj[key] = (value.arity == 0) ? value.call : value.call(self)
else
value
end
end # lookup_and_evaluate
def squash_instance_assigns_with_environments
@scopes.last.each_key do |k|
@environments.each do |env|
if env.has_key?(k)
scopes.last[k] = lookup_and_evaluate(env, k)
break
end
end
end
end # squash_instance_assigns_with_environments
end # Context
end # Liquid
|
redlinesoftware/liquid_cms
|
lib/generators/liquid_cms/templates/vendor/plugins/liquid/lib/liquid/context.rb
|
Ruby
|
mit
| 7,207
|
<?php
/**
* Created by PhpStorm.
* User: Jordan
* Date: 04/07/14
* Time: 3:54 PM.
*/
return [
/*
|--------------------------------------------------------------------------
| Absolute path to location where parsed swagger annotations will be stored
|--------------------------------------------------------------------------
*/
'doc-dir' => storage_path().'/docs',
/*
|--------------------------------------------------------------------------
| Relative path to access parsed swagger annotations.
|--------------------------------------------------------------------------
*/
'doc-route' => 'swagger/json',
/*
|--------------------------------------------------------------------------
| Relative path to access swagger ui.
|--------------------------------------------------------------------------
*/
'api-docs-route' => 'swagger/ui',
/*
|--------------------------------------------------------------------------
| Absolute path to directory containing the swagger annotations are stored.
|--------------------------------------------------------------------------
*/
'app-dir' => 'app',
/*
|--------------------------------------------------------------------------
| Absolute path to directories that you would like to exclude from swagger generation
|--------------------------------------------------------------------------
*/
'excludes' => [
storage_path(),
base_path().'/tests',
base_path().'/resources/views',
base_path().'/config',
base_path().'/vendor',
],
/*
|--------------------------------------------------------------------------
| Turn this off to remove swagger generation on production
|--------------------------------------------------------------------------
*/
'generateAlways' => false,
'api-key' => 'auth_token',
/*
|--------------------------------------------------------------------------
| Edit to set the api's version number
|--------------------------------------------------------------------------
*/
'default-api-version' => 'v1',
/*
|--------------------------------------------------------------------------
| Edit to set the swagger version number
|--------------------------------------------------------------------------
*/
'default-swagger-version' => '2.0',
/*
|--------------------------------------------------------------------------
| Edit to set the api's base path
|--------------------------------------------------------------------------
*/
'default-base-path' => '',
/*
|--------------------------------------------------------------------------
| Edit to trust the proxy's ip address - needed for AWS Load Balancer
|--------------------------------------------------------------------------
*/
'behind-reverse-proxy' => false,
/*
|--------------------------------------------------------------------------
| Uncomment to add response headers when swagger is generated
|--------------------------------------------------------------------------
*/
/*"viewHeaders" => array(
'Content-Type' => 'text/plain'
),*/
/*
|--------------------------------------------------------------------------
| Uncomment to add request headers when swagger performs requests
|--------------------------------------------------------------------------
*/
/*"requestHeaders" => array(
'TestMe' => 'testValue'
),*/
];
|
jeevad/pm-university
|
config/swaggervel.php
|
PHP
|
mit
| 3,700
|
//
// UIScrollView+YXDExtension.h
// YXDExtensionDemo
//
// Copyright (c) 2015年 YangXudong. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, YXDLoadStatus) {
YXDLoadStatusLoading = 1,
YXDLoadStatusSuccess = 2,
YXDLoadStatusEmpty = 3,
YXDLoadStatusFailed = 4,
};
@interface UIScrollView (YXDExtension)
- (void)triggerLoading;
- (void)setStatusSuccess;
- (void)setStatusFail;
- (void)setStatusEmpty;
- (void)noticeFooterNoMoreData;
//无 pullLoadingBlock 时 此方法无效
- (void)addLoadStatusViewWithPullLoadingBlock:(dispatch_block_t)pullLoadingBlock footerLoadingBlock:(dispatch_block_t)footerLoadingBlock;
//仅 YXDLoadStatusEmpty 和 YXDLoadStatusFailed 有效
- (void)setTitle:(NSString *)title imageName:(NSString *)imageName forStatus:(YXDLoadStatus)status;
@end
|
smartdong/YXDExtension
|
YXDExtensionDemo/YXDExtensionDemo/YXDExtension/YXDUIKitExtension/UIScrollView+YXDExtension.h
|
C
|
mit
| 838
|
<?php
require_once 'conexion.php';
$idEvento = $_GET['idEvento'];
$idUsuario = $_GET['idUsuario'];
$sqlQuery = "CALL pa_buscar_evento_por_alumno" . "($idEvento,'$idUsuario')";
$result = $conexion->query($sqlQuery);
if(!$result)die('Sql query failed' . $conexion->error);
$eventInfo = array();
while($data = mysqli_fetch_assoc($result)) {
$eventInfo[] = $data;
}
echo json_encode($eventInfo);
?>
|
jleiva/magki
|
prototipo/services/buscar_evento_por_alumno.php
|
PHP
|
mit
| 424
|
<?php
/**
* @author: mix
* @date: 08.11.14
*/
namespace PhpParser;
class Helper
{
const DEFAULT_CACHEDIR = "~/.phpstruct";
const STRING_LEN = 12;
public static function buildTrace($trace) {
$lines = [["FILE", "LINE"]];
foreach ($trace as $codeline) {
$file = isset($codeline["file"]) ? ($codeline["file"] . ":" . $codeline["line"]) : "internal function";
$func = isset($codeline["class"]) ? ($codeline["class"] . $codeline["type"]) : "";
$func .= $codeline["function"];
$func .= "(";
$args = [];
foreach ($codeline["args"] as $argument) {
if (is_object($argument)) {
$arg = get_class($argument);
if (method_exists($argument, "getId")) {
$arg .= "<" . $argument->getId() . ">";
}
} elseif (is_array($argument)) {
$arg = "array[" . count($argument) . "]";
} elseif (is_bool($argument)) {
$arg = $argument ? "TRUE" : "FALSE";
} elseif (is_string($argument)) {
$argument = preg_replace("/\033\[[0-9;]+m/", "", $argument);
if (mb_strlen($argument) > self::STRING_LEN) {
$arg = str_replace("\n", "\\n", mb_strcut($argument, 0, self::STRING_LEN - 1)) . "…";
}
} else {
$arg = $argument;
}
$args[] = $arg;
}
$func .= implode(",", $args);
$func .= ")";
$lines[] = [$file, $func];
}
$length = [];
foreach ($lines as $row) {
foreach ($row as $i => $item) {
if (!isset($length[$i])) {
$length[$i] = 0;
}
$length[$i] = max($length[$i], mb_strlen($item));
}
}
$out = "";
foreach ($lines as $line) {
foreach ($line as $i => $item) {
$out .= $item;
for ($j = mb_strlen($item); $j < $length[$i]; $j++) {
$out .= " ";
}
$out .= " ";
}
$out .= "\n";
}
return "\nTrace:\n" . $out;
}
public static function getTrace() {
$trace = debug_backtrace(1);
return self::buildTrace($trace);
}
public static function exception(\Exception $e) {
echo "\nUncaught " . get_class($e) . " exception with messge: " .
$e->getMessage() . " at " . $e->getFile() . ":" . $e->getLine() .
self::buildTrace($e->getTrace()) . "\n";
}
public function error($errno, $errstr, $errfile, $errline) {
$errLevel = "Unknown[{$errno}]";
switch ($errno) {
case E_NOTICE :
$errLevel = "Notice";
break;
case E_WARNING :
$errLevel = "Warning";
break;
case E_RECOVERABLE_ERROR :
$errLevel = "Catchable Fatal Error";
break;
case E_STRICT :
$errLevel = "Strict Error";
break;
}
$msg = "[$errLevel] $errstr at $errfile:$errline\n";
$trace = debug_backtrace(1);
array_shift($trace);
$msg .= self::buildTrace($trace);
echo $msg . "\n";
if (in_array($errno, [E_RECOVERABLE_ERROR])) {
exit();
}
}
public static function mkdir($dir){
if(!file_exists($dir)) {
mkdir($dir, 0777, true);
}
}
public static function getFulPath($filename) {
if ($filename[0] == "~") {
$filename = $_ENV["HOME"] . ltrim($filename, "~");
}
return $filename;
}
}
|
mipxtx/phpstruct
|
lib/PhpParser/Helper.php
|
PHP
|
mit
| 3,891
|
// saskavi.js
// client side script for calling saskavi functions
//
(function() {
"use strict";
var Saskavi = function(fbRoot, uid) {
if (!uid)
throw new Error("uid not supplied, an authenticated user id is required");
this.rpcBus = fbRoot.child("__saskavi-rpc").child(uid);
};
function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}
Saskavi.prototype.call = function() {
var params = Array.prototype.slice.call(arguments, 0);
var funcName = params[0];
if (!isFunction(params[params.length - 1]))
throw new Error("Callback function as last parameter is required, promises may come soon");
var cb = params[params.length - 1];
console.log(params);
var ps = params.slice(1, params.length - 1);
console.log(ps);
var rpcData = {
"function": funcName,
"args": ps
};
var rpcRef = this.rpcBus.push(rpcData);
var resultRef = rpcRef.child('result');
resultRef.on('value', function(snapshot) {
if (snapshot !== null && snapshot.val() !== null) {
resultRef.off('value');
cb(null, snapshot.val());
}
});
};
window.Saskavi = Saskavi;
})();
|
saskavi/saskavi
|
examples/post-to-slack/client/saskavi.js
|
JavaScript
|
mit
| 1,201
|
function checkNeighbours(arr, i) {
var result,
inputArray,
position;
if (arr == null) {
inputArray = document.getElementById('numbersArray2').value.split(' '),
position = +document.getElementById('num6').value;
} else {
inputArray = arr,
position = i;
}
if ((position === 0 || position === inputArray.length) && arr == null) {
result = 'Not enough neighbours!';
document.getElementById('result6').innerHTML = result;
return result;
}
if ((+inputArray[position] > +inputArray[position - 1]) && (+inputArray[position] > +inputArray[position + 1])) result = true;
else result = false;
if (arr == null) document.getElementById('result6').innerHTML = result;
return result;
}
|
mdraganov/Telerik-Academy
|
Java Script/JavaScript Fundmentals/Functions/Functions/06.Larger than neighbours.js
|
JavaScript
|
mit
| 793
|
SHELL = /bin/bash
.SUFFIXES:
.SECONDARY:
VPATH=..
CC = gcc
CFLAGS = -I../../include -I.. -g3 -fPIC -std=gnu11 -pedantic -Wall -O0
TESTINT = test_internal
TESTSHR = test_shared
TESTQ = test_shrq
TESTMAP = test_shrmap
TESTS = $(TESTINT) $(TESTSHR) $(TESTQ) $(TESTMAP)
LIB = -lrt -lpthread
check: checkshr64 checkint64 checkq64
checkq64: CFLAGS += -mcx16 ../shared_int.o ../shared.o ../shared_q.o -o $(TESTQ)
checkq64: clean test_shrq
./$(TESTQ)
checkint64: CFLAGS += -mcx16 ../shared_int.o -o $(TESTINT)
checkint64: clean test_internal
./$(TESTINT)
checkshr64: CFLAGS += -mcx16 ../shared.o -o $(TESTSHR)
checkshr64: clean test_shared
./$(TESTSHR)
checkq32: CFLAGS += -m32 ../shared_int.o ../shared.o ../shared_q.o -o $(TESTQ)
checkq32: clean test_shrq
./$(TESTQ)
checkint32: CFLAGS += -m32 ../shared_int.o -o $(TESTINT)
checkint32: clean test_internal
./$(TESTINT)
checkshr32: CFLAGS += -m32 ../shared.o -o $(TESTSHR)
checkshr32: clean test_shared
./$(TESTSHR)
%: %.c
@$(CC) $< $(CFLAGS) $(LIB)
clean:
@if test -f core*; then \
@rm core*; \
fi
@rm -f -- $(TESTS)
.PHONY: clean checkint64 checkint32 checkshr64 checkshr32 checkq64 checkq32
|
bkarr/libshr
|
src/test/Makefile
|
Makefile
|
mit
| 1,158
|
h1 {
color: #369;
font-size: 250%;
}
body {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
}
.menu {
font-size: 16pt;
}
.menu a, .menu a:active, .menu a:hover, .menu a:visited, .menu a:link {
text-decoration: none;
width: 200px;
color: #555;
border-bottom: 1px blue solid;
display: inline-block;
margin: 10px;
}
ul, ol {
text-align: left;
width: auto;
display: inline-block;
}
|
RalfNieuwenhuizen/angular-demo
|
styles.css
|
CSS
|
mit
| 423
|
{ :'zgh_MA' => { :i18n => { :plural => { :keys => nil, :rule => } } } }
|
meedan/check-api
|
data/zgh-MA/plurals.rb
|
Ruby
|
mit
| 72
|
<input type='text' ng-model="username" style="width:800px" class='form-control' placeholder='Username or Email'></input>
<br/>
<br/>
<input type='password' ng-model="password" style="width:800px" class='form-control' placeholder='Password'></input>
<br/>
<p class="alert alert-danger" ng-show="alert.error" ng-bind="alert.error"></p>
<br/>
<button type='button' ng-click="login(username, password)" class='btn btn-primary'>Sign In</button>
<button type='button' class='btn btn-primary' ui-sref="^.forgotPassword">
Forgot Password
</button>
<button type='button' style="float:right" class='btn btn-primary' ui-sref="^.signup">
New User
</button>
|
tkaplan/apollo
|
public/ap-views/login.html
|
HTML
|
mit
| 646
|
package smtp
import (
"net/smtp"
qlang "qlang.io/spec"
)
// Exports is the export table of this module.
//
var Exports = map[string]interface{}{
"_name": "net/smtp",
"sendMail": smtp.SendMail,
"CRAMMD5Auth": smtp.CRAMMD5Auth,
"plainAuth": smtp.PlainAuth,
"Client": qlang.StructOf((*smtp.Client)(nil)),
"client": smtp.NewClient,
"dial": smtp.Dial,
"ServerInfo": qlang.StructOf((*smtp.ServerInfo)(nil)),
}
|
yuanlixg/qlang
|
qlang/net/smtp/smtp.go
|
GO
|
mit
| 436
|
//////////////////////////////////////////////////////////////////////////////
//
// Copyright 2012 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
//
//////////////////////////////////////////////////////////////////////////////
//
// Name: AcEdSteeringWheel.h
//
// Description:
//
///////////////////////////////////////////////////////////////////////////////
#pragma once
#include "acgs.h"
#include "dbNavSettings.h"
class AcEdSteeringWheelReactor;
class AcEdSteeringWheel;
AcEdSteeringWheel* acedCreateSteeringWheel ();
void acedDestroySteeringWheel(AcEdSteeringWheel* pWheel);
///////////////////////////////////////////////////////////////////////////////
//
// Interface AcEdSteeringWheel
//
class AcEdSteeringWheel
{
public:
enum WheelType
{
kExterior = 0, ///< View Object Wheel.
kInterior, ///< Tour Buiding Wheel.
kFull, ///< Full Navigation Wheel.
k2D, ///< 2D Steering Wheel.
kMini, ///< Mini View Object Wheel.
kMiniOther, ///< Mini Tour Building Wheel.
kMiniEight, ///< Mini Full Navigation Wheel.
kTotalCount, ///< Total number of SteeringWheel types.
kWheelNone ///< Marks a disabled SteeringWheel.
};
enum MenuType
{
// Steering Wheel Menus
kMenuNone = 0,
kMenuInterior,
kMenuExterior,
kMenuFull,
kMenu2D
};
// Message handlers
virtual void onKeyDown (UINT nChar, UINT nRepCount, UINT nFlags) = 0;
virtual void onKeyUp (UINT nChar, UINT nRepCount, UINT nFlags) = 0;
virtual bool onMouseWheel (UINT nFlags, short zDelta, POINT pt) = 0;
virtual void onMouseMove (UINT nFlags, POINT pt) = 0;
virtual void onLButtonUp (UINT nFlags, POINT pt) = 0;
virtual void onLButtonDown (UINT nFlags, POINT pt) = 0;
virtual void onRButtonUp (UINT nFlags, POINT pt) = 0;
virtual void onRButtonDown (UINT nFlags, POINT pt) = 0;
virtual void onMButtonDown (UINT nFlags, POINT pt) = 0;
virtual void onMButtonUp (UINT nFlags, POINT pt) = 0;
virtual void setHomeCamera (const AcDbHomeView& home) = 0;
virtual bool setLargeWheelOpacity (int nOpacity) = 0;
virtual int getLargeWheelOpacity () = 0;
virtual bool setMiniWheelOpacity (int nOpacity) = 0;
virtual int getMiniWheelOpacity () = 0;
virtual bool setWalkSpeed(double speed) = 0;
virtual double getWalkSpeed() = 0;
virtual bool setActiveWheel(WheelType type) = 0;
virtual WheelType getActiveWheel() = 0;
virtual void enableWheel (bool enable) = 0;
virtual bool isWheelEnabled() = 0;
virtual AcGsModel * getModel() = 0;
virtual AcGsView * getView() = 0;
virtual HWND getDeviceHandle() = 0;
virtual bool attachView (HWND hDevice, AcGsView* pGsView) = 0;
virtual void detachView () = 0;
virtual void addReactor (AcEdSteeringWheelReactor* pReactor) = 0;
virtual void removeReactor(AcEdSteeringWheelReactor* pReactor) = 0;
};
///////////////////////////////////////////////////////////////////////////////
//
// Interface AcEdSteeringWheelReactor
//
class AcEdSteeringWheelReactor
{
public:
virtual void modifyContextMenu(HMENU hMenu) = 0;
virtual void onSetCursor(HCURSOR hCursor) = 0;
virtual void onBeginOperation() = 0;
virtual void onEndOperation() = 0;
virtual void onBeginShot() = 0;
virtual void onEndShot() = 0;
virtual void onClose() = 0;
};
|
kevinzhwl/ObjectARXCore
|
2013/inc/AcEdSteeringWheel.h
|
C
|
mit
| 3,925
|
{\footnotesize\renewcommand{\arraystretch}{1.5}
\begin{tabular}{@{}p{1.2cm}|p{1.3cm}@{}p{0.8cm}@{}|p{1.3cm}@{}p{0.8cm}@{}|p{1.3cm}@{}p{0.8cm}@{}|p{1.3cm}@{}p{0.8cm}@{}}
form & agent 1 & & agent 2 & & agent 3 & & agent 4 & \\
\hline
\textit{"sidigu"} & \texttt{c-8}
\texttt{c-5}
\texttt{c-3}
\texttt{c-6} & 0.68
0.59
0.57
0.48 & \texttt{c-8}
\texttt{c-5}
\texttt{c-3}
\texttt{c-6} & 0.60
0.57
0.55
0.33 & \texttt{c-5}
\texttt{c-8}
\texttt{c-3}
\texttt{c-6} & 0.66
0.63
0.59
0.46 & \texttt{c-8}
\texttt{c-5}
\texttt{c-3}
\texttt{c-6}
\texttt{c-2} & 0.73
0.68
0.50
0.43
0.16\\
\hline
\textit{"wefugu"} & \texttt{c-7}
\texttt{c-8}
\texttt{c-1} & 0.60
0.56
0.21 & \texttt{c-7}
\texttt{c-8}
\texttt{c-4}
\texttt{c-2}
\texttt{c-1} & 0.64
0.51
0.44
0.36
0.32 & \texttt{c-4}
\texttt{c-2}
\texttt{c-8}
\texttt{c-7}
\texttt{c-1} & 0.59
0.46
0.45
0.45
0.26 & \texttt{c-8}
\texttt{c-7}
\texttt{c-4}
\texttt{c-2}
\texttt{c-1} & 0.55
0.53
0.46
0.40
0.13\\
\hline
\textit{"vufaxe"} & \texttt{c-5}
\texttt{c-9} & 0.80
0.44 & \texttt{c-5}
\texttt{c-9}
\texttt{c-12} & 0.77
0.73
0.27 & \texttt{c-5}
\texttt{c-9}
\texttt{c-12} & 0.84
0.67
0.29 & \texttt{c-9}
\texttt{c-5}
\texttt{c-12} & 0.74
0.72
0.22\\
\hline
\textit{"bivura"} & \texttt{c-3}
\texttt{c-5}
\texttt{c-6}
\texttt{c-8}
\texttt{c-7} & 0.53
0.53
0.51
0.38
0.31 & \texttt{c-3}
\texttt{c-7}
\texttt{c-5}
\texttt{c-6}
\texttt{c-8} & 0.70
0.64
0.55
0.54
0.48 & \texttt{c-3}
\texttt{c-5}
\texttt{c-7}
\texttt{c-8}
\texttt{c-6} & 0.67
0.67
0.37
0.32
0.31 & \texttt{c-5}
\texttt{c-3}
\texttt{c-6}
\texttt{c-8}
\texttt{c-7} & 0.61
0.58
0.50
0.36
0.29\\
\hline
\textit{"rotapo"} & \texttt{c-2}
\texttt{c-5} & 0.80
0.53 & \texttt{c-2}
\texttt{c-5} & 0.83
0.54 & \texttt{c-2}
\texttt{c-5}
\texttt{c-3} & 0.86
0.46
0.03 & \texttt{c-2}
\texttt{c-5} & 0.82
0.54
\end{tabular}}
|
martin-loetzsch/phd-thesis
|
figures/sfwm-lexicon-forms-5000.tex
|
TeX
|
mit
| 1,920
|
<?php
namespace SkeletonInterceptor;
use
Aop\Aop,
Aop\Weaver\Interceptor,
Aop\Advice\AdviceInterface,
Aop\Pointcut\PointcutInterface
;
/**
* @see \Aop\Weaver\Interceptor
*/
class SkeletonInterceptor extends Interceptor
{
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::isEnabled()
*/
public function isEnabled($index = null, $selector = null)
{
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::enable()
*/
public function enable($index = null, $selector = null)
{
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::disable()
*/
public function disable($index = null, $selector = null)
{
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::getPointcut()
*/
public function getPointcut($index)
{
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::getIndexOfSelector()
*/
public function getIndexOfSelector($selector, $status = WeaverInterface::ENABLE)
{
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::addBefore()
*/
public function addBefore(Pointcutinterface $pointcut, AdviceInterface $advice,
array $options = [])
{
// assign the index of this
$this->lastIndex++;
// your code here
// ...
return $this->lastIndex;
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::addAround()
*/
public function addAround(Pointcutinterface $pointcut, AdviceInterface $advice,
array $options = [])
{
// assign the index of this
$this->lastIndex++;
// your code here
// ...
return $this->lastIndex;
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::addAfter()
*/
public function addAfter(Pointcutinterface $pointcut, AdviceInterface $advice,
array $options = [])
{
// assign the index of this
$this->lastIndex++;
// your code here
// ...
return $this->lastIndex;
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::addAfterThrow()
*/
public function addAfterThrow(PointcutInterface $pointcut, AdviceInterface $advice,
array $options = [])
{
// assign the index of this
$this->lastIndex++;
// your code here
// ...
return $this->lastIndex;
}
/**
* @inheritdoc
* @see \Aop\Weaver\WeaverInterface::addAfterReturn()
*/
public function addAfterReturn(PointcutInterface $pointcut, AdviceInterface $advice,
array $options = [])
{
// assign the index of this
$this->lastIndex++;
// your code here
// ...
return $this->lastIndex;
}
}
|
aop-io/skeleton-interceptor
|
src/SkeletonInterceptor/SkeletonInterceptor.php
|
PHP
|
mit
| 2,972
|
<header id="site-header">
<div class="wrapper">
<a class="home" href="{{> src source='/'}}"><img class="logo" src="{{> src source='/images/logo.png'}}"></a>
<div id="subline">JavaScript Utility Library</div>
<nav id="site-nav">
<a href="#" class="menu-icon">
<svg viewBox="0 0 18 15">
<path fill="#424242"
d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"></path>
<path fill="#424242"
d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"></path>
<path fill="#424242"
d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"></path>
</svg>
</a>
<div class="trigger">
<a class="page-link" href="{{> src source='/docs/4.6.1/-_.html'}}">Documentation</a>
</div>
</nav>
</div>
</header>
|
justinhelmer/lodash.github.io
|
source/partials/header.html
|
HTML
|
mit
| 1,143
|
/*Owner & Copyrights: Vance King Saxbe. A.*//*Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxbe@yahoo.com. Development teams from Power Dominion Enterprise, Precieux Consulting. Project sponsored by GoldSax Foundation, GoldSax Group and executed by GoldSax Manager.*/
/*
$quote = file_get_contents('http://finance.google.co.uk/finance/info?client=ig&q=NYSE:MTW');
$avgp = "19.14";
$high = "19.44";
$low = "19.06";
$json = str_replace("\n", "", $quote);
$data = substr($json, 4, strlen($json) -5);
$json_output = json_decode($data, true);
echo "&L=".$json_output['l']."&N=MTW&";
$temp = file_get_contents("MTWTEMP.txt", "r");
*/
$json_output['l'] = file_get_contents('MTWLAST.txt');
$avgp = "19.14";
$high = "19.44";
$low = "19.06";
echo "&L=".$json_output['l']."&N=MTW&";
$temp = file_get_contents("MTWTEMP.txt", "r");
if ($json_output['l'] != $temp ) {
$mhigh = ($avgp + $high)/2;
$mlow = ($avgp + $low)/2;
$llow = ($low - (($avgp - $low)/2));
$hhigh = ($high + (($high - $avgp)/2));
$diff = $json_output['l'] - $temp;
$diff = number_format($diff, 2, '.', '');
$avgp = number_format($avgp, 2, '.', '');
if ( $json_output['l'] > $temp ) {
if ( ($json_output['l'] > $mhigh ) && ($json_output['l'] < $high)) { echo "&sign=au" ; }
if ( ($json_output['l'] < $mlow ) && ($json_output['l'] > $low)) { echo "&sign=ad" ; }
if ( $json_output['l'] < $llow ) { echo "&sign=as" ; }
if ( $json_output['l'] > $hhigh ) { echo "&sign=al" ; }
if ( ($json_output['l'] < $hhigh) && ($json_output['l'] > $high)) { echo "&sign=auu" ; }
if ( ($json_output['l'] > $llow) && ($json_output['l'] < $low)) { echo "&sign=add" ; }
//else { echo "&sign=a" ; }
$filedish = fopen("C:\wamp\www\malert.txt", "a+");
$write = fputs($filedish, "Manitowoc:".$json_output['l']. ":Moving up:".$diff.":".$high.":".$low.":".$avgp."\r\n");
fclose( $filedish );}
if ( $json_output['l'] < $temp ) {
if ( ($json_output['l'] >$mhigh) && ($json_output['l'] < $high)) { echo "&sign=bu" ; }
if ( ($json_output['l'] < $mlow) && ($json_output['l'] > $low)) { echo "&sign=bd" ; }
if ( $json_output['l'] < $llow ) { echo "&sign=bs" ; }
if ( $json_output['l'] > $hhigh ) { echo "&sign=bl" ; }
if ( ($json_output['l'] < $hhigh) && ($json_output['l'] > $high)) { echo "&sign=buu" ; }
if ( ($json_output['l'] > $llow) && ($json_output['l'] < $low)) { echo "&sign=bdd" ; }
// else { echo "&sign=b" ; }
$filedish = fopen("C:\wamp\www\malert.txt", "a+");
$write = fputs($filedish, "Manitowoc:".$json_output['l']. ":Moving down:".$diff.":".$high.":".$low.":".$avgp."\r\n");
fclose( $filedish );}
$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$index = file_get_contents("SNP500LAST.txt");
$time = date('h:i:s',$new_time);
$filename= 'MTW.txt';
$file = fopen($filename, "a+" );
fwrite( $file, $json_output['l'].":".$index.":".$time."\r\n" );
fclose( $file );
if (($json_output['l'] > $mhigh ) && ($temp<= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Approaching:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $mhigh ) && ($temp>= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Moving Down:PHIGH:".$high.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $mlow ) && ($temp<= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Moving Up:PLOW:".$low.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $mlow ) && ($temp>= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Approaching:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $high ) && ($temp<= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Breaking:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $hhigh ) && ($temp<= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Moving Beyond:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $hhigh ) && ($temp>= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l']. ":Coming near:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $high ) && ($temp>= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l']. ":Retracing:PHIGH:".$high."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $llow ) && ($temp>= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Breaking Beyond:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $low ) && ($temp>= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Breaking:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $llow ) && ($temp<= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Coming near:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $low ) && ($temp<= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:". $json_output['l'].":Retracing:PLOW:".$low."\r\n");
fclose( $filedash );
}
if (($json_output['l'] > $avgp ) && ($temp<= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($json_output['l'] - $low) * (200000/$json_output['l']);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Sliding up:PAVG:".$avgp.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($json_output['l'] < $avgp ) && ($temp>= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $json_output['l']) * (200000/$json_output['l']);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "Manitowoc:".$json_output['l']. ":Sliding down:PAVG:".$avgp.":Short Cost:".$risk."\r\n");
fclose( $filedash );
}
}
$filedash = fopen("MTWTEMP.txt", "w");
$wrote = fputs($filedash, $json_output['l']);
fclose( $filedash );
//echo "&chg=".$json_output['cp']."&";
?>
/*email to provide support at vancekingsaxbe@powerdominionenterprise.com, businessaffairs@powerdominionenterprise.com, For donations please write to fundraising@powerdominionenterprise.com*/
|
VanceKingSaxbeA/NYSE-Engine
|
App/MTW.php
|
PHP
|
mit
| 10,342
|
/*
Copyright © 2019 Salt Edge. https://saltedge.com
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 com.saltedge.sdk.network;
import com.saltedge.sdk.SaltEdgeSDK;
import java.io.IOException;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
public class HeaderInterceptor implements Interceptor {
private String acceptType;
public HeaderInterceptor(String acceptType) {
this.acceptType = acceptType;
}
@Override
public Response intercept(Chain chain) throws IOException {
Request.Builder requestBuilder = chain.request().newBuilder()
.header(SEApiConstants.KEY_HEADER_CONTENT_TYPE, SEApiConstants.MIME_TYPE_JSON)
.header(SEApiConstants.KEY_HEADER_APP_ID, SaltEdgeSDK.getInstance().getAppId())
.header(SEApiConstants.KEY_HEADER_APP_SECRET, SaltEdgeSDK.getInstance().getAppSecret());
if (acceptType != null) {
requestBuilder.header(SEApiConstants.KEY_HEADER_ACCEPT, acceptType);
}
return chain.proceed(requestBuilder.build());
}
}
|
saltedge/saltedge-android
|
saltedge-library/src/main/java/com/saltedge/sdk/network/HeaderInterceptor.java
|
Java
|
mit
| 2,075
|
'use strict';
var $ = require('./main')
, getViewportRect = require('./get-viewport-rect')
, getElementRect = require('./get-element-rect');
module.exports = $.showInViewport = function (el/*, options*/) {
var vpRect = getViewportRect()
, elRect = getElementRect(el)
, options = Object(arguments[1])
, padding = isNaN(options.padding) ? 0 : Number(options.padding)
, elTopLeft = { x: elRect.left, y: elRect.top }
, elBottomRight = { x: elRect.left + elRect.width, y: elRect.top + elRect.height }
, vpTopLeft = { x: vpRect.left + padding, y: vpRect.top + padding }
, vpBottomRight = { x: vpRect.left + vpRect.width - padding,
y: vpRect.top + vpRect.height - padding }
, diffPoint = { x: 0, y: 0 }, diff;
if (elBottomRight.x > vpBottomRight.x) {
// right beyond
diff = elBottomRight.x - vpBottomRight.x;
elTopLeft.x -= diff;
elBottomRight.x -= diff;
diffPoint.x -= diff;
}
if (elBottomRight.y > vpBottomRight.y) {
// bottom beyond
diff = elBottomRight.y - vpBottomRight.y;
elTopLeft.y -= diff;
elBottomRight.y -= diff;
diffPoint.y -= diff;
}
if (elTopLeft.x < vpTopLeft.x) {
// left beyond
diff = vpTopLeft.x - elTopLeft.x;
elTopLeft.x += diff;
elBottomRight.x += diff;
diffPoint.x += diff;
}
if (elTopLeft.y < vpTopLeft.y) {
// top beyond
diff = vpTopLeft.y - elTopLeft.y;
elTopLeft.y += diff;
elBottomRight.y += diff;
diffPoint.y += diff;
}
if (diffPoint.x) el.style.left = (el.offsetLeft + diffPoint.x) + "px";
if (diffPoint.y) el.style.top = (el.offsetTop + diffPoint.y) + "px";
};
|
egovernment/eregistrations-demo
|
node_modules/mano-legacy/show-in-viewport.js
|
JavaScript
|
mit
| 1,587
|
<?php
declare(strict_types=1);
namespace IssetBV\PushNotification\Core;
use IssetBV\PushNotification\Core\Message\Message;
use IssetBV\PushNotification\Core\Message\MessageEnvelope;
use Psr\Log\LoggerAwareInterface;
/**
* Interface Notifier.
*/
interface Notifier extends LoggerAwareInterface
{
/**
* @param Message $message
* @param string $connectionName
*
* @return MessageEnvelope
*/
public function send(Message $message, string $connectionName = null): MessageEnvelope;
/**
* @param Message $message
* @param string|null $connectionName
*
* @return MessageEnvelope
*/
public function queue(Message $message, string $connectionName = null): MessageEnvelope;
/**
* @param Message $message
*
* @return bool
*/
public function handles(Message $message): bool;
/**
* Flushes the queue to the notifier queues.
*
* @param string $connectionName
*/
public function flushQueue(string $connectionName = null);
}
|
Isset/pushnotification
|
src/PushNotification/Core/Notifier.php
|
PHP
|
mit
| 1,039
|
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>{{page.title}}·The Tea Company</title>
<meta name="handheldfriendly" content="true">
<meta name="mobileoptimized" content="240">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,200italic,300italic,400italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Cedarville+Cursive' rel='stylesheet' type='text/css'>
<link href="{{site.baseurl}}/css/main.css" rel="stylesheet">
<link href="http://weloveiconfonts.com/api/?family=entypo" rel=stylesheet>
<link rel="shortcut icon" href="{{site.baseurl}}/favicon.ico">
<meta name="description" content="{{page.meta}}"
</head>
<body>
<header id="top" role="banner">
<div class="grid masthead">
<a class="logo-wrapper" href="{{site.baseurl}}/"><img src="{{site.baseurl}}/images/jbd-logo.svg" alt="The Tea Company" class="logo"></a>
</div>
<nav class="nav grid" role="navigation">
<a class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3 {% if page.url == '/about/'%}current{% endif %}" href="{{site.baseurl}}/about/">About</a>
<a class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3 {% if page.url contains'/tea/'%}current{% endif %}" href="{{site.baseurl}}/tea/">Tea</a>
<a class="unit gutter unit-s-1 unit-m-1-3 unit-l-1-3 {% if page.url == '/cart/'%}current{% endif %}" href="{{site.baseurl}}/cart/">Cart</a>
</nav>
<div class="grid search-background">
<div class="unit unit-s-1">
<form method="get" action="{{site.baseurl}}/search/" class="search-wrapper cf" role="search">
<input type="text" placeholder="Search here..." required>
<button type="submit">Search</button>
</form>
</div>
</div>
</header>
{% if page.showbanner %}
<div class="banner">
<h2>{{page.bannertext}}</h2>
</div>
{% endif %}
{{content}}
<footer class="footer" >
<div class="footer">
<div class="social"><a href="https://www.facebook.com"></a></div>
<div class="social"><a href="https://twitter.com"></a></div>
<div class="social"><a href="https://www.pinterest.com"></a></div>
</div>
<div class="content giga" role="contentinfo">
<a class="top" href="#top">Return to Top</a>
<p class="micro">© 2013 Samantha Nickerson.</p>
</div>
</footer>
</body>
</html>
|
samantha-nickerson/ecommerce-website
|
_layouts/default.html
|
HTML
|
mit
| 2,394
|
'use strict';
require('babel/register');
// controls application file
let app = require('app');
// control main window
let BrowserWindow = require('browser-window');
let mainWindow = null;
// quite when all windows are closed
app.on('window-all-closed', () => {
if (process.platform != 'darwin') {
app.quit();
}
});
// This is called when Electron is ready to create windows
app.on('ready', () => {
// create the main window
mainWindow = new BrowserWindow({ width: 800, height: 600 });
// load main file
mainWindow.loadUrl(`file://${__dirname}/index.html`);
// open dev tools
mainWindow.openDevTools();
// when the window is closed
mainWindow.on('close', () => {
// clean the window object for garbage collector
mainWindow = null;
});
});
|
flyingkrai/electron-angularjs
|
app/main.js
|
JavaScript
|
mit
| 790
|
from zang.exceptions.zang_exception import ZangException
from zang.configuration.configuration import Configuration
from zang.connectors.connector_factory import ConnectorFactory
from zang.domain.enums.http_method import HttpMethod
from docs.examples.credetnials import sid, authToken
url = 'https://api.zang.io/v2'
configuration = Configuration(sid, authToken, url=url)
sipDomainsConnector = ConnectorFactory(configuration).sipDomainsConnector
# view domain
try:
domain = sipDomainsConnector.viewDomain('TestDomainSid')
print(domain)
except ZangException as ze:
print(ze)
# list domains
try:
domains = sipDomainsConnector.listDomains()
print(domains.total)
except ZangException as ze:
print(ze)
# create domain
try:
domain = sipDomainsConnector.createDomain(
domainName='mydomain.com',
friendlyName='MyDomain',
voiceUrl='VoiceUrl',
voiceMethod=HttpMethod.POST,
voiceFallbackUrl='VoiceFallbackUrl',
voiceFallbackMethod=HttpMethod.GET)
print(domain.sid)
except ZangException as ze:
print(ze)
# update domain
try:
domain = sipDomainsConnector.updateDomain(
'TestDomainSid',
friendlyName='MyDomain3',
voiceUrl='VoiceUrl2',
voiceMethod=HttpMethod.POST,)
print(domain.voiceUrl)
except ZangException as ze:
print(ze)
# delete domain
try:
domain = sipDomainsConnector.deleteDomain('TestDomainSid')
print(domain.sid)
except ZangException as ze:
print(ze)
# list mapped credentials lists
try:
credentialsLists = sipDomainsConnector.listMappedCredentialsLists(
'TestDomainSid')
print(credentialsLists.total)
except ZangException as ze:
print(ze)
# map credentials list
try:
credentialsList = sipDomainsConnector.mapCredentialsLists(
'TestDomainSid', 'TestCredentialsListSid')
print(credentialsList.credentialsCount)
except ZangException as ze:
print(ze)
# delete mapped credentials list
try:
credentialsList = sipDomainsConnector.deleteMappedCredentialsList(
'TestDomainSid', 'TestCredentialsListSid')
print(credentialsList.friendlyName)
except ZangException as ze:
print(ze)
# list mapped ip access control lists
try:
aclLists = sipDomainsConnector.listMappedIpAccessControlLists(
'TestDomainSid')
print(aclLists.total)
except ZangException as ze:
print(ze)
# map ip access control list
try:
aclList = sipDomainsConnector.mapIpAccessControlList(
'TestDomainSid', 'TestIpAccessControlListSid')
print(aclList.credentialsCount)
except ZangException as ze:
print(ze)
# delete mapped ip access control list
try:
aclList = sipDomainsConnector.deleteMappedIpAccessControlList(
'TestDomainSid', 'TestIpAccessControlListSid')
print(aclList.friendlyName)
except ZangException as ze:
print(ze)
|
zang-cloud/zang-python
|
docs/examples/sip_domains_example.py
|
Python
|
mit
| 2,859
|
/* Welcome to Compass.
* In this file you should write your main styles. (or centralize your imports)
* Import this file using the following HTML or equivalent:
* <link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" /> */
/* line 17, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font: inherit;
font-size: 100%;
vertical-align: baseline;
}
/* line 22, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html {
line-height: 1;
}
/* line 24, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
ol, ul {
list-style: none;
}
/* line 26, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
table {
border-collapse: collapse;
border-spacing: 0;
}
/* line 28, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
caption, th, td {
text-align: left;
font-weight: normal;
vertical-align: middle;
}
/* line 30, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q, blockquote {
quotes: none;
}
/* line 103, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
q:before, q:after, blockquote:before, blockquote:after {
content: "";
content: none;
}
/* line 32, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
a img {
border: none;
}
/* line 116, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary {
display: block;
}
/* line 3, ../sass/header.scss */
header {
display: block;
width: 100%;
height: 90px;
position: fixed;
top: 0;
z-index: 500;
background: #313945;
transition: all 0.4s ease-in-out;
}
/* line 12, ../sass/header.scss */
header div.nav-container {
text-align: center;
padding: 24px 10px 7px;
}
/* line 16, ../sass/header.scss */
header img {
display: none;
width: 70px;
height: 70px;
margin-top: -13px;
margin-right: 2px;
transition: all 0.4s ease-in-out;
}
/* line 24, ../sass/header.scss */
header nav {
margin-top: -13px;
}
/* line 26, ../sass/header.scss */
header nav ul {
list-style: none;
transition: all 0.4s ease-in-out;
}
/* line 29, ../sass/header.scss */
header nav ul li {
display: block;
margin-bottom: 10px;
}
/* line 32, ../sass/header.scss */
header nav ul li a {
font-family: 'Lato', sans-serif;
font-weight: 400;
font-size: 15px;
letter-spacing: 2px;
color: #BBBBBB;
text-transform: uppercase;
-webkit-transition-property: all;
-moz-transition-property: all;
-o-transition-property: all;
transition-property: all;
-webkit-transition-duration: 0.5s;
-moz-transition-duration: 0.5s;
-o-transition-duration: 0.5s;
transition-duration: 0.5s;
}
/* line 43, ../sass/header.scss */
header nav ul li a:hover {
color: #2270b1;
}
/* line 47, ../sass/header.scss */
header nav ul li:nth-child(3) {
display: none;
}
/* line 48, ../sass/header.scss */
header nav ul li:nth-child(4) {
margin-bottom: 5px;
}
/* line 49, ../sass/header.scss */
header nav ul li:last-child {
margin-right: 0;
}
/* line 54, ../sass/header.scss */
section.scroller {
display: block;
height: 300px;
width: 100%;
position: relative;
top: 40px;
overflow: hidden;
background: url(../img/bannermobile.jpg);
background-position: 2250px 0px;
}
/* line 3, ../sass/mainbody.scss */
body {
background: #F0F0F0;
}
/* line 7, ../sass/mainbody.scss */
a {
text-decoration: none;
}
/* line 11, ../sass/mainbody.scss */
.mainbody {
position: relative;
margin-top: 40px;
display: block;
}
/* line 17, ../sass/mainbody.scss */
.hero {
padding: 20px 0 20px 0;
width: 100%;
background: #e3e1e1;
}
/* line 23, ../sass/mainbody.scss */
#hero-text {
display: block;
width: 80%;
margin-right: auto;
margin-left: auto;
text-align: center;
font-family: 'Raleway' sans-serif;
font-size: 21px;
font-weight: 300;
line-height: 35px;
color: #8e99a1;
}
/* line 36, ../sass/mainbody.scss */
div.socialise {
width: 100%;
text-align: center;
margin-top: 30px;
}
/* line 42, ../sass/mainbody.scss */
span.socialiseheader {
font-family: 'Montserrat' sans-serif;
font-weight: bold;
font-size: 48px;
letter-spacing: 1px;
text-transform: uppercase;
color: #313945;
padding-bottom: 15px;
border-bottom: 2px solid #e3e1e1;
-webkit-font-smoothing: antialiased;
}
/* line 54, ../sass/mainbody.scss */
div.iconwrapper {
margin-top: 50px;
margin-bottom: 100px;
}
/* line 59, ../sass/mainbody.scss */
div.iconcontainer {
width: 200px;
height: 200px;
margin-left: auto;
margin-right: auto;
margin-top: 30px;
margin-bottom: 30px;
display: block;
}
/* line 69, ../sass/mainbody.scss */
#iconY, #iconY:hover, #iconG, #iconG:hover, #iconT, #iconT:hover {
background: url(../img/sprites.png) no-repeat;
}
/* line 73, ../sass/mainbody.scss */
#iconY {
background-position: 0 0;
}
/* line 77, ../sass/mainbody.scss */
#iconY:hover {
background-position: 0 -250px;
}
/* line 81, ../sass/mainbody.scss */
#iconG {
background-position: 0 -500px;
}
/* line 85, ../sass/mainbody.scss */
#iconG:hover {
background-position: 0 -750px;
}
/* line 89, ../sass/mainbody.scss */
#iconT {
background-position: 0 -1000px;
}
/* line 93, ../sass/mainbody.scss */
#iconT:hover {
background-position: 0 -1250px;
}
@media screen and (min-width: 480px) {
/* line 4, ../sass/mediaqueries.scss */
#hero-text {
width: 70%;
font-size: 22px;
}
/* line 9, ../sass/mediaqueries.scss */
span.socialiseheader {
font-size: 60px;
}
}
@media screen and (min-width: 600px) {
/* line 16, ../sass/mediaqueries.scss */
header nav ul {
padding-top: 26px;
}
/* line 18, ../sass/mediaqueries.scss */
header nav ul li {
display: inline;
margin-right: 25px;
}
/* line 21, ../sass/mediaqueries.scss */
header nav ul li a {
font-size: 17px;
}
/* line 26, ../sass/mediaqueries.scss */
section.scroller {
height: 380px;
background: url(../img/banner.jpg);
background-position: 850px 0px;
}
/* line 32, ../sass/mediaqueries.scss */
.hero {
padding: 30px 0 30px 0;
}
/* line 36, ../sass/mediaqueries.scss */
#hero-text {
width: 70%;
font-size: 23px;
line-height: 40px;
}
/* line 42, ../sass/mediaqueries.scss */
span.socialiseheader {
font-size: 90px;
line-height: 80px;
}
}
@media screen and (min-width: 700px) {
/* line 51, ../sass/mediaqueries.scss */
div.iconwrapper {
width: 640px;
margin-right: auto;
margin-left: auto;
}
/* line 57, ../sass/mediaqueries.scss */
div.iconcontainer {
display: inline-block;
margin-left: 2px;
margin-right: 2px;
}
}
@media screen and (min-width: 850px) {
/* line 66, ../sass/mediaqueries.scss */
header.tiny {
height: 40px;
}
/* line 70, ../sass/mediaqueries.scss */
header.tiny nav ul {
padding-top: 1px;
}
/* line 74, ../sass/mediaqueries.scss */
header.tiny img {
height: 0px;
width: 0px;
}
/* line 79, ../sass/mediaqueries.scss */
header img {
float: right;
display: inline;
}
/* line 84, ../sass/mediaqueries.scss */
header nav {
display: inline;
float: left;
}
/* line 88, ../sass/mediaqueries.scss */
header nav ul {
margin-left: 10px;
}
/* line 93, ../sass/mediaqueries.scss */
header nav ul li:nth-child(3) {
display: inline;
}
/* line 94, ../sass/mediaqueries.scss */
header nav ul li:first-child {
margin-left: 25px;
}
/* line 96, ../sass/mediaqueries.scss */
div.iconwrapper {
width: 810px;
}
/* line 100, ../sass/mediaqueries.scss */
div.iconcontainer {
margin-left: 30px;
margin-right: 30px;
}
}
@media (min-width: 1200px) {
/* line 106, ../sass/mediaqueries.scss */
section.scroller {
background-position: 0px 0px;
}
}
|
TomRich/rw-parallax
|
stylesheets/screen.css
|
CSS
|
mit
| 8,899
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as _ from 'vs/base/parts/tree/browser/tree';
export function isEqualOrParent(tree: _.ITree, element: any, candidateParent: any): boolean {
const nav = tree.getNavigator(element);
do {
if (element === candidateParent) {
return true;
}
} while (element = nav.parent());
return false;
}
|
mjbvz/vscode
|
src/vs/base/parts/tree/browser/treeUtils.ts
|
TypeScript
|
mit
| 660
|
package com.github.gquintana.beepbeep.script;
import com.github.gquintana.beepbeep.file.YamlFileScriptStore;
import com.github.gquintana.beepbeep.store.MemoryScriptStore;
import com.github.gquintana.beepbeep.store.ScriptStore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import java.io.File;
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
public class ScriptStoresTest {
@Rule
public final TemporaryFolder temporaryFolder = new TemporaryFolder();
@Test
public void testMemory() {
// When
ScriptStore store1 = ScriptStores.scheme("mem:test");
ScriptStore store2 = ScriptStores.scheme("mem:test");
ScriptStore store3 = ScriptStores.scheme("mem:other");
// Then
assertThat(store1).isInstanceOf(MemoryScriptStore.class);
assertThat(store1).isEqualTo(store2);
assertThat(store1).isNotEqualTo(store3);
}
@Test
public void testFile() throws IOException {
// Given
File yamlFile = temporaryFolder.newFile("store.yml");
// When
ScriptStore store = ScriptStores.scheme(yamlFile.toURI().toString());
// Then
assertThat(store).isInstanceOf(YamlFileScriptStore.class);
}
}
|
gquintana/beepbeep
|
src/test/java/com/github/gquintana/beepbeep/script/ScriptStoresTest.java
|
Java
|
mit
| 1,293
|
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vegvesen.Storage;
namespace Vegvesen.Client.Console
{
class Program
{
private const string DataDir = @"H:\Documents\Projects\Git\MilesDatex\Data";
private static string ConnectionString;
static void Main(string[] args)
{
ConnectionString = ConfigurationManager.ConnectionStrings["VegvesenDatex"].ConnectionString;
foreach (var serviceUrl in VegvesenClient.ServiceUrls.Values)
{
RequestAsync(serviceUrl);
Task.Delay(60000 / VegvesenClient.ServiceUrls.Count).Wait();
}
System.Console.ReadKey();
}
static async void RequestAsync(string serviceUrl)
{
while (true)
{
try
{
var storage = new VegvesenFileStorage(DataDir);
var lastModified = await storage.GetLastModifiedTime(serviceUrl);
var client = new VegvesenClient(ConnectionString);
var result = await client.GetDataAsStreamAsync(serviceUrl, lastModified);
if (result.Content != null)
{
System.Console.WriteLine("Saving updates for {0} since {1}...", serviceUrl, result.LastModified);
await storage.SaveEntryDataAsync(serviceUrl, result.Content, result.LastModified.Value);
System.Console.WriteLine("Updates for {0} are saved.", serviceUrl);
}
else
{
System.Console.WriteLine("No updates for {0}.", serviceUrl);
}
}
catch (Exception exception)
{
System.Console.WriteLine("Error in {0}: {1}", serviceUrl, exception.Message);
}
await Task.Delay(60000);
}
}
}
}
|
miles-no/datex-azure
|
Vegvesen.Client.Console/Program.cs
|
C#
|
mit
| 2,146
|
# dom-observer [](https://travis-ci.org/jide/dom-observer)
[](https://saucelabs.com/u/empty)
Observe DOM changes
## Getting Started
### Install
```
$ npm install dom-observer
```
### Usage
#### import module via browserify
```javascript
var aModule = require('dom-observer');
// by default, the generator scaffold a function as default module implementation
aModule();
```
#### import the old school style
just import the `lib/index.js` script
### Example
Install and build the example
```
npm run build-example
```
Open example/index.html in your favorite browser
### Test module
Build tests with
```
npm run build-test
```
Then open `test/index.html` to run the tests.
Test module on saucelabs with mocha
```
npm test
```
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
|
jide/dom-observer
|
README.md
|
Markdown
|
mit
| 963
|
<?php
use PHPUnit\Framework\TestCase;
use QMVC\Base\Routing\Route;
use QMVC\Base\Routing\Middleware;
class MiddlewareTest extends TestCase
{
public function testConstructor()
{
$routeCallback = function()
{
echo 'This is the route callback';
};
$route = new Route('/', [], $routeCallback);
$midwareCallback = function()
{
echo 'This is the middleware callback';
};
$midware = new Middleware($route->getHandler(), $midwareCallback);
$this->assertTrue($midware->getNext() === $routeCallback);
}
}
?>
|
infinityCounter/QMVC
|
Base/Tests/Routing/MiddlewareTest.php
|
PHP
|
mit
| 610
|
---
layout: post
date: 2017-02-28
title: "Jesús Peiró 6055"
category: Jesús Peiró
tags: [Jesús Peiró]
---
### Jesús Peiró 6055
Just **$389.99**
###
<table><tr><td>BRANDS</td><td>Jesús Peiró</td></tr></table>
<a href="https://www.readybrides.com/en/jesus-peiro/35595-jesus-peiro-6055.html"><img src="//img.readybrides.com/74535/jesus-peiro-6055.jpg" alt="Jesús Peiró 6055" style="width:100%;" /></a>
<!-- break --><a href="https://www.readybrides.com/en/jesus-peiro/35595-jesus-peiro-6055.html"><img src="//img.readybrides.com/74536/jesus-peiro-6055.jpg" alt="Jesús Peiró 6055" style="width:100%;" /></a>
<a href="https://www.readybrides.com/en/jesus-peiro/35595-jesus-peiro-6055.html"><img src="//img.readybrides.com/74534/jesus-peiro-6055.jpg" alt="Jesús Peiró 6055" style="width:100%;" /></a>
Buy it: [https://www.readybrides.com/en/jesus-peiro/35595-jesus-peiro-6055.html](https://www.readybrides.com/en/jesus-peiro/35595-jesus-peiro-6055.html)
|
novstylessee/novstylessee.github.io
|
_posts/2017-02-28-Jess-Peir-6055.md
|
Markdown
|
mit
| 1,026
|
//+build linux darwin
// File generated by 2goarray (http://github.com/cratonica/2goarray)
package main
var iconData []byte = []byte {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x48,
0x08, 0x06, 0x00, 0x00, 0x00, 0x55, 0xed, 0xb3, 0x47, 0x00, 0x00, 0x0e,
0xcf, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0xdc, 0x79, 0x50, 0xd4,
0x67, 0x9e, 0xc7, 0xf1, 0xa7, 0x0f, 0x4e, 0x41, 0x10, 0x51, 0x3c, 0x51,
0x82, 0x1a, 0x22, 0x4d, 0x03, 0x1e, 0x31, 0x18, 0x74, 0x74, 0xd4, 0x4d,
0xed, 0xd4, 0xcc, 0xce, 0xec, 0xd6, 0x4e, 0x6d, 0xed, 0x99, 0x6c, 0x0e,
0x63, 0x92, 0x19, 0x27, 0x99, 0x9d, 0x19, 0x0f, 0x04, 0xf1, 0x4a, 0x24,
0xf1, 0x4a, 0x62, 0xc6, 0x8c, 0x46, 0xe8, 0x6e, 0x9a, 0x43, 0x44, 0xf1,
0x40, 0x41, 0x8c, 0x21, 0x51, 0xd1, 0x44, 0x88, 0x42, 0x14, 0x93, 0x31,
0x8e, 0xc1, 0x93, 0xa6, 0xb9, 0x4c, 0x34, 0x51, 0xa3, 0xf8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 0xe1, 0x0c, 0x24, 0x9c, 0x41, 0xcb, 0x9b, 0x30, 0x64, 0x45, 0x13,
0x86, 0xbd, 0xda, 0x84, 0xe8, 0xd7, 0x9b, 0x11, 0x4d, 0x40, 0x23, 0x76,
0xdd, 0x45, 0xcc, 0xee, 0xbb, 0x78, 0x88, 0x8a, 0x55, 0x1b, 0x55, 0xea,
0x29, 0xb6, 0x54, 0x79, 0x8f, 0x7f, 0x3e, 0xba, 0x24, 0x07, 0x0f, 0x17,
0x3e, 0x8c, 0x31, 0x05, 0x63, 0x30, 0xba, 0x60, 0xb4, 0x02, 0x95, 0x17,
0x83, 0x11, 0x79, 0x23, 0x30, 0xdc, 0x3e, 0x9c, 0x90, 0x68, 0x9a, 0x6c,
0x34, 0x4d, 0xd6, 0x28, 0x44, 0x5a, 0x08, 0x29, 0x27, 0x02, 0x93, 0xaa,
0x43, 0x90, 0x52, 0x1b, 0x84, 0x49, 0xb5, 0x84, 0x74, 0xc2, 0x88, 0xf1,
0x27, 0xf4, 0x9d, 0x53, 0xc4, 0x0f, 0x31, 0xc2, 0xb9, 0x61, 0xae, 0x60,
0x33, 0xfe, 0xba, 0xbf, 0x2c, 0xe0, 0x42, 0xb2, 0xdf, 0x70, 0x21, 0x69,
0xa6, 0x47, 0x37, 0x6d, 0x2f, 0x8c, 0x3f, 0x2e, 0x83, 0xff, 0xcc, 0x72,
0xf8, 0xcf, 0xa9, 0x47, 0x40, 0x5a, 0x23, 0x82, 0x17, 0x35, 0x12, 0x4e,
0xa3, 0x82, 0x93, 0xc9, 0x71, 0x1c, 0x88, 0x5a, 0xe6, 0xc0, 0x60, 0xc2,
0x19, 0x4a, 0x38, 0xd1, 0xaf, 0x35, 0x61, 0xc4, 0xca, 0x26, 0xc4, 0xac,
0x72, 0x22, 0x66, 0x57, 0x87, 0x02, 0xc2, 0x37, 0x4f, 0x10, 0x63, 0xa8,
0x87, 0xd5, 0xe2, 0xd4, 0xdc, 0xff, 0xe7, 0x9f, 0xc5, 0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48, 0x00, 0x00, 0x00, 0x00,
0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
}
|
deet/picturelife-experimental-uploader
|
iconunix.go
|
GO
|
mit
| 23,871
|
<!--
Copyright 2005-2008 Adobe Systems Incorporated
Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
or a copy at http://stlab.adobe.com/licenses.html)
Some files are held under additional license.
Please see "http://stlab.adobe.com/licenses.html" for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<TITLE>Adobe Software Technology Lab: any_bidirectional_iterator_instance< V, R, D > Struct Template Reference</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=ISO-8859-1"/>
<LINK TYPE="text/css" REL="stylesheet" HREF="adobe_source.css"/>
<LINK REL="alternate" TITLE="stlab.adobe.com RSS" HREF="http://sourceforge.net/export/rss2_projnews.php?group_id=132417&rss_fulltext=1" TYPE="application/rss+xml"/>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
</head>
<body>
<div id='content'>
<table><tr>
<td colspan='5'>
<div id='opensource_banner'>
<table style='width: 100%; padding: 5px;'><tr>
<td align='left'>
<a href='index.html' style='border: none'><img src='stlab2007.jpg' alt="stlab.adobe.com"/></a>
</td>
<td align='right'>
<a href='http://www.adobe.com' style='border: none'><img src='adobe_hlogo.gif' alt="Adobe Systems Incorporated"/></a>
</td>
</tr></table>
</div>
</td></tr><tr>
<td valign="top">
<div id='navtable' height='100%'>
<div style='margin: 5px'>
<h4>Documentation</h4>
<a href="group__asl__overview.html">Overview</a><br/>
<a href="asl_readme.html">Building ASL</a><br/>
<a href="asl_toc.html">Documentation</a><br/>
<a href="http://stlab.adobe.com/wiki/index.php/Supplementary_ASL_Documentation">Library Wiki Docs</a><br/>
<a href="asl_indices.html">Indices</a><br/>
<a href="http://stlab.adobe.com/perforce/">Browse Perforce</a><br/>
<h4>More Info</h4>
<a href="asl_release_notes.html">Release Notes</a><br/>
<a href="http://stlab.adobe.com/wiki/">Wiki</a><br/>
<a href="asl_search.html">Site Search</a><br/>
<a href="licenses.html">License</a><br/>
<a href="success_stories.html">Success Stories</a><br/>
<a href="asl_contributors.html">Contributors</a><br/>
<h4>Media</h4>
<a href="http://sourceforge.net/project/showfiles.php?group_id=132417&package_id=145420">Download</a><br/>
<a href="asl_download_perforce.html">Perforce Depots</a><br/>
<h4>Support</h4>
<a href="http://sourceforge.net/projects/adobe-source/">ASL SourceForge Home</a><br/>
<a href="http://sourceforge.net/mail/?group_id=132417">Mailing Lists</a><br/>
<a href="http://sourceforge.net/forum/?group_id=132417">Discussion Forums</a><br/>
<a href="http://sourceforge.net/tracker/?atid=724218&group_id=132417&func=browse">Report Bugs</a><br/>
<a href="http://sourceforge.net/tracker/?atid=724221&group_id=132417&func=browse">Suggest Features</a><br/>
<a href="asl_contributing.html">Contribute to ASL</a><br/>
<h4>RSS</h4>
<a href="http://sourceforge.net/export/rss2_projnews.php?group_id=132417">Short-text news</a><br/>
<a href="http://sourceforge.net/export/rss2_projnews.php?group_id=132417&rss_fulltext=1">Full-text news</a><br/>
<a href="http://sourceforge.net/export/rss2_projfiles.php?group_id=132417">File releases</a><br/>
<h4>Other Adobe Projects</h4>
<a href="http://sourceforge.net/adobe/">Open @ Adobe</a><br/>
<a href="http://opensource.adobe.com/">Adobe Open Source</a><br/>
<a href="http://labs.adobe.com/">Adobe Labs</a><br/>
<a href="http://stlab.adobe.com/amg/">Adobe Media Gallery</a><br/>
<a href="http://stlab.adobe.com/performance/">C++ Benchmarks</a><br/>
<h4>Other Resources</h4>
<a href="http://boost.org">Boost</a><br/>
<a href="http://www.riaforge.com/">RIAForge</a><br/>
<a href="http://www.sgi.com/tech/stl">SGI STL</a><br/>
</div>
</div>
</td>
<td id='maintable' width="100%" valign="top">
<!-- End Header -->
<!-- Generated by Doxygen 1.7.2 -->
<div class="navpath">
<ul>
<li><a class="el" href="namespaceadobe.html">adobe</a> </li>
<li><a class="el" href="structadobe_1_1any__bidirectional__iterator__instance.html">any_bidirectional_iterator_instance</a> </li>
</ul>
</div>
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> </div>
<div class="headertitle">
<h1>any_bidirectional_iterator_instance< V, R, D > Struct Template Reference</h1> </div>
</div>
<div class="contents">
<!-- doxytag: class="adobe::any_bidirectional_iterator_instance" -->
<p><code>#include <<a class="el" href="any__iterator_8hpp_source.html">any_iterator.hpp</a>></code></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structadobe_1_1any__bidirectional__iterator__instance_1_1type.html">type</a></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<h3>template<typename V, typename R = V&, typename D = std::ptrdiff_t><br/>
struct adobe::any_bidirectional_iterator_instance< V, R, D ></h3>
<p>Definition at line <a class="el" href="any__iterator_8hpp_source.html#l00130">130</a> of file <a class="el" href="any__iterator_8hpp_source.html">any_iterator.hpp</a>.</p>
</div>
<!-- Begin Footer -->
</td></tr>
</table>
</div> <!-- content -->
<div class='footerdiv'>
<div id='footersub'>
<ul>
<li><a href="http://www.adobe.com/go/gftray_foot_aboutadobe">Company</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_privacy_security">Online Privacy Policy</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_terms">Terms of Use</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_contact_adobe">Contact Us</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_accessibility">Accessibility</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_report_piracy">Report Piracy</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_permissions_trademarks">Permissions & Trademarks</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_product_license_agreements">Product License Agreements</a> | </li>
<li><a href="http://www.adobe.com/go/gftray_foot_feedback">Send Feedback</a></li>
</ul>
<div>
<p>Copyright © 2006-2007 Adobe Systems Incorporated.</p>
<p>Use of this website signifies your agreement to the <a href="http://www.adobe.com/go/gftray_foot_terms">Terms of Use</a> and <a href="http://www.adobe.com/go/gftray_foot_privacy_security">Online Privacy Policy</a>.</p>
<p>Search powered by <a href="http://www.google.com/" target="new">Google</a></p>
</div>
</div>
</div>
<script type="text/javascript">
_uacct = "UA-396569-1";
urchinTracker();
</script>
</body>
</html>
|
brycelelbach/asl
|
documentation/html/structadobe_1_1any__bidirectional__iterator__instance.html
|
HTML
|
mit
| 7,535
|
package main
import (
"encoding/base32"
"encoding/hex"
"fmt"
"io"
"io/ioutil"
"net/url"
"os"
"strings"
)
func escape(encoding string) {
switch {
case strings.HasPrefix("query", encoding):
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Stdout.Write([]byte(url.QueryEscape(string(b))))
case strings.HasPrefix("hex", encoding):
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Stdout.Write([]byte(hex.EncodeToString(b)))
default:
fmt.Fprintf(os.Stderr, "unknown escape encoding: %q\n", encoding)
os.Exit(2)
}
}
func unescape(encoding string) {
switch {
case strings.HasPrefix("query", encoding):
b, err := ioutil.ReadAll(os.Stdin)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
s, err := url.QueryUnescape(string(b))
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
os.Stdout.Write([]byte(s))
case strings.HasPrefix("b32", encoding):
d := base32.NewDecoder(base32.StdEncoding, os.Stdin)
io.Copy(os.Stdout, d)
default:
fmt.Fprintf(os.Stderr, "unknown unescape encoding: %q\n", encoding)
}
}
func main() {
if len(os.Args) != 3 {
fmt.Fprintf(os.Stderr, "expected two arguments: <mode> <encoding>: got %d\n", len(os.Args)-1)
os.Exit(2)
}
mode := os.Args[1]
switch {
case strings.HasPrefix("escape", mode):
escape(os.Args[2])
case strings.HasPrefix("unescape", mode) || strings.HasPrefix("decode", mode):
unescape(os.Args[2])
default:
fmt.Fprintf(os.Stderr, "unknown mode: %q\n", mode)
os.Exit(2)
}
}
|
anacrolix/missinggo
|
cmd/gd/main.go
|
GO
|
mit
| 1,615
|
<!DOCTYPE html>
<html lang="en" manifest="offline.manifest.php">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
var APP_START_FAILED = "I'm sorry, the app can't start right now.";
function startWithResources(resources, storeResources) {
// Try to execute the Javascript
try {
eval(resources.js);
APP.applicationController.start(resources, storeResources);
// If the Javascript fails to launch, stop execution!
} catch (e) {
alert(APP_START_FAILED);
}
}
function startWithOnlineResources(resources) {
startWithResources(resources, true);
}
function startWithOfflineResources() {
var resources;
// If we have resources saved from a previous visit, use them
if (localStorage && localStorage.resources) {
resources = JSON.parse(localStorage.resources);
startWithResources(resources, false);
// Otherwise, apologize and let the user know
} else {
alert(APP_START_FAILED);
}
}
// If we know the device is offline, don't try to load new resources
if (navigator && navigator.onLine === false) {
startWithOfflineResources();
// Otherwise, download resources, eval them, if successful push them into local storage.
} else {
$.ajax({
url: 'api/resources/',
success: startWithOnlineResources,
error: startWithOfflineResources,
dataType: 'json'
});
}
});
</script>
<title>News</title>
</head>
<body>
<div id="loading">Loading…</div>
</body>
</html>
|
matthew-andrews/ft-style-offline-web-app-part-1
|
index.html
|
HTML
|
mit
| 1,710
|
class CreateArtistTracks < ActiveRecord::Migration
def change
create_table :artist_tracks do |t|
t.integer :track_id
t.integer :artist_id
t.timestamps null: false
end
end
end
|
laurahines22/spotsync
|
db/migrate/20150419204229_create_artist_tracks.rb
|
Ruby
|
mit
| 206
|
---
title: Automotive Grade Linux build for Raspberry Pi 3
image: https://pbs.twimg.com/profile_images/729987519916302337/mJwGl4qa.jpg
excerpt: In-vehicle infotainment
description: IVI Raspberry Pi AGL
categories: linux
---

Phil L. alerted me to this.
UPDATE: Look at Geektillithertz link
## Links
[Automotive Grade Linux Official Website](https://www.automotivelinux.org/)
[AGL Raspberry Pi 3 image](https://download.automotivelinux.org/AGL/snapshots/master/latest/raspberrypi3/deploy/images/raspberrypi3/)
[Geek Till It Hertz Link](http://geektillithertz.com/wordpress/index.php/2017/06/09/agl-on-the-raspberry-pi-23/)
|
raspberrypisig/raspberrypisig.github.io
|
_posts/2017-6-02-automotive-grade-linux.md
|
Markdown
|
mit
| 729
|
[comment /**]
[comment Plain text doesn't have any special ]
[comment indentation. {][comment&tag @link][comment foo}]
[comment&tag @fileoverview][comment Doesn't have any special]
[comment indentation.]
[comment&tag @see][comment https://github.com/google/closure-compiler/wiki/Annotating-JavaScript-for-the-Closure-Compiler]
[comment&tag @constructor]
[comment&tag @foo]
[comment&tag @param][comment {]
[comment * ][comment&type !Foo][comment } ]
[comment * ][comment&def param][comment Some ]
[comment description.]
[comment&tag @param][comment {][comment&type {]
[comment ][comment&type foo: objectRulesApplyAndParamNameIsRequired}][comment }]
[comment ][comment&def Desc]
[comment */]
[string "use strict"]
|
codemirror/google-modes
|
test/js/jsdoc.js
|
JavaScript
|
mit
| 741
|
<?php
include("Includes/header.php");
?>
<?php
include "Includes/class.FastTemplate.php";
$tpl = new FastTemplate("Templates");
$tpl->define(array(
"WorkoutHistoryPage"=>"workoutHistory.html",
"WorkoutTable"=>"workoutTable.html",
"WorkoutRow"=>"workoutRow.html",
"exerciseData"=>"exerciseData.html"));
if(isset($_SESSION["username"]))
{
$allCategoriesDetails = json_decode(getAllCategoriesDetails(), TRUE);
$db = new database();
$db->pick_db("workoutlog");
$userId = getUserIdFromUsername($_SESSION["username"]);
$query = "SELECT WorkoutDate, WorkoutId FROM tbl_workoutlog_workout WHERE UserId = " . $userId . " ORDER BY WorkoutDate DESC";
$res = $db->send_sql($query);
$workouts = $res->fetch_all(MYSQLI_ASSOC);
if(count($workouts)==0)
{
$tpl->assign("WORKOUTTABLES","<p>You haven't recorded any workouts yet!</p>");
}
else
{
foreach ($workouts as $workout) //For each workout for this user
{
$tpl->clear("EXERCISEROW");
$query = "SELECT ExerciseId, ExerciseNameId FROM tbl_workoutlog_exercise WHERE WorkoutId = " . $workout['WorkoutId'];
$res = $db->send_sql($query);
$exercises = $res->fetch_all(MYSQLI_ASSOC);
//Find maximum number of sets for any exercise
$exerciseIds = "(";
foreach($exercises as $exercise)
{
$exerciseIds = $exerciseIds . $exercise['ExerciseId'] . ",";
}
$exerciseIds = substr($exerciseIds,0,-1) . ")";
$query = "SELECT MAX(cnt) as max
FROM
(
SELECT COUNT(*) AS cnt
FROM tbl_workoutlog_exercise e ";
foreach ($allCategoriesDetails as $category => $details)
{
$query .= "LEFT JOIN tbl_workoutlog_category_" . $category . " `" . $category . "` ON e.ExerciseId = `" . $category . "`.ExerciseId ";
}
$query .= "WHERE e.WorkoutId = " . $workout['WorkoutId'] . "
AND e.ExerciseId IN " . $exerciseIds . "
GROUP BY e.ExerciseId
) AS tbl";
$res = $db->send_sql($query);
$row = $res->fetch_assoc();
$maxSetsCount = $row['max'];
foreach($exercises as $exercise) //For each exercise in this workout
{
$tpl->clear("EXERCISEDATACOL");
$query = "SELECT ExerciseName, ExerciseCategory FROM tbl_workoutlog_exercisename WHERE ExerciseNameId = " . $exercise['ExerciseNameId'];
$res = $db->send_sql($query);
$row = $res->fetch_assoc();
$exerciseName = $row['ExerciseName'];
$exerciseCategory = $row['ExerciseCategory'];
if ($exerciseCategory == 'set')
{
$query = "SELECT Weight, WeightUnit, NumOfReps, Notes FROM tbl_workoutlog_category_set WHERE ExerciseId = " . $exercise['ExerciseId'];
$res = $db->send_sql($query);
$sets = $res->fetch_all(MYSQLI_ASSOC);
$roundCount = count($sets);
foreach($sets as $set) //For each set of the exercise
{
if ($set['WeightUnit'] == "pounds")
$shortUnit = "#";
else if ($set['WeightUnit'] == 'kilograms')
$shortUnit = 'kgs';
else
$shortUnit = '';
$setString = $set['NumOfReps'] . "@" . $set['Weight'] . $shortUnit;
if ($set['Notes'] != "")
$setString .= " (" . $set['Notes'] . ")";
$tpl->assign("EXERCISEDATA",$setString);
$tpl->parse("EXERCISEDATACOL", ".exerciseData");
}
}
else if ($exerciseCategory == 'endurance')
{
$query = "SELECT Meters, Milliseconds, Notes FROM tbl_workoutlog_category_endurance WHERE ExerciseId = " . $exercise['ExerciseId'];
$res = $db->send_sql($query);
$rounds = $res->fetch_all(MYSQLI_ASSOC);
$roundCount = count($rounds);
foreach($rounds as $round) //For each set of the exercise
{
$miles = round(($round['Meters'] / 1609.344),2);
$time = getTimeStringFromMilliseconds($round['Milliseconds']);
$pace = getPace($miles,$round['Milliseconds']);
$roundString = $miles . " miles in " . $time . ". Pace= " . $pace . " per mile";
if ($round['Notes'] != "")
$roundString .= " (" . $round['Notes'] . ")";
$tpl->assign("EXERCISEDATA",$roundString);
$tpl->parse("EXERCISEDATACOL", ".exerciseData");
}
}
else //Admin added Category
{
$query = "SELECT * FROM tbl_workoutlog_category_" . $exerciseCategory . " WHERE ExerciseId = " . $exercise['ExerciseId'];
$res = $db->send_sql($query);
$rounds = $res->fetch_all(MYSQLI_ASSOC);
$roundCount = count($rounds);
foreach ($rounds as $round)
{
$roundString = "";
foreach ($round as $fieldName => $fieldData)
{
if (strtolower($fieldName) != strtolower(($exerciseCategory . "Id")) && strtolower($fieldName) != strtolower("ExerciseId"))
$roundString .= $fieldName . "=>" . $fieldData . ", ";
}
$roundString = substr($roundString,0,-2);
$tpl->assign("EXERCISEDATA",$roundString);
$tpl->parse("EXERCISEDATACOL", ".exerciseData");
}
}
while ($roundCount < $maxSetsCount)
{
$tpl->assign("EXERCISEDATA","");
$tpl->parse("EXERCISEDATACOL", ".exerciseData");
$roundCount +=1;
}
$tpl->assign("EXERCISENAME",$exerciseName);
$tpl->parse("EXERCISEROW", ".WorkoutRow");
}
$tpl->assign("WORKOUTTITLE", $workout['WorkoutDate']);
$tpl->assign("COLSPAN", $maxSetsCount);
$tpl->parse("WORKOUTTABLES", ".WorkoutTable");
}
}
}
else
{
$tpl->assign("WORKOUTTABLES","<p>Please log in</p>");
}
$tpl->parse("WORKOUTTABLES","WorkoutHistoryPage");
$tpl->FastPrint();
function getTimeStringFromMilliseconds($milliseconds)
{
$hours = floor($milliseconds / 3600000);
$milliseconds = $milliseconds - ($hours * 3600000);
$minutes = floor($milliseconds / 60000);
$milliseconds = $milliseconds - ($minutes * 60000);
$seconds = round($milliseconds / 1000);
return $hours . ":" . $minutes . ":" . $seconds;
}
function getPace($miles, $milliseconds)
{
$millisecondsForOneMile = ($milliseconds / $miles);
return getTimeStringFromMilliseconds($millisecondsForOneMile);
}
?>
<?php include("Includes/footer.php"); ?>
|
jdevince/WorkoutLogger
|
viewWorkoutHistory.php
|
PHP
|
mit
| 8,001
|
var path = require('path')
var AtomicFile = require('atomic-file')
function id (e) { return e }
var none = {
encode: id, decode: id
}
module.exports = function (dir, name, codec) {
codec = codec || require('flumecodec/json')
var af = AtomicFile(path.join(dir, name+'.json'), '~', none)
var self
return self = {
size: null,
get: function (cb) {
af.get(function (err, value) {
if(err) return cb(err)
if(value == null) return cb()
try {
self.size = value.length
value = codec.decode(value)
value.size = self.size
} catch(err) {
return cb(err)
}
cb(null, value)
})
},
set: function (value, cb) {
value = codec.encode(value)
self.size = value.length
af.set(value, cb)
},
destroy: function (cb) {
value = null
self.size = 0
af.destroy(cb)
}
}
}
|
flumedb/flumeview-reduce
|
store/fs.js
|
JavaScript
|
mit
| 925
|
C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild ..\src\AssertProperties\AssertProperties.csproj /p:Configuration=Release
|
lfreneda/AssertProperties
|
build/build.bat
|
Batchfile
|
mit
| 127
|
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/mqtt-elements/mqtt-connection.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">
<link rel="import" href="../bower_components/paper-card/paper-card.html">
<link rel="import" href="chat-window.html">
<link rel="import" href="chat-online-user.html">
<link rel="import" href="chat-user.html">
<dom-module id="chat-element">
<template>
<style>
:host {
display: block;
box-sizing: border-box;
}
.user-avatar {
height: 68px;
width: 68px;
border-radius: 50%;
}
.user-card {
@apply(--layout-vertical);
@apply(--layout-center);
}
</style>
<mqtt-connection client="{{mqttClient}}" url="[[mqttUrl]]" auto>
</mqtt-connection>
<chat-online-user self="[[userName]]" app-prefix="[[appPrefix]]" online-user-array="{{onlineUserArray}}" mqtt-client="[[mqttClient]]"></chat-online-user>
<chat-user user="[[userName]]"></chat-user>
<template is="dom-repeat" items="[[onlineUserArray]]">
<paper-card on-tap="_openChatWindow">
<div class="card-content">
<div class="user-card">
<img class="user-avatar" src="[[item.img]]" alt="">
<paper-item>[[item.user]]</paper-item>
</div>
</div>
</paper-card>
</template>
<div id="chatWindows">
<template is="dom-repeat" items="[[chatsArray]]" as="chat">
<chat-window
mqtt-client="[[mqttClient]]"
thread="[[chat.thread]]"
self="[[chat.self]]"
chat-partner="[[chat.chatPartner]]"></chat-window>
</template>
</div>
</template>
<script>
Polymer({
is: 'chat-element',
properties: {
userName: {
type: String,
value: ""
},
mqttClient: {
type: Object,
},
mqttUrl: {
type: String,
},
onlineUserArray: {
type: Array,
},
appPrefix: {
type: String
},
chatsCollection: {
type: Object,
value: function(){
return Polymer.Collection([]);
}
},
chatsArray: {
type: Array,
value: function(){
return [];
}
}
},
_openChatWindow: function(event){
this.push("chats", this._createChatModel(this.userName, event.model.item.user));
},
_setChatsArray: function(arr){
this.set("chatsArray", arr);
},
_addChat: function(chatModel){
this.chatsCollection.setItem(this._chatModelToKey(chatModel), chatModel);
},
_openOrAddChat: function(chatModel){
this.chatsCollection
},
_chatModelToKey: function(chatModel){
return "#" + chatModel.chatPartner.user;
},
_createChatModel: function (self, chatPartner) {
return {
"self": {
"user": self,
"readTopic": self + "/read/#",
"writeTopic": self + "/write"
},
"chatPartner": {
"user": chatPartner,
"readTopic": chatPartner + "/write",
"writeTopic": chatPartner + "/read/" + self
},
"mqttClient": null,
"thread": [],
"mqttUrl": this.mqttUrl
};
},
});
</script>
</dom-module>
|
sandro-k/maps-chat
|
elements/chat-element.html
|
HTML
|
mit
| 3,475
|
<?php
namespace Contact\Controller\Admin;
use Contact\Lib\Helper;
use Contact\Model\Mail as Mail;
use Contact\Extensions\Table\InboxTable;
use Event, Flash, Input, Pagination, Redirect, Setting, Translate;
/**
* Contact Inbox Controller
* @package Contact\Contact
* @author RebornCMS Developement Team <reborncms@gmail.com>
*/
class ContactController extends \AdminController
{
public function before()
{
$this->menu->activeParent(\Module::get('contact', 'uri'));
$this->template->script('contact.js','contact');
}
/**
* Show all Email to Admin
*
* @package Contact\Controller
* @author RebornCMS Development Team
**/
public function index()
{
$options = array(
'total_items' => Mail::count(),
'items_per_page'=> Setting::get('admin_item_per_page'),
);
$pagination = Pagination::create($options);
if (Pagination::isInvalid()) {
return $this->notFound();
}
$result = Mail::skip(Pagination::offset())
->take(Pagination::limit())
->orderBy('id','desc')
->get();
$table = InboxTable::create($result);
$this->template->title(t('contact::contact.inbox'))
->breadcrumb(t('contact::contact.all_con'))
->set('table', $table)
->set('pagination',$pagination)
->view('admin\inbox\table');
}
/**
* Show detail Email to Admin
*
* @param string $id
* @package Contact\Controller
* @author RebornCMS Development Team
**/
public function detail($id)
{
if (!user_has_access('contact.view')) return $this->notFound();
$mail = Mail::where('id', '=', $id)->first();
if (count($mail) == 0) return $this->notFound();
$mail->read_mail = 1;
$mail->save();
Event::call('email_receive_detail',array($mail));
$temp = array();
if (\Module::isEnabled('field')) {
$temp = \Field::get('contact', $mail);
}
if ($this->request->isAjax()) {
$this->template->partialOnly();
}
$this->template->title(t('contact::contact.title'))
->breadcrumb($mail->subject)
->set('mail',$mail)
->set('field',$temp->extended_fields)
->view('admin\inbox\detail');
}
/**
* Delete Email from Database
*
* @package Contact\Controller
* @author RebornCMS Development Team
**/
public function delete($id = 0)
{
if (!user_has_access('contact.delete')) return $this->notFound();
$ids = ($id) ? array($id) : Input::get('action_to');
$mails = array();
foreach ($ids as $id) {
if ($mail = Mail::find($id)) {
if ($mail->delete()) {
if (\Module::isEnabled('field')) {
\Field::delete('contact', $mail);
}
}
$mails[] = "success";
}
}
if (!empty($mails)) {
if (count($mails) == 1) {
Flash::success(t('contact::contact.mail_delete'));
} else {
Flash::success(t('contact::contact.mails_delete'));
}
} else {
Flash::error(t('contact::contact.template_error'));
}
Event::call('email_receive_delete', array(true));
return Redirect::toAdmin('contact');
}
/**
* Attachement Download from Inbox
* @param int $id [mail id]
* @return
*/
public function download($id)
{
$data = Helper::getAttachment($id);
if (empty($data)) {
return $this->notFound();
}else {
return \Response::binary($data['0'], $data['1']);
}
}
}
|
reborncms/reborn
|
heart/modules/contact/src/Contact/Controller/Admin/ContactController.php
|
PHP
|
mit
| 4,013
|
using System;
using System.Collections.Generic;
using System.Linq;
internal static partial class SdkInfo
{
public static IEnumerable<Tuple<string, string, string>> ApiInfo_ServiceBusManagementClient
{
get
{
return new Tuple<string, string, string>[]
{
new Tuple<string, string, string>("ServiceBus", "DisasterRecoveryConfigs", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "EventHubs", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Namespaces", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Operations", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "PremiumMessagingRegions", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Queues", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Regions", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Rules", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Subscriptions", "2017-04-01"),
new Tuple<string, string, string>("ServiceBus", "Topics", "2017-04-01"),
}.AsEnumerable();
}
}
}
|
shutchings/azure-sdk-for-net
|
src/SDKs/ServiceBus/Management.ServiceBus/Generated/SdkInfo_ServiceBusManagementClient.cs
|
C#
|
mit
| 1,292
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="A collection of lamps designed and created in San Francisco.">
<link href="imgs/favicon.ico" rel="shortcut icon" />
<title>PORT/ATLAS</title>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Dosis:200">
<link rel="stylesheet" type="text/css" href="stylesheets/default.css">
<link rel="stylesheet" type="text/css" href="stylesheets/portfolio.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" type="text/css" href="stylesheets/bootstrap.css">
<!-- jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="scripts/nav_scripts.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-83806482-1', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<div id="nav_site"></div>
<div class="container">
<h1 class="center">PRODUCT DESIGN</h1>
<div class="row">
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 center">
<div class="wrapper hoverlink">
<a href="/skyline_lamp.html">
<img class="img-responsive animated fadeIn hovereffect" src="imgs/skyline_lamp_thumb.jpg" alt="skyline lamp" />
</a>
<div class="img_desc">skyline lamp</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 center">
<div class="wrapper hoverlink">
<a href="/column_lamp.html">
<img class="img-responsive animated fadeIn hovereffect" src="imgs/column_lamp_thumb.jpg" alt="column lamp" />
</a>
<div class="img_desc">column lamp</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 center">
<div class="wrapper hoverlink">
<a href="/ridgeline_light.html">
<img class="img-responsive animated fadeIn hovereffect" src="imgs/ridgeline_light_thumb.jpg" alt="ridgeline light"/>
</a>
<div class="img_desc">ridgeline light</div>
</div>
</div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12 center">
<div class="wrapper hoverlink">
<a href="/reversed_column_lamp.html">
<img class="img-responsive animated fadeIn hovereffect" src="imgs/reversed_column_lamp_thumb.jpg" alt="reversed column lamp"/>
</a>
<div class="img_desc">reversed column lamp</div>
</div>
</div>
</div>
</div>
<div id="footer"></div>
</body>
</html>
|
portatlas/portatlas.github.io
|
products.html
|
HTML
|
mit
| 3,384
|
/*Owner & Copyrights: Vance King Saxbe. A.*//*Copyright (c) <2014> Author Vance King Saxbe. A, and contributors Power Dominion Enterprise, Precieux Consulting and other contributors. Modelled, Architected and designed by Vance King Saxbe. A. with the geeks from GoldSax Consulting and GoldSax Technologies email @vsaxbe@yahoo.com. Development teams from Power Dominion Enterprise, Precieux Consulting. Project sponsored by GoldSax Foundation, GoldSax Group and executed by GoldSax Manager.*/
$stream = file_get_contents('QQLAST.txt');
$avgp = "49.00";
$high = "50.00";
$low = "48.75";
echo "&L=".$stream."&N=QQ&";
$temp = file_get_contents("QQTEMP.txt", "r");
if ($stream != $temp ) {
$mhigh = ($avgp + $high)/2;
$mlow = ($avgp + $low)/2;
$llow = ($low - (($avgp - $low)/2));
$hhigh = ($high + (($high - $avgp)/2));
if ( $stream > $temp ) {
if ( ($stream > $mhigh ) && ($stream < $high)) { echo "&sign=au" ; }
if ( ($stream < $mlow ) && ($stream > $low)) { echo "&sign=ad" ; }
if ( $stream < $llow ) { echo "&sign=as" ; }
if ( $stream > $hhigh ) { echo "&sign=al" ; }
if ( ($stream < $hhigh) && ($stream > $high)) { echo "&sign=auu" ; }
if ( ($stream > $llow) && ($stream < $low)) { echo "&sign=add" ; }
//else { echo "&sign=a" ; }
}
if ( $stream < $temp ) {
if ( ($stream >$mhigh) && ($stream < $high)) { echo "&sign=bu" ; }
if ( ($stream < $mlow) && ($stream > $low)) { echo "&sign=bd" ; }
if ( $stream < $llow ) { echo "&sign=bs" ; }
if ( $stream > $hhigh ) { echo "&sign=bl" ; }
if ( ($stream < $hhigh) && ($stream > $high)) { echo "&sign=buu" ; }
if ( ($stream > $llow) && ($stream < $low)) { echo "&sign=bdd" ; }
// else { echo "&sign=b" ; }
}
$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filename= 'QQ.txt';
$file = fopen($filename, "a+" );
fwrite( $file, $stream.":".$time."\r\n" );
fclose( $file );
if (($stream > $mhigh ) && ($temp<= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Approaching:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $mhigh ) && ($temp>= $mhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Moving Down:PHIGH:".$high.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $mlow ) && ($temp<= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Moving Up:PLOW:".$low.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $mlow ) && ($temp>= $mlow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Approaching:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $high ) && ($temp<= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Breaking:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $hhigh ) && ($temp<= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Moving Beyond:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $hhigh ) && ($temp>= $hhigh ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream. ":Coming near:PHIGH:".$high.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $high ) && ($temp>= $high ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream. ":Retracing:PHIGH:".$high."\r\n");
fclose( $filedash );
}
if (($stream < $llow ) && ($temp>= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Breaking Beyond:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $low ) && ($temp>= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Breaking:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $llow ) && ($temp<= $llow ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Coming near:PLOW:".$low.":short Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream > $low ) && ($temp<= $low ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:". $stream.":Retracing:PLOW:".$low."\r\n");
fclose( $filedash );
}
if (($stream > $avgp ) && ($temp<= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($stream - $low) * (200000/$stream);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Sliding up:PAVG:".$avgp.":Buy Cost:".$risk."\r\n");
fclose( $filedash );
}
if (($stream < $avgp ) && ($temp>= $avgp ))
{$my_time = date('h:i:s',time());
$seconds2add = 19800;
$new_time= strtotime($my_time);
$new_time+=$seconds2add;
$risk = ($high - $stream) * (200000/$stream);
$risk = (int)$risk;
$avgp = number_format($avgp, 2, '.', '');
$time = date('h:i:s',$new_time);
$filedash = fopen("C:\wamp\www\alert.txt", "a+");
$wrote = fputs($filedash, "QQ:".$stream. ":Sliding down:PAVG:".$avgp.":Short Cost:".$risk."\r\n");
fclose( $filedash );
}
}
$filedash = fopen("QQTEMP.txt", "w");
$wrote = fputs($filedash, $stream);
fclose( $filedash );
//echo "&chg=".$json_output['cp']."&";
?>
/*email to provide support at vancekingsaxbe@powerdominionenterprise.com, businessaffairs@powerdominionenterprise.com, For donations please write to fundraising@powerdominionenterprise.com*/
|
VanceKingSaxbeA/FTSE-Engine
|
App/QQ.php
|
PHP
|
mit
| 8,539
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.omsalung.api;
import java.io.Serializable;
import org.codehaus.jackson.annotate.JsonProperty;
/**
*
* @author anonymous
*/
public class JsonResponse implements Serializable{
@JsonProperty("status_code")
private int statusCode;
private Object data;
@JsonProperty("response_time")
private long responseTime;
public int getStatusCode() {
return statusCode;
}
public void setStatusCode(int statusCode) {
this.statusCode = statusCode;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public long getResponseTime() {
return responseTime;
}
public void setResponseTime(long responseTime) {
this.responseTime = responseTime;
}
}
|
jittagornp/omsalung
|
api/src/main/java/com/omsalung/api/JsonResponse.java
|
Java
|
mit
| 996
|
angular.module('ModuleGlobal').service('LoginService', ['$http', 'urlService', function($http, urlService) {
var self = this;
var url = urlService.getLoginUrl();
var connected = false;
self.identifier = '';
self.isConnected = function() {
return connected;
};
self.connect = function(identifier, password, remember) {
var logs = {
login : identifier,
mdp : password,
};
return $http.post(url, logs).then(function(response) {
connected = true;
if (remember)
self.identifier = identifier;
else
self.identifier = '';
return {connected: true, status: response.status};
},
function(response) {
return {connected: false, status: response.status};
});
};
self.disconnect = function() {
connected = false;
};
}]);
|
YohannJouanny/mediatic
|
app/module-global/js/service/LoginService.js
|
JavaScript
|
mit
| 843
|
//////////////////////////////////
//Auto-generated. Do NOT modify!//
//////////////////////////////////
import { MessageKey, QueryKey, Type, EnumType, registerSymbol } from '../../Signum.React/Scripts/Reflection'
import * as Entities from '../../Signum.React/Scripts/Signum.Entities'
export interface IFile
{
__isFile__ : true; //only for type-checking
binaryFile?: string | null;
fileName?: string | null;
fullWebPath?: string | null;
}
export interface FileEntity extends IFile { }
export interface FileEmbedded extends IFile { }
export interface IFilePath extends IFile
{
fileType?: FileTypeSymbol | null;
suffix?: string | null;
}
export interface FilePathEntity extends IFilePath { }
export interface FilePathEmbedded extends IFilePath {
entityId: number | string;
mListRowId: number | string | null;
propertyRoute: string;
rootType: string;
}
export const BigStringMixin = new Type<BigStringMixin>("BigStringMixin");
export interface BigStringMixin extends Entities.MixinEntity {
Type: "BigStringMixin";
file: FilePathEmbedded | null;
}
export const FileEmbedded = new Type<FileEmbedded>("FileEmbedded");
export interface FileEmbedded extends Entities.EmbeddedEntity {
Type: "FileEmbedded";
fileName: string;
binaryFile: string /*Byte[]*/;
}
export const FileEntity = new Type<FileEntity>("File");
export interface FileEntity extends Entities.ImmutableEntity {
Type: "File";
fileName: string;
hash: string;
binaryFile: string /*Byte[]*/;
}
export module FileMessage {
export const DownloadFile = new MessageKey("FileMessage", "DownloadFile");
export const ErrorSavingFile = new MessageKey("FileMessage", "ErrorSavingFile");
export const FileTypes = new MessageKey("FileMessage", "FileTypes");
export const Open = new MessageKey("FileMessage", "Open");
export const OpeningHasNotDefaultImplementationFor0 = new MessageKey("FileMessage", "OpeningHasNotDefaultImplementationFor0");
export const WebDownload = new MessageKey("FileMessage", "WebDownload");
export const WebImage = new MessageKey("FileMessage", "WebImage");
export const Remove = new MessageKey("FileMessage", "Remove");
export const SavingHasNotDefaultImplementationFor0 = new MessageKey("FileMessage", "SavingHasNotDefaultImplementationFor0");
export const SelectFile = new MessageKey("FileMessage", "SelectFile");
export const ViewFile = new MessageKey("FileMessage", "ViewFile");
export const ViewingHasNotDefaultImplementationFor0 = new MessageKey("FileMessage", "ViewingHasNotDefaultImplementationFor0");
export const OnlyOneFileIsSupported = new MessageKey("FileMessage", "OnlyOneFileIsSupported");
export const OrDragAFileHere = new MessageKey("FileMessage", "OrDragAFileHere");
export const TheFile0IsNotA1 = new MessageKey("FileMessage", "TheFile0IsNotA1");
export const File0IsTooBigTheMaximumSizeIs1 = new MessageKey("FileMessage", "File0IsTooBigTheMaximumSizeIs1");
export const TheNameOfTheFileMustNotContainPercentSymbol = new MessageKey("FileMessage", "TheNameOfTheFileMustNotContainPercentSymbol");
}
export const FilePathEmbedded = new Type<FilePathEmbedded>("FilePathEmbedded");
export interface FilePathEmbedded extends Entities.EmbeddedEntity {
Type: "FilePathEmbedded";
fileName: string;
binaryFile: string /*Byte[]*/;
hash: string | null;
fileLength: number;
suffix: string;
calculatedDirectory: string | null;
fileType: FileTypeSymbol;
}
export const FilePathEntity = new Type<FilePathEntity>("FilePath");
export interface FilePathEntity extends Entities.Entity {
Type: "FilePath";
creationDate: string /*DateTime*/;
fileName: string;
binaryFile: string /*Byte[]*/;
hash: string | null;
fileLength: number;
suffix: string;
calculatedDirectory: string | null;
fileType: FileTypeSymbol;
}
export module FilePathOperation {
export const Save : Entities.ExecuteSymbol<FilePathEntity> = registerSymbol("Operation", "FilePathOperation.Save");
}
export const FileTypeSymbol = new Type<FileTypeSymbol>("FileType");
export interface FileTypeSymbol extends Entities.Symbol {
Type: "FileType";
}
|
signumsoftware/framework
|
Signum.React.Extensions/Files/Signum.Entities.Files.ts
|
TypeScript
|
mit
| 4,210
|
Slice
=====
Slice
A simple shell script to automate splitting slices into subfolders.
Usable for iOS and Android Slices.
On iOS, slices with names XXX-@1x.png for example, will be renamed and moved into @1x/XXX.png
On Android, similarly, XXX-hdpi.png will be moved to drawable-hdpi/XXX.png.
|
andrekandore/Slice
|
README.md
|
Markdown
|
mit
| 294
|
<!DOCTYPE html>
<head>
<title>Blogging My Time at the Recurse Center</title>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<main>
<h1>Fifth Week of RC</h1>
<h2>Day 4: Chrome Extensions</h2>
<h4>March 21, 2019</h4>
<section>
<p>
As previously mentioned, I'm working on a project called <a href="/w3-d2.html">EmoReply</a> with a fellow Recurser, Jamie. Though the project originated as a parody of Gmail's autoreply feature, we decided to make it a chrome extension, so that it can provide angsty autoresponses across various platforms. Whether you're writing an email, commenting on a NYTimes article, or posting on a forum, EmoReply is at your service.
</p>
<p>
Jamie and I decided to make a roughly-functioning chrome extension before integrating the machine learning component. Our goal was to build a chrome extension with a text box, which would take user input, then display the input at the extension's bottom. Once we have our angsty auto reply learning, we'll display the emoreplies at the extension's bottom.
</p>
<p>
We learned various things while working on the chrome extension. For example, the developer tools' console for a chrome extension is different than the developer tools' console for the main page. Additionally, if you go to `chrome://extensions`, you can see any errors that occur for each extension. However, the displayed errors won't automatically go away after you fix them. Instead, you'll need to hit "clear errors." (This seems like questionable UX to me.)
</p>
<p>
Struggling with a bug, Jamie and I posted a question on Recurse's internal chat, Zulip. We were lucky to get a response from another Recurser, Cory, who teaches a class on chrome extensions at a local college. If this doesn't illustrate the richness of Recurse's intellectual community, I don't know what does. Cory agreed to meet with me, and with his help, I was able to make the extension display text in 15 minutes. Yay, collaboration!
</p>
<p>
When Jamie and I looked through chrome extension tutorials, we saw extensions that had two scripts, <code>popup.js</code> and <code>background.js</code>. We made our extension with only one script, which we called <code>background.js</code>. At a certain point, we had mutually acknowledged that this was a misnomer, because we were using the <code>background.js</code> script to work on the popup. "We should probably call it popup.js," we said, then kept coding in the background.js script.
</p>
<p>
This was silly.
</p>
<p>
Cory pointed out that Jamie and I had imported the poorly-named <code>background.js</code> script into <code>popup.html</code> with the below code:
</p>
<p>
<code>
<script src="background.js"></script>
</code>
</p>
<p>
We had also made reference to the <code>background.js</code> script in the <code>manifest.json</code>, as seen below:
</p>
<p>
<code>
"background": {
"scripts": ["background.js"],
"persistent": false
},
</code>
</p>
<p>
Since we made reference to the same script twice, we were attempting to run it simultaneously in two different places. This, too, was silly.
</p>
<p>
As a quick fix, I renamed our existing <code>background.js</code> file as <code>popup.js</code> and made reference to it in the <code>popup.html</code>, like so.
<code>
<script src="popup.js"></script>
</code>
Then, as a quick fix, I created a blank <code>background.js</code> and kept the reference to it in <code>manifest.json</code>.
</p>
<p>
The chrome extension now displays the input text after the button is clicked. Huzzah! Here's the repo, for anyone who is interested in more details. <a href="https://github.com/McEileen/EmoReply/tree/feature/chrome-extension">EmoReply</a>
</p>
</section>
</main>
|
McEileen/McEileen.github.io
|
blog/w5-d4.html
|
HTML
|
mit
| 4,041
|
# frozen_string_literal: true
require 'transproc/coercions'
module Transproc
# Transformation functions for Hash objects
#
# @example
# require 'transproc/hash'
#
# include Transproc::Helper
#
# fn = t(:symbolize_keys) >> t(:nest, :address, [:street, :zipcode])
#
# fn["street" => "Street 1", "zipcode" => "123"]
# # => {:address => {:street => "Street 1", :zipcode => "123"}}
#
# @api public
module HashTransformations
extend Registry
EMPTY_HASH = {}.freeze
if RUBY_VERSION >= '2.5'
# Map all keys in a hash with the provided transformation function
#
# @example
# Transproc(:map_keys, -> s { s.upcase })['name' => 'Jane']
# # => {"NAME" => "Jane"}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.map_keys(source_hash, fn)
Hash[source_hash].transform_keys!(&fn)
end
else
def self.map_keys(source_hash, fn)
Hash[source_hash].tap do |hash|
hash.keys.each { |key| hash[fn[key]] = hash.delete(key) }
end
end
end
# Symbolize all keys in a hash
#
# @example
# Transproc(:symbolize_keys)['name' => 'Jane']
# # => {:name => "Jane"}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.symbolize_keys(hash)
map_keys(hash, Coercions[:to_symbol].fn)
end
# Symbolize keys in a hash recursively
#
# @example
#
# input = { 'foo' => 'bar', 'baz' => [{ 'one' => 1 }] }
#
# t(:deep_symbolize_keys)[input]
# # => { :foo => "bar", :baz => [{ :one => 1 }] }
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.deep_symbolize_keys(hash)
hash.each_with_object({}) do |(key, value), output|
output[key.to_sym] =
case value
when Hash
deep_symbolize_keys(value)
when Array
value.map { |item|
item.is_a?(Hash) ? deep_symbolize_keys(item) : item
}
else
value
end
end
end
# Stringify all keys in a hash
#
# @example
# Transproc(:stringify_keys)[:name => 'Jane']
# # => {"name" => "Jane"}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.stringify_keys(hash)
map_keys(hash, Coercions[:to_string].fn)
end
# Stringify keys in a hash recursively
#
# @example
# input = { :foo => "bar", :baz => [{ :one => 1 }] }
#
# t(:deep_stringify_keys)[input]
# # => { "foo" => "bar", "baz" => [{ "one" => 1 }] }
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.deep_stringify_keys(hash)
hash.each_with_object({}) do |(key, value), output|
output[key.to_s] =
case value
when Hash
deep_stringify_keys(value)
when Array
value.map { |item|
item.is_a?(Hash) ? deep_stringify_keys(item) : item
}
else
value
end
end
end
if RUBY_VERSION >= '2.4'
# Map all values in a hash using transformation function
#
# @example
# Transproc(:map_values, -> v { v.upcase })[:name => 'Jane']
# # => {"name" => "JANE"}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.map_values(source_hash, fn)
Hash[source_hash].transform_values!(&fn)
end
else
def self.map_values(source_hash, fn)
Hash[source_hash].tap do |hash|
hash.each { |key, value| hash[key] = fn[value] }
end
end
end
# Rename all keys in a hash using provided mapping hash
#
# @example
# Transproc(:rename_keys, user_name: :name)[user_name: 'Jane']
# # => {:name => "Jane"}
#
# @param [Hash] source_hash The input hash
# @param [Hash] mapping The key-rename mapping
#
# @return [Hash]
#
# @api public
def self.rename_keys(source_hash, mapping)
Hash[source_hash].tap do |hash|
mapping.each { |k, v| hash[v] = hash.delete(k) if hash.key?(k) }
end
end
# Copy all keys in a hash using provided mapping hash
#
# @example
# Transproc(:copy_keys, user_name: :name)[user_name: 'Jane']
# # => {:user_name => "Jane", :name => "Jane"}
#
# @param [Hash] source_hash The input hash
# @param [Hash] mapping The key-copy mapping
#
# @return [Hash]
#
# @api public
def self.copy_keys(source_hash, mapping)
Hash[source_hash].tap do |hash|
mapping.each do |original_key, new_keys|
[*new_keys].each do |new_key|
hash[new_key] = hash[original_key]
end
end
end
end
# Rejects specified keys from a hash
#
# @example
# Transproc(:reject_keys, [:name])[name: 'Jane', email: 'jane@doe.org']
# # => {:email => "jane@doe.org"}
#
# @param [Hash] hash The input hash
# @param [Array] keys The keys to be rejected
#
# @return [Hash]
#
# @api public
def self.reject_keys(hash, keys)
Hash[hash].reject { |k, _| keys.include?(k) }
end
if RUBY_VERSION >= '2.5'
# Accepts specified keys from a hash
#
# @example
# Transproc(:accept_keys, [:name])[name: 'Jane', email: 'jane@doe.org']
# # => {:name=>"Jane"}
#
# @param [Hash] hash The input hash
# @param [Array] keys The keys to be accepted
#
# @return [Hash]
#
# @api public
def self.accept_keys(hash, keys)
Hash[hash].slice(*keys)
end
else
def self.accept_keys(hash, keys)
reject_keys(hash, hash.keys - keys)
end
end
# Map a key in a hash with the provided transformation function
#
# @example
# Transproc(:map_value, 'name', -> s { s.upcase })['name' => 'jane']
# # => {"name" => "JANE"}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.map_value(hash, key, fn)
hash.merge(key => fn[hash[key]])
end
# Nest values from specified keys under a new key
#
# @example
# Transproc(:nest, :address, [:street, :zipcode])[street: 'Street', zipcode: '123']
# # => {address: {street: "Street", zipcode: "123"}}
#
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.nest(hash, root, keys)
child = {}
keys.each do |key|
child[key] = hash[key] if hash.key?(key)
end
output = Hash[hash]
child.each_key { |key| output.delete(key) }
old_root = hash[root]
if old_root.is_a?(Hash)
output[root] = old_root.merge(child)
else
output[root] = child
end
output
end
# Collapse a nested hash from a specified key
#
# @example
# Transproc(:unwrap, :address, [:street, :zipcode])[address: { street: 'Street', zipcode: '123' }]
# # => {street: "Street", zipcode: "123"}
#
# @param [Hash] source_hash
# @param [Mixed] root The root key to unwrap values from
# @param [Array] selected The keys that should be unwrapped (optional)
# @param [Hash] options hash of options (optional)
# @option options [Boolean] :prefix if true, unwrapped keys will be prefixed
# with the root key followed by an underscore (_)
#
# @return [Hash]
#
# @api public
def self.unwrap(source_hash, root, selected = nil, options = EMPTY_HASH)
return source_hash unless source_hash[root]
options, selected = selected, nil if options.empty? && selected.is_a?(::Hash)
add_prefix = ->(key) do
combined = [root, key].join('_')
root.is_a?(::Symbol) ? combined.to_sym : combined
end
Hash[source_hash].merge(root => Hash[source_hash[root]]).tap do |hash|
nested_hash = hash[root]
keys = nested_hash.keys
keys &= selected if selected
new_keys = options[:prefix] ? keys.map(&add_prefix) : keys
hash.update(Hash[new_keys.zip(keys.map { |key| nested_hash.delete(key) })])
hash.delete(root) if nested_hash.empty?
end
end
# Folds array of tuples to array of values from a specified key
#
# @example
# source = {
# name: "Jane",
# tasks: [{ title: "be nice", priority: 1 }, { title: "sleep well" }]
# }
# Transproc(:fold, :tasks, :title)[source]
# # => { name: "Jane", tasks: ["be nice", "sleep well"] }
# Transproc(:fold, :tasks, :priority)[source]
# # => { name: "Jane", tasks: [1, nil] }
#
# @param [Hash] hash
# @param [Object] key The key to fold values to
# @param [Object] tuple_key The key to take folded values from
#
# @return [Hash]
#
# @api public
def self.fold(hash, key, tuple_key)
hash.merge(key => ArrayTransformations.extract_key(hash[key], tuple_key))
end
# Splits hash to array by all values from a specified key
#
# The operation adds missing keys extracted from the array to regularize the output.
#
# @example
# input = {
# name: 'Joe',
# tasks: [
# { title: 'sleep well', priority: 1 },
# { title: 'be nice', priority: 2 },
# { priority: 2 },
# { title: 'be cool' }
# ]
# }
# Transproc(:split, :tasks, [:priority])[input]
# => [
# { name: 'Joe', priority: 1, tasks: [{ title: 'sleep well' }] },
# { name: 'Joe', priority: 2, tasks: [{ title: 'be nice' }, { title: nil }] },
# { name: 'Joe', priority: nil, tasks: [{ title: 'be cool' }] }
# ]
#
# @param [Hash] hash
# @param [Object] key The key to split a hash by
# @param [Array] subkeys The list of subkeys to be extracted from key
#
# @return [Array<Hash>]
#
# @api public
def self.split(hash, key, keys)
list = Array(hash[key])
return [hash.reject { |k, _| k == key }] if list.empty?
existing = list.flat_map(&:keys).uniq
grouped = existing - keys
ungrouped = existing & keys
list = ArrayTransformations.group(list, key, grouped) if grouped.any?
list = list.map { |item| item.merge(reject_keys(hash, [key])) }
ArrayTransformations.add_keys(list, ungrouped)
end
# Recursively evaluate hash values if they are procs/lambdas
#
# @example
# hash = {
# num: -> i { i + 1 },
# str: -> i { "num #{i}" }
# }
#
# t(:eval_values, 1)[hash]
# # => {:num => 2, :str => "num 1" }
#
# # with filters
# t(:eval_values, 1, [:str])[hash]
# # => {:num => #{still a proc}, :str => "num 1" }
#
# @param [Hash]
# @param [Array,Object] args Anything that should be passed to procs
# @param [Array] filters A list of attribute names that should be evaluated
#
# @api public
def self.eval_values(hash, args, filters = [])
hash.each_with_object({}) do |(key, value), output|
output[key] =
case value
when Proc
if filters.empty? || filters.include?(key)
value.call(*args)
else
value
end
when Hash
eval_values(value, args, filters)
when Array
value.map { |item|
item.is_a?(Hash) ? eval_values(item, args, filters) : item
}
else
value
end
end
end
# Merge a hash recursively
#
# @example
#
# input = { 'foo' => 'bar', 'baz' => { 'one' => 1 } }
# other = { 'foo' => 'buz', 'baz' => { :one => 'one', :two => 2 } }
#
# t(:deep_merge)[input, other]
# # => { 'foo' => "buz", :baz => { :one => 'one', 'one' => 1, :two => 2 } }
#
# @param [Hash]
# @param [Hash]
#
# @return [Hash]
#
# @api public
def self.deep_merge(hash, other)
Hash[hash].merge(other) do |_, original_value, new_value|
if original_value.respond_to?(:to_hash) &&
new_value.respond_to?(:to_hash)
deep_merge(Hash[original_value], Hash[new_value])
else
new_value
end
end
end
end
end
|
solnic/transproc
|
lib/transproc/hash.rb
|
Ruby
|
mit
| 12,480
|
+++
title = "Número 462"
date = "1994-03-01"
numero = "462"
artistas = []
colaboradores= ["Juan Manuel Cibeira", "Sandra Conte", "Noemí Zabala"]
discos = []
+++
**Póster**:
**Nota de tapa**:
**Reportajes**:
**Entrevistas**:
**Notas sobre**:
**Secciones**:
|
carlospeix/revista-pelo
|
content/numeros/1994/462.md
|
Markdown
|
mit
| 301
|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class General_model extends CI_Model {
public function validateLogin(){
if(($this->session->userdata('user_name')!=""))
{
return true;
}
else
{
redirect('signin');
}
}
}
?>
|
divyeshiflair/co-ncall
|
application/models/General_model.php
|
PHP
|
mit
| 294
|
import React from 'react';
import {Link} from "react-router";
import Subheading from '../components/Subheading';
import Portfolio4col from '../components/Portfolio/Portfolio4col';
export default class Layout extends React.Component {
constructor() {
super();
this.state = {
title:"Welcome to Momoware!",
};
}
changeTitle(title){
this.setState({title});
}
navigate() {
console.log(this.props);
}
render() {
return(
<div>
<Subheading title="Portfolio4col"/>
<Portfolio4col
projectImgPic1="http://placehold.it/700x300"
projectImgPic2="http://placehold.it/700x300"
projectImgPic3="http://placehold.it/700x300"
projectImgPic4="http://placehold.it/700x300"
/>
<Portfolio4col
projectImgPic1="http://placehold.it/700x300"
projectImgPic2="http://placehold.it/700x300"
projectImgPic3="http://placehold.it/700x300"
projectImgPic4="http://placehold.it/700x300"
/>
<Portfolio4col
projectImgPic1="http://placehold.it/700x300"
projectImgPic2="http://placehold.it/700x300"
projectImgPic3="http://placehold.it/700x300"
projectImgPic4="http://placehold.it/700x300"
/>
</div>
);
}
}
|
hadnazzar/ModernBusinessBootstrap-ReactComponent
|
src/js/pages/Portfolio4.js
|
JavaScript
|
mit
| 1,382
|
phone.slide
===========
手機簡報
|
weitsai/phone.slide
|
README.md
|
Markdown
|
mit
| 38
|
using System;
using MetroFramework.Forms;
using MetroFramework.Controls;
using ZasuvkaPtakopyskaExtender;
using System.Drawing;
using System.Windows.Forms;
using MetroFramework;
namespace ZasuvkaPtakopyska
{
public class OpenFileWithDialog : MetroForm
{
#region Private Static Data.
private static readonly int DEFAULT_SEPARATOR = 8;
private static readonly int DEFAULT_BUTTON_HEIGHT = 24;
private static readonly int DEFAULT_SIZE = 320;
#endregion
#region Private Data.
private string[] m_options;
private int m_selectedOption = -1;
private int m_contentHeight = 0;
#endregion
#region Public Properties.
public int ResultOptionIndex
{
get { return m_selectedOption; }
set { m_selectedOption = m_options == null || value < 0 || value > m_options.Length - 1 ? -1 : value; }
}
public string ResultOption
{
get
{
return m_options == null || m_selectedOption < 0 || m_selectedOption > m_options.Length - 1 ?
null :
m_options[m_selectedOption];
}
set
{
m_selectedOption = -1;
if (m_options != null && value != null)
{
for (int i = 0; i < m_options.Length; ++i)
if (m_options[i] == value)
m_selectedOption = i;
}
}
}
public int OptionsCount { get { return m_options == null ? 0 : m_options.Length; } }
#endregion
#region Construction and Destruction.
public OpenFileWithDialog(string options = "", string defaultButton = "Default Application")
: this(String.IsNullOrEmpty(options) ? null : options.Split('|'), defaultButton)
{
}
public OpenFileWithDialog(string[] options, string defaultButton = "Default Application")
{
MetroSkinManager.ApplyMetroStyle(this);
Text = "Open File With";
TextAlign = MetroFormTextAlign.Center;
Size = new Size(DEFAULT_SIZE, 0);
ShowInTaskbar = false;
ControlBox = false;
Resizable = false;
DialogResult = DialogResult.None;
m_options = options;
MetroPanel panel = new MetroPanel();
MetroSkinManager.ApplyMetroStyle(panel);
panel.Size = new Size(DEFAULT_SIZE, 0);
panel.Dock = DockStyle.Fill;
Controls.Add(panel);
int index = 0;
m_contentHeight = 0;
MetroTileIcon tile;
if (m_options != null)
{
foreach (string opt in m_options)
{
tile = new MetroTileIcon();
MetroSkinManager.ApplyMetroStyle(tile);
tile.Tag = index;
tile.Width = panel.Width;
tile.Height = DEFAULT_BUTTON_HEIGHT;
tile.Top = m_contentHeight;
tile.Text = opt;
tile.TextAlign = ContentAlignment.MiddleCenter;
tile.TileTextFontWeight = MetroTileTextWeight.Bold;
tile.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tile.Click += new EventHandler(tile_Click);
panel.Controls.Add(tile);
m_contentHeight = tile.Bottom + DEFAULT_SEPARATOR;
++index;
}
}
tile = new MetroTileIcon();
MetroSkinManager.ApplyMetroStyle(tile);
tile.Tag = -1;
tile.Width = panel.Width;
tile.Height = DEFAULT_BUTTON_HEIGHT;
tile.Top = m_contentHeight;
tile.Text = defaultButton;
tile.TextAlign = ContentAlignment.MiddleCenter;
tile.TileTextFontWeight = MetroTileTextWeight.Bold;
tile.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tile.Click += new EventHandler(tile_Click);
panel.Controls.Add(tile);
m_contentHeight = tile.Bottom + DEFAULT_SEPARATOR;
tile = new MetroTileIcon();
MetroSkinManager.ApplyMetroStyle(tile);
tile.Width = panel.Width;
tile.Height = DEFAULT_BUTTON_HEIGHT;
tile.Top = DEFAULT_SEPARATOR + DEFAULT_SEPARATOR + m_contentHeight;
tile.Text = "CANCEL";
tile.TextAlign = ContentAlignment.MiddleCenter;
tile.TileTextFontWeight = MetroTileTextWeight.Bold;
tile.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
tile.Click += new EventHandler(tile_Click);
panel.Controls.Add(tile);
m_contentHeight = tile.Bottom;
panel.Height = m_contentHeight;
Height = m_contentHeight + Padding.Vertical;
}
private void tile_Click(object sender, EventArgs e)
{
MetroTileIcon tile = sender as MetroTileIcon;
if (tile == null)
return;
if (tile.Tag is int)
ResultOptionIndex = (int)tile.Tag;
if (tile.Tag != null)
DialogResult = DialogResult.OK;
Close();
}
#endregion
}
}
|
PsichiX/Ptakopysk
|
development/ZasuvkaPtakopyska/ZasuvkaPtakopyska/OpenFileWithDialog.cs
|
C#
|
mit
| 5,476
|
# frozen_string_literal: true
require 'spec_helper'
feature 'User deleting topics' do
scenario 'cannot delete their own topic' do
user.log_in
topic = users_topic
topic.visit_topic
expect(topic).not_to be_deletable
end
context 'as an admin' do
scenario "can delete someone else's topic" do
admin.log_in
topic = someone_elses_topic
topic.visit_topic
expect(topic).to be_deletable
topic.delete
expect(topic).to have_redirected_after_delete
expect(topic).not_to be_listed
end
end
def user
@user ||= create(:user)
PageObject::User.new(@user)
end
def admin
@user = create(:user, :admin)
PageObject::User.new(@user)
end
def users_topic
topic = create(:topic, with_posts: 3, user: @user)
PageObject::Topic.new(topic)
end
def someone_elses_topic
topic = create(:topic, with_posts: 2)
PageObject::Topic.new(topic)
end
end
|
jvoss/thredded
|
spec/features/thredded/user_deletes_topic_spec.rb
|
Ruby
|
mit
| 944
|
<?php
class guardarUsuario extends controllerExtends {
public function main(\request $request) {
try {
$this->loadTableusuario();
$usuario = new usuario();
$usuario->setCedula($request->getParam('cedula'));
$usuario->setNombre($request->getParam('nombre'));
$usuario->setDireccion($request->getParam('direccion'));
$usuario->setTelfijo($request->getParam('telfijo'));
$usuario->setCelular($request->getParam('celular'));
$usuario->setRol_id($request->getParam('rol'));
$usuario->setCorreo($request->getParam('correo'));
$usuario->setContrasena($request->getParam('contrasena'), $this->getConfig()->getHash());
$usuarioDAO = new usuarioDAOExt($this->getConfig());
$respuesta1 = $usuarioDAO->insert($usuario);
if (count($respuesta1) > 0) {
$respuesta1 = $usuarioDAO->select();
$respuesta2 = array(
'code' => 200,
'datos' => $respuesta1
);
} else {
$respuesta2 = array(
'code' => 500,
'datos' => $respuesta1
);
}
$this->setParam('rsp', $respuesta2);
$this->setView('imprimirJson');
} catch (Exception $exc) {
echo $exc->getMessage();
}
}
private function loadTableusuario() {
require $this->getConfig()->getPath() . 'model/table/table.usuario.php';
require $this->getConfig()->getPath() . 'model/interface/interface.usuario.php';
require $this->getConfig()->getPath() . 'model/DAO/class.usuarioDAO.php';
require $this->getConfig()->getPath() . 'model/extended/class.usuarioDAOExt.php';
}
}
|
Jorge-CR/Eintrag
|
controller/class.guardarUsuarioController.php
|
PHP
|
mit
| 1,844
|
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import java.io.*;
import java.math.*;
public class Solution {
public int numWays(int n, int k) {
if (n == 0 || k == 0) {
return 0;
}
if (n == 1) {
return k;
}
int countSameColor = k * 1;
int countDifferentColor = k * (k - 1);
for (int i = 2; i < n; i++) {
int nextCountDifferentColor = countDifferentColor * (k - 1) + countSameColor * (k - 1);
int nextSameDifferentColor = countDifferentColor;
countDifferentColor = nextCountDifferentColor;
countSameColor = nextSameDifferentColor;
}
return countSameColor + countDifferentColor;
}
}
|
yehzhang/RapidTest
|
examples/solutions/PaintFence.java
|
Java
|
mit
| 763
|
package model
import skinny.DBSettings
import skinny.test._
import org.scalatest.fixture.FlatSpec
import org.scalatest._
import scalikejdbc._
import scalikejdbc.scalatest._
import org.joda.time._
class PasswordResetSpec extends FlatSpec with Matchers with DBSettings with AutoRollback {
}
|
yoshitakes/skinny-task-example
|
src/test/scala/model/PasswordResetSpec.scala
|
Scala
|
mit
| 291
|
import Message from '../components/Message';
import socket from '../socket';
import { SEAL_TEXT, SEAL_USER_TIMEOUT } from '../../../utils/const';
/** 用户是否被封禁 */
let isSeal = false;
export default function fetch<T = any>(
event: string,
data = {},
{ toast = true } = {},
): Promise<[string | null, T | null]> {
if (isSeal) {
Message.error(SEAL_TEXT);
return Promise.resolve([SEAL_TEXT, null]);
}
return new Promise((resolve) => {
socket.emit(event, data, (res: any) => {
if (typeof res === 'string') {
if (toast) {
Message.error(res);
}
/**
* 服务端返回封禁状态后, 本地存储该状态
* 用户再触发接口请求时, 直接拒绝
*/
if (res === SEAL_TEXT) {
isSeal = true;
// 用户封禁和ip封禁时效不同, 这里用的短时间
setTimeout(() => {
isSeal = false;
}, SEAL_USER_TIMEOUT);
}
resolve([res, null]);
} else {
resolve([null, res]);
}
});
});
}
|
yinxin630/fiora
|
packages/web/src/utils/fetch.ts
|
TypeScript
|
mit
| 1,273
|
<?php
return array (
'id' => 'portalmmm_ver2_subs342ic10tb',
'fallback' => 'portalmmm_ver2_subs342i',
'capabilities' =>
array (
),
);
|
cuckata23/wurfl-data
|
data/portalmmm_ver2_subs342ic10tb.php
|
PHP
|
mit
| 145
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace IISLogTools
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
|
wbf1013/IISLogTools
|
IISLogTools/Program.cs
|
C#
|
mit
| 495
|
/*
* Licensed under the MIT License (MIT)
*
* Copyright (c) 2013 AudioScience Inc.
*
* 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.
*/
/**
* util_imp.cpp
*
* Utility implementation
*/
#include <sstream>
#include <utility>
#include <map>
#include <vector>
#include <set>
#include <algorithm>
#include <string.h>
#include "enumeration.h"
#include "util.h"
#include "cassert.h"
#define IEEE1722_FORMAT_STR_DELIM ("_")
// 1722 Stream formats
#define IEEE1722_FORMAT_VERSION_SHIFT (63)
#define IEEE1722_FORMAT_VERSION_MASK (0x00000001)
#define IEEE1722_FORMAT_SUBTYPE_SHIFT (56)
#define IEEE1722_FORMAT_SUBTYPE_MASK (0x0000007f)
// IEC 61883
#define IEC61883_EXPECTED_TOKEN_COUNT (5)
#define IEC61883_SF_SHIFT (55)
#define IEC61883_SF_MASK (0x00000001)
#define IEC61883_TYPE_SHIFT (49)
#define IEC61883_TYPE_MASK (0x0000003f)
#define IEC61883_6_SFC_SHIFT (40)
#define IEC61883_6_SFC_MASK (0x00000007)
#define IEC61883_6_BLOCK_COUNT_SHIFT (32)
#define IEC61883_6_BLOCK_COUNT_MASK (0x000000ff)
#define IEC61883_6_BLOCKING_SHIFT (31)
#define IEC61883_6_BLOCKING_MASK (0x00000001)
#define IEC61883_6_NONBLOCKING_SHIFT (30)
#define IEC61883_6_NONBLOCKING_MASK (0x00000001)
#define IEC61883_6_UPTO_SHIFT (29)
#define IEC61883_6_UPTO_MASK (0x00000001)
#define IEC61883_6_SYNCHRONOUS_SHIFT (28)
#define IEC61883_6_SYNCHRONOUS_MASK (0x00000001)
#define IEC61883_6_PACKETIZATION_SHIFT (43)
#define IEC61883_6_PACKETIZATION_MASK (0x0000001f)
#define IEC61883_6_AM824_IEC60958_COUNT_SHIFT (16)
#define IEC61883_6_AM824_IEC60958_COUNT_MASK (0x000000ff)
#define IEC61883_6_AM824_MBLA_COUNT_SHIFT (8)
#define IEC61883_6_AM824_MBLA_COUNT_MASK (0x000000ff)
#define IEC61883_6_AM824_MIDI_COUNT_SHIFT (4)
#define IEC61883_6_AM824_MIDI_COUNT_MASK (0x0000000f)
#define IEC61883_6_AM824_SMPTE_COUNT_SHIFT (0)
#define IEC61883_6_AM824_SMPTE_COUNT_MASK (0x0000000f)
#define IEC61883_6_AM824_TOKEN_TYPE (0)
#define IEC61883_6_AM824_TOKEN_PACKETIZATION (1)
#define IEC61883_6_AM824_TOKEN_SFC (3)
#define IEC61883_6_AM824_TOKEN_BLOCK_COUNT (4)
// AAF
#define AAF_EXPECTED_TOKEN_COUNT (6)
#define AAF_UPTO_SHIFT (52)
#define AAF_UPTO_MASK (0x00000001)
#define AAF_NSR_SHIFT (48)
#define AAF_NSR_MASK (0x0000000f)
#define AAF_TYPE_SHIFT (40)
#define AAF_TYPE_MASK (0x000000ff)
#define AAF_PCM_BIT_DEPTH_SHIFT (32)
#define AAF_PCM_BIT_DEPTH_MASK (0x000000ff)
#define AAF_PCM_CHANNELS_PER_FRAME_SHIFT (22)
#define AAF_PCM_CHANNELS_PER_FRAME_MASK (0x000003ff)
#define AAF_PCM_SAMPLES_PER_FRAME_SHIFT (12)
#define AAF_PCM_SAMPLES_PER_FRAME_MASK (0x000003ff)
#define AAF_TOKEN_SUBTYPE (0)
#define AAF_TOKEN_NSR (1)
#define AAF_TOKEN_PACKETIZATION (2)
#define AAF_TOKEN_BIT_DEPTH (3)
#define AAF_TOKEN_CHANNELS_PER_FRAME (4)
#define AAF_TOKEN_SAMPLES_PER_FRAME (5)
// CRF
#define CRF_EXPECTED_TOKEN_COUNT (6)
#define CRF_TYPE_SHIFT (52)
#define CRF_TYPE_MASK (0x0000000f)
#define CRF_TIMESTAMP_INTERVAL_SHIFT (40)
#define CRF_TIMESTAMP_INTERVAL_MASK (0x00000fff)
#define CRF_TIMESTAMPS_PER_PDU_SHIFT (32)
#define CRF_TIMESTAMPS_PER_PDU_MASK (0x000000ff)
#define CRF_PULL_VALUE_SHIFT (29)
#define CRF_PULL_VALUE_MASK (0x00000007)
#define CRF_BASE_FREQUENCY_SHIFT (0)
#define CRF_BASE_FREQUENCY_MASK (0x1fffffff)
#define CRF_TOKEN_SUBTYPE (0)
#define CRF_TOKEN_TYPE (1)
#define CRF_TOKEN_TIMESTAMP_INTERVAL (2)
#define CRF_TOKEN_TIMESTAMPS_PER_PDU (3)
#define CRF_TOKEN_PULL (4)
#define CRF_TOKEN_BASE_FREQUENCY (5)
namespace avdecc_lib
{
namespace utility
{
const char * aem_cmds_names[] =
{
"ACQUIRE_ENTITY",
"LOCK_ENTITY",
"ENTITY_AVAILABLE",
"CONTROLLER_AVAILABLE",
"READ_DESCRIPTOR",
"WRITE_DESCRIPTOR",
"SET_CONFIGURATION",
"GET_CONFIGURATION",
"SET_STREAM_FORMAT",
"GET_STREAM_FORMAT",
"SET_VIDEO_FORMAT",
"GET_VIDEO_FORMAT",
"SET_SENSOR_FORMAT",
"GET_SENSOR_FORMAT",
"SET_STREAM_INFO",
"GET_STREAM_INFO",
"SET_NAME",
"GET_NAME",
"SET_ASSOCIATION_ID",
"GET_ASSOCIATION_ID",
"SET_SAMPLING_RATE",
"GET_SAMPLING_RATE",
"SET_CLOCK_SOURCE",
"GET_CLOCK_SOURCE",
"SET_CONTROL",
"GET_CONTROL",
"INCREMENT_CONTROL",
"DECREMENT_CONTROL",
"SET_SIGNAL_SELECTOR",
"GET_SIGNAL_SELECTOR",
"SET_MIXER",
"GET_MIXER",
"SET_MATRIX",
"GET_MATRIX",
"START_STREAMING",
"STOP_STREAMING",
"REGISTER_UNSOLICITED_NOTIFICATION",
"DEREGISTER_UNSOLICITED_NOTIFICATION",
"IDENTIFY_NOTIFICATION",
"GET_AVB_INFO",
"GET_AS_PATH",
"GET_COUNTERS",
"REBOOT",
"GET_AUDIO_MAP",
"ADD_AUDIO_MAPPINGS",
"REMOVE_AUDIO_MAPPINGS",
"GET_VIDEO_MAP",
"ADD_VIDEO_MAPPINGS",
"REMOVE_VIDEO_MAPPINGS",
"GET_SENSOR_MAP",
"ADD_SENSOR_MAPPINGS",
"REMOVE_SENSOR_MAPPINGS",
"START_OPERATION",
"ABORT_OPERATION",
"OPERATION_STATUS",
"AUTH_ADD_KEY",
"AUTH_DELETE_KEY",
"AUTH_GET_KEY_LIST",
"AUTH_GET_KEY",
"AUTH_ADD_KEY_TO_CHAIN",
"AUTH_DELETE_KEY_FROM_CHAIN",
"AUTH_GET_KEYCHAIN_LIST",
"AUTH_GET_IDENTITY",
"AUTH_ADD_TOKEN",
"AUTH_DELETE_TOKEN",
"AUTHENTICATE",
"DEAUTHENTICATE",
"ENABLE_TRANSPORT_SECURITY",
"DISABLE_TRANSPORT_SECURITY",
"ENABLE_STREAM_ENCRYPTION",
"DISABLE_STREAM_ENCRYPTION",
"SET_MEMORY_OBJECT_LENGTH",
"GET_MEMORY_OBJECT_LENGTH",
"SET_STREAM_BACKUP",
"GET_STREAM_BACKUP"};
const char * aem_descs_names[] =
{
"ENTITY",
"CONFIGURATION",
"AUDIO_UNIT",
"VIDEO_UNIT",
"SENSOR_UNIT",
"STREAM_INPUT",
"STREAM_OUTPUT",
"JACK_INPUT",
"JACK_OUTPUT",
"AVB_INTERFACE",
"CLOCK_SOURCE",
"MEMORY_OBJECT",
"LOCALE",
"STRINGS",
"STREAM_PORT_INPUT",
"STREAM_PORT_OUTPUT",
"EXTERNAL_PORT_INPUT",
"EXTERNAL_PORT_OUTPUT",
"INTERNAL_PORT_INPUT",
"INTERNAL_PORT_OUTPUT",
"AUDIO_CLUSTER",
"VIDEO_CLUSTER",
"SENSOR_CLUSTER",
"AUDIO_MAP",
"VIDEO_MAP",
"SENSOR_MAP",
"CONTROL",
"SIGNAL_SELECTOR",
"MIXER",
"MATRIX",
"MATRIX_SIGNAL",
"SIGNAL_SPLITTER",
"SIGNAL_COMBINER",
"SIGNAL_DEMULTIPLEXER",
"SIGNAL_MULTIPLEXER",
"SIGNAL_TRANSCODER",
"CLOCK_DOMAIN",
"CONTROL_BLOCK"};
const char * aem_cmds_status_names[] =
{
"SUCCESS", // AEM_STATUS_SUCCESS
"NOT_IMPLEMENTED", // AEM_STATUS_NOT_IMPLEMENTED
"NO_SUCH_DESCRIPTOR", // AEM_STATUS_NO_SUCH_DESCRIPTOR
"ENTITY_LOCKED", // AEM_STATUS_ENTITY_LOCKED
"ENTITY_ACQUIRED", // AEM_STATUS_ENTITY_ACQUIRED
"NOT_AUTHENTICATED", // AEM_STATUS_NOT_AUTHENTICATED
"AUTHENTICATION_DISABLED ", // AEM_STATUS_AUTHENTICATION_DISABLED
"BAD_ARGUMENTS", // AEM_STATUS_BAD_ARGUMENTS
"STATUS_NO_RESOURCES", // STATUS_NO_RESOURCES
"IN_PROGRESS", // AEM_STATUS_IN_PROGRESS
"ENTITY_MISBEHAVING", // AEM_STATUS_ENTITY_MISBEHAVING
"NOT_SUPPORTED", // AEM_STATUS_NOT_SUPPORTED
"STREAM_IS_RUNNING", // AEM_STATUS_STREAM_IS_RUNNING
};
const char * acmp_cmds_names[] =
{
"CONNECT_TX_COMMAND",
"CONNECT_TX_RESPONSE",
"DISCONNECT_TX_COMMAND",
"DISCONNECT_TX_RESPONSE",
"GET_TX_STATE_COMMAND",
"GET_TX_STATE_RESPONSE",
"CONNECT_RX_COMMAND",
"CONNECT_RX_RESPONSE",
"DISCONNECT_RX_COMMAND",
"DISCONNECT_RX_RESPONSE",
"GET_RX_STATE_COMMAND",
"GET_RX_STATE_RESPONSE",
"GET_TX_CONNECTION_COMMAND",
"GET_TX_CONNECTION_RESPONSE"};
const char * acmp_cmds_status_names[] =
{
"SUCCESS", // ACMP_STATUS_SUCCESS
"LISTENER_UNKNOWN_ID", // ACMP_STATUS_LISTENER_UNKNOWN_ID
"TALKER_UNKNOWN_ID", // ACMP_STATUS_TALKER_UNKNOWN_ID
"TALKER_DEST_MAC_FAIL", // ACMP_STATUS_TALKER_DEST_MAC_FAIL
"TALKER_NO_STREAM_INDEX", // ACMP_STATUS_TALKER_NO_STREAM_INDEX
"TALKER_NO_BANDWIDTH", // ACMP_STATUS_TALKER_NO_BANDWIDTH
"TALKER_EXCLUSIVE", // ACMP_STATUS_TALKER_EXCLUSIVE
"LISTENER_TALKER_TIMEOUT", // ACMP_STATUS_LISTENER_TALKER_TIMEOUT
"LISTENER_EXCLUSIVE", // ACMP_STATUS_LISTENER_EXCLUSIVE
"STATE_UNAVAILABLE", // ACMP_STATUS_STATE_UNAVAILABLE
"NOT_CONNECTED", // ACMP_STATUS_NOT_CONNECTED
"NO_SUCH_CONNECTION", // ACMP_STATUS_NO_SUCH_CONNECTION
"COULD_NOT_SEND_MESSAGE", // ACMP_STATUS_COULD_NOT_SEND_MESSAGE
"TALKER_MISBEHAVING", // ACMP_STATUS_TALKER_MISBEHAVING
"LISTENER_MISBEHAVING", // ACMP_STATUS_LISTENER_MISBEHAVING
"RESERVED", // ACMP_STATUS_RESERVED
"CONTROLLER_NOT_AUTHORIZED", // ACMP_STATUS_CONTROLLER_NOT_AUTHORIZED
"INCOMPATIBLE_REQUEST", // ACMP_STATUS_INCOMPATIBLE_REQUEST
"LISTENER_INVALID_CONNECTION" // ACMP_STATUS_LISTENER_INVALID_CONNECTION
};
const char * notification_names[] =
{
"NO_MATCH_FOUND",
"END_STATION_CONNECTED",
"END_STATION_DISCONNECTED",
"COMMAND_TIMEOUT",
"RESPONSE_RECEIVED",
"END_STATION_READ_COMPLETED",
"UNSOLICITED_RESPONSE_RECEIVED"};
const char * acmp_notification_names[] =
{
"NULL_ACMP_NOTIFICATION",
"BROADCAST_ACMP_RESPONSE_RECEIVED",
"ACMP_RESPONSE_RECEIVED"};
const char * logging_level_names[] =
{
"ERROR", // LOGGING_LEVEL_ERROR
"WARNING", // LOGGING_LEVEL_WARNING
"NOTICE", // LOGGING_LEVEL_NOTICE
"INFO", // LOGGING_LEVEL_INFO
"DEBUG", // LOGGING_LEVEL_DEBUG
"VERBOSE" // LOGGING_LEVEL_VERBOSE
};
struct acmp_command_and_timeout
{
uint32_t cmd;
uint32_t timeout_ms;
};
struct acmp_command_and_timeout acmp_command_and_timeout_table[] =
{
{avdecc_lib::CONNECT_TX_COMMAND, avdecc_lib::ACMP_CONNECT_TX_COMMAND_TIMEOUT_MS},
{avdecc_lib::DISCONNECT_TX_COMMAND, avdecc_lib::ACMP_DISCONNECT_TX_COMMAND_TIMEOUT_MS},
{avdecc_lib::GET_TX_STATE_COMMAND, avdecc_lib::ACMP_GET_TX_STATE_COMMAND_TIMEOUT_MS},
{avdecc_lib::CONNECT_RX_COMMAND, avdecc_lib::ACMP_CONNECT_RX_COMMAND_TIMEOUT_MS},
{avdecc_lib::DISCONNECT_RX_COMMAND, avdecc_lib::ACMP_DISCONNECT_RX_COMMAND_TIMEOUT_MS},
{avdecc_lib::GET_RX_STATE_COMMAND, avdecc_lib::ACMP_GET_RX_STATE_COMMAND_TIMEOUT_MS},
{avdecc_lib::GET_TX_CONNECTION_COMMAND, avdecc_lib::ACMP_GET_TX_CONNECTION_COMMAND_TIMEOUT_MS},
{avdecc_lib::AEM_ACMP_ERROR, 0xffff}};
const char * STDCALL aem_cmd_value_to_name(uint16_t cmd_value)
{
if (cmd_value < avdecc_lib::TOTAL_NUM_OF_AEM_CMDS)
{
return aem_cmds_names[cmd_value];
}
return "UNKNOWN";
}
uint16_t STDCALL aem_cmd_name_to_value(const char * cmd_name)
{
std::string cmd_name_string;
cmd_name_string = cmd_name;
std::transform(cmd_name_string.begin(), cmd_name_string.end(), cmd_name_string.begin(), ::toupper);
for (uint32_t i = 0; i < avdecc_lib::TOTAL_NUM_OF_AEM_CMDS; i++)
{
if (cmd_name_string == aem_cmds_names[i])
{
return (uint16_t)i;
}
}
return (uint16_t)avdecc_lib::AEM_CMD_ERROR;
}
const char * STDCALL aem_desc_value_to_name(uint16_t desc_value)
{
if (desc_value < avdecc_lib::TOTAL_NUM_OF_AEM_DESCS)
{
return aem_descs_names[desc_value];
}
return "UNKNOWN";
}
uint16_t STDCALL aem_desc_name_to_value(const char * desc_name)
{
std::string desc_name_string;
desc_name_string = desc_name;
std::transform(desc_name_string.begin(), desc_name_string.end(), desc_name_string.begin(), ::toupper);
for (uint32_t i = 0; i < avdecc_lib::TOTAL_NUM_OF_AEM_DESCS; i++)
{
if (desc_name_string.compare(aem_descs_names[i]) == 0)
{
return (uint16_t)i;
}
}
return (uint16_t)avdecc_lib::AEM_DESC_ERROR;
}
const char * STDCALL aem_cmd_status_value_to_name(uint32_t aem_cmd_status_value)
{
if (aem_cmd_status_value < avdecc_lib::TOTAL_NUM_OF_AEM_CMDS_STATUS)
{
return aem_cmds_status_names[aem_cmd_status_value];
}
else if (aem_cmd_status_value == avdecc_lib::AVDECC_LIB_STATUS_INVALID)
{
return "AVDECC_LIB_STATUS_INVALID";
}
else if (aem_cmd_status_value == avdecc_lib::AVDECC_LIB_STATUS_TICK_TIMEOUT)
{
return "AVDECC_LIB_STATUS_TICK_TIMEOUT";
}
return "UNKNOWN";
}
const char * STDCALL acmp_cmd_value_to_name(uint32_t cmd_value)
{
if (cmd_value < avdecc_lib::TOTAL_NUM_OF_ACMP_CMDS)
{
return acmp_cmds_names[cmd_value];
}
return "UNKNOWN";
}
uint16_t STDCALL acmp_cmd_name_to_value(const char * cmd_name)
{
std::string cmd_name_string;
cmd_name_string = cmd_name;
std::transform(cmd_name_string.begin(), cmd_name_string.end(), cmd_name_string.begin(), ::toupper);
for (uint32_t i = 0; i < avdecc_lib::TOTAL_NUM_OF_ACMP_CMDS; i++)
{
if (cmd_name_string == acmp_cmds_names[i])
{
return (uint16_t)i;
}
}
return (uint16_t)avdecc_lib::AEM_CMD_ERROR;
}
const char * STDCALL acmp_cmd_status_value_to_name(uint32_t acmp_cmd_status_value)
{
if (acmp_cmd_status_value < avdecc_lib::TOTAL_NUM_OF_ACMP_CMDS_STATUS)
{
return acmp_cmds_status_names[acmp_cmd_status_value];
}
return "UNKNOWN";
}
const char * STDCALL notification_value_to_name(uint16_t notification_value)
{
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#endif
compile_time_assert(ARRAY_SIZE(notification_names) == TOTAL_NUM_OF_NOTIFICATIONS, assert_notification_names_size);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
if (notification_value < avdecc_lib::TOTAL_NUM_OF_NOTIFICATIONS)
{
return notification_names[notification_value];
}
return "UNKNOWN";
}
const char * STDCALL acmp_notification_value_to_name(uint16_t acmp_notification_value)
{
if (acmp_notification_value < avdecc_lib::TOTAL_NUM_OF_ACMP_NOTIFICATIONS)
{
return acmp_notification_names[acmp_notification_value];
}
return "UNKNOWN";
}
const char * STDCALL logging_level_value_to_name(uint16_t logging_level_value)
{
if (logging_level_value < avdecc_lib::TOTAL_NUM_OF_LOGGING_LEVELS)
{
return logging_level_names[logging_level_value];
}
return "UNKNOWN";
}
uint32_t STDCALL acmp_cmd_to_timeout(const uint32_t acmp_cmd)
{
struct acmp_command_and_timeout * p = &acmp_command_and_timeout_table[0];
while (p->cmd != avdecc_lib::AEM_ACMP_ERROR)
{
if (p->cmd == acmp_cmd)
{
return p->timeout_ms;
}
p++;
}
return (uint32_t)0xffff;
}
const char * STDCALL end_station_mac_to_string(uint64_t end_station_mac)
{
static std::string mac_substring;
std::stringstream mac_to_string;
mac_to_string << std::hex << end_station_mac;
mac_substring = " [" + (mac_to_string.str().substr(mac_to_string.str().length() - 4, 2) + ":" +
mac_to_string.str().substr(mac_to_string.str().length() - 2, 2)) +
"]";
return mac_substring.c_str();
}
void convert_uint64_to_eui48(const uint64_t value, uint8_t new_value[6])
{
for (uint32_t i = 0; i < 6; i++)
{
new_value[i] = (uint8_t)(value >> ((5 - i) * 8));
}
}
void convert_eui48_to_uint64(const uint8_t value[6], uint64_t & new_value)
{
new_value = 0;
for (uint32_t i = 0; i < 6; i++)
{
new_value |= (uint64_t)value[i] << ((5 - i) * 8);
}
}
static std::set<std::string> ieee1722_format_names;
unsigned int ieee1722_format_value_extract_subtype(uint64_t format_value)
{
return ieee1722_stream_format(format_value).subtype();
}
unsigned int ieee1722_format_value_extract_sample_rate(uint64_t format_value)
{
unsigned int sample_rate = 0;
ieee1722_stream_format sf(format_value);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
sample_rate = iec_61883_iidc_format(format_value).sample_rate();
break;
case ieee1722_stream_format::AAF:
sample_rate = aaf_format(format_value).sample_rate();
break;
}
return sample_rate;
}
unsigned int ieee1722_format_value_extract_channel_count(uint64_t format_value)
{
unsigned int channel_count = 0;
ieee1722_stream_format sf(format_value);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
channel_count = iec_61883_iidc_format(format_value).channel_count();
break;
case ieee1722_stream_format::AAF:
channel_count = aaf_format(format_value).channel_count();
break;
}
return channel_count;
}
unsigned int ieee1722_format_value_extract_ut(uint64_t format_value)
{
unsigned int ut = 0;
ieee1722_stream_format sf(format_value);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
ut = iec_61883_iidc_format(format_value).upto();
break;
case ieee1722_stream_format::AAF:
ut = aaf_format(format_value).upto();
break;
}
return ut;
}
unsigned int ieee1722_format_value_extract_packetization(uint64_t format_value)
{
unsigned int packetization = 0;
ieee1722_stream_format sf(format_value);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
packetization = iec_61883_iidc_format(format_value).packetization_type_value();
break;
case ieee1722_stream_format::AAF:
packetization = aaf_format(format_value).packetization_type();
break;
}
return packetization;
}
const char * ieee1722_format_value_to_name(uint64_t format_value)
{
std::string format_name = "UNKNOWN";
ieee1722_stream_format sf(format_value);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
format_name = iec_61883_iidc_format(format_value).name();
break;
case ieee1722_stream_format::AAF:
format_name = aaf_format(format_value).name();
break;
case ieee1722_stream_format::CRF:
format_name = crf_format(format_value).name();
break;
}
auto it = ieee1722_format_names.find(format_name);
if (it == ieee1722_format_names.end())
return "UNKNOWN";
else
return (*it).c_str();
}
uint64_t ieee1722_format_name_to_value(const char * format_name)
{
ieee1722_stream_format sf(format_name);
switch (sf.subtype())
{
case ieee1722_stream_format::IIDC_61883:
return iec_61883_iidc_format(format_name).value();
case ieee1722_stream_format::AAF:
return aaf_format(format_name).value();
case ieee1722_stream_format::CRF:
return crf_format(format_name).value();
}
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
const std::map<unsigned int, std::string> ieee1722_stream_data_subtypes =
{
{ ieee1722_stream_format::IIDC_61883, "IIDC-61883" }, // IEC 61883/IIDC format
{ ieee1722_stream_format::MMA_STREAM, "MMA-STREAM" }, // MMA Streams
{ ieee1722_stream_format::AAF, "AAF" }, // AVTP Audio Format
{ ieee1722_stream_format::CVF, "CVF" }, // Compressed Video Format
{ ieee1722_stream_format::CRF, "CRF" } // Clock Reference Format
};
ieee1722_stream_format::ieee1722_stream_format(uint64_t format_value) : m_format_value(format_value)
{
m_version = (m_format_value >> IEEE1722_FORMAT_VERSION_SHIFT) & IEEE1722_FORMAT_VERSION_MASK;
m_subtype = (m_format_value >> IEEE1722_FORMAT_SUBTYPE_SHIFT) & IEEE1722_FORMAT_SUBTYPE_MASK;
}
ieee1722_stream_format::ieee1722_stream_format(const char * format_name) : m_format_name(format_name)
{
std::string s = format_name;
std::string subtype = s.substr(0, s.find(IEEE1722_FORMAT_STR_DELIM));
for (auto it = ieee1722_stream_data_subtypes.begin(); it != ieee1722_stream_data_subtypes.end(); ++it)
if (it->second == subtype)
m_subtype = it->first;
}
bool ieee1722_stream_format::subtype_from_str(std::string subtype)
{
bool subtype_found = false;
for (auto it = ieee1722_stream_data_subtypes.begin(); it != ieee1722_stream_data_subtypes.end(); ++it)
{
if (it->second == subtype)
{
m_subtype = it->first;
subtype_found = true;
}
}
return subtype_found;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
static const std::map<unsigned int, std::string> crf_types =
{
{ crf_format::CRF_USER, "USER" }, // User Specified
{ crf_format::CRF_AUDIO_SAMPLE, "AUDIO" }, // Audio sample timestamp
{ crf_format::CRF_VIDEO_FRAME, "VIDEO-FRAME" }, // Video frame sync timestamp
{ crf_format::CRF_VIDEO_LINE, "VIDEO-LINE" }, // Video line sync timestamp
{ crf_format::CRF_MACHINE_CYCLE, "MACHINE" }, // Machine cycle timestamp
};
static const std::map<unsigned int, std::string> crf_pull_values =
{
{ crf_format::MULTIPLY_1_0, "1.0-PULL" },
{ crf_format::MULTIPLY_1_1_001, "1/1.001-PULL" },
{ crf_format::MULTIPLY_1_001, "1.001-PULL" },
{ crf_format::MULTIPLY_24_25, "24/25-PULL" },
{ crf_format::MULTIPLY_25_24, "25/24-PULL" },
{ crf_format::MULTIPLY_1_8, "1/8-PULL" }
};
crf_format::crf_format(uint64_t format_value) : ieee1722_stream_format(format_value)
{
m_type = (m_format_value >> CRF_TYPE_SHIFT) & CRF_TYPE_MASK;
m_timestamp_interval = (m_format_value >> CRF_TIMESTAMP_INTERVAL_SHIFT) & CRF_TIMESTAMP_INTERVAL_MASK;
m_timestamps_per_pdu = (m_format_value >> CRF_TIMESTAMPS_PER_PDU_SHIFT) & CRF_TIMESTAMPS_PER_PDU_MASK;
m_pull_value = (m_format_value >> CRF_PULL_VALUE_SHIFT) & CRF_PULL_VALUE_MASK;
m_base_frequency = (m_format_value >> CRF_BASE_FREQUENCY_SHIFT) & CRF_BASE_FREQUENCY_MASK;
to_string();
}
void crf_format::to_string()
{
std::stringstream ss;
auto it = ieee1722_stream_data_subtypes.find(CRF);
if (it != ieee1722_stream_data_subtypes.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
it = crf_types.find(m_type);
if (it != crf_types.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_timestamp_interval) << "-INTVL" << IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_timestamps_per_pdu) << "-TS" << IEEE1722_FORMAT_STR_DELIM;
it = crf_pull_values.find(m_pull_value);
if (it != crf_pull_values.end())
{
ss << it->second<< IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_base_frequency) << "HZ";
m_format_name = ss.str();
ieee1722_format_names.insert(m_format_name);
}
}
}
}
void crf_format::to_val()
{
std::string s(m_format_name);
std::vector<std::string> tokens;
size_t pos = 0;
std::string token;
while ((pos = s.find(IEEE1722_FORMAT_STR_DELIM)) != std::string::npos) {
token = s.substr(0, pos);
tokens.push_back(token);
s.erase(0, pos + 1);
}
tokens.push_back(s);
if (tokens.size() != CRF_EXPECTED_TOKEN_COUNT)
return;
if (!subtype_from_str(tokens.at(CRF_TOKEN_SUBTYPE)))
return;
if (m_subtype == CRF)
{
if (!crf_type_from_str(tokens.at(CRF_TOKEN_TYPE)) ||
!crf_timestamp_interval_from_str(tokens.at(CRF_TOKEN_TIMESTAMP_INTERVAL)) ||
!crf_timestamps_per_pdu_from_str(tokens.at(CRF_TOKEN_TIMESTAMPS_PER_PDU)) ||
!crf_pull_value_from_str(tokens.at(CRF_TOKEN_PULL)) ||
!crf_base_frequency_from_str(tokens.at(CRF_TOKEN_BASE_FREQUENCY)))
return;
uint64_t val = uint64_t( (uint64_t) m_subtype << IEEE1722_FORMAT_SUBTYPE_SHIFT) |
((uint64_t) m_type << CRF_TYPE_SHIFT) |
((uint64_t) m_timestamp_interval << CRF_TIMESTAMP_INTERVAL_SHIFT) |
((uint64_t) m_timestamps_per_pdu << CRF_TIMESTAMPS_PER_PDU_SHIFT) |
((uint64_t) m_pull_value << CRF_PULL_VALUE_SHIFT) |
((uint64_t) m_base_frequency << CRF_BASE_FREQUENCY_SHIFT);
m_format_value = val;
}
}
bool crf_format::crf_type_from_str(std::string type)
{
bool crf_type_found = false;
for (auto it = crf_types.begin(); it != crf_types.end(); ++it)
{
if (it->second == type)
{
m_type = it->first;
crf_type_found = true;
}
}
return crf_type_found;
}
bool crf_format::crf_timestamp_interval_from_str(std::string timestamp_interval)
{
std::string timestamp_interval_str = timestamp_interval.substr(0, timestamp_interval.find("-INTVL"));
if (timestamp_interval_str.empty() || !isdigit(timestamp_interval_str[0]))
return false;
unsigned int timestamp_interval_val = (unsigned int) std::stoul(timestamp_interval_str, NULL, 0);
if (!timestamp_interval_val)
return false;
m_timestamp_interval = timestamp_interval_val;
return true;
}
bool crf_format::crf_timestamps_per_pdu_from_str(std::string timestamps_per_pdu)
{
std::string timestamps_per_pdu_str = timestamps_per_pdu.substr(0, timestamps_per_pdu.find("-INTVL"));
if (timestamps_per_pdu_str.empty() || !isdigit(timestamps_per_pdu_str[0]))
return false;
unsigned int timestamps_per_pdu_val = (unsigned int) std::stoul(timestamps_per_pdu_str, NULL, 0);
if (!timestamps_per_pdu_val)
return false;
m_timestamps_per_pdu = timestamps_per_pdu_val;
return true;
}
bool crf_format::crf_pull_value_from_str(std::string pull)
{
bool pull_value_found = false;
for (auto it = crf_pull_values.begin(); it != crf_pull_values.end(); ++it)
{
if (it->second == pull)
{
m_pull_value = it->first;
pull_value_found = true;
}
}
return pull_value_found;
}
bool crf_format::crf_base_frequency_from_str(std::string base_frequency)
{
std::string base_frequency_str = base_frequency.substr(0, base_frequency.find("-HZ"));
if (base_frequency_str.empty() || !isdigit(base_frequency_str[0]))
return false;
unsigned int base_frequency_val = (unsigned int) std::stoul(base_frequency_str, NULL, 0);
if (!base_frequency_val)
return false;
m_base_frequency = base_frequency_val;
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
static const std::map<unsigned int, std::string> aaf_nsr_values =
{
{ aaf_format::NSR_8KHZ, "8KHZ" },
{ aaf_format::NSR_16KHZ, "16KHZ" },
{ aaf_format::NSR_32KHZ, "32KHZ" },
{ aaf_format::NSR_44_1KHZ, "44.1KHZ" },
{ aaf_format::NSR_48KHZ, "48KHZ" },
{ aaf_format::NSR_88_2KHZ, "88.2KHZ" },
{ aaf_format::NSR_96KHZ, "96KHZ" },
{ aaf_format::NSR_176_4KHZ, "176.4KHZ" },
{ aaf_format::NSR_192KHZ, "192KHZ" },
{ aaf_format::NSR_24KHZ, "24KHZ" }
};
static const std::map<unsigned int, std::string> aaf_packetization_types =
{
{ aaf_format::FLOAT_32BIT, "FLOAT32" }, // 32-bit floating point
{ aaf_format::INT_32BIT, "INT32" }, // 32-bit integer
{ aaf_format::INT_24BIT, "INT24" }, // 24-bit integer
{ aaf_format::INT_16BIT, "INT16" }, // 16-bit integer
{ aaf_format::AES3_32BIT, "AES32" }, // 32-bit AES3 format
};
aaf_format::aaf_format(uint64_t format_value) : ieee1722_stream_format(format_value)
{
m_upto = (m_format_value >> AAF_UPTO_SHIFT) & AAF_UPTO_MASK;
m_nsr_value = (m_format_value >> AAF_NSR_SHIFT) & AAF_NSR_MASK;
m_packetization_type = (m_format_value >> AAF_TYPE_SHIFT) & AAF_TYPE_MASK;
switch (m_packetization_type)
{
case FLOAT_32BIT:
case INT_32BIT:
case INT_24BIT:
case INT_16BIT:
decode_aaf_pcm_fields();
break;
default:
break;
}
to_string();
}
unsigned int aaf_format::sample_rate()
{
switch (m_nsr_value)
{
case NSR_8KHZ:
return 8000;
case NSR_16KHZ:
return 16000;
case NSR_32KHZ:
return 32000;
case NSR_44_1KHZ:
return 44100;
case NSR_48KHZ:
return 48000;
case NSR_88_2KHZ:
return 88200;
case NSR_96KHZ:
return 96000;
case NSR_176_4KHZ:
return 176400;
case NSR_192KHZ:
return 192000;
case NSR_24KHZ:
return 24000;
}
return 0;
}
void aaf_format::to_string()
{
std::stringstream ss;
auto it = ieee1722_stream_data_subtypes.find(AAF);
if (it != ieee1722_stream_data_subtypes.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
it = aaf_nsr_values.find(m_nsr_value);
if (it != aaf_nsr_values.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
it = aaf_packetization_types.find(m_packetization_type);
if (it != aaf_packetization_types.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
if (m_packetization_type != AES3_32BIT)
{
ss << std::to_string(m_bit_depth) << "-BIT" << IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_channels_per_frame) << "CH" << IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_samples_per_frame) << "-SAMPLES";
m_format_name = ss.str();
ieee1722_format_names.insert(m_format_name);
}
}
}
}
}
void aaf_format::to_val()
{
std::string s(m_format_name);
std::vector<std::string> tokens;
size_t pos = 0;
std::string token;
while ((pos = s.find(IEEE1722_FORMAT_STR_DELIM)) != std::string::npos) {
token = s.substr(0, pos);
tokens.push_back(token);
s.erase(0, pos + 1);
}
tokens.push_back(s);
if (tokens.size() != AAF_EXPECTED_TOKEN_COUNT)
return;
if (!subtype_from_str(tokens.at(AAF_TOKEN_SUBTYPE)))
return;
if (m_subtype == AAF)
{
if (!aaf_packetization_type_from_str(tokens.at(AAF_TOKEN_PACKETIZATION)) ||
!aaf_nsr_from_str(tokens.at(AAF_TOKEN_NSR)))
return;
if (m_packetization_type != AES3_32BIT)
{
if (!aaf_bit_depth_from_str(tokens.at(AAF_TOKEN_BIT_DEPTH)) ||
!aaf_channels_per_frame_from_str(tokens.at(AAF_TOKEN_CHANNELS_PER_FRAME)) ||
!aaf_samples_per_frame_from_str(tokens.at(AAF_TOKEN_SAMPLES_PER_FRAME)))
return;
uint64_t val = uint64_t( (uint64_t) m_subtype << IEEE1722_FORMAT_SUBTYPE_SHIFT) |
((uint64_t) m_nsr_value << AAF_NSR_SHIFT) |
((uint64_t) m_packetization_type << AAF_TYPE_SHIFT) |
((uint64_t) m_bit_depth << AAF_PCM_BIT_DEPTH_SHIFT) |
((uint64_t) m_channels_per_frame << AAF_PCM_CHANNELS_PER_FRAME_SHIFT) |
((uint64_t) m_samples_per_frame << AAF_PCM_SAMPLES_PER_FRAME_SHIFT);
m_format_value = val;
}
}
}
void aaf_format::decode_aaf_pcm_fields()
{
m_bit_depth = (m_format_value >> AAF_PCM_BIT_DEPTH_SHIFT) & AAF_PCM_BIT_DEPTH_MASK;
m_channels_per_frame = (m_format_value >> AAF_PCM_CHANNELS_PER_FRAME_SHIFT) & AAF_PCM_CHANNELS_PER_FRAME_MASK;
m_samples_per_frame = (m_format_value >> AAF_PCM_SAMPLES_PER_FRAME_SHIFT) & AAF_PCM_SAMPLES_PER_FRAME_MASK;
}
bool aaf_format::aaf_packetization_type_from_str(std::string packetization_type)
{
bool packetization_type_found = false;
for (auto it = aaf_packetization_types.begin(); it != aaf_packetization_types.end(); ++it)
{
if (it->second == packetization_type)
{
m_packetization_type = it->first;
packetization_type_found = true;
}
}
return packetization_type_found;
}
bool aaf_format::aaf_nsr_from_str(std::string nsr)
{
bool nsr_value_found = false;
for (auto it = aaf_nsr_values.begin(); it != aaf_nsr_values.end(); ++it)
{
if (it->second == nsr)
{
m_nsr_value = it->first;
nsr_value_found = true;
}
}
return nsr_value_found;
}
bool aaf_format::aaf_bit_depth_from_str(std::string bit_depth)
{
std::string bit_depth_str = bit_depth.substr(0, bit_depth.find("-BIT"));
if (bit_depth_str.empty() || !isdigit(bit_depth_str[0]))
return false;
unsigned int bit_depth_val = (unsigned int) std::stoul(bit_depth_str, NULL, 0);
if (!bit_depth_val)
return false;
m_bit_depth = bit_depth_val;
return true;
}
bool aaf_format::aaf_channels_per_frame_from_str(std::string channels)
{
std::string channel_count_str = channels.substr(0, channels.find("CH"));
if (channel_count_str.empty() || !isdigit(channel_count_str[0]))
return false;
unsigned int channel_count_val = (unsigned int) std::stoul(channel_count_str, NULL, 0);
if (!channel_count_val)
return false;
m_channels_per_frame = channel_count_val;
return true;
}
bool aaf_format::aaf_samples_per_frame_from_str(std::string samples)
{
std::string samples_str = samples.substr(0, samples.find("-SAMPLES"));
if (samples_str.empty() || !isdigit(samples_str[0]))
return false;
unsigned int samples_val = (unsigned int) std::stoul(samples_str, NULL, 0);
if (!samples_val)
return false;
m_samples_per_frame = samples_val;
return true;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
static const std::map<unsigned int, std::string> iec61883_types =
{
{ iec_61883_iidc_format::IEC_61883_4, "IEC61883-4" }, // IEC 61883-4 MPEG2 TS
{ iec_61883_iidc_format::IEC_61883_6, "IEC61883-6" }, // IEC 61883-6 Audio/Music
{ iec_61883_iidc_format::IEC_61883_7, "IEC61883-7" }, // IEC 61883-7 ITU-R BO.1294 System B
{ iec_61883_iidc_format::IEC_61883_8, "IEC61883-8" }, // IEC 61883-8 BT.601 Video
};
static const std::map<unsigned int, std::string> iec61883_packetization_types =
{
{ iec_61883_iidc_format::FIXED_32BIT, "FIXED-32BIT" }, // 32-bit fixed-point packetization
{ iec_61883_iidc_format::FLOAT_32BIT, "FLOAT-32BIT" }, // 32-bit floating-point packetization
{ iec_61883_iidc_format::AM824, "AM824" }, // AM824 packetization
};
static const std::map<unsigned int, std::string> iec61883_fdf_sfc_values =
{
{ iec_61883_iidc_format::FDF_SFC_44_1KHZ, "44.1KHZ" },
{ iec_61883_iidc_format::FDF_SFC_48KHZ, "48KHZ" },
{ iec_61883_iidc_format::FDF_SFC_88_2KHZ, "88.2KHZ" },
{ iec_61883_iidc_format::FDF_SFC_96KHZ, "96KHZ" },
{ iec_61883_iidc_format::FDF_SFC_176_4KHZ, "176.4KHZ" },
{ iec_61883_iidc_format::FDF_SFC_192KHZ, "192KHZ" }
};
iec_61883_iidc_format::iec_61883_iidc_format(uint64_t format_value) : ieee1722_stream_format(format_value)
{
m_sf = (m_format_value >> IEC61883_SF_SHIFT) & IEC61883_SF_MASK;
if (m_sf) // IEC 61883-4, IEC 61883-6, IEC 61883-8
decode_iec_61883_type();
else // IIDC
decode_iidc_format();
to_string();
}
unsigned int iec_61883_iidc_format::sample_rate()
{
switch (m_fdf_sfc_value)
{
case FDF_SFC_44_1KHZ:
return 44100;
case FDF_SFC_48KHZ:
return 48000;
case FDF_SFC_88_2KHZ:
return 88200;
case FDF_SFC_96KHZ:
return 96000;
case FDF_SFC_176_4KHZ:
return 176400;
case FDF_SFC_192KHZ:
return 192000;
}
return 0;
}
void iec_61883_iidc_format::to_string()
{
std::stringstream ss;
if (m_sf) // IEC 61883-4, IEC 61883-6, IEC 61883-8
{
auto it = iec61883_types.find(m_iec61883_type);
if (it != iec61883_types.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
it = iec61883_packetization_types.find(m_packetization_type_value);
if (it != iec61883_packetization_types.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
if (m_packetization_type_value == AM824)
{
// FIX ME: Assume all IEC61883-6 AM824 formats
// have multi-bit linear audio (MBLA) quadlets.
ss << "MBLA" << IEEE1722_FORMAT_STR_DELIM;
}
it = iec61883_fdf_sfc_values.find(m_fdf_sfc_value);
if (it != iec61883_fdf_sfc_values.end())
{
ss << it->second << IEEE1722_FORMAT_STR_DELIM;
ss << std::to_string(m_dbs) << "CH";
m_format_name = ss.str();
ieee1722_format_names.insert(m_format_name);
}
}
}
}
}
void iec_61883_iidc_format::to_val()
{
std::string s(m_format_name);
std::vector<std::string> tokens;
size_t pos = 0;
std::string token;
while ((pos = s.find(IEEE1722_FORMAT_STR_DELIM)) != std::string::npos) {
token = s.substr(0, pos);
tokens.push_back(token);
s.erase(0, pos + 1);
}
tokens.push_back(s);
// SFC token may have been split, e.g. 176_4KHZ -> 176 4KHZ
if (tokens.size() == 6)
{
tokens.at(3) += IEEE1722_FORMAT_STR_DELIM + tokens.at(4);
tokens.erase(tokens.begin() + 4);
}
if (tokens.size() != IEC61883_EXPECTED_TOKEN_COUNT)
return;
if (!iec_61883_type_from_str(tokens.at(IEC61883_6_AM824_TOKEN_TYPE)))
return;
switch (m_iec61883_type)
{
case IEC_61883_6:
{
m_sf = 1;
m_nonblocking = 1; // assume non-blocking
if (!iec_61883_packetization_type_from_str(tokens.at(IEC61883_6_AM824_TOKEN_PACKETIZATION)))
return;
switch (m_packetization_type_value)
{
case AM824:
{
if (!iec_61883_sfc_from_str(tokens.at(IEC61883_6_AM824_TOKEN_SFC)) ||
!iec_61883_dbs_from_str(tokens.at(IEC61883_6_AM824_TOKEN_BLOCK_COUNT)))
return;
uint64_t val = uint64_t( (uint64_t) m_subtype << IEEE1722_FORMAT_SUBTYPE_SHIFT) |
((uint64_t) m_sf << IEC61883_SF_SHIFT) |
((uint64_t) m_iec61883_type << IEC61883_TYPE_SHIFT) |
((uint64_t) m_packetization_type_value << IEC61883_6_PACKETIZATION_SHIFT) |
((uint64_t) m_fdf_sfc_value << IEC61883_6_SFC_SHIFT) |
((uint64_t) m_dbs << IEC61883_6_BLOCK_COUNT_SHIFT) |
((uint64_t) m_nonblocking << IEC61883_6_NONBLOCKING_SHIFT) |
((uint64_t) m_dbs << IEC61883_6_AM824_MBLA_COUNT_SHIFT);
m_format_value = val;
}
default:
return;
}
}
default:
return;
}
}
void iec_61883_iidc_format::decode_iec_61883_type()
{
m_iec61883_type = (m_format_value >> IEC61883_TYPE_SHIFT) & IEC61883_TYPE_MASK;
switch (m_iec61883_type)
{
case IEC_61883_6:
decode_iec_61883_common();
decode_iec_61883_packetization_type();
break;
default:
break;
}
}
void iec_61883_iidc_format::decode_iec_61883_common()
{
m_fdf_sfc_value = (m_format_value >> IEC61883_6_SFC_SHIFT) & IEC61883_6_SFC_MASK;
m_dbs = (m_format_value >> IEC61883_6_BLOCK_COUNT_SHIFT) & IEC61883_6_BLOCK_COUNT_MASK;
m_blocking = (m_format_value >> IEC61883_6_BLOCKING_SHIFT) & IEC61883_6_BLOCKING_MASK;
m_nonblocking = (m_format_value >> IEC61883_6_NONBLOCKING_SHIFT) & IEC61883_6_NONBLOCKING_MASK;
m_upto = (m_format_value >> IEC61883_6_UPTO_SHIFT) & IEC61883_6_UPTO_MASK;
m_synchronous = (m_format_value >> IEC61883_6_SYNCHRONOUS_SHIFT) & IEC61883_6_SYNCHRONOUS_MASK;
}
void iec_61883_iidc_format::decode_iec_61883_packetization_type()
{
m_packetization_type_value = (m_format_value >> IEC61883_6_PACKETIZATION_SHIFT) & IEC61883_6_PACKETIZATION_MASK;
switch (m_packetization_type_value)
{
case AM824:
decode_iec_61883_am824_fields();
break;
default:
break;
}
}
void iec_61883_iidc_format::decode_iec_61883_am824_fields()
{
m_iec60958_count = (m_format_value >> IEC61883_6_AM824_IEC60958_COUNT_SHIFT) & IEC61883_6_AM824_IEC60958_COUNT_MASK;
m_mbla_count = (m_format_value >> IEC61883_6_AM824_MBLA_COUNT_SHIFT) & IEC61883_6_AM824_MBLA_COUNT_MASK;
m_midi_count = (m_format_value >> IEC61883_6_AM824_MIDI_COUNT_SHIFT) & IEC61883_6_AM824_MIDI_COUNT_MASK;
m_smpte_count = (m_format_value >> IEC61883_6_AM824_SMPTE_COUNT_SHIFT) & IEC61883_6_AM824_SMPTE_COUNT_MASK;
}
bool iec_61883_iidc_format::iec_61883_type_from_str(std::string type)
{
bool iec61883_type_found = false;
for (auto it = iec61883_types.begin(); it != iec61883_types.end(); ++it)
{
if (it->second == type)
{
m_iec61883_type = it->first;
iec61883_type_found = true;
}
}
return iec61883_type_found;
}
bool iec_61883_iidc_format::iec_61883_packetization_type_from_str(std::string packetization_type)
{
bool iec61883_packetization_type_found = false;
for (auto it = iec61883_packetization_types.begin(); it != iec61883_packetization_types.end(); ++it)
{
if (it->second == packetization_type)
{
m_packetization_type_value = it->first;
iec61883_packetization_type_found = true;
}
}
return iec61883_packetization_type_found;
}
bool iec_61883_iidc_format::iec_61883_sfc_from_str(std::string sfc)
{
bool iec61883_fdf_sfc_value_found = false;
for (auto it = iec61883_fdf_sfc_values.begin(); it != iec61883_fdf_sfc_values.end(); ++it)
{
if (it->second == sfc)
{
m_fdf_sfc_value = it->first;
iec61883_fdf_sfc_value_found = true;
}
}
return iec61883_fdf_sfc_value_found;
}
bool iec_61883_iidc_format::iec_61883_dbs_from_str(std::string dbs)
{
std::string channel_count_str = dbs.substr(0, dbs.find("CH"));
if (channel_count_str.empty() || !isdigit(channel_count_str[0]))
return false;
unsigned int channel_count_val = (unsigned int) std::stoul(channel_count_str, NULL, 0);
if (!channel_count_val)
return false;
m_dbs = channel_count_val;
return true;
}
}
}
|
audioscience/avdecc-lib
|
controller/lib/src/util.cpp
|
C++
|
mit
| 50,116
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.11.8: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.11.8
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li class="current"><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="functions.html"><span>All</span></a></li>
<li><a href="functions_func.html"><span>Functions</span></a></li>
<li><a href="functions_vars.html"><span>Variables</span></a></li>
<li><a href="functions_type.html"><span>Typedefs</span></a></li>
<li><a href="functions_enum.html"><span>Enumerations</span></a></li>
</ul>
</div>
<div id="navrow4" class="tabs3">
<ul class="tablist">
<li><a href="functions.html#index_a"><span>a</span></a></li>
<li><a href="functions_b.html#index_b"><span>b</span></a></li>
<li><a href="functions_c.html#index_c"><span>c</span></a></li>
<li><a href="functions_d.html#index_d"><span>d</span></a></li>
<li><a href="functions_e.html#index_e"><span>e</span></a></li>
<li><a href="functions_f.html#index_f"><span>f</span></a></li>
<li><a href="functions_g.html#index_g"><span>g</span></a></li>
<li><a href="functions_h.html#index_h"><span>h</span></a></li>
<li><a href="functions_i.html#index_i"><span>i</span></a></li>
<li><a href="functions_k.html#index_k"><span>k</span></a></li>
<li><a href="functions_l.html#index_l"><span>l</span></a></li>
<li><a href="functions_m.html#index_m"><span>m</span></a></li>
<li class="current"><a href="functions_n.html#index_n"><span>n</span></a></li>
<li><a href="functions_o.html#index_o"><span>o</span></a></li>
<li><a href="functions_p.html#index_p"><span>p</span></a></li>
<li><a href="functions_r.html#index_r"><span>r</span></a></li>
<li><a href="functions_s.html#index_s"><span>s</span></a></li>
<li><a href="functions_t.html#index_t"><span>t</span></a></li>
<li><a href="functions_u.html#index_u"><span>u</span></a></li>
<li><a href="functions_v.html#index_v"><span>v</span></a></li>
<li><a href="functions_w.html#index_w"><span>w</span></a></li>
<li><a href="functions_~.html#index_~"><span>~</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Here is a list of all documented class members with links to the class documentation for each member:</div>
<h3><a class="anchor" id="index_n"></a>- n -</h3><ul>
<li>Neuter()
: <a class="el" href="classv8_1_1_array_buffer.html#a3420f7d38a8fe20e8f40fb82e6acb325">v8::ArrayBuffer</a>
</li>
<li>New()
: <a class="el" href="classv8_1_1_array.html#ac3b086f18d6fd7e41cf28fe90018e877">v8::Array</a>
, <a class="el" href="classv8_1_1_array_buffer.html#abd389f38c2e8aa1414e0312baeea9f05">v8::ArrayBuffer</a>
, <a class="el" href="classv8_1_1_context.html#a43329765465b5f525ff28368b0cef2d4">v8::Context</a>
, <a class="el" href="classv8_1_1_function.html#a56e303d1019aaa7954de668aee8486f7">v8::Function</a>
, <a class="el" href="classv8_1_1_function_template.html#a803a1cbd72796de5d9509f33e6b1e975">v8::FunctionTemplate</a>
, <a class="el" href="classv8_1_1_isolate.html#a36f397e1d09e0122e89641288f348d2d">v8::Isolate</a>
, <a class="el" href="classv8_1_1_local.html#ac4024a7e2aea140c6aaa38fc32d5a840">v8::Local< T ></a>
, <a class="el" href="classv8_1_1_object_template.html#a394801526a9e9eb6df349a0eb8dfa0d0">v8::ObjectTemplate</a>
, <a class="el" href="classv8_1_1_reg_exp.html#ac92fcff5a40cf8c698aefd021c823c2e">v8::RegExp</a>
, <a class="el" href="classv8_1_1_script.html#a9f36775d3dfa63a02d265bb265e94638">v8::Script</a>
, <a class="el" href="classv8_1_1_script_data.html#a642fc06a9615387f9ac80f264758cc70">v8::ScriptData</a>
, <a class="el" href="classv8_1_1_string.html#a0b56fc1ad999590ce82f8348177ed725">v8::String</a>
</li>
<li>NewExternal()
: <a class="el" href="classv8_1_1_string.html#a5b98a12b3c09f22597d2ff3f9c9f2f2d">v8::String</a>
</li>
<li>NewFromOneByte()
: <a class="el" href="classv8_1_1_string.html#afa8026ed1337564a9fd15dc56aceaa83">v8::String</a>
</li>
<li>NewFromTwoByte()
: <a class="el" href="classv8_1_1_string.html#a876615eb027092a6a71a4e7d69b82d00">v8::String</a>
</li>
<li>NewFromUtf8()
: <a class="el" href="classv8_1_1_string.html#aa4b8c052f5108ca6350c45922602b9d4">v8::String</a>
</li>
<li>NewInstance()
: <a class="el" href="classv8_1_1_object_template.html#ad25d8ebf37b1a3aaf7d4a03b1a9bd5c1">v8::ObjectTemplate</a>
</li>
<li>NewSymbol()
: <a class="el" href="classv8_1_1_string.html#a5c0b10e71e456bbe859d0fe1c3216680">v8::String</a>
</li>
<li>NewUndetectable()
: <a class="el" href="classv8_1_1_string.html#a089ee9f9c9cd64552a55c6c3795aa4fa">v8::String</a>
</li>
<li>NumberOfHandles()
: <a class="el" href="classv8_1_1_handle_scope.html#abb2d32a75b0468885b7340404050604b">v8::HandleScope</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Aug 11 2015 23:46:13 for V8 API Reference Guide for node.js v0.11.8 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
|
v8-dox/v8-dox.github.io
|
a53c763/html/functions_n.html
|
HTML
|
mit
| 8,558
|
<md-toolbar class="md-table-toolbar md-default">
<div class="md-toolbar-tools">
<md-button id="main" class="md-icon-button md-primary" ng-click="back()" aria-label="Settings">
<md-icon md-font-icon="arrow_back" >arrow_back</md-icon>
</md-button>
<p>Trigger Logs</p>
</div>
<md-divider></md-divider>
</md-toolbar>
<md-content class="md-padding" layout="column" layout-gt-sm='column'>
<div layout="row" layout-align="center center">
<div flex="100" flex-gt-sm="75">
<md-card>
<md-card-title>
<md-card-title-text>
<span class="md-headline" translate>Trigger Details</span>
</md-card-title-text>
</md-card-title>
<md-card-content>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Summary</h3>
<p>{{ history.attr_1 }}</p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Created</h3>
<p>{{ history.created_at | humanTime }}</p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Event</h3>
<p>{{ ::history.trigger_event }}</p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Trigger</h3>
<p><a href="/#/locations/{{ location.slug }}/triggers/{{ ::history.trigger_id }}">{{ ::history.trigger_name }}</a></p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Success</h3>
<p>{{ ::history.success }}</p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Response</h3>
<p>{{ history.response || '-' }}</p>
</div>
</md-list-item>
<md-list-item class="md-2-line">
<div class="md-list-item-text">
<h3>Status Code</h3>
<p>{{ ::history.status }}</p>
</div>
</md-list-item>
</md-card-content>
<md-card-actions layout="row" layout-align="end center">
<md-button href="" ng-click="back()"><translate>Back</translate></md-button>
</md-card-actions>
</md-card>
</div>
</div>
</md-content>
|
simonmorley/cucumber-frontend
|
client/components/views/triggers/history/_show.html
|
HTML
|
mit
| 2,544
|
import { Enumerable } from "../enumerable_";
import { wrapInThunk } from "../common/wrap";
import { OperatorR } from "../common/types";
function _elementat<T>(source: Iterable<T>, index: number, defaultValue?: T): T | undefined {
if (index >= 0) {
var i = 0;
for (var item of source) {
if (i++ === index) {
return item;
}
}
}
return defaultValue;
}
export function elementat<T>(source: Iterable<T>, index: number, defaultValue: T): T;
export function elementat<T>(source: Iterable<T>, index: number): T | undefined;
export function elementat<T>(index: number, defaultValue: T): OperatorR<T, T>;
export function elementat<T>(index: number): OperatorR<T, T | undefined>;
export function elementat() {
return wrapInThunk(arguments, _elementat);
}
declare module '../enumerable_' {
interface Enumerable<T> {
elementat(index: number, defaultValue: T): T;
elementat(index: number): T | undefined;
}
}
Enumerable.prototype.elementat = function <T>(this: Enumerable<T>, index: number, defaultValue?: T): T | undefined {
return _elementat<T>(this, index, defaultValue);
};
|
marcinnajder/powerseq
|
src/operators/elementat.ts
|
TypeScript
|
mit
| 1,175
|
<?php
namespace Acd;
/**
* Response Class
* @author Acidvertigo MIT Licence
*/
class Response
{
/** @var array|string $headers variable containing the headers* */
private $headers;
/**
* Function to obtain the HTTP response headers
* @param string|null $url
* @return array a list of response headers
* @throws \InvalidArgumentException if response headers are null
*/
public function getResponseHeaders($url = null)
{
$response = @get_headers($url, 1);
if (!is_array($response) || $response === FALSE)
{
throw new \InvalidArgumentException('Unable to get Response Headers');
}
$this->headers = $response;
return $this->headers;
}
/**
* Gets HTTP status code
* @param string|null $url
* @return integer HTTP response code
* @throws \InvalidArgumentException if the status code is outside range
*/
public function getStatusCode($url = null)
{
$response = ($this->getResponseHeaders($url)[0]);
$codestatus = (int) substr($response, 9, 3);
if ($codestatus < 100 || $codestatus > 999)
{
throw new \InvalidArgumentException('Invalid response status code: ' . $codestatus);
}
return $codestatus;
}
}
|
acidvertigo/php-conf
|
core/Response.php
|
PHP
|
mit
| 1,329
|
/*
* Copyright (c) 2015 Cryptonomex, Inc., and contributors.
*
* The MIT License
*
* 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.
*/
#include <graphene/chain/assert_evaluator.hpp>
#include <graphene/chain/block_summary_object.hpp>
#include <graphene/chain/database.hpp>
#include <sstream>
namespace graphene { namespace chain {
struct predicate_evaluator
{
typedef void result_type;
const database& db;
predicate_evaluator( const database& d ):db(d){}
void operator()( const account_name_eq_lit_predicate& p )const
{
FC_ASSERT( p.account_id(db).name == p.name );
}
void operator()( const asset_symbol_eq_lit_predicate& p )const
{
FC_ASSERT( p.asset_id(db).symbol == p.symbol );
}
void operator()( const block_id_predicate& p )const
{
FC_ASSERT( block_summary_id_type( block_header::num_from_id( p.id ) & 0xffff )(db).block_id == p.id );
}
};
void_result assert_evaluator::do_evaluate( const assert_operation& o )
{ try {
const database& _db = db();
uint32_t skip = _db.get_node_properties().skip_flags;
auto max_predicate_opcode = _db.get_global_properties().parameters.max_predicate_opcode;
if( skip & database::skip_assert_evaluation )
return void_result();
for( const auto& p : o.predicates )
{
FC_ASSERT( p.which() >= 0 );
FC_ASSERT( unsigned(p.which()) < max_predicate_opcode );
p.visit( predicate_evaluator( _db ) );
}
return void_result();
} FC_CAPTURE_AND_RETHROW( (o) ) }
void_result assert_evaluator::do_apply( const assert_operation& o )
{ try {
// assert_operation is always a no-op
return void_result();
} FC_CAPTURE_AND_RETHROW( (o) ) }
} } // graphene::chain
|
bigoc/openchain
|
libraries/chain/assert_evaluator.cpp
|
C++
|
mit
| 2,803
|
# -*- coding: utf-8 -*-
import pytest
from mmb_perceptron.feature_extractor import FeatureExtractor
class TestFeatureExtractor(object):
"""Tests for feature extractors.
"""
def test_context_size(self):
f = FeatureExtractor()
assert f.context_size == (0, 0)
f.context_size = (1, 2)
assert f.context_size == (1, 2)
with pytest.raises(ValueError):
f.context_size = (-1, 1)
with pytest.raises(ValueError):
f.context_size = (1, -1)
assert f.context_size == (1, 2)
|
mbollmann/perceptron
|
test/test_feature_extractor.py
|
Python
|
mit
| 554
|
/*****************************************************************************/
/* PayRunResultModal: Event Handlers */
/*****************************************************************************/
import Ladda from 'ladda';
Template.PayRunResultModal.events({
});
/*****************************************************************************/
/* PayRunResultModal: Helpers */
/*****************************************************************************/
Template.PayRunResultModal.helpers({
});
/*****************************************************************************/
/* PayRunResultModal: Lifecycle Hooks */
/*****************************************************************************/
Template.PayRunResultModal.onCreated(function () {
let self = this;
});
Template.PayRunResultModal.onRendered(function () {
});
Template.PayRunResultModal.onDestroyed(function () {
});
|
c2gconsulting/bp-core
|
main/app/client/templates/modals/payrun_result_modal/payrun_result_modal.js
|
JavaScript
|
mit
| 899
|
Thread.abort_on_exception = true
module Concurrent
describe Map do
before(:each) do
@cache = described_class.new
end
it 'concurrency' do
(1..THREADS).map do |i|
Thread.new do
1000.times do |j|
key = i * 1000 + j
@cache[key] = i
@cache[key]
@cache.delete(key)
end
end
end.map(&:join)
end
it 'retrieval' do
expect_size_change(1) do
expect(nil).to eq @cache[:a]
expect(nil).to eq @cache.get(:a)
@cache[:a] = 1
expect(1).to eq @cache[:a]
expect(1).to eq @cache.get(:a)
end
end
it '#put_if_absent' do
with_or_without_default_proc do
expect_size_change(1) do
expect(nil).to eq @cache.put_if_absent(:a, 1)
expect(1).to eq @cache.put_if_absent(:a, 1)
expect(1).to eq @cache.put_if_absent(:a, 2)
expect(1).to eq @cache[:a]
end
end
end
describe '#compute_if_absent' do
it 'common' do
with_or_without_default_proc do
expect_size_change(3) do
expect(1).to eq @cache.compute_if_absent(:a) { 1 }
expect(1).to eq @cache.compute_if_absent(:a) { 2 }
expect(1).to eq @cache[:a]
@cache[:b] = nil
expect(nil).to eq @cache.compute_if_absent(:b) { 1 }
expect(nil).to eq @cache.compute_if_absent(:c) {}
expect(nil).to eq @cache[:c]
expect(true).to eq @cache.key?(:c)
end
end
end
it 'with return' do
with_or_without_default_proc do
expect_handles_return_lambda(:compute_if_absent, :a)
end
end
it 'exception' do
with_or_without_default_proc do
expect_handles_exception(:compute_if_absent, :a)
end
end
it 'atomicity' do
late_compute_threads_count = 10
late_put_if_absent_threads_count = 10
getter_threads_count = 5
compute_started = Concurrent::CountDownLatch.new(1)
compute_proceed = Concurrent::CountDownLatch.new(
late_compute_threads_count +
late_put_if_absent_threads_count +
getter_threads_count
)
block_until_compute_started = lambda do |name|
# what does it mean?
if (v = @cache[:a]) != nil
expect(nil).to v
end
compute_proceed.count_down
compute_started.wait
end
expect_size_change 1 do
late_compute_threads = Array.new(late_compute_threads_count) do
Thread.new do
block_until_compute_started.call('compute_if_absent')
expect(1).to eq @cache.compute_if_absent(:a) { fail }
end
end
late_put_if_absent_threads = Array.new(late_put_if_absent_threads_count) do
Thread.new do
block_until_compute_started.call('put_if_absent')
expect(1).to eq @cache.put_if_absent(:a, 2)
end
end
getter_threads = Array.new(getter_threads_count) do
Thread.new do
block_until_compute_started.call('getter')
Thread.pass while @cache[:a].nil?
expect(1).to eq @cache[:a]
end
end
Thread.new do
@cache.compute_if_absent(:a) do
compute_started.count_down
compute_proceed.wait
sleep(0.2)
1
end
end.join
(late_compute_threads +
late_put_if_absent_threads +
getter_threads).each(&:join)
end
end
end
describe '#compute_if_present' do
it 'common' do
with_or_without_default_proc do
expect_no_size_change do
expect(nil).to eq @cache.compute_if_present(:a) {}
expect(nil).to eq @cache.compute_if_present(:a) { 1 }
expect(nil).to eq @cache.compute_if_present(:a) { fail }
expect(false).to eq @cache.key?(:a)
end
@cache[:a] = 1
expect_no_size_change do
expect(1).to eq @cache.compute_if_present(:a) { 1 }
expect(1).to eq @cache[:a]
expect(2).to eq @cache.compute_if_present(:a) { 2 }
expect(2).to eq @cache[:a]
expect(false).to eq @cache.compute_if_present(:a) { false }
expect(false).to eq @cache[:a]
@cache[:a] = 1
yielded = false
@cache.compute_if_present(:a) do |old_value|
yielded = true
expect(1).to eq old_value
2
end
expect(true).to eq yielded
end
expect_size_change(-1) do
expect(nil).to eq @cache.compute_if_present(:a) {}
expect(false).to eq @cache.key?(:a)
expect(nil).to eq @cache.compute_if_present(:a) { 1 }
expect(false).to eq @cache.key?(:a)
end
end
end
it 'with return' do
with_or_without_default_proc do
@cache[:a] = 1
expect_handles_return_lambda(:compute_if_present, :a)
end
end
it 'exception' do
with_or_without_default_proc do
@cache[:a] = 1
expect_handles_exception(:compute_if_present, :a)
end
end
end
describe '#compute' do
it 'common' do
with_or_without_default_proc do
expect_no_size_change do
expect_compute(:a, nil, nil) {}
end
expect_size_change(1) do
expect_compute(:a, nil, 1) { 1 }
expect_compute(:a, 1, 2) { 2 }
expect_compute(:a, 2, false) { false }
expect(false).to eq @cache[:a]
end
expect_size_change(-1) do
expect_compute(:a, false, nil) {}
end
end
end
it 'with return' do
with_or_without_default_proc do
expect_handles_return_lambda(:compute, :a)
@cache[:a] = 1
expect_handles_return_lambda(:compute, :a)
end
end
it 'exception' do
with_or_without_default_proc do
expect_handles_exception(:compute, :a)
@cache[:a] = 2
expect_handles_exception(:compute, :a)
end
end
end
describe '#merge_pair' do
it 'common' do
with_or_without_default_proc do
expect_size_change(1) do
expect(nil).to eq @cache.merge_pair(:a, nil) { fail }
expect(true).to eq @cache.key?(:a)
expect(nil).to eq @cache[:a]
end
expect_no_size_change do
expect_merge_pair(:a, nil, nil, false) { false }
expect_merge_pair(:a, nil, false, 1) { 1 }
expect_merge_pair(:a, nil, 1, 2) { 2 }
end
expect_size_change(-1) do
expect_merge_pair(:a, nil, 2, nil) {}
expect(false).to eq @cache.key?(:a)
end
end
end
it 'with return' do
with_or_without_default_proc do
@cache[:a] = 1
expect_handles_return_lambda(:merge_pair, :a, 2)
end
end
it 'exception' do
with_or_without_default_proc do
@cache[:a] = 1
expect_handles_exception(:merge_pair, :a, 2)
end
end
end
it 'updates dont block reads' do
getters_count = 20
key_klass = Concurrent::ThreadSafe::Test::HashCollisionKey
keys = [key_klass.new(1, 100),
key_klass.new(2, 100),
key_klass.new(3, 100)] # hash colliding keys
inserted_keys = []
keys.each do |key, i|
compute_started = Concurrent::CountDownLatch.new(1)
compute_finished = Concurrent::CountDownLatch.new(1)
getters_started = Concurrent::CountDownLatch.new(getters_count)
getters_finished = Concurrent::CountDownLatch.new(getters_count)
computer_thread = Thread.new do
getters_started.wait
@cache.compute_if_absent(key) do
compute_started.count_down
getters_finished.wait
1
end
compute_finished.count_down
end
getter_threads = (1..getters_count).map do
Thread.new do
getters_started.count_down
inserted_keys.each do |inserted_key|
expect(true).to eq @cache.key?(inserted_key)
expect(1).to eq @cache[inserted_key]
end
expect(false).to eq @cache.key?(key)
compute_started.wait
inserted_keys.each do |inserted_key|
expect(true).to eq @cache.key?(inserted_key)
expect(1).to eq @cache[inserted_key]
end
expect(false).to eq @cache.key?(key)
expect(nil).to eq @cache[key]
getters_finished.count_down
compute_finished.wait
expect(true).to eq @cache.key?(key)
expect(1).to eq @cache[key]
end
end
(getter_threads << computer_thread).map do |t|
expect(t.join(2)).to be_truthy
end # asserting no deadlocks
inserted_keys << key
end
end
specify 'collision resistance' do
expect_collision_resistance(
(0..1000).map { |i| Concurrent::ThreadSafe::Test::HashCollisionKey(i, 1) }
)
end
specify 'collision resistance with arrays' do
special_array_class = Class.new(Array) do
def key # assert_collision_resistance expects to be able to call .key to get the "real" key
first.key
end
end
# Test collision resistance with a keys that say they responds_to <=>, but then raise exceptions
# when actually called (ie: an Array filled with non-comparable keys).
# See https://github.com/headius/thread_safe/issues/19 for more info.
expect_collision_resistance(
(0..100).map do |i|
special_array_class.new(
[Concurrent::ThreadSafe::Test::HashCollisionKeyNonComparable.new(i, 1)]
)
end
)
end
it '#replace_pair' do
with_or_without_default_proc do
expect_no_size_change do
expect(false).to eq @cache.replace_pair(:a, 1, 2)
expect(false).to eq @cache.replace_pair(:a, nil, nil)
expect(false).to eq @cache.key?(:a)
end
end
@cache[:a] = 1
expect_no_size_change do
expect(true).to eq @cache.replace_pair(:a, 1, 2)
expect(false).to eq @cache.replace_pair(:a, 1, 2)
expect(2).to eq @cache[:a]
expect(true).to eq @cache.replace_pair(:a, 2, 2)
expect(2).to eq @cache[:a]
expect(true).to eq @cache.replace_pair(:a, 2, nil)
expect(false).to eq @cache.replace_pair(:a, 2, nil)
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
expect(true).to eq @cache.replace_pair(:a, nil, nil)
expect(true).to eq @cache.key?(:a)
expect(true).to eq @cache.replace_pair(:a, nil, 1)
expect(1).to eq @cache[:a]
end
end
it '#replace_if_exists' do
with_or_without_default_proc do
expect_no_size_change do
expect(nil).to eq @cache.replace_if_exists(:a, 1)
expect(false).to eq @cache.key?(:a)
end
@cache[:a] = 1
expect_no_size_change do
expect(1).to eq @cache.replace_if_exists(:a, 2)
expect(2).to eq @cache[:a]
expect(2).to eq @cache.replace_if_exists(:a, nil)
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
expect(nil).to eq @cache.replace_if_exists(:a, 1)
expect(1).to eq @cache[:a]
end
end
end
it '#get_and_set' do
with_or_without_default_proc do
expect(nil).to eq @cache.get_and_set(:a, 1)
expect(true).to eq @cache.key?(:a)
expect(1).to eq @cache[:a]
expect(1).to eq @cache.get_and_set(:a, 2)
expect(2).to eq @cache.get_and_set(:a, nil)
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
expect(nil).to eq @cache.get_and_set(:a, 1)
expect(1).to eq @cache[:a]
end
end
it '#key' do
with_or_without_default_proc do
expect(nil).to eq @cache.key(1)
@cache[:a] = 1
expect(:a).to eq @cache.key(1)
expect(nil).to eq @cache.key(0)
end
end
it '#key?' do
with_or_without_default_proc do
expect(false).to eq @cache.key?(:a)
@cache[:a] = 1
expect(true).to eq @cache.key?(:a)
end
end
it '#value?' do
with_or_without_default_proc do
expect(false).to eq @cache.value?(1)
@cache[:a] = 1
expect(true).to eq @cache.value?(1)
end
end
it '#delete' do
with_or_without_default_proc do |default_proc_set|
expect_no_size_change do
expect(nil).to eq @cache.delete(:a)
end
@cache[:a] = 1
expect_size_change -1 do
expect(1).to eq @cache.delete(:a)
end
expect_no_size_change do
expect(nil).to eq @cache[:a] unless default_proc_set
expect(false).to eq @cache.key?(:a)
expect(nil).to eq @cache.delete(:a)
end
end
end
it '#delete_pair' do
with_or_without_default_proc do
expect_no_size_change do
expect(false).to eq @cache.delete_pair(:a, 2)
expect(false).to eq @cache.delete_pair(:a, nil)
end
@cache[:a] = 1
expect_no_size_change do
expect(false).to eq @cache.delete_pair(:a, 2)
end
expect_size_change(-1) do
expect(1).to eq @cache[:a]
expect(true).to eq @cache.delete_pair(:a, 1)
expect(false).to eq @cache.delete_pair(:a, 1)
expect(false).to eq @cache.key?(:a)
end
end
end
specify 'default proc' do
@cache = cache_with_default_proc(1)
expect_no_size_change do
expect(false).to eq @cache.key?(:a)
end
expect_size_change(1) do
expect(1).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
end
specify 'falsy default proc' do
@cache = cache_with_default_proc(nil)
expect_no_size_change do
expect(false).to eq @cache.key?(:a)
end
expect_size_change(1) do
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
end
describe '#fetch' do
it 'common' do
with_or_without_default_proc do |default_proc_set|
expect_no_size_change do
expect(1).to eq @cache.fetch(:a, 1)
expect(1).to eq @cache.fetch(:a) { 1 }
expect(false).to eq @cache.key?(:a)
expect(nil).to eq @cache[:a] unless default_proc_set
end
@cache[:a] = 1
expect_no_size_change do
expect(1).to eq @cache.fetch(:a) { fail }
end
expect { @cache.fetch(:b) }.to raise_error(KeyError)
expect_no_size_change do
expect(1).to eq @cache.fetch(:b, :c) {1} # assert block supersedes default value argument
expect(false).to eq @cache.key?(:b)
end
end
end
it 'falsy' do
with_or_without_default_proc do
expect(false).to eq @cache.key?(:a)
expect_no_size_change do
expect(nil).to eq @cache.fetch(:a, nil)
expect(false).to eq @cache.fetch(:a, false)
expect(nil).to eq @cache.fetch(:a) {}
expect(false).to eq @cache.fetch(:a) { false }
end
@cache[:a] = nil
expect_no_size_change do
expect(true).to eq @cache.key?(:a)
expect(nil).to eq @cache.fetch(:a) { fail }
end
end
end
it 'with return' do
with_or_without_default_proc do
r = fetch_with_return
# r = lambda do
# @cache.fetch(:a) { return 10 }
# end.call
expect_no_size_change do
expect(10).to eq r
expect(false).to eq @cache.key?(:a)
end
end
end
end
describe '#fetch_or_store' do
it 'common' do
with_or_without_default_proc do |default_proc_set|
expect_size_change(1) do
expect(1).to eq @cache.fetch_or_store(:a, 1)
expect(1).to eq @cache[:a]
end
@cache.delete(:a)
expect_size_change 1 do
expect(1).to eq @cache.fetch_or_store(:a) { 1 }
expect(1).to eq @cache[:a]
end
expect_no_size_change do
expect(1).to eq @cache.fetch_or_store(:a) { fail }
end
expect { @cache.fetch_or_store(:b) }.
to raise_error(KeyError)
expect_size_change(1) do
expect(1).to eq @cache.fetch_or_store(:b, :c) { 1 } # assert block supersedes default value argument
expect(1).to eq @cache[:b]
end
end
end
it 'falsy' do
with_or_without_default_proc do
expect(false).to eq @cache.key?(:a)
expect_size_change(1) do
expect(nil).to eq @cache.fetch_or_store(:a, nil)
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
@cache.delete(:a)
expect_size_change(1) do
expect(false).to eq @cache.fetch_or_store(:a, false)
expect(false).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
@cache.delete(:a)
expect_size_change(1) do
expect(nil).to eq @cache.fetch_or_store(:a) {}
expect(nil).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
@cache.delete(:a)
expect_size_change(1) do
expect(false).to eq @cache.fetch_or_store(:a) { false }
expect(false).to eq @cache[:a]
expect(true).to eq @cache.key?(:a)
end
@cache[:a] = nil
expect_no_size_change do
expect(nil).to eq @cache.fetch_or_store(:a) { fail }
end
end
end
it 'with return' do
with_or_without_default_proc do
r = fetch_or_store_with_return
expect_no_size_change do
expect(10).to eq r
expect(false).to eq @cache.key?(:a)
end
end
end
end
it '#clear' do
@cache[:a] = 1
expect_size_change(-1) do
expect(@cache).to eq @cache.clear
expect(false).to eq @cache.key?(:a)
expect(nil).to eq @cache[:a]
end
end
describe '#each_pair' do
it 'common' do
@cache.each_pair { |k, v| fail }
expect(@cache).to eq @cache.each_pair {}
@cache[:a] = 1
h = {}
@cache.each_pair { |k, v| h[k] = v }
expect({:a => 1}).to eq h
@cache[:b] = 2
h = {}
@cache.each_pair { |k, v| h[k] = v }
expect({:a => 1, :b => 2}).to eq h
end
it 'pair iterator' do
@cache[:a] = 1
@cache[:b] = 2
i = 0
r = @cache.each_pair do |k, v|
if i == 0
i += 1
next
fail
elsif i == 1
break :breaked
end
end
expect(:breaked).to eq r
end
it 'allows modification' do
@cache[:a] = 1
@cache[:b] = 1
@cache[:c] = 1
expect_size_change(1) do
@cache.each_pair do |k, v|
@cache[:z] = 1
end
end
end
end
it '#keys' do
expect([]).to eq @cache.keys
@cache[1] = 1
expect([1]).to eq @cache.keys
@cache[2] = 2
expect([1, 2]).to eq @cache.keys.sort
end
it '#values' do
expect([]).to eq @cache.values
@cache[1] = 1
expect([1]).to eq @cache.values
@cache[2] = 2
expect([1, 2]).to eq @cache.values.sort
end
it '#each_key' do
expect(@cache).to eq @cache.each_key { fail }
@cache[1] = 1
arr = []
@cache.each_key { |k| arr << k }
expect([1]).to eq arr
@cache[2] = 2
arr = []
@cache.each_key { |k| arr << k }
expect([1, 2]).to eq arr.sort
end
it '#each_value' do
expect(@cache).to eq @cache.each_value { fail }
@cache[1] = 1
arr = []
@cache.each_value { |k| arr << k }
expect([1]).to eq arr
@cache[2] = 2
arr = []
@cache.each_value { |k| arr << k }
expect([1, 2]).to eq arr.sort
end
it '#empty' do
expect(true).to eq @cache.empty?
@cache[:a] = 1
expect(false).to eq @cache.empty?
end
it 'options validation' do
expect_valid_options(nil)
expect_valid_options({})
expect_valid_options(foo: :bar)
end
it 'initial capacity options validation' do
expect_valid_option(:initial_capacity, nil)
expect_valid_option(:initial_capacity, 1)
expect_invalid_option(:initial_capacity, '')
expect_invalid_option(:initial_capacity, 1.0)
expect_invalid_option(:initial_capacity, -1)
end
it 'load factor options validation' do
expect_valid_option(:load_factor, nil)
expect_valid_option(:load_factor, 0.01)
expect_valid_option(:load_factor, 0.75)
expect_valid_option(:load_factor, 1)
expect_invalid_option(:load_factor, '')
expect_invalid_option(:load_factor, 0)
expect_invalid_option(:load_factor, 1.1)
expect_invalid_option(:load_factor, 2)
expect_invalid_option(:load_factor, -1)
end
it '#size' do
expect(0).to eq @cache.size
@cache[:a] = 1
expect(1).to eq @cache.size
@cache[:b] = 1
expect(2).to eq @cache.size
@cache.delete(:a)
expect(1).to eq @cache.size
@cache.delete(:b)
expect(0).to eq @cache.size
end
it '#get_or_default' do
with_or_without_default_proc do
expect(1).to eq @cache.get_or_default(:a, 1)
expect(nil).to eq @cache.get_or_default(:a, nil)
expect(false).to eq @cache.get_or_default(:a, false)
expect(false).to eq @cache.key?(:a)
@cache[:a] = 1
expect(1).to eq @cache.get_or_default(:a, 2)
end
end
it '#dup,#clone' do
[:dup, :clone].each do |meth|
cache = cache_with_default_proc(:default_value)
cache[:a] = 1
dupped = cache.send(meth)
expect(1).to eq dupped[:a]
expect(1).to eq dupped.size
expect_size_change(1, cache) do
expect_no_size_change(dupped) do
cache[:b] = 1
end
end
expect(false).to eq dupped.key?(:b)
expect_no_size_change(cache) do
expect_size_change(-1, dupped) do
dupped.delete(:a)
end
end
expect(false).to eq dupped.key?(:a)
expect(true).to eq cache.key?(:a)
# test default proc
expect_size_change(1, cache) do
expect_no_size_change dupped do
expect(:default_value).to eq cache[:c]
expect(false).to eq dupped.key?(:c)
end
end
expect_no_size_change cache do
expect_size_change 1, dupped do
expect(:default_value).to eq dupped[:d]
expect(false).to eq cache.key?(:d)
end
end
end
end
it 'is unfreezable' do
expect { @cache.freeze }.to raise_error(NoMethodError)
end
it 'marshal dump load' do
new_cache = Marshal.load(Marshal.dump(@cache))
expect(new_cache).to be_an_instance_of Concurrent::Map
expect(0).to eq new_cache.size
@cache[:a] = 1
new_cache = Marshal.load(Marshal.dump(@cache))
expect(1).to eq @cache[:a]
expect(1).to eq new_cache.size
end
it 'marshal dump doesnt work with default proc' do
expect { Marshal.dump(Concurrent::Map.new {}) }.to raise_error(TypeError)
end
it '#inspect' do
regexp = /\A#<Concurrent::Map:0x[0-9a-f]+ entries=[0-9]+ default_proc=.*>\Z/i
expect(Concurrent::Map.new.inspect).to match(regexp)
expect((Concurrent::Map.new {}).inspect).to match(regexp)
map = Concurrent::Map.new
map[:foo] = :bar
expect(map.inspect).to match(regexp)
end
private
def with_or_without_default_proc(&block)
block.call(false)
@cache = Concurrent::Map.new { |h, k| h[k] = :default_value }
block.call(true)
end
def cache_with_default_proc(default_value = 1)
Concurrent::Map.new { |cache, k| cache[k] = default_value }
end
def expect_size_change(change, cache = @cache, &block)
start = cache.size
block.call
expect(change).to eq cache.size - start
end
def expect_valid_option(option_name, value)
expect_valid_options(option_name => value)
end
def expect_valid_options(options)
c = Concurrent::Map.new(options)
expect(c).to be_an_instance_of Concurrent::Map
end
def expect_invalid_option(option_name, value)
expect_invalid_options(option_name => value)
end
def expect_invalid_options(options)
expect { Concurrent::Map.new(options) }.to raise_error(ArgumentError)
end
def expect_no_size_change(cache = @cache, &block)
expect_size_change(0, cache, &block)
end
def expect_handles_return_lambda(method, key, *args)
before_had_key = @cache.key?(key)
before_had_value = before_had_key ? @cache[key] : nil
returning_lambda = lambda do
@cache.send(method, key, *args) { return :direct_return }
end
expect_no_size_change do
expect(:direct_return).to eq returning_lambda.call
expect(before_had_key).to eq @cache.key?(key)
expect(before_had_value).to eq @cache[key] if before_had_value
end
end
class TestException < Exception; end
def expect_handles_exception(method, key, *args)
before_had_key = @cache.key?(key)
before_had_value = before_had_key ? @cache[key] : nil
expect_no_size_change do
expect { @cache.send(method, key, *args) { raise TestException, '' } }.
to raise_error(TestException)
expect(before_had_key).to eq @cache.key?(key)
expect(before_had_value).to eq @cache[key] if before_had_value
end
end
def expect_compute(key, expected_old_value, expected_result, &block)
result = @cache.compute(:a) do |old_value|
expect(expected_old_value).to eq old_value
block.call
end
expect(expected_result).to eq result
end
def expect_merge_pair(key, value, expected_old_value, expected_result, &block)
result = @cache.merge_pair(key, value) do |old_value|
expect(expected_old_value).to eq old_value
block.call
end
expect(expected_result).to eq result
end
def expect_collision_resistance(keys)
keys.each { |k| @cache[k] = k.key }
10.times do |i|
size = keys.size
while i < size
k = keys[i]
expect(k.key == @cache.delete(k) &&
!@cache.key?(k) &&
(@cache[k] = k.key; @cache[k] == k.key)).to be_truthy
i += 10
end
end
expect(keys.all? { |k| @cache[k] == k.key }).to be_truthy
end
# Took out for compatibility with Rubinius, see https://github.com/rubinius/rubinius/issues/1312
def fetch_with_return
lambda do
@cache.fetch(:a) { return 10 }
end.call
end
# Took out for compatibility with Rubinius, see https://github.com/rubinius/rubinius/issues/1312
def fetch_or_store_with_return
lambda do
@cache.fetch_or_store(:a) { return 10 }
end.call
end
end
end
|
MadBomber/concurrent-ruby
|
spec/concurrent/map_spec.rb
|
Ruby
|
mit
| 28,178
|
<?php
// Navigator class generated automatically by MDA process
namespace MyCompany\MyProject\SysBundle\Controller;
// Start of user code imports
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
// End of user code
class NavigationController extends Controller
{
private $navigation = array();
public function createAction() {
// just to build tree
$main = new Main();
$dummy = $main->getAction();
$this->navigation = array( 'mycompany_myproject_sysbundle_main'=> $main, );
ksort($this->navigation);
return $this->render('MyCompanyMyProjectSysBundle:ViewPart:navbar.html.twig',
array('navigation' => $this->navigation));
}
public function getAction($route, $entry)
{
$this->current=$route;
$url=$this->get('router')->generate($route);
//$url=$entry->url;
return $this->render('MyCompanyMyProjectSysBundle:ViewPart:navbarentry.html.twig', array('url' => $url));
}
}
?>
<?php
class Page101
{
public $title = "#sys_nav_page101#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE101";
public $name = "Page101";
public $url = "fr_FR/admin/locale/new";
public function getAction() {
// just to build tree
$this->navigation = array(
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Page001
{
public $title = "#sys_nav_page001#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE001";
public $name = "Page001";
public $url = "fr_FR/admin/role/new";
public function getAction() {
$page0010 = new Page0010();
// just to build tree
$dummy = $page0010->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page0010'
=> $page0010,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Section3
{
public $title = "#sys_nav_section3#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_SECTION3";
public $name = "Section3";
public $url = "fr_FR/admin/reference";
public function getAction() {
$page301 = new Page301();
// just to build tree
$dummy = $page301->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page301'
=> $page301,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Section2
{
public $title = "#sys_nav_section2#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_SECTION2";
public $name = "Section2";
public $url = "fr_FR/admin/user";
public function getAction() {
$page201 = new Page201();
// just to build tree
$dummy = $page201->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page201'
=> $page201,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Section1
{
public $title = "#sys_nav_section1#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_SECTION1";
public $name = "Section1";
public $url = "fr_FR/admin/system";
public function getAction() {
$page101 = new Page101();
// just to build tree
$dummy = $page101->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page101'
=> $page101,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Page0010
{
public $title = "#sys_nav_page0010#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE0010";
public $name = "Page0010";
public $url = "fr_FR/admin/role/new";
public function getAction() {
// just to build tree
$this->navigation = array(
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Main
{
public $title = "#sys_nav_main#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_MAIN";
public $name = "Main";
public $url = "fr_FR/admin/";
public function getAction() {
$section2 = new Section2();
$section0 = new Section0();
$section4 = new Section4();
$section3 = new Section3();
$section1 = new Section1();
// just to build tree
$dummy = $section2->getAction();
$dummy = $section0->getAction();
$dummy = $section4->getAction();
$dummy = $section3->getAction();
$dummy = $section1->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_section2'
=> $section2,
'mycompany_myproject_sysbundle_section0'
=> $section0,
'mycompany_myproject_sysbundle_section4'
=> $section4,
'mycompany_myproject_sysbundle_section3'
=> $section3,
'mycompany_myproject_sysbundle_section1'
=> $section1,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Page301
{
public $title = "#sys_nav_page301#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE301";
public $name = "Page301";
public $url = "fr_FR/admin/reference:new";
public function getAction() {
// just to build tree
$this->navigation = array(
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Section0
{
public $title = "#sys_nav_section0#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_SECTION0";
public $name = "Section0";
public $url = "fr_FR/admin/role";
public function getAction() {
$page001 = new Page001();
// just to build tree
$dummy = $page001->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page001'
=> $page001,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Page201
{
public $title = "#sys_nav_page201#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE201";
public $name = "Page201";
public $url = "fr_FR/admin/user/new";
public function getAction() {
// just to build tree
$this->navigation = array(
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Section4
{
public $title = "#sys_nav_section4#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_SECTION4";
public $name = "Section4";
public $url = "fr_FR/admin/menu";
public function getAction() {
$page401 = new Page401();
// just to build tree
$dummy = $page401->getAction();
$this->navigation = array(
'mycompany_myproject_sysbundle_page401'
=> $page401,
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
<?php
class Page401
{
public $title = "#sys_nav_page401#";
public $entries = array();
public $navigation = array();
public $role = "ROLE_SYS_PAGE401";
public $name = "Page401";
public $url = "fr_FR/admin/menu/new";
public function getAction() {
// just to build tree
$this->navigation = array(
);
ksort($this->navigation);
return $this->navigation;
}
}
?>
|
ithone/pam
|
src/MyCompany/MyProject/SysBundle/Controller/NavigationController.php
|
PHP
|
mit
| 7,419
|
import { Injectable } from '@angular/core';
import { ReplaySubject, Subject } from 'rxjs/Rx';
@Injectable()
export class MockNg2LocalforageService {
item;
list;
constructor() {
this.onInit();
}
onInit() {
this.item = new Subject();
this.list = new ReplaySubject();
}
getItem(input) {
if (input === 'list-2') {
return this.list.asObservable();
}
return this.item.asObservable();
}
setItem(input) {
}
update(updateInput, list?: boolean) {
if (list) {
this.list.next(updateInput);
} else {
this.item.next(updateInput);
this.item.complete();
}
}
}
|
adriancarriger/clean-to-the-core
|
src/mocks/mock-ng2-localforage.service.spec.ts
|
TypeScript
|
mit
| 630
|
require "collectd_gearman/application"
require "collectd_gearman/version"
module CollectdGearman
end
|
adrianlzt/collectd_gearman
|
lib/collectd_gearman.rb
|
Ruby
|
mit
| 102
|
{% block organization_item %}
<section class="group-list module module-narrow module-shallow">
{% block organization_item_header %}
<header class="module-heading">
{% set url=h.url_for(controller='organization', action='read', id=organization.name) %}
{% set truncate=truncate or 0 %}
{% block organization_item_header_image %}
<a class="module-image" href="{{ url }}">
<img src="{{ organization.image_display_url or h.url_for_static('/base/images/placeholder-organization.png') }}" alt="{{ organization.name }}" />
</a>
{% endblock %}
{% block organization_item_header_title %}
<h3 class="media-heading"><a href={{ url }}>{{ organization.title or organization.name }}</a></h3>
{% endblock %}
{% block organization_item_header_description %}
{% if organization.description %}
{% if truncate == 0 %}
<p >{{ h.markdown_extract(organization.description)|urlize }}</p>
{% else %}
<p>{{ h.markdown_extract(organization.description, truncate)|urlize }}</p>
{% endif %}
{% endif %}
{% endblock %}
</header>
{% endblock %}
{% block organization_item_content %}
{% set list_class = "unstyled dataset-list" %}
{% set item_class = "dataset-item module-content" %}
{% snippet 'snippets/package_list.html', packages=organization.packages, list_class=list_class, item_class=item_class, truncate=120 %}
{% endblock %}
</section>
{% endblock %}
|
cbgaindia/ckanext-openbudgetsin_theme
|
ckanext/openbudgetsin_theme/templates/snippets/organization_item.html
|
HTML
|
mit
| 1,563
|
/**
* ****************************************************************************
* Copyright (c) 2010-2016 by Min Cai (min.cai.china@gmail.com).
* <p>
* This file is part of the Archimulator multicore architectural simulator.
* <p>
* Archimulator is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* Archimulator is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with Archimulator. If not, see <http://www.gnu.org/licenses/>.
* ****************************************************************************
*/
package archimulator.core;
import java.util.ArrayList;
import java.util.List;
/**
* Physical register file.
*
* @author Min Cai
*/
public class PhysicalRegisterFile {
private String name;
private List<PhysicalRegister> registers;
private int numFreePhysicalRegisters;
/**
* Create a physical register file.
*
* @param name the name of the physical register file
* @param capacity the capacity
*/
public PhysicalRegisterFile(String name, int capacity) {
this.name = name;
this.registers = new ArrayList<>();
for (int i = 0; i < capacity; i++) {
this.registers.add(new PhysicalRegister(this));
}
this.setNumFreePhysicalRegisters(capacity);
}
/**
* Allocate a physical register for the specified dependency.
*
* @param dependency the dependency
* @return the newly allocated physical register for the specified dependency
*/
public PhysicalRegister allocate(int dependency) {
for (PhysicalRegister physReg : this.registers) {
if (physReg.getState() == PhysicalRegisterState.AVAILABLE) {
physReg.allocate(dependency);
return physReg;
}
}
throw new IllegalArgumentException();
}
/**
* Get a value indicating whether the physical register file is full or not.
*
* @return a value indicating whether the physical register file is full or not
*/
public boolean isFull() {
return this.numFreePhysicalRegisters == 0;
}
/**
* Get the name of the physical register file.
*
* @return the name of the physical register file
*/
public String getName() {
return name;
}
/**
* Get the list of physical registers.
*
* @return the list of physical registers
*/
public List<PhysicalRegister> getRegisters() {
return registers;
}
/**
* Get the number of free physical registers.
*
* @return the number of free physical registers
*/
public int getNumFreePhysicalRegisters() {
return numFreePhysicalRegisters;
}
/**
* Set the number of free physical registers.
*
* @param numFreePhysicalRegisters the number of free physical registers
*/
public void setNumFreePhysicalRegisters(int numFreePhysicalRegisters) {
this.numFreePhysicalRegisters = numFreePhysicalRegisters;
}
}
|
mcai/Archimulator
|
src/main/java/archimulator/core/PhysicalRegisterFile.java
|
Java
|
mit
| 3,464
|
package TheOtherOne::Command::client;
use strict;
use warnings;
use feature ':5.14';
use List::Util qw(none);
use TheOtherOne -command;
use TheOtherOne::Client;
my $socket_key = lc TheOtherOne::Client::SOCKET;
my $http_key = lc TheOtherOne::Client::HTTP;
sub abstract {
'connect to too server';
}
sub opt_spec {
return (
[ "$socket_key|s", 'use socket' ],
[ "$http_key|h", 'use http' ],
[ 'host|t=s', 'socket|http host', { default => '127.0.0.1' } ],
[ 'port|p=s', 'socket|http port', { default => '7777' } ],
[ 'verbose|v', 'speaks verbosely', { default => 0 } ],
);
}
sub validate_args {
my ($self, $opt, $args) = @_;
if ( none { $opt->{$_}; } ($socket_key, $http_key) ) {
$opt->{$socket_key} = 1;
}
}
sub execute {
my ($self, $opt, $args) = @_;
if ( $opt->{$socket_key} ) {
TheOtherOne::Client->get($socket_key)->run($opt->{host}, $opt->{port}, $args->[0], $opt->{verbose});
}
elsif ( $opt->{$http_key} ) {
}
else {
print $self->usage;
}
}
1;
|
oogatta/TheOtherOne
|
lib/TheOtherOne/Command/client.pm
|
Perl
|
mit
| 1,039
|
package org.zalando.logbook.spring.webflux;
import org.reactivestreams.Publisher;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.http.server.reactive.ServerHttpResponseDecorator;
import reactor.core.publisher.Mono;
@SuppressWarnings({"NullableProblems"})
class BufferingServerHttpResponse extends ServerHttpResponseDecorator {
private final ServerResponse serverResponse;
BufferingServerHttpResponse(ServerHttpResponse delegate, ServerResponse serverResponse, Runnable writeHook) {
super(delegate);
this.serverResponse = serverResponse;
beforeCommit(() -> {
writeHook.run();
return Mono.empty();
});
}
@Override
public Mono<Void> writeWith(Publisher<? extends DataBuffer> body) {
return super.writeWith(bufferingWrap(body));
}
private Publisher<? extends DataBuffer> bufferingWrap(Publisher<? extends DataBuffer> body) {
if (serverResponse.shouldBuffer()) {
return DataBufferCopyUtils.wrapAndBuffer(body, serverResponse::buffer);
} else {
return body;
}
}
}
|
zalando/logbook
|
logbook-spring-webflux/src/main/java/org/zalando/logbook/spring/webflux/BufferingServerHttpResponse.java
|
Java
|
mit
| 1,210
|
require('modules/collision')
require('modules/player')
require('modules/bullet')
function love.load(args)
player = Player:new()
walls = {}
table.insert(walls, collision.collider:addRectangle(256, 256, 512, 16))
bullets = {}
end
function love.update(dt)
player:setState('leg', 'idle')
player:setState('torso', 'idle')
if love.keyboard.isDown('d') then
player:move(200 * dt, 0)
player:setState('leg', 'walk')
player:setState('torso', 'move')
end
if love.keyboard.isDown('a') then
player:move(-200 * dt, 0)
player:setState('leg', 'walk')
player:setState('torso', 'move')
end
if love.keyboard.isDown('w') then
player:move(0, -200 * dt)
player:setState('leg', 'walk')
player:setState('torso', 'move')
end
if love.keyboard.isDown('s') then
player:move(0, 200 * dt)
player:setState('leg', 'walk')
player:setState('torso', 'move')
end
player:rotateTowards(love.mouse.getX(), love.mouse.getY())
player:update(dt)
for k, v in pairs(bullets) do
v:update(dt)
if v.destroyed then
table.remove(bullets, k)
end
end
collision.collider:update(dt)
end
function love.draw()
for k, v in pairs(bullets) do
v:draw()
end
player:draw()
love.graphics.setColor(255, 0, 0, 255)
for k, v in pairs(walls) do
v:draw('fill')
end
end
function love.mousepressed(x, y, button)
if button == 'l' then
table.insert(bullets, Bullet:new(player:getPosition().x + 46 * math.cos(player:getRotation()) - 26 * math.sin(player:getRotation()), player:getPosition().y + 46 * math.sin(player:getRotation()) + 26 * math.cos(player:getRotation()), player:getRotation()))
player:setState('torso', 'shoot')
end
end
|
Julzso23/blowthedoorsoff
|
main.lua
|
Lua
|
mit
| 1,638
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `XKB_KEY_osfUndo` constant in crate `wayland_kbd`.">
<meta name="keywords" content="rust, rustlang, rust-lang, XKB_KEY_osfUndo">
<title>wayland_kbd::keysyms::XKB_KEY_osfUndo - Rust</title>
<link rel="stylesheet" type="text/css" href="../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<section class="sidebar">
<p class='location'><a href='../index.html'>wayland_kbd</a>::<wbr><a href='index.html'>keysyms</a></p><script>window.sidebarCurrent = {name: 'XKB_KEY_osfUndo', ty: 'constant', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</section>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press 'S' to search, '?' for more options..."
type="search">
</div>
</form>
</nav>
<section id='main' class="content constant">
<h1 class='fqn'><span class='in-band'><a href='../index.html'>wayland_kbd</a>::<wbr><a href='index.html'>keysyms</a>::<wbr><a class='constant' href=''>XKB_KEY_osfUndo</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>−</span>]
</a>
</span><a id='src-7127' class='srclink' href='../../src/wayland_kbd/ffi/keysyms.rs.html#2954' title='goto source code'>[src]</a></span></h1>
<pre class='rust const'>pub const XKB_KEY_osfUndo: <a href='http://doc.rust-lang.org/nightly/std/primitive.u32.html'>u32</a><code> = </code><code>0x1004FF65</code></pre></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<div id="help" class="hidden">
<div class="shortcuts">
<h1>Keyboard shortcuts</h1>
<dl>
<dt>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>⇤</dt>
<dd>Move up in search results</dd>
<dt>⇥</dt>
<dd>Move down in search results</dd>
<dt>⏎</dt>
<dd>Go to active search result</dd>
</dl>
</div>
<div class="infos">
<h1>Search tricks</h1>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>typedef</code> (or
<code>tdef</code>).
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code>)
</p>
</div>
</div>
<script>
window.rootPath = "../../";
window.currentCrate = "wayland_kbd";
window.playgroundUrl = "";
</script>
<script src="../../jquery.js"></script>
<script src="../../main.js"></script>
<script async src="../../search-index.js"></script>
</body>
</html>
|
mcanders/bevy
|
doc/wayland_kbd/keysyms/constant.XKB_KEY_osfUndo.html
|
HTML
|
mit
| 3,827
|
/**
* The MIT License (MIT)
*
* Copyright (c) 2017 Vseslav Sekorin
*/
package com.vssekorin.bilogic.util;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.Accessors;
/**
* The pair.
*
* @author Vseslav Sekorin (vssekorin@gmail.com)
* @version $Id$
* @param <T> Type of elements.
* @since 1.0
*/
@AllArgsConstructor
public final class Pair<T> {
/**
* The first element.
*/
@Getter @Accessors(fluent = true)
private final T first;
/**
* The second element.
*/
@Getter @Accessors(fluent = true)
private final T second;
}
|
VsSekorin/BiLogic
|
src/main/java/com/vssekorin/bilogic/util/Pair.java
|
Java
|
mit
| 611
|
class CreateSummaries < ActiveRecord::Migration
def change
create_table :summaries do |t|
t.integer :user_id
t.integer :day_id
t.text :content
t.timestamps
end
end
end
|
loganhasson/lykke
|
db/migrate/20140531195812_create_summaries.rb
|
Ruby
|
mit
| 205
|
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import static org.junit.Assert.*;
public class P61_CyclicalFigurateNumbersTest {
@Test
public void getSum() throws Exception {
List<Long> list = new ArrayList<>();
list.add(1234L);
assertEquals(1234, P61_CyclicalFigurateNumbers.getSum(list));
list.add(3456L);
assertEquals(1234 + 3456, P61_CyclicalFigurateNumbers.getSum(list));
list.add(5678L);
assertEquals(1234 + 3456 + 5678, P61_CyclicalFigurateNumbers.getSum(list));
list.add(7890L);
assertEquals(1234 + 3456 + 5678 + 7890, P61_CyclicalFigurateNumbers.getSum(list));
list.add(9012L);
assertEquals(1234 + 3456 + 5678 + 7890 + 9012, P61_CyclicalFigurateNumbers.getSum(list));
list.add(1234L);
assertEquals(1234 + 3456 + 5678 + 7890 + 9012 + 1234, P61_CyclicalFigurateNumbers.getSum(list));
}
}
|
bruckhaus/challenges
|
java_challenges/ProjectEuler/test/P61_CyclicalFigurateNumbersTest.java
|
Java
|
mit
| 940
|
/**
* iOS and Android apis should match.
* It doesn't matter if you export `.ios` or `.android`, either one but only one.
*/
export * from './mapbox.ios';
// Export any shared classes, constants, etc.
export * from './mapbox.common';
|
sK0pe/nativescript-mapbox
|
src/index.d.ts
|
TypeScript
|
mit
| 237
|
/* global Mousetrap */
import { typeOf } from '@ember/utils';
import { get } from "@ember/object";
export function bindKeyboardShortcuts(context) {
const shortcuts = get(context, 'keyboardShortcuts');
if (typeOf(shortcuts) !== 'object') {
return;
}
context._mousetraps = [];
Object.keys(shortcuts).forEach(function(shortcut) {
const actionObject = shortcuts[shortcut];
let mousetrap;
let preventDefault = true;
function invokeAction(action, eventType) {
let type = typeOf(action);
let callback;
if (type === 'string') {
callback = function() {
context.send(action);
return preventDefault !== true;
};
} else if (type === 'function') {
callback = action.bind(context);
} else {
throw new Error('Invalid value for keyboard shortcut: ' + action);
}
mousetrap.bind(shortcut, callback, eventType);
}
if (typeOf(actionObject) === 'object') {
if (actionObject.global === false) {
mousetrap = new Mousetrap(document);
} else if (actionObject.scoped) {
if (typeOf(actionObject.scoped) === 'boolean') {
mousetrap = new Mousetrap(get(context, 'element'));
} else if (typeOf(actionObject.scoped) === 'string') {
mousetrap = new Mousetrap(
document.querySelector(actionObject.scoped)
);
}
} else if (actionObject.targetElement) {
mousetrap = new Mousetrap(actionObject.targetElement);
} else {
mousetrap = new Mousetrap(document.body);
}
if (actionObject.preventDefault === false) {
preventDefault = false;
}
invokeAction(actionObject.action, actionObject.eventType);
} else {
mousetrap = new Mousetrap(document.body);
invokeAction(actionObject);
}
context._mousetraps.push(mousetrap);
});
}
export function unbindKeyboardShortcuts(context) {
const _removeEvent = (object, type, callback) => {
if (object.removeEventListener) {
object.removeEventListener(type, callback, false);
return;
}
object.detachEvent('on' + type, callback);
};
Array.isArray(context._mousetraps) && context._mousetraps.forEach(mousetrap => {
// manually unbind JS event
_removeEvent(mousetrap.target, 'keypress', mousetrap._handleKeyEvent);
_removeEvent(mousetrap.target, 'keydown', mousetrap._handleKeyEvent);
_removeEvent(mousetrap.target, 'keyup', mousetrap._handleKeyEvent);
mousetrap.reset();
});
context._mousetraps = [];
}
|
Skalar/ember-keyboard-shortcuts
|
addon/index.js
|
JavaScript
|
mit
| 2,558
|
/**
* Transforms __ref to ref
* @param {object} props
* @returns {object}
* @private
*/
export default (oldProps = {}) => {
const { __ref, ...props } = oldProps
if (!__ref) return oldProps
return { ...props, ref: __ref }
}
|
robinpokorny/transform-props-with
|
src/transform-ref.js
|
JavaScript
|
mit
| 236
|
<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if (IE 7)&!(IEMobile)]><html class="no-js lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>About chriscatalfo.com – chriscatalfo.com</title>
<meta name="description" content="What this site is about">
<!-- Twitter Cards -->
<meta name="twitter:title" content="About chriscatalfo.com">
<meta name="twitter:description" content="What this site is about">
<meta name="twitter:site" content="@cfcatalfo">
<meta name="twitter:creator" content="@cfcatalfo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://localhost:4000/images/site-logo.png">
<!-- Open Graph -->
<meta property="og:locale" content="">
<meta property="og:type" content="article">
<meta property="og:title" content="About chriscatalfo.com">
<meta property="og:description" content="What this site is about">
<meta property="og:url" content="http://localhost:4000/about/">
<meta property="og:site_name" content="chriscatalfo.com">
<link rel="canonical" href="http://localhost:4000/about/">
<link href="http://localhost:4000/feed.xml" type="application/atom+xml" rel="alternate" title="chriscatalfo.com Feed">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- For all browsers -->
<link rel="stylesheet" href="http://localhost:4000/assets/css/main.css">
<!-- Webfonts -->
<script src="//use.edgefonts.net/source-sans-pro:n2,i2,n3,i3,n4,i4,n6,i6,n7,i7,n9,i9;source-code-pro:n4,n7;volkhov.js"></script>
<script type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<meta http-equiv="cleartype" content="on">
<!-- HTML5 Shiv and Media Query Support -->
<!--[if lt IE 9]>
<script src="http://localhost:4000/assets/js/vendor/html5shiv.min.js"></script>
<script src="http://localhost:4000/assets/js/vendor/respond.min.js"></script>
<![endif]-->
<!-- Modernizr -->
<script src="http://localhost:4000/assets/js/vendor/modernizr-2.7.1.custom.min.js"></script>
<!-- Icons -->
<!-- 16x16 -->
<link rel="shortcut icon" href="http://localhost:4000/favicon.ico">
<!-- 32x32 -->
<link rel="shortcut icon" href="http://localhost:4000/favicon.png">
<!-- 57x57 (precomposed) for iPhone 3GS, pre-2011 iPod Touch and older Android devices -->
<link rel="apple-touch-icon-precomposed" href="http://localhost:4000/images/apple-touch-icon-precomposed.png">
<!-- 72x72 (precomposed) for 1st generation iPad, iPad 2 and iPad mini -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="http://localhost:4000/images/apple-touch-icon-72x72-precomposed.png">
<!-- 114x114 (precomposed) for iPhone 4, 4S, 5 and post-2011 iPod Touch -->
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="http://localhost:4000/images/apple-touch-icon-114x114-precomposed.png">
<!-- 144x144 (precomposed) for iPad 3rd and 4th generation -->
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="http://localhost:4000/images/apple-touch-icon-144x144-precomposed.png">
</head>
<body id="page">
<div class="navigation-wrapper">
<nav role="navigation" id="site-nav" class="animated drop">
<ul>
<li><a href="http://localhost:4000/about/" >About</a></li>
<li><a href="http://localhost:4000/articles/" >Articles</a></li>
<li class="dosearch"><span><i class="fa fa-search"></i> Search</span></li>
</ul>
</nav>
</div><!-- /.navigation-wrapper -->
<!--[if lt IE 9]><div class="upgrade"><strong><a href="http://whatbrowser.org/">Your browser is quite old!</strong> Why not upgrade to a different browser to better enjoy this site?</a></div><![endif]-->
<div class="search-wrapper">
<div class="search-form">
<input type="text" class="search-field" placeholder="Search...">
<button class="close-btn"><i class="fa fa-times-circle fa-2x"></i></button>
<ul class="search-results post-list"></ul><!-- /.search-results -->
</div><!-- /.search-form -->
</div><!-- ./search-wrapper -->
<header class="masthead">
<div class="wrap">
<a href="http://localhost:4000" class="site-logo" rel="home" title="chriscatalfo.com"><img src="http://localhost:4000/images/site-logo.png" width="200" height="200" alt="chriscatalfo.com logo" class="animated fadeInUp"></a>
<h1 class="site-title animated fadeIn"><a href="http://localhost:4000">chriscatalfo.com</a></h1>
<h2 class="site-description animated fadeIn" itemprop="description">Thoughts on things.</h2>
</div>
</header><!-- /.masthead -->
<div class="js-menu-screen menu-screen"></div>
<div id="main" role="main">
<article class="entry">
<div class="entry-wrapper">
<header class="entry-header">
<h1 class="entry-title">About chriscatalfo.com</h1>
</header>
<div class="entry-content">
<h2 id="why">Why?</h2>
<p>Because I said so.</p>
<h2 id="when">When?</h2>
<p>Whenever I feel like it.</p>
<h2 id="who">Who?</h2>
<p>You’ll never guess!</p>
<h2 id="where">Where?</h2>
<p>In the library, with the laptop.</p>
</div><!-- /.entry-content -->
</div><!-- /.entry-wrapper -->
</article>
</div><!-- /#main -->
<div class="footer-wrapper">
<footer role="contentinfo" class="entry-wrapper">
<span>© 2018 Chris Catalfo. Powered by <a href="http://jekyllrb.com" rel="nofollow">Jekyll</a> using the <a href="http://mademistakes.com/so-simple/" rel="nofollow">So Simple Theme</a>.</span>
<div class="social-icons">
<a href="http://twitter.com/cfcatalfo" title="Chris Catalfo on Twitter" target="_blank"><i class="fa fa-twitter-square fa-2x"></i></a>
<a href="http://linkedin.com/in/ccatalfo" title="Chris Catalfo on LinkedIn" target="_blank"><i class="fa fa-linkedin-square fa-2x"></i></a>
<a href="http://meta.stackexchange.com/users/196015/ccatalfo" title="Chris Catalfo on StackExchange" target="_blank"><i class="fa fa-stack-exchange fa-2x"></i></a>
<a href="http://github.com/ccatalfo" title="Chris Catalfo on Github" target="_blank"><i class="fa fa-github-square fa-2x"></i></a>
<a href="http://localhost:4000/feed.xml" title="Atom/RSS feed"><i class="fa fa-rss-square fa-2x"></i></a>
</div><!-- /.social-icons -->
</footer>
</div><!-- /.footer-wrapper -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="http://localhost:4000/assets/js/vendor/jquery-1.9.1.min.js"><\/script>')</script>
<script src="http://localhost:4000/assets/js/scripts.min.js"></script>
<!-- Jekyll Simple Search option -->
<script>
$(document).ready(function() {
$('.search-field').jekyllSearch({
jsonFile: 'http://localhost:4000/search.json',
searchResults: '.search-results',
template: '<li><article><a href="{url}">{title} <span class="entry-date"><time datetime="{date}">{shortdate}</time></span></a></article></li>',
fuzzy: true,
noResults: '<p>Nothing found.</p>'
});
});
(function( $, window, undefined ) {
var bs = {
close: $(".close-btn"),
searchform: $(".search-form"),
canvas: $(".js-menu-screen"),
dothis: $('.dosearch')
};
bs.dothis.on('click', function() {
$('.search-wrapper').css({ display: "block" });
$('body').toggleClass('no-scroll');
bs.searchform.toggleClass('active');
bs.searchform.find('input').focus();
bs.canvas.toggleClass('is-visible');
});
bs.close.on('click', function() {
$('.search-wrapper').removeAttr( 'style' );
$('body').toggleClass('no-scroll');
bs.searchform.toggleClass('active');
bs.canvas.removeClass('is-visible');
});
})( jQuery, window );
</script>
</body>
</html>
|
ccatalfo/ccatalfo.github.io
|
_site/about/index.html
|
HTML
|
mit
| 8,156
|
<?php
namespace MoneyKeeper\Models;
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
/**
* User model
*
*/
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = array('password', 'remember_token');
}
|
tokarev-yuriy/moneyKeeper
|
app/MoneyKeeper/Models/User.php
|
PHP
|
mit
| 586
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OpenNI 1.5.4: XnDepthMetaData Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="OpenNILogo.bmp"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">OpenNI 1.5.4
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-attribs">Public Attributes</a> </div>
<div class="headertitle">
<div class="title">XnDepthMetaData Struct Reference</div> </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="XnDepthMetaData" -->
<p><code>#include <<a class="el" href="_xn_types_8h_source.html">XnTypes.h</a>></code></p>
<p><a href="struct_xn_depth_meta_data-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct_xn_map_meta_data.html">XnMapMetaData</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_xn_depth_meta_data.html#aa9c3236a081c934c9c40150b3ba804dd">pMap</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">const <a class="el" href="_xn_types_8h.html#ad55e431b82556504d5c1c00d153156c9">XnDepthPixel</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_xn_depth_meta_data.html#a6c366fc993c8232607f4d4992716c0ba">pData</a></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="_xn_types_8h.html#ad55e431b82556504d5c1c00d153156c9">XnDepthPixel</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="struct_xn_depth_meta_data.html#a919c547f3a82ca056ba77bd147323deb">nZRes</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Holds information about a frame of depth. </p>
</div><hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a919c547f3a82ca056ba77bd147323deb"></a><!-- doxytag: member="XnDepthMetaData::nZRes" ref="a919c547f3a82ca056ba77bd147323deb" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="_xn_types_8h.html#ad55e431b82556504d5c1c00d153156c9">XnDepthPixel</a> <a class="el" href="struct_xn_depth_meta_data.html#a919c547f3a82ca056ba77bd147323deb">XnDepthMetaData::nZRes</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>The value of the Z resolution of this frame - the maximum depth a pixel can have. </p>
</div>
</div>
<a class="anchor" id="a6c366fc993c8232607f4d4992716c0ba"></a><!-- doxytag: member="XnDepthMetaData::pData" ref="a6c366fc993c8232607f4d4992716c0ba" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="_xn_types_8h.html#ad55e431b82556504d5c1c00d153156c9">XnDepthPixel</a>* <a class="el" href="struct_xn_depth_meta_data.html#a6c366fc993c8232607f4d4992716c0ba">XnDepthMetaData::pData</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A pointer to the depth data of this frame. </p>
</div>
</div>
<a class="anchor" id="aa9c3236a081c934c9c40150b3ba804dd"></a><!-- doxytag: member="XnDepthMetaData::pMap" ref="aa9c3236a081c934c9c40150b3ba804dd" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct_xn_map_meta_data.html">XnMapMetaData</a>* <a class="el" href="struct_xn_depth_meta_data.html#aa9c3236a081c934c9c40150b3ba804dd">XnDepthMetaData::pMap</a></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A pointer to the map meta data of this frame. </p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="_xn_types_8h_source.html">XnTypes.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Nov 26 2014 12:18:20 for OpenNI 1.5.4 by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>
</body>
</html>
|
ipab-rad/ocv_kinect
|
external/OpenNI/Documentation/html/struct_xn_depth_meta_data.html
|
HTML
|
mit
| 5,655
|
module Main (main) where
import System.Console.GetOpt
import System.IO
import System.Environment
import System.Exit
import qualified System.IO as SIO
import Data.ByteString
import Data.Word
import Data.ListLike.CharString
import qualified Data.Iteratee as I
import qualified Data.Iteratee.ListLike as IL
import qualified Data.Iteratee.IO.Handle as IOH
import Data.Iteratee.Base.ReadableChunk
import Data.Iteratee ((><>),(<><))
import Data.Iteratee.Char
import qualified Data.Iteratee.Char as IC
main :: IO ()
main =
do let
enum = I.enumPure1Chunk [1..1000::Int]
it = (I.joinI $ (I.take 15 ><> I.take 10) I.stream2list)
rs <- enum it >>= I.run
print rs
--
handle <- openFile "iterdata/source.txt" ReadMode
let
enum2 = IL.take 20
it2 = I.joinI $ enum2 (I.stream2list::I.Iteratee ByteString IO [Word8])
i <- IOH.enumHandle 22 handle it2 >>= I.run
str <- SIO.hGetLine handle
SIO.putStr $ str ++ "\n"
SIO.hClose handle
-- Enumerating a handle over a finished iteratee doesn't read
-- from the handle, and doesn't throw an exception
handle <- openFile "iterdata/source.txt" ReadMode
let
finishediter = I.idone () (I.EOF Nothing::I.Stream [Word8])
i <- IOH.enumHandle 22 handle finishediter >>= I.run
str <- SIO.hGetLine handle
SIO.putStr $ str ++ "\n"
SIO.hClose handle
-- I wonder... can you compose an already "started" iteratee
-- with another iteratee?
handle <- openFile "iterdata/smallfile.txt" ReadMode
let
enum3 = IL.take 4
it3 = I.joinI $ enum3 (I.stream2list::I.Iteratee [Char] IO [Char])
enum4 = IL.take 4
it4 = I.joinI $ enum4 (I.stream2list::I.Iteratee [Char] IO [Char])
ii <- IOH.enumHandle 22 handle it3
SIO.hClose handle
let
combined = ii >> it4
handle <- openFile "iterdata/smallfile2.txt" ReadMode
iii <- IOH.enumHandle 22 handle combined >>= I.run
SIO.hClose handle
print iii
|
danidiaz/haskell-sandbox
|
iteratee.hs
|
Haskell
|
mit
| 2,218
|
---
layout: post
title: "A Shiny-app Serves as Shiny-server Load Balancer"
date: 2014-04-30 13:51
comments: true
categories: R Shiny
---
The Shiny-app on open-source edition Shiny-server has only one concurrent, which means it can run only for one user at a time point. But it can host multiple Shiny-apps, which can run synchronously. So, if we create severl Shiny-apps with different names but same function, then we can let more users use our service at same time. But users don't how to choose the Shiny-app with small user number. This post will show you how to create a Shiny-app to redirect user to the Shiny-app with lower load.
I have no knowledge about server load balancer, the following method is ONLY what I thought it can be.
- First, we need to know the load information about Shiny apps on our server, like which apps are running, how many users for each app, etc.
- Then, create a normal Shiny app to detect which app has little user number than others, and using JavaScript to redirect user to that app.
###1. CPU information about Shiny-app
The following is the R code than generates a data frame containing which Shiny-app are running and the user number of each Shiny-app.
``` ruby
## Setup work directory;
setwd("/srv/shiny-system/Data")
I <- 0
for (i in 1:60) {
system("top -n 1 -b -u shiny > top.log")
dat <- readLines("top.log")
id <- grep("R *$", dat)
Names <- strsplit(gsub("^ +|%|\\+", "", dat[7]), " +")[[1]]
if (length(id) > 0) {
# 'top' data frame;
L <- strsplit(gsub("^ *", "", dat[id]), " +")
dat <- data.frame(matrix(unlist(L), ncol = 12, byrow = T))
names(dat) <- Names
dat <- data.frame(Time = Sys.time(), dat[, -ncol(dat)], usr = NA, app = NA)
dat$CPU <-as.numeric(as.character(dat$CPU))
dat$MEM <-as.numeric(as.character(dat$MEM))
# Check if connection number changed;
for (i in 1:length(dat$PID)) {
PID <- dat$PID[i]
system(paste("sudo netstat -p | grep", PID, "> netstat.log"))
system(paste("sudo netstat -p | grep", PID, ">> netstat.log2"))
system(paste("sudo lsof -p", PID, "| grep /srv > lsof.log"))
netstat <- readLines("netstat.log")
lsof <- readLines("lsof.log")
dat$usr[i] <- length(grep("ESTABLISHED", netstat) & grep("tcp", netstat))
dat$app[i] <- regmatches(lsof, regexec("srv/(.*)", lsof))[[1]][2]
}
dat <- dat[, c("app", "usr")]
} else {
dat <- data.frame(app = "app", usr = 0)
}
write.table(dat, file = "CPU.txt")
}
```
To make it run automatically, schedule it under <code>/etc/crontab</code> like the following:
``` ruby
* * * * * root Rscript /<dir of shiny-app>/CPU.R
```
###2. Create the Shiny-app for redirecting.
**ui.R**
``` ruby
shinyUI(bootstrapPage(
tags$style("#link {visibility: hidden;}"), # This app doesn't need user interface;
textInput(inputId = "link", label = "", value = ""), # Redirecting link;
tags$script(type="text/javascript", src = "redirect.js") # JavaScript for redirecting;
))
```
**server.R**
``` ruby
shinyServer(function(input, output, session) {
CPU <- read.table("Data/CPU.txt")
App <- data.frame(app = c("app_1", "app_2", "app_3", "app_4"))
App <- merge(App, CPU, all.x = TRUE)
App$usr[which(is.na(App$usr))] <- 0
Link <- paste("http://192.168.150.36/", App$app[which.min(App$usr)], sep = "")
updateTextInput(session, inputId = "link", value = Link)
})
```
**redirect.js**
``` ruby
setInterval(function() {
var link = document.getElementById('link').value;
if (link.length >1) {
window.open(link, "_top")
}
}, 50)
```
|
withr/withr.github.io
|
_posts/2014-04-30-a-shiny-app-serves-as-shiny-server-load-balancer.md
|
Markdown
|
mit
| 3,609
|
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\Rest\Action\Visit;
use Laminas\Diactoros\Response\JsonResponse;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Shlinkio\Shlink\Common\Paginator\Util\PagerfantaUtilsTrait;
use Shlinkio\Shlink\Core\Model\VisitsParams;
use Shlinkio\Shlink\Core\Visit\VisitsStatsHelperInterface;
use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
class NonOrphanVisitsAction extends AbstractRestAction
{
use PagerfantaUtilsTrait;
protected const ROUTE_PATH = '/visits/non-orphan';
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
public function __construct(private VisitsStatsHelperInterface $visitsHelper)
{
}
public function handle(ServerRequestInterface $request): ResponseInterface
{
$params = VisitsParams::fromRawData($request->getQueryParams());
$apiKey = AuthenticationMiddleware::apiKeyFromRequest($request);
$visits = $this->visitsHelper->nonOrphanVisits($params, $apiKey);
return new JsonResponse([
'visits' => $this->serializePaginator($visits),
]);
}
}
|
shlinkio/shlink
|
module/Rest/src/Action/Visit/NonOrphanVisitsAction.php
|
PHP
|
mit
| 1,215
|
package com.distributeddb.reno;
import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
import java.util.Iterator;
import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import com.distributeddb.errors.EncryptionError;
import com.distributeddb.utils.FileBlock;
import com.distributeddb.reno.crypto.CryptoBlock;
import com.distributeddb.reno.crypto.Hasher;
import static com.distributeddb.utils.Constants.*;
public final class DataManipulatorTest {
private static final String KEY = "0123456789123456";
private static final String FILE = ";alsijeflisjfeliajselitjalstesljal;seafslefasleiflwief";
private static List<String> breakFile(final String file) {
final List<String> fileSegments = new ArrayList<>();
final int length = file.length();
final int sizeOfSegment = (int) Math.ceil(length / NUM_BLOCKS);
int index = 0;
while (index < length) {
final String chunk = file.substring(index, Math.min(index + sizeOfSegment, length));
fileSegments.add(chunk);
index += sizeOfSegment;
}
return fileSegments;
}
private static List<Long> getBlockOrderValues(final int numberOfBlocks) {
final List<Long> blockOrders = new ArrayList<>();
long maxLong = Long.MAX_VALUE - 1_000_000_000;
final Long first = ThreadLocalRandom.current().nextLong(Long.MIN_VALUE, maxLong);
blockOrders.add(first);
for (int i = 1; i < numberOfBlocks; i++) {
maxLong += (Long.MAX_VALUE - maxLong) / 2;
final Long blockOrder = ThreadLocalRandom.current().nextLong(blockOrders.get(i-1) + 1, maxLong);
blockOrders.add(blockOrder);
}
return blockOrders;
}
private static List<FileBlock> createBlocksTestHelper(final String secretKey, final String file) {
final List<FileBlock> blocks = new ArrayList<>();
final List<String> splitFiles = breakFile(file);
final int numBlocks = splitFiles.size();
final List<Long> blockOrders = getBlockOrderValues(numBlocks);
final Iterator<String> it1 = splitFiles.iterator();
final Iterator<Long> it2 = blockOrders.iterator();
while (it1.hasNext() && it2.hasNext()) {
String encrypted = null;
try {
encrypted = CryptoBlock.encrypt(it1.next(), secretKey);
} catch (Exception e) {
Assert.fail("Error encrypting file in helper");
}
final long blockOrder = it2.next();
final FileBlock block = new FileBlock(blockOrder, encrypted);
blocks.add(block);
}
return blocks;
}
public static List<String> createKeysTestHelper(final String secretKey, final String filename, final String user, final long fileSizeInBlocks) {
final List<String> keys = new ArrayList<>();
for (long blockNum = 0; blockNum < fileSizeInBlocks; blockNum++) {
final String key = Hasher.createBlockKey(secretKey, filename, blockNum);
keys.add(key);
}
return keys;
}
@Test
public void testCreateBlocks() throws EncryptionError {
final List<FileBlock> actual = DataManipulator.createBlocks(KEY, FILE);
final List<FileBlock> expected = createBlocksTestHelper(KEY, FILE);
Assert.assertEquals(expected.size(), actual.size());
for (int i = 0; i < actual.size(); i++) {
Assert.assertEquals(expected.get(i).getData(), actual.get(i).getData());
}
}
@Test
public void testMakeFile() throws EncryptionError {
final List<FileBlock> brokenUp = createBlocksTestHelper(KEY, FILE);
final String actual = DataManipulator.makeFile(brokenUp, KEY);
Assert.assertEquals(FILE, actual);
}
@Test
public void testCreateKeys() {
final List<String> expected = createKeysTestHelper(KEY, FILE, USER, 10);
final List<String> actual = DataManipulator.createKeys(KEY, FILE, USER, 10);
Assert.assertEquals(10, actual.size());
Assert.assertEquals(expected.size(), actual.size());
for (int i = 0; i < expected.size(); i++) {
Assert.assertEquals(expected.get(i), actual.get(i));
}
}
}
|
rthotakura97/decentralized-database
|
src/test/java/com/distributeddb/reno/DataManipulatorTest.java
|
Java
|
mit
| 4,313
|
{% comment %} -- head.html -- {% endcomment %}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ site.title }}</title>
<meta name="description" content="{% if page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | truncate: 160 }}{% else %}{{ site.description }}{% endif %}">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700|Raleway:400,300,700' rel='stylesheet' type='text/css'>
{% comment %} -- favicon -- {% endcomment %}
<link rel="manifest" href="{{ site.baseurl }}/manifest.json">
<link rel="apple-touch-icon" sizes="180x180" href="{{ site.baseurl }}/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" href="{{ site.baseurl }}/favicon/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="{{ site.baseurl }}/favicon/favicon-16x16.png" sizes="16x16">
<link rel="mask-icon" href="{{ site.baseurl }}/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="{{ site.baseurl }}/favicon.ico">
<meta name="apple-mobile-web-app-title" content="OA Data">
<meta name="application-name" content="OA Data">
<meta name="msapplication-config" content="{{ site.baseurl }}/favicon/browserconfig.xml">
<meta name="-color" content="#ffffff">
{% comment %} -- css -- {% endcomment %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
{% assign theme_name = site.jkan_theme | default: 'Default' %}
{% assign theme = site.data.themes | where:'name', theme_name | first %}
{% if theme and theme.src and theme.src != empty %}
<link rel="stylesheet" href="{{ theme.src }}">
{% endif %}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.2/css/select2.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/notie/3.0.0/notie.min.css">
<link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
{% comment %} -- Open Graph Metadata -- https://developers.facebook.com/tools/debug/ -- {% endcomment %}
{% if site.opengraph.enabled == true %}
{% assign description = page.notes | default: site.description %}
{% assign title = page.title | default: site.title %}
{% assign logo = page.logo | default: "/favicon/android-chrome-192x192.png" %}
<meta property="og:description" content="{{ description | truncate: 255 }}" />
<meta property="og:title" content="{{ title | truncate: 80 }}" />
<meta name="og:image" content="{{ site.baseurl }}{{ logo }}" />
<meta property="og:image:width" content="192"/>
<meta property="og:image:height" content="192"/>
<meta property="og:site_name" content="{{ site.title }}" />
{% endif %}
{% comment %} -- JS libraries -- {% endcomment %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
{% comment %} -- US Digital Analytics Program see https://analytics.usa.gov for data {% endcomment %}
{% if site.digital_analytics_program.enabled == true %}
<script id="_fed_an_ua_tag" src="https://dap.digitalgov.gov/Universal-Federated-Analytics-Min.js?agency={{ site.digital_analytics_program.agency }}&subagency={{ site.digital_analytics_program.subagency }}"></script>
{% endif %}
{% comment %} -- Google Analytics -- {% endcomment %}
{% if site.google_analytics.enabled == true %}
{% include addons/google-analytics.html %}
{% endif %}
{% comment %} -- Hypothesis.io -- {% endcomment %}
{% if site.hypothesis.enabled == true %}
<script async defer src="//hypothes.is/embed.js"></script>
{% endif %}
{% comment %} -- Twittercard -- {% endcomment %}
{% if site.twittercard.enabled == true %}
{% include addons/twittercard.html %}
{% endif %}
<script>
var settings = {
BASE_URL: {{ site.baseurl | jsonify }},
PAGE_URL: {{ page.url | jsonify }},
REPO_BRANCH: {% if site.github.is_user_page %}"master"{% else %}"gh-pages"{% endif %},
{% if site.github_repo %}
REPO_OWNER: {{ site.github_repo.owner | jsonify }},
REPO_NAME: {{ site.github_repo.name | jsonify }},
{% else %}
REPO_OWNER: {{ site.github.owner_name | jsonify }},
REPO_NAME: {{ site.github.project_title | jsonify }},
{% endif %}
GITHUB_CLIENT_ID: {{ site.github_client_id | jsonify }},
GATEKEEPER_HOST: {{ site.gatekeeper_host | jsonify }}
}
</script>
<script>
$(function() {
$('#nav li a').click(function() {
$('#nav li').removeClass();
$($(this).attr('href')).addClass('active');
});
});
</script>
|
amaliebarras/data-portal-new
|
_includes/head.html
|
HTML
|
mit
| 4,891
|
<?php
namespace Pinq\Queries\Requests;
/**
* Request query for a double of the sum of all the projected values
*
* @author Elliot Levin <elliotlevin@hotmail.com>
*/
class Sum extends ProjectionRequest
{
public function getType()
{
return self::SUM;
}
public function traverse(IRequestVisitor $visitor)
{
return $visitor->visitSum($this);
}
}
|
TimeToogo/Pinq
|
Source/Queries/Requests/Sum.php
|
PHP
|
mit
| 389
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.