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
/** * @class elFinder command "places" * Regist to Places * * @author Naoki Sawada **/ elFinder.prototype.commands.places = function() { "use strict"; var self = this, fm = this.fm, filter = function(hashes) { return $.grep(self.files(hashes), function(f) { return f.mime == 'directory' ? true : false; }); }, places = null; this.getstate = function(select) { var sel = this.hashes(select), cnt = sel.length; return places && cnt && cnt == filter(sel).length ? 0 : -1; }; this.exec = function(hashes) { var files = this.files(hashes); places.trigger('regist', [ files ]); return $.Deferred().resolve(); }; fm.one('load', function(){ places = fm.ui.places; }); };
TeamSPoon/logicmoo_workspace
docker/rootfs/var/www/html/ef/js/commands/places.js
JavaScript
mit
714
describe Appsignal::EventFormatter::Moped::QueryFormatter do let(:klass) { Appsignal::EventFormatter::Moped::QueryFormatter } let(:formatter) { klass.new } it "should register query.moped" do expect(Appsignal::EventFormatter.registered?("query.moped", klass)).to be_truthy end describe "#format" do let(:payload) { { :ops => [op] } } subject { formatter.format(payload) } context "without ops in the payload" do let(:payload) { {} } it { is_expected.to be_nil } end context "Moped::Protocol::Command" do let(:op) do double( :full_collection_name => "database.collection", :selector => { "query" => { "_id" => "abc" } }, :class => double(:to_s => "Moped::Protocol::Command") ) end it { is_expected.to eq ["Command", '{:database=>"database.collection", :selector=>{"query"=>"?"}}'] } end context "Moped::Protocol::Query" do let(:op) do double( :full_collection_name => "database.collection", :selector => { "_id" => "abc" }, :flags => [], :limit => 0, :skip => 0, :fields => nil, :class => double(:to_s => "Moped::Protocol::Query") ) end it { is_expected.to eq ["Query", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[], :limit=>0, :skip=>0, :fields=>nil}'] } end context "Moped::Protocol::Delete" do let(:op) do double( :full_collection_name => "database.collection", :selector => { "_id" => "abc" }, :flags => [], :class => double(:to_s => "Moped::Protocol::Delete") ) end it { is_expected.to eq ["Delete", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :flags=>[]}'] } end context "Moped::Protocol::Insert" do let(:op) do double( :full_collection_name => "database.collection", :flags => [], :documents => [ { "_id" => "abc", "events" => { "foo" => [{ "bar" => "baz" }] } }, { "_id" => "def", "events" => { "foo" => [{ "baz" => "bar" }] } } ], :class => double(:to_s => "Moped::Protocol::Insert") ) end it { is_expected.to eq ["Insert", '{:database=>"database.collection", :documents=>{"_id"=>"?", "events"=>"?"}, :count=>2, :flags=>[]}'] } end context "Moped::Protocol::Update" do let(:op) do double( :full_collection_name => "database.collection", :selector => { "_id" => "abc" }, :update => { "user.name" => "James Bond" }, :flags => [], :class => double(:to_s => "Moped::Protocol::Update") ) end it { is_expected.to eq ["Update", '{:database=>"database.collection", :selector=>{"_id"=>"?"}, :update=>{"user.?"=>"?"}, :flags=>[]}'] } end context "Moped::Protocol::KillCursors" do let(:op) do double( :number_of_cursor_ids => 2, :class => double(:to_s => "Moped::Protocol::KillCursors") ) end it { is_expected.to eq ["KillCursors", "{:number_of_cursor_ids=>2}"] } end context "Moped::Protocol::Other" do let(:op) do double( :full_collection_name => "database.collection", :class => double(:to_s => "Moped::Protocol::Other") ) end it { is_expected.to eq ["Other", '{:database=>"database.collection"}'] } end end end
appsignal/appsignal
spec/lib/appsignal/event_formatter/moped/query_formatter_spec.rb
Ruby
mit
3,798
<a href='/admin'>Back</a> <hr/> <form action='/admin/update_contact' method='post'> <p>Name</p> <input type='text' name='ol_name' value='<?php echo $site->name ?>' class='form-control' required /> <p>Contact</p> <textarea class='form-control' name='ol_contact' rows=20 required><?php echo $site->contact ?></textarea> <hr/> <p><input type='submit' value='update' /></p> </form>
howtomakeaturn/design
application/views/admin/edit_contact.php
PHP
mit
402
import Ember from 'ember'; import TableBlock from '../views/table-block'; export default TableBlock.extend({ classNames: ['ember-table-header-block'], // TODO(new-api): Eliminate view alias itemView: 'header-row', itemViewClass: Ember.computed.alias('itemView'), content: Ember.computed(function() { return [this.get('columns')]; }).property('columns') });
Addepar/ember-table-addon
addon/views/header-block.js
JavaScript
mit
375
RSpec.describe StackMaster::PagedResponseAccumulator do let(:cf) { Aws::CloudFormation::Client.new } subject(:accumulator) { described_class.new(cf, :describe_stack_events, { stack_name: 'blah' }, :stack_events) } context 'with one page' do let(:page_one_events) { [ { event_id: '1', stack_id: '1', stack_name: 'blah', timestamp: Time.now}, { event_id: '2', stack_id: '1', stack_name: 'blah', timestamp: Time.now} ] } before do cf.stub_responses(:describe_stack_events, { stack_events: page_one_events, next_token: nil }) end it 'returns the first page' do events = accumulator.call expect(events.stack_events.count).to eq 2 end end context 'with two pages' do let(:page_one_events) { [ { event_id: '1', stack_id: '1', stack_name: 'blah', timestamp: Time.now}, { event_id: '2', stack_id: '1', stack_name: 'blah', timestamp: Time.now} ] } let(:page_two_events) { [ { event_id: '3', stack_id: '1', stack_name: 'blah', timestamp: Time.now} ] } before do cf.stub_responses(:describe_stack_events, { stack_events: page_one_events, next_token: 'blah' }, { stack_events: page_two_events } ) end it 'returns all the stack events combined' do events = accumulator.call expect(events.stack_events.count).to eq 3 end end end
bulletproofnetworks/stack_master
spec/stack_master/paged_response_accumulator_spec.rb
Ruby
mit
1,354
package f5 import ( "encoding/json" "strings" ) type LBServerSsl struct { Name string `json:"name"` Partition string `json:"partition"` FullPath string `json:"fullPath"` Generation int `json:"generation"` UntrustedCertResponseControl string `json:"untrustedCertResponseControl"` UncleanShutdown string `json:"uncleanShutdown"` StrictResume string `json:"strictResume"` SslSignHash string `json:"sslSignHash"` SslForwardProxyBypass string `json:"sslForwardProxyBypass"` SslForwardProxy string `json:"sslForwardProxy"` SniRequire string `json:"sniRequire"` SniDefault string `json:"sniDefault"` ExpireCertResponseControl string `json:"expireCertResponseControl"` DefaultsFrom string `json:"defaultsFrom"` Ciphers string `json:"ciphers"` Chain string `json:"chain"` Cert string `json:"cert"` Key string `json:"key"` CacheTimeout int `json:"cacheTimeout"` CacheSize int `json:"cacheSize"` AuthenticateDepth int `json:"authenticateDepth"` AlertTimeout string `json:"alertTimeout"` SelfLink string `json:"selfLink"` Authenticate string `json:"authenticate"` GenericAlert string `json:"genericAlert"` HandshakeTimeout string `json:"handshakeTimeout"` ModSslMethods string `json:"modSslMethods"` Mode string `json:"mode"` TmOptions []string `json:"tmOptions"` PeerCertMode string `json:"peerCertMode"` ProxySsl string `json:"proxySsl"` ProxySslPassthrough string `json:"proxySslPassthrough"` RenegotiatePeriod string `json:"renegotiatePeriod"` RenegotiateSize string `json:"renegotiateSize"` Renegotiation string `json:"renegotiation"` RetainCertificate string `json:"retainCertificate"` SecureRenegotiation string `json:"secureRenegotiation"` SessionMirroring string `json:"sessionMirroring"` SessionTicket string `json:"sessionTicket"` } type LBServerSsls struct { Items []LBServerSsl `json:"items"` } func (f *Device) ShowServerSsls() (error, *LBServerSsls) { u := f.Proto + "://" + f.Hostname + "/mgmt/tm/ltm/profile/server-ssl" res := LBServerSsls{} err, _ := f.sendRequest(u, GET, nil, &res) if err != nil { return err, nil } else { return nil, &res } } func (f *Device) ShowServerSsl(sname string) (error, *LBServerSsl) { server := strings.Replace(sname, "/", "~", -1) u := f.Proto + "://" + f.Hostname + "/mgmt/tm/ltm/profile/server-ssl/" + server res := LBServerSsl{} err, _ := f.sendRequest(u, GET, nil, &res) if err != nil { return err, nil } else { return nil, &res } } func (f *Device) AddServerSsl(body *json.RawMessage) (error, *LBServerSsl) { u := f.Proto + "://" + f.Hostname + "/mgmt/tm/ltm/profile/server-ssl" res := LBServerSsl{} // post the request err, _ := f.sendRequest(u, POST, &body, &res) if err != nil { return err, nil } else { return nil, &res } } func (f *Device) UpdateServerSsl(sname string, body *json.RawMessage) (error, *LBServerSsl) { server := strings.Replace(sname, "/", "~", -1) u := f.Proto + "://" + f.Hostname + "/mgmt/tm/ltm/profile/server-ssl/" + server res := LBServerSsl{} // put the request err, _ := f.sendRequest(u, PUT, &body, &res) if err != nil { return err, nil } else { return nil, &res } } func (f *Device) DeleteServerSsl(sname string) (error, *Response) { server := strings.Replace(sname, "/", "~", -1) u := f.Proto + "://" + f.Hostname + "/mgmt/tm/ltm/profile/server-ssl/" + server res := json.RawMessage{} err, resp := f.sendRequest(u, DELETE, nil, &res) if err != nil { return err, nil } else { return nil, resp } }
ExpressenAB/bigip_exporter
vendor/github.com/pr8kerl/f5er/f5/server-ssl.go
GO
mit
4,187
<?php namespace Github\Tests\Integration; use Github\ResultPager; /** * @group integration */ class ResultPagerTest extends TestCase { /** * @test * * response in a search api has different format: * * { * "total_count": 1, * "incomplete_results": false, * "items": [] * } * * and we need to extract result from `items` */ public function shouldGetAllResultsFromSearchApi() { $searchApi = $this->client->search(); $pager = $this->createPager(); $users = $pager->fetch($searchApi, 'users', ['location:Kyiv']); $this->assertCount(10, $users); } private function createPager() { return new ResultPager($this->client); } }
KnpLabs/php-github-api
test/Github/Tests/Integration/ResultPagerTest.php
PHP
mit
757
from .models import Project,Member,Contact,Technology,Contributor from rest_framework import serializers class ContactSerializer(serializers.ModelSerializer): class Meta: model = Contact fields = ('name', 'link') class MemberSerializer(serializers.ModelSerializer): contacts = ContactSerializer(many=True) class Meta: model = Member fields = ('name', 'post', 'img', 'contacts') class ContributorSerializer(serializers.ModelSerializer): class Meta: model=Contributor fields = ('name','github') class ProjectSerializer(serializers.ModelSerializer): contributors=ContributorSerializer(many=True) class Meta: model = Project fields = ('slug','name','type','desc','icon','technologies','long_desc','contributors','meta')
o-d-i-n/HelloWorld
api/serializers.py
Python
mit
778
// Copyright (C) 2010 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * @fileoverview * Registers a language handler for Scala. * * Derived from http://lampsvn.epfl.ch/svn-repos/scala/scala-documentation/trunk/src/reference/SyntaxSummary.tex * * @author mikesamuel@gmail.com */ PR['registerLangHandler']( PR['createSimpleLexer']( [ // Whitespace [PR['PR_PLAIN'], /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'], // A double or single quoted string // or a triple double-quoted multi-line string. [PR['PR_STRING'], /^(?:"(?:(?:""(?:""?(?!")|[^\\"]|\\.)*"{0,3})|(?:[^"\r\n\\]|\\.)*"?))/, null, '"'], [PR['PR_LITERAL'], /^`(?:[^\r\n\\`]|\\.)*`?/, null, '`'], [PR['PR_PUNCTUATION'], /^[!#%&()*+,\-:;<=>?@\[\\\]^{|}~]+/, null, '!#%&()*+,-:;<=>?@[\\]^{|}~'] ], [ // A symbol literal is a single quote followed by an identifier with no // single quote following // A character literal has single quotes on either side [PR['PR_STRING'], /^'(?:[^\r\n\\']|\\(?:'|[^\r\n']+))'/], [PR['PR_LITERAL'], /^'[a-zA-Z_$][\w$]*(?!['$\w])/], [PR['PR_KEYWORD'], /^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/], [PR['PR_LITERAL'], /^(?:true|false|null|this)\b/], [PR['PR_LITERAL'], /^(?:(?:0(?:[0-7]+|X[0-9A-F]+))L?|(?:(?:0|[1-9][0-9]*)(?:(?:\.[0-9]+)?(?:E[+\-]?[0-9]+)?F?|L?))|\\.[0-9]+(?:E[+\-]?[0-9]+)?F?)/i], // Treat upper camel case identifiers as types. [PR['PR_TYPE'], /^[$_]*[A-Z][_$A-Z0-9]*[a-z][\w$]*/], [PR['PR_PLAIN'], /^[$a-zA-Z_][\w$]*/], [PR['PR_COMMENT'], /^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/], [PR['PR_PUNCTUATION'], /^(?:\.+|\/)/] ]), ['scala']);
moduloproject/massage-app
bower_components/google-code-prettify/src/lang-scala.js
JavaScript
mit
2,563
'use strict'; angular.module('myApp.viewPopular', ['ngRoute', 'movieApi']) .config(['$routeProvider', function ($routeProvider) { $routeProvider.when('/popular', { templateUrl: 'viewPopular/view1.html', controller: 'ViewPopularCtrl' }); }]) .controller('ViewPopularCtrl', [ '$scope', 'TMDbConfigService', 'TMDbService', //'$modal', function ($scope, TMDbConfigService, TMDbService/*,$modal*/) { //TODO: use $anchorScroll // http://stackoverflow.com/questions/14107531/retain-scroll-position-on-route-change-in-angularjs var imagesConfig = null, totalPages = 2; $scope.configService = TMDbConfigService; $scope.movies = []; $scope.page = 0; $scope.foundMovies = []; $scope.loadMoreData = function () { $scope.page += 1; if ($scope.page >= totalPages) { return; } TMDbService.movies.get({ verb: "popular", page: $scope.page }, function (data) { totalPages = data.total_pages; data.results.forEach(function (item) { item.poster_path = $scope.configService.getPosterImageUrl(item.poster_path); $scope.movies.push(item); }); }); }; $scope.loadMovieDetail = function (movieId) { TMDbService.movie.get({ verb: movieId }, function (data) { $scope.selectedMovie = data; }); }; $scope.searchMovies = function() { $scope.foundMovies = []; var searchText = $scope.searchText; if (searchText && searchText.length > 3) { TMDbService.movieSearch.get({ query: searchText //TODO: paging }, function (data) { data.results.forEach(function (item) { item.poster_path = $scope.configService.getPosterImageUrl(item.poster_path); $scope.foundMovies.push(item); }); }); } }; // $scope.showDetails = function (movie) { // var modalInstance = $modal.open({ // templateUrl: 'movieDetails.html', // controller: 'ViewDetailsCtrl', // resolve: { // movieId: function () { // return movie.id; // } // } // }); // // modalInstance.result.then(function (selectedItem) { // //ok // }, function () { // //cancel // }); // }; $scope.loadMoreData(); }]); //angular.module('myApp.viewPopular') // .controller('ViewDetailsCtrl', [ // '$scope', // '$modalInstance', // 'TMDbService', // 'TMDbConfigService', // 'movieId', // function ($scope, $modalInstance, TMDbService, TMDbConfigService, movieId) { // $scope.movieId = movieId; // $scope.configService = TMDbConfigService; // // TMDbService.movie.get({ // verb: $scope.movieId // }, function (data) { // $scope.movie = data; // }); // }]);
realalgorithmer/movies
app/viewPopular/view1.js
JavaScript
mit
3,803
fn main() { let moo = foo().bar().baz() <caret> }
d9n/intellij-rust
src/test/resources/org/rust/ide/formatter/fixtures/auto_indent/chain_call_after.rs
Rust
mit
58
#### Integrations ##### BMC Helix Remedyforce - Updated the Docker image to: *demisto/python3:3.9.7.24076*.
VirusTotal/content
Packs/BmcHelixRemedyForce/ReleaseNotes/1_0_8.md
Markdown
mit
108
E2.p = E2.plugins["assets_started_generator"] = function(core, node) { this.desc = 'Emits the current number of assets that have begun loading.'; this.input_slots = []; this.output_slots = [ { name: 'count', dt: core.datatypes.FLOAT, desc: 'Number of assets that have begun loading.' } ]; this.core = core; this.node = node; this.asset_listener = function(self) { return function() { self.node.queued_update = 1; }}(this); core.asset_tracker.add_listener(this.asset_listener); }; E2.p.prototype.reset = function() { }; E2.p.prototype.destroy = function() { this.core.asset_tracker.remove_listener(this.asset_listener); }; E2.p.prototype.update_output = function(slot) { return this.core.asset_tracker.started; };
engijs/engi
browser/plugins/assets_started_generator.plugin.js
JavaScript
mit
742
/* * Copyright (c) 2009, 2010, 2011, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group. */ #include <stdlib.h> #include <stdio.h> #include <assert.h> #include <stdint.h> #include <omp.h> #include <arch/x86/barrelfish_kpi/asm_inlines_arch.h> #define GANG_SCHEDULING #undef MEASURE_SYNC #define MEASURE #define WORK_PERIOD 5000000000UL #define STACK_SIZE (64 * 1024) int main(int argc, char *argv[]) { uint64_t now, start; volatile uint64_t workcnt, workload = 0; int64_t workmax = 1000; int64_t i; if(argc == 1) { printf("calibrating...\n"); do { workload = 0; workmax *= 2; start = rdtsc(); #pragma omp parallel private(i,workload) for(i = 0; i < workmax; i++) { #pragma omp barrier workload++; } now = rdtsc(); } while(now - start < WORK_PERIOD); printf("workmax = %ld\n", workmax); return 0; } else { workmax = atol(argv[1]); } int nthreads = omp_get_max_threads(); if(argc == 3) { nthreads = atoi(argv[2]); assert(!"REVISE!!!"); bomp_bomp_init(nthreads); omp_set_num_threads(nthreads); } printf("threads %d, workmax %ld, CPUs %d\n", nthreads, workmax, omp_get_num_procs()); #ifdef MEASURE_SYNC uint64_t waits[16] = { 0, 1000, 1000000, 1000000000, 500, 5000000, 5000000000, 3000000, 0, 1000, 1000000, 1000000000, 500, 5000000, 5000000000, 3000000 }; uint64_t ts[16][10]; printf("before sync:\n"); #pragma omp parallel private(workcnt) { for(int j = 0; j < waits[omp_get_thread_num()]; j++) { workcnt++; } for(int j = 0; j < 10; j++) { ts[omp_get_thread_num()][j] = rdtsc(); } } for(int j = 0; j < 10; j++) { printf("timestamp %d: ", j); for(int n = 1; n < nthreads; n++) { printf("%ld ", ts[n][j] - ts[n - 1][j]); } printf("\n"); } printf("after sync:\n"); #pragma omp parallel { bomp_synchronize(); for(int j = 0; j < 10; j++) { ts[omp_get_thread_num()][j] = rdtsc(); } } for(int j = 0; j < 10; j++) { printf("timestamp %d: ", j); for(int n = 1; n < nthreads; n++) { printf("%ld ", ts[n][j] - ts[n - 1][j]); } printf("\n"); } #endif #ifdef GANG_SCHEDULING #pragma omp parallel { // bomp_synchronize(); } #endif start = rdtsc(); #ifdef MEASURE # define MAXTHREADS 16 # define WORKMAX 10000 static uint64_t starta[MAXTHREADS][WORKMAX]; static uint64_t end1[MAXTHREADS][WORKMAX]; static uint64_t end2[MAXTHREADS][WORKMAX]; #endif // Do some work #pragma omp parallel private(workcnt,i) for(i = 0; i < workmax; i++) { #ifdef MEASURE starta[omp_get_thread_num()][i < WORKMAX ? i : WORKMAX] = rdtsc(); #endif workcnt++; #ifdef MEASURE end1[omp_get_thread_num()][i < WORKMAX ? i : WORKMAX] = rdtsc(); #endif #pragma omp barrier #ifdef MEASURE end2[omp_get_thread_num()][i < WORKMAX ? i : WORKMAX] = rdtsc(); #endif } now = rdtsc(); #ifdef MEASURE printf("avg compute time: "); for(int n = 0; n < nthreads; n++) { uint64_t sum = 0, min = end1[0][0], max = 0; for(i = 0; i < WORKMAX; i++) { uint64_t val = end1[n][i] - starta[n][i]; sum += val; min = val < min ? val : min; max = val > max ? val : max; } printf("%lu(%lu,%lu) ", sum / WORKMAX, min, max); } printf("\n"); #if 0 printf("wait time dump:\n"); for(i = 0; i < WORKMAX; i++) { for(int n = 0; n < nthreads; n++) { uint64_t val = end2[n][i] - end1[n][i]; printf("%lu ", val); } printf("\n"); } #endif printf("avg wait time: "); for(int n = 0; n < nthreads; n++) { uint64_t sum = 0, min = end2[0][0], max = 0; for(i = 0; i < WORKMAX; i++) { uint64_t val = end2[n][i] - end1[n][i]; sum += val; min = val < min ? val : min; max = val > max ? val : max; } printf("%lu(%lu,%lu) ", sum / WORKMAX, min, max); } printf("\n"); #endif printf("%s: threads %d, compute time %lu ticks\n", argv[0], nthreads, now - start); for(;;); return 0; }
kishoredbn/barrelfish
usr/tests/bomptest/sync.c
C
mit
4,408
package org.ccci.gto.android.common.util; import android.os.Looper; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.collection.LongSparseArray; import java.util.Map; public final class ThreadUtils { private ThreadUtils() {} public static void assertNotOnUiThread() { if (isUiThread()) { throw new RuntimeException("unsupported method on UI thread"); } } public static void assertOnUiThread() { if (!isUiThread()) { throw new RuntimeException("method requires UI thread"); } } @NonNull @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public static <K> Object getLock(@NonNull final Map<K, Object> locks, @Nullable final K key) { synchronized (locks) { Object lock = locks.get(key); if (lock == null) { lock = new Object(); locks.put(key, lock); } return lock; } } @NonNull @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public static Object getLock(@NonNull final LongSparseArray<Object> locks, final long key) { synchronized (locks) { Object lock = locks.get(key); if (lock == null) { lock = new Object(); locks.put(key, lock); } return lock; } } public static boolean isUiThread() { return Looper.getMainLooper().getThread() == Thread.currentThread(); } }
CruGlobal/android-gto-support
gto-support-core/src/main/java/org/ccci/gto/android/common/util/ThreadUtils.java
Java
mit
1,565
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.keyvault.models; import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; /** Defines values for KeyPermissions. */ public final class KeyPermissions extends ExpandableStringEnum<KeyPermissions> { /** Static value all for KeyPermissions. */ public static final KeyPermissions ALL = fromString("all"); /** Static value encrypt for KeyPermissions. */ public static final KeyPermissions ENCRYPT = fromString("encrypt"); /** Static value decrypt for KeyPermissions. */ public static final KeyPermissions DECRYPT = fromString("decrypt"); /** Static value wrapKey for KeyPermissions. */ public static final KeyPermissions WRAP_KEY = fromString("wrapKey"); /** Static value unwrapKey for KeyPermissions. */ public static final KeyPermissions UNWRAP_KEY = fromString("unwrapKey"); /** Static value sign for KeyPermissions. */ public static final KeyPermissions SIGN = fromString("sign"); /** Static value verify for KeyPermissions. */ public static final KeyPermissions VERIFY = fromString("verify"); /** Static value get for KeyPermissions. */ public static final KeyPermissions GET = fromString("get"); /** Static value list for KeyPermissions. */ public static final KeyPermissions LIST = fromString("list"); /** Static value create for KeyPermissions. */ public static final KeyPermissions CREATE = fromString("create"); /** Static value update for KeyPermissions. */ public static final KeyPermissions UPDATE = fromString("update"); /** Static value import for KeyPermissions. */ public static final KeyPermissions IMPORT = fromString("import"); /** Static value delete for KeyPermissions. */ public static final KeyPermissions DELETE = fromString("delete"); /** Static value backup for KeyPermissions. */ public static final KeyPermissions BACKUP = fromString("backup"); /** Static value restore for KeyPermissions. */ public static final KeyPermissions RESTORE = fromString("restore"); /** Static value recover for KeyPermissions. */ public static final KeyPermissions RECOVER = fromString("recover"); /** Static value purge for KeyPermissions. */ public static final KeyPermissions PURGE = fromString("purge"); /** * Creates or finds a KeyPermissions from its string representation. * * @param name a name to look for. * @return the corresponding KeyPermissions. */ @JsonCreator public static KeyPermissions fromString(String name) { return fromString(name, KeyPermissions.class); } /** @return known KeyPermissions values. */ public static Collection<KeyPermissions> values() { return values(KeyPermissions.class); } }
Azure/azure-sdk-for-java
sdk/resourcemanagerhybrid/azure-resourcemanager-keyvault/src/main/java/com/azure/resourcemanager/keyvault/models/KeyPermissions.java
Java
mit
3,010
package socks import ( _ "bufio" "errors" "io" "net" "strconv" "github.com/v2ray/v2ray-core" "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" protocol "github.com/v2ray/v2ray-core/proxy/socks/protocol" ) var ( ErrorAuthenticationFailed = errors.New("None of the authentication methods is allowed.") ErrorCommandNotSupported = errors.New("Client requested an unsupported command.") ErrorInvalidUser = errors.New("Invalid username or password.") ) // SocksServer is a SOCKS 5 proxy server type SocksServer struct { accepting bool vPoint *core.Point config SocksConfig } func NewSocksServer(vp *core.Point, rawConfig []byte) *SocksServer { config, err := loadConfig(rawConfig) if err != nil { panic(log.Error("Unable to load socks config: %v", err)) } return &SocksServer{ vPoint: vp, config: config, } } func (server *SocksServer) Listen(port uint16) error { listener, err := net.Listen("tcp", ":"+strconv.Itoa(int(port))) if err != nil { log.Error("Error on listening port %d: %v", port, err) return err } log.Debug("Working on tcp:%d", port) server.accepting = true go server.AcceptConnections(listener) return nil } func (server *SocksServer) AcceptConnections(listener net.Listener) { for server.accepting { connection, err := listener.Accept() if err != nil { log.Error("Error on accepting socks connection: %v", err) } go server.HandleConnection(connection) } } func (server *SocksServer) HandleConnection(connection net.Conn) error { defer connection.Close() reader := connection.(io.Reader) auth, auth4, err := protocol.ReadAuthentication(reader) if err != nil && err != protocol.ErrorSocksVersion4 { log.Error("Error on reading authentication: %v", err) return err } var dest v2net.Destination // TODO refactor this part if err == protocol.ErrorSocksVersion4 { result := protocol.Socks4RequestGranted if auth4.Command == protocol.CmdBind { result = protocol.Socks4RequestRejected } socks4Response := protocol.NewSocks4AuthenticationResponse(result, auth4.Port, auth4.IP[:]) protocol.WriteSocks4AuthenticationResponse(connection, socks4Response) if result == protocol.Socks4RequestRejected { return ErrorCommandNotSupported } dest = v2net.NewTCPDestination(v2net.IPAddress(auth4.IP[:], auth4.Port)) } else { expectedAuthMethod := protocol.AuthNotRequired if server.config.AuthMethod == JsonAuthMethodUserPass { expectedAuthMethod = protocol.AuthUserPass } if !auth.HasAuthMethod(expectedAuthMethod) { authResponse := protocol.NewAuthenticationResponse(protocol.AuthNoMatchingMethod) err = protocol.WriteAuthentication(connection, authResponse) if err != nil { log.Error("Error on socksio write authentication: %v", err) return err } log.Warning("Client doesn't support allowed any auth methods.") return ErrorAuthenticationFailed } authResponse := protocol.NewAuthenticationResponse(expectedAuthMethod) err = protocol.WriteAuthentication(connection, authResponse) if err != nil { log.Error("Error on socksio write authentication: %v", err) return err } if server.config.AuthMethod == JsonAuthMethodUserPass { upRequest, err := protocol.ReadUserPassRequest(reader) if err != nil { log.Error("Failed to read username and password: %v", err) return err } status := byte(0) if !upRequest.IsValid(server.config.Username, server.config.Password) { status = byte(0xFF) } upResponse := protocol.NewSocks5UserPassResponse(status) err = protocol.WriteUserPassResponse(connection, upResponse) if err != nil { log.Error("Error on socksio write user pass response: %v", err) return err } if status != byte(0) { return ErrorInvalidUser } } request, err := protocol.ReadRequest(reader) if err != nil { log.Error("Error on reading socks request: %v", err) return err } response := protocol.NewSocks5Response() if request.Command == protocol.CmdBind || request.Command == protocol.CmdUdpAssociate { response := protocol.NewSocks5Response() response.Error = protocol.ErrorCommandNotSupported err = protocol.WriteResponse(connection, response) if err != nil { log.Error("Error on socksio write response: %v", err) return err } log.Warning("Unsupported socks command %d", request.Command) return ErrorCommandNotSupported } response.Error = protocol.ErrorSuccess response.Port = request.Port response.AddrType = request.AddrType switch response.AddrType { case protocol.AddrTypeIPv4: copy(response.IPv4[:], request.IPv4[:]) case protocol.AddrTypeIPv6: copy(response.IPv6[:], request.IPv6[:]) case protocol.AddrTypeDomain: response.Domain = request.Domain } err = protocol.WriteResponse(connection, response) if err != nil { log.Error("Error on socksio write response: %v", err) return err } dest = request.Destination() } ray := server.vPoint.DispatchToOutbound(v2net.NewTCPPacket(dest)) input := ray.InboundInput() output := ray.InboundOutput() readFinish := make(chan bool) writeFinish := make(chan bool) go dumpInput(reader, input, readFinish) go dumpOutput(connection, output, writeFinish) <-writeFinish return nil } func dumpInput(reader io.Reader, input chan<- []byte, finish chan<- bool) { v2net.ReaderToChan(input, reader) close(input) close(finish) } func dumpOutput(writer io.Writer, output <-chan []byte, finish chan<- bool) { v2net.ChanToWriter(writer, output) close(finish) }
larryeee/v2ray-core
proxy/socks/socks.go
GO
mit
5,558
import {createItemSelector} from 'collections'; import {memoizedSelector} from 'utils'; const selector = createItemSelector('widgets'); export function widgetAttributes({role}) { return memoizedSelector( selector({id: role}), widget => widget ); }
tf/pageflow-dependabot-test
node_package/src/widgets/selectors.js
JavaScript
mit
263
// This is a part of the Microsoft Foundation Classes C++ library. // Copyright (C) Microsoft Corporation // All rights reserved. // // This source code is only intended as a supplement to the // Microsoft Foundation Classes Reference and related // electronic documentation provided with the library. // See these sources for detailed information regarding the // Microsoft Foundation Classes product. #pragma once #include "afxcontrolbarutil.h" #include "afxdockablepane.h" #ifdef _AFX_PACKING #pragma pack(push, _AFX_PACKING) #endif #ifdef _AFX_MINREBUILD #pragma component(minrebuild, off) #endif ///////////////////////////////////////////////////////////////////////////// // CDockablePaneAdapter window class CDockablePaneAdapter : public CDockablePane { DECLARE_SERIAL(CDockablePaneAdapter); // Construction public: CDockablePaneAdapter(); // Attributes public: CRect m_rectInitial; DWORD m_dwEnabledAlignmentInitial; // Operations public: virtual BOOL SetWrappedWnd(CWnd* pWnd); virtual CWnd* GetWrappedWnd() const { return m_pWnd; } virtual BOOL LoadState(LPCTSTR lpszProfileName = NULL, int nIndex = -1, UINT uiID = (UINT) -1); virtual BOOL SaveState(LPCTSTR lpszProfileName = NULL, int nIndex = -1, UINT uiID = (UINT) -1); // Implementation public: virtual ~CDockablePaneAdapter(); protected: //{{AFX_MSG(CDockablePaneAdapter) afx_msg void OnSize(UINT nType, int cx, int cy); //}}AFX_MSG DECLARE_MESSAGE_MAP() protected: CWnd* m_pWnd; }; #ifdef _AFX_MINREBUILD #pragma component(minrebuild, on) #endif #ifdef _AFX_PACKING #pragma pack(pop) #endif
pvpgn/pvpgn-magic-builder
module/include/atlmfc/afxdockablepaneadapter.h
C
mit
1,588
RSpec.configure do |config| config.add_setting :infer_base_class_for_anonymous_controllers, :default => false end module RSpec::Rails module ControllerExampleGroup extend ActiveSupport::Concern include RSpec::Rails::RailsExampleGroup include ActionController::TestCase::Behavior include RSpec::Rails::ViewRendering include RSpec::Rails::Matchers::RedirectTo include RSpec::Rails::Matchers::RenderTemplate include RSpec::Rails::Matchers::RoutingMatchers module ClassMethods # @private def controller_class described_class end # Supports a simple DSL for specifying behavior of ApplicationController. # Creates an anonymous subclass of ApplicationController and evals the # `body` in that context. Also sets up implicit routes for this # controller, that are separate from those defined in "config/routes.rb". # # @note Due to Ruby 1.8 scoping rules in anoymous subclasses, constants # defined in `ApplicationController` must be fully qualified (e.g. # `ApplicationController::AccessDenied`) in the block passed to the # `controller` method. Any instance methods, filters, etc, that are # defined in `ApplicationController`, however, are accessible from # within the block. # # @example # # describe ApplicationController do # controller do # def index # raise ApplicationController::AccessDenied # end # end # # describe "handling AccessDenied exceptions" do # it "redirects to the /401.html page" do # get :index # response.should redirect_to("/401.html") # end # end # end # # If you would like to spec a subclass of ApplicationController, call # controller like so: # # controller(ApplicationControllerSubclass) do # # .... # end def controller(base_class = nil, &body) base_class ||= RSpec.configuration.infer_base_class_for_anonymous_controllers? ? controller_class : ApplicationController metadata[:example_group][:described_class] = Class.new(base_class) do def self.name; "AnonymousController"; end end metadata[:example_group][:described_class].class_eval(&body) before do @orig_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new @routes.draw { resources :anonymous } end after do @routes, @orig_routes = @orig_routes, nil end end end attr_reader :controller, :routes module BypassRescue def rescue_with_handler(exception) raise exception end end # Extends the controller with a module that overrides # `rescue_with_handler` to raise the exception passed to it. Use this to # specify that an action _should_ raise an exception given appropriate # conditions. # # @example # # describe ProfilesController do # it "raises a 403 when a non-admin user tries to view another user's profile" do # profile = create_profile # login_as profile.user # # expect do # bypass_rescue # get :show, :id => profile.id + 1 # end.to raise_error(/403 Forbidden/) # end # end def bypass_rescue controller.extend(BypassRescue) end # If method is a named_route, delegates to the RouteSet associated with # this controller. def method_missing(method, *args, &block) if @orig_routes && @orig_routes.named_routes.helpers.include?(method) controller.send(method, *args, &block) else super end end included do subject { controller } metadata[:type] = :controller before do @routes = ::Rails.application.routes ActionController::Base.allow_forgery_protection = false end end end end
Jarob22/sc2_app_fyp_backend
vendor/bundle/ruby/1.9.1/gems/rspec-rails-2.11.0/lib/rspec/rails/example/controller_example_group.rb
Ruby
mit
4,140
# Lamppost [![Gem Version](http://img.shields.io/gem/v/lamppost.svg)](https://rubygems.org/gems/lamppost) [![Dependency Status](https://gemnasium.com/scour/lamppost.svg)](https://gemnasium.com/scour/lamppost) [![Build Status](https://travis-ci.org/scour/lamppost.svg)](https://travis-ci.org/scour/lamppost) [![Code Climate](https://codeclimate.com/github/scour/lamppost/badges/gpa.svg)](https://codeclimate.com/github/scour/lamppost) [![Coverage Status](https://coveralls.io/repos/scour/lamppost/badge.svg)](https://coveralls.io/r/scour/lamppost) Lamppost provides basic OPML parsing. It provides a convenience class for straightforward parsing of XML and files, but because it causes a parser class to get registered with Feedjira, it also allows you to take fetch and parse files with Feedjira itself. ### Basic Usage Pass in either a `File` or a `String` ```ruby opml = Lamppost::OPML.new(response.body) ``` You have access to any elements from the OPML's `<head>`. ```ruby title = opml.head.title name = opml.head.owner_name ``` And the outlines from the `<body>` ```ruby opml.outlines.each do |outline| text = outline.text url = outline.xml_url end ``` ### Feedjira Behind the scenes Lampost uses Feedjira parser classes provided by the [feedjira-opml](https://www.github.com/farski/feedjira-opml) gem. That gem registers the OPML parser with Feedjira, so it is available any time Feedjira is used to parse a document. ```ruby # Parse against OPML explicitly Feedjira::Feed.parse_with(Feedjira::Parser::OPML, response.body) ``` ```ruby # Feedjira will implicitly match the OPML parser when # it finds an <opml> tag Feedjira::Feed.parse(response.body) ``` You could also use Feedjira's `fetch_and_parse` method if you'd like.
farski/lamppost
README.md
Markdown
mit
1,751
package spire.math import scala.annotation.tailrec import scala.math.{ScalaNumber, ScalaNumericConversions} import java.math.{ BigDecimal => JBigDecimal, MathContext, RoundingMode } import spire.algebra.{Field, IsRational, NRoot, Sign} import spire.algebra.Sign.{ Positive, Zero, Negative } import spire.macros.Checked import spire.std.long.LongAlgebra import spire.std.double._ import spire.syntax.nroot._ sealed abstract class Rational extends ScalaNumber with ScalaNumericConversions with Ordered[Rational] { lhs => import LongRationals.LongRational import BigRationals.BigRational def numerator: BigInt def denominator: BigInt def numeratorAsLong: Long def denominatorAsLong: Long def isValidLong: Boolean def isWhole: Boolean // ugh, ScalaNumber and ScalaNumericConversions in 2.10 require this hack override def underlying: Object = this def abs: Rational = if (signum < 0) -this else this def inverse: Rational = reciprocal def reciprocal: Rational def signum: Int def unary_-(): Rational def +(rhs: Rational): Rational def -(rhs: Rational): Rational def *(rhs: Rational): Rational def /(rhs: Rational): Rational def /~(rhs: Rational): Rational = Rational(SafeLong((this / rhs).toBigInt), SafeLong.one) def %(rhs: Rational): Rational = this - (this /~ rhs) * rhs def /%(rhs: Rational): (Rational, Rational) = { val q = this /~ rhs (q, this - q * rhs) } def gcd(rhs: Rational): Rational def toBigDecimal(scale: Int, mode: RoundingMode): BigDecimal = { val n = new JBigDecimal(numerator.bigInteger) val d = new JBigDecimal(denominator.bigInteger) BigDecimal(n.divide(d, scale, mode)) } def toBigDecimal(mc: MathContext): BigDecimal = { val n = new JBigDecimal(numerator.bigInteger) val d = new JBigDecimal(denominator.bigInteger) BigDecimal(n.divide(d, mc)) } def toBigInt: BigInt override def shortValue: Short = longValue.toShort override def byteValue: Byte = longValue.toByte def floor: Rational def ceil: Rational def round: Rational def roundTo(denom: SafeLong): Rational = (this * denom).round / denom def pow(exp: Int): Rational def sign: Sign = Sign(signum) def compareToOne: Int def min(rhs: Rational): Rational = if ((lhs compare rhs) < 0) lhs else rhs def max(rhs: Rational): Rational = if ((lhs compare rhs) > 0) lhs else rhs /** * Returns a `Rational` whose numerator and denominator both fit in an `Int`. */ def limitToInt: Rational = limitTo(BigInt(Int.MaxValue)) /** * Returns a `Rational` whose numerator and denominator both fit in a `Long`. */ def limitToLong: Rational = limitTo(BigInt(Long.MaxValue)) /** * Returns a `Rational` whose denominator and numerator are no larger than * `max` and whose value is close to the original. This applies, even if, for * example, this `Rational` is greater than `max`. In that case, * `Rational(max, 1)` is returned. * * @param max A positive integer. */ def limitTo(max: BigInt): Rational = if (this.signum < 0) { -((-this).limitTo(max)) } else { require(max > 0, "Limit must be a positive integer.") val half = max >> 1 val floor = this.toBigInt if (floor >= max) { Rational(max) } else if (floor >= (max >> 1)) { Rational(floor.toLong) } else if (this < Rational(1)) { limitDenominatorTo(max) } else { limitDenominatorTo(max * denominator / numerator) } } /** * Finds the closest `Rational` to this `Rational` whose denominator is no * larger than `limit`. * * See [[http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree#Mediants_and_binary_search]] */ def limitDenominatorTo(limit: BigInt): Rational = { require(limit > 0, "Cannot limit denominator to non-positive number.") // TODO: We should always perform a binary search from the left or right to // speed up computation. For example, if in a search, we have a lower // bound of 1/2 for many steps, then each step will only add 1/2 to // the upper-bound, and so we'd converge on the number quite slowly. // However, we can speed this up by tentatively checking if we could // skip some intermediate values, by performing an adaptive search. // We'd simply keep doubling the number of steps we're skipping until // the upper-bound (eg) is now the lower bound, then go back to find // the greatest lower bound in the steps we missed by binary search. // Instead of adding 1/2 n times, we would try to add 1/2, 2/4, 4/8, // 8/16, etc., until the upper-bound swiches to a lower bound. Say // this happens a (1/2)*2^k, then we simply perform a binary search in // between (1/2)*2^(k-1) and (1/2)*2^k to find the new lower bound. // This would reduce the number of steps to O(log n). @tailrec def closest(l: Rational, u: Rational): Rational = { val mediant = Rational(l.numerator + u.numerator, l.denominator + u.denominator) if (mediant.denominator > limit) { if ((this - l).abs > (u - this).abs) u else l } else if (mediant == this) { mediant } else if (mediant < this) { closest(mediant, u) } else { closest(l, mediant) } } this.sign match { case Zero => this case Positive => closest(Rational(this.toBigInt), LongRationals.LongRational(1, 0)) case Negative => closest(LongRationals.LongRational(-1, 0), Rational(this.toBigInt)) } } } object Rational extends RationalInstances { private val RationalString = """^(-?\d+)/(-?\d+)$""".r private val IntegerString = """^(-?\d+)$""".r import LongRationals.LongRational import BigRationals.BigRational val zero: Rational = LongRational(0L, 1L) val one: Rational = LongRational(1L, 1L) def apply(n: SafeLong, d: SafeLong): Rational = { if (d.signum < 0) return apply(-n, -d) val g = n gcd d (n / g) match { case SafeLongLong(x) => (d / g) match { case SafeLongLong(y) => LongRational(x, y) case SafeLongBigInt(y) => BigRational(x, y) } case SafeLongBigInt(x) => BigRational(x, (d / g).toBigInt) } } def apply(n: Long, d: Long): Rational = LongRationals.build(n, d) def apply(n: BigInt, d: BigInt): Rational = BigRationals.build(n, d) implicit def apply(x: Int): Rational = if(x == 0) Rational.zero else LongRational(x, 1L) implicit def apply(x: Long): Rational = if(x == 0L) Rational.zero else LongRational(x, 1L) implicit def apply(x: BigInt): Rational = BigRationals.build(x, BigInt(1)) implicit def apply(x: Float): Rational = apply(x.toDouble) implicit def apply(x: Double): Rational = if (x == 0D) { zero } else { val bits = java.lang.Double.doubleToLongBits(x) val value = if ((bits >> 63) < 0) -(bits & 0x000FFFFFFFFFFFFFL | 0x0010000000000000L) else (bits & 0x000FFFFFFFFFFFFFL | 0x0010000000000000L) val exp = ((bits >> 52) & 0x7FF).toInt - 1075 // 1023 + 52 if (exp > 10) { apply(BigInt(value) << exp, BigInt(1)) } else if (exp >= 0) { apply(value << exp, 1L) } else if (exp >= -52 && (~((-1L) << (-exp)) & value) == 0L) { apply(value >> (-exp), 1L) } else { apply(BigInt(value), BigInt(1) << (-exp)) } } implicit def apply(x:BigDecimal): Rational = { if (x.ulp >= 1) { BigRationals.build(x.toBigInt, 1) } else { val n = (x / x.ulp).toBigInt val d = (BigDecimal(1.0) / x.ulp).toBigInt BigRationals.build(n, d) } } def apply(r: String): Rational = r match { case RationalString(n, d) => Rational(BigInt(n), BigInt(d)) case IntegerString(n) => Rational(BigInt(n)) case s => try { Rational(BigDecimal(s)) } catch { case nfe: NumberFormatException => throw new NumberFormatException("For input string: " + s) } } implicit def apply(n: SafeLong): Rational = n match { case SafeLongLong(x) => if (x == 0) Rational.zero else LongRational(x, 1L) case SafeLongBigInt(x) => BigRational(x, BigInt(1)) } implicit def apply(x: Number): Rational = x match { case RationalNumber(n) => n case IntNumber(n) => apply(n) case FloatNumber(n) => apply(n) case DecimalNumber(n) => apply(n) } // $COVERAGE-OFF$ /** * Returns an interval that bounds the nth-root of the integer x. * * TODO: This is really out-of-place too. */ def nroot(x: BigInt, n: Int): (BigInt, BigInt) = { def findnroot(prev: BigInt, add: Int): (BigInt, BigInt) = { val min = prev setBit add val max = min + 1 val fl = min pow n val cl = max pow n if (fl > x) { findnroot(prev, add - 1) } else if (cl < x) { findnroot(min, add - 1) } else if (cl == x) { (max, max) } else if (fl == x) { (min, min) } else { (min, max) } } findnroot(BigInt(0), (x.bitLength + n - 1) / n) // ceil(x.bitLength / n) } /** * Returns an interval that bounds the nth-root of the integer x. */ def nroot(x: Long, n: Int): (Long, Long) = { def findnroot(prev: Long, add: Long): (Long, Long) = { val min = prev | add val max = min + 1 val fl = pow(min, n) val cl = pow(max, n) if (fl <= 0 || fl > x) { findnroot(prev, add >> 1) } else if (cl < x) { findnroot(min, add >> 1) } else if (cl == x) { (max, max) } else if (fl == x) { (min, min) } else { (min, max) } } // TODO: Could probably get a better initial add then this. findnroot(0, 1L << ((65 - n) / n)) } // $COVERAGE-ON$ } private[math] abstract class Rationals[@specialized(Long) A](implicit integral: Integral[A]) { import integral._ def build(n: A, d: A): Rational sealed trait RationalLike extends Rational { def num: A def den: A def isWhole: Boolean = den == one def toBigInt: BigInt = (integral.toBigInt(num) / integral.toBigInt(den)) def longValue: Long = toBigInt.longValue def intValue: Int = longValue.intValue def floatValue: Float = doubleValue.toFloat def doubleValue: Double = if (num == zero) { 0.0 } else if (integral.lt(num, zero)) { -((-this).toDouble) } else { // We basically just shift n so that integer division gives us 54 bits of // accuracy. We use the last bit for rounding, so end w/ 53 bits total. val n = integral.toBigInt(num) val d = integral.toBigInt(den) val sharedLength = java.lang.Math.min(n.bitLength, d.bitLength) val dLowerLength = d.bitLength - sharedLength val nShared = n >> (n.bitLength - sharedLength) val dShared = d >> dLowerLength d.underlying.getLowestSetBit() < dLowerLength val addBit = if (nShared < dShared || (nShared == dShared && d.underlying.getLowestSetBit() < dLowerLength)) { 1 } else { 0 } val e = d.bitLength - n.bitLength + addBit val ln = n << (53 + e) // We add 1 bit for rounding. val lm = (ln / d).toLong val m = ((lm >> 1) + (lm & 1)) & 0x000fffffffffffffL val bits = (m | ((1023L - e) << 52)) java.lang.Double.longBitsToDouble(bits) } override def equals(that: Any): Boolean = that match { case that: Real => this == that.toRational case that: Algebraic => that == this case that: RationalLike => num == that.num && den == that.den case that: BigInt => isWhole && toBigInt == that case that: BigDecimal => try { toBigDecimal(that.mc) == that } catch { case ae: ArithmeticException => false } case that: SafeLong => SafeLong(toBigInt) == that case that: Number => Number(this) == that case that: Natural => isWhole && this == Rational(that.toBigInt) case that: Complex[_] => that == this case that: Quaternion[_] => that == this case that: Long => isValidLong && toLong == that case that => unifiedPrimitiveEquals(that) } override def toString: String = if (den == 1L) num.toString else "%s/%s" format (num, den) } } private[math] object LongRationals extends Rationals[Long] { import BigRationals.BigRational def build(n: Long, d: Long): Rational = { if (d == 0) throw new IllegalArgumentException("0 denominator") else if (d > 0) unsafeBuild(n, d) else if (n == Long.MinValue || d == Long.MinValue) Rational(-BigInt(n), -BigInt(d)) else unsafeBuild(-n, -d) } private[this] def buildWithDiv(num: Long, ngcd: Long, rd: Long, lden: Long): Rational = { val n = num / ngcd val d = rd / ngcd Checked.tryOrReturn { build(n, lden * d) } { Rational(BigInt(n), BigInt(lden) * d) } } private[this] def unsafeBuild(n: Long, d: Long): Rational = { if (n == 0L) return Rational.zero val divisor = spire.math.gcd(n, d) if (divisor == 1L) LongRational(n, d) else LongRational(n / divisor, d / divisor) } @SerialVersionUID(0L) case class LongRational private[math] (n: Long, d: Long) extends RationalLike with Serializable { def num: Long = n def den: Long = d def numerator: BigInt = ConvertableFrom[Long].toBigInt(n) def denominator: BigInt = ConvertableFrom[Long].toBigInt(d) def numeratorAsLong: Long = n def denominatorAsLong: Long = d def reciprocal: Rational = if (n == 0L) throw new ArithmeticException("reciprocal called on 0/1") else if (n > 0L) LongRational(d, n) else if (n == Long.MinValue || d == Long.MinValue) BigRational(-BigInt(d), -BigInt(n)) else LongRational(-d, -n) override def signum: Int = java.lang.Long.signum(n) override def isWhole: Boolean = d == 1L override def isValidChar: Boolean = isWhole && n.isValidChar override def isValidByte: Boolean = isWhole && n.isValidByte override def isValidShort: Boolean = isWhole && n.isValidShort override def isValidInt: Boolean = isWhole && n.isValidInt override def isValidLong: Boolean = isWhole override def unary_-(): Rational = if (n == Long.MinValue) BigRational(-BigInt(Long.MinValue), BigInt(d)) else LongRational(-n, d) def +(r: Rational): Rational = r match { case r: LongRational => val dgcd: Long = spire.math.gcd(d, r.d) if (dgcd == 1L) { Checked.tryOrReturn[Rational] { build(n * r.d + r.n * d, d * r.d) } { Rational(SafeLong(n) * r.d + SafeLong(r.n) * d, SafeLong(d) * r.d) } } else { val lden: Long = d / dgcd val rden: Long = r.d / dgcd Checked.tryOrReturn { val num: Long = n * rden + r.n * lden val ngcd: Long = spire.math.gcd(num, dgcd) if (ngcd == 1L) build(num, lden * r.d) else buildWithDiv(num, ngcd, r.d, lden) } { val num: BigInt = BigInt(n) * rden + BigInt(r.n) * lden val ngcd: Long = spire.math.gcd(dgcd, (num % dgcd).toLong) if (ngcd == 1L) Rational(SafeLong(num), SafeLong(lden) * r.d) else Rational(SafeLong(num) / ngcd, SafeLong(lden) * (r.d / ngcd)) } } case r: BigRational => val dgcd: Long = spire.math.gcd(d, (r.d % d).toLong) if (dgcd == 1L) { val num = SafeLong(r.d * n + r.n * d) val den = SafeLong(r.d * d) Rational(num, den) } else { val lden: Long = d / dgcd val rden: SafeLong = SafeLong(r.d) / dgcd val num: SafeLong = rden * n + SafeLong(r.n) * lden val ngcd: Long = num match { case SafeLongLong(x) => spire.math.gcd(x, dgcd) case SafeLongBigInt(x) => spire.math.gcd(dgcd, (x % dgcd).toLong) } if (ngcd == 1L) Rational(num, SafeLong(lden) * r.d) else Rational(num / ngcd, SafeLong(r.d / ngcd) * lden) } } def -(r: Rational): Rational = r match { case r: LongRational => val dgcd: Long = spire.math.gcd(d, r.d) if (dgcd == 1L) { Checked.tryOrReturn[Rational] { build(n * r.d - r.n * d, d * r.d) } { Rational(SafeLong(n) * r.d - SafeLong(r.n) * d, SafeLong(d) * r.d) } } else { val lden: Long = d / dgcd val rden: Long = r.d / dgcd Checked.tryOrReturn { val num: Long = n * rden - r.n * lden val ngcd: Long = spire.math.gcd(num, dgcd) if (ngcd == 1L) build(num, lden * r.d) else buildWithDiv(num, ngcd, r.d, lden) } { val num: BigInt = BigInt(n) * rden - BigInt(r.n) * lden val ngcd: Long = spire.math.gcd(dgcd, (num % dgcd).toLong) if (ngcd == 1L) Rational(SafeLong(num), SafeLong(lden) * r.d) else Rational(SafeLong(num) / ngcd, SafeLong(lden) * (r.d / ngcd)) } } case r: BigRational => val dgcd: Long = spire.math.gcd(d, (r.d % d).toLong) if (dgcd == 1L) { val num = SafeLong(r.d * n - r.n * d) val den = SafeLong(r.d * d) Rational(num, den) } else { val lden: Long = d / dgcd val rden: SafeLong = SafeLong(r.d) / dgcd val num: SafeLong = rden * n - SafeLong(r.n) * lden val ngcd: Long = num match { case SafeLongLong(x) => spire.math.gcd(x, dgcd) case SafeLongBigInt(x) => spire.math.gcd(dgcd, (x % dgcd).toLong) } if (ngcd == 1L) Rational(num, SafeLong(lden) * r.d) else Rational(num / ngcd, SafeLong(r.d / ngcd) * lden) } } def *(r: Rational): Rational = if (n == 0L) Rational.zero else r match { case r: LongRationals.LongRational => val a = spire.math.gcd(n, r.d) val b = spire.math.gcd(d, r.n) // this does not have to happen within the checked block, since the divisions are guaranteed to work val n1 = n / a val n2 = r.n / b val d1 = d / b val d2 = r.d / a Checked.tryOrReturn[Rational] { LongRational(n1 * n2, d1 * d2) } { // we know that the result does not fit into a LongRational, and also that the denominators are positive. // so we can just call BigRational.apply directly BigRational(BigInt(n1) * n2, BigInt(d1) * d2) } case r: BigRational => val a = spire.math.gcd(n, (r.d % n).toLong) val b = spire.math.gcd(d, (r.n % d).toLong) Rational(SafeLong(n / a) * (r.n / b), SafeLong(d / b) * (r.d / a)) } def /(r: Rational): Rational = r match { case r: LongRational => // we only have to do this check in the long branch, since 0 is always represented as LongRational(0,1) if (r.n == 0L) throw new ArithmeticException("divide (/) by 0") if (n == 0L) return this val a = spire.math.gcd(n, r.n) val b = spire.math.gcd(d, r.d) // this does not have to happen within the checked block, since the divisions are guaranteed to work val n1 = n / a val n2 = r.n / a var d1 = d / b var d2 = r.d / b // this is to make sure that the denominator of the result is positive if (n2 < 0) { // denominators are always positive, so negating them can not yield an overflow d1 = -d1 d2 = -d2 } Checked.tryOrReturn[Rational] { LongRational(n1 * d2, d1 * n2) } { // we know that the result does not fit into a LongRational, and we have made sure that the product of d1 // and n2 is positive. So we can just call BigRational.apply directly BigRational(BigInt(n1) * d2, BigInt(d1) * n2) } case r: BigRational => if (n == 0L) return this val a = spire.math.gcd(n, (r.n % n).toLong) val b = spire.math.gcd(d, (r.d % d).toLong) val num = SafeLong(n / a) * (r.d / b) val den = SafeLong(d / b) * (r.n / a) if (den < SafeLong.zero) Rational(-num, -den) else Rational(num, den) } def gcd(r: Rational): Rational = r match { case r: LongRationals.LongRational => val dgcd: Long = spire.math.gcd(d, r.d) val n0 = spire.math.abs(n) val n1 = spire.math.abs(r.n) if (dgcd == 1L) { Rational(spire.math.gcd(n0, n1), SafeLong(d) * r.d) } else { val lm = d / dgcd val rm = r.d / dgcd Rational((SafeLong(n0) * rm) gcd (SafeLong(n1) * lm), SafeLong(dgcd) * lm * rm) } case r: BigRational => val dgcd: Long = spire.math.gcd(d, (r.d % d).toLong) if (dgcd == 1L) { Rational(spire.math.gcd(spire.math.abs(n), spire.math.abs((r.n % n).toLong)), SafeLong(d) * r.d) } else { val lm = d / dgcd val rm = r.d / dgcd Rational((SafeLong(spire.math.abs(n)) * rm) gcd (SafeLong(r.n.abs) * lm), SafeLong(dgcd) * lm * rm) } } def floor: Rational = if (d == 1L) this else if (n >= 0) Rational(n / d, 1L) else Rational(n / d - 1L, 1L) def ceil: Rational = if (d == 1L) this else if (n >= 0) Rational(n / d + 1L, 1L) else Rational(n / d, 1L) def round: Rational = if (n >= 0) { val m = (n % d) if (m >= (d - m)) Rational(n / d + 1) else Rational(n / d) } else { val m = -(n % d) if (m >= (d - m)) Rational(n / d - 1) else Rational(n / d) } def pow(exp: Int): Rational = if (exp == 0) Rational.one else if (exp < 0) reciprocal.pow(-exp) else Rational(SafeLong(n).pow(exp), SafeLong(d).pow(exp)) def compareToOne: Int = n compare d def compare(r: Rational): Int = r match { case r: LongRationals.LongRational => Checked.tryOrElse { LongAlgebra.compare(n * r.d, r.n * d) } { val dgcd = spire.math.gcd(d, r.d) if (dgcd == 1L) (SafeLong(n) * r.d - SafeLong(r.n) * d).signum else (SafeLong(n) * (r.d / dgcd) - SafeLong(r.n) * (d / dgcd)).signum } case r: BigRational => val dgcd = spire.math.gcd(d, (r.d % d).toLong) if (dgcd == 1L) (SafeLong(n) * r.d - SafeLong(r.n) * d).signum else (SafeLong(n) * (r.d / dgcd) - SafeLong(r.n) * (d / dgcd)).signum } override def equals(that: Any): Boolean = that match { case that: LongRational => this.n == that.n && this.d == that.d case _ => super.equals(that) } override def longValue: Long = if(d == 1L) n else n / d override def hashCode: Int = if (d==1) unifiedPrimitiveHashcode else 29 * (37 * n.## + d.##) } } private[math] object BigRationals extends Rationals[BigInt] { import LongRationals.LongRational def build(n: BigInt, d: BigInt): Rational = { if (d == 0) throw new IllegalArgumentException("0 denominator") else if (d > 0) unsafeBuild(n, d) else unsafeBuild(-n, -d) } private[this] def unsafeBuild(n: BigInt, d:BigInt): Rational = { if (n == 0) return Rational.zero val gcd = n.gcd(d) if (gcd == 1) Rational(SafeLong(n), SafeLong(d)) else Rational(SafeLong(n / gcd), SafeLong(d / gcd)) } @SerialVersionUID(0L) case class BigRational private[math] (n: BigInt, d: BigInt) extends RationalLike with Serializable { def num: BigInt = n def den: BigInt = d def numerator: BigInt = n def denominator: BigInt = d def numeratorAsLong: Long = n.toLong def denominatorAsLong: Long = d.toLong def reciprocal: BigRational = if (signum < 0) BigRational(-d, -n) else BigRational(d, n) override def signum: Int = n.signum override def isValidChar: Boolean = false override def isValidByte: Boolean = false override def isValidShort: Boolean = false override def isValidInt: Boolean = false override def isValidLong: Boolean = false override def unary_-(): Rational = Rational(-SafeLong(n), SafeLong(d)) def +(r: Rational): Rational = r match { case r: LongRational => r + this case r: BigRationals.BigRational => val dgcd: BigInt = d.gcd(r.d) if (dgcd == 1) { Rational(SafeLong(r.d * n + r.n * d), SafeLong(r.d * d)) } else { val lden: BigInt = d / dgcd val rden: BigInt = r.d / dgcd val num: BigInt = rden * n + r.n * lden val ngcd: BigInt = num.gcd(dgcd) if (ngcd == 1) Rational(SafeLong(num), SafeLong(lden * r.d)) else Rational(SafeLong(num / ngcd), SafeLong(r.d / ngcd) * lden) } } def -(r: Rational): Rational = r match { case r: LongRational => (-r) + this case r: BigRationals.BigRational => val dgcd: BigInt = d.gcd(r.d) if (dgcd == 1) { Rational(SafeLong(r.d * n - r.n * d), SafeLong(r.d * d)) } else { val lden: BigInt = d / dgcd val rden: BigInt = r.d / dgcd val num: BigInt = rden * n - r.n * lden val ngcd: BigInt = num.gcd(dgcd) if (ngcd == 1) Rational(SafeLong(num), SafeLong(lden * r.d)) else Rational(SafeLong(num / ngcd), SafeLong(r.d / ngcd) * lden) } } def *(r: Rational): Rational = r match { case r: LongRational => r * this case r: BigRationals.BigRational => val a = n.gcd(r.d) val b = d.gcd(r.n) Rational(SafeLong((n / a) * (r.n / b)), SafeLong((d / b) * (r.d / a))) } def /(r: Rational): Rational = r match { case r: LongRational => r.inverse * this case r: BigRationals.BigRational => val a = n.gcd(r.n) val b = d.gcd(r.d) val num = SafeLong(n / a) * (r.d / b) val den = SafeLong(d / b) * (r.n / a) if (den < SafeLong.zero) Rational(-num, -den) else Rational(num, den) } def gcd(r: Rational): Rational = r match { case r: LongRational => r gcd this case r: BigRationals.BigRational => val dgcd: BigInt = d.gcd(r.d) if (dgcd == 1) { Rational(n.abs gcd r.n.abs, d * r.d) } else { val lm = d / dgcd val rm = r.d / dgcd Rational((n * rm).abs gcd (r.n * lm).abs, dgcd * lm * rm) } } def floor: Rational = if (d == 1) this else if (n >= 0) Rational(n / d, BigInt(1)) else Rational(n / d - 1, BigInt(1)) def ceil: Rational = if (d == 1) this else if (n >= 0) Rational(n / d + 1, BigInt(1)) else Rational(n / d, BigInt(1)) def round: Rational = if (n >= 0) { val m = (n % d) if (m >= (d - m)) Rational(n / d + 1) else Rational(n / d) } else { val m = -(n % d) if (m >= (d - m)) Rational(n / d - 1) else Rational(n / d) } def pow(exp: Int): Rational = if (exp == 0) Rational.one else if (exp < 0) BigRationals.build(d pow -exp, n pow -exp) else BigRationals.build(n pow exp, d pow exp) def compareToOne: Int = n compare d def compare(r: Rational): Int = r match { case r: LongRational => { val dgcd = spire.math.gcd(r.d, (d % r.d).toLong) if (dgcd == 1L) (SafeLong(n) * r.d - SafeLong(r.n) * d).signum else (SafeLong(n) * (r.d / dgcd) - SafeLong(r.n) * (d / dgcd)).signum } case r: BigRationals.BigRational => { val dgcd = d.gcd(r.d) if (dgcd == 1) (SafeLong(n * r.d) - r.n * d).signum else (SafeLong(r.d / dgcd) * n - SafeLong(d / dgcd) * r.n).signum } } override def hashCode: Int = 29 * (37 * n.## + d.##) } } trait RationalInstances { implicit final val RationalAlgebra = new RationalAlgebra import NumberTag._ implicit final val RationalTag = new LargeTag[Rational](Exact, Rational.zero) } /** * Used for Fractional[Rational] and Numeric[Rational] to provide * approximate sqrt and nroot implementations. * * These operations occur at Double precision. */ private[math] trait RationalApproximateNRoot extends NRoot[Rational] { def nroot(n: Rational, k: Int): Rational = Rational(n.toDouble nroot k) def fpow(n: Rational, k: Rational): Rational = Rational(n.toDouble ** k.toDouble) } private[math] trait RationalIsField extends Field[Rational] { override def minus(a:Rational, b:Rational): Rational = a - b def negate(a:Rational): Rational = -a def one: Rational = Rational.one def plus(a:Rational, b:Rational): Rational = a + b override def pow(a:Rational, b:Int): Rational = a.pow(b) override def times(a:Rational, b:Rational): Rational = a * b def zero: Rational = Rational.zero def quot(a:Rational, b:Rational): Rational = a /~ b def mod(a:Rational, b:Rational): Rational = a % b override def quotmod(a:Rational, b:Rational): (Rational, Rational) = a /% b def gcd(a:Rational, b:Rational): Rational = a gcd b override def fromInt(n: Int): Rational = Rational(n) override def fromDouble(n: Double): Rational = Rational(n) def div(a:Rational, b:Rational): Rational = a / b } private[math] trait RationalIsReal extends IsRational[Rational] { override def eqv(x:Rational, y:Rational): Boolean = x == y override def neqv(x:Rational, y:Rational): Boolean = x != y override def gt(x: Rational, y: Rational): Boolean = x > y override def gteqv(x: Rational, y: Rational): Boolean = x >= y override def lt(x: Rational, y: Rational): Boolean = x < y override def lteqv(x: Rational, y: Rational): Boolean = x <= y def compare(x: Rational, y: Rational): Int = x compare y override def sign(a: Rational): Sign = a.sign def signum(a: Rational): Int = a.signum def abs(a: Rational): Rational = a.abs def toDouble(r: Rational): Double = r.toDouble def ceil(a:Rational): Rational = a.ceil def floor(a:Rational): Rational = a.floor def round(a:Rational): Rational = a.round def toRational(a: Rational): Rational = a def isWhole(a:Rational): Boolean = a.isWhole } @SerialVersionUID(1L) class RationalAlgebra extends RationalIsField with RationalIsReal with Serializable
woparry/spire
core/src/main/scala/spire/math/Rational.scala
Scala
mit
30,582
package skin.support.utils; import android.content.Context; import android.content.SharedPreferences; import skin.support.SkinCompatManager; /** * Created by ximsfei on 2017/1/10. */ public class SkinPreference { private static final String FILE_NAME = "meta-data"; private static final String KEY_SKIN_NAME = "skin-name"; private static final String KEY_SKIN_STRATEGY = "skin-strategy"; private static final String KEY_SKIN_USER_THEME = "skin-user-theme-json"; private static SkinPreference sInstance; private final Context mApp; private final SharedPreferences mPref; private final SharedPreferences.Editor mEditor; public static void init(Context context) { if (sInstance == null) { synchronized (SkinPreference.class) { if (sInstance == null) { sInstance = new SkinPreference(context.getApplicationContext()); } } } } public static SkinPreference getInstance() { return sInstance; } private SkinPreference(Context applicationContext) { mApp = applicationContext; mPref = mApp.getSharedPreferences(FILE_NAME, Context.MODE_PRIVATE); mEditor = mPref.edit(); } public SkinPreference setSkinName(String skinName) { mEditor.putString(KEY_SKIN_NAME, skinName); return this; } public String getSkinName() { return mPref.getString(KEY_SKIN_NAME, ""); } public SkinPreference setSkinStrategy(int strategy) { mEditor.putInt(KEY_SKIN_STRATEGY, strategy); return this; } public int getSkinStrategy() { return mPref.getInt(KEY_SKIN_STRATEGY, SkinCompatManager.SKIN_LOADER_STRATEGY_NONE); } public SkinPreference setUserTheme(String themeJson) { mEditor.putString(KEY_SKIN_USER_THEME, themeJson); return this; } public String getUserTheme() { return mPref.getString(KEY_SKIN_USER_THEME, ""); } public void commitEditor() { mEditor.apply(); } }
ximsfei/Android-skin-support
androidx/skin-support/src/main/java/skin/support/utils/SkinPreference.java
Java
mit
2,066
from . animation import Animation from .. layout import strip class Strip(Animation): LAYOUT_CLASS = strip.Strip LAYOUT_ARGS = 'num', def __init__(self, layout, start=0, end=-1, **kwds): super().__init__(layout, **kwds) self._start = max(start, 0) self._end = end if self._end < 0 or self._end >= self.layout.numLEDs: self._end = self.layout.numLEDs - 1 self._size = self._end - self._start + 1 from .. import deprecated if deprecated.allowed(): BaseStripAnim = Strip
ManiacalLabs/BiblioPixel
bibliopixel/animation/strip.py
Python
mit
543
/* dso_lib.c */ /* * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project * 2000. */ /* ==================================================================== * Copyright (c) 2000 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. All advertising materials mentioning features or use of this * software must display the following acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" * * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to * endorse or promote products derived from this software without * prior written permission. For written permission, please contact * licensing@OpenSSL.org. * * 5. Products derived from this software may not be called "OpenSSL" * nor may "OpenSSL" appear in their names without prior written * permission of the OpenSSL Project. * * 6. Redistributions of any form whatsoever must retain the following * acknowledgment: * "This product includes software developed by the OpenSSL Project * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" * * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * * This product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include <stdio.h> #include "crypto.h" #include "cryptlib.h" #include "dso.h" static DSO_METHOD *default_DSO_meth = NULL; DSO *DSO_new(void) { return (DSO_new_method(NULL)); } void DSO_set_default_method(DSO_METHOD *meth) { default_DSO_meth = meth; } DSO_METHOD *DSO_get_default_method(void) { return (default_DSO_meth); } DSO_METHOD *DSO_get_method(DSO *dso) { return (dso->meth); } DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth) { DSO_METHOD *mtmp; mtmp = dso->meth; dso->meth = meth; return (mtmp); } DSO *DSO_new_method(DSO_METHOD *meth) { DSO *ret; if (default_DSO_meth == NULL) /* * We default to DSO_METH_openssl() which in turn defaults to * stealing the "best available" method. Will fallback to * DSO_METH_null() in the worst case. */ default_DSO_meth = DSO_METHOD_openssl(); ret = (DSO *)OPENSSL_malloc(sizeof(DSO)); if (ret == NULL) { DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); return (NULL); } memset(ret, 0, sizeof(DSO)); ret->meth_data = sk_void_new_null(); if (ret->meth_data == NULL) { /* sk_new doesn't generate any errors so we do */ DSOerr(DSO_F_DSO_NEW_METHOD, ERR_R_MALLOC_FAILURE); OPENSSL_free(ret); return (NULL); } if (meth == NULL) ret->meth = default_DSO_meth; else ret->meth = meth; ret->references = 1; if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { sk_void_free(ret->meth_data); OPENSSL_free(ret); ret = NULL; } return (ret); } int DSO_free(DSO *dso) { int i; if (dso == NULL) { DSOerr(DSO_F_DSO_FREE, ERR_R_PASSED_NULL_PARAMETER); return (0); } i = CRYPTO_add(&dso->references, -1, CRYPTO_LOCK_DSO); #ifdef REF_PRINT REF_PRINT("DSO", dso); #endif if (i > 0) return (1); #ifdef REF_CHECK if (i < 0) { fprintf(stderr, "DSO_free, bad reference count\n"); abort(); } #endif if ((dso->meth->dso_unload != NULL) && !dso->meth->dso_unload(dso)) { DSOerr(DSO_F_DSO_FREE, DSO_R_UNLOAD_FAILED); return (0); } if ((dso->meth->finish != NULL) && !dso->meth->finish(dso)) { DSOerr(DSO_F_DSO_FREE, DSO_R_FINISH_FAILED); return (0); } sk_void_free(dso->meth_data); if (dso->filename != NULL) OPENSSL_free(dso->filename); if (dso->loaded_filename != NULL) OPENSSL_free(dso->loaded_filename); OPENSSL_free(dso); return (1); } int DSO_flags(DSO *dso) { return ((dso == NULL) ? 0 : dso->flags); } int DSO_up_ref(DSO *dso) { if (dso == NULL) { DSOerr(DSO_F_DSO_UP_REF, ERR_R_PASSED_NULL_PARAMETER); return (0); } CRYPTO_add(&dso->references, 1, CRYPTO_LOCK_DSO); return (1); } DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth, int flags) { DSO *ret; int allocated = 0; if (dso == NULL) { ret = DSO_new_method(meth); if (ret == NULL) { DSOerr(DSO_F_DSO_LOAD, ERR_R_MALLOC_FAILURE); goto err; } allocated = 1; /* Pass the provided flags to the new DSO object */ if (DSO_ctrl(ret, DSO_CTRL_SET_FLAGS, flags, NULL) < 0) { DSOerr(DSO_F_DSO_LOAD, DSO_R_CTRL_FAILED); goto err; } } else ret = dso; /* Don't load if we're currently already loaded */ if (ret->filename != NULL) { DSOerr(DSO_F_DSO_LOAD, DSO_R_DSO_ALREADY_LOADED); goto err; } /* * filename can only be NULL if we were passed a dso that already has one * set. */ if (filename != NULL) if (!DSO_set_filename(ret, filename)) { DSOerr(DSO_F_DSO_LOAD, DSO_R_SET_FILENAME_FAILED); goto err; } filename = ret->filename; if (filename == NULL) { DSOerr(DSO_F_DSO_LOAD, DSO_R_NO_FILENAME); goto err; } if (ret->meth->dso_load == NULL) { DSOerr(DSO_F_DSO_LOAD, DSO_R_UNSUPPORTED); goto err; } if (!ret->meth->dso_load(ret)) { DSOerr(DSO_F_DSO_LOAD, DSO_R_LOAD_FAILED); goto err; } /* Load succeeded */ return (ret); err: if (allocated) DSO_free(ret); return (NULL); } void *DSO_bind_var(DSO *dso, const char *symname) { void *ret = NULL; if ((dso == NULL) || (symname == NULL)) { DSOerr(DSO_F_DSO_BIND_VAR, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } if (dso->meth->dso_bind_var == NULL) { DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_UNSUPPORTED); return (NULL); } if ((ret = dso->meth->dso_bind_var(dso, symname)) == NULL) { DSOerr(DSO_F_DSO_BIND_VAR, DSO_R_SYM_FAILURE); return (NULL); } /* Success */ return (ret); } DSO_FUNC_TYPE DSO_bind_func(DSO *dso, const char *symname) { DSO_FUNC_TYPE ret = NULL; if ((dso == NULL) || (symname == NULL)) { DSOerr(DSO_F_DSO_BIND_FUNC, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } if (dso->meth->dso_bind_func == NULL) { DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_UNSUPPORTED); return (NULL); } if ((ret = dso->meth->dso_bind_func(dso, symname)) == NULL) { DSOerr(DSO_F_DSO_BIND_FUNC, DSO_R_SYM_FAILURE); return (NULL); } /* Success */ return (ret); } /* * I don't really like these *_ctrl functions very much to be perfectly * honest. For one thing, I think I have to return a negative value for any * error because possible DSO_ctrl() commands may return values such as * "size"s that can legitimately be zero (making the standard * "if (DSO_cmd(...))" form that works almost everywhere else fail at odd * times. I'd prefer "output" values to be passed by reference and the return * value as success/failure like usual ... but we conform when we must... :-) */ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg) { if (dso == NULL) { DSOerr(DSO_F_DSO_CTRL, ERR_R_PASSED_NULL_PARAMETER); return (-1); } /* * We should intercept certain generic commands and only pass control to * the method-specific ctrl() function if it's something we don't handle. */ switch (cmd) { case DSO_CTRL_GET_FLAGS: return dso->flags; case DSO_CTRL_SET_FLAGS: dso->flags = (int)larg; return (0); case DSO_CTRL_OR_FLAGS: dso->flags |= (int)larg; return (0); default: break; } if ((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL)) { DSOerr(DSO_F_DSO_CTRL, DSO_R_UNSUPPORTED); return (-1); } return (dso->meth->dso_ctrl(dso, cmd, larg, parg)); } int DSO_set_name_converter(DSO *dso, DSO_NAME_CONVERTER_FUNC cb, DSO_NAME_CONVERTER_FUNC *oldcb) { if (dso == NULL) { DSOerr(DSO_F_DSO_SET_NAME_CONVERTER, ERR_R_PASSED_NULL_PARAMETER); return (0); } if (oldcb) *oldcb = dso->name_converter; dso->name_converter = cb; return (1); } const char *DSO_get_filename(DSO *dso) { if (dso == NULL) { DSOerr(DSO_F_DSO_GET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } return (dso->filename); } int DSO_set_filename(DSO *dso, const char *filename) { char *copied; if ((dso == NULL) || (filename == NULL)) { DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_PASSED_NULL_PARAMETER); return (0); } if (dso->loaded_filename) { DSOerr(DSO_F_DSO_SET_FILENAME, DSO_R_DSO_ALREADY_LOADED); return (0); } /* We'll duplicate filename */ copied = OPENSSL_malloc(strlen(filename) + 1); if (copied == NULL) { DSOerr(DSO_F_DSO_SET_FILENAME, ERR_R_MALLOC_FAILURE); return (0); } BUF_strlcpy(copied, filename, strlen(filename) + 1); if (dso->filename) OPENSSL_free(dso->filename); dso->filename = copied; return (1); } char *DSO_merge(DSO *dso, const char *filespec1, const char *filespec2) { char *result = NULL; if (dso == NULL || filespec1 == NULL) { DSOerr(DSO_F_DSO_MERGE, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { if (dso->merger != NULL) result = dso->merger(dso, filespec1, filespec2); else if (dso->meth->dso_merger != NULL) result = dso->meth->dso_merger(dso, filespec1, filespec2); } return (result); } char *DSO_convert_filename(DSO *dso, const char *filename) { char *result = NULL; if (dso == NULL) { DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } if (filename == NULL) filename = dso->filename; if (filename == NULL) { DSOerr(DSO_F_DSO_CONVERT_FILENAME, DSO_R_NO_FILENAME); return (NULL); } if ((dso->flags & DSO_FLAG_NO_NAME_TRANSLATION) == 0) { if (dso->name_converter != NULL) result = dso->name_converter(dso, filename); else if (dso->meth->dso_name_converter != NULL) result = dso->meth->dso_name_converter(dso, filename); } if (result == NULL) { result = OPENSSL_malloc(strlen(filename) + 1); if (result == NULL) { DSOerr(DSO_F_DSO_CONVERT_FILENAME, ERR_R_MALLOC_FAILURE); return (NULL); } BUF_strlcpy(result, filename, strlen(filename) + 1); } return (result); } const char *DSO_get_loaded_filename(DSO *dso) { if (dso == NULL) { DSOerr(DSO_F_DSO_GET_LOADED_FILENAME, ERR_R_PASSED_NULL_PARAMETER); return (NULL); } return (dso->loaded_filename); } int DSO_pathbyaddr(void *addr, char *path, int sz) { DSO_METHOD *meth = default_DSO_meth; if (meth == NULL) meth = DSO_METHOD_openssl(); if (meth->pathbyaddr == NULL) { DSOerr(DSO_F_DSO_PATHBYADDR, DSO_R_UNSUPPORTED); return -1; } return (*meth->pathbyaddr) (addr, path, sz); } void *DSO_global_lookup(const char *name) { DSO_METHOD *meth = default_DSO_meth; if (meth == NULL) meth = DSO_METHOD_openssl(); if (meth->globallookup == NULL) { DSOerr(DSO_F_DSO_GLOBAL_LOOKUP, DSO_R_UNSUPPORTED); return NULL; } return (*meth->globallookup) (name); }
NickAger/elm-slider
ServerSlider/HTTPServer/Packages/COpenSSL-0.14.0/Sources/dso_lib.c
C
mit
13,102
Vedeu.interface :chat do visible false # cursor needs to be enabled to scroll cursor true background SpicedRumby::GUI::Colorer::BACKGROUND foreground SpicedRumby::GUI::Colorer::FOREGROUND group :main border do title "#{SpicedRumby::NAME}: v#{SpicedRumby::VERSION}" background SpicedRumby::GUI::Colorer::BACKGROUND end geometry do width = (Vedeu.width / 5.0 * 4.0).round align :top, :left, width, Vedeu.height - 6 end end
NullVoxPopuli/spiced_gracken
lib/spiced_rumby/gui/views/interfaces/chat.rb
Ruby
mit
459
<?php return unserialize('a:1:{i:0;O:27:"Doctrine\\ORM\\Mapping\\Column":9:{s:4:"name";s:17:"naturemarchandise";s:4:"type";s:6:"string";s:6:"length";i:255;s:9:"precision";i:0;s:5:"scale";i:0;s:6:"unique";b:0;s:8:"nullable";b:1;s:7:"options";a:0:{}s:16:"columnDefinition";N;}}');
ingetat2014/www
app/cache/prod/annotations/008eac84e85085c602f8f91e85c141c65a12cdef$naturemarchandise.cache.php
PHP
mit
278
require 'test_helper' class RemoteStripeTest < Test::Unit::TestCase def setup @gateway = StripeGateway.new(fixtures(:stripe)) @amount = 100 @credit_card = credit_card('4242424242424242') @declined_card = credit_card('4000000000000002') @new_credit_card = credit_card('5105105105105100') @options = { :currency => "USD", :description => 'ActiveMerchant Test Purchase', :email => 'wow@example.com' } end def test_transcript_scrubbing transcript = capture_transcript(@gateway) do @gateway.purchase(@amount, @credit_card, @options) end transcript = @gateway.scrub(transcript) assert_scrubbed(@credit_card.number, transcript) assert_scrubbed(@credit_card.verification_value, transcript) assert_scrubbed(@gateway.options[:login], transcript) end def test_successful_purchase assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert_equal "charge", response.params["object"] assert_equal response.authorization, response.params["id"] assert response.params["paid"] assert_equal "ActiveMerchant Test Purchase", response.params["description"] assert_equal "wow@example.com", response.params["metadata"]["email"] end def test_successful_purchase_with_blank_referer options = @options.merge({referrer: ""}) assert response = @gateway.purchase(@amount, @credit_card, options) assert_success response assert_equal "charge", response.params["object"] assert_equal response.authorization, response.params["id"] assert response.params["paid"] assert_equal "ActiveMerchant Test Purchase", response.params["description"] assert_equal "wow@example.com", response.params["metadata"]["email"] end def test_successful_purchase_with_recurring_flag custom_options = @options.merge(:eci => 'recurring') assert response = @gateway.purchase(@amount, @credit_card, custom_options) assert_success response assert_equal "charge", response.params["object"] assert response.params["paid"] assert_equal "ActiveMerchant Test Purchase", response.params["description"] assert_equal "wow@example.com", response.params["metadata"]["email"] end def test_unsuccessful_purchase assert response = @gateway.purchase(@amount, @declined_card, @options) assert_failure response assert_match %r{Your card was declined}, response.message assert_match Gateway::STANDARD_ERROR_CODE[:card_declined], response.error_code assert_match /ch_[a-zA-Z\d]+/, response.authorization end def test_authorization_and_capture assert authorization = @gateway.authorize(@amount, @credit_card, @options) assert_success authorization refute authorization.params["captured"] assert_equal "ActiveMerchant Test Purchase", authorization.params["description"] assert_equal "wow@example.com", authorization.params["metadata"]["email"] assert capture = @gateway.capture(@amount, authorization.authorization) assert_success capture end def test_authorization_and_void assert authorization = @gateway.authorize(@amount, @credit_card, @options) assert_success authorization refute authorization.params["captured"] assert void = @gateway.void(authorization.authorization) assert_success void end def test_successful_void assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response.authorization assert void = @gateway.void(response.authorization) assert_success void end def test_unsuccessful_void assert void = @gateway.void("active_merchant_fake_charge") assert_failure void assert_match %r{active_merchant_fake_charge}, void.message end def test_successful_refund assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert response.authorization assert refund = @gateway.refund(@amount - 20, response.authorization) refund_id = refund.params["id"] assert_equal refund.authorization, refund_id assert_success refund end def test_refund_with_reverse_transfer destination = fixtures(:stripe_destination)[:stripe_user_id] assert response = @gateway.purchase(@amount, @credit_card, @options.merge(destination: destination)) assert_success response assert refund = @gateway.refund(@amount - 20, response.authorization, reverse_transfer: true) assert_success refund assert_equal "Transaction approved", refund.message end def test_unsuccessful_refund assert refund = @gateway.refund(@amount, "active_merchant_fake_charge") assert_failure refund assert_match %r{active_merchant_fake_charge}, refund.message end def test_successful_verify assert response = @gateway.verify(@credit_card, @options) assert_success response assert_equal "Transaction approved", response.message assert_equal "wow@example.com", response.params["metadata"]["email"] assert_equal "charge", response.params["object"] assert_success response.responses.last, "The void should succeed" assert_equal "refund", response.responses.last.params["object"] end def test_unsuccessful_verify assert response = @gateway.verify(@declined_card, @options) assert_failure response assert_match %r{Your card was declined}, response.message end def test_successful_store assert response = @gateway.store(@credit_card, description: "TheDescription", email: "email@example.com") assert_success response assert_equal "customer", response.params["object"] assert_equal "TheDescription", response.params["description"] assert_equal "email@example.com", response.params["email"] first_card = response.params["sources"]["data"].first assert_equal response.params["default_source"], first_card["id"] assert_equal @credit_card.last_digits, first_card["last4"] end def test_successful_store_with_validate_false assert response = @gateway.store(@credit_card, validate: false) assert_success response assert_equal "customer", response.params["object"] end def test_successful_store_with_existing_customer assert response = @gateway.store(@credit_card) assert_success response assert response = @gateway.store(@new_credit_card, customer: response.params['id'], email: "email@example.com", description: "TheDesc") assert_success response assert_equal 2, response.responses.size card_response = response.responses[0] assert_equal "card", card_response.params["object"] assert_equal @new_credit_card.last_digits, card_response.params["last4"] customer_response = response.responses[1] assert_equal "customer", customer_response.params["object"] assert_equal "TheDesc", customer_response.params["description"] assert_equal "email@example.com", customer_response.params["email"] assert_equal 2, customer_response.params["sources"]["total_count"] end def test_successful_purchase_using_stored_card assert store = @gateway.store(@credit_card) assert_success store assert response = @gateway.purchase(@amount, store.authorization) assert_success response assert_equal "Transaction approved", response.message assert response.params["paid"] assert_equal "4242", response.params["source"]["last4"] end def test_successful_purchase_using_stored_card_on_existing_customer assert first_store_response = @gateway.store(@credit_card) assert_success first_store_response assert second_store_response = @gateway.store(@new_credit_card, customer: first_store_response.params['id']) assert_success second_store_response assert response = @gateway.purchase(@amount, second_store_response.authorization) assert_success response assert_equal "5100", response.params["source"]["last4"] end def test_successful_purchase_using_stored_card_and_deprecated_api assert store = @gateway.store(@credit_card) assert_success store recharge_options = @options.merge(:customer => store.params["id"]) assert_deprecation_warning do response = @gateway.purchase(@amount, nil, recharge_options) assert_success response assert_equal "4242", response.params["source"]["last4"] end end def test_successful_unstore creation = @gateway.store(@credit_card, {:description => "Active Merchant Unstore Customer"}) card_id = creation.params['sources']['data'].first['id'] assert response = @gateway.unstore(creation.authorization) assert_success response assert_equal card_id, response.params['id'] assert_equal true, response.params['deleted'] assert_equal "Transaction approved", response.message end def test_successful_unstore_using_deprecated_api creation = @gateway.store(@credit_card, {:description => "Active Merchant Unstore Customer"}) card_id = creation.params['sources']['data'].first['id'] customer_id = creation.params["id"] assert_deprecation_warning do response = @gateway.unstore(customer_id, card_id) assert_success response assert_equal true, response.params['deleted'] end end def test_invalid_login gateway = StripeGateway.new(:login => 'active_merchant_test') assert response = gateway.purchase(@amount, @credit_card, @options) assert_failure response assert_match "Invalid API Key provided", response.message end def test_card_present_purchase @credit_card.track_data = '%B378282246310005^LONGSON/LONGBOB^1705101130504392?' assert response = @gateway.purchase(@amount, @credit_card, @options) assert_success response assert_equal "charge", response.params["object"] assert response.params["paid"] end def test_card_present_authorize_and_capture @credit_card.track_data = '%B378282246310005^LONGSON/LONGBOB^1705101130504392?' assert authorization = @gateway.authorize(@amount, @credit_card, @options) assert_success authorization refute authorization.params["captured"] assert capture = @gateway.capture(@amount, authorization.authorization) assert_success capture end def test_creditcard_purchase_with_customer assert response = @gateway.purchase(@amount, @credit_card, @options.merge(:customer => '1234')) assert_success response assert_equal "charge", response.params["object"] assert response.params["paid"] end def test_expanding_objects assert response = @gateway.purchase(@amount, @credit_card, @options.merge(:expand => 'balance_transaction')) assert_success response assert response.params['balance_transaction'].is_a?(Hash) assert_equal 'balance_transaction', response.params['balance_transaction']['object'] end def test_successful_update creation = @gateway.store(@credit_card, {:description => "Active Merchant Update Credit Card"}) customer_id = creation.params['id'] card_id = creation.params['sources']['data'].first['id'] assert response = @gateway.update(customer_id, card_id, { :name => "John Doe", :address_line1 => "123 Main Street", :address_city => "Pleasantville", :address_state => "NY", :address_zip => "12345", :exp_year => Time.now.year + 2, :exp_month => 6 }) assert_success response assert_equal "John Doe", response.params["name"] assert_equal "123 Main Street", response.params["address_line1"] assert_equal "Pleasantville", response.params["address_city"] assert_equal "NY", response.params["address_state"] assert_equal "12345", response.params["address_zip"] assert_equal Time.now.year + 2, response.params["exp_year"] assert_equal 6, response.params["exp_month"] end def test_incorrect_number_for_purchase card = credit_card('4242424242424241') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:incorrect_number], response.error_code end def test_invalid_number_for_purchase card = credit_card('-1') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:invalid_number], response.error_code end def test_invalid_expiry_month_for_purchase card = credit_card('4242424242424242', month: 16) assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:invalid_expiry_date], response.error_code end def test_invalid_expiry_year_for_purchase card = credit_card('4242424242424242', year: 'xx') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:invalid_expiry_date], response.error_code end def test_expired_card_for_purchase card = credit_card('4000000000000069') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:expired_card], response.error_code end def test_invalid_cvc_for_purchase card = credit_card('4242424242424242', verification_value: -1) assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:invalid_cvc], response.error_code end def test_incorrect_cvc_for_purchase card = credit_card('4000000000000127') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:incorrect_cvc], response.error_code end def test_processing_error card = credit_card('4000000000000119') assert response = @gateway.purchase(@amount, card, @options) assert_failure response assert_match Gateway::STANDARD_ERROR_CODE[:processing_error], response.error_code end def test_statement_description assert response = @gateway.purchase(@amount, @credit_card, statement_description: "Eggcellent Description") assert_success response assert_equal "Eggcellent Description", response.params["statement_descriptor"] end end
hps/active_merchant
test/remote/gateways/remote_stripe_test.rb
Ruby
mit
14,185
// // CTimeHierarchy.h // CMIDI // // Created by CHARLES GILLINGHAM on 9/8/15. // Copyright (c) 2015 CharlesGillingham. All rights reserved. // #import <Foundation/Foundation.h> #import "CTime.h" @interface CTimeHierarchy : NSObject <NSCopying, NSCoding> @property (readonly) NSArray * branchCounts; // Not needed. - (NSUInteger) depth; // Number of timeLines - (NSUInteger) maxTimeLine; // Highest timeLine - (id) initWithBranchCounts: (NSArray *) branchCounts offsets: (NSArray *) offsets NS_DESIGNATED_INITIALIZER; - (id) initWithBranchCounts: (NSArray *) branchCounts; // ----------------------------------------------------------------------------- #pragma mark Time Conversions // ----------------------------------------------------------------------------- // Convert times between representations on various levels // Note that time conversions to higher time lines are not typically reversible: details are lost. - (CTime) AsPerB: (CTimeLine) timeLineA : (CTimeLine) timeLineB; - (CTime) convertTime: (CTime) time from: (CTimeLine) timeLineA to: (CTimeLine) timeLineB; // ----------------------------------------------------------------------------- #pragma mark Time Signal // ----------------------------------------------------------------------------- // Time signals // A time signal is like an odometer, e.g // @[bars, beat since bar started, 8ths since beat started, ticks since 8th, nanoseconds since tick] // Or, similarly // @[week, day of week, hour of day, minute of hour, second in minute, nanonsecond in second] - (NSArray *) timeSignalForTime: (CTime) time timeLine: (CTimeLine) timeLine; - (CTime) timeOnTimeLine: (CTimeLine) timeLine fromTimeSignal: (NSArray *) timeSignal; // ----------------------------------------------------------------------------- #pragma mark Time strength // ----------------------------------------------------------------------------- // A measure of the "importance" of a moment in time. E.g. time strength on a bar line is higher than that of an an upbeat eighth. // If the timeStrength = S, then all relative times at levels L < S will be 0. // If you retreive a time at level L, then the time strength S will be greater than or equal to L. - (NSUInteger) timeStrengthOfTime: (CTime) time timeLine: (CTimeLine) timeLine; // ----------------------------------------------------------------------------- #pragma mark Change branch count // ----------------------------------------------------------------------------- // Do not use these routines if the time hierarchy is part of a time map. Make changes to branch counts using the time map. // Set the branch count, and reset the offsets so that [self timeAtLevel: outLevel withTime: B atLevel: levelA+1] is stays the same for all "outLevels". Used by the time map adding meter/tempo changes to a time map at time B -- the total times at B will stay exactly the same, regardless if retrieve them from the previous hierarchy or the following hierarchy. - (void) setBranchCount: (CTime) AsPerB atLevel: (CTimeLine) levelA withTimeFixedAt: (CTime) B; // Where levelB = levelA+1 // Set the branch count directly. Used by the time map for setting branch count changes for time period 0. - (void) setBranchCount: (CTime) AsPerB atLevel: (CTimeLine) levelA; @end
CharlesGillingham/CMusic
CMusic/Headers/CTimeHierarchy.h
C
mit
3,410
<?php namespace AdButler; /** * @property-read int id * @property-read string object * @property-read string self * @property-read string created_date * @property-read string|null last_modified * @property string name * @property int width * @property int height * @property string network * @property array parameters */ class S2SBanner extends SingleResource { protected static $type = 's2s_banner'; protected static $url = 'banners/s2s'; /* * Overridden Methods * ================== */ /** * @param array $bodyParams * @param array $queryParams * * @return S2SBanner * @throws Error\APIConnectionError * @throws Error\APIError * @throws Error\InvalidAPIKeyError * @throws Error\InvalidAccountError * @throws Error\InvalidRequestError * @throws Error\InvalidRequestParametersError * @throws Error\InvalidResourceError * @throws Error\JSONDecodingError * @throws Error\JSONEncodingError * @throws Error\MethodNotSupportedError * @throws Error\MissingResponseError * @throws Error\ResourceCreateError * @throws Error\ResourceNotFoundError * @throws Error\UndefinedAPIKeyError * @throws Error\UndefinedRequestParametersError * @throws Error\UndefinedResponseError * @throws \Exception */ public static function create($bodyParams = array(), $queryParams = array()) { return parent::create($bodyParams, $queryParams); } /** * @param int $id * @param array $queryParams * * @return S2SBanner * @throws Error\APIConnectionError * @throws Error\APIError * @throws Error\InvalidAPIKeyError * @throws Error\InvalidAccountError * @throws Error\InvalidRequestError * @throws Error\InvalidRequestParametersError * @throws Error\InvalidResourceError * @throws Error\JSONDecodingError * @throws Error\JSONEncodingError * @throws Error\MethodNotSupportedError * @throws Error\MissingResponseError * @throws Error\ResourceCreateError * @throws Error\ResourceNotFoundError * @throws Error\UndefinedAPIKeyError * @throws Error\UndefinedRequestParametersError * @throws Error\UndefinedResponseError * @throws \Exception */ public static function retrieve($id, $queryParams = array()) { return parent::retrieve($id, $queryParams); } /** * @param array $bodyParams * * @return S2SBanner */ public function update($bodyParams = array()) { return parent::update($bodyParams); } /** * @param array $queryParams * * @return S2SBanner * @throws Error\APIConnectionError * @throws Error\APIError * @throws Error\InvalidAPIKeyError * @throws Error\InvalidAccountError * @throws Error\InvalidRequestError * @throws Error\InvalidRequestParametersError * @throws Error\InvalidResourceError * @throws Error\JSONDecodingError * @throws Error\JSONEncodingError * @throws Error\MethodNotSupportedError * @throws Error\MissingResponseError * @throws Error\ResourceCreateError * @throws Error\ResourceNotFoundError * @throws Error\UndefinedAPIKeyError * @throws Error\UndefinedRequestParametersError * @throws Error\UndefinedResponseError * @throws \Exception */ public function save($queryParams = array()) { return parent::save($queryParams); } /** * @param array $queryParams * * @return bool * @throws Error\APIConnectionError * @throws Error\APIError * @throws Error\InvalidAPIKeyError * @throws Error\InvalidAccountError * @throws Error\InvalidRequestError * @throws Error\InvalidRequestParametersError * @throws Error\InvalidResourceError * @throws Error\JSONDecodingError * @throws Error\JSONEncodingError * @throws Error\MethodNotSupportedError * @throws Error\MissingResponseError * @throws Error\ResourceCreateError * @throws Error\ResourceNotFoundError * @throws Error\UndefinedAPIKeyError * @throws Error\UndefinedRequestParametersError * @throws Error\UndefinedResponseError * @throws \Exception */ public function delete($queryParams = array()) { return parent::delete($queryParams); } /** * @param array $queryParams * * @return Collection|array * @throws Error\APIConnectionError * @throws Error\APIError * @throws Error\InvalidAPIKeyError * @throws Error\InvalidAccountError * @throws Error\InvalidRequestError * @throws Error\InvalidRequestParametersError * @throws Error\InvalidResourceError * @throws Error\JSONDecodingError * @throws Error\JSONEncodingError * @throws Error\MethodNotSupportedError * @throws Error\MissingResponseError * @throws Error\ResourceCreateError * @throws Error\ResourceNotFoundError * @throws Error\UndefinedAPIKeyError * @throws Error\UndefinedRequestParametersError * @throws Error\UndefinedResponseError * @throws \Exception */ public static function retrieveAll($queryParams = array()) { return parent::retrieveAll($queryParams); } /* * Resource specific methods * ========================= */ }
sparklit/adbutler-php
lib/Resource/S2SBanner.php
PHP
mit
5,419
'use strict'; let path = require('path'); let defaultSettings = require('./defaults'); // Additional npm or bower modules to include in builds // Add all foreign plugins you may need into this array // @example: // let npmBase = path.join(__dirname, '../node_modules'); // let additionalPaths = [ path.join(npmBase, 'react-bootstrap') ]; const npmBase = path.join(__dirname, '../node_modules'); const additionalPaths = [ path.join(npmBase, 'pouch-redux-middleware')]; module.exports = { additionalPaths: additionalPaths, port: defaultSettings.port, debug: true, devtool: 'eval', output: { path: path.join(__dirname, '/../dist/assets'), filename: 'app.js', publicPath: defaultSettings.publicPath }, devServer: { contentBase: './src/', historyApiFallback: true, hot: true, port: defaultSettings.port, publicPath: defaultSettings.publicPath, noInfo: false }, resolve: { extensions: ['', '.js', '.jsx'], alias: { actions: `${defaultSettings.srcPath}/actions/`, components: `${defaultSettings.srcPath}/components/`, sources: `${defaultSettings.srcPath}/sources/`, stores: `${defaultSettings.srcPath}/stores/`, styles: `${defaultSettings.srcPath}/styles/`, config: `${defaultSettings.srcPath}/config/` + process.env.REACT_WEBPACK_ENV } }, module: {} };
C3-TKO/gaiyo
cfg/base.js
JavaScript
mit
1,355
{ "name": "Chillin.js", "url": "https://github.com/frantzmiccoli/Chillin.js.git" }
jduncanator/components
packages/c/Chillin.js
JavaScript
mit
87
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // <auto-generated/> #nullable disable using System.Collections.Generic; using System.Text.Json; using Azure.Core; namespace Azure.Search.Documents.Indexes.Models { public partial class CustomEntityLookupSkill : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); if (Optional.IsDefined(DefaultLanguageCode)) { if (DefaultLanguageCode != null) { writer.WritePropertyName("defaultLanguageCode"); writer.WriteStringValue(DefaultLanguageCode.Value.ToString()); } else { writer.WriteNull("defaultLanguageCode"); } } if (Optional.IsDefined(EntitiesDefinitionUri)) { if (EntitiesDefinitionUri != null) { writer.WritePropertyName("entitiesDefinitionUri"); writer.WriteStringValue(EntitiesDefinitionUri); } else { writer.WriteNull("entitiesDefinitionUri"); } } if (Optional.IsCollectionDefined(InlineEntitiesDefinition)) { if (InlineEntitiesDefinition != null) { writer.WritePropertyName("inlineEntitiesDefinition"); writer.WriteStartArray(); foreach (var item in InlineEntitiesDefinition) { writer.WriteObjectValue(item); } writer.WriteEndArray(); } else { writer.WriteNull("inlineEntitiesDefinition"); } } if (Optional.IsDefined(GlobalDefaultCaseSensitive)) { if (GlobalDefaultCaseSensitive != null) { writer.WritePropertyName("globalDefaultCaseSensitive"); writer.WriteBooleanValue(GlobalDefaultCaseSensitive.Value); } else { writer.WriteNull("globalDefaultCaseSensitive"); } } if (Optional.IsDefined(GlobalDefaultAccentSensitive)) { if (GlobalDefaultAccentSensitive != null) { writer.WritePropertyName("globalDefaultAccentSensitive"); writer.WriteBooleanValue(GlobalDefaultAccentSensitive.Value); } else { writer.WriteNull("globalDefaultAccentSensitive"); } } if (Optional.IsDefined(GlobalDefaultFuzzyEditDistance)) { if (GlobalDefaultFuzzyEditDistance != null) { writer.WritePropertyName("globalDefaultFuzzyEditDistance"); writer.WriteNumberValue(GlobalDefaultFuzzyEditDistance.Value); } else { writer.WriteNull("globalDefaultFuzzyEditDistance"); } } writer.WritePropertyName("@odata.type"); writer.WriteStringValue(ODataType); if (Optional.IsDefined(Name)) { writer.WritePropertyName("name"); writer.WriteStringValue(Name); } if (Optional.IsDefined(Description)) { writer.WritePropertyName("description"); writer.WriteStringValue(Description); } if (Optional.IsDefined(Context)) { writer.WritePropertyName("context"); writer.WriteStringValue(Context); } writer.WritePropertyName("inputs"); writer.WriteStartArray(); foreach (var item in Inputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); writer.WritePropertyName("outputs"); writer.WriteStartArray(); foreach (var item in Outputs) { writer.WriteObjectValue(item); } writer.WriteEndArray(); writer.WriteEndObject(); } internal static CustomEntityLookupSkill DeserializeCustomEntityLookupSkill(JsonElement element) { Optional<CustomEntityLookupSkillLanguage?> defaultLanguageCode = default; Optional<string> entitiesDefinitionUri = default; Optional<IList<CustomEntity>> inlineEntitiesDefinition = default; Optional<bool?> globalDefaultCaseSensitive = default; Optional<bool?> globalDefaultAccentSensitive = default; Optional<int?> globalDefaultFuzzyEditDistance = default; string odataType = default; Optional<string> name = default; Optional<string> description = default; Optional<string> context = default; IList<InputFieldMappingEntry> inputs = default; IList<OutputFieldMappingEntry> outputs = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("defaultLanguageCode")) { if (property.Value.ValueKind == JsonValueKind.Null) { defaultLanguageCode = null; continue; } defaultLanguageCode = new CustomEntityLookupSkillLanguage(property.Value.GetString()); continue; } if (property.NameEquals("entitiesDefinitionUri")) { if (property.Value.ValueKind == JsonValueKind.Null) { entitiesDefinitionUri = null; continue; } entitiesDefinitionUri = property.Value.GetString(); continue; } if (property.NameEquals("inlineEntitiesDefinition")) { if (property.Value.ValueKind == JsonValueKind.Null) { inlineEntitiesDefinition = null; continue; } List<CustomEntity> array = new List<CustomEntity>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(CustomEntity.DeserializeCustomEntity(item)); } inlineEntitiesDefinition = array; continue; } if (property.NameEquals("globalDefaultCaseSensitive")) { if (property.Value.ValueKind == JsonValueKind.Null) { globalDefaultCaseSensitive = null; continue; } globalDefaultCaseSensitive = property.Value.GetBoolean(); continue; } if (property.NameEquals("globalDefaultAccentSensitive")) { if (property.Value.ValueKind == JsonValueKind.Null) { globalDefaultAccentSensitive = null; continue; } globalDefaultAccentSensitive = property.Value.GetBoolean(); continue; } if (property.NameEquals("globalDefaultFuzzyEditDistance")) { if (property.Value.ValueKind == JsonValueKind.Null) { globalDefaultFuzzyEditDistance = null; continue; } globalDefaultFuzzyEditDistance = property.Value.GetInt32(); continue; } if (property.NameEquals("@odata.type")) { odataType = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("description")) { description = property.Value.GetString(); continue; } if (property.NameEquals("context")) { context = property.Value.GetString(); continue; } if (property.NameEquals("inputs")) { List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item)); } inputs = array; continue; } if (property.NameEquals("outputs")) { List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item)); } outputs = array; continue; } } return new CustomEntityLookupSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, Optional.ToNullable(defaultLanguageCode), entitiesDefinitionUri.Value, Optional.ToList(inlineEntitiesDefinition), Optional.ToNullable(globalDefaultCaseSensitive), Optional.ToNullable(globalDefaultAccentSensitive), Optional.ToNullable(globalDefaultFuzzyEditDistance)); } } }
ayeletshpigelman/azure-sdk-for-net
sdk/search/Azure.Search.Documents/src/Generated/Models/CustomEntityLookupSkill.Serialization.cs
C#
mit
10,349
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2016.06.14 at 11:32:33 AM EDT // package edu.cornell.gobii.gdi.main; import java.io.File; import java.io.IOException; import java.io.StringWriter; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.apache.commons.io.FileUtils; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="crop" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="user"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="user_id" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="user_name" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="user_fullname" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="user_email" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;element name="configDir" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="logFile" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="server" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "crop", "user", "configDir", "logFile", "server" }) @XmlRootElement(name = "App") public class App { public static App INSTANCE = new App(); @XmlElement(required = true) protected String crop; @XmlElement(required = true) protected App.User user; @XmlElement(required = true) protected String configDir; @XmlElement(required = true) protected String logFile; @XmlElement(required = true) protected String server; /** * Gets the value of the crop property. * * @return * possible object is * {@link String } * */ public String getCrop() { return crop; } /** * Sets the value of the crop property. * * @param value * allowed object is * {@link String } * */ public void setCrop(String value) { this.crop = value; } /** * Gets the value of the user property. * * @return * possible object is * {@link App.User } * */ public App.User getUser() { return user; } /** * Sets the value of the user property. * * @param value * allowed object is * {@link App.User } * */ public void setUser(App.User value) { this.user = value; } /** * Gets the value of the configDir property. * * @return * possible object is * {@link String } * */ public String getConfigDir() { return configDir; } /** * Sets the value of the configDir property. * * @param value * allowed object is * {@link String } * */ public void setConfigDir(String value) { this.configDir = value; } /** * Gets the value of the logFile property. * * @return * possible object is * {@link String } * */ public String getLogFile() { return logFile; } /** * Sets the value of the logFile property. * * @param value * allowed object is * {@link String } * */ public void setLogFile(String value) { this.logFile = value; } /** * Gets the value of the server property. * * @return * possible object is * {@link String } * */ public String getServer() { return server; } /** * Sets the value of the server property. * * @param value * allowed object is * {@link String } * */ public void setServer(String value) { this.server = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="user_id" type="{http://www.w3.org/2001/XMLSchema}int"/> * &lt;element name="user_name" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="user_fullname" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;element name="user_email" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "userId", "userName", "userFullname", "userEmail" }) public static class User { @XmlElement(name = "user_id") protected int userId; @XmlElement(name = "user_name", required = true) protected String userName; @XmlElement(name = "user_fullname", required = true) protected String userFullname; @XmlElement(name = "user_email", required = true) protected String userEmail; /** * Gets the value of the userId property. * */ public int getUserId() { return userId; } /** * Sets the value of the userId property. * */ public void setUserId(int value) { this.userId = value; } /** * Gets the value of the userName property. * * @return * possible object is * {@link String } * */ public String getUserName() { return userName; } /** * Sets the value of the userName property. * * @param value * allowed object is * {@link String } * */ public void setUserName(String value) { this.userName = value; } /** * Gets the value of the userFullname property. * * @return * possible object is * {@link String } * */ public String getUserFullname() { return userFullname; } /** * Sets the value of the userFullname property. * * @param value * allowed object is * {@link String } * */ public void setUserFullname(String value) { this.userFullname = value; } /** * Gets the value of the userEmail property. * * @return * possible object is * {@link String } * */ public String getUserEmail() { return userEmail; } /** * Sets the value of the userEmail property. * * @param value * allowed object is * {@link String } * */ public void setUserEmail(String value) { this.userEmail = value; } public boolean isValid(){ if(userName == null || userName.isEmpty()) return false; if(userFullname == null || userFullname.isEmpty()) return false; if(userEmail == null || userEmail.isEmpty()) return false; return true; } } public App(){} public boolean isValid(){ if(user == null) return false; if(!user.isValid()) return false; if(crop == null || crop.isEmpty()) return false; if(logFile == null || logFile.isEmpty()) return false; if(configDir == null || configDir.isEmpty()) return false; if(server == null) return false; return true; } public void load(String xml){ File xmlFile = new File(xml); if(!xmlFile.exists()) return; try{ JAXBContext jc = JAXBContext.newInstance(App.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); INSTANCE = (App) unmarshaller.unmarshal(xmlFile); }catch (JAXBException e) { e.printStackTrace(); } } public void save(){ try { StringWriter writer = new StringWriter(); JAXBContext context = JAXBContext.newInstance(App.class); Marshaller m = context.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); m.marshal(INSTANCE, writer); FileUtils.writeStringToFile(new File(configDir+"/App.xml"), writer.toString()); } catch (JAXBException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
gobiiproject/GOBii-System
loaderui/distribution/config/generated/App.20160616.java
Java
mit
10,196
# conda-peachpy This package is a conda-ed ``PeachPy``. One can install ``PeachPy`` with anaconda by ``` conda build opcodes peachpy --python 27 conda install peachy ```
GaZ3ll3/conda-peachpy-recipe
README.md
Markdown
mit
176
# JSON Web Token / AngularJS / Spring Boot example [Blog post on this subject](http://niels.nu/blog/2015/json-web-tokens.html) This is an example project where a Spring REST API is secured using JSON Web Tokens. Since there are relatively few examples available for Java and there are some pitfalls (such as most sources pointing to a Java lib that's not straightforward to use) I decided to extract my proof of concept into a stand-alone example and publish it for all to see. ## JSON Web Tokens JSON Web Tokens have a few benefits over just sending a 'regular' token over the line. The more common approach to securing a REST API (outside of normal HTTP Basic Auth) is to send a random string as a token on succesful login from the server to the client. The client then sends this token on every request, and the server does an internal lookup on that token (in for example a REDIS cache or a simple Hashtable) to retrieve the corresponding user data. With JSON Web Tokens the latter part isn't needed: the token itself contains a representation of the 'claims' of client: this can be just a username, but can also be extended to include any data you wish. This token is transmitted from the client on every request. The contents of the token are encrypted and a hash is added to prevent tampering: this way the content is secure: the server is the one signing and encrypting the token and is also the only one who had the key needed to decrypt the token. In this example this key is fixed ("secretkey") but in a real life situations the secret key would simply be an array of bytes randomly generated on application startup. This has the added benefit that any tokens get automatically invalidated when you restart the service. If this behaviour is undesired you can persist the keys in for example REDIS. ## Server side: Spring Boot I like using Spring (Boot) to create RESTful services. On the server side, the JWT signing is done in the user/login REST call in UserController. It contains a tiny 'database' of 2 users, one of which has the 'admin' rights. The verification is done in a Filter (JwtFilter): it filters every request that matches "/api/*". If a correct token isn't found an exception is thrown. If a correct token is found, the claims object is added to the Http Request object and can be used in any REST endpoint (as shown in ApiController). The heavy lifting for JWT signing is done by the more than excellent [Java JWT](https://github.com/jwtk/jjwt) library. ## Client Side: AngularJS The simple Angular app shows a login page. On successful login it checks with 'the API' which roles are available (of which the 'foo' role doesn't exist for any user). ## Running It is a standard Maven project and can be imported into your favorite IDE. You run the example by starting the WebApplication class (it has a main) and navigating to http://localhost:8080/. If everything is correct you should see a "Welcome to the JSON Web Token / AngularJR / Spring example!" message and a login form.
akimirka/gnr_back
README.md
Markdown
mit
3,022
{% extends 'cdc/base.html' %} {% load staticfiles %} {% block content %} <div id="contact"> <form action="{% url 'cdc:form' %}" method="post"> <p>Comments:</p><p>{{ form.text }}</p> <p>Your name: {{ form.postedby}}</p> <p>Email: {{ form.email }}</p> <input type="submit" value="Submit"> </form><br/> </div> {% endblock %}
ISEAGE-ISU/cdc2-2015-www
cdc/templates/cdc/form.html
HTML
mit
362
package io.sponges.bot.api.entities.channel; import io.sponges.bot.api.entities.User; import java.util.Map; public interface GroupChannel extends Channel { Map<String, User> getUsers(); boolean isUser(String id); User getUser(String id); }
SpongyBot/ModuleAPI
src/main/java/io/sponges/bot/api/entities/channel/GroupChannel.java
Java
mit
259
/**************************************************************************//** * @file efr32fg1p_i2c.h * @brief EFR32FG1P_I2C register and bit field definitions * @version 5.4.0 ****************************************************************************** * # License * <b>Copyright 2017 Silicon Laboratories, Inc. www.silabs.com</b> ****************************************************************************** * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software.@n * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software.@n * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Laboratories, Inc. * has no obligation to support this Software. Silicon Laboratories, Inc. is * providing the Software "AS IS", with no express or implied warranties of any * kind, including, but not limited to, any implied warranties of * merchantability or fitness for any particular purpose or warranties against * infringement of any proprietary rights of a third party. * * Silicon Laboratories, Inc. will not be liable for any consequential, * incidental, or special damages, or any other relief, or for any claim by * any third party, arising from your use of this Software. * *****************************************************************************/ #ifdef __cplusplus extern "C" { #endif #if defined(__ICCARM__) #pragma system_include /* Treat file as system include file. */ #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #pragma clang system_header /* Treat file as system include file. */ #endif /**************************************************************************//** * @addtogroup Parts * @{ ******************************************************************************/ /**************************************************************************//** * @defgroup EFR32FG1P_I2C I2C * @{ * @brief EFR32FG1P_I2C Register Declaration *****************************************************************************/ /** I2C Register Declaration */ typedef struct { __IOM uint32_t CTRL; /**< Control Register */ __IOM uint32_t CMD; /**< Command Register */ __IM uint32_t STATE; /**< State Register */ __IM uint32_t STATUS; /**< Status Register */ __IOM uint32_t CLKDIV; /**< Clock Division Register */ __IOM uint32_t SADDR; /**< Slave Address Register */ __IOM uint32_t SADDRMASK; /**< Slave Address Mask Register */ __IM uint32_t RXDATA; /**< Receive Buffer Data Register */ __IM uint32_t RXDOUBLE; /**< Receive Buffer Double Data Register */ __IM uint32_t RXDATAP; /**< Receive Buffer Data Peek Register */ __IM uint32_t RXDOUBLEP; /**< Receive Buffer Double Data Peek Register */ __IOM uint32_t TXDATA; /**< Transmit Buffer Data Register */ __IOM uint32_t TXDOUBLE; /**< Transmit Buffer Double Data Register */ __IM uint32_t IF; /**< Interrupt Flag Register */ __IOM uint32_t IFS; /**< Interrupt Flag Set Register */ __IOM uint32_t IFC; /**< Interrupt Flag Clear Register */ __IOM uint32_t IEN; /**< Interrupt Enable Register */ __IOM uint32_t ROUTEPEN; /**< I/O Routing Pin Enable Register */ __IOM uint32_t ROUTELOC0; /**< I/O Routing Location Register */ } I2C_TypeDef; /** @} */ /**************************************************************************//** * @addtogroup EFR32FG1P_I2C * @{ * @defgroup EFR32FG1P_I2C_BitFields I2C Bit Fields * @{ *****************************************************************************/ /* Bit fields for I2C CTRL */ #define _I2C_CTRL_RESETVALUE 0x00000000UL /**< Default value for I2C_CTRL */ #define _I2C_CTRL_MASK 0x0007B3FFUL /**< Mask for I2C_CTRL */ #define I2C_CTRL_EN (0x1UL << 0) /**< I2C Enable */ #define _I2C_CTRL_EN_SHIFT 0 /**< Shift value for I2C_EN */ #define _I2C_CTRL_EN_MASK 0x1UL /**< Bit mask for I2C_EN */ #define _I2C_CTRL_EN_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_EN_DEFAULT (_I2C_CTRL_EN_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_SLAVE (0x1UL << 1) /**< Addressable as Slave */ #define _I2C_CTRL_SLAVE_SHIFT 1 /**< Shift value for I2C_SLAVE */ #define _I2C_CTRL_SLAVE_MASK 0x2UL /**< Bit mask for I2C_SLAVE */ #define _I2C_CTRL_SLAVE_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_SLAVE_DEFAULT (_I2C_CTRL_SLAVE_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOACK (0x1UL << 2) /**< Automatic Acknowledge */ #define _I2C_CTRL_AUTOACK_SHIFT 2 /**< Shift value for I2C_AUTOACK */ #define _I2C_CTRL_AUTOACK_MASK 0x4UL /**< Bit mask for I2C_AUTOACK */ #define _I2C_CTRL_AUTOACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOACK_DEFAULT (_I2C_CTRL_AUTOACK_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOSE (0x1UL << 3) /**< Automatic STOP When Empty */ #define _I2C_CTRL_AUTOSE_SHIFT 3 /**< Shift value for I2C_AUTOSE */ #define _I2C_CTRL_AUTOSE_MASK 0x8UL /**< Bit mask for I2C_AUTOSE */ #define _I2C_CTRL_AUTOSE_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOSE_DEFAULT (_I2C_CTRL_AUTOSE_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOSN (0x1UL << 4) /**< Automatic STOP on NACK */ #define _I2C_CTRL_AUTOSN_SHIFT 4 /**< Shift value for I2C_AUTOSN */ #define _I2C_CTRL_AUTOSN_MASK 0x10UL /**< Bit mask for I2C_AUTOSN */ #define _I2C_CTRL_AUTOSN_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_AUTOSN_DEFAULT (_I2C_CTRL_AUTOSN_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_ARBDIS (0x1UL << 5) /**< Arbitration Disable */ #define _I2C_CTRL_ARBDIS_SHIFT 5 /**< Shift value for I2C_ARBDIS */ #define _I2C_CTRL_ARBDIS_MASK 0x20UL /**< Bit mask for I2C_ARBDIS */ #define _I2C_CTRL_ARBDIS_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_ARBDIS_DEFAULT (_I2C_CTRL_ARBDIS_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_GCAMEN (0x1UL << 6) /**< General Call Address Match Enable */ #define _I2C_CTRL_GCAMEN_SHIFT 6 /**< Shift value for I2C_GCAMEN */ #define _I2C_CTRL_GCAMEN_MASK 0x40UL /**< Bit mask for I2C_GCAMEN */ #define _I2C_CTRL_GCAMEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_GCAMEN_DEFAULT (_I2C_CTRL_GCAMEN_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_TXBIL (0x1UL << 7) /**< TX Buffer Interrupt Level */ #define _I2C_CTRL_TXBIL_SHIFT 7 /**< Shift value for I2C_TXBIL */ #define _I2C_CTRL_TXBIL_MASK 0x80UL /**< Bit mask for I2C_TXBIL */ #define _I2C_CTRL_TXBIL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define _I2C_CTRL_TXBIL_EMPTY 0x00000000UL /**< Mode EMPTY for I2C_CTRL */ #define _I2C_CTRL_TXBIL_HALFFULL 0x00000001UL /**< Mode HALFFULL for I2C_CTRL */ #define I2C_CTRL_TXBIL_DEFAULT (_I2C_CTRL_TXBIL_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_TXBIL_EMPTY (_I2C_CTRL_TXBIL_EMPTY << 7) /**< Shifted mode EMPTY for I2C_CTRL */ #define I2C_CTRL_TXBIL_HALFFULL (_I2C_CTRL_TXBIL_HALFFULL << 7) /**< Shifted mode HALFFULL for I2C_CTRL */ #define _I2C_CTRL_CLHR_SHIFT 8 /**< Shift value for I2C_CLHR */ #define _I2C_CTRL_CLHR_MASK 0x300UL /**< Bit mask for I2C_CLHR */ #define _I2C_CTRL_CLHR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define _I2C_CTRL_CLHR_STANDARD 0x00000000UL /**< Mode STANDARD for I2C_CTRL */ #define _I2C_CTRL_CLHR_ASYMMETRIC 0x00000001UL /**< Mode ASYMMETRIC for I2C_CTRL */ #define _I2C_CTRL_CLHR_FAST 0x00000002UL /**< Mode FAST for I2C_CTRL */ #define I2C_CTRL_CLHR_DEFAULT (_I2C_CTRL_CLHR_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_CLHR_STANDARD (_I2C_CTRL_CLHR_STANDARD << 8) /**< Shifted mode STANDARD for I2C_CTRL */ #define I2C_CTRL_CLHR_ASYMMETRIC (_I2C_CTRL_CLHR_ASYMMETRIC << 8) /**< Shifted mode ASYMMETRIC for I2C_CTRL */ #define I2C_CTRL_CLHR_FAST (_I2C_CTRL_CLHR_FAST << 8) /**< Shifted mode FAST for I2C_CTRL */ #define _I2C_CTRL_BITO_SHIFT 12 /**< Shift value for I2C_BITO */ #define _I2C_CTRL_BITO_MASK 0x3000UL /**< Bit mask for I2C_BITO */ #define _I2C_CTRL_BITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define _I2C_CTRL_BITO_OFF 0x00000000UL /**< Mode OFF for I2C_CTRL */ #define _I2C_CTRL_BITO_40PCC 0x00000001UL /**< Mode 40PCC for I2C_CTRL */ #define _I2C_CTRL_BITO_80PCC 0x00000002UL /**< Mode 80PCC for I2C_CTRL */ #define _I2C_CTRL_BITO_160PCC 0x00000003UL /**< Mode 160PCC for I2C_CTRL */ #define I2C_CTRL_BITO_DEFAULT (_I2C_CTRL_BITO_DEFAULT << 12) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_BITO_OFF (_I2C_CTRL_BITO_OFF << 12) /**< Shifted mode OFF for I2C_CTRL */ #define I2C_CTRL_BITO_40PCC (_I2C_CTRL_BITO_40PCC << 12) /**< Shifted mode 40PCC for I2C_CTRL */ #define I2C_CTRL_BITO_80PCC (_I2C_CTRL_BITO_80PCC << 12) /**< Shifted mode 80PCC for I2C_CTRL */ #define I2C_CTRL_BITO_160PCC (_I2C_CTRL_BITO_160PCC << 12) /**< Shifted mode 160PCC for I2C_CTRL */ #define I2C_CTRL_GIBITO (0x1UL << 15) /**< Go Idle on Bus Idle Timeout */ #define _I2C_CTRL_GIBITO_SHIFT 15 /**< Shift value for I2C_GIBITO */ #define _I2C_CTRL_GIBITO_MASK 0x8000UL /**< Bit mask for I2C_GIBITO */ #define _I2C_CTRL_GIBITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_GIBITO_DEFAULT (_I2C_CTRL_GIBITO_DEFAULT << 15) /**< Shifted mode DEFAULT for I2C_CTRL */ #define _I2C_CTRL_CLTO_SHIFT 16 /**< Shift value for I2C_CLTO */ #define _I2C_CTRL_CLTO_MASK 0x70000UL /**< Bit mask for I2C_CLTO */ #define _I2C_CTRL_CLTO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CTRL */ #define _I2C_CTRL_CLTO_OFF 0x00000000UL /**< Mode OFF for I2C_CTRL */ #define _I2C_CTRL_CLTO_40PCC 0x00000001UL /**< Mode 40PCC for I2C_CTRL */ #define _I2C_CTRL_CLTO_80PCC 0x00000002UL /**< Mode 80PCC for I2C_CTRL */ #define _I2C_CTRL_CLTO_160PCC 0x00000003UL /**< Mode 160PCC for I2C_CTRL */ #define _I2C_CTRL_CLTO_320PCC 0x00000004UL /**< Mode 320PCC for I2C_CTRL */ #define _I2C_CTRL_CLTO_1024PCC 0x00000005UL /**< Mode 1024PCC for I2C_CTRL */ #define I2C_CTRL_CLTO_DEFAULT (_I2C_CTRL_CLTO_DEFAULT << 16) /**< Shifted mode DEFAULT for I2C_CTRL */ #define I2C_CTRL_CLTO_OFF (_I2C_CTRL_CLTO_OFF << 16) /**< Shifted mode OFF for I2C_CTRL */ #define I2C_CTRL_CLTO_40PCC (_I2C_CTRL_CLTO_40PCC << 16) /**< Shifted mode 40PCC for I2C_CTRL */ #define I2C_CTRL_CLTO_80PCC (_I2C_CTRL_CLTO_80PCC << 16) /**< Shifted mode 80PCC for I2C_CTRL */ #define I2C_CTRL_CLTO_160PCC (_I2C_CTRL_CLTO_160PCC << 16) /**< Shifted mode 160PCC for I2C_CTRL */ #define I2C_CTRL_CLTO_320PCC (_I2C_CTRL_CLTO_320PCC << 16) /**< Shifted mode 320PCC for I2C_CTRL */ #define I2C_CTRL_CLTO_1024PCC (_I2C_CTRL_CLTO_1024PCC << 16) /**< Shifted mode 1024PCC for I2C_CTRL */ /* Bit fields for I2C CMD */ #define _I2C_CMD_RESETVALUE 0x00000000UL /**< Default value for I2C_CMD */ #define _I2C_CMD_MASK 0x000000FFUL /**< Mask for I2C_CMD */ #define I2C_CMD_START (0x1UL << 0) /**< Send Start Condition */ #define _I2C_CMD_START_SHIFT 0 /**< Shift value for I2C_START */ #define _I2C_CMD_START_MASK 0x1UL /**< Bit mask for I2C_START */ #define _I2C_CMD_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_START_DEFAULT (_I2C_CMD_START_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_STOP (0x1UL << 1) /**< Send Stop Condition */ #define _I2C_CMD_STOP_SHIFT 1 /**< Shift value for I2C_STOP */ #define _I2C_CMD_STOP_MASK 0x2UL /**< Bit mask for I2C_STOP */ #define _I2C_CMD_STOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_STOP_DEFAULT (_I2C_CMD_STOP_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_ACK (0x1UL << 2) /**< Send ACK */ #define _I2C_CMD_ACK_SHIFT 2 /**< Shift value for I2C_ACK */ #define _I2C_CMD_ACK_MASK 0x4UL /**< Bit mask for I2C_ACK */ #define _I2C_CMD_ACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_ACK_DEFAULT (_I2C_CMD_ACK_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_NACK (0x1UL << 3) /**< Send NACK */ #define _I2C_CMD_NACK_SHIFT 3 /**< Shift value for I2C_NACK */ #define _I2C_CMD_NACK_MASK 0x8UL /**< Bit mask for I2C_NACK */ #define _I2C_CMD_NACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_NACK_DEFAULT (_I2C_CMD_NACK_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_CONT (0x1UL << 4) /**< Continue Transmission */ #define _I2C_CMD_CONT_SHIFT 4 /**< Shift value for I2C_CONT */ #define _I2C_CMD_CONT_MASK 0x10UL /**< Bit mask for I2C_CONT */ #define _I2C_CMD_CONT_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_CONT_DEFAULT (_I2C_CMD_CONT_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_ABORT (0x1UL << 5) /**< Abort Transmission */ #define _I2C_CMD_ABORT_SHIFT 5 /**< Shift value for I2C_ABORT */ #define _I2C_CMD_ABORT_MASK 0x20UL /**< Bit mask for I2C_ABORT */ #define _I2C_CMD_ABORT_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_ABORT_DEFAULT (_I2C_CMD_ABORT_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_CLEARTX (0x1UL << 6) /**< Clear TX */ #define _I2C_CMD_CLEARTX_SHIFT 6 /**< Shift value for I2C_CLEARTX */ #define _I2C_CMD_CLEARTX_MASK 0x40UL /**< Bit mask for I2C_CLEARTX */ #define _I2C_CMD_CLEARTX_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_CLEARTX_DEFAULT (_I2C_CMD_CLEARTX_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_CMD */ #define I2C_CMD_CLEARPC (0x1UL << 7) /**< Clear Pending Commands */ #define _I2C_CMD_CLEARPC_SHIFT 7 /**< Shift value for I2C_CLEARPC */ #define _I2C_CMD_CLEARPC_MASK 0x80UL /**< Bit mask for I2C_CLEARPC */ #define _I2C_CMD_CLEARPC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CMD */ #define I2C_CMD_CLEARPC_DEFAULT (_I2C_CMD_CLEARPC_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_CMD */ /* Bit fields for I2C STATE */ #define _I2C_STATE_RESETVALUE 0x00000001UL /**< Default value for I2C_STATE */ #define _I2C_STATE_MASK 0x000000FFUL /**< Mask for I2C_STATE */ #define I2C_STATE_BUSY (0x1UL << 0) /**< Bus Busy */ #define _I2C_STATE_BUSY_SHIFT 0 /**< Shift value for I2C_BUSY */ #define _I2C_STATE_BUSY_MASK 0x1UL /**< Bit mask for I2C_BUSY */ #define _I2C_STATE_BUSY_DEFAULT 0x00000001UL /**< Mode DEFAULT for I2C_STATE */ #define I2C_STATE_BUSY_DEFAULT (_I2C_STATE_BUSY_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_STATE */ #define I2C_STATE_MASTER (0x1UL << 1) /**< Master */ #define _I2C_STATE_MASTER_SHIFT 1 /**< Shift value for I2C_MASTER */ #define _I2C_STATE_MASTER_MASK 0x2UL /**< Bit mask for I2C_MASTER */ #define _I2C_STATE_MASTER_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATE */ #define I2C_STATE_MASTER_DEFAULT (_I2C_STATE_MASTER_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_STATE */ #define I2C_STATE_TRANSMITTER (0x1UL << 2) /**< Transmitter */ #define _I2C_STATE_TRANSMITTER_SHIFT 2 /**< Shift value for I2C_TRANSMITTER */ #define _I2C_STATE_TRANSMITTER_MASK 0x4UL /**< Bit mask for I2C_TRANSMITTER */ #define _I2C_STATE_TRANSMITTER_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATE */ #define I2C_STATE_TRANSMITTER_DEFAULT (_I2C_STATE_TRANSMITTER_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_STATE */ #define I2C_STATE_NACKED (0x1UL << 3) /**< Nack Received */ #define _I2C_STATE_NACKED_SHIFT 3 /**< Shift value for I2C_NACKED */ #define _I2C_STATE_NACKED_MASK 0x8UL /**< Bit mask for I2C_NACKED */ #define _I2C_STATE_NACKED_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATE */ #define I2C_STATE_NACKED_DEFAULT (_I2C_STATE_NACKED_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_STATE */ #define I2C_STATE_BUSHOLD (0x1UL << 4) /**< Bus Held */ #define _I2C_STATE_BUSHOLD_SHIFT 4 /**< Shift value for I2C_BUSHOLD */ #define _I2C_STATE_BUSHOLD_MASK 0x10UL /**< Bit mask for I2C_BUSHOLD */ #define _I2C_STATE_BUSHOLD_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATE */ #define I2C_STATE_BUSHOLD_DEFAULT (_I2C_STATE_BUSHOLD_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_STATE */ #define _I2C_STATE_STATE_SHIFT 5 /**< Shift value for I2C_STATE */ #define _I2C_STATE_STATE_MASK 0xE0UL /**< Bit mask for I2C_STATE */ #define _I2C_STATE_STATE_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATE */ #define _I2C_STATE_STATE_IDLE 0x00000000UL /**< Mode IDLE for I2C_STATE */ #define _I2C_STATE_STATE_WAIT 0x00000001UL /**< Mode WAIT for I2C_STATE */ #define _I2C_STATE_STATE_START 0x00000002UL /**< Mode START for I2C_STATE */ #define _I2C_STATE_STATE_ADDR 0x00000003UL /**< Mode ADDR for I2C_STATE */ #define _I2C_STATE_STATE_ADDRACK 0x00000004UL /**< Mode ADDRACK for I2C_STATE */ #define _I2C_STATE_STATE_DATA 0x00000005UL /**< Mode DATA for I2C_STATE */ #define _I2C_STATE_STATE_DATAACK 0x00000006UL /**< Mode DATAACK for I2C_STATE */ #define I2C_STATE_STATE_DEFAULT (_I2C_STATE_STATE_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_STATE */ #define I2C_STATE_STATE_IDLE (_I2C_STATE_STATE_IDLE << 5) /**< Shifted mode IDLE for I2C_STATE */ #define I2C_STATE_STATE_WAIT (_I2C_STATE_STATE_WAIT << 5) /**< Shifted mode WAIT for I2C_STATE */ #define I2C_STATE_STATE_START (_I2C_STATE_STATE_START << 5) /**< Shifted mode START for I2C_STATE */ #define I2C_STATE_STATE_ADDR (_I2C_STATE_STATE_ADDR << 5) /**< Shifted mode ADDR for I2C_STATE */ #define I2C_STATE_STATE_ADDRACK (_I2C_STATE_STATE_ADDRACK << 5) /**< Shifted mode ADDRACK for I2C_STATE */ #define I2C_STATE_STATE_DATA (_I2C_STATE_STATE_DATA << 5) /**< Shifted mode DATA for I2C_STATE */ #define I2C_STATE_STATE_DATAACK (_I2C_STATE_STATE_DATAACK << 5) /**< Shifted mode DATAACK for I2C_STATE */ /* Bit fields for I2C STATUS */ #define _I2C_STATUS_RESETVALUE 0x00000080UL /**< Default value for I2C_STATUS */ #define _I2C_STATUS_MASK 0x000003FFUL /**< Mask for I2C_STATUS */ #define I2C_STATUS_PSTART (0x1UL << 0) /**< Pending START */ #define _I2C_STATUS_PSTART_SHIFT 0 /**< Shift value for I2C_PSTART */ #define _I2C_STATUS_PSTART_MASK 0x1UL /**< Bit mask for I2C_PSTART */ #define _I2C_STATUS_PSTART_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PSTART_DEFAULT (_I2C_STATUS_PSTART_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PSTOP (0x1UL << 1) /**< Pending STOP */ #define _I2C_STATUS_PSTOP_SHIFT 1 /**< Shift value for I2C_PSTOP */ #define _I2C_STATUS_PSTOP_MASK 0x2UL /**< Bit mask for I2C_PSTOP */ #define _I2C_STATUS_PSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PSTOP_DEFAULT (_I2C_STATUS_PSTOP_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PACK (0x1UL << 2) /**< Pending ACK */ #define _I2C_STATUS_PACK_SHIFT 2 /**< Shift value for I2C_PACK */ #define _I2C_STATUS_PACK_MASK 0x4UL /**< Bit mask for I2C_PACK */ #define _I2C_STATUS_PACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PACK_DEFAULT (_I2C_STATUS_PACK_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PNACK (0x1UL << 3) /**< Pending NACK */ #define _I2C_STATUS_PNACK_SHIFT 3 /**< Shift value for I2C_PNACK */ #define _I2C_STATUS_PNACK_MASK 0x8UL /**< Bit mask for I2C_PNACK */ #define _I2C_STATUS_PNACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PNACK_DEFAULT (_I2C_STATUS_PNACK_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PCONT (0x1UL << 4) /**< Pending Continue */ #define _I2C_STATUS_PCONT_SHIFT 4 /**< Shift value for I2C_PCONT */ #define _I2C_STATUS_PCONT_MASK 0x10UL /**< Bit mask for I2C_PCONT */ #define _I2C_STATUS_PCONT_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PCONT_DEFAULT (_I2C_STATUS_PCONT_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PABORT (0x1UL << 5) /**< Pending Abort */ #define _I2C_STATUS_PABORT_SHIFT 5 /**< Shift value for I2C_PABORT */ #define _I2C_STATUS_PABORT_MASK 0x20UL /**< Bit mask for I2C_PABORT */ #define _I2C_STATUS_PABORT_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_PABORT_DEFAULT (_I2C_STATUS_PABORT_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_TXC (0x1UL << 6) /**< TX Complete */ #define _I2C_STATUS_TXC_SHIFT 6 /**< Shift value for I2C_TXC */ #define _I2C_STATUS_TXC_MASK 0x40UL /**< Bit mask for I2C_TXC */ #define _I2C_STATUS_TXC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_TXC_DEFAULT (_I2C_STATUS_TXC_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_TXBL (0x1UL << 7) /**< TX Buffer Level */ #define _I2C_STATUS_TXBL_SHIFT 7 /**< Shift value for I2C_TXBL */ #define _I2C_STATUS_TXBL_MASK 0x80UL /**< Bit mask for I2C_TXBL */ #define _I2C_STATUS_TXBL_DEFAULT 0x00000001UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_TXBL_DEFAULT (_I2C_STATUS_TXBL_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_RXDATAV (0x1UL << 8) /**< RX Data Valid */ #define _I2C_STATUS_RXDATAV_SHIFT 8 /**< Shift value for I2C_RXDATAV */ #define _I2C_STATUS_RXDATAV_MASK 0x100UL /**< Bit mask for I2C_RXDATAV */ #define _I2C_STATUS_RXDATAV_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_RXDATAV_DEFAULT (_I2C_STATUS_RXDATAV_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_RXFULL (0x1UL << 9) /**< RX FIFO Full */ #define _I2C_STATUS_RXFULL_SHIFT 9 /**< Shift value for I2C_RXFULL */ #define _I2C_STATUS_RXFULL_MASK 0x200UL /**< Bit mask for I2C_RXFULL */ #define _I2C_STATUS_RXFULL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_STATUS */ #define I2C_STATUS_RXFULL_DEFAULT (_I2C_STATUS_RXFULL_DEFAULT << 9) /**< Shifted mode DEFAULT for I2C_STATUS */ /* Bit fields for I2C CLKDIV */ #define _I2C_CLKDIV_RESETVALUE 0x00000000UL /**< Default value for I2C_CLKDIV */ #define _I2C_CLKDIV_MASK 0x000001FFUL /**< Mask for I2C_CLKDIV */ #define _I2C_CLKDIV_DIV_SHIFT 0 /**< Shift value for I2C_DIV */ #define _I2C_CLKDIV_DIV_MASK 0x1FFUL /**< Bit mask for I2C_DIV */ #define _I2C_CLKDIV_DIV_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_CLKDIV */ #define I2C_CLKDIV_DIV_DEFAULT (_I2C_CLKDIV_DIV_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_CLKDIV */ /* Bit fields for I2C SADDR */ #define _I2C_SADDR_RESETVALUE 0x00000000UL /**< Default value for I2C_SADDR */ #define _I2C_SADDR_MASK 0x000000FEUL /**< Mask for I2C_SADDR */ #define _I2C_SADDR_ADDR_SHIFT 1 /**< Shift value for I2C_ADDR */ #define _I2C_SADDR_ADDR_MASK 0xFEUL /**< Bit mask for I2C_ADDR */ #define _I2C_SADDR_ADDR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_SADDR */ #define I2C_SADDR_ADDR_DEFAULT (_I2C_SADDR_ADDR_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_SADDR */ /* Bit fields for I2C SADDRMASK */ #define _I2C_SADDRMASK_RESETVALUE 0x00000000UL /**< Default value for I2C_SADDRMASK */ #define _I2C_SADDRMASK_MASK 0x000000FEUL /**< Mask for I2C_SADDRMASK */ #define _I2C_SADDRMASK_MASK_SHIFT 1 /**< Shift value for I2C_MASK */ #define _I2C_SADDRMASK_MASK_MASK 0xFEUL /**< Bit mask for I2C_MASK */ #define _I2C_SADDRMASK_MASK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_SADDRMASK */ #define I2C_SADDRMASK_MASK_DEFAULT (_I2C_SADDRMASK_MASK_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_SADDRMASK */ /* Bit fields for I2C RXDATA */ #define _I2C_RXDATA_RESETVALUE 0x00000000UL /**< Default value for I2C_RXDATA */ #define _I2C_RXDATA_MASK 0x000000FFUL /**< Mask for I2C_RXDATA */ #define _I2C_RXDATA_RXDATA_SHIFT 0 /**< Shift value for I2C_RXDATA */ #define _I2C_RXDATA_RXDATA_MASK 0xFFUL /**< Bit mask for I2C_RXDATA */ #define _I2C_RXDATA_RXDATA_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDATA */ #define I2C_RXDATA_RXDATA_DEFAULT (_I2C_RXDATA_RXDATA_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_RXDATA */ /* Bit fields for I2C RXDOUBLE */ #define _I2C_RXDOUBLE_RESETVALUE 0x00000000UL /**< Default value for I2C_RXDOUBLE */ #define _I2C_RXDOUBLE_MASK 0x0000FFFFUL /**< Mask for I2C_RXDOUBLE */ #define _I2C_RXDOUBLE_RXDATA0_SHIFT 0 /**< Shift value for I2C_RXDATA0 */ #define _I2C_RXDOUBLE_RXDATA0_MASK 0xFFUL /**< Bit mask for I2C_RXDATA0 */ #define _I2C_RXDOUBLE_RXDATA0_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDOUBLE */ #define I2C_RXDOUBLE_RXDATA0_DEFAULT (_I2C_RXDOUBLE_RXDATA0_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_RXDOUBLE */ #define _I2C_RXDOUBLE_RXDATA1_SHIFT 8 /**< Shift value for I2C_RXDATA1 */ #define _I2C_RXDOUBLE_RXDATA1_MASK 0xFF00UL /**< Bit mask for I2C_RXDATA1 */ #define _I2C_RXDOUBLE_RXDATA1_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDOUBLE */ #define I2C_RXDOUBLE_RXDATA1_DEFAULT (_I2C_RXDOUBLE_RXDATA1_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_RXDOUBLE */ /* Bit fields for I2C RXDATAP */ #define _I2C_RXDATAP_RESETVALUE 0x00000000UL /**< Default value for I2C_RXDATAP */ #define _I2C_RXDATAP_MASK 0x000000FFUL /**< Mask for I2C_RXDATAP */ #define _I2C_RXDATAP_RXDATAP_SHIFT 0 /**< Shift value for I2C_RXDATAP */ #define _I2C_RXDATAP_RXDATAP_MASK 0xFFUL /**< Bit mask for I2C_RXDATAP */ #define _I2C_RXDATAP_RXDATAP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDATAP */ #define I2C_RXDATAP_RXDATAP_DEFAULT (_I2C_RXDATAP_RXDATAP_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_RXDATAP */ /* Bit fields for I2C RXDOUBLEP */ #define _I2C_RXDOUBLEP_RESETVALUE 0x00000000UL /**< Default value for I2C_RXDOUBLEP */ #define _I2C_RXDOUBLEP_MASK 0x0000FFFFUL /**< Mask for I2C_RXDOUBLEP */ #define _I2C_RXDOUBLEP_RXDATAP0_SHIFT 0 /**< Shift value for I2C_RXDATAP0 */ #define _I2C_RXDOUBLEP_RXDATAP0_MASK 0xFFUL /**< Bit mask for I2C_RXDATAP0 */ #define _I2C_RXDOUBLEP_RXDATAP0_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDOUBLEP */ #define I2C_RXDOUBLEP_RXDATAP0_DEFAULT (_I2C_RXDOUBLEP_RXDATAP0_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_RXDOUBLEP */ #define _I2C_RXDOUBLEP_RXDATAP1_SHIFT 8 /**< Shift value for I2C_RXDATAP1 */ #define _I2C_RXDOUBLEP_RXDATAP1_MASK 0xFF00UL /**< Bit mask for I2C_RXDATAP1 */ #define _I2C_RXDOUBLEP_RXDATAP1_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_RXDOUBLEP */ #define I2C_RXDOUBLEP_RXDATAP1_DEFAULT (_I2C_RXDOUBLEP_RXDATAP1_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_RXDOUBLEP */ /* Bit fields for I2C TXDATA */ #define _I2C_TXDATA_RESETVALUE 0x00000000UL /**< Default value for I2C_TXDATA */ #define _I2C_TXDATA_MASK 0x000000FFUL /**< Mask for I2C_TXDATA */ #define _I2C_TXDATA_TXDATA_SHIFT 0 /**< Shift value for I2C_TXDATA */ #define _I2C_TXDATA_TXDATA_MASK 0xFFUL /**< Bit mask for I2C_TXDATA */ #define _I2C_TXDATA_TXDATA_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_TXDATA */ #define I2C_TXDATA_TXDATA_DEFAULT (_I2C_TXDATA_TXDATA_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_TXDATA */ /* Bit fields for I2C TXDOUBLE */ #define _I2C_TXDOUBLE_RESETVALUE 0x00000000UL /**< Default value for I2C_TXDOUBLE */ #define _I2C_TXDOUBLE_MASK 0x0000FFFFUL /**< Mask for I2C_TXDOUBLE */ #define _I2C_TXDOUBLE_TXDATA0_SHIFT 0 /**< Shift value for I2C_TXDATA0 */ #define _I2C_TXDOUBLE_TXDATA0_MASK 0xFFUL /**< Bit mask for I2C_TXDATA0 */ #define _I2C_TXDOUBLE_TXDATA0_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_TXDOUBLE */ #define I2C_TXDOUBLE_TXDATA0_DEFAULT (_I2C_TXDOUBLE_TXDATA0_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_TXDOUBLE */ #define _I2C_TXDOUBLE_TXDATA1_SHIFT 8 /**< Shift value for I2C_TXDATA1 */ #define _I2C_TXDOUBLE_TXDATA1_MASK 0xFF00UL /**< Bit mask for I2C_TXDATA1 */ #define _I2C_TXDOUBLE_TXDATA1_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_TXDOUBLE */ #define I2C_TXDOUBLE_TXDATA1_DEFAULT (_I2C_TXDOUBLE_TXDATA1_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_TXDOUBLE */ /* Bit fields for I2C IF */ #define _I2C_IF_RESETVALUE 0x00000010UL /**< Default value for I2C_IF */ #define _I2C_IF_MASK 0x0007FFFFUL /**< Mask for I2C_IF */ #define I2C_IF_START (0x1UL << 0) /**< START Condition Interrupt Flag */ #define _I2C_IF_START_SHIFT 0 /**< Shift value for I2C_START */ #define _I2C_IF_START_MASK 0x1UL /**< Bit mask for I2C_START */ #define _I2C_IF_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_START_DEFAULT (_I2C_IF_START_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_RSTART (0x1UL << 1) /**< Repeated START Condition Interrupt Flag */ #define _I2C_IF_RSTART_SHIFT 1 /**< Shift value for I2C_RSTART */ #define _I2C_IF_RSTART_MASK 0x2UL /**< Bit mask for I2C_RSTART */ #define _I2C_IF_RSTART_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_RSTART_DEFAULT (_I2C_IF_RSTART_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_ADDR (0x1UL << 2) /**< Address Interrupt Flag */ #define _I2C_IF_ADDR_SHIFT 2 /**< Shift value for I2C_ADDR */ #define _I2C_IF_ADDR_MASK 0x4UL /**< Bit mask for I2C_ADDR */ #define _I2C_IF_ADDR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_ADDR_DEFAULT (_I2C_IF_ADDR_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_TXC (0x1UL << 3) /**< Transfer Completed Interrupt Flag */ #define _I2C_IF_TXC_SHIFT 3 /**< Shift value for I2C_TXC */ #define _I2C_IF_TXC_MASK 0x8UL /**< Bit mask for I2C_TXC */ #define _I2C_IF_TXC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_TXC_DEFAULT (_I2C_IF_TXC_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_TXBL (0x1UL << 4) /**< Transmit Buffer Level Interrupt Flag */ #define _I2C_IF_TXBL_SHIFT 4 /**< Shift value for I2C_TXBL */ #define _I2C_IF_TXBL_MASK 0x10UL /**< Bit mask for I2C_TXBL */ #define _I2C_IF_TXBL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_TXBL_DEFAULT (_I2C_IF_TXBL_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_RXDATAV (0x1UL << 5) /**< Receive Data Valid Interrupt Flag */ #define _I2C_IF_RXDATAV_SHIFT 5 /**< Shift value for I2C_RXDATAV */ #define _I2C_IF_RXDATAV_MASK 0x20UL /**< Bit mask for I2C_RXDATAV */ #define _I2C_IF_RXDATAV_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_RXDATAV_DEFAULT (_I2C_IF_RXDATAV_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_ACK (0x1UL << 6) /**< Acknowledge Received Interrupt Flag */ #define _I2C_IF_ACK_SHIFT 6 /**< Shift value for I2C_ACK */ #define _I2C_IF_ACK_MASK 0x40UL /**< Bit mask for I2C_ACK */ #define _I2C_IF_ACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_ACK_DEFAULT (_I2C_IF_ACK_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_NACK (0x1UL << 7) /**< Not Acknowledge Received Interrupt Flag */ #define _I2C_IF_NACK_SHIFT 7 /**< Shift value for I2C_NACK */ #define _I2C_IF_NACK_MASK 0x80UL /**< Bit mask for I2C_NACK */ #define _I2C_IF_NACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_NACK_DEFAULT (_I2C_IF_NACK_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_MSTOP (0x1UL << 8) /**< Master STOP Condition Interrupt Flag */ #define _I2C_IF_MSTOP_SHIFT 8 /**< Shift value for I2C_MSTOP */ #define _I2C_IF_MSTOP_MASK 0x100UL /**< Bit mask for I2C_MSTOP */ #define _I2C_IF_MSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_MSTOP_DEFAULT (_I2C_IF_MSTOP_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_ARBLOST (0x1UL << 9) /**< Arbitration Lost Interrupt Flag */ #define _I2C_IF_ARBLOST_SHIFT 9 /**< Shift value for I2C_ARBLOST */ #define _I2C_IF_ARBLOST_MASK 0x200UL /**< Bit mask for I2C_ARBLOST */ #define _I2C_IF_ARBLOST_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_ARBLOST_DEFAULT (_I2C_IF_ARBLOST_DEFAULT << 9) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_BUSERR (0x1UL << 10) /**< Bus Error Interrupt Flag */ #define _I2C_IF_BUSERR_SHIFT 10 /**< Shift value for I2C_BUSERR */ #define _I2C_IF_BUSERR_MASK 0x400UL /**< Bit mask for I2C_BUSERR */ #define _I2C_IF_BUSERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_BUSERR_DEFAULT (_I2C_IF_BUSERR_DEFAULT << 10) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_BUSHOLD (0x1UL << 11) /**< Bus Held Interrupt Flag */ #define _I2C_IF_BUSHOLD_SHIFT 11 /**< Shift value for I2C_BUSHOLD */ #define _I2C_IF_BUSHOLD_MASK 0x800UL /**< Bit mask for I2C_BUSHOLD */ #define _I2C_IF_BUSHOLD_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_BUSHOLD_DEFAULT (_I2C_IF_BUSHOLD_DEFAULT << 11) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_TXOF (0x1UL << 12) /**< Transmit Buffer Overflow Interrupt Flag */ #define _I2C_IF_TXOF_SHIFT 12 /**< Shift value for I2C_TXOF */ #define _I2C_IF_TXOF_MASK 0x1000UL /**< Bit mask for I2C_TXOF */ #define _I2C_IF_TXOF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_TXOF_DEFAULT (_I2C_IF_TXOF_DEFAULT << 12) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_RXUF (0x1UL << 13) /**< Receive Buffer Underflow Interrupt Flag */ #define _I2C_IF_RXUF_SHIFT 13 /**< Shift value for I2C_RXUF */ #define _I2C_IF_RXUF_MASK 0x2000UL /**< Bit mask for I2C_RXUF */ #define _I2C_IF_RXUF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_RXUF_DEFAULT (_I2C_IF_RXUF_DEFAULT << 13) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_BITO (0x1UL << 14) /**< Bus Idle Timeout Interrupt Flag */ #define _I2C_IF_BITO_SHIFT 14 /**< Shift value for I2C_BITO */ #define _I2C_IF_BITO_MASK 0x4000UL /**< Bit mask for I2C_BITO */ #define _I2C_IF_BITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_BITO_DEFAULT (_I2C_IF_BITO_DEFAULT << 14) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_CLTO (0x1UL << 15) /**< Clock Low Timeout Interrupt Flag */ #define _I2C_IF_CLTO_SHIFT 15 /**< Shift value for I2C_CLTO */ #define _I2C_IF_CLTO_MASK 0x8000UL /**< Bit mask for I2C_CLTO */ #define _I2C_IF_CLTO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_CLTO_DEFAULT (_I2C_IF_CLTO_DEFAULT << 15) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_SSTOP (0x1UL << 16) /**< Slave STOP Condition Interrupt Flag */ #define _I2C_IF_SSTOP_SHIFT 16 /**< Shift value for I2C_SSTOP */ #define _I2C_IF_SSTOP_MASK 0x10000UL /**< Bit mask for I2C_SSTOP */ #define _I2C_IF_SSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_SSTOP_DEFAULT (_I2C_IF_SSTOP_DEFAULT << 16) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_RXFULL (0x1UL << 17) /**< Receive Buffer Full Interrupt Flag */ #define _I2C_IF_RXFULL_SHIFT 17 /**< Shift value for I2C_RXFULL */ #define _I2C_IF_RXFULL_MASK 0x20000UL /**< Bit mask for I2C_RXFULL */ #define _I2C_IF_RXFULL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_RXFULL_DEFAULT (_I2C_IF_RXFULL_DEFAULT << 17) /**< Shifted mode DEFAULT for I2C_IF */ #define I2C_IF_CLERR (0x1UL << 18) /**< Clock Low Error Interrupt Flag */ #define _I2C_IF_CLERR_SHIFT 18 /**< Shift value for I2C_CLERR */ #define _I2C_IF_CLERR_MASK 0x40000UL /**< Bit mask for I2C_CLERR */ #define _I2C_IF_CLERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IF */ #define I2C_IF_CLERR_DEFAULT (_I2C_IF_CLERR_DEFAULT << 18) /**< Shifted mode DEFAULT for I2C_IF */ /* Bit fields for I2C IFS */ #define _I2C_IFS_RESETVALUE 0x00000000UL /**< Default value for I2C_IFS */ #define _I2C_IFS_MASK 0x0007FFCFUL /**< Mask for I2C_IFS */ #define I2C_IFS_START (0x1UL << 0) /**< Set START Interrupt Flag */ #define _I2C_IFS_START_SHIFT 0 /**< Shift value for I2C_START */ #define _I2C_IFS_START_MASK 0x1UL /**< Bit mask for I2C_START */ #define _I2C_IFS_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_START_DEFAULT (_I2C_IFS_START_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_RSTART (0x1UL << 1) /**< Set RSTART Interrupt Flag */ #define _I2C_IFS_RSTART_SHIFT 1 /**< Shift value for I2C_RSTART */ #define _I2C_IFS_RSTART_MASK 0x2UL /**< Bit mask for I2C_RSTART */ #define _I2C_IFS_RSTART_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_RSTART_DEFAULT (_I2C_IFS_RSTART_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_ADDR (0x1UL << 2) /**< Set ADDR Interrupt Flag */ #define _I2C_IFS_ADDR_SHIFT 2 /**< Shift value for I2C_ADDR */ #define _I2C_IFS_ADDR_MASK 0x4UL /**< Bit mask for I2C_ADDR */ #define _I2C_IFS_ADDR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_ADDR_DEFAULT (_I2C_IFS_ADDR_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_TXC (0x1UL << 3) /**< Set TXC Interrupt Flag */ #define _I2C_IFS_TXC_SHIFT 3 /**< Shift value for I2C_TXC */ #define _I2C_IFS_TXC_MASK 0x8UL /**< Bit mask for I2C_TXC */ #define _I2C_IFS_TXC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_TXC_DEFAULT (_I2C_IFS_TXC_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_ACK (0x1UL << 6) /**< Set ACK Interrupt Flag */ #define _I2C_IFS_ACK_SHIFT 6 /**< Shift value for I2C_ACK */ #define _I2C_IFS_ACK_MASK 0x40UL /**< Bit mask for I2C_ACK */ #define _I2C_IFS_ACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_ACK_DEFAULT (_I2C_IFS_ACK_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_NACK (0x1UL << 7) /**< Set NACK Interrupt Flag */ #define _I2C_IFS_NACK_SHIFT 7 /**< Shift value for I2C_NACK */ #define _I2C_IFS_NACK_MASK 0x80UL /**< Bit mask for I2C_NACK */ #define _I2C_IFS_NACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_NACK_DEFAULT (_I2C_IFS_NACK_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_MSTOP (0x1UL << 8) /**< Set MSTOP Interrupt Flag */ #define _I2C_IFS_MSTOP_SHIFT 8 /**< Shift value for I2C_MSTOP */ #define _I2C_IFS_MSTOP_MASK 0x100UL /**< Bit mask for I2C_MSTOP */ #define _I2C_IFS_MSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_MSTOP_DEFAULT (_I2C_IFS_MSTOP_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_ARBLOST (0x1UL << 9) /**< Set ARBLOST Interrupt Flag */ #define _I2C_IFS_ARBLOST_SHIFT 9 /**< Shift value for I2C_ARBLOST */ #define _I2C_IFS_ARBLOST_MASK 0x200UL /**< Bit mask for I2C_ARBLOST */ #define _I2C_IFS_ARBLOST_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_ARBLOST_DEFAULT (_I2C_IFS_ARBLOST_DEFAULT << 9) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_BUSERR (0x1UL << 10) /**< Set BUSERR Interrupt Flag */ #define _I2C_IFS_BUSERR_SHIFT 10 /**< Shift value for I2C_BUSERR */ #define _I2C_IFS_BUSERR_MASK 0x400UL /**< Bit mask for I2C_BUSERR */ #define _I2C_IFS_BUSERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_BUSERR_DEFAULT (_I2C_IFS_BUSERR_DEFAULT << 10) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_BUSHOLD (0x1UL << 11) /**< Set BUSHOLD Interrupt Flag */ #define _I2C_IFS_BUSHOLD_SHIFT 11 /**< Shift value for I2C_BUSHOLD */ #define _I2C_IFS_BUSHOLD_MASK 0x800UL /**< Bit mask for I2C_BUSHOLD */ #define _I2C_IFS_BUSHOLD_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_BUSHOLD_DEFAULT (_I2C_IFS_BUSHOLD_DEFAULT << 11) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_TXOF (0x1UL << 12) /**< Set TXOF Interrupt Flag */ #define _I2C_IFS_TXOF_SHIFT 12 /**< Shift value for I2C_TXOF */ #define _I2C_IFS_TXOF_MASK 0x1000UL /**< Bit mask for I2C_TXOF */ #define _I2C_IFS_TXOF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_TXOF_DEFAULT (_I2C_IFS_TXOF_DEFAULT << 12) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_RXUF (0x1UL << 13) /**< Set RXUF Interrupt Flag */ #define _I2C_IFS_RXUF_SHIFT 13 /**< Shift value for I2C_RXUF */ #define _I2C_IFS_RXUF_MASK 0x2000UL /**< Bit mask for I2C_RXUF */ #define _I2C_IFS_RXUF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_RXUF_DEFAULT (_I2C_IFS_RXUF_DEFAULT << 13) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_BITO (0x1UL << 14) /**< Set BITO Interrupt Flag */ #define _I2C_IFS_BITO_SHIFT 14 /**< Shift value for I2C_BITO */ #define _I2C_IFS_BITO_MASK 0x4000UL /**< Bit mask for I2C_BITO */ #define _I2C_IFS_BITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_BITO_DEFAULT (_I2C_IFS_BITO_DEFAULT << 14) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_CLTO (0x1UL << 15) /**< Set CLTO Interrupt Flag */ #define _I2C_IFS_CLTO_SHIFT 15 /**< Shift value for I2C_CLTO */ #define _I2C_IFS_CLTO_MASK 0x8000UL /**< Bit mask for I2C_CLTO */ #define _I2C_IFS_CLTO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_CLTO_DEFAULT (_I2C_IFS_CLTO_DEFAULT << 15) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_SSTOP (0x1UL << 16) /**< Set SSTOP Interrupt Flag */ #define _I2C_IFS_SSTOP_SHIFT 16 /**< Shift value for I2C_SSTOP */ #define _I2C_IFS_SSTOP_MASK 0x10000UL /**< Bit mask for I2C_SSTOP */ #define _I2C_IFS_SSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_SSTOP_DEFAULT (_I2C_IFS_SSTOP_DEFAULT << 16) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_RXFULL (0x1UL << 17) /**< Set RXFULL Interrupt Flag */ #define _I2C_IFS_RXFULL_SHIFT 17 /**< Shift value for I2C_RXFULL */ #define _I2C_IFS_RXFULL_MASK 0x20000UL /**< Bit mask for I2C_RXFULL */ #define _I2C_IFS_RXFULL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_RXFULL_DEFAULT (_I2C_IFS_RXFULL_DEFAULT << 17) /**< Shifted mode DEFAULT for I2C_IFS */ #define I2C_IFS_CLERR (0x1UL << 18) /**< Set CLERR Interrupt Flag */ #define _I2C_IFS_CLERR_SHIFT 18 /**< Shift value for I2C_CLERR */ #define _I2C_IFS_CLERR_MASK 0x40000UL /**< Bit mask for I2C_CLERR */ #define _I2C_IFS_CLERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFS */ #define I2C_IFS_CLERR_DEFAULT (_I2C_IFS_CLERR_DEFAULT << 18) /**< Shifted mode DEFAULT for I2C_IFS */ /* Bit fields for I2C IFC */ #define _I2C_IFC_RESETVALUE 0x00000000UL /**< Default value for I2C_IFC */ #define _I2C_IFC_MASK 0x0007FFCFUL /**< Mask for I2C_IFC */ #define I2C_IFC_START (0x1UL << 0) /**< Clear START Interrupt Flag */ #define _I2C_IFC_START_SHIFT 0 /**< Shift value for I2C_START */ #define _I2C_IFC_START_MASK 0x1UL /**< Bit mask for I2C_START */ #define _I2C_IFC_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_START_DEFAULT (_I2C_IFC_START_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_RSTART (0x1UL << 1) /**< Clear RSTART Interrupt Flag */ #define _I2C_IFC_RSTART_SHIFT 1 /**< Shift value for I2C_RSTART */ #define _I2C_IFC_RSTART_MASK 0x2UL /**< Bit mask for I2C_RSTART */ #define _I2C_IFC_RSTART_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_RSTART_DEFAULT (_I2C_IFC_RSTART_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_ADDR (0x1UL << 2) /**< Clear ADDR Interrupt Flag */ #define _I2C_IFC_ADDR_SHIFT 2 /**< Shift value for I2C_ADDR */ #define _I2C_IFC_ADDR_MASK 0x4UL /**< Bit mask for I2C_ADDR */ #define _I2C_IFC_ADDR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_ADDR_DEFAULT (_I2C_IFC_ADDR_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_TXC (0x1UL << 3) /**< Clear TXC Interrupt Flag */ #define _I2C_IFC_TXC_SHIFT 3 /**< Shift value for I2C_TXC */ #define _I2C_IFC_TXC_MASK 0x8UL /**< Bit mask for I2C_TXC */ #define _I2C_IFC_TXC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_TXC_DEFAULT (_I2C_IFC_TXC_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_ACK (0x1UL << 6) /**< Clear ACK Interrupt Flag */ #define _I2C_IFC_ACK_SHIFT 6 /**< Shift value for I2C_ACK */ #define _I2C_IFC_ACK_MASK 0x40UL /**< Bit mask for I2C_ACK */ #define _I2C_IFC_ACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_ACK_DEFAULT (_I2C_IFC_ACK_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_NACK (0x1UL << 7) /**< Clear NACK Interrupt Flag */ #define _I2C_IFC_NACK_SHIFT 7 /**< Shift value for I2C_NACK */ #define _I2C_IFC_NACK_MASK 0x80UL /**< Bit mask for I2C_NACK */ #define _I2C_IFC_NACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_NACK_DEFAULT (_I2C_IFC_NACK_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_MSTOP (0x1UL << 8) /**< Clear MSTOP Interrupt Flag */ #define _I2C_IFC_MSTOP_SHIFT 8 /**< Shift value for I2C_MSTOP */ #define _I2C_IFC_MSTOP_MASK 0x100UL /**< Bit mask for I2C_MSTOP */ #define _I2C_IFC_MSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_MSTOP_DEFAULT (_I2C_IFC_MSTOP_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_ARBLOST (0x1UL << 9) /**< Clear ARBLOST Interrupt Flag */ #define _I2C_IFC_ARBLOST_SHIFT 9 /**< Shift value for I2C_ARBLOST */ #define _I2C_IFC_ARBLOST_MASK 0x200UL /**< Bit mask for I2C_ARBLOST */ #define _I2C_IFC_ARBLOST_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_ARBLOST_DEFAULT (_I2C_IFC_ARBLOST_DEFAULT << 9) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_BUSERR (0x1UL << 10) /**< Clear BUSERR Interrupt Flag */ #define _I2C_IFC_BUSERR_SHIFT 10 /**< Shift value for I2C_BUSERR */ #define _I2C_IFC_BUSERR_MASK 0x400UL /**< Bit mask for I2C_BUSERR */ #define _I2C_IFC_BUSERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_BUSERR_DEFAULT (_I2C_IFC_BUSERR_DEFAULT << 10) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_BUSHOLD (0x1UL << 11) /**< Clear BUSHOLD Interrupt Flag */ #define _I2C_IFC_BUSHOLD_SHIFT 11 /**< Shift value for I2C_BUSHOLD */ #define _I2C_IFC_BUSHOLD_MASK 0x800UL /**< Bit mask for I2C_BUSHOLD */ #define _I2C_IFC_BUSHOLD_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_BUSHOLD_DEFAULT (_I2C_IFC_BUSHOLD_DEFAULT << 11) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_TXOF (0x1UL << 12) /**< Clear TXOF Interrupt Flag */ #define _I2C_IFC_TXOF_SHIFT 12 /**< Shift value for I2C_TXOF */ #define _I2C_IFC_TXOF_MASK 0x1000UL /**< Bit mask for I2C_TXOF */ #define _I2C_IFC_TXOF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_TXOF_DEFAULT (_I2C_IFC_TXOF_DEFAULT << 12) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_RXUF (0x1UL << 13) /**< Clear RXUF Interrupt Flag */ #define _I2C_IFC_RXUF_SHIFT 13 /**< Shift value for I2C_RXUF */ #define _I2C_IFC_RXUF_MASK 0x2000UL /**< Bit mask for I2C_RXUF */ #define _I2C_IFC_RXUF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_RXUF_DEFAULT (_I2C_IFC_RXUF_DEFAULT << 13) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_BITO (0x1UL << 14) /**< Clear BITO Interrupt Flag */ #define _I2C_IFC_BITO_SHIFT 14 /**< Shift value for I2C_BITO */ #define _I2C_IFC_BITO_MASK 0x4000UL /**< Bit mask for I2C_BITO */ #define _I2C_IFC_BITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_BITO_DEFAULT (_I2C_IFC_BITO_DEFAULT << 14) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_CLTO (0x1UL << 15) /**< Clear CLTO Interrupt Flag */ #define _I2C_IFC_CLTO_SHIFT 15 /**< Shift value for I2C_CLTO */ #define _I2C_IFC_CLTO_MASK 0x8000UL /**< Bit mask for I2C_CLTO */ #define _I2C_IFC_CLTO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_CLTO_DEFAULT (_I2C_IFC_CLTO_DEFAULT << 15) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_SSTOP (0x1UL << 16) /**< Clear SSTOP Interrupt Flag */ #define _I2C_IFC_SSTOP_SHIFT 16 /**< Shift value for I2C_SSTOP */ #define _I2C_IFC_SSTOP_MASK 0x10000UL /**< Bit mask for I2C_SSTOP */ #define _I2C_IFC_SSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_SSTOP_DEFAULT (_I2C_IFC_SSTOP_DEFAULT << 16) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_RXFULL (0x1UL << 17) /**< Clear RXFULL Interrupt Flag */ #define _I2C_IFC_RXFULL_SHIFT 17 /**< Shift value for I2C_RXFULL */ #define _I2C_IFC_RXFULL_MASK 0x20000UL /**< Bit mask for I2C_RXFULL */ #define _I2C_IFC_RXFULL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_RXFULL_DEFAULT (_I2C_IFC_RXFULL_DEFAULT << 17) /**< Shifted mode DEFAULT for I2C_IFC */ #define I2C_IFC_CLERR (0x1UL << 18) /**< Clear CLERR Interrupt Flag */ #define _I2C_IFC_CLERR_SHIFT 18 /**< Shift value for I2C_CLERR */ #define _I2C_IFC_CLERR_MASK 0x40000UL /**< Bit mask for I2C_CLERR */ #define _I2C_IFC_CLERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IFC */ #define I2C_IFC_CLERR_DEFAULT (_I2C_IFC_CLERR_DEFAULT << 18) /**< Shifted mode DEFAULT for I2C_IFC */ /* Bit fields for I2C IEN */ #define _I2C_IEN_RESETVALUE 0x00000000UL /**< Default value for I2C_IEN */ #define _I2C_IEN_MASK 0x0007FFFFUL /**< Mask for I2C_IEN */ #define I2C_IEN_START (0x1UL << 0) /**< START Interrupt Enable */ #define _I2C_IEN_START_SHIFT 0 /**< Shift value for I2C_START */ #define _I2C_IEN_START_MASK 0x1UL /**< Bit mask for I2C_START */ #define _I2C_IEN_START_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_START_DEFAULT (_I2C_IEN_START_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_RSTART (0x1UL << 1) /**< RSTART Interrupt Enable */ #define _I2C_IEN_RSTART_SHIFT 1 /**< Shift value for I2C_RSTART */ #define _I2C_IEN_RSTART_MASK 0x2UL /**< Bit mask for I2C_RSTART */ #define _I2C_IEN_RSTART_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_RSTART_DEFAULT (_I2C_IEN_RSTART_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_ADDR (0x1UL << 2) /**< ADDR Interrupt Enable */ #define _I2C_IEN_ADDR_SHIFT 2 /**< Shift value for I2C_ADDR */ #define _I2C_IEN_ADDR_MASK 0x4UL /**< Bit mask for I2C_ADDR */ #define _I2C_IEN_ADDR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_ADDR_DEFAULT (_I2C_IEN_ADDR_DEFAULT << 2) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXC (0x1UL << 3) /**< TXC Interrupt Enable */ #define _I2C_IEN_TXC_SHIFT 3 /**< Shift value for I2C_TXC */ #define _I2C_IEN_TXC_MASK 0x8UL /**< Bit mask for I2C_TXC */ #define _I2C_IEN_TXC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXC_DEFAULT (_I2C_IEN_TXC_DEFAULT << 3) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXBL (0x1UL << 4) /**< TXBL Interrupt Enable */ #define _I2C_IEN_TXBL_SHIFT 4 /**< Shift value for I2C_TXBL */ #define _I2C_IEN_TXBL_MASK 0x10UL /**< Bit mask for I2C_TXBL */ #define _I2C_IEN_TXBL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXBL_DEFAULT (_I2C_IEN_TXBL_DEFAULT << 4) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXDATAV (0x1UL << 5) /**< RXDATAV Interrupt Enable */ #define _I2C_IEN_RXDATAV_SHIFT 5 /**< Shift value for I2C_RXDATAV */ #define _I2C_IEN_RXDATAV_MASK 0x20UL /**< Bit mask for I2C_RXDATAV */ #define _I2C_IEN_RXDATAV_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXDATAV_DEFAULT (_I2C_IEN_RXDATAV_DEFAULT << 5) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_ACK (0x1UL << 6) /**< ACK Interrupt Enable */ #define _I2C_IEN_ACK_SHIFT 6 /**< Shift value for I2C_ACK */ #define _I2C_IEN_ACK_MASK 0x40UL /**< Bit mask for I2C_ACK */ #define _I2C_IEN_ACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_ACK_DEFAULT (_I2C_IEN_ACK_DEFAULT << 6) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_NACK (0x1UL << 7) /**< NACK Interrupt Enable */ #define _I2C_IEN_NACK_SHIFT 7 /**< Shift value for I2C_NACK */ #define _I2C_IEN_NACK_MASK 0x80UL /**< Bit mask for I2C_NACK */ #define _I2C_IEN_NACK_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_NACK_DEFAULT (_I2C_IEN_NACK_DEFAULT << 7) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_MSTOP (0x1UL << 8) /**< MSTOP Interrupt Enable */ #define _I2C_IEN_MSTOP_SHIFT 8 /**< Shift value for I2C_MSTOP */ #define _I2C_IEN_MSTOP_MASK 0x100UL /**< Bit mask for I2C_MSTOP */ #define _I2C_IEN_MSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_MSTOP_DEFAULT (_I2C_IEN_MSTOP_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_ARBLOST (0x1UL << 9) /**< ARBLOST Interrupt Enable */ #define _I2C_IEN_ARBLOST_SHIFT 9 /**< Shift value for I2C_ARBLOST */ #define _I2C_IEN_ARBLOST_MASK 0x200UL /**< Bit mask for I2C_ARBLOST */ #define _I2C_IEN_ARBLOST_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_ARBLOST_DEFAULT (_I2C_IEN_ARBLOST_DEFAULT << 9) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_BUSERR (0x1UL << 10) /**< BUSERR Interrupt Enable */ #define _I2C_IEN_BUSERR_SHIFT 10 /**< Shift value for I2C_BUSERR */ #define _I2C_IEN_BUSERR_MASK 0x400UL /**< Bit mask for I2C_BUSERR */ #define _I2C_IEN_BUSERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_BUSERR_DEFAULT (_I2C_IEN_BUSERR_DEFAULT << 10) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_BUSHOLD (0x1UL << 11) /**< BUSHOLD Interrupt Enable */ #define _I2C_IEN_BUSHOLD_SHIFT 11 /**< Shift value for I2C_BUSHOLD */ #define _I2C_IEN_BUSHOLD_MASK 0x800UL /**< Bit mask for I2C_BUSHOLD */ #define _I2C_IEN_BUSHOLD_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_BUSHOLD_DEFAULT (_I2C_IEN_BUSHOLD_DEFAULT << 11) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXOF (0x1UL << 12) /**< TXOF Interrupt Enable */ #define _I2C_IEN_TXOF_SHIFT 12 /**< Shift value for I2C_TXOF */ #define _I2C_IEN_TXOF_MASK 0x1000UL /**< Bit mask for I2C_TXOF */ #define _I2C_IEN_TXOF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_TXOF_DEFAULT (_I2C_IEN_TXOF_DEFAULT << 12) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXUF (0x1UL << 13) /**< RXUF Interrupt Enable */ #define _I2C_IEN_RXUF_SHIFT 13 /**< Shift value for I2C_RXUF */ #define _I2C_IEN_RXUF_MASK 0x2000UL /**< Bit mask for I2C_RXUF */ #define _I2C_IEN_RXUF_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXUF_DEFAULT (_I2C_IEN_RXUF_DEFAULT << 13) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_BITO (0x1UL << 14) /**< BITO Interrupt Enable */ #define _I2C_IEN_BITO_SHIFT 14 /**< Shift value for I2C_BITO */ #define _I2C_IEN_BITO_MASK 0x4000UL /**< Bit mask for I2C_BITO */ #define _I2C_IEN_BITO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_BITO_DEFAULT (_I2C_IEN_BITO_DEFAULT << 14) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_CLTO (0x1UL << 15) /**< CLTO Interrupt Enable */ #define _I2C_IEN_CLTO_SHIFT 15 /**< Shift value for I2C_CLTO */ #define _I2C_IEN_CLTO_MASK 0x8000UL /**< Bit mask for I2C_CLTO */ #define _I2C_IEN_CLTO_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_CLTO_DEFAULT (_I2C_IEN_CLTO_DEFAULT << 15) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_SSTOP (0x1UL << 16) /**< SSTOP Interrupt Enable */ #define _I2C_IEN_SSTOP_SHIFT 16 /**< Shift value for I2C_SSTOP */ #define _I2C_IEN_SSTOP_MASK 0x10000UL /**< Bit mask for I2C_SSTOP */ #define _I2C_IEN_SSTOP_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_SSTOP_DEFAULT (_I2C_IEN_SSTOP_DEFAULT << 16) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXFULL (0x1UL << 17) /**< RXFULL Interrupt Enable */ #define _I2C_IEN_RXFULL_SHIFT 17 /**< Shift value for I2C_RXFULL */ #define _I2C_IEN_RXFULL_MASK 0x20000UL /**< Bit mask for I2C_RXFULL */ #define _I2C_IEN_RXFULL_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_RXFULL_DEFAULT (_I2C_IEN_RXFULL_DEFAULT << 17) /**< Shifted mode DEFAULT for I2C_IEN */ #define I2C_IEN_CLERR (0x1UL << 18) /**< CLERR Interrupt Enable */ #define _I2C_IEN_CLERR_SHIFT 18 /**< Shift value for I2C_CLERR */ #define _I2C_IEN_CLERR_MASK 0x40000UL /**< Bit mask for I2C_CLERR */ #define _I2C_IEN_CLERR_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_IEN */ #define I2C_IEN_CLERR_DEFAULT (_I2C_IEN_CLERR_DEFAULT << 18) /**< Shifted mode DEFAULT for I2C_IEN */ /* Bit fields for I2C ROUTEPEN */ #define _I2C_ROUTEPEN_RESETVALUE 0x00000000UL /**< Default value for I2C_ROUTEPEN */ #define _I2C_ROUTEPEN_MASK 0x00000003UL /**< Mask for I2C_ROUTEPEN */ #define I2C_ROUTEPEN_SDAPEN (0x1UL << 0) /**< SDA Pin Enable */ #define _I2C_ROUTEPEN_SDAPEN_SHIFT 0 /**< Shift value for I2C_SDAPEN */ #define _I2C_ROUTEPEN_SDAPEN_MASK 0x1UL /**< Bit mask for I2C_SDAPEN */ #define _I2C_ROUTEPEN_SDAPEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_ROUTEPEN */ #define I2C_ROUTEPEN_SDAPEN_DEFAULT (_I2C_ROUTEPEN_SDAPEN_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_ROUTEPEN */ #define I2C_ROUTEPEN_SCLPEN (0x1UL << 1) /**< SCL Pin Enable */ #define _I2C_ROUTEPEN_SCLPEN_SHIFT 1 /**< Shift value for I2C_SCLPEN */ #define _I2C_ROUTEPEN_SCLPEN_MASK 0x2UL /**< Bit mask for I2C_SCLPEN */ #define _I2C_ROUTEPEN_SCLPEN_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_ROUTEPEN */ #define I2C_ROUTEPEN_SCLPEN_DEFAULT (_I2C_ROUTEPEN_SCLPEN_DEFAULT << 1) /**< Shifted mode DEFAULT for I2C_ROUTEPEN */ /* Bit fields for I2C ROUTELOC0 */ #define _I2C_ROUTELOC0_RESETVALUE 0x00000000UL /**< Default value for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_MASK 0x00001F1FUL /**< Mask for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_SHIFT 0 /**< Shift value for I2C_SDALOC */ #define _I2C_ROUTELOC0_SDALOC_MASK 0x1FUL /**< Bit mask for I2C_SDALOC */ #define _I2C_ROUTELOC0_SDALOC_LOC0 0x00000000UL /**< Mode LOC0 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC1 0x00000001UL /**< Mode LOC1 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC2 0x00000002UL /**< Mode LOC2 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC3 0x00000003UL /**< Mode LOC3 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC4 0x00000004UL /**< Mode LOC4 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC5 0x00000005UL /**< Mode LOC5 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC6 0x00000006UL /**< Mode LOC6 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC7 0x00000007UL /**< Mode LOC7 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC8 0x00000008UL /**< Mode LOC8 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC9 0x00000009UL /**< Mode LOC9 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC10 0x0000000AUL /**< Mode LOC10 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC11 0x0000000BUL /**< Mode LOC11 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC12 0x0000000CUL /**< Mode LOC12 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC13 0x0000000DUL /**< Mode LOC13 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC14 0x0000000EUL /**< Mode LOC14 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC15 0x0000000FUL /**< Mode LOC15 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC16 0x00000010UL /**< Mode LOC16 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC17 0x00000011UL /**< Mode LOC17 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC18 0x00000012UL /**< Mode LOC18 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC19 0x00000013UL /**< Mode LOC19 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC20 0x00000014UL /**< Mode LOC20 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC21 0x00000015UL /**< Mode LOC21 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC22 0x00000016UL /**< Mode LOC22 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC23 0x00000017UL /**< Mode LOC23 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC24 0x00000018UL /**< Mode LOC24 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC25 0x00000019UL /**< Mode LOC25 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC26 0x0000001AUL /**< Mode LOC26 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC27 0x0000001BUL /**< Mode LOC27 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC28 0x0000001CUL /**< Mode LOC28 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC29 0x0000001DUL /**< Mode LOC29 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC30 0x0000001EUL /**< Mode LOC30 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SDALOC_LOC31 0x0000001FUL /**< Mode LOC31 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC0 (_I2C_ROUTELOC0_SDALOC_LOC0 << 0) /**< Shifted mode LOC0 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_DEFAULT (_I2C_ROUTELOC0_SDALOC_DEFAULT << 0) /**< Shifted mode DEFAULT for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC1 (_I2C_ROUTELOC0_SDALOC_LOC1 << 0) /**< Shifted mode LOC1 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC2 (_I2C_ROUTELOC0_SDALOC_LOC2 << 0) /**< Shifted mode LOC2 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC3 (_I2C_ROUTELOC0_SDALOC_LOC3 << 0) /**< Shifted mode LOC3 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC4 (_I2C_ROUTELOC0_SDALOC_LOC4 << 0) /**< Shifted mode LOC4 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC5 (_I2C_ROUTELOC0_SDALOC_LOC5 << 0) /**< Shifted mode LOC5 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC6 (_I2C_ROUTELOC0_SDALOC_LOC6 << 0) /**< Shifted mode LOC6 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC7 (_I2C_ROUTELOC0_SDALOC_LOC7 << 0) /**< Shifted mode LOC7 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC8 (_I2C_ROUTELOC0_SDALOC_LOC8 << 0) /**< Shifted mode LOC8 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC9 (_I2C_ROUTELOC0_SDALOC_LOC9 << 0) /**< Shifted mode LOC9 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC10 (_I2C_ROUTELOC0_SDALOC_LOC10 << 0) /**< Shifted mode LOC10 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC11 (_I2C_ROUTELOC0_SDALOC_LOC11 << 0) /**< Shifted mode LOC11 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC12 (_I2C_ROUTELOC0_SDALOC_LOC12 << 0) /**< Shifted mode LOC12 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC13 (_I2C_ROUTELOC0_SDALOC_LOC13 << 0) /**< Shifted mode LOC13 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC14 (_I2C_ROUTELOC0_SDALOC_LOC14 << 0) /**< Shifted mode LOC14 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC15 (_I2C_ROUTELOC0_SDALOC_LOC15 << 0) /**< Shifted mode LOC15 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC16 (_I2C_ROUTELOC0_SDALOC_LOC16 << 0) /**< Shifted mode LOC16 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC17 (_I2C_ROUTELOC0_SDALOC_LOC17 << 0) /**< Shifted mode LOC17 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC18 (_I2C_ROUTELOC0_SDALOC_LOC18 << 0) /**< Shifted mode LOC18 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC19 (_I2C_ROUTELOC0_SDALOC_LOC19 << 0) /**< Shifted mode LOC19 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC20 (_I2C_ROUTELOC0_SDALOC_LOC20 << 0) /**< Shifted mode LOC20 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC21 (_I2C_ROUTELOC0_SDALOC_LOC21 << 0) /**< Shifted mode LOC21 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC22 (_I2C_ROUTELOC0_SDALOC_LOC22 << 0) /**< Shifted mode LOC22 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC23 (_I2C_ROUTELOC0_SDALOC_LOC23 << 0) /**< Shifted mode LOC23 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC24 (_I2C_ROUTELOC0_SDALOC_LOC24 << 0) /**< Shifted mode LOC24 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC25 (_I2C_ROUTELOC0_SDALOC_LOC25 << 0) /**< Shifted mode LOC25 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC26 (_I2C_ROUTELOC0_SDALOC_LOC26 << 0) /**< Shifted mode LOC26 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC27 (_I2C_ROUTELOC0_SDALOC_LOC27 << 0) /**< Shifted mode LOC27 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC28 (_I2C_ROUTELOC0_SDALOC_LOC28 << 0) /**< Shifted mode LOC28 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC29 (_I2C_ROUTELOC0_SDALOC_LOC29 << 0) /**< Shifted mode LOC29 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC30 (_I2C_ROUTELOC0_SDALOC_LOC30 << 0) /**< Shifted mode LOC30 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SDALOC_LOC31 (_I2C_ROUTELOC0_SDALOC_LOC31 << 0) /**< Shifted mode LOC31 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_SHIFT 8 /**< Shift value for I2C_SCLLOC */ #define _I2C_ROUTELOC0_SCLLOC_MASK 0x1F00UL /**< Bit mask for I2C_SCLLOC */ #define _I2C_ROUTELOC0_SCLLOC_LOC0 0x00000000UL /**< Mode LOC0 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_DEFAULT 0x00000000UL /**< Mode DEFAULT for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC1 0x00000001UL /**< Mode LOC1 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC2 0x00000002UL /**< Mode LOC2 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC3 0x00000003UL /**< Mode LOC3 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC4 0x00000004UL /**< Mode LOC4 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC5 0x00000005UL /**< Mode LOC5 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC6 0x00000006UL /**< Mode LOC6 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC7 0x00000007UL /**< Mode LOC7 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC8 0x00000008UL /**< Mode LOC8 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC9 0x00000009UL /**< Mode LOC9 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC10 0x0000000AUL /**< Mode LOC10 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC11 0x0000000BUL /**< Mode LOC11 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC12 0x0000000CUL /**< Mode LOC12 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC13 0x0000000DUL /**< Mode LOC13 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC14 0x0000000EUL /**< Mode LOC14 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC15 0x0000000FUL /**< Mode LOC15 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC16 0x00000010UL /**< Mode LOC16 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC17 0x00000011UL /**< Mode LOC17 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC18 0x00000012UL /**< Mode LOC18 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC19 0x00000013UL /**< Mode LOC19 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC20 0x00000014UL /**< Mode LOC20 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC21 0x00000015UL /**< Mode LOC21 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC22 0x00000016UL /**< Mode LOC22 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC23 0x00000017UL /**< Mode LOC23 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC24 0x00000018UL /**< Mode LOC24 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC25 0x00000019UL /**< Mode LOC25 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC26 0x0000001AUL /**< Mode LOC26 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC27 0x0000001BUL /**< Mode LOC27 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC28 0x0000001CUL /**< Mode LOC28 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC29 0x0000001DUL /**< Mode LOC29 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC30 0x0000001EUL /**< Mode LOC30 for I2C_ROUTELOC0 */ #define _I2C_ROUTELOC0_SCLLOC_LOC31 0x0000001FUL /**< Mode LOC31 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC0 (_I2C_ROUTELOC0_SCLLOC_LOC0 << 8) /**< Shifted mode LOC0 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_DEFAULT (_I2C_ROUTELOC0_SCLLOC_DEFAULT << 8) /**< Shifted mode DEFAULT for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC1 (_I2C_ROUTELOC0_SCLLOC_LOC1 << 8) /**< Shifted mode LOC1 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC2 (_I2C_ROUTELOC0_SCLLOC_LOC2 << 8) /**< Shifted mode LOC2 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC3 (_I2C_ROUTELOC0_SCLLOC_LOC3 << 8) /**< Shifted mode LOC3 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC4 (_I2C_ROUTELOC0_SCLLOC_LOC4 << 8) /**< Shifted mode LOC4 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC5 (_I2C_ROUTELOC0_SCLLOC_LOC5 << 8) /**< Shifted mode LOC5 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC6 (_I2C_ROUTELOC0_SCLLOC_LOC6 << 8) /**< Shifted mode LOC6 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC7 (_I2C_ROUTELOC0_SCLLOC_LOC7 << 8) /**< Shifted mode LOC7 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC8 (_I2C_ROUTELOC0_SCLLOC_LOC8 << 8) /**< Shifted mode LOC8 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC9 (_I2C_ROUTELOC0_SCLLOC_LOC9 << 8) /**< Shifted mode LOC9 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC10 (_I2C_ROUTELOC0_SCLLOC_LOC10 << 8) /**< Shifted mode LOC10 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC11 (_I2C_ROUTELOC0_SCLLOC_LOC11 << 8) /**< Shifted mode LOC11 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC12 (_I2C_ROUTELOC0_SCLLOC_LOC12 << 8) /**< Shifted mode LOC12 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC13 (_I2C_ROUTELOC0_SCLLOC_LOC13 << 8) /**< Shifted mode LOC13 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC14 (_I2C_ROUTELOC0_SCLLOC_LOC14 << 8) /**< Shifted mode LOC14 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC15 (_I2C_ROUTELOC0_SCLLOC_LOC15 << 8) /**< Shifted mode LOC15 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC16 (_I2C_ROUTELOC0_SCLLOC_LOC16 << 8) /**< Shifted mode LOC16 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC17 (_I2C_ROUTELOC0_SCLLOC_LOC17 << 8) /**< Shifted mode LOC17 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC18 (_I2C_ROUTELOC0_SCLLOC_LOC18 << 8) /**< Shifted mode LOC18 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC19 (_I2C_ROUTELOC0_SCLLOC_LOC19 << 8) /**< Shifted mode LOC19 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC20 (_I2C_ROUTELOC0_SCLLOC_LOC20 << 8) /**< Shifted mode LOC20 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC21 (_I2C_ROUTELOC0_SCLLOC_LOC21 << 8) /**< Shifted mode LOC21 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC22 (_I2C_ROUTELOC0_SCLLOC_LOC22 << 8) /**< Shifted mode LOC22 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC23 (_I2C_ROUTELOC0_SCLLOC_LOC23 << 8) /**< Shifted mode LOC23 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC24 (_I2C_ROUTELOC0_SCLLOC_LOC24 << 8) /**< Shifted mode LOC24 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC25 (_I2C_ROUTELOC0_SCLLOC_LOC25 << 8) /**< Shifted mode LOC25 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC26 (_I2C_ROUTELOC0_SCLLOC_LOC26 << 8) /**< Shifted mode LOC26 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC27 (_I2C_ROUTELOC0_SCLLOC_LOC27 << 8) /**< Shifted mode LOC27 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC28 (_I2C_ROUTELOC0_SCLLOC_LOC28 << 8) /**< Shifted mode LOC28 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC29 (_I2C_ROUTELOC0_SCLLOC_LOC29 << 8) /**< Shifted mode LOC29 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC30 (_I2C_ROUTELOC0_SCLLOC_LOC30 << 8) /**< Shifted mode LOC30 for I2C_ROUTELOC0 */ #define I2C_ROUTELOC0_SCLLOC_LOC31 (_I2C_ROUTELOC0_SCLLOC_LOC31 << 8) /**< Shifted mode LOC31 for I2C_ROUTELOC0 */ /** @} */ /** @} End of group EFR32FG1P_I2C */ /** @} End of group Parts */ #ifdef __cplusplus } #endif
basilfx/EFM2Riot
dist/cpu/efm32/families/efr32fg1p/include/vendor/efr32fg1p_i2c.h
C
mit
96,253
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BasicRestServer")] [assembly: AssemblyDescription("A very basic HTTP REST server implementation")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BasicRestServer")] [assembly: AssemblyCopyright("Copyright © Marcin Badurowicz 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("2685f4c6-8465-46dd-aef0-8f819da236e7")] [assembly: AssemblyVersion("${GfvSemVer}")] [assembly: AssemblyFileVersion("${GfvAssemblySemVer}")] [assembly: AssemblyInformationalVersion("${GfvFullSemVer}.${GfvBranchName}.${ShortSha}")]
ktos/BasicRestServer
BasicRestServer/Properties/AssemblyInfo.template.cs
C#
mit
1,274
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- from msrest.serialization import Model class DeploymentProperties(Model): """Deployment properties. :param template: The template content. It can be a JObject or a well formed JSON string. Use only one of Template or TemplateLink. :type template: object :param template_link: The template URI. Use only one of Template or TemplateLink. :type template_link: :class:`TemplateLink <azure.mgmt.resource.resources.v2016_02_01.models.TemplateLink>` :param parameters: Deployment parameters. It can be a JObject or a well formed JSON string. Use only one of Parameters or ParametersLink. :type parameters: object :param parameters_link: The parameters URI. Use only one of Parameters or ParametersLink. :type parameters_link: :class:`ParametersLink <azure.mgmt.resource.resources.v2016_02_01.models.ParametersLink>` :param mode: The deployment mode. Possible values include: 'Incremental', 'Complete' :type mode: str or :class:`DeploymentMode <azure.mgmt.resource.resources.v2016_02_01.models.DeploymentMode>` :param debug_setting: The debug setting of the deployment. :type debug_setting: :class:`DebugSetting <azure.mgmt.resource.resources.v2016_02_01.models.DebugSetting>` """ _validation = { 'mode': {'required': True}, } _attribute_map = { 'template': {'key': 'template', 'type': 'object'}, 'template_link': {'key': 'templateLink', 'type': 'TemplateLink'}, 'parameters': {'key': 'parameters', 'type': 'object'}, 'parameters_link': {'key': 'parametersLink', 'type': 'ParametersLink'}, 'mode': {'key': 'mode', 'type': 'DeploymentMode'}, 'debug_setting': {'key': 'debugSetting', 'type': 'DebugSetting'}, } def __init__(self, mode, template=None, template_link=None, parameters=None, parameters_link=None, debug_setting=None): self.template = template self.template_link = template_link self.parameters = parameters self.parameters_link = parameters_link self.mode = mode self.debug_setting = debug_setting
v-iam/azure-sdk-for-python
azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/deployment_properties.py
Python
mit
2,606
/* * Copyright 2017 Dgraph Labs, Inc. and Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package y import ( "bytes" "encoding/binary" "hash/crc32" "math" "os" "sync" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" ) // ErrEOF indicates an end of file when trying to read from a memory mapped file // and encountering the end of slice. var ErrEOF = errors.New("End of mapped region") var ( // This is O_DSYNC (datasync) on platforms that support it -- see file_unix.go datasyncFileFlag = 0x0 // CastagnoliCrcTable is a CRC32 polynomial table CastagnoliCrcTable = crc32.MakeTable(crc32.Castagnoli) ) // OpenExistingSyncedFile opens an existing file, errors if it doesn't exist. func OpenExistingSyncedFile(filename string, sync bool) (*os.File, error) { flags := os.O_RDWR if sync { flags |= datasyncFileFlag } return os.OpenFile(filename, flags, 0) } // CreateSyncedFile creates a new file (using O_EXCL), errors if it already existed. func CreateSyncedFile(filename string, sync bool) (*os.File, error) { flags := os.O_RDWR | os.O_CREATE | os.O_EXCL if sync { flags |= datasyncFileFlag } return os.OpenFile(filename, flags, 0666) } // OpenSyncedFile creates the file if one doesn't exist. func OpenSyncedFile(filename string, sync bool) (*os.File, error) { flags := os.O_RDWR | os.O_CREATE if sync { flags |= datasyncFileFlag } return os.OpenFile(filename, flags, 0666) } // OpenTruncFile opens the file with O_RDWR | O_CREATE | O_TRUNC func OpenTruncFile(filename string, sync bool) (*os.File, error) { flags := os.O_RDWR | os.O_CREATE | os.O_TRUNC if sync { flags |= datasyncFileFlag } return os.OpenFile(filename, flags, 0666) } // SafeCopy does append(a[:0], src...). func SafeCopy(a []byte, src []byte) []byte { return append(a[:0], src...) } // Copy copies a byte slice and returns the copied slice. func Copy(a []byte) []byte { b := make([]byte, len(a)) copy(b, a) return b } // KeyWithTs generates a new key by appending ts to key. func KeyWithTs(key []byte, ts uint64) []byte { out := make([]byte, len(key)+8) copy(out, key) binary.BigEndian.PutUint64(out[len(key):], math.MaxUint64-ts) return out } // ParseTs parses the timestamp from the key bytes. func ParseTs(key []byte) uint64 { if len(key) <= 8 { return 0 } return math.MaxUint64 - binary.BigEndian.Uint64(key[len(key)-8:]) } // CompareKeys checks the key without timestamp and checks the timestamp if keyNoTs // is same. // a<timestamp> would be sorted higher than aa<timestamp> if we use bytes.compare // All keys should have timestamp. func CompareKeys(key1 []byte, key2 []byte) int { AssertTrue(len(key1) > 8 && len(key2) > 8) if cmp := bytes.Compare(key1[:len(key1)-8], key2[:len(key2)-8]); cmp != 0 { return cmp } return bytes.Compare(key1[len(key1)-8:], key2[len(key2)-8:]) } // ParseKey parses the actual key from the key bytes. func ParseKey(key []byte) []byte { if key == nil { return nil } AssertTruef(len(key) > 8, "key=%q", key) return key[:len(key)-8] } // SameKey checks for key equality ignoring the version timestamp suffix. func SameKey(src, dst []byte) bool { if len(src) != len(dst) { return false } return bytes.Equal(ParseKey(src), ParseKey(dst)) } // Slice holds a reusable buf, will reallocate if you request a larger size than ever before. // One problem is with n distinct sizes in random order it'll reallocate log(n) times. type Slice struct { buf []byte } // Resize reuses the Slice's buffer (or makes a new one) and returns a slice in that buffer of // length sz. func (s *Slice) Resize(sz int) []byte { if cap(s.buf) < sz { s.buf = make([]byte, sz) } return s.buf[0:sz] } // Closer holds the two things we need to close a goroutine and wait for it to finish: a chan // to tell the goroutine to shut down, and a WaitGroup with which to wait for it to finish shutting // down. type Closer struct { closed chan struct{} waiting sync.WaitGroup } // NewCloser constructs a new Closer, with an initial count on the WaitGroup. func NewCloser(initial int) *Closer { ret := &Closer{closed: make(chan struct{})} ret.waiting.Add(initial) return ret } // AddRunning Add()'s delta to the WaitGroup. func (lc *Closer) AddRunning(delta int) { lc.waiting.Add(delta) } // Signal signals the HasBeenClosed signal. func (lc *Closer) Signal() { close(lc.closed) } // HasBeenClosed gets signaled when Signal() is called. func (lc *Closer) HasBeenClosed() <-chan struct{} { return lc.closed } // Done calls Done() on the WaitGroup. func (lc *Closer) Done() { lc.waiting.Done() } // Wait waits on the WaitGroup. (It waits for NewCloser's initial value, AddRunning, and Done // calls to balance out.) func (lc *Closer) Wait() { lc.waiting.Wait() } // SignalAndWait calls Signal(), then Wait(). func (lc *Closer) SignalAndWait() { lc.Signal() lc.Wait() }
hoffmabc/openbazaar-go
vendor/gx/ipfs/QmdKhi5wUQyV9i3GcTyfUmpfTntWjXu8DcyT9HyNbznYrn/badger/y/y.go
GO
mit
5,386
// // CreditCardInputViewController.h // BitStore // // Created by Dylan Marriott on 26.07.14. // Copyright (c) 2014 Dylan Marriott. All rights reserved. // #import <Foundation/Foundation.h> @class Order; @interface CreditCardInputViewController : UITableViewController - (id)init UNAVAILABLE_ATTRIBUTE; - (id)initWithStyle:(UITableViewStyle)style UNAVAILABLE_ATTRIBUTE; - (id)initWithOrder:(Order *)order; @end
BitStore/BitStore-iOS
BitStore/Controller/Buy/CreditCardInputViewController.h
C
mit
421
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace spec\Sylius\Bundle\OrderBundle\StateMachineCallback; use PhpSpec\ObjectBehavior; use Sylius\Bundle\OrderBundle\StateMachineCallback\CompleteOrderCallback; use Sylius\Component\Order\Model\OrderInterface; final class CompleteOrderCallbackSpec extends ObjectBehavior { function it_is_initializable() { $this->shouldHaveType(CompleteOrderCallback::class); } function it_completes_an_order(OrderInterface $order) { $order->complete()->shouldBeCalled(); $this->completeOrder($order); } }
patrick-mcdougle/Sylius
src/Sylius/Bundle/OrderBundle/spec/StateMachineCallback/CompleteOrderCallbackSpec.php
PHP
mit
765
//! Bindings for [netfilter_queue](http://netfilter.org/projects/libnetfilter_queue/doxygen/index.html) //! //! These bindings allow you to have access to the `QUEUE` and `NFQUEUE`, set in `iptables`, //! and write your own userspace programs to process these queues. #![deny(missing_docs)] extern crate libc; extern crate num; #[macro_use] extern crate lazy_static; mod ffi; mod error; mod util; mod lock; pub mod handle; pub mod queue; pub mod message; //#[cfg(test)] //mod test;
steveklabnik/libnetfilter_queue
src/lib.rs
Rust
mit
487
using System; namespace Core { }
BclEx/GpuStructs
src/SystemL.Data.net/Opcodes.cs
C#
mit
37
<section data-ng-controller="GeosController" data-ng-init="findOne()"> <div class="page-header"> <h1>Edit Geo</h1> </div> <div class="col-md-12"> <form class="form-horizontal" data-ng-submit="update()" novalidate> <fieldset> <div class="form-group"> <label class="control-label" for="name">Name</label> <div class="controls"> <input type="text" data-ng-model="geo.name" id="name" class="form-control" placeholder="Name" required> </div> </div> <div class="form-group"> <input type="submit" value="Update" class="btn btn-default"> </div> <div data-ng-show="error" class="text-danger"> <strong data-ng-bind="error"></strong> </div> </fieldset> </form> </div> </section>
dpxxdp/floo-server
public/modules/geos/views/edit-geo.client.view.html
HTML
mit
912
import * as m from './model' import * as f from './factories' export function filterModules(moduleNames: string[]|((moduleName: string) => boolean), modules: m.KeyValue<f.ModuleFactory>): m.KeyValue<f.ModuleFactory> { // TODO: Temporary hack to get a demo ready return modules // let filteredModules: m.KeyValue<f.ModuleFactory> = {} // // function processTypeContainer(container: f.ContainerFactory) { // Object.keys(container.classConstructors).forEach(function(clsName) { // processClass(container.classConstructors[clsName]) // }) // // Object.keys(container.interfaceConstructors).forEach(function(intName) { // processInterface(container.interfaceConstructors[intName]) // }) // // Object.keys(container.enums).forEach(function(name) { // processEnum(container.enums[name]) // }) // // Object.keys(container.typeAliasConstructors).forEach(function(name) { // processTypeAliasConstructor(container.typeAliasConstructors[name]) // }) // // Object.keys(container.namespaces).forEach(function(name) { // processTypeContainer(container.namespaces[name]) // }) // // Object.keys(container.values).forEach(function(name) { // processValue(container.values[name]) // }) // } // // function processDecorator(decorator: f.DecoratorFactory<any>) { // copy(decorator.decoratorType) // if (decorator.parameters) { // decorator.parameters.forEach(function(parameter) { // processExpression(parameter) // }) // } // } // // function processValue(value: f.ValueFactory<any>) { // // } // // function processEnum(e: f.EnumFactory) { // processType(e) // // TODO Process initializers // } // // function processTypeAliasConstructor(typeAliasConstructor: f.TypeAliasConstructorFactory<any>) { // processType(typeAliasConstructor.type) // } // // function processExpression(expr: f.ExpressionFactory<any>) { // switch (expr.expressionKind) { // case m.ExpressionKind.CLASS_REFERENCE: // copy((<f.ClassReferenceExpressionFactory>expr).classReference) // break // case m.ExpressionKind.OBJECT: // let obj = <m.RawObjectExpression>expr // Object.keys(obj.properties).forEach(function(name) { // processExpression(obj.properties[name]) // }) // break // case m.ExpressionKind.ARRAY: // let arr = <m.RawArrayExpression>expr // arr.elements.forEach(function(expr) { // processExpression(expr) // }) // break // } // } // // function processClass(cls: f.ClassConstructorFactory) { // processType(cls.instanceType) // processType(cls.staticType) // // if (cls.extends) { // processType(cls.extends) // } // if (cls.implements) { // cls.implements.forEach(function(type) { // processType(type) // }) // } // if (cls.typeParameters) { // cls.typeParameters.forEach(function(typeParameter) { // if (typeParameter.extends) { // processType(typeParameter.extends) // } // }) // } // // if (cls.decorators) { // cls.decorators.forEach(function(decorator) { // processDecorator(decorator) // }) // } // } // // function processInterface(int: f.InterfaceConstructorFactory) { // processType(int.instanceType) // // if (int.extends) { // int.extends.forEach(function(type) { // processType(type) // }) // } // if (int.typeParameters) { // int.typeParameters.forEach(function(typeParameter) { // if (typeParameter.extends) { // processType(typeParameter.extends) // } // }) // } // } // // function processType(ref: f.TypeFactory<any>) { // if ((<m.TypeTemplate>ref).typeKind) { // let type = <m.TypeTemplate>ref // switch (type.typeKind) { // case m.TypeKind.TYPE_QUERY: // if ((<m.RawTypeQuery>ref).type) { // copyReference((<m.RawTypeQuery>ref).type) // } // break // case m.TypeKind.FUNCTION: // let f = <m.RawFunctionType>ref // f.parameters.forEach(function(parameter) { // if ((<m.RawDecoratedParameter>parameter).decorators) { // (<m.RawDecoratedParameter>parameter).decorators.forEach(processDecorator) // } // processType(parameter.type) // }) // if (f.typeParameters) { // f.typeParameters.forEach(function(typeParameter) { // if (typeParameter.extends) { // processType(typeParameter.extends) // } // }) // } // if (f.type) { // processType(f.type) // } // break // case m.TypeKind.TUPLE: // (<m.RawTupleType>ref).elements.forEach(function(type) { // processType(type) // }) // break // case m.TypeKind.UNION: // (<m.RawUnionType>ref).types.forEach(function(type) { // processType(type) // }) // break // case m.TypeKind.COMPOSITE: // let composite = <m.RawCompositeType>ref // Object.keys(composite.members).forEach(function(name) { // let member = composite.members[name] // processType(member.type) // if ((<m.RawDecoratedMember>member).decorators) { // (<m.RawDecoratedMember>member).decorators.forEach(processDecorator) // } // }) // if (composite.index) { // processType(composite.index.valueType) // } // if (composite.calls) { // composite.calls.forEach(processType) // } // break // } // } else if ((<m.RefinedReference>ref).reference) { // let rr = <m.RefinedReference>ref // copy(rr.reference) // rr.typeArguments.forEach(function(typeArg) { // processType(typeArg) // }) // } else { // copy(ref) // } // } // // function copy(factory:f.Factory<any>) { // switch (factory.modelKind) { // case m.ModelKind.CLASS_CONSTRUCTOR: // case m.ModelKind.INTERFACE_CONSTRUCTOR: // case m.ModelKind.TYPE_ALIAS_CONSTRUCTOR: // case m.ModelKind.VALUE: // return copyContained(<f.ContainedFactory<any>>factory) // case m.ModelKind.TYPE: // if ((<f.TypeFactory<any>>factory).typeKind === m.TypeKind.ENUM) { // return copyContained(<f.ContainedFactory<any>>factory) // } // } // } // // function copyContained(ref: f.ContainedFactory<any>) { // let parent = ref.parent // let parents = [parent] // while (parent.containerKind === m.ContainerKind.NAMESPACE) { // parent = ref.parent // parents.splice(0, 0, parent) // } // let filteredContainer:f.ContainerFactory = filteredModules[parent[0].name] // if (!filteredContainer) { // filteredContainer = new f.ModuleFactory(parent[0].name) // filteredModules[parent[0].name] = <f.ModuleFactory>filteredContainer // } // for (let i = 1; i < parents.length; i++) { // filteredContainer = filteredContainer.addNamespace(parents[i].name) // } // switch (ref.modelKind) { // case m.ModelKind.CLASS_CONSTRUCTOR: // let filteredClass = filteredContainer.addClassConstructor(ref.name) // let cc = <f.ClassConstructorFactory>ref // filteredClass.implements = cc.implements // filteredClass.extends = cc.extends // cc.instanceType // case m.ModelKind.INTERFACE_CONSTRUCTOR: // case m.ModelKind.TYPE_ALIAS_CONSTRUCTOR: // case m.ModelKind.TYPE: // case m.ModelKind.VALUE: // } // } // // function copyComposite(orig:f.DecoratedCompositeTypeFactory<any>, filtered:f.DecoratedCompositeTypeFactory<any>) { // Object.keys(orig.members).forEach(function(name){ // let member = orig.members[name] // let fMember = filtered.addMember(name) // fMember.type = member.type // }) // } // // // function copyReference(ref: m.Reference) { // // let split = ref.module.split(':') // // let namespaces: string[] // // let moduleName = split[0] // // // // if (split.length > 1) { // // split.shift() // // namespaces = split // // } // // // // if (ref.module !== '@') { // // let refMod = modules[moduleName] // // if (!refMod) { // // refMod = modules[''].namespaces[moduleName] // // } // // let mod = refMod // // let _mod = filteredModules[moduleName] // // if (!_mod) { // // _mod = createRawTypeContainer() // // filteredModules[moduleName] = <m.RawTypeContainer>_mod // // } // // if (namespaces) { // // for (let i = 0; i < namespaces.length; i++) { // // mod = mod.namespaces[namespaces[i]] // // _mod = _mod.namespaces[namespaces[i]] // // if (!_mod) { // // let __mod = _mod // // _mod = createRawTypeContainer() // // __mod.namespaces[namespaces[i]] = <m.RawTypeContainer>_mod // // } // // } // // } // // if (mod.classConstructors[ref.name]) { // // if (!_mod.classConstructors[ref.name]) { // // _mod.classConstructors[ref.name] = mod.classConstructors[ref.name] // // processClass(mod.classConstructors[ref.name]) // // } // // } else if (mod.interfaceConstructors[ref.name]) { // // if (!_mod.interfaceConstructors[ref.name]) { // // _mod.interfaceConstructors[ref.name] = mod.interfaceConstructors[ref.name] // // processInterface(mod.interfaceConstructors[ref.name]) // // } // // } else if (mod.types[ref.name]) { // // if (!_mod.types[ref.name]) { // // _mod.types[ref.name] = mod.types[ref.name] // // processTypeAlias(mod.types[ref.name]) // // } // // } else if (mod.statics[ref.name]) { // // if (!_mod.statics[ref.name]) { // // _mod.statics[ref.name] = mod.statics[ref.name] // // processType(mod.statics[ref.name].type) // // } // // } else if (mod.reexports[ref.name]) { // // if (!_mod.reexports[ref.name]) { // // _mod.reexports[ref.name] = mod.reexports[ref.name] // // copyReference(mod.reexports[ref.name]) // // } // // } else { // // throw new Error('Cannot find entity ' + ref.module + ':' + ref.name) // // } // // } // // } // // if ((<((moduleName: string) => boolean)>moduleNames).bind) { // let f = <((moduleName: string) => boolean)>moduleNames // Object.keys(modules).forEach(function(moduleName) { // if (f(moduleName)) { // filteredModules[moduleName] = modules[moduleName] // processTypeContainer(modules[moduleName]) // } // }) // } else { // (<string[]>moduleNames).forEach(function(moduleName) { // filteredModules[moduleName] = modules[moduleName] // processTypeContainer(modules[moduleName]) // }) // } // // return filteredModules }
christyharagan/ts-schema
src/lib/filter.ts
TypeScript
mit
11,311
require_relative "../spec_helper_lite.rb" require_relative "../helpers/shared_specs_helper" module DisplayCase shared_examples_for 'a class comparator' do describe "DisplayCase Class Comparators" do it 'identifies when an object is of a given class' do object = TestClass.new comparator.call(object, TestClass).must_equal true end it 'identifies when an object is not of a given class' do object = OtherTestClass.new comparator.call(object, TestClass).must_equal false end it 'identifies when an object is of any of a list classes' do object = OtherTestClass.new comparator.call(object, TestClass, OtherTestClass).must_equal true end it 'identifies when an object is of a class including a given module' do object = TestClassIncludingModule.new comparator.call(object, TestClassIncludingModule).must_equal true end it 'identifies objects when classes are given as names' do object = TestClass.new comparator.call(object, 'DisplayCase::TestClass').must_equal true comparator.call(object, 'DisplayCase::OtherTestClass').must_equal false end it 'identifies objects when classes are given as symbols' do object = TestClass.new comparator.call(object, :'DisplayCase::TestClass').must_equal true comparator.call(object, :'DisplayCase::OtherTestClass').must_equal false end class TestClass end class OtherTestClass end module TestModule end class TestClassIncludingModule include TestModule end end end end
objects-on-rails/display-case
spec/display_case/class_comparator_shared_examples.rb
Ruby
mit
1,661
package net.ontrack.extension.git.client.impl; import net.ontrack.extension.git.client.GitClient; import net.ontrack.extension.git.client.GitClientFactory; import net.ontrack.extension.git.model.GitConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class DefaultGitClientFactory implements GitClientFactory { private final GitRepositoryManager repositoryManager; @Autowired public DefaultGitClientFactory(GitRepositoryManager repositoryManager) { this.repositoryManager = repositoryManager; } @Override public GitClient getClient(GitConfiguration gitConfiguration) { // Repository GitRepository repository = repositoryManager.getRepository( gitConfiguration.getRemote(), gitConfiguration.getBranch()); // Client return new DefaultGitClient(repository, gitConfiguration); } }
joansmith/ontrack
ontrack-extension/ontrack-extension-git/src/main/java/net/ontrack/extension/git/client/impl/DefaultGitClientFactory.java
Java
mit
975
module Enumerable def all?(&block) %x{ var result = true; if (block !== nil) { self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.falsy?(`value`)}) { result = false; return $breaker; } }; } else { self.$each.$$p = function(obj) { if (arguments.length == 1 && #{Opal.falsy?(`obj`)}) { result = false; return $breaker; } }; } self.$each(); return result; } end def any?(&block) %x{ var result = false; if (block !== nil) { self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result = true; return $breaker; } }; } else { self.$each.$$p = function(obj) { if (arguments.length != 1 || #{Opal.truthy?(`obj`)}) { result = true; return $breaker; } } } self.$each(); return result; } end def chunk(state = undefined, &block) raise NotImplementedError end def collect(&block) return enum_for(:collect){self.enumerator_size} unless block_given? %x{ var result = []; self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } result.push(value); }; self.$each(); return result; } end def collect_concat(&block) return enum_for(:collect_concat){self.enumerator_size} unless block_given? map { |item| yield item }.flatten(1) end def count(object = undefined, &block) %x{ var result = 0; if (object != null) { block = function() { return #{Opal.destructure(`arguments`) == `object`}; }; } else if (block === nil) { block = function() { return true; }; } self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result++; } } self.$each(); return result; } end def cycle(n = nil, &block) return enum_for(:cycle, n) { if n == nil respond_to?(:size) ? Float::INFINITY : nil else n = Opal.coerce_to!(n, Integer, :to_int) n > 0 ? self.enumerator_size * n : 0 end } unless block_given? unless n.nil? n = Opal.coerce_to! n, Integer, :to_int return if `n <= 0` end %x{ var result, all = [], i, length, value; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } all.push(param); } self.$each(); if (result !== undefined) { return result; } if (all.length === 0) { return nil; } if (n === nil) { while (true) { for (i = 0, length = all.length; i < length; i++) { value = Opal.yield1(block, all[i]); if (value === $breaker) { return $breaker.$v; } } } } else { while (n > 1) { for (i = 0, length = all.length; i < length; i++) { value = Opal.yield1(block, all[i]); if (value === $breaker) { return $breaker.$v; } } n--; } } } end def detect(ifnone = undefined, &block) return enum_for :detect, ifnone unless block_given? %x{ var result; self.$each.$$p = function() { var params = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, params); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result = params; return $breaker; } }; self.$each(); if (result === undefined && ifnone !== undefined) { if (typeof(ifnone) === 'function') { result = ifnone(); } else { result = ifnone; } } return result === undefined ? nil : result; } end def drop(number) number = Opal.coerce_to number, Integer, :to_int if `number < 0` raise ArgumentError, "attempt to drop negative size" end %x{ var result = [], current = 0; self.$each.$$p = function() { if (number <= current) { result.push(#{Opal.destructure(`arguments`)}); } current++; }; self.$each() return result; } end def drop_while(&block) return enum_for :drop_while unless block_given? %x{ var result = [], dropping = true; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (dropping) { var value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.falsy?(`value`)}) { dropping = false; result.push(param); } } else { result.push(param); } }; self.$each(); return result; } end def each_cons(n, &block) raise NotImplementedError end def each_entry(&block) raise NotImplementedError end def each_slice(n, &block) n = Opal.coerce_to n, Integer, :to_int if `n <= 0` raise ArgumentError, 'invalid slice size' end return enum_for(:each_slice, n){respond_to?(:size) ? (size / n).ceil : nil} unless block_given? %x{ var result, slice = [] self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; slice.push(param); if (slice.length === n) { if (Opal.yield1(block, slice) === $breaker) { result = $breaker.$v; return $breaker; } slice = []; } }; self.$each(); if (result !== undefined) { return result; } // our "last" group, if smaller than n then won't have been yielded if (slice.length > 0) { if (Opal.yield1(block, slice) === $breaker) { return $breaker.$v; } } } nil end def each_with_index(*args, &block) return enum_for(:each_with_index, *args){self.enumerator_size} unless block_given? %x{ var result, index = 0; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = block(param, index); if (value === $breaker) { result = $breaker.$v; return $breaker; } index++; }; self.$each.apply(self, args); if (result !== undefined) { return result; } } self end def each_with_object(object, &block) return enum_for(:each_with_object, object){self.enumerator_size} unless block_given? %x{ var result; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = block(param, object); if (value === $breaker) { result = $breaker.$v; return $breaker; } }; self.$each(); if (result !== undefined) { return result; } } object end def entries(*args) %x{ var result = []; self.$each.$$p = function() { result.push(#{Opal.destructure(`arguments`)}); }; self.$each.apply(self, args); return result; } end alias find detect def find_all(&block) return enum_for(:find_all){self.enumerator_size} unless block_given? %x{ var result = []; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result.push(param); } }; self.$each(); return result; } end def find_index(object = undefined, &block) return enum_for :find_index if `object === undefined && block === nil` %x{ var result = nil, index = 0; if (object != null) { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (#{`param` == `object`}) { result = index; return $breaker; } index += 1; }; } else if (block !== nil) { self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result = index; return $breaker; } index += 1; }; } self.$each(); return result; } end def first(number = undefined) if `number === undefined` result = nil %x{ self.$each.$$p = function() { result = #{Opal.destructure(`arguments`)}; return $breaker; }; self.$each(); } else result = [] number = Opal.coerce_to number, Integer, :to_int if `number < 0` raise ArgumentError, 'attempt to take negative size' end if `number == 0` return [] end %x{ var current = 0; number = #{Opal.coerce_to number, Integer, :to_int}; self.$each.$$p = function() { result.push(#{Opal.destructure(`arguments`)}); if (number <= ++current) { return $breaker; } }; self.$each(); } end result end alias flat_map collect_concat def grep(pattern, &block) %x{ var result = []; if (block !== nil) { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = #{pattern === `param`}; if (#{Opal.truthy?(`value`)}) { value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } result.push(value); } }; } else { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = #{pattern === `param`}; if (#{Opal.truthy?(`value`)}) { result.push(param); } }; } self.$each(); return result; } end def group_by(&block) return enum_for(:group_by){self.enumerator_size} unless block_given? hash = Hash.new %x{ var result; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } #{(hash[`value`] ||= []) << `param`}; } self.$each(); if (result !== undefined) { return result; } } hash end def include?(obj) %x{ var result = false; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (#{`param` == obj}) { result = true; return $breaker; } } self.$each(); return result; } end def inject(object = undefined, sym = undefined, &block) %x{ var result = object; if (block !== nil && sym === undefined) { self.$each.$$p = function() { var value = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = value; return; } value = Opal.yieldX(block, [result, value]); if (value === $breaker) { result = $breaker.$v; return $breaker; } result = value; }; } else { if (sym === undefined) { if (!#{Symbol === object}) { #{raise TypeError, "#{object.inspect} is not a Symbol"}; } sym = object; result = undefined; } self.$each.$$p = function() { var value = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = value; return; } result = #{`result`.__send__ sym, `value`}; }; } self.$each(); return result == undefined ? nil : result; } end def lazy Enumerator::Lazy.new(self, enumerator_size) {|enum, *args| enum.yield(*args) } end def enumerator_size respond_to?(:size) ? size : nil end alias map collect def max(&block) %x{ var result; if (block !== nil) { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = param; return; } var value = block(param, result); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (value === nil) { #{raise ArgumentError, "comparison failed"}; } if (value > 0) { result = param; } }; } else { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = param; return; } if (#{Opal.compare(`param`, `result`)} > 0) { result = param; } }; } self.$each(); return result === undefined ? nil : result; } end def max_by(&block) return enum_for(:max_by){self.enumerator_size} unless block %x{ var result, by; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (result === undefined) { result = param; by = value; return; } if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{`value` <=> `by`} > 0) { result = param by = value; } }; self.$each(); return result === undefined ? nil : result; } end alias member? include? def min(&block) %x{ var result; if (block !== nil) { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = param; return; } var value = block(param, result); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (value === nil) { #{raise ArgumentError, "comparison failed"}; } if (value < 0) { result = param; } }; } else { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}; if (result === undefined) { result = param; return; } if (#{Opal.compare(`param`, `result`)} < 0) { result = param; } }; } self.$each(); return result === undefined ? nil : result; } end def min_by(&block) return enum_for(:min_by){self.enumerator_size} unless block %x{ var result, by; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (result === undefined) { result = param; by = value; return; } if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{`value` <=> `by`} < 0) { result = param by = value; } }; self.$each(); return result === undefined ? nil : result; } end def minmax(&block) raise NotImplementedError end def minmax_by(&block) raise NotImplementedError end def none?(&block) %x{ var result = true; if (block !== nil) { self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { result = false; return $breaker; } } } else { self.$each.$$p = function() { var value = #{Opal.destructure(`arguments`)}; if (#{Opal.truthy?(`value`)}) { result = false; return $breaker; } }; } self.$each(); return result; } end def one?(&block) %x{ var result = false; if (block !== nil) { self.$each.$$p = function() { var value = Opal.yieldX(block, arguments); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { if (result === true) { result = false; return $breaker; } result = true; } } } else { self.$each.$$p = function() { var value = #{Opal.destructure(`arguments`)}; if (#{Opal.truthy?(`value`)}) { if (result === true) { result = false; return $breaker; } result = true; } } } self.$each(); return result; } end def partition(&block) return enum_for(:partition){self.enumerator_size} unless block_given? %x{ var truthy = [], falsy = [], result; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.truthy?(`value`)}) { truthy.push(param); } else { falsy.push(param); } }; self.$each(); return [truthy, falsy]; } end alias reduce inject def reject(&block) return enum_for(:reject){self.enumerator_size} unless block_given? %x{ var result = []; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.falsy?(`value`)}) { result.push(param); } }; self.$each(); return result; } end def reverse_each(&block) return enum_for(:reverse_each){self.enumerator_size} unless block_given? %x{ var result = []; self.$each.$$p = function() { result.push(arguments); }; self.$each(); for (var i = result.length - 1; i >= 0; i--) { Opal.yieldX(block, result[i]); } return result; } end alias select find_all def slice_before(pattern = undefined, &block) if `pattern === undefined && block === nil || arguments.length > 1` raise ArgumentError, "wrong number of arguments (#{`arguments.length`} for 1)" end Enumerator.new {|e| %x{ var slice = []; if (block !== nil) { if (pattern === undefined) { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (#{Opal.truthy?(`value`)} && slice.length > 0) { #{e << `slice`}; slice = []; } slice.push(param); }; } else { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = block(param, #{pattern.dup}); if (#{Opal.truthy?(`value`)} && slice.length > 0) { #{e << `slice`}; slice = []; } slice.push(param); }; } } else { self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = #{pattern === `param`}; if (#{Opal.truthy?(`value`)} && slice.length > 0) { #{e << `slice`}; slice = []; } slice.push(param); }; } self.$each(); if (slice.length > 0) { #{e << `slice`}; } } } end def sort(&block) ary = to_a block = -> a,b {a <=> b} unless block_given? return `ary.sort(block)` end def sort_by(&block) return enum_for(:sort_by){self.enumerator_size} unless block_given? dup = map { arg = Opal.destructure(`arguments`) [block.call(arg), arg] } dup.sort! { |a, b| `a[0]` <=> `b[0]` } dup.map! { |i| `i[1]` } end def take(num) first(num) end def take_while(&block) return enum_for :take_while unless block %x{ var result = []; self.$each.$$p = function() { var param = #{Opal.destructure(`arguments`)}, value = Opal.yield1(block, param); if (value === $breaker) { result = $breaker.$v; return $breaker; } if (#{Opal.falsy?(`value`)}) { return $breaker; } result.push(param); }; self.$each(); return result; } end alias to_a entries def zip(*others, &block) to_a.zip(*others) end end
Ajedi32/opal
opal/corelib/enumerable.rb
Ruby
mit
22,803
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>specification (Gem::SourceIndex)</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> <pre><span class="ruby-comment cmt"># File lib/rubygems/source_index.rb, line 210</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">specification</span>(<span class="ruby-identifier">full_name</span>) <span class="ruby-ivar">@gems</span>[<span class="ruby-identifier">full_name</span>] <span class="ruby-keyword kw">end</span></pre> </body> </html>
michaelsync/Giles
tools/Rake/lib/ruby/gems/1.8/doc/rubygems-1.5.2/rdoc/classes/Gem/SourceIndex.src/M000488.html
HTML
mit
853
namespace HaloOnline.Server.Core.Log.Messages { public class UpdateConnectionMessageVisitor : MessageVisitor { private readonly IConnection _connection; public UpdateConnectionMessageVisitor(IConnection connection) { _connection = connection; } public override void Visit(MessageHearbeat message) { _connection.ClientComputerName = message.ClientComputerName; _connection.ClientId = message.ClientId; _connection.ClientName = message.ClientName; } } }
Atvaark/Emurado
HaloOnline.Server.Core.Log/Messages/UpdateConnectionMessageVisitor.cs
C#
mit
573
/** * \file RandomCoverage.cpp * \brief Coverage test for %RandomLib * * Compile/link with, e.g.,\n * g++ -I../include -O2 -funroll-loops * -o RandomCoverage RandomCoverage.cpp ../src/Random.cpp\n * ./RandomCoverage * * This executes nearly all of the public functions in %RandomLib. This is * important, since it allows the compiler to check the code which appears in * header files. It also shows how templated functions can be invoked. * * Copyright (c) Charles Karney (2006-2012) <charles@karney.com> and licensed * under the MIT/X11 License. For more information, see * http://randomlib.sourceforge.net/ **********************************************************************/ #include <iostream> #include <vector> #include <string> #include <sstream> #include <RandomLib/Random.hpp> #include <RandomLib/NormalDistribution.hpp> #include <RandomLib/ExponentialDistribution.hpp> #include <RandomLib/RandomSelect.hpp> #include <RandomLib/LeadingZeros.hpp> #include <RandomLib/ExponentialProb.hpp> #include <RandomLib/RandomNumber.hpp> #include <RandomLib/ExactExponential.hpp> #include <RandomLib/ExactNormal.hpp> #include <RandomLib/ExactPower.hpp> #include <RandomLib/InversePiProb.hpp> #include <RandomLib/InverseEProb.hpp> #define repeat for (int i = 0; i < 1000; ++i) void coverage32() { typedef RandomLib::SRandom32 Random; { // Setting and examing the seed + seed management std::vector<unsigned long> v(Random::SeedVector()); unsigned long w = Random::SeedWord(); std::string s(Random::VectorToString(v)); { Random r(v); } { Random r(v.begin(), v.end()); } int a[] = {1, 2, 3, 4}; { Random r(a, a + 4); } { Random r(w); } { Random r(s); } { Random r; } Random r(0); r.Reseed(v); r.Reseed(v.begin(), v.end()); r.Reseed(w); r.Reseed(s); r.Reseed(); v = r.Seed(); s = r.SeedString(); r.Reseed(Random::VectorToString(v)); r.Reseed(Random::StringToVector(s)); } Random r; { // Functions returning random integers repeat r(); repeat r.Ran(); repeat r.Ran32(); repeat r.Ran64(); repeat r(52); repeat r.Integer<signed short, 3>(); repeat r.Integer<3>(); repeat r.Integer(); repeat r.Integer<signed short>(); repeat r.Integer<signed short>(52); repeat r.IntegerC<signed short>(51); repeat r.IntegerC<signed short>(1,52); repeat r.Integer(6u); repeat r.IntegerC(5u); repeat r.IntegerC(1u,6u); repeat r(); repeat r(52u); } { // Functions returning random reals repeat { r.Fixed <float, 16 >(); r.Fixed <float>(); r.Fixed (); } repeat { r.FixedU<float, 16 >(); r.FixedU<float>(); r.FixedU(); } repeat { r.FixedN<float, 16 >(); r.FixedN<float>(); r.FixedN(); } repeat { r.FixedW<float, 16 >(); r.FixedW<float>(); r.FixedW(); } repeat { r.FixedS<float, 16 >(); r.FixedS<float>(); r.FixedS(); } repeat { r.FixedO<float, 16 >(); r.FixedO<float>(); r.FixedO(); } repeat { r.Float <float, 4, 2>(); r.Float <float>(); r.Float (); } repeat { r.FloatU<float, 4, 2>(); r.FloatU<float>(); r.FloatU(); } repeat { r.FloatN<float, 4, 2>(); r.FloatN<float>(); r.FloatN(); } repeat { r.FloatW<float, 4, 2>(); r.FloatW<float>(); r.FloatW(); } repeat { r.Real<float>(); r.Real(); } } { // Functions returning other random results repeat r.Boolean(); repeat r.Prob(0.5f); repeat r.Prob(2.3, 7.0); repeat r.Prob(23, 70); repeat r.Bits< 5>(); repeat r.Bits<64>(); } { // Normal distribution RandomLib::NormalDistribution<float> nf; RandomLib::NormalDistribution<> nd; repeat nf(r); repeat nd(r, 1.0, 2.0); } { // Exponention distribution RandomLib::ExponentialDistribution<float> ef; RandomLib::ExponentialDistribution<> ed; repeat ef(r); repeat ed(r, 2.0); } { // Discrete probabilities unsigned w[] = { 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 }; std::vector<int> wi(13); std::vector<float> wf(13); for (int i = 0; i < 13; ++i) { wi[i] = int(w[i]); wf[i] = float(w[i]); } { RandomLib::RandomSelect<unsigned> sel; } { RandomLib::RandomSelect<unsigned> sel(w, w + 13); } { RandomLib::RandomSelect<unsigned> sel(wi.begin(), wi.end()); } { RandomLib::RandomSelect<unsigned> sel(wi); } { RandomLib::RandomSelect<> sel; } { RandomLib::RandomSelect<> sel(w, w + 13); } { RandomLib::RandomSelect<> sel(wi); } { RandomLib::RandomSelect<> sel(wf.begin(), wf.end()); } { RandomLib::RandomSelect<> sel(wf); } { RandomLib::RandomSelect<unsigned> sel; sel.Init(w, w + 13); sel.Init(wi.begin(), wi.end()); sel.Init(wi); repeat sel(r); sel.TotalWeight(); sel.MaxWeight(); sel.Weight(3); sel.Choices(); } { RandomLib::RandomSelect<> sel; sel.Init(w, w + 13); sel.Init(wi.begin(), wi.end()); sel.Init(wi); sel.Init(wf); repeat sel(r); sel.TotalWeight(); sel.MaxWeight(); sel.Weight(3); sel.Choices(); } // Other distributions { RandomLib::LeadingZeros lz; repeat lz(r); } { RandomLib::ExponentialProb ep; repeat ep(r, 1.5f); } { // Infinite precision random numbers { RandomLib::RandomNumber<1> n; n.Init(); n.Digit(r, 10); n.RawDigit(4); n.AddInteger(-2); n.Negate(); n.Sign(); n.Floor(); n.Ceiling(); n.Size(); n.Range(); n.Fraction<float>(r); n.Value<double>(r); RandomLib::RandomNumber<1> p; n.LessThan(r, p); std::ostringstream os; os << n; } { RandomLib::RandomNumber<32> n; n.Init(); n.Digit(r, 10); n.RawDigit(4); n.AddInteger(-2); n.Negate(); n.Sign(); n.Floor(); n.Ceiling(); n.Size(); n.Range(); n.Fraction<float>(r); n.Value<double>(r); RandomLib::RandomNumber<32> p; n.LessThan(r, p); std::ostringstream os; os << n; } // Exact distributions { RandomLib::ExactExponential< 1> ed; repeat ed(r).Value<float >(r); } { RandomLib::ExactExponential<32> ed; repeat ed(r).Value<double>(r); } { RandomLib::ExactNormal< 1> ed; repeat ed(r).Value<float >(r); } { RandomLib::ExactNormal<32> ed; repeat ed(r).Value<double>(r); } { RandomLib::ExactPower< 1> pd; repeat pd(r,2).Value<float >(r); } { RandomLib::ExactPower<32> pd; repeat pd(r,3).Value<double>(r); } { RandomLib::InversePiProb pd; repeat pd(r); } { RandomLib::InverseEProb pd; repeat pd(r); } } } { // Setting position in sequence r.Count(); r.StepCount(1000); r.Reset(); r.SetCount(10000); r.SetStride(10,1); r.SetStride(5); r.GetStride(); r.SetStride(); } { // Other Random s(r); s = Random::Global; s == r; s != s; r.swap(s); std::swap(r, s); } } void coverage64() { typedef RandomLib::SRandom64 Random; { // Setting and examing the seed + seed management std::vector<unsigned long> v(Random::SeedVector()); unsigned long w = Random::SeedWord(); std::string s(Random::VectorToString(v)); { Random r(v); } { Random r(v.begin(), v.end()); } int a[] = {1, 2, 3, 4}; { Random r(a, a + 4); } { Random r(w); } { Random r(s); } { Random r; } Random r(0); r.Reseed(v); r.Reseed(v.begin(), v.end()); r.Reseed(w); r.Reseed(s); r.Reseed(); v = r.Seed(); s = r.SeedString(); r.Reseed(Random::VectorToString(v)); r.Reseed(Random::StringToVector(s)); } Random r; { // Functions returning random integers repeat r(); repeat r.Ran(); repeat r.Ran32(); repeat r.Ran64(); repeat r(52); repeat r.Integer<signed short, 3>(); repeat r.Integer<3>(); repeat r.Integer(); repeat r.Integer<signed short>(); repeat r.Integer<signed short>(52); repeat r.IntegerC<signed short>(51); repeat r.IntegerC<signed short>(1,52); repeat r.Integer(6u); repeat r.IntegerC(5u); repeat r.IntegerC(1u,6u); repeat r(); repeat r(52u); } { // Functions returning random reals repeat { r.Fixed <float, 16 >(); r.Fixed <float>(); r.Fixed (); } repeat { r.FixedU<float, 16 >(); r.FixedU<float>(); r.FixedU(); } repeat { r.FixedN<float, 16 >(); r.FixedN<float>(); r.FixedN(); } repeat { r.FixedW<float, 16 >(); r.FixedW<float>(); r.FixedW(); } repeat { r.FixedS<float, 16 >(); r.FixedS<float>(); r.FixedS(); } repeat { r.FixedO<float, 16 >(); r.FixedO<float>(); r.FixedO(); } repeat { r.Float <float, 4, 2>(); r.Float <float>(); r.Float (); } repeat { r.FloatU<float, 4, 2>(); r.FloatU<float>(); r.FloatU(); } repeat { r.FloatN<float, 4, 2>(); r.FloatN<float>(); r.FloatN(); } repeat { r.FloatW<float, 4, 2>(); r.FloatW<float>(); r.FloatW(); } repeat { r.Real<float>(); r.Real(); } } { // Functions returning other random results repeat r.Boolean(); repeat r.Prob(0.5f); repeat r.Prob(2.3, 7.0); repeat r.Prob(23, 70); repeat r.Bits< 5>(); repeat r.Bits<64>(); } { // Normal distribution RandomLib::NormalDistribution<float> nf; RandomLib::NormalDistribution<> nd; repeat nf(r); repeat nd(r, 1.0, 2.0); } { // Exponention distribution RandomLib::ExponentialDistribution<float> ef; RandomLib::ExponentialDistribution<> ed; repeat ef(r); repeat ed(r, 2.0); } { // Discrete probabilities unsigned w[] = { 0, 0, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1 }; std::vector<int> wi(13); std::vector<float> wf(13); for (int i = 0; i < 13; ++i) { wi[i] = int(w[i]); wf[i] = float(w[i]); } { RandomLib::RandomSelect<unsigned> sel; } { RandomLib::RandomSelect<unsigned> sel(w, w + 13); } { RandomLib::RandomSelect<unsigned> sel(wi.begin(), wi.end()); } { RandomLib::RandomSelect<unsigned> sel(wi); } { RandomLib::RandomSelect<> sel; } { RandomLib::RandomSelect<> sel(w, w + 13); } { RandomLib::RandomSelect<> sel(wi); } { RandomLib::RandomSelect<> sel(wf.begin(), wf.end()); } { RandomLib::RandomSelect<> sel(wf); } { RandomLib::RandomSelect<unsigned> sel; sel.Init(w, w + 13); sel.Init(wi.begin(), wi.end()); sel.Init(wi); repeat sel(r); sel.TotalWeight(); sel.MaxWeight(); sel.Weight(3); sel.Choices(); } { RandomLib::RandomSelect<> sel; sel.Init(w, w + 13); sel.Init(wi.begin(), wi.end()); sel.Init(wi); sel.Init(wf); repeat sel(r); sel.TotalWeight(); sel.MaxWeight(); sel.Weight(3); sel.Choices(); } // Other distributions { RandomLib::LeadingZeros lz; repeat lz(r); } { RandomLib::ExponentialProb ep; repeat ep(r, 1.5f); } { // Infinite precision random numbers { RandomLib::RandomNumber<1> n; n.Init(); n.Digit(r, 10); n.RawDigit(4); n.AddInteger(-2); n.Negate(); n.Sign(); n.Floor(); n.Ceiling(); n.Size(); n.Range(); n.Fraction<float>(r); n.Value<double>(r); RandomLib::RandomNumber<1> p; n.LessThan(r, p); std::ostringstream os; os << n; } { RandomLib::RandomNumber<32> n; n.Init(); n.Digit(r, 10); n.RawDigit(4); n.AddInteger(-2); n.Negate(); n.Sign(); n.Floor(); n.Ceiling(); n.Size(); n.Range(); n.Fraction<float>(r); n.Value<double>(r); RandomLib::RandomNumber<32> p; n.LessThan(r, p); std::ostringstream os; os << n; } // Exact distributions { RandomLib::ExactExponential< 1> ed; repeat ed(r).Value<float >(r); } { RandomLib::ExactExponential<32> ed; repeat ed(r).Value<double>(r); } { RandomLib::ExactNormal< 1> ed; repeat ed(r).Value<float >(r); } { RandomLib::ExactNormal<32> ed; repeat ed(r).Value<double>(r); } { RandomLib::ExactPower< 1> pd; repeat pd(r,2).Value<float >(r); } { RandomLib::ExactPower<32> pd; repeat pd(r,3).Value<double>(r); } { RandomLib::InversePiProb pd; repeat pd(r); } { RandomLib::InverseEProb pd; repeat pd(r); } } } { // Setting position in sequence r.Count(); r.StepCount(1000); r.Reset(); r.SetCount(10000); r.SetStride(10,1); r.SetStride(5); r.GetStride(); r.SetStride(); } { // Other Random s(r); s = Random::Global; s == r; s != s; r.swap(s); std::swap(r, s); } } int main(int, char**) { std::cout << "RandomLib Coverage Test\n"; coverage32(); coverage64(); int retval = 0; { using namespace RandomLib; { RandomEngine<MT19937<Random_u32>,MixerMT0<Random_u32> > s("0x123,0x234,0x345,0x456"); s.SetCount(999); bool pass = s() == 3460025646U; std::cout << "Check " << s.Name() << (pass ? " passed\n" : " FAILED\n"); if (!pass) retval = 1; } { RandomEngine<MT19937<Random_u64>,MixerMT0<Random_u64> > s("0x12345,0,0x23456,0,0x34567,0,0x45678,0"); s.SetCount(999); bool pass = s() == 994412663058993407ULL; std::cout << "Check " << s.Name() << (pass ? " passed\n" : " FAILED\n"); if (!pass) retval = 1; } { SRandomGenerator32 s("0x1234,0x5678,0x9abc,0xdef0"); s.SetCount(999); bool pass = s() == 788493625U; std::cout << "Check " << s.Name() << (pass ? " passed\n" : " FAILED\n"); if (!pass) retval = 1; } { SRandomGenerator64 s("5,4,3,2,1"); s.SetCount(999); bool pass = s() == 13356980519185762498ULL; std::cout << "Check " << s.Name() << (pass ? " passed\n" : " FAILED\n"); if (!pass) retval = 1; } } return retval; }
eiimage/randomlib
examples/RandomCoverage.cpp
C++
mit
14,113
#module Applicat::Mvc::Controller module Applicat module Mvc module Controller def self.included(base) base.class_eval do include ErrorHandling include TransitionActions protect_from_forgery layout proc { |controller| controller.request.xhr? || !controller.params[:is_ajax_request].nil? ? false : 'application' } helper :all helper_method :controller_action?, :resource_exists?, :layout_presenter def controller_action?(input_controller, input_action) if "#{input_controller}/#{input_action}" == "#{controller_name}/#{action_name}" return true else return false end end def resource_exists?(name) if eval("@#{name}.nil?") || (eval("@#{name}.class.name") != name.classify && eval("@#{name}.class.superclass.name") != name.classify) || eval("@#{name}.id.nil?") return false else return true end end def help helper = Helper.instance helper.controller = self return helper end def layout_presenter layout_name = _layout if layout_name.inspect.match('.') # app/views/layouts/application.html.erb layout_name = layout_name.inspect.gsub('"', '').split('/').last.split('.').first end @layout_presenter ||= "Layout::#{layout_name.classify}Presenter".constantize.new( self.view_context, resource: self.respond_to?(:resource) ? resource : nil ) end protected def eager_load_polymorphs(list, includes) polymorphs = {} logger.debug "eager_load_polymorphs for list length: #{list.length}" list.each do |record| includes.each do |include| include = include.first if include.is_a?(Array) polymorphs[eval("record.#{include}_type")] ||= [] polymorphs[eval("record.#{include}_type")] << eval("record.#{include}_id") end end logger.debug "Load polymorphs: #{polymorphs.keys.join(', ')}" polymorphs.each do |type,ids| polymorphs[type] = type.constantize.find(ids) end list_index = 0 list.each do |record| includes.each do |include| polymorphs[eval("record.#{include}_type")].each do |polymorph| next unless polymorph.id == eval("record.#{include}_id") eval("list[list_index].#{include} = polymorph") break end end list_index += 1 end # free memory polymorphs.each do |type,ids| polymorphs.delete(type) end return list end def model_name self.class.name.gsub('Controller', '').classify end def set_i18n_locale_from_params if params[:locale] if I18n.available_locales.include?(params[:locale].to_sym) I18n.locale = params[:locale] else flash.now[:notice] = "#{params[:locale]} translation not available" logger.error flash.now[:notice] end end end def js_help js_helper = JavaScriptHelper.instance js_helper.controller = self return js_helper end def store_location session[:"user.return_to"] = request.fullpath end private def exception_action(exception) @exception_catched = true if Rails.env == 'production' notify_airbrake(exception) logger.error "INTERNAL SERVER ERROR FOR REQUEST: " + exception.message logger.error exception.backtrace.join("\n") else raise exception end if !request.env['REQUEST_URI'].match(/\/assets\//).nil? render :text => '', :layout => false elsif exception.is_a?(ActiveRecord::RecordNotFound) render 'pages/exception_404', :layout => 'application' else render 'pages/exception_500', :layout => 'application' end end end end class Helper include Singleton #include ActionView::Helpers::TextHelper include ActionView::Helpers include ActionView::Helpers::CaptureHelper include ActionView::Helpers::UrlHelper attr_accessor :controller # Proxy Pattern use here cause of NoMethodError at help.link_to('destroy', send("#{@resource_class.name.downcase}_path", @resource_instance), :confirm => 'Are you sure?', :method => :delete) in presenters # undefined method `protect_against_forgery?' for #<ApplicationController::Helper:0x804da10> def method_missing(name, *args) @controller.send(name, *args) unless @controller.nil? end end class JavaScriptHelper include Singleton include ActionView::Helpers::JavaScriptHelper end end end end
volontariat/voluntary
lib/applicat/mvc/controller.rb
Ruby
mit
5,757
/** <!-- Minimal Markup --> <div class="layout-wrapper"> <div class="layout-header"> <div class="layout-header-wrapper">Header</div> </div> <div class="layout-body"> <div class="layout-content-wrapper"> Content <div data-lorem="4p"></div> <div data-lorem="4p"></div> </div> <div class="layout-lside"> <div class="layout-lside-wrapper">lside</div> </div> <div class="layout-rside"> <div class="layout-rside-wrapper">rside</div> </div> </div> <div class="layout-footer"> <div class="layout-footer-wrapper">Footer</div> </div> </div> */ /** * 1. Avoid the IE 10-11 `min-height` bug. * 2. Set `flex-shrink` to `0` to prevent some browsers from * letting these items shrink to smaller than their content's default * minimum size. See http://bit.ly/1Mn35US for details. * 3. Use `%` instead of `vh` since `vh` is buggy in older mobile Safari. */ .layout-wrapper { display: flex; flex-direction: column; width: 100%; } .layout-header, .layout-footer { flex: none; overflow: hidden; } .layout-body { display: flex; flex-direction: row; flex: 1; } .layout-body-wrapper { flex: 1; } .layout-content-wrapper { flex: 1; } .layout-lside { order: -1; overflow: hidden; } .layout-rside { overflow: hidden; } /* @media (--break-lg) { .layout-body { flex-direction: row; } .layout-content-wrapper { flex: 1; padding: 0 var(--space-lg); margin: 0; } .layout-lside, .layout-rside { flex: 0 0 12em; } } */
tilleps/devstack
static/_/styles/layout.css
CSS
mit
1,516
#include "EnginePCH.hpp" using namespace Poly; //----------------------------------------------------------------------------- TransformComponent::~TransformComponent() { if (Parent != nullptr) { Parent->Children.Remove(this); } } //----------------------------------------------------------------------------- void TransformComponent::SetParent(TransformComponent* parent) { if (parent != nullptr) { parent->UpdateGlobalTransformationCache(); LocalTranslation = LocalTranslation - parent->GlobalTranslation; LocalRotation = LocalRotation * parent->GlobalRotation.GetConjugated(); Vector parentGlobalScale = parent->GlobalScale; LocalScale.X = LocalScale.X / parentGlobalScale.X; LocalScale.Y = LocalScale.Y / parentGlobalScale.Y; LocalScale.Z = LocalScale.Z / parentGlobalScale.Z; UpdateLocalTransformationCache(); Parent = parent; Parent->Children.PushBack(this); } else { ResetParent(); } } //----------------------------------------------------------------------------- void TransformComponent::ResetParent() { ASSERTE(Parent, "ResetParent() called with parent == nullptr"); Matrix globalTransform = GetGlobalTransformationMatrix(); Parent->Children.Remove(this); Parent = nullptr; SetLocalTransformationMatrix(globalTransform); } //------------------------------------------------------------------------------ const Vector& TransformComponent::GetGlobalTranslation() const { UpdateGlobalTransformationCache(); return GlobalTranslation; } //------------------------------------------------------------------------------ void TransformComponent::SetLocalTranslation(const Vector& position) { LocalTranslation = position; LocalDirty = true; SetGlobalDirty(); } //------------------------------------------------------------------------------ const Quaternion& TransformComponent::GetGlobalRotation() const { UpdateGlobalTransformationCache(); return GlobalRotation; } //------------------------------------------------------------------------------ void TransformComponent::SetLocalRotation(const Quaternion& quaternion) { LocalRotation = quaternion; LocalDirty = true; SetGlobalDirty(); } //------------------------------------------------------------------------------ const Vector& TransformComponent::GetGlobalScale() const { UpdateGlobalTransformationCache(); return GlobalScale; } //------------------------------------------------------------------------------ void TransformComponent::SetLocalScale(const Vector& scale) { LocalScale = scale; LocalDirty = true; SetGlobalDirty(); } //------------------------------------------------------------------------------ const Matrix& TransformComponent::GetLocalTransformationMatrix() const { UpdateLocalTransformationCache(); return LocalTransform; } //------------------------------------------------------------------------------ const Matrix& TransformComponent::GetGlobalTransformationMatrix() const { UpdateGlobalTransformationCache(); return GlobalTransform; } //------------------------------------------------------------------------------ void TransformComponent::SetLocalTransformationMatrix(const Matrix& localTransformation) { LocalTransform = localTransformation; localTransformation.Decompose(LocalTranslation, LocalRotation, LocalScale); LocalDirty = false; SetGlobalDirty(); } //------------------------------------------------------------------------------ bool TransformComponent::UpdateLocalTransformationCache() const { if (LocalDirty) { Matrix translation; Matrix rotation = LocalRotation.ToRotationMatrix(); Matrix scale; translation.SetTranslation(LocalTranslation); scale.SetScale(LocalScale); LocalTransform = translation * rotation * scale; LocalDirty = false; return true; } return false; } //------------------------------------------------------------------------------ void TransformComponent::UpdateGlobalTransformationCache() const { if (!GlobalDirty) return; if (Parent == nullptr) { GlobalTransform = GetLocalTransformationMatrix(); } else { GlobalTransform = Parent->GetGlobalTransformationMatrix() * GetLocalTransformationMatrix(); } GlobalTransform.Decompose(GlobalTranslation, GlobalRotation, GlobalScale); GlobalDirty = false; } //------------------------------------------------------------------------------ void TransformComponent::SetGlobalDirty() const { GlobalDirty = true; for (TransformComponent* c : Children) { c->SetGlobalDirty(); } }
Althiena/PolyEngine
PolyEngine/Engine/Src/TransformComponent.cpp
C++
mit
4,456
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. * abc */ package com.microsoft.azure.management.policyinsights.v2018_07_01_preview.implementation; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResources; import rx.functions.Func1; import rx.Observable; import com.microsoft.azure.Page; import com.microsoft.azure.management.policyinsights.v2018_07_01_preview.PolicyTrackedResource; class PolicyTrackedResourcesImpl extends WrapperImpl<PolicyTrackedResourcesInner> implements PolicyTrackedResources { private final PolicyInsightsManager manager; PolicyTrackedResourcesImpl(PolicyInsightsManager manager) { super(manager.inner().policyTrackedResources()); this.manager = manager; } public PolicyInsightsManager manager() { return this.manager; } @Override public Observable<PolicyTrackedResource> listQueryResultsForManagementGroupAsync(final String managementGroupName) { PolicyTrackedResourcesInner client = this.inner(); return client.listQueryResultsForManagementGroupAsync(managementGroupName) .flatMapIterable(new Func1<Page<PolicyTrackedResourceInner>, Iterable<PolicyTrackedResourceInner>>() { @Override public Iterable<PolicyTrackedResourceInner> call(Page<PolicyTrackedResourceInner> page) { return page.items(); } }) .map(new Func1<PolicyTrackedResourceInner, PolicyTrackedResource>() { @Override public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { return new PolicyTrackedResourceImpl(inner, manager()); } }); } @Override public Observable<PolicyTrackedResource> listQueryResultsForSubscriptionAsync(final String subscriptionId) { PolicyTrackedResourcesInner client = this.inner(); return client.listQueryResultsForSubscriptionAsync(subscriptionId) .flatMapIterable(new Func1<Page<PolicyTrackedResourceInner>, Iterable<PolicyTrackedResourceInner>>() { @Override public Iterable<PolicyTrackedResourceInner> call(Page<PolicyTrackedResourceInner> page) { return page.items(); } }) .map(new Func1<PolicyTrackedResourceInner, PolicyTrackedResource>() { @Override public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { return new PolicyTrackedResourceImpl(inner, manager()); } }); } @Override public Observable<PolicyTrackedResource> listQueryResultsForResourceGroupAsync(final String resourceGroupName, final String subscriptionId) { PolicyTrackedResourcesInner client = this.inner(); return client.listQueryResultsForResourceGroupAsync(resourceGroupName, subscriptionId) .flatMapIterable(new Func1<Page<PolicyTrackedResourceInner>, Iterable<PolicyTrackedResourceInner>>() { @Override public Iterable<PolicyTrackedResourceInner> call(Page<PolicyTrackedResourceInner> page) { return page.items(); } }) .map(new Func1<PolicyTrackedResourceInner, PolicyTrackedResource>() { @Override public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { return new PolicyTrackedResourceImpl(inner, manager()); } }); } @Override public Observable<PolicyTrackedResource> listQueryResultsForResourceAsync(final String resourceId) { PolicyTrackedResourcesInner client = this.inner(); return client.listQueryResultsForResourceAsync(resourceId) .flatMapIterable(new Func1<Page<PolicyTrackedResourceInner>, Iterable<PolicyTrackedResourceInner>>() { @Override public Iterable<PolicyTrackedResourceInner> call(Page<PolicyTrackedResourceInner> page) { return page.items(); } }) .map(new Func1<PolicyTrackedResourceInner, PolicyTrackedResource>() { @Override public PolicyTrackedResource call(PolicyTrackedResourceInner inner) { return new PolicyTrackedResourceImpl(inner, manager()); } }); } }
selvasingh/azure-sdk-for-java
sdk/policyinsights/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/policyinsights/v2018_07_01_preview/implementation/PolicyTrackedResourcesImpl.java
Java
mit
4,515
/* * $Id: om-combo.css,v 1.5 2012/06/27 07:38:03 linxiaomin Exp $ * operamasks-ui combo 2.1 * * Copyright 2011, AUTHORS.txt (http://ui.operamasks.org/about) * Dual licensed under the MIT or LGPL Version 2 licenses. * http://ui.operamasks.org/license * * http://ui.operamasks.org/docs/ */ .om-combo {white-space: nowrap;display: inline-block;height: 20px;} .om-widget.om-combo {background: none;} .om-combo input {margin:0px; border: 0px solid;height: 18px;line-height: 18px;vertical-align: top;} .om-combo .om-combo-trigger {cursor: pointer;display: inline-block;height: 20px;vertical-align: top;width: 19px;background-color: #e6e6e6;} .om-combo-list-row {height: 20px; line-height: 20px; padding: 0 5px; margin : 1px; overflow-x: hidden; white-space: nowrap;cursor: default;} .om-combo-trigger{background: url("images/combo/combo-trigger.png") no-repeat scroll 0px 50% transparent;} .om-combo-selected, .om-state-hover.om-combo-selected {background:url("images/combo/combo_selected.jpg") repeat-x scroll 0 0 #2376C0; color:#ffffff;}
ali322/operamasks-ui
themes/elegant/om-combo.css
CSS
mit
1,043
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConfiguringUnity { public class ComplexGenericInterfaceImplementation : IComplexGenericInterface<ComplexGenericClass<GenericClass>> { } }
rahulpnath/Blog
ConfiguringUnity/ConfiguringUnity/ComplexGenericInterfaceImplementation.cs
C#
mit
250
'use strict'; describe('portfolio.version module', function() { beforeEach(module('portfolio.version')); describe('app-version directive', function() { it('should print current version', function() { module(function($provide) { $provide.value('version', 'TEST_VER'); }); inject(function($compile, $rootScope) { var element = $compile('<span app-version></span>')($rootScope); expect(element.text()).toEqual('TEST_VER'); }); }); }); });
pmfarnsw/portfolioWebsite
app/components/version/version-directive_test.js
JavaScript
mit
500
<?php namespace Propel\Tests\Generator\Migration; use Propel\Generator\Config\QuickGeneratorConfig; use Propel\Generator\Exception\BuildException; use Propel\Generator\Model\Database; use Propel\Generator\Model\Diff\DatabaseComparator; use Propel\Generator\Util\QuickBuilder; use Propel\Generator\Util\SqlParser; use Propel\Runtime\Propel; use Propel\Tests\TestCase; class MigrationTestCase extends TestCase { /** * @var \Propel\Runtime\Connection\ConnectionInterface */ protected $con; /** * @var Database */ protected $database; /** * @var \Propel\Generator\Reverse\AbstractSchemaParser */ protected $parser; /** * @var \Propel\Generator\Platform\PlatformInterface */ protected $platform; public function setUp() { if (!$this->con) { require_once __DIR__ . '/../../../../Fixtures/migration/build/conf/migration-conf.php'; $this->con = Propel::getConnection('migration'); $adapterClass = Propel::getServiceContainer()->getAdapterClass('migration'); $this->database = new Database(); $schemaParserClass = sprintf('\\%s\\%sSchemaParser', 'Propel\\Generator\\Reverse', ucfirst($adapterClass)); $platformClass = sprintf('\\%s\\%sPlatform', 'Propel\\Generator\\Platform', ucfirst($adapterClass)); $this->parser = new $schemaParserClass($this->con); $this->platform = new $platformClass(); $this->platform->setIdentifierQuoting(true); $generatorConfig = new QuickGeneratorConfig(); $generatorConfig->setBuildProperty('mysqlTableType', 'InnoDB'); $this->platform->setGeneratorConfig($generatorConfig); $this->parser->setGeneratorConfig(new QuickGeneratorConfig()); $this->parser->setPlatform($this->platform); } } /** * @param string $xml * * @return Database|boolean */ public function applyXml($xml, $changeRequired = false) { $this->readDatabase(); $builder = new QuickBuilder(); $builder->setPlatform($this->database->getPlatform()); $builder->setSchema($xml); $database = $builder->getDatabase(); $database->setSchema('migration'); $database->setPlatform($this->database->getPlatform()); $diff = DatabaseComparator::computeDiff($this->database, $database); if (false === $diff) { if ($changeRequired) { throw new BuildException(sprintf("No changes in schema to current database: \nSchema database:\n%s\n\nCurrent Database:\n%s", $database, $this->database )); } return false; } $sql = $this->database->getPlatform()->getModifyDatabaseDDL($diff); $this->con->beginTransaction(); if (!$sql) { throw new BuildException( sprintf('Ooops. There is a diff between current database and schema xml but no SQL has been generated. Change: %s', $diff )); } $statements = SqlParser::parseString($sql); foreach ($statements as $statement) { try { $stmt = $this->con->prepare($statement); $stmt->execute(); } catch (\Exception $e) { throw new BuildException(sprintf("Can not execute SQL: \n%s\nFrom database: \n%s\n\nTo database: \n%s\n", $statement, $this->database, $database ), null, $e); } } $this->con->commit(); return $database; } public function readDatabase() { $this->database = new Database(); $this->database->setSchema('migration'); $this->database->setPlatform($this->platform); $this->parser->parse($this->database); } /** * Migrates the schema of originXml to the database, checks for no diff and then * migrates targetXml and checks again for no diff. * * @param string $originXml * @param string $targetXml */ public function migrateAndTest($originXml, $targetXml) { try { $this->applyXmlAndTest($originXml); } catch (BuildException $e) { throw new BuildException('There was a exception in applying the first(origin) schema', 0, $e); } try { $this->applyXmlAndTest($targetXml, true); } catch (BuildException $e) { throw new BuildException('There was a exception in applying the second(target) schema', 0, $e); } } /** * @param string $xml * @param bool $changeRequired */ public function applyXmlAndTest($xml, $changeRequired = false) { $database = $this->applyXml($xml, $changeRequired); if ($database) { $this->compareCurrentDatabase($database); } } /** * Compares the current database with $database. * * @param Database $database * @throws BuildException if a difference has been found between $database and the real database */ public function compareCurrentDatabase(Database $database) { $this->readDatabase(); $diff = DatabaseComparator::computeDiff($this->database, $database); if (false !== $diff) { $sql = $this->database->getPlatform()->getModifyDatabaseDDL($diff); throw new BuildException(sprintf( "There are unexpected diffs (real to model): \n%s\n-----%s-----\nCurrent Database: \n%s\nTo XML Database: \n%s\n", $diff, $sql, $this->database, $database) ); } $this->assertFalse($diff, 'no changes.'); } }
TonnyORG/ScioTest1
vendor/propel/propel/tests/Propel/Tests/Generator/Migration/MigrationTestCase.php
PHP
mit
5,897
package lnwire import ( "fmt" "net" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/wire" ) // NetAddress represents information pertaining to the identity and network // reachability of a peer. Information stored includes the node's identity // public key for establishing a confidential+authenticated connection, the // service bits it supports, and a TCP address the node is reachable at. // // TODO(roasbeef): merge with LinkNode in some fashion type NetAddress struct { // IdentityKey is the long-term static public key for a node. This node is // used throughout the network as a node's identity key. It is used to // authenticate any data sent to the network on behalf of the node, and // additionally to establish a confidential+authenticated connection with // the node. IdentityKey *btcec.PublicKey // Address is the IP address and port of the node. This is left // general so that multiple implementations can be used. Address net.Addr // ChainNet is the Bitcoin network this node is associated with. // TODO(roasbeef): make a slice in the future for multi-chain ChainNet wire.BitcoinNet } // A compile time assertion to ensure that NetAddress meets the net.Addr // interface. var _ net.Addr = (*NetAddress)(nil) // String returns a human readable string describing the target NetAddress. The // current string format is: <pubkey>@host. // // This part of the net.Addr interface. func (n *NetAddress) String() string { // TODO(roasbeef): use base58? pubkey := n.IdentityKey.SerializeCompressed() return fmt.Sprintf("%x@%v", pubkey, n.Address) } // Network returns the name of the network this address is bound to. // // This part of the net.Addr interface. func (n *NetAddress) Network() string { return n.Address.Network() }
LightningNetwork/lnd
lnwire/netaddress.go
GO
mit
1,777
<?php if(!isset($_SESSION)) { session_start(); } include_once("acl.php"); include_once("db.php"); // Connects to your Database $data = mysqli_query($db,"SELECT * FROM vwdashboardactuators WHERE tbNode_id = '" . $_SESSION["nid"] . "' order by 1") or die(mysqli_error()); require 'includegetactuators.php'; ?> </ul> <script type="text/javascript"> $('#mainlist').listview().listview(); </script>
theflorianmaas/dh
webapp/Live/dh/php/getactuators.php
PHP
mit
406
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class SpinnerBackground : CircularContainer, IHasAccentColour { public override bool HandleKeyboardInput => false; public override bool HandleMouseInput => false; protected Box Disc; public Color4 AccentColour { get { return Disc.Colour; } set { Disc.Colour = value; EdgeEffect = new EdgeEffectParameters { Hollow = true, Type = EdgeEffectType.Glow, Radius = 40, Colour = value, }; } } public SpinnerBackground() { RelativeSizeAxes = Axes.Both; Masking = true; Children = new Drawable[] { Disc = new Box { Origin = Anchor.Centre, Anchor = Anchor.Centre, RelativeSizeAxes = Axes.Both, Alpha = 1, }, }; } } }
NeoAdonis/osu
osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs
C#
mit
1,493
<?php namespace Grav\Plugin; use Grav\Common\Plugin; use WyriHaximus\HtmlCompress\Factory; /** * Class MinifyHtmlPlugin * @package Grav\Plugin */ class MinifyHtmlPlugin extends Plugin { /** * @return array * * The getSubscribedEvents() gives the core a list of events * that the plugin wants to listen to. The key of each * array section is the event that the plugin listens to * and the value (in the form of an array) contains the * callable (or function) as well as the priority. The * higher the number the higher the priority. */ public static function getSubscribedEvents() { return [ 'onPluginsInitialized' => ['onPluginsInitialized', 0] ]; } /** * Initialize the plugin */ public function onPluginsInitialized() { // Don't proceed if we are in the admin plugin if ($this->isAdmin()) return; // Check if plugin is enabled if ($this->config['plugins.minify-html.enabled']) { // Enable the main event we are interested in $this->enable([ 'onOutputGenerated' => ['onOutputGenerated', 0] ]); } } /** * On Page Content Raw Hook */ public function onOutputGenerated() { // Check if the page type is HTML if ($this->grav['page']->templateFormat() === 'html') { // If Minify HTML cache option is enabled and if page exist continue // Else only compress the page if ($this->config['plugins.minify-html.cache'] and !is_null($this->grav['page']->route())) { $cache = $this->grav['cache']; $cache_id = md5('minify-html' . $this->grav['page']->id()); $compressedHtmlCache = $cache->fetch($cache_id); // If the page is not already cached compress the output then cache it // Else return the precached page if ($compressedHtmlCache === false) { $compressedHtml = $this->compressHtml(); $cache->save($cache_id, $compressedHtml); } else { $compressedHtml = $compressedHtmlCache; } } else { $compressedHtml = $this->compressHtml(); } // Return the compressed HTML $this->grav->output = $compressedHtml; } } /** * Compress HTML output * * @return string HTML output compressed */ private function compressHtml() { require_once(__DIR__ . '/vendor/autoload.php'); // HTML input (not compressed) $sourceHtml = $this->grav->output; // Compression mode $mode = $this->config['plugins.minify-html.mode']; // Instantiate the compressor if ($mode == 'default') $compressor = Factory::construct(); elseif ($mode == 'fastest') $compressor = Factory::constructFastest(); elseif ($mode == 'smallest') $compressor = Factory::constructSmallest(); // HTML output (compressed) return $compressor->compress($sourceHtml); } }
gregorykelleher/gregorykelleher_website
user/plugins/minify-html/minify-html.php
PHP
mit
2,872
// ========================================================================== // Mason - A Read Simulator // ========================================================================== // Copyright (c) 2006-2013, Knut Reinert, FU Berlin // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // * Neither the name of Knut Reinert or the FU Berlin nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH // DAMAGE. // // ========================================================================== // Author: Manuel Holtgrewe <manuel.holtgrewe@fu-berlin.de> // ========================================================================== #ifndef EXTRAS_APPS_MASON2_METHYLATION_LEVELS_H_ #define EXTRAS_APPS_MASON2_METHYLATION_LEVELS_H_ #include <seqan/index.h> // for Shape<> #include <seqan/sequence.h> #include <seqan/sequence_journaled.h> // for the journal #include "mason_types.h" #include "mason_options.h" // ============================================================================ // Forwards // ============================================================================ typedef seqan::Rng<> TRng; // ============================================================================ // Tags, Classes, Enums // ============================================================================ // -------------------------------------------------------------------------- // Class MethylationLevels // -------------------------------------------------------------------------- // Stores methylation levels separately for forward and reverse strand. struct MethylationLevels { // Forward and reverse levels, encoded as round(level / 0.125) + 33. seqan::CharString forward, reverse; void resize(unsigned len) { seqan::resize(forward, len, '!'); seqan::resize(reverse, len, '!'); } void clear() { seqan::clear(forward); seqan::clear(reverse); } // Translate character in forward/reverse to level (0..80). inline char charToLevel(char c) const { if (c < '>') // '>' cannot be used as value return c - 33; else return c - 34; } // Translate level (0..80) to character in forward/reverse. inline char levelToChar(char c) const { if (c + '!' < '>') return c + 33; else return c + 34; } // Returns methylation level for forward strand at position i. inline float levelF(unsigned i) const { return (charToLevel(forward[i]) / 80.0) / 0.0125; } // Sets methylation level for forward strand at position i. inline void setLevelF(unsigned i, float level) { SEQAN_ASSERT_GEQ(level, 0.0); SEQAN_ASSERT_LEQ(level, 1.0); // std::cerr << "forward[i] = " << levelToChar(round(level / 0.0125)) << " ~ " << (level / 0.0125) << " ~ " << level << "\n"; char c = levelToChar(static_cast<char>(round(level / 0.0125))); SEQAN_ASSERT_NEQ((int)c, (int)'>'); forward[i] = std::max(reverse[i], c); } // Returns methylation level for reverse strand at position i. inline float levelR(unsigned i) const { return (charToLevel(reverse[i]) / 80.0) / 0.0125; } // Sets methylation level for reverse strand at position i if level is larger than current. inline void setLevelR(unsigned i, float level) { SEQAN_ASSERT_GEQ(level, 0.0); SEQAN_ASSERT_LEQ(level, 1.0); // std::cerr << "reverse[" << i << "] = " << levelToChar(round(level / 0.0125)) << " ~ " << (level / 0.0125) << " ~ " << level << "\n"; char c = levelToChar(static_cast<char>(round(level / 0.0125))); SEQAN_ASSERT_NEQ((int)c, (int)'>'); reverse[i] = std::max(reverse[i], c); } }; inline void swap(MethylationLevels & lhs, MethylationLevels & rhs) { swap(lhs.forward, rhs.forward); swap(lhs.reverse, rhs.reverse); } // -------------------------------------------------------------------------- // Class MethylationLevelSimulator // -------------------------------------------------------------------------- // Simulate methylation levels for a Dna sequence/contig on forward and reverse strand. class MethylationLevelSimulator { public: // Options for the mu/sigma values. MethylationLevelSimulatorOptions const & options; // Random number generator to use. TRng & rng; // Beta probability density functions for level generation. seqan::Pdf<seqan::Beta> pdfCG, pdfCHG, pdfCHH; MethylationLevelSimulator(TRng & rng, MethylationLevelSimulatorOptions const & options) : options(options), rng(rng), pdfCG(options.methMuCG, options.methSigmaCG, seqan::MeanStdDev()), pdfCHG(options.methMuCHG, options.methSigmaCHG, seqan::MeanStdDev()), pdfCHH(options.methMuCHH, options.methSigmaCHH, seqan::MeanStdDev()) {} // Simulate methylation levels for the sequence in contig. The results are stored in levels. void run(MethylationLevels & levels, seqan::Dna5String const & contig) { levels.resize(length(contig)); typedef seqan::Iterator<seqan::Dna5String const>::Type TContigIter; TContigIter it = begin(contig, seqan::Standard()); TContigIter itEnd = end(contig, seqan::Standard()) - 3; // We will go over the contig with hashes to search for patterns efficiently. seqan::Shape<seqan::Dna5> shape2, shape3; if (levels.forward[0] != '!') SEQAN_ASSERT_EQ_MSG(contig[0], 'C', "pos = %d", 0); if (levels.reverse[0] != '!') SEQAN_ASSERT_EQ_MSG(contig[0], 'G', "pos = %d", 0); if (length(contig) >= 2u) { resize(shape2, 2); hash(shape2, it); handleTwoMer(levels, 0, value(shape2)); if (levels.forward[1] != '!') SEQAN_ASSERT_EQ_MSG(contig[1], 'C', "pos = %d", 1); if (levels.reverse[1] != '!') SEQAN_ASSERT_EQ_MSG(contig[1], 'G', "pos = %d", 1); } if (length(contig) >= 3u) { resize(shape3, 3); hash(shape3, it); handleThreeMer(levels, 0, value(shape3)); if (levels.forward[2] != '!') SEQAN_ASSERT_EQ_MSG(contig[2], 'C', "pos = %d", 2); if (levels.reverse[2] != '!') SEQAN_ASSERT_EQ_MSG(contig[2], 'G', "pos = %d", 2); } ++it; unsigned pos = 1; for (; (pos + 3 < length(contig)) && (it != itEnd); ++it, ++pos) { hashNext(shape2, it); hashNext(shape3, it); handleTwoMer(levels, pos, value(shape2)); handleThreeMer(levels, pos, value(shape3)); if (levels.forward[pos] != '!') SEQAN_ASSERT_EQ_MSG(contig[pos], 'C', "pos = %u", pos); if (levels.reverse[pos] != '!') SEQAN_ASSERT_EQ_MSG(contig[pos], 'G', "pos = %u", pos); } if (pos + 1 < length(contig)) { hashNext(shape2, it++); handleTwoMer(levels, pos++, value(shape2)); } } // Handle 3mer, forward case. void handleThreeMer(MethylationLevels & levels, unsigned pos, unsigned hashValue) { // seqan::Dna5String dbg, dbg2; // unhash(dbg, hashValue, 3); // dbg2 = dbg; // reverse(dbg2); switch (hashValue) { case 27: // CHG is symmetric case 32: case 42: // std::cerr << "CHG fw \t" << dbg << "\t" << dbg2 << "\t" << pos << "\n"; levels.setLevelF(pos, pickRandomNumber(rng, pdfCHG)); break; case 25: // CHH is symmetric case 26: case 28: case 30: case 31: case 33: case 40: case 41: case 43: // std::cerr << "CHH \t" << dbg << "\t" << dbg2 << "\t" << pos << "\n"; levels.setLevelF(pos, pickRandomNumber(rng, pdfCHH)); break; default: // nop break; } } // Handle 2mer. void handleTwoMer(MethylationLevels & levels, unsigned pos, unsigned hashValue) { if (hashValue == 7) // CpG forward (symmetric, also reverse) { // seqan::Dna5String dbg; // unhash(dbg, hashValue, 2); // std::cerr << "CpG \t" << dbg << "\n"; levels.setLevelF(pos, pickRandomNumber(rng, pdfCG)); levels.setLevelR(pos + 1, pickRandomNumber(rng, pdfCG)); } } }; // ============================================================================ // Metafunctions // ============================================================================ // ============================================================================ // Functions // ============================================================================ // ---------------------------------------------------------------------------- // Function VariantMaterializer::_fixVariationLevels() // ---------------------------------------------------------------------------- // Fix variation levels on contig given the points (second == true -> SNP, second == false -> breakpoint). void fixVariationLevels(MethylationLevels & levels, TRng & rng, seqan::Dna5String const & contig, seqan::String<std::pair<int, bool> > const & varPoints, MethylationLevelSimulatorOptions const & options); #endif // #ifndef EXTRAS_APPS_MASON2_METHYLATION_LEVELS_H_
bkahlert/seqan-research
raw/workshop13/workshop2013-data-20130926/trunk/extras/apps/mason2/methylation_levels.h
C
mit
10,977
<?php /** * Custom Panel for https://github.com/cakephp/debug_kit */ App::uses('DebugPanel', 'DebugKit.Lib'); /** * Provides XHProf link and infos. * */ class XHProfPanel extends DebugPanel { /** * Defines which plugin this panel is from so the element can be located. * * @var string */ public $plugin = 'XHProf'; /** * Not used right now * * @param \Controller|string $controller * @return array */ public function beforeRender(Controller $controller) { return array(); } }
renan/CakePHP-XHProf
Lib/Panel/XHProfPanel.php
PHP
mit
512
module Fog module Compute class AWS class Real require 'fog/aws/parsers/compute/describe_network_interfaces' # Describe all or specified network interfaces # # ==== Parameters # * filters<~Hash> - List of filters to limit results with # # === Returns # * response<~Excon::Response>: # * body<~Hash>: # * 'requestId'<~String> - Id of request # * 'networkInterfaceSet'<~Array>: # * 'networkInterfaceId'<~String> - The ID of the network interface # * 'subnetId'<~String> - The ID of the subnet # * 'vpcId'<~String> - The ID of the VPC # * 'availabilityZone'<~String> - The availability zone # * 'description'<~String> - The description # * 'ownerId'<~String> - The ID of the person who created the interface # * 'requesterId'<~String> - The ID ot teh entity requesting this interface # * 'requesterManaged'<~String> - # * 'status'<~String> - "available" or "in-use" # * 'macAddress'<~String> - # * 'privateIpAddress'<~String> - IP address of the interface within the subnet # * 'privateDnsName'<~String> - The private DNS name # * 'sourceDestCheck'<~Boolean> - Flag indicating whether traffic to or from the instance is validated # * 'groupSet'<~Hash> - Associated security groups # * 'key'<~String> - ID of associated group # * 'value'<~String> - Name of associated group # * 'attachment'<~Hash>: - Describes the way this nic is attached # * 'attachmentID'<~String> # * 'instanceID'<~String> # * 'instanceOwnerId'<~String> # * 'deviceIndex'<~Integer> # * 'status'<~String> # * 'attachTime'<~String> # * 'deleteOnTermination'<~Boolean> # * 'association'<~Hash>: - Describes an eventual instance association # * 'attachmentID'<~String> - ID of the network interface attachment # * 'instanceID'<~String> - ID of the instance attached to the network interface # * 'publicIp'<~String> - Address of the Elastic IP address bound to the network interface # * 'ipOwnerId'<~String> - ID of the Elastic IP address owner # * 'tagSet'<~Array>: - Tags assigned to the resource. # * 'key'<~String> - Tag's key # * 'value'<~String> - Tag's value # * 'privateIpAddresses' <~Array>: # * 'privateIpAddress'<~String> - One of the additional private ip address # * 'privateDnsName'<~String> - The private DNS associate to the ip address # * 'primay'<~String> - Whether main ip associate with NIC true of false # # {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/2012-03-01/APIReference/index.html?ApiReference-query-DescribeNetworkInterfaces.html] def describe_network_interfaces(filters = {}) params = Fog::AWS.indexed_filters(filters) request({ 'Action' => 'DescribeNetworkInterfaces', :idempotent => true, :parser => Fog::Parsers::Compute::AWS::DescribeNetworkInterfaces.new }.merge!(params)) end end class Mock def describe_network_interfaces(filters = {}) response = Excon::Response.new network_interface_info = self.data[:network_interfaces].values for filter_key, filter_value in filters network_interface_info = network_interface_info.reject{|nic| ![*filter_value].include?(nic[filter_key])} end response.status = 200 response.body = { 'requestId' => Fog::AWS::Mock.request_id, 'networkInterfaceSet' => network_interface_info } response end end end end end
suhongrui/gitlab
vendor/bundle/ruby/2.1.0/gems/fog-1.21.0/lib/fog/aws/requests/compute/describe_network_interfaces.rb
Ruby
mit
4,133
{% extends "survey/base.html" %} {% block content %} <ul class="breadcrumbs"> <li><a href="{% url 'survey:index' %}">Home</a></li> <li class="current">Pick an Instrument</li> </ul> <div class="row"> <div class="large-12 small-12 columns"> <h1>Instruments</h1> <p><strong>Step 1: </strong> Pick an instrument below.</p> <ul> {% for instrument in instruments %} <li> <a href="{% url 'survey:take-questions' instrument.pk %}"> {{ instrument.title }}</a> </li> {% endfor %} </li> </div> </div> {# end .row #} <hr/> {% endblock %}
tndatacommons/tndata_backend
tndata_backend/survey/templates/survey/take_survey.html
HTML
mit
628
.mainDivChatBoxClass{ background-color:white; height: 275px; width: 325px; -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; box-shadow: 10px 10px 5px #888; } .chatBoxCloseClass{ background-color: #FFD700; font-size: 22px; height: 26px; left: 98%; position: relative; top: -186%; width: 28px; cursor:pointer; -moz-box-shadow: 10px 10px 5px #888; -webkit-box-shadow: 10px 10px 5px #888; box-shadow: 10px 10px 5px #888; -moz-border-radius: 35px 35px 35px 35px; border-radius: 35px 35px 35px 35px; } .closeLetterClass{ margin-left:6px; } .chatBoxMinimizeClass{ background-color:#ffe4c4; } .chatBoxTitleClass{ cursor:move; } .chatBoxHeaderClass{ width:100%; height:22px; } .chatBoxMiddleClass{ background-color:ActiveCaption; height:65%; width:100%; } .chatBoxDialogClass{ overflow-y:auto; height:100%; width:100%; } .chatBoxFooterClass{ width:100%; height:28%; } .chatBoxFTextBoxClass{ background-color: white; float: left; height: 99%; width: 100%; resize:none; } .chatBoxFAcceptButClass{ background-color: #DCDCDC; float: left; height: 100%; width: 18%; } .chatBoxDialogText{ width:100%; height:100%; } .historyEntry{ color:#a52a2a; } .chatBoxHistoryDiv{ background-color:#5f9ea0; height:auto; width:auto; }
bixsolutions/elchat
client/styles/defaultChatBox.css
CSS
mit
1,503
/** * Main application file */ 'use strict'; // Set default node environment to development process.env.NODE_ENV = process.env.NODE_ENV || 'development'; var express = require('express'); var mongoose = require('mongoose'); var config = require('./config/environment'); // Connect to database mongoose.connect(config.mongo.uri, config.mongo.options); // Populate DB with sample data if (config.seedDB) { require('./config/seed'); } // Setup server var app = express(); var server = require('http').createServer(app); var socketio = require('socket.io')(server, { serveClient: (config.env === 'production') ? false : true, path: '/socket.io-client' }); require('./config/socketio')(socketio); require('./config/express')(app); require('./routes')(app); // Start server server.listen(config.port, config.ip, function () { console.log('Express server listening on %d, in %s mode', config.port, app.get('env')); }); // Expose app exports = module.exports = app;
rb7373/pets-rescue
src/server/app.js
JavaScript
mit
976
/* * WARNING: do not edit! * Generated by Makefile from include/openssl/opensslconf.h.in * * Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include <openssl/opensslv.h> #ifdef __cplusplus extern "C" { #endif #ifdef OPENSSL_ALGORITHM_DEFINES # error OPENSSL_ALGORITHM_DEFINES no longer supported #endif /* * OpenSSL was configured with the following options: */ #ifndef OPENSSL_SYS_AIX # define OPENSSL_SYS_AIX 1 #endif #ifndef OPENSSL_NO_COMP # define OPENSSL_NO_COMP #endif #ifndef OPENSSL_NO_MD2 # define OPENSSL_NO_MD2 #endif #ifndef OPENSSL_NO_RC5 # define OPENSSL_NO_RC5 #endif #ifndef OPENSSL_THREADS # define OPENSSL_THREADS #endif #ifndef OPENSSL_RAND_SEED_OS # define OPENSSL_RAND_SEED_OS #endif #ifndef OPENSSL_NO_AFALGENG # define OPENSSL_NO_AFALGENG #endif #ifndef OPENSSL_NO_ASAN # define OPENSSL_NO_ASAN #endif #ifndef OPENSSL_NO_ASM # define OPENSSL_NO_ASM #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG # define OPENSSL_NO_CRYPTO_MDEBUG #endif #ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE # define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE #endif #ifndef OPENSSL_NO_DEVCRYPTOENG # define OPENSSL_NO_DEVCRYPTOENG #endif #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128 # define OPENSSL_NO_EC_NISTP_64_GCC_128 #endif #ifndef OPENSSL_NO_EGD # define OPENSSL_NO_EGD #endif #ifndef OPENSSL_NO_EXTERNAL_TESTS # define OPENSSL_NO_EXTERNAL_TESTS #endif #ifndef OPENSSL_NO_FUZZ_AFL # define OPENSSL_NO_FUZZ_AFL #endif #ifndef OPENSSL_NO_FUZZ_LIBFUZZER # define OPENSSL_NO_FUZZ_LIBFUZZER #endif #ifndef OPENSSL_NO_HEARTBEATS # define OPENSSL_NO_HEARTBEATS #endif #ifndef OPENSSL_NO_MSAN # define OPENSSL_NO_MSAN #endif #ifndef OPENSSL_NO_SCTP # define OPENSSL_NO_SCTP #endif #ifndef OPENSSL_NO_SSL3 # define OPENSSL_NO_SSL3 #endif #ifndef OPENSSL_NO_SSL3_METHOD # define OPENSSL_NO_SSL3_METHOD #endif #ifndef OPENSSL_NO_UBSAN # define OPENSSL_NO_UBSAN #endif #ifndef OPENSSL_NO_UNIT_TEST # define OPENSSL_NO_UNIT_TEST #endif #ifndef OPENSSL_NO_WEAK_SSL_CIPHERS # define OPENSSL_NO_WEAK_SSL_CIPHERS #endif #ifndef OPENSSL_NO_DYNAMIC_ENGINE # define OPENSSL_NO_DYNAMIC_ENGINE #endif /* * Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers * don't like that. This will hopefully silence them. */ #define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy; /* * Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the * declarations of functions deprecated in or before <version>. Otherwise, they * still won't see them if the library has been built to disable deprecated * functions. */ #ifndef DECLARE_DEPRECATED # define DECLARE_DEPRECATED(f) f; # ifdef __GNUC__ # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0) # undef DECLARE_DEPRECATED # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); # endif # elif defined(__SUNPRO_C) # if (__SUNPRO_C >= 0x5130) # undef DECLARE_DEPRECATED # define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated)); # endif # endif #endif #ifndef OPENSSL_FILE # ifdef OPENSSL_NO_FILENAMES # define OPENSSL_FILE "" # define OPENSSL_LINE 0 # else # define OPENSSL_FILE __FILE__ # define OPENSSL_LINE __LINE__ # endif #endif #ifndef OPENSSL_MIN_API # define OPENSSL_MIN_API 0 #endif #if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API # undef OPENSSL_API_COMPAT # define OPENSSL_API_COMPAT OPENSSL_MIN_API #endif /* * Do not deprecate things to be deprecated in version 1.2.0 before the * OpenSSL version number matches. */ #if OPENSSL_VERSION_NUMBER < 0x10200000L # define DEPRECATEDIN_1_2_0(f) f; #elif OPENSSL_API_COMPAT < 0x10200000L # define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_2_0(f) #endif #if OPENSSL_API_COMPAT < 0x10100000L # define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_1_0(f) #endif #if OPENSSL_API_COMPAT < 0x10000000L # define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_1_0_0(f) #endif #if OPENSSL_API_COMPAT < 0x00908000L # define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f) #else # define DEPRECATEDIN_0_9_8(f) #endif /* Generate 80386 code? */ #undef I386_ONLY #undef OPENSSL_UNISTD #define OPENSSL_UNISTD <unistd.h> #undef OPENSSL_EXPORT_VAR_AS_FUNCTION /* * The following are cipher-specific, but are part of the public API. */ #if !defined(OPENSSL_SYS_UEFI) # define BN_LLONG /* Only one for the following should be defined */ # undef SIXTY_FOUR_BIT_LONG # undef SIXTY_FOUR_BIT # define THIRTY_TWO_BIT #endif #define RC4_INT unsigned char #ifdef __cplusplus } #endif
dmilith/SublimeText3-dmilith
Package Storage/lsp_utils/node-runtime/12.20.2/node/include/node/openssl/archs/aix-gcc/no-asm/include/openssl/opensslconf.h
C
mit
4,834
<html> <head> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <title>React and Flux Example</title> <!-- Just some stylesheets to make the app look better --> <style type="text/css"> body { padding-top: 40px; } hr { margin-top: 50px; margin-bottom: 50px;} </style> </head> <body> <div id='root'> </div> </body> <script src="/bundle.js"></script> </html>
danilotorrisi/a-modern-web-with-react-and-flux
Sample Code/05-immutable/index.html
HTML
mit
566
pageflow.AudioPlayer.getMediaElementMethod = function(player) { player.getMediaElement = function() { return player.audio.audio; }; };
tf/pageflow-dependabot-test
app/assets/javascripts/pageflow/audio_player/get_media_element_method.js
JavaScript
mit
143
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.resourcehealth.v2015_01_01; import com.fasterxml.jackson.annotation.JsonProperty; /** * Properties of the service impacting event. */ public class ServiceImpactingEventIncidentProperties { /** * Title of the incident. */ @JsonProperty(value = "title") private String title; /** * Service impacted by the event. */ @JsonProperty(value = "service") private String service; /** * Region impacted by the event. */ @JsonProperty(value = "region") private String region; /** * Type of Event. */ @JsonProperty(value = "incidentType") private String incidentType; /** * Get title of the incident. * * @return the title value */ public String title() { return this.title; } /** * Set title of the incident. * * @param title the title value to set * @return the ServiceImpactingEventIncidentProperties object itself. */ public ServiceImpactingEventIncidentProperties withTitle(String title) { this.title = title; return this; } /** * Get service impacted by the event. * * @return the service value */ public String service() { return this.service; } /** * Set service impacted by the event. * * @param service the service value to set * @return the ServiceImpactingEventIncidentProperties object itself. */ public ServiceImpactingEventIncidentProperties withService(String service) { this.service = service; return this; } /** * Get region impacted by the event. * * @return the region value */ public String region() { return this.region; } /** * Set region impacted by the event. * * @param region the region value to set * @return the ServiceImpactingEventIncidentProperties object itself. */ public ServiceImpactingEventIncidentProperties withRegion(String region) { this.region = region; return this; } /** * Get type of Event. * * @return the incidentType value */ public String incidentType() { return this.incidentType; } /** * Set type of Event. * * @param incidentType the incidentType value to set * @return the ServiceImpactingEventIncidentProperties object itself. */ public ServiceImpactingEventIncidentProperties withIncidentType(String incidentType) { this.incidentType = incidentType; return this; } }
selvasingh/azure-sdk-for-java
sdk/resourcehealth/mgmt-v2015_01_01/src/main/java/com/microsoft/azure/management/resourcehealth/v2015_01_01/ServiceImpactingEventIncidentProperties.java
Java
mit
2,857
<div class="body-content bg-1"> <div class="col-sm-12 col-xs-12" ng-controller="DashboardCtrl"> <div class="container"> <div class="center"> <h1>My Dashboard</h1> </div> <!-- alert messages --> <div> <alert ng-repeat="alert in alerts" type="{{alert.type}}" close="closeAlert($index)"> <span class="{{alert.icone}}"></span> {{alert.msg}} </alert> </div> <p ng-controller="LoginCtrl">Welcome {{deName}} ({{deMail}}) | <a id="logout" href ng-click="logout()">Logout</a></p> </div> </div> </div>
ffariasdev/angular-login
app/views/dashboard.html
HTML
mit
679
using System; using System.Linq; using System.Collections.Generic; // Toolkit namespace using SimpleMvvmToolkit; using System.ServiceModel.DomainServices.Client; using System.ComponentModel; namespace SimpleMvvm { // Add ServiceAgentExport attribute, setting AgentType to Mock public class ItemListServiceAgent : IItemListServiceAgent { // TODO: Add a field of type MyDomainContext //MyDomainContext domainContext = new MyDomainContext(); // TODO: Load items from domain context public void GetItems(Action<List<Item>, Exception> completed) { //// Load GetItemsQuery //EntityQuery<Item> query = domainContext.GetItemsQuery(); //domainContext.Load(query, loadOp => //{ // // Declare error and result // Exception error = null; // IEnumerable<Item> items = null; // // Set error or result // if (loadOp.HasError) // { // error = loadOp.Error; // } // else // { // items = loadOp.Entities; // } // // Invoke completion callback // completed(items.ToList(), error); //}, null); } // TODO: Call Add on domain context items public void AddItem(Item item) { //domainContext.Items.Add(item); } // TODO: Call Remove on domain context items public void RemoveItem(Item item) { //domainContext.Items.Remove(item); } // TODO: Save changes on the domain content if there are any public void SaveChanges(Action<Exception> completed) { //// See if any products have changed //if (domainContext.Items.HasChanges) //{ // // Submit bulk update // domainContext.SubmitChanges(submitOp => // { // // Declare error // Exception error = null; // // Set error or result // if (submitOp.HasError) // { // error = submitOp.Error; // } // // Invoke completion callback // completed(error); // }, null); //} } // TODO: Reject unsaved changes on domain context public void RejectChanges() { //if (this.domainContext.Items.HasChanges) //{ // this.domainContext.RejectChanges(); //} } } }
tonysneed/SimpleMvvmToolkit
Extensions/VS2013/Project Templates/Source/RiaServices/SimpleMvvm/Services/ItemListServiceAgent.cs
C#
mit
2,701
module Neo4j module ActiveRel class ActiveRelQueryProxy def initialize(model, starting_query = nil) @model = model @chain = [] @starting_query = starting_query end METHODS = %w(where order skip limit) METHODS.each do |method| define_method(method) { |*args| build_deeper_query_proxy(method.to_sym, args) } end include Enumerable def each(&block) query.pluck(rel_var).each(&block) end def query query_as(rel_var) end NON_PREFIXED_CLAUSES = [:limit, :skip] def query_as(var) @chain.inject(@starting_query || _session.query) do |query, (clause, args)| args.inject(query) do |query2, arg| if clause.in?(NON_PREFIXED_CLAUSES) query.send(clause, arg) else query.send(clause, rel_var => arg) end end end end def size self.count end protected def _add_link(clause, args) @chain << [clause, args] end private def rel_var :r1 end def build_deeper_query_proxy(method, args) self.clone.tap do |new_query_proxy| new_query_proxy.instance_variable_set('@chain', @chain.dup) new_query_proxy._add_link(method, args) end end def _session @session || (@model && @model.neo4j_session) end end def self.query_proxy ActiveRelQueryProxy.new(self) end end end ::Neo4j::ActiveRel::ActiveRelQueryProxy.send :include, ::Kaminari::Neo4j::Extension::InstanceMethods ::Neo4j::ActiveRel.send :include, ::Kaminari::Neo4j::Extension::ClassMethods
ernestoe/rails_admin
lib/rails_admin/adapters/neo4j/active_rel_ext.rb
Ruby
mit
1,726
var http = require('http'), browserify = require('browserify'), literalify = require('literalify'), React = require('react'); var App = require('./app'); http.createServer(function(req, res) { if (req.url == '/') { res.setHeader('Content-Type', 'text/html'); var props = { items: [ 'Item 0', 'Item 1' ] }; var html = React.renderToStaticMarkup( <body> <div id="content" dangerouslySetInnerHTML={{__html: React.renderToString(<App items={props.items}/>) }} />, <script dangerouslySetInnerHTML={{__html: 'var APP_PROPS = ' + JSON.stringify(props) + ';' }}/> <script src="//fb.me/react-0.13.1.min.js"/> <script src="/bundle.js"/> </body> ); res.end(html); } else if (req.url == '/bundle.js') { res.setHeader('Content-Type', 'text/javascript'); browserify() .add('./browser.js') .transform(literalify.configure({react: 'window.React'})) .bundle() .pipe(res); } else { res.statusCode = 404; res.end(); } }).listen(3000, function(err) { if (err) throw err; console.log('Listening on 3000...'); })
410675629/common_use
react-demos/demo11/src/server.js
JavaScript
mit
1,191
package com.microsoft.bingads.campaignmanagement; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="CampaignIds" type="{http://schemas.microsoft.com/2003/10/Serialization/Arrays}ArrayOflong" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "campaignIds" }) @XmlRootElement(name = "AddCampaignsResponse") public class AddCampaignsResponse { @XmlElement(name = "CampaignIds", nillable = true) protected ArrayOflong campaignIds; /** * Gets the value of the campaignIds property. * * @return * possible object is * {@link ArrayOflong } * */ public ArrayOflong getCampaignIds() { return campaignIds; } /** * Sets the value of the campaignIds property. * * @param value * allowed object is * {@link ArrayOflong } * */ public void setCampaignIds(ArrayOflong value) { this.campaignIds = value; } }
shyTNT/BingAds-Java-SDK
proxies/com/microsoft/bingads/campaignmanagement/AddCampaignsResponse.java
Java
mit
1,621
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateGeonamesNames extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('geonames_names', function(Blueprint $table) { $table->increments('id'); $table->string('name', 200); $table->string('ascii_name', 200); $table->string('alternate_names', 4000); $table->decimal('latitude', 10, 7); $table->decimal('longitude', 10, 7); $table->string('f_class', 1); $table->string('f_code', 10); $table->string('country_id', 2)->index(); $table->string('cc2', 60); $table->string('admin1', 20)->index(); $table->string('admin2', 80)->index(); $table->string('admin3', 20)->index(); $table->string('admin4', 20)->index(); $table->integer('population')->index(); $table->integer('elevation'); $table->integer('gtopo30'); $table->string('timezone_id', 40)->index(); $table->date('modification_at'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('geonames_names'); } }
nrich2010/geonames
src/migrations/2013_11_28_170337_create_geonames_names.php
PHP
mit
1,146
import Ember from 'ember'; import layout from '../../templates/components/one-way-select/option'; const { Component } = Ember; export default Component.extend({ layout, tagName: '' });
dockyard/ember-one-way-input
addon/components/one-way-select/option.js
JavaScript
mit
193
require 'rubygems' require 'bundler/setup' require 'plist' require 'parse-ruby-client' require_relative 'paths.rb' def generatePlist (settings) puts "--> Creation du plist" buildConfiguration = settings[:buildConfiguration] buildDirectory = settings[:buildDirectory] buildNumber = settings[:buildNumber] projectInfosPath = settings[:projectInfosPath] projectInfos = Plist::parse_xml(projectInfosPath) deployPlistPath = deployPlistPath(settings) deployPlist = Hash.new items = Array.new item = Hash.new assets = Array.new asset = Hash.new asset['kind'] = 'software-package' asset['url'] = settings[:deploy]["uploadServer"]["ipa"][0]["publicURL"] + "/" + ipaName(settings) assets.push asset metadata = Hash.new # the following line has been commented and replaced by th next one in order to make it work on iOS 9... # metadata['bundle-identifier'] = settings[:deploy]["infosPlist"]["CFBundleIdentifier"] + ".iOS8" metadata['bundle-identifier'] = settings[:deploy]["infosPlist"]["CFBundleIdentifier"] metadata['bundle-version'] = projectInfos['CFBundleVersion'] metadata['subtitle'] = 'by SoLocal' metadata['title'] = settings[:deploy]["infosPlist"]["CFBundleDisplayName"] metadata['kind'] = 'software' item['assets'] = assets item['metadata'] = metadata items.push item deployPlist['items'] = items Plist::Emit.save_plist(deployPlist , deployPlistPath) end
teriiehina/mercure
lib/mercure/plist.rb
Ruby
mit
1,538
<?php /* * This file is part of the PHPExifTool package. * * (c) Alchemy <support@alchemy.fr> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace PHPExiftool\Driver\Tag\OpenEXR; use JMS\Serializer\Annotation\ExclusionPolicy; use PHPExiftool\Driver\AbstractTag; /** * @ExclusionPolicy("all") */ class Aperture extends AbstractTag { protected $Id = 'aperture'; protected $Name = 'Aperture'; protected $FullName = 'OpenEXR::Main'; protected $GroupName = 'OpenEXR'; protected $g0 = 'OpenEXR'; protected $g1 = 'OpenEXR'; protected $g2 = 'Image'; protected $Type = '?'; protected $Writable = false; protected $Description = 'Aperture'; }
bburnichon/PHPExiftool
lib/PHPExiftool/Driver/Tag/OpenEXR/Aperture.php
PHP
mit
784
const gulp = require('gulp'); const babel = require('gulp-babel'); const gdt = require('gulp-dev-tasks'); const eslintrc = require('./.eslintrc.json'); gdt.setRules(eslintrc.rules); gulp.task('build', () => gulp.src('src/**/*.js') .pipe(babel({ presets: ['es2015', 'stage-2'] })) .pipe(gulp.dest('build/')) ); gulp.task('default', ['lint', 'build'], () => { gulp.watch('src/**/*.js', ['lint', 'build']); });
zoover/hodlog
gulpfile.js
JavaScript
mit
421
<?php declare(strict_types=1); namespace TestApp\Controller; use Cake\Controller\Controller; use Cake\Http\Response; use TestApp\Controller\Component\TestSecurityComponent; class SecurityTestController extends Controller { /** * failed property * * @var bool */ public $failed = false; /** * Used for keeping track of headers in test * * @var array */ public $testHeaders = []; public function initialize(): void { $this->loadComponent('TestSecurity', ['className' => TestSecurityComponent::class]); } /** * fail method * * @return void */ public function fail(): void { $this->failed = true; } /** * @inheritDoc */ public function redirect($url, ?int $status = null): ?Response { return $status; } /** * Convenience method for header() * * @return void */ public function header(string $status): void { $this->testHeaders[] = $status; } }
cakephp/cakephp
tests/test_app/TestApp/Controller/SecurityTestController.php
PHP
mit
1,046
<?php /** * Database Configure */ Rtfd_Helper_Database::init_server(array( 'host' => 'localhost', 'port' => 3306, 'username' => 'root', 'password' => 'root', 'database' => 'rtfd' ));
JShadowMan/package
php/rtfd-server/Service/Rtfd/Config/Database.php
PHP
mit
218
// // ScottShowAlertView.h // QQLive // // Created by Scott_Mr on 2016/12/3. // Copyright © 2016年 Scott. All rights reserved. // #import <UIKit/UIKit.h> @interface ScottShowAlertView : UIView @property (nonatomic, weak, readonly) UIView *alertView; @property (nonatomic, strong) UIView *backgroundView; // 是否可以点击背景消失(默认为NO) @property (nonatomic, assign) BOOL tapBackgroundDismissEnable; // Default is 15 @property (nonatomic, assign) CGFloat alertViewMargin; // Default centerY @property (nonatomic, assign) CGFloat alertOriginY; // 初始化 + (instancetype)alertViewWithView:(UIView *)view; // 显示方式 + (void)showAlertViewWithView:(UIView *)alertView; + (void)showAlertViewWithView:(UIView *)alertView backgroundDismissEnable:(BOOL)backgroundDismissEnable; + (void)showAlertViewWithView:(UIView *)alertView withOriginY:(CGFloat)originY; + (void)showAlertViewWithView:(UIView *)alertView withOriginY:(CGFloat)originY backgroundDismissEnable:(BOOL)backgroundDismissEnable; - (void)show; - (void)dismiss; @end
LZAscott/ScottAlertController
ScottAlertViewDemo/ScottAlertViewDemo/ScottAlertController/ScottAlertView/ScottShowAlertView.h
C
mit
1,062
<h1> comments </h1> <div id="disqus_thread"></div> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES * * */ var disqus_shortname = 'charliedrage'; /* * * DON'T EDIT BELOW THIS LINE * * */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript> <script type="text/javascript"> /* * * CONFIGURATION VARIABLES * * */ var disqus_shortname = 'charliedrage'; /* * * DON'T EDIT BELOW THIS LINE * * */ (function () { var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); </script>
charliedrage/charliedrage
_includes/disqus.html
HTML
mit
1,080
import peek42 from './browser/peek42'; export default peek42;
rpeev/konsole
src/index.browser.js
JavaScript
mit
63
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <title>Couchdbkit - Couchdbkit version 0.2.4 released </title> <!--[if IE]> <script> // allow IE to recognize HTMl5 elements document.createElement('section'); document.createElement('article'); document.createElement('aside'); document.createElement('footer'); document.createElement('header'); document.createElement('nav'); document.createElement('time'); </script> <![endif]--> <link rel="stylesheet" href="/css/couchdbkit.css?20090615" type="text/css" media="screen, projection" /> <link rel="stylesheet" href="/static/css/print.css?20090615" type="text/css" media="print" /> <script type="text/javascript" src="/js/prettify.js"></script> <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="/feed.xml" /> </head> <body onload="prettyPrint()"> <div class="container"> <header id="site_header"> <h1><a href="/"><span>couchdbkit</span></a></h1> <ul id="main_nav"> <li><a href="/">home</a></li> <li><a href="/blog/">news</a></li> <li><a href="/download.html">download</a></li> <li><a href="/docs/">documentation</a></li> <li><a href="/docs/api/">API</a></li> </ul> </header> <aside id="sidebar"> <ul class="sidenav"> <li><a href="/blog/">Latest news</a></li> <li><a href="/download.html">Download latest</a></li> <li><a href="/docs/gettingstarted.html">Getting started</a></li> <li><a href="/docs/faq.html">Frequently Asked Questions</a></li> <li><a href="/docs/about.html">About couchdbkit</a></li> <li><a href="/contact.html">Getting help with couchdbkit</a></li> </ul> <div class="info"> <h3>Getting started</h3> <p>See the <a href="/download.html">download instructions</a> for information on getting couchdbkit, and read the <a href="/docs/gettingstarted.html">getting started</a> instructions to start programming CouchDB in your own application in less than 10 minutes.</p> </div> <div class="info"> <h3>Get involved</h3> <ul> <li><p><a href="http://webchat.freenode.net/?channels=couchdbkit">#couchdbkit IRC channel</a>: chat with other couchdbkit users</p></li> <li><p><a href="http://github.com/benoitc/couchdbkit/issues">Ticket system</a>: report bugs and make feature requests</p></li> <li><p><a href="http://groups.google.com/group/couchdbkit">Mailing-List</a>: The main list for help and follow changes.</p></li> </ul> </div> </aside> <section id="content"> <article> <header> <h1>Couchdbkit version 0.2.4 released</h1> </header> <p>New release for <a href="http://couchdbkit.org">Couchdbkit</a>. This release fix a lot of oddities from previous version.</p> <p>You can download latest release on <a href="http://pypi.python.org/pypi/couchdbkit/0.2.4">Pypi</a> or check <a href="../download.html">download page</a> for other ways.</p> <h2>New features :</h2> <ul> <li>Depends on new restkit 0.8.8 &#8211; support timeout, latest webbob exceptions, handle connection reset</li> <li>new property: ListSchemaProperty. Allow you to savec and validate a list of DocumentSchema object</li> <li>db.compact function has now a dname argyment &#8211; allow you to compact views handled by the design doc named `dname`</li> <li>db.view_cleanup function &#8211; Old view output remains on disk until you explicitly run cleanup </li> <li>if conflicts or any other error in bulk_save, BulkSaveError is now raised. You can get list of documents in errors by using `error` property of this exception.</li> <li>allow django extension to set timeout in settings</li> </ul> <footer> <p><span class='comments'><a href='/blog/2009-11-22-Couchdbkit-0.2.4.html#disqus_thread'>View Comments</a></span></p> </footer> </article> <div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/couchdbkit/embed.js"></script><noscript><a href="http://couchdbkit.disqus.com/?url=ref">View the discussion thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a> </section> <footer id="bottom"> <p class="copyright">2008-20011 &copy; <a href="http://benoitc.org">Benoît Chesneau</a> - Some rights reserved.</p> <div id="cc"><a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/2.0/fr/80x15.png" /></a> This <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/InteractiveResource" rel="dc:type">website</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Creative Commons Attribution 2.0 France License</a>.</div> <p>Hosted on <a href="http://github.com/">GitHub</a></p> </footer> </div> <script> //<![CDATA[ (function() { var links = document.getElementsByTagName('a'); var query = '?'; for(var i = 0; i < links.length; i++) { if(links[i].href.indexOf('#disqus_thread') >= 0) { query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&'; } } document.write('<script charset="utf-8" type="text/javascript" src="http://disqus.com/forums/couchdbkit/get_num_replies.js' + query + '&disqus_developer=1"></' + 'script>'); })(); //]]> </script> </body> </html>
arnaudsj/couchdbkit
doc/couchdbkit.org/htdocs/blog/2009-11-22-Couchdbkit-0.2.4.html
HTML
mit
6,115
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. */ package com.microsoft.azure.management.network.v2019_07_01; import com.fasterxml.jackson.annotation.JsonProperty; import com.microsoft.rest.SkipParentValidation; import com.microsoft.azure.Resource; /** * Network Intent Policy resource. */ @SkipParentValidation public class NetworkIntentPolicy extends Resource { /** * A unique read-only string that changes whenever the resource is updated. */ @JsonProperty(value = "etag") private String etag; /** * Resource ID. */ @JsonProperty(value = "id") private String id; /** * Get a unique read-only string that changes whenever the resource is updated. * * @return the etag value */ public String etag() { return this.etag; } /** * Set a unique read-only string that changes whenever the resource is updated. * * @param etag the etag value to set * @return the NetworkIntentPolicy object itself. */ public NetworkIntentPolicy withEtag(String etag) { this.etag = etag; return this; } /** * Get resource ID. * * @return the id value */ public String id() { return this.id; } /** * Set resource ID. * * @param id the id value to set * @return the NetworkIntentPolicy object itself. */ public NetworkIntentPolicy withId(String id) { this.id = id; return this; } }
selvasingh/azure-sdk-for-java
sdk/network/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/network/v2019_07_01/NetworkIntentPolicy.java
Java
mit
1,678
<?php namespace Admin\AgenciaBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class AgenciaHojadevidaType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('Estado') ->add('Estado', 'choice', array( 'choices' => array( 'Activo' => 'Activo', 'Pendiente' => 'Pendiente', 'Vetado' => 'Vetado' ), 'required' => True, 'label'=>'Estado*', 'empty_value' => 'Seleccione', 'empty_data' => null )) ->add('Tags','text',array('label'=>'Perfiles')) ->add('categoria', 'choice', array( 'choices' => array( '' => 'Seleccione', 'Extra A' => 'Extra A', 'Extra AA' => 'Extra AA', 'Extra AAA' => 'Extra AAA', 'Figurante' => 'Figurante', 'Actor en formacion' => 'Actor en formación', 'Actor' => 'Actor', 'Modelo A' => 'Modelo A', 'Modelo AA' => 'Modelo AA', 'Modelo AAA' => 'Modelo AAA' ), 'empty_data' => null, 'required' => true, 'label'=>'Categoría*' )) ->add('calificacion','choice', array( 'choices' => array( '' => 'Seleccione', '1' => '★', '2' => '★★', '3' => '★★★', '4' => '★★★★', '5' => '★★★★★' ), 'empty_data' => null, 'required' => true, 'label'=>'Calidad de book*' )) ; } /** * @param OptionsResolverInterface $resolver */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults(array( 'data_class' => 'Admin\AdminBundle\Entity\AgenciaHojadevida' )); } /** * @return string */ public function getName() { return 'admin_adminbundle_agenciahojadevida'; } }
luisk262/fk
src/Admin/AgenciaBundle/Form/AgenciaHojadevidaType.php
PHP
mit
2,761
var favicon = require('./includes/favicon.js'); var feed = require('./includes/feed.js'); var retrofitIcon = function (f, callback) { console.log("Checking ", f.htmlUrl); favicon.find(f.htmlUrl, function (favicon_url) { f.icon = favicon_url; feed.update(f, function (err, data) { callback(err, data); }); }); }; // retrofit "icon" image urls to each feed feed.readAll(function (allFeeds) { var i = 0, f = {}; console.log("Finding favicons for ", allFeeds.length, " feeds."); for (i = 0; i < allFeeds.length; i++) { f = allFeeds[i]; if (typeof f.icon === "undefined" || f.icon === null) { retrofitIcon(f, function (err, data) { console.log(err, data); }); } } });
glynnbird/birdreader
retrofit_favicons.js
JavaScript
mit
733
#if !defined (_win_clip_h_) #define _win_clip_h_ /* * Copyright 1999 by Abacus Research and Development, Inc. * All rights reserved. */ #if defined (SDL) extern void write_pict_as_dib_to_clipboard (void); extern void write_surfp_to_clipboard (SDL_Surface *surfp); extern unsigned long ROMlib_executor_format (LONGINT type); extern void write_pict_as_dib_to_clipboard (void); extern void write_pict_as_pict_to_clipboard (void); #endif #endif
ctm/executor
src/config/os/cygwin32/win_clip.h
C
mit
447
<!DOCTYPE html> <html lang="en"> <head> <title>DemoExpandingCollection Reference</title> <link rel="stylesheet" type="text/css" href="css/jazzy.css" /> <link rel="stylesheet" type="text/css" href="css/highlight.css" /> <meta charset='utf-8'> <script src="js/jquery.min.js" defer></script> <script src="js/jazzy.js" defer></script> </head> <body> <a title="DemoExpandingCollection Reference"></a> <header> <div class="content-wrapper"> <p><a href="index.html">DemoExpandingCollection Docs</a> (100% documented)</p> </div> </header> <div class="content-wrapper"> <p id="breadcrumbs"> <a href="index.html">DemoExpandingCollection Reference</a> <img id="carat" src="img/carat.png" /> DemoExpandingCollection Reference </p> </div> <div class="content-wrapper"> <nav class="sidebar"> <ul class="nav-groups"> <li class="nav-group-name"> <a href="Classes.html">Classes</a> <ul class="nav-group-tasks"> <li class="nav-group-task"> <a href="Classes/BasePageCollectionCell.html">BasePageCollectionCell</a> </li> <li class="nav-group-task"> <a href="Classes/ExpandingTableViewController.html">ExpandingTableViewController</a> </li> <li class="nav-group-task"> <a href="Classes/ExpandingViewController.html">ExpandingViewController</a> </li> </ul> </li> </ul> </nav> <article class="main-content"> <section> <section class="section"> <p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/header.png" alt="header"></p> <a href='#expanding_collection' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h1 id='expanding_collection'>expanding-collection</h1> <p><a href="http://twitter.com/Ramotion"><img src="https://img.shields.io/badge/Twitter-@Ramotion-blue.svg?style=flat" alt="Twitter"></a> <a href="https://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/p/expanding-collection.svg" alt="CocoaPods"></a> <a href="http://cocoapods.org/pods/expanding-collection"><img src="https://img.shields.io/cocoapods/v/expanding-collection.svg" alt="CocoaPods"></a> <a href="https://cdn.rawgit.com/Ramotion/expanding-collection/master/docs/index.html"><img src="https://img.shields.io/cocoapods/metrics/doc-percent/expanding-collection.svg" alt="CocoaPods"></a></p> <p><a href="https://github.com/Ramotion/expanding-collection"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage compatible"></a> <a href="https://travis-ci.org/Ramotion/elastic-pull-to-update"><img src="https://travis-ci.org/Ramotion/elastic-pull-to-update.svg?branch=master" alt="Travis"></a> <a href="https://codebeat.co/projects/github-com-ramotion-expanding-collection"><img src="https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d" alt="codebeat badge"></a></p> <p><a href="https://dribbble.com/shots/2741477-iOS-Expanding-Collection-Open-Source">shot on dribbble</a>: <img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/preview.gif" alt="Animation"></p> <p>The <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">iPhone mockup</a> available <a href="https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">here</a>.</p> <a href='#requirements' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='requirements'>Requirements</h2> <ul> <li>iOS 8.0+</li> <li>Xcode 7.3</li> </ul> <a href='#installation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='installation'>Installation</h2> <p>Just add the Source folder to your project.</p> <p>or use <a href="https://cocoapods.org">CocoaPods</a> with Podfile: <code>ruby pod &#39;expanding-collection&#39; </code> or <a href="https://github.com/Carthage/Carthage">Carthage</a> users can simply add to their <code>Cartfile</code>: <code> github &quot;Ramotion/expanding-collection&quot; </code></p> <a href='#usage' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='usage'>Usage</h2> <pre class="highlight swift"><code><span class="kd">import</span> <span class="kt">ExpandingCollection</span> </code></pre> <a href='#create_collectionviewcell' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcell'>Create CollectionViewCell</h4> <p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image2.png" alt="cell"></p> <p>1) Create UICollectionViewCell inherit from <code>BasePageCollectionCell</code> (recommend create cell with xib file)</p> <p>2) Adding FrontView - add a view to YOURCELL.xib and connect it to <code>@IBOutlet weak var frontContainerView: UIView!</code><br> - add width, height, centerX and centerY constraints (width and height constranints must equal cellSize)</p> <p><img src="https://raw.githubusercontent.com/Ramotion/expanding-collection/master/images/image1.png" alt="cell"><br> - connect centerY constraint to <code>@IBOutlet weak var frontConstraintY: NSLayoutConstraint!</code> - add any desired uiviews to frontView</p> <p>3) Adding BackView - repeat step 2 (connect outlets to <code>@IBOutlet weak var backContainerView: UIView!</code>, <code>@IBOutlet weak var backConstraintY: NSLayoutConstraint!</code>)</p> <p>4) Cell example <a href="https://github.com/Ramotion/expanding-collection/tree/master/DemoExpandingCollection/DemoExpandingCollection/ViewControllers/DemoViewController/Cells">DemoCell</a></p> <a href='#if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_set_code_tag_101_code_for_any_code_frontview_subviews_code_this_view_will_be_hidden_during_the_transition_animation'>If set <code>tag = 101</code> for any <code>FrontView.subviews</code> this view will be hidden during the transition animation</h6> <a href='#create_collectionviewcontroller' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='create_collectionviewcontroller'>Create CollectionViewController</h4> <p>1) Create a UIViewController inheriting from <code>ExpandingViewController</code></p> <p>2) Register Cell and set Cell size:</p> <pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span> <span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span> <span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span> <span class="c1">// register cell</span> <span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"NibName"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span> <span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">)</span> <span class="p">}</span> </code></pre> <p>3) Add UICollectionViewDataSource methods</p> <pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">YourViewController</span> <span class="p">{</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">numberOfItemsInSection</span> <span class="nv">section</span><span class="p">:</span> <span class="kt">Int</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Int</span> <span class="p">{</span> <span class="k">return</span> <span class="n">items</span><span class="o">.</span><span class="n">count</span> <span class="p">}</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">cellForItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UICollectionViewCell</span> <span class="p">{</span> <span class="k">let</span> <span class="nv">cell</span> <span class="o">=</span> <span class="n">collectionView</span><span class="o">.</span><span class="nf">dequeueReusableCellWithReuseIdentifier</span><span class="p">(</span><span class="s">"CellIdentifier"</span><span class="p">),</span> <span class="nv">forIndexPath</span><span class="p">:</span> <span class="n">indexPath</span><span class="p">)</span> <span class="c1">// configure cell</span> <span class="k">return</span> <span class="n">cell</span> <span class="p">}</span> <span class="p">}</span> </code></pre> <p>4) Open Cell animation</p> <pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span> <span class="n">itemSize</span> <span class="o">=</span> <span class="kt">CGSize</span><span class="p">(</span><span class="nv">width</span><span class="p">:</span> <span class="mi">214</span><span class="p">,</span> <span class="nv">height</span><span class="p">:</span> <span class="mi">264</span><span class="p">)</span> <span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span> <span class="c1">// register cell</span> <span class="k">let</span> <span class="nv">nib</span> <span class="o">=</span> <span class="kt">UINib</span><span class="p">(</span><span class="nv">nibName</span><span class="p">:</span> <span class="s">"CellIdentifier"</span><span class="p">,</span> <span class="nv">bundle</span><span class="p">:</span> <span class="kc">nil</span><span class="p">)</span> <span class="n">collectionView</span><span class="p">?</span><span class="o">.</span><span class="nf">registerNib</span><span class="p">(</span><span class="n">nib</span><span class="p">,</span> <span class="nv">forCellWithReuseIdentifier</span><span class="p">:</span> <span class="kt">String</span><span class="p">(</span><span class="kt">DemoCollectionViewCell</span><span class="p">))</span> <span class="p">}</span> </code></pre> <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">collectionView</span><span class="p">(</span><span class="nv">collectionView</span><span class="p">:</span> <span class="kt">UICollectionView</span><span class="p">,</span> <span class="n">didSelectItemAtIndexPath</span> <span class="nv">indexPath</span><span class="p">:</span> <span class="kt">NSIndexPath</span><span class="p">)</span> <span class="p">{</span> <span class="n">cell</span><span class="o">.</span><span class="nf">cellIsOpen</span><span class="p">(</span><span class="o">!</span><span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span><span class="p">)</span> <span class="p">}</span> </code></pre> <a href='#if_you_use_this_delegates_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='if_you_use_this_delegates_method'>if you use this delegates method:</h6> <pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) func scrollViewDidEndDecelerating(scrollView: UIScrollView) </code></pre> <a href='#must_call_super_method' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h6 id='must_call_super_method'>must call super method:</h6> <pre class="highlight plaintext"><code>func collectionView(collectionView: UICollectionView, willDisplayCell cell: UICollectionViewCell, forItemAtIndexPath indexPath: NSIndexPath) { super.collectionView(collectionView: collectionView, willDisplayCell cell: cell, forItemAtIndexPath indexPath: indexPath) // code } func scrollViewDidEndDecelerating(scrollView: UIScrollView) { super.scrollViewDidEndDecelerating(scrollView: scrollView) // code } </code></pre> <a href='#transition_animation' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h4 id='transition_animation'>Transition animation</h4> <p>1) Create a UITableViewController inheriting from <code>ExpandingTableViewController</code></p> <p>2) Set header height default 236</p> <pre class="highlight swift"><code><span class="k">override</span> <span class="kd">func</span> <span class="nf">viewDidLoad</span><span class="p">()</span> <span class="p">{</span> <span class="k">super</span><span class="o">.</span><span class="nf">viewDidLoad</span><span class="p">()</span> <span class="n">headerHeight</span> <span class="o">=</span> <span class="o">***</span> <span class="p">}</span> </code></pre> <p>3) Call the push method in YourViewController to YourTableViewController</p> <pre class="highlight swift"><code> <span class="k">if</span> <span class="n">cell</span><span class="o">.</span><span class="n">isOpened</span> <span class="o">==</span> <span class="kc">true</span> <span class="p">{</span> <span class="k">let</span> <span class="nv">vc</span><span class="p">:</span> <span class="kt">YourTableViewController</span> <span class="o">=</span> <span class="c1">// ... create view controller </span> <span class="nf">pushToViewController</span><span class="p">(</span><span class="n">vc</span><span class="p">)</span> <span class="p">}</span> </code></pre> <p>4) For back transition use <code>popTransitionAnimation()</code></p> <a href='#license' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='license'>License</h2> <p>Expanding collection is released under the MIT license. See <a href="./LICENSE">LICENSE</a> for details.</p> <a href='#about' class='anchor' aria-hidden=true><span class="header-anchor"></span></a><h2 id='about'>About</h2> <p>The project maintained by <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">app development agency</a> <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">Ramotion Inc.</a> See our other <a href="https://github.com/ramotion">open-source projects</a> or <a href="https://ramotion.com?utm_source=gthb&amp;utm_medium=special&amp;utm_campaign=expanding-collection">hire</a> us to design, develop, and grow your product.</p> <p><a href="https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection"><img src="https://img.shields.io/twitter/url/http/shields.io.svg?style=social" alt="Twitter URL"></a> <a href="https://twitter.com/ramotion"><img src="https://img.shields.io/twitter/follow/ramotion.svg?style=social" alt="Twitter Follow"></a></p> </section> </section> <section id="footer"> <p>&copy; 2016 <a class="link" href="" target="_blank" rel="external">AlexKalinkin</a>. All rights reserved. (Last updated: 2016-06-10)</p> <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.5.0</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p> </section> </article> </div> </body> </div> </html>
Ramotion/expanding-collection
docs/index.html
HTML
mit
16,620
/** * Zepernick jQuery plugins */ (function($) { $.fn.dataTableSearch = function(delay) { //console.log("data table search plugin..."); var dt = this; this.find("thead input").on( 'keyup', function (event) { getInput = function() { return $(event.target); }; $z.delay(delay, function() { var td = getInput().closest("td"); var index = td.index(); //console.log("index is " + index); dt.DataTable() .columns(index) .search(getInput().val()) .draw(); }); }); return this; }; function delay(){ var timer = 0; return function(ms, callback){ clearTimeout (timer); timer = setTimeout(callback, ms); }; }; })(jQuery);
rickyalex/cts
assets/js/jQuery.dtplugin.js
JavaScript
mit
816
using Exercism.CSharp.Output; namespace Exercism.CSharp.Exercises.Generators { public class Poker : GeneratorExercise { protected override void UpdateTestMethod(TestMethod testMethod) { testMethod.UseVariablesForInput = true; testMethod.UseVariableForExpected = true; testMethod.UseVariableForTested = true; } } }
ErikSchierboom/xcsharp
generators/Exercises/Generators/Poker.cs
C#
mit
390
<!-- nav bar --> <ng-include src="'app/views/foNavbar.view.html'"></ng-include> <div class="fo-edit-main-div" data-ng-init="getFarmOwner()"> <div class="fo-edit-block"> <h4>Edit Profile</h4> <div class="alert alert-danger collapse" id="error"> <strong>{{error}}</strong> </div> <form role="form"> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="text" class="form-control" ng-model="farmOwner.firstname" placeholder="First Name"> </div> </div> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="text" class="form-control" ng-model="farmOwner.lastname" placeholder="Last Name"> </div> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="email" class="form-control" ng-model="farmOwner.email" placeholder="Email Address"> </div> </div> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="tel" class="form-control" ng-model="farmOwner.phoneNo" placeholder="Phone Number"> </div> </div> </div> <hr> <div class="form-group"> <input type="text" class="form-control" ng-model="farmOwner.farmName" placeholder="Farm Name"> </div> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6 form-group"> <select class="form-control" ng-model="farmOwner.agricType"> <option>Arable</option> <option>Livestock</option> <option>Mixed</option> </select> </div> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="number" class="form-control" ng-model="farmOwner.numOfEmployees" placeholder="Number of Employees"> </div> </div> </div> <div class="form-group"> <input type="text" class="form-control" ng-model="farmOwner.address" placeholder="Address"> </div> <div class="row"> <div class="col-xs-12 col-sm-6 col-md-6"> <select ng-model="farmOwner.state" class="form-control"> <option>Abia</option> <option>Adamawa</option> <option>Akwa Ibom</option> <option>Anambra</option> <option>Bauchi</option> <option>Bayelsa</option> <option>Benue</option> <option>Borno</option> <option>Cross River</option> <option>Delta</option> <option>Ebonyi</option> <option>Edo</option> <option>Ekiti</option> <option>Enugu</option> <option>Federal Capital Territory</option> <option>Gombe</option> <option>Imo</option> <option>Jigawa</option> <option>Kaduna</option> <option>Kano</option> <option>Katsina</option> <option>Kebbi</option> <option>Kogi</option> <option>Kwara</option> <option>Lagos</option> <option>Nassarawa</option> <option>Niger</option> <option>Ogun</option> <option>Ondo</option> <option>Osun</option> <option>Oyo</option> <option>Plateau</option> <option>Rivers</option> <option>Sokoto</option> <option>Taraba</option> <option>Yobe</option> <option>Zamfara</option> </select> </div> <div class="col-xs-12 col-sm-6 col-md-6"> <div class="form-group"> <input type="text" class="form-control" ng-model="farmOwner.website" placeholder="Website"> </div> </div> </div> <div class="form-group"> <textarea class="form-control" rows="7" placeholder="Farm Description (This will appear on your profile.)"></textarea> </div> <div class="row"> <div class="col-xs-12 col-md-12"><a href="#" ng-click="editFarmOwner()" id="signupin-but" class="btn btn-default mbc btn-block">Update Profile</a></div> </div> </form> </div> </div>
andela-ayusuf/farmplace
public/app/views/foEditProfile.view.html
HTML
mit
4,296