answer
stringlengths 15
1.25M
|
|---|
import Icon from '../components/Icon.vue'
Icon.register({"arrows":{"width":1792,"height":1792,"paths":[{"d":"M1792 896q0 26-19 45l-256 256q-19 19-45 <API key> 0 45 19t19 45-19 45l-256 256q-19 19-45 <API key> <API key> 26-19 45t-45 <API key> 45-19t45 19 19 <API key> 0-45-19t-19-45 19-45l256-256q19-19 45-19t45 19l256 256q19 19 19 45t-19 45-45 <API key> 19-45t45-19 45 19l256 256q19 19 19 45z"}]}})
|
require 'test_helper'
require 'bearychat/rtm'
class BearychatTest < Minitest::Test
MOCK_HOOK_URI = 'https://hook.bearychat.com/mock/incoming/hook'
def <API key>
refute_nil ::Bearychat::VERSION
end
def <API key>
assert_equal true, ::Bearychat.incoming(MOCK_HOOK_URI).is_a?(::Bearychat::Incoming)
end
def test_incoming_send
incoming_stub = stub_request(:post, MOCK_HOOK_URI).with(body: hash_including(:text))
::Bearychat.incoming(MOCK_HOOK_URI).send
assert_requested(incoming_stub)
end
def test_rtm_send
rtm_stub = stub_request(:post, Bearychat::RTM::MESSAGE_URL).with(body: hash_including(:token))
token = 'TOKEN'
::Bearychat.rtm(token).send text: 'test'
assert_requested(rtm_stub)
end
end
|
package iron_hippo_exe
import (
"fmt"
"io"
"net/http"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"google.golang.org/appengine"
"google.golang.org/appengine/log"
"google.golang.org/appengine/urlfetch"
)
const ProjectID = "cpb101demo1"
type <API key> struct {
JobName string `json:"jobName"`
GcsPath string `json:"gcsPath"`
Parameters struct {
InputTable string `json:"inputTable"`
OutputProjectID string `json:"outputProjectId"`
OutputKind string `json:"outputKind"`
} `json:"parameters"`
Environment struct {
TempLocation string `json:"tempLocation"`
Zone string `json:"zone"`
} `json:"environment"`
}
func init() {
http.HandleFunc("/cron/start", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
ctx := appengine.NewContext(r)
client := &http.Client{
Transport: &oauth2.Transport{
Source: google.<API key>(ctx, "https:
Base: &urlfetch.Transport{Context: ctx},
},
}
res, err := client.Post(fmt.Sprintf("https://dataflow.googleapis.com/v1b3/projects/%s/templates", ProjectID), "application/json", r.Body)
if err != nil {
log.Errorf(ctx, "ERROR dataflow: %s", err)
w.WriteHeader(http.<API key>)
return
}
_, err = io.Copy(w, res.Body)
if err != nil {
log.Errorf(ctx, "ERROR Copy API response: %s", err)
w.WriteHeader(http.<API key>)
return
}
w.WriteHeader(res.StatusCode)
}
|
Title: On Git and GitHub Flow
Date: 2015-01-01
Recently, I have been making an added effort to seek out and contribute to open source projects on GitHub. The motivation behind this was largely the [24 Pull Requests](http://24pullrequests.com) project, which encourages developers to submit one pull request for each day in December leading up to Christmas. The prospect of being a new contributor to a large, open source project can be daunting, especially to the novice programmer, so this little bit of extrinsic motivation was a nudge in the right direction.
In learning how to properly make use of Git and GitHub, I've referenced a multitude of different resources. With 2015 having just arrived, I'm sure many people have "contribute to more open source projects" on their list of New Year's resolutions as well, so hopefully this article serves as a useful starting point.
## Finding a Project
Choosing a project is left as an exercise to the reader. However, here are my suggestions:
- Look to see if any software you use on a regular basis is open source. Given your familiarity with the software, you will likely be able to identify (and hack on) some bugs or additional features.
- Check out [trending GitHub repositories](https://github.com/trending) for languages that you're familiar with or ones that you're interested in learning, and pick one that seems friendly towards new contributors (most projects on GitHub are) and well-maintained. This technique is useful as you'll be browsing across projects that your fellow open source developers have also deemed interesting.
Remember that even if you can't contribute directly to the codebase due to lack of experience or being overwhelmed by the scale of the project, open source projects appreciate all sorts of contributions. While not as "prestigious", documentation and unit tests are areas that inevitability need to be addressed, and are a good way to become familiar with the project.
## Getting Started
The first step to using Git is installing it. You can do that from Git's [download page](http://git-scm.com/downloads), or through a package manager like Homebrew. My suggestion is to learn Git from the command line, and to avoid using other Git clients; the command line is universal, so being familiar with it to start with will be beneficial in the long run.
That being said, I do have [GitHub for Mac](https://mac.github.com) installed and I use it fairly frequently for selectively choosing specific parts of a file to commit, which is fairly cumbersome to do from the command line. Also, I find looking through the changes that have been made is much easier with the GitHub application compared to using `git diff`.
## Overview
Git tracks content modifications. It does so primarily through the use of commits. Commits can be thought of as snapshots in the development process, and contain authorship and timestamp information among other pieces of metadata. By committing frequently, it becomes trivial to rollback to an old commit if something goes disastrously (or if your simply don't like the changes you made). Because of this, Git (and any other version control system) is extremely powerful, even for projects that aren't collaborative in nature.
There is a convention behind the formatting of commit messages that should be followed, given the collaborative nature of open source projects. The first (or only) line of the commit is a summary of the changes, 50 characters at most, in the imperative tense (as in *add*, not *added*). If you want to expand further, you should leave a blank line and on the third line, begin an extended description wrapped to 72 characters.
Unfortunately, after prolonged periods of time, the quality of commit messages tends to degrade ([relevant XKCD](http://xkcd.com/1296/)). Don't worry about this, though, as you can avoid forcing others to look at your horribly crafted commit messages through a process known as *rebasing*, discussed later in this article.
## Branches and Pull Requests
One concept that is central to Git and GitHub flow is branching. Branches are pointers to commits. When working on feature additions or fixes in a project, it is advisable to *always* work in a separate branch, and either merge or rebase -- discussed later in much more detail -- into the master branch upon competition.
When you open a pull request on GitHub, the branch that you chose is noted. Pushing additional commits to that specific branch will result in them appearing in the pull request. This is one of the strongest cases for using a new branch for every feature or bug fix -- it makes it trivial to open a pull request for that specific change, without incorporating any unrelated changes.
## To Merge or Not to Merge
Merging is the process of merging the commits made in two branches into one branch. This is done when a branch that is being worked on is deemed complete, and the changes are to be merged into the master branch. In the simplest case (where the only commits that have been made are in the topic branch), this is known as a fast-forward merge, and the commits are "played on top of" the master branch. Fast-forward merges can be performed automatically by Git and require no additional effort on the part of the user performing the merge. In other cases, merging either results in a merge commit or the manual resolution of merge conflicts (if the changes made in the branches contradict one another).
Something that Git tutorials tend to gloss over is the rebase command. The reason for this is that rebasing involves *rewriting history*. When you rebase a set of commits, they will change, and if the older set of commits have already been pushed to a remote repository that others have pulled from, pushing new changes will cause a break in continuity for others who try to pull these newly pushed commits. Because of this, it is recommended to only rebase local commits in most cases.
sh
$ git rebase -i HEAD~n # rebase the last n commits
The `-i` flag stands for *interactive*. Upon executing the command, your `$EDITOR` of choice will open with a list of commits from least recent to most recent preceded by the word "pick":
#!text
pick a5b977a Ensure all expected resource files exist
pick f08e801 Add problems 311–320
pick 969f9e5 Update tests to ensure resource correspondence
Below the list of commits are some instructions about rebasing, including the available commands. To actually rebase, you make changes to the text in the editor and then close it. Here are the operations that you can perform:
- Delete the line, which will remove the commit entirely.
- Change "pick" to a different command, causing the rebase to execute that command instead.
- Rearrange the lines, which will rearrange the order of the commits.
Typically, a project maintainer might ask for you to squash your pull request. What this actually involves doing is rebasing and using the "squash" command to turn multiple commits into just one or a couple logical commits. For example, if you wanted to turn the three commits listed above into one larger commit, you would edit the file to look like the following:
#!text
pick a5b977a Ensure all expected resource files exist
squash f08e801 Add problems 311–320
squash 969f9e5 Update tests to ensure resource correspondence
Upon closing the editor, a new editor will open up that allows you to edit the commit message of the newly created single commit. The commit messages of each of the commits being squashed are included for the sake of convenience, and when the editor is closed, the non-commented lines become the new commit message.
I mentioned before that rebasing should only be done with local changes that have not been pushed to a remote repository, but in a pull request, by definition, the commits have already been pushed to your fork of the main repository. In this case, it is fine to rebase and push, since it can be assumed that people have not been actively making changes on the feature/fix branch that your pull request is based on. However, Git will not let you push the rebased commits using `git push` out of safety; you have to use `git push -f` to *force* the push to happen.
## Putting It All Together
After forking the project on GitHub, the typical GitHub workflow might look something like this:
#!sh
git clone https://github.com/<API key>/PROJECT_NAME.git
cd PROJECT_NAME
git branch my-feature
git checkout my-feature
nano README.md
rm silly-file.txt
git add -A
git commit
git push -u origin my-feature
1. Clone your fork to your local development machine.
2. Change the current directory to the project folder.
3. Create a branch called `my-feature`.
4. Switch to the newly created `my-feature` branch.
5. Make changes to `README.md`.
6. Remove `silly-file.txt`.
7. Stage all (`-A`) changes made, including file creations and deletions. You can specify certain files rather than using the `-A` flag to selectively stage changes.
8. Commit the changes that have been staged. Continue to commit new changes and rebase when needed.
9. Push the `my-feature` branch to remote repository aliased as `origin` (your fork), using the `-u` flag to add the branch as a remote tracking branch. (Subsequent pushes will only requre a `git push` with no additional parameters.) Then, open a pull request using GitHub's web interface!
For other Git-related problems that one may run into, Google can usually provide the answer. Be sure to look at [GitHub's help page](https:
|
File: src/animation/frame.lua
Author: Daniel "lytedev" Flanagan
Website: http://dmf.me
Contains the data to specify a piece of a texture over a period of time.
]]
local Frame = Class{}
function Frame.generate(w, h, imgw, imgh, num, time, frames, offset, start)
local start = start or 0
local tw = math.floor(imgw / w)
local th = math.floor(imgh / h)
local num = num or (tw * th)
local framesArray = {}
for i = start, num - 1, 1 do
-- To change left-to-right-down, modify xid and yid calcs
local xid = i % tw
local yid = math.floor(i / tw)
local frame = Frame(Vector(xid * w, yid * h), Vector(w, h), time, frames, offset)
table.insert(framesArray, frame)
end
return framesArray
end
function Frame:init(source, size, time, frames, offset)
self.source = source or Vector(0, 0)
self.size = size or Vector(16, 16)
self.offset = offset or Vector(0, 0)
self.time = time or 0.2
self.frames = frames or nil
end
function Frame:__tostring()
return string.format("Source: (%s), Size: (%s), Time: %ds, Frames: %i, Offset: (%s)", tostring(self.source), tostring(self.size), self.time, self.frames or 0, tostring(self.offset))
end
return Frame
|
# Input Number
Simple jQuery plugin to add plus and minus controls to an input element
## Installation
Installation can be done through bower
bower install develo-input-number --save
Then add the script and jQuery to your page.
## Example Usage
// Default options, feel free to override them.
var options = {
// Style customisations
className: '<API key>',
buttonClassName: 'button',
// Min and max
max: null,
min: null,
// Plus and minus buttons. Supports html
minusHtml: '-',
plusHtml: '+',
// Callbacks
onDecreased: function( value ){},
onIncreased: function( value ){}
};
$( 'input' ).develoInputNumber();
|
#import <UIKit/UIKit.h>
#import "TiModule.h"
@class <API key>;
@class HTTPServer;
@interface <API key> : TiModule
{
HTTPServer *httpServer;
BOOL wasRunning;
}
@property (nonatomic, assign) NSNumber* <API key>;
-(id)startServer:(id)args;
@end
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="<API key>" content="yes">
<meta name="<API key>" content="white">
<title>My App</title>
<!-- Path to Framework7 Library CSS-->
<link rel="stylesheet" href="https://framework7.io/dist/css/framework7.ios.min.css">
<link rel="stylesheet" href="https://framework7.io/dist/css/framework7.ios.colors.min.css">
<!-- Path to your custom app styles-->
<link rel="stylesheet" href="css/Framework7.QuickActions.css">
<link rel="stylesheet" href="css/my-app.css">
</head>
<body>
<!-- Status bar overlay for fullscreen mode-->
<div class="statusbar-overlay"></div>
<!-- Panels overlay-->
<div class="panel-overlay"></div>
<!-- Left panel with reveal effect-->
<div class="panel panel-left panel-reveal">
<div class="content-block">
<p>Left panel content goes here</p>
</div>
</div>
<!-- Right panel with cover effect-->
<div class="panel panel-right panel-cover">
<div class="content-block">
<p>Right panel content goes here</p>
</div>
</div>
<!-- Views-->
<div class="views">
<!-- Your main view, should have "view-main" class-->
<div class="view view-main">
<!-- Top Navbar-->
<div class="navbar">
<!-- Navbar inner for Index page-->
<div data-page="index" class="navbar-inner">
<!-- We have home navbar without left link-->
<div class="center sliding">Awesome App</div>
<div class="right">
<!-- Right link contains only icon - additional "icon-only" class--><a href="#" class="link icon-only open-panel"> <i class="icon icon-bars"></i></a>
</div>
</div>
<!-- Navbar inner for About page-->
<div data-page="about" class="navbar-inner cached">
<div class="left sliding"><a href="#" class="back link"> <i class="icon icon-back"></i><span>Back</span></a></div>
<div class="center sliding">About Us</div>
</div>
<!-- Navbar inner for Services page-->
<div data-page="services" class="navbar-inner cached">
<div class="left sliding"><a href="#" class="back link"> <i class="icon icon-back"></i><span>Back</span></a></div>
<div class="center sliding">Services</div>
</div>
<!-- Navbar inner for Form page-->
<div data-page="form" class="navbar-inner cached">
<div class="left sliding"><a href="#" class="back link"> <i class="icon icon-back"></i><span>Back</span></a></div>
<div class="center sliding">Form</div>
</div>
</div>
<!-- Pages, because we need fixed-through navbar and toolbar, it has additional appropriate classes-->
<div class="pages navbar-through toolbar-through">
<!-- Index Page-->
<div data-page="index" class="page">
<!-- Scrollable page content-->
<div class="page-content">
<div class="content-block-title">Welcome To My Awesome App</div>
<div class="content-block">
<div class="content-block-inner">
<p>Couple of worlds here because my app is so awesome!</p>
<p><a href="#" <API key>="#action1" class="link quick-actions">Duis sed</a> <a href="#" data-href='hi @ds' class="peekPop">erat ac</a> eros ultrices pharetra id ut tellus. Praesent rhoncus enim ornare ipsum aliquet ultricies. Pellentesque sodales erat quis elementum sagittis.</p>
</div>
</div>
<div class="content-block-title">What about simple navigation?</div>
<div class="list-block">
<ul>
<li><a href="#about" class="item-link">
<div class="item-content">
<div class="item-inner">
<div class="item-title">About</div>
</div>
</div></a></li>
<li><a href="#services" class="item-link">
<div class="item-content">
<div class="item-inner">
<div class="item-title">Services</div>
</div>
</div></a></li>
<li><a href="#form" class="item-link">
<div class="item-content">
<div class="item-inner">
<div class="item-title">Form</div>
</div>
</div></a></li>
</ul>
</div>
<div class="content-block-title">Side panels</div>
<div class="content-block">
<div class="row">
<div class="col-50"><a href="#" data-panel="left" class="button open-panel">Left Panel</a></div>
<div class="col-50"><a href="#" data-panel="right" class="button open-panel">Right Panel</a></div>
</div>
</div>
</div>
</div>
<!-- About Page-->
<div data-page="about" class="page cached">
<div class="page-content">
<div class="content-block">
<p>You may go <a href="#" class="back">back</a> or load <a href="#services">Services</a> page.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris.</p>
</div>
</div>
</div>
<!-- Services Page-->
<div data-page="services" class="page cached">
<div class="page-content">
<div class="content-block">
<p>You may go <a href="#" class="back">back</a> or load <a href="#about">About</a> page.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla vel commodo massa, eu adipiscing mi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Phasellus ultricies dictum neque, non varius tortor fermentum at. Curabitur auctor cursus imperdiet. Nam molestie nisi nec est lacinia volutpat in a purus. Maecenas consectetur condimentum viverra. Donec ultricies nec sem vel condimentum. Phasellus eu tincidunt enim, sit amet convallis orci. Vestibulum quis fringilla dolor. </p>
<p>Mauris commodo lacus at nisl lacinia, nec facilisis erat rhoncus. Sed eget pharetra nunc. Aenean vitae vehicula massa, sed sagittis ante. Quisque luctus nec velit dictum convallis. Nulla facilisi. Ut sed erat nisi. Donec non dolor massa. Mauris malesuada dolor velit, in suscipit leo consectetur vitae. Duis tempus ligula non eros pretium condimentum. Cras sed dolor odio.</p>
<p>Suspendisse commodo adipiscing urna, a aliquet sem egestas in. Sed tincidunt dui a magna facilisis bibendum. Nunc euismod consectetur lorem vitae molestie. Proin mattis tellus libero, non hendrerit neque eleifend ac. Pellentesque interdum velit at lacus consectetur scelerisque et id dui. Praesent non fringilla dui, a elementum purus. Proin vitae lacus libero. Nunc eget lectus non mi iaculis interdum vel a velit. Nullam tincidunt purus id lacus ornare, at elementum turpis euismod. Cras mauris enim, congue eu nisl sit amet, pulvinar semper erat. Suspendisse sed mauris diam.</p>
<p>Nam eu mauris leo. Pellentesque aliquam vehicula est, sed lobortis tellus malesuada facilisis. Fusce at hendrerit ligula. Donec eu nibh convallis, pulvinar enim quis, lacinia diam. Ut semper ac magna nec ornare. Integer placerat justo sed nunc suscipit facilisis. Vestibulum ac tincidunt augue. Duis eu aliquet mauris, vel luctus mauris. Nulla non augue nec diam pharetra posuere at in mauris. </p>
</div>
</div>
</div>
<!-- Form Page-->
<div data-page="form" class="page cached">
<div class="page-content">
<div class="content-block-title">Form Example</div>
<div class="list-block">
<ul>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-name"></i></div>
<div class="item-inner">
<div class="item-title label">Name</div>
<div class="item-input">
<input type="text" placeholder="Your name">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-email"></i></div>
<div class="item-inner">
<div class="item-title label">E-mail</div>
<div class="item-input">
<input type="email" placeholder="E-mail">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-url"></i></div>
<div class="item-inner">
<div class="item-title label">URL</div>
<div class="item-input">
<input type="url" placeholder="URL">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-password"></i></div>
<div class="item-inner">
<div class="item-title label">Password</div>
<div class="item-input">
<input type="password" placeholder="Password">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-tel"></i></div>
<div class="item-inner">
<div class="item-title label">Phone</div>
<div class="item-input">
<input type="tel" placeholder="Phone">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-gender"></i></div>
<div class="item-inner">
<div class="item-title label">Gender</div>
<div class="item-input">
<select>
<option>Male</option>
<option>Female</option>
</select>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-calendar"></i></div>
<div class="item-inner">
<div class="item-title label">Birth date</div>
<div class="item-input">
<input type="date" placeholder="Birth day" value="2014-04-30">
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-toggle"></i></div>
<div class="item-inner">
<div class="item-title label">Switch</div>
<div class="item-input">
<label class="label-switch">
<input type="checkbox">
<div class="checkbox"></div>
</label>
</div>
</div>
</div>
</li>
<li>
<div class="item-content">
<div class="item-media"><i class="icon icon-form-settings"></i></div>
<div class="item-inner">
<div class="item-title label">Slider</div>
<div class="item-input">
<div class="range-slider">
<input type="range" min="0" max="100" value="50" step="0.1">
</div>
</div>
</div>
</div>
</li>
<li class="align-top">
<div class="item-content">
<div class="item-media"><i class="icon icon-form-comment"></i></div>
<div class="item-inner">
<div class="item-title label">Textarea</div>
<div class="item-input">
<textarea></textarea>
</div>
</div>
</div>
</li>
</ul>
</div>
<div class="content-block">
<div class="row">
<div class="col-50"><a href="#" class="button button-big button-fill color-red">Cancel</a></div>
<div class="col-50">
<input type="submit" value="Submit" class="button button-big button-fill color-green">
</div>
</div>
</div>
<div class="content-block-title">Checkbox group</div>
<div class="list-block">
<ul>
<li>
<label class="label-checkbox item-content">
<input type="checkbox" name="ks-checkbox" value="Books" checked>
<div class="item-media"><i class="icon icon-form-checkbox"></i></div>
<div class="item-inner">
<div class="item-title">Books</div>
</div>
</label>
</li>
<li>
<label class="label-checkbox item-content">
<input type="checkbox" name="ks-checkbox" value="Movies">
<div class="item-media"><i class="icon icon-form-checkbox"></i></div>
<div class="item-inner">
<div class="item-title">Movies</div>
</div>
</label>
</li>
<li>
<label class="label-checkbox item-content">
<input type="checkbox" name="ks-checkbox" value="Food">
<div class="item-media"><i class="icon icon-form-checkbox"></i></div>
<div class="item-inner">
<div class="item-title">Food</div>
</div>
</label>
</li>
<li>
<label class="label-checkbox item-content">
<input type="checkbox" name="ks-checkbox" value="Drinks">
<div class="item-media"><i class="icon icon-form-checkbox"></i></div>
<div class="item-inner">
<div class="item-title">Drinks</div>
</div>
</label>
</li>
</ul>
</div>
<div class="content-block-title">Radio buttons group</div>
<div class="list-block">
<ul>
<li>
<label class="label-radio item-content">
<input type="radio" name="ks-radio" value="Books" checked>
<div class="item-inner">
<div class="item-title">Books</div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="ks-radio" value="Movies">
<div class="item-inner">
<div class="item-title">Movies</div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="ks-radio" value="Food">
<div class="item-inner">
<div class="item-title">Food</div>
</div>
</label>
</li>
<li>
<label class="label-radio item-content">
<input type="radio" name="ks-radio" value="Drinks">
<div class="item-inner">
<div class="item-title">Drinks</div>
</div>
</label>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Bottom Toolbar-->
<div class="toolbar">
<div class="toolbar-inner">
<a href="#" class="link">Link 1</a>
<a href="#" class="link">Link 2</a></div>
</div>
</div>
</div>
<!-- Quick actions -->
<ul id="action1" class="quick-actions-menu">
<li class="quickaction-item sub-menu-item">
<a class="quickaction-link" href="#">New message</a>
</li>
<li class="quickaction-item sub-menu-item">
<a class="quickaction-link" href="#">Inbox</a>
</li>
</ul>
<!-- Peek and Pop -->
<!-- Path to Framework7 Library JS-->
<script type="text/javascript" src="https://framework7.io/dist/js/framework7.min.js"></script>
<!-- Path to your app js-->
<script type="text/javascript" src="js/Hammer.js"></script>
<!-- Maybe in future: script type="text/javascript" src="js/Forcify.js"></script-->
<script type="text/javascript" src="js/Framework7.QuickActions.js"></script>
<script type="text/javascript" src="js/my-app.js"></script>
</body>
</html>
|
# Controllers
- [Introduction](#introduction)
- [Writing Controllers](#writing-controllers)
- [Basic Controllers](#basic-controllers)
- [Single Action Controllers](#<API key>)
- [Controller Middleware](#<API key>)
- [Resource Controllers](#<API key>)
- [Partial Resource Routes](#<API key>)
- [Nested Resources](#<API key>)
- [Naming Resource Routes](#<API key>)
- [Naming Resource Route Parameters](#<API key>)
- [Scoping Resource Routes](#<API key>)
- [Localizing Resource URIs](#<API key>)
- [Supplementing Resource Controllers](#<API key>)
- [Dependency Injection & Controllers](#<API key>)
<a name="introduction"></a>
## Introduction
Instead of defining all of your request handling logic as closures in your route files, you may wish to organize this behavior using "controller" classes. Controllers can group related request handling logic into a single class. For example, a `UserController` class might handle all incoming requests related to users, including showing, creating, updating, and deleting users. By default, controllers are stored in the `app/Http/Controllers` directory.
<a name="writing-controllers"></a>
## Writing Controllers
<a name="basic-controllers"></a>
Basic Controllers
Let's take a look at an example of a basic controller. Note that the controller extends the base controller class included with Laravel: `App\Http\Controllers\Controller`:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\User;
class UserController extends Controller
{
/**
* Show the profile for a given user.
*
* @param int $id
* @return \Illuminate\View\View
*/
public function show($id)
{
return view('user.profile', [
'user' => User::findOrFail($id)
]);
}
}
You can define a route to this controller method like so:
use App\Http\Controllers\UserController;
Route::get('/user/{id}', [UserController::class, 'show']);
When an incoming request matches the specified route URI, the `show` method on the `App\Http\Controllers\UserController` class will be invoked and the route parameters will be passed to the method.
> {tip} Controllers are not **required** to extend a base class. However, you will not have access to convenient features such as the `middleware` and `authorize` methods.
<a name="<API key>"></a>
Single Action Controllers
If a controller action is particularly complex, you might find it convenient to dedicate an entire controller class to that single action. To accomplish this, you may define a single `__invoke` method within the controller:
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use App\Models\User;
class ProvisionServer extends Controller
{
/**
* Provision a new web server.
*
* @return \Illuminate\Http\Response
*/
public function __invoke()
{
}
}
When registering routes for single action controllers, you do not need to specify a controller method. Instead, you may simply pass the name of the controller to the router:
use App\Http\Controllers\ProvisionServer;
Route::post('/server', ProvisionServer::class);
You may generate an invokable controller by using the `--invokable` option of the `make:controller` Artisan command:
shell
php artisan make:controller ProvisionServer --invokable
> {tip} Controller stubs may be customized using [stub publishing](/docs/{{version}}/artisan#stub-customization).
<a name="<API key>"></a>
## Controller Middleware
[Middleware](/docs/{{version}}/middleware) may be assigned to the controller's routes in your route files:
Route::get('profile', [UserController::class, 'show'])->middleware('auth');
Or, you may find it convenient to specify middleware within your controller's constructor. Using the `middleware` method within your controller's constructor, you can assign middleware to the controller's actions:
class UserController extends Controller
{
/**
* Instantiate a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('log')->only('index');
$this->middleware('subscribed')->except('store');
}
}
Controllers also allow you to register middleware using a closure. This provides a convenient way to define an inline middleware for a single controller without defining an entire middleware class:
$this->middleware(function ($request, $next) {
return $next($request);
});
<a name="<API key>"></a>
## Resource Controllers
If you think of each Eloquent model in your application as a "resource", it is typical to perform the same sets of actions against each resource in your application. For example, imagine your application contains a `Photo` model and a `Movie` model. It is likely that users can create, read, update, or delete these resources.
Because of this common use case, Laravel resource routing assigns the typical create, read, update, and delete ("CRUD") routes to a controller with a single line of code. To get started, we can use the `make:controller` Artisan command's `--resource` option to quickly create a controller to handle these actions:
shell
php artisan make:controller PhotoController --resource
This command will generate a controller at `app/Http/Controllers/PhotoController.php`. The controller will contain a method for each of the available resource operations. Next, you may register a resource route that points to the controller:
use App\Http\Controllers\PhotoController;
Route::resource('photos', PhotoController::class);
This single route declaration creates multiple routes to handle a variety of actions on the resource. The generated controller will already have methods stubbed for each of these actions. Remember, you can always get a quick overview of your application's routes by running the `route:list` Artisan command.
You may even register many resource controllers at once by passing an array to the `resources` method:
Route::resources([
'photos' => PhotoController::class,
'posts' => PostController::class,
]);
<a name="<API key>"></a>
# Actions Handled By Resource Controller
Verb | URI | Action | Route Name
GET | `/photos` | index | photos.index
GET | `/photos/create` | create | photos.create
POST | `/photos` | store | photos.store
GET | `/photos/{photo}` | show | photos.show
GET | `/photos/{photo}/edit` | edit | photos.edit
PUT/PATCH | `/photos/{photo}` | update | photos.update
DELETE | `/photos/{photo}` | destroy | photos.destroy
<a name="<API key>"></a>
# Customizing Missing Model Behavior
Typically, a 404 HTTP response will be generated if an implicitly bound resource model is not found. However, you may customize this behavior by calling the `missing` method when defining your resource route. The `missing` method accepts a closure that will be invoked if an implicitly bound model can not be found for any of the resource's routes:
use App\Http\Controllers\PhotoController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
Route::resource('photos', PhotoController::class)
->missing(function (Request $request) {
return Redirect::route('photos.index');
});
<a name="<API key>"></a>
# Specifying The Resource Model
If you are using [route model binding](/docs/{{version}}/routing#route-model-binding) and would like the resource controller's methods to type-hint a model instance, you may use the `--model` option when generating the controller:
shell
php artisan make:controller PhotoController --model=Photo --resource
<a name="<API key>"></a>
# Generating Form Requests
You may provide the `--requests` option when generating a resource controller to instruct Artisan to generate [form request classes](/docs/{{version}}/validation#<API key>) for the controller's storage and update methods:
shell
php artisan make:controller PhotoController --model=Photo --resource --requests
<a name="<API key>"></a>
Partial Resource Routes
When declaring a resource route, you may specify a subset of actions the controller should handle instead of the full set of default actions:
use App\Http\Controllers\PhotoController;
Route::resource('photos', PhotoController::class)->only([
'index', 'show'
]);
Route::resource('photos', PhotoController::class)->except([
'create', 'store', 'update', 'destroy'
]);
<a name="api-resource-routes"></a>
# API Resource Routes
When declaring resource routes that will be consumed by APIs, you will commonly want to exclude routes that present HTML templates such as `create` and `edit`. For convenience, you may use the `apiResource` method to automatically exclude these two routes:
use App\Http\Controllers\PhotoController;
Route::apiResource('photos', PhotoController::class);
You may register many API resource controllers at once by passing an array to the `apiResources` method:
use App\Http\Controllers\PhotoController;
use App\Http\Controllers\PostController;
Route::apiResources([
'photos' => PhotoController::class,
'posts' => PostController::class,
]);
To quickly generate an API resource controller that does not include the `create` or `edit` methods, use the `--api` switch when executing the `make:controller` command:
shell
php artisan make:controller PhotoController --api
<a name="<API key>"></a>
Nested Resources
Sometimes you may need to define routes to a nested resource. For example, a photo resource may have multiple comments that may be attached to the photo. To nest the resource controllers, you may use "dot" notation in your route declaration:
use App\Http\Controllers\<API key>;
Route::resource('photos.comments', <API key>::class);
This route will register a nested resource that may be accessed with URIs like the following:
/photos/{photo}/comments/{comment}
<a name="<API key>"></a>
# Scoping Nested Resources
Laravel's [implicit model binding](/docs/{{version}}/routing#<API key>) feature can automatically scope nested bindings such that the resolved child model is confirmed to belong to the parent model. By using the `scoped` method when defining your nested resource, you may enable automatic scoping as well as instruct Laravel which field the child resource should be retrieved by. For more information on how to accomplish this, please see the documentation on [scoping resource routes](#<API key>).
<a name="shallow-nesting"></a>
# Shallow Nesting
Often, it is not entirely necessary to have both the parent and the child IDs within a URI since the child ID is already a unique identifier. When using unique identifiers such as auto-incrementing primary keys to identify your models in URI segments, you may choose to use "shallow nesting":
use App\Http\Controllers\CommentController;
Route::resource('photos.comments', CommentController::class)->shallow();
This route definition will define the following routes:
Verb | URI | Action | Route Name
GET | `/photos/{photo}/comments` | index | photos.comments.index
GET | `/photos/{photo}/comments/create` | create | photos.comments.create
POST | `/photos/{photo}/comments` | store | photos.comments.store
GET | `/comments/{comment}` | show | comments.show
GET | `/comments/{comment}/edit` | edit | comments.edit
PUT/PATCH | `/comments/{comment}` | update | comments.update
DELETE | `/comments/{comment}` | destroy | comments.destroy
<a name="<API key>"></a>
Naming Resource Routes
By default, all resource controller actions have a route name; however, you can override these names by passing a `names` array with your desired route names:
use App\Http\Controllers\PhotoController;
Route::resource('photos', PhotoController::class)->names([
'create' => 'photos.build'
]);
<a name="<API key>"></a>
Naming Resource Route Parameters
By default, `Route::resource` will create the route parameters for your resource routes based on the "singularized" version of the resource name. You can easily override this on a per resource basis using the `parameters` method. The array passed into the `parameters` method should be an associative array of resource names and parameter names:
use App\Http\Controllers\AdminUserController;
Route::resource('users', AdminUserController::class)->parameters([
'users' => 'admin_user'
]);
The example above generates the following URI for the resource's `show` route:
/users/{admin_user}
<a name="<API key>"></a>
Scoping Resource Routes
Laravel's [scoped implicit model binding](/docs/{{version}}/routing#<API key>) feature can automatically scope nested bindings such that the resolved child model is confirmed to belong to the parent model. By using the `scoped` method when defining your nested resource, you may enable automatic scoping as well as instruct Laravel which field the child resource should be retrieved by:
use App\Http\Controllers\<API key>;
Route::resource('photos.comments', <API key>::class)->scoped([
'comment' => 'slug',
]);
This route will register a scoped nested resource that may be accessed with URIs like the following:
/photos/{photo}/comments/{comment:slug}
When using a custom keyed implicit binding as a nested route parameter, Laravel will automatically scope the query to retrieve the nested model by its parent using conventions to guess the relationship name on the parent. In this case, it will be assumed that the `Photo` model has a relationship named `comments` (the plural of the route parameter name) which can be used to retrieve the `Comment` model.
<a name="<API key>"></a>
Localizing Resource URIs
By default, `Route::resource` will create resource URIs using English verbs. If you need to localize the `create` and `edit` action verbs, you may use the `Route::resourceVerbs` method. This may be done at the beginning of the `boot` method within your application's `App\Providers\<API key>`:
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
Route::resourceVerbs([
'create' => 'crear',
'edit' => 'editar',
]);
}
Once the verbs have been customized, a resource route registration such as `Route::resource('fotos', PhotoController::class)` will produce the following URIs:
/fotos/crear
/fotos/{foto}/editar
<a name="<API key>"></a>
Supplementing Resource Controllers
If you need to add additional routes to a resource controller beyond the default set of resource routes, you should define those routes before your call to the `Route::resource` method; otherwise, the routes defined by the `resource` method may unintentionally take precedence over your supplemental routes:
use App\Http\Controller\PhotoController;
Route::get('/photos/popular', [PhotoController::class, 'popular']);
Route::resource('photos', PhotoController::class);
> {tip} Remember to keep your controllers focused. If you find yourself routinely needing methods outside of the typical set of resource actions, consider splitting your controller into two, smaller controllers.
<a name="<API key>"></a>
## Dependency Injection & Controllers
<a name="<API key>"></a>
# Constructor Injection
The Laravel [service container](/docs/{{version}}/container) is used to resolve all Laravel controllers. As a result, you are able to type-hint any dependencies your controller may need in its constructor. The declared dependencies will automatically be resolved and injected into the controller instance:
<?php
namespace App\Http\Controllers;
use App\Repositories\UserRepository;
class UserController extends Controller
{
/**
* The user repository instance.
*/
protected $users;
/**
* Create a new controller instance.
*
* @param \App\Repositories\UserRepository $users
* @return void
*/
public function __construct(UserRepository $users)
{
$this->users = $users;
}
}
<a name="method-injection"></a>
# Method Injection
In addition to constructor injection, you may also type-hint dependencies on your controller's methods. A common use-case for method injection is injecting the `Illuminate\Http\Request` instance into your controller methods:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Store a new user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$name = $request->name;
}
}
If your controller method is also expecting input from a route parameter, list your route arguments after your other dependencies. For example, if your route is defined like so:
use App\Http\Controllers\UserController;
Route::put('/user/{id}', [UserController::class, 'update']);
You may still type-hint the `Illuminate\Http\Request` and access your `id` parameter by defining your controller method as follows:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserController extends Controller
{
/**
* Update the given user.
*
* @param \Illuminate\Http\Request $request
* @param string $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
}
}
|
using NUnit.Framework;
using Ploeh.AutoFixture;
using RememBeer.Models.Dtos;
using RememBeer.Tests.Utils;
namespace RememBeer.Tests.Models.Dtos
{
[TestFixture]
public class BeerDtoTests : TestClassBase
{
[Test]
public void <API key>()
{
var id = this.Fixture.Create<int>();
var breweryId = this.Fixture.Create<int>();
var name = this.Fixture.Create<string>();
var breweryName = this.Fixture.Create<string>();
var dto = new BeerDto();
dto.Id = id;
dto.BreweryId = breweryId;
dto.Name = name;
dto.BreweryName = breweryName;
Assert.AreEqual(id, dto.Id);
Assert.AreEqual(breweryId, dto.BreweryId);
Assert.AreSame(name, dto.Name);
Assert.AreSame(breweryName, dto.BreweryName);
}
}
}
|
import teca.utils as tecautils
import teca.ConfigHandler as tecaconf
import unittest
class TestFileFilter(unittest.TestCase):
def setUp(self):
self.conf = tecaconf.ConfigHandler(
"tests/test_data/configuration.json",
{"starting_path": "tests/test_data/images"}
)
self.files_list = [
"foo.doc",
"yukinon.jpg",
"<API key>.webm"
]
def test_dothefiltering(self):
self.assertTrue("foo.doc" not in
tecautils.filterImages(self.files_list,
self.conf))
self.assertTrue("yukinon.jpg" in
tecautils.filterImages(self.files_list,
self.conf))
def test_nofiles(self):
self.assertEqual(0, len(tecautils.filterImages([], self.conf)))
|
<?php
namespace Integrated\Bundle\AssetBundle\Tests\Manager;
use Integrated\Bundle\AssetBundle\Manager\AssetManager;
/**
* @author Ger Jan van den Bosch <gerjan@e-active.nl>
*/
class AssetManagerTest extends \<API key>
{
/**
* @var AssetManager
*/
private $manager;
protected function setUp()
{
$this->manager = new AssetManager();
}
public function <API key>()
{
$this->manager->add('script.js');
$this->manager->add('script2.js');
$this->manager->add('script.js');
$this->assertCount(2, $this->manager->getAssets());
}
public function testInlineFunction()
{
$inline = 'html { color: red; }';
$this->manager->add($inline, true);
$asset = $this->manager->getAssets()[0];
$this->assertTrue($asset->isInline());
$this->assertEquals($inline, $asset->getContent());
}
public function <API key>()
{
$this-><API key>('\<API key>');
$this->manager->add('script.js', false, 'invalid');
}
public function testPrependFunction()
{
$this->manager->add('script2.js');
$this->manager->add('script3.js', false, AssetManager::MODE_APPEND);
$this->manager->add('script1.js', false, AssetManager::MODE_PREPEND);
$assets = $this->manager->getAssets();
$this->assertEquals('script1.js', $assets[0]->getContent());
$this->assertEquals('script2.js', $assets[1]->getContent());
$this->assertEquals('script3.js', $assets[2]->getContent());
}
}
|
import { h, Component } from 'preact';
import moment from 'moment';
const MonthPicker = ({ onChange, ...props }) => (
<select onChange={onChange} id="select-month">{ optionsFor("month", props.date) }</select>
);
const DayPicker = ({ onChange, ...props }) => (
<select onChange={onChange} id="select-date">{ optionsFor("day", props.date) }</select>
);
const YearPicker = ({ onChange, ...props }) => (
<select onChange={onChange} id="select-year">{ optionsFor("year", props.date) }</select>
);
const months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
const startYear = 1930;
const endYear = 2018;
function optionsFor(field, selectedDate) {
if (field === 'year') {
selected = selectedDate.year();
return [...Array(endYear-startYear).keys()].map((item, i) => {
var isSelected = (startYear + item) == selected;
return (
<option value={startYear + item} selected={isSelected ? 'selected' : ''}>{startYear + item}</option>
);
});
}
else if (field === 'month') {
selected = selectedDate.month();
return months.map((item, i) => {
var isSelected = i == selected;
return (
<option value={i} selected={isSelected ? 'selected' : ''}>{item}</option>
);
});
}
else if (field === 'day') {
var selected = selectedDate.date();
var firstDay = 1;
var lastDay = moment(selectedDate).add(1, 'months').date(1).subtract(1, 'days').date() + 1;
return [...Array(lastDay-firstDay).keys()].map((item, i) => {
var isSelected = (item + 1) == selected;
return (
<option value={item + 1} selected={isSelected ? 'selected': ''}>{item + 1}</option>
)
});
}
}
export default class DatePicker extends Component {
constructor(props) {
super(props);
this.state = {
date: props.date
};
this.onChange = this.onChange.bind(this);
}
onChange(event) {
var month = document.getElementById('select-month').value;
var day = document.getElementById('select-date').value;
var year = document.getElementById('select-year').value;
var newDate = moment().year(year).month(month).date(day);
this.setState({ date: newDate })
this.props.onChange(newDate);
}
render() {
return (
<div>
<MonthPicker date={this.state.date} onChange={this.onChange} />
<DayPicker date={this.state.date} onChange={this.onChange} />
<YearPicker date={this.state.date} onChange={this.onChange} />
</div>
)
}
}
|
import $ from 'jquery';
import keyboard from 'virtual-keyboard';
$.fn.addKeyboard = function () {
return this.keyboard({
openOn: null,
stayOpen: false,
layout: 'custom',
customLayout: {
'normal': ['7 8 9 {c}', '4 5 6 {del}', '1 2 3 {sign}', '0 0 {dec} {a}'],
},
position: {
// null (attach to input/textarea) or a jQuery object (attach elsewhere)
of: null,
my: 'center top',
at: 'center top',
// at2 is used when "usePreview" is false (centers keyboard at the bottom
// of the input/textarea)
at2: 'center top',
collision: 'flipfit flipfit'
},
reposition: true,
css: {
input: 'form-control input-sm',
container: 'center-block dropdown-menu',
buttonDefault: 'btn btn-default',
buttonHover: 'btn-light',
// used when disabling the decimal button {dec}
// when a decimal exists in the input area
buttonDisabled: 'enabled',
},
});
};
|
require 'nokogiri'
require 'ostruct'
require 'active_support/core_ext/string'
require 'active_support/core_ext/date'
module Lifebouy
class MalformedRequestXml < StandardError
def initialize(xml_errors)
@xml_errors = xml_errors
end
def message
"The request contains the following errors:\n\t#{@xml_errors.join("\n\t")}"
end
end
class <API key> < MalformedRequestXml
def message
"The response contains the following errors:\n\t#{@xml_errors.join("\n\t")}"
end
end
class RequestHandler
attr_reader :request_error, :schema, :request_doc, :response_error
attr_accessor :response_data
def initialize(wsdl_file, request_xml)
@wsdl = Nokogiri::XML(File.read(wsdl_file))
# Find the root schema node
schema_namespace = @wsdl.namespaces.select { |k,v| v =~ /XMLSchema/ }.first
<API key> = @wsdl.root['targetNamespace']
@target_namespace = @wsdl.namespaces.select { |k,v| v == <API key>}.first
@schema_prefix = schema_namespace.first.split(/:/).last
schema_root = @wsdl.at_xpath("//#{@schema_prefix}:schema").dup
schema_root.<API key>(@target_namespace.first.split(/:/).last, @target_namespace.last)
# Create a document to store the schema and the parse it into a Schema for validation
@schema_doc = Nokogiri::XML::Document.new
@schema_doc << schema_root
@schema = Nokogiri::XML::Schema(@schema_doc.to_xml)
envelope = Nokogiri::XML(request_xml)
request_data = envelope.at_xpath("//#{envelope.root.namespace.prefix}:Body").first_element_child
@request_doc = Nokogiri::XML::Document.new
@request_doc << request_data
@response_data = OpenStruct.new
end
def <API key>?
begin
<API key>!
return true
rescue MalformedRequestXml => e
@request_error = e
return false
end
end
def <API key>!
request_errors = []
@schema.validate(request_doc).each do |error|
request_errors << "Line #{error.line}: #{error.message}"
end
raise MalformedRequestXml.new(request_errors) unless request_errors.empty?
end
def request_data
@request_data ||= build_request_data
end
def validate_response?
begin
validate_response!
return true
rescue <API key> => e
@response_error = e
return false
end
end
def validate_response!
raise <API key>.new(["Empty Responses Not Allowed"]) if response_data.to_h.empty?
@response_xml = nil
response_errors = []
@schema.validate(response_xml).each do |error|
response_errors << "Line #{error.line}: #{error.message}"
end
raise <API key>.new(response_errors) unless response_errors.empty?
end
def response_xml
@response_xml ||= build_response_xml
end
def response_soap
end
private
def build_response_xml
xml = Nokogiri::XML::Document.new
symbols_and_names = {}
@schema_doc.xpath("//#{@schema_prefix}:element").each do |e_node|
symbols_and_names[e_node[:name].underscore.to_sym] = e_node[:name]
end
xml << ostruct_to_node(@response_data, xml, symbols_and_names)
xml
end
def ostruct_to_node(ostruct, xml, symbols_and_names)
raise <API key>.new(["Structure Must Contain a Node Name"]) if ostruct.name.blank?
ele = xml.create_element(ostruct.name)
ele.<API key>(nil, @target_namespace.last)
ostruct.each_pair do |k,v|
next if k == :name
if v.is_a?(OpenStruct)
ele << ostruct_to_node(v, xml, symbols_and_names)
else
ele << create_element_node(xml, symbols_and_names[k], v)
end
end
ele
end
def create_element_node(xml, node_name, value)
t_node = @schema_doc.at_xpath("//#{@schema_prefix}:element[@name='#{node_name}']")
formatted_value = value.to_s
begin
case <API key>(node_name)
when 'integer', 'int'
formatted_value = '%0d' % value
when 'boolean'
formatted_value = (value == true ? 'true' : 'false')
when 'date', 'time', 'dateTime'
formatted_value = value.strftime('%m-%d-%Y')
end
rescue Exception => e
raise <API key>.new([e.message])
end
to_add = xml.create_element(node_name, formatted_value)
to_add.<API key>(nil, @target_namespace.last)
to_add
end
def build_request_data
@request_data = node_to_ostruct(@request_doc.first_element_child)
end
def node_to_ostruct(node)
ret = OpenStruct.new
ret[:name] = node.node_name
node.element_children.each do |ele|
if ele.element_children.count > 0
ret[ele.node_name.underscore.to_sym] = node_to_ostruct(ele)
else
ret[ele.node_name.underscore.to_sym] = xml_to_type(ele)
end
end
ret
end
def xml_to_type(node)
return nil if node.text.blank?
case <API key>(node.node_name)
when 'decimal', 'float', 'double'
node.text.to_f
when 'integer', 'int'
node.text.to_i
when 'boolean'
node.text == 'true'
when 'date', 'time', 'dateTime'
Date.parse(node.text)
else
node.text
end
end
def <API key>(node_name)
t_node = @schema_doc.at_xpath("//#{@schema_prefix}:element[@name='#{node_name}']")
raise "No type defined for #{node_name}" unless t_node
t_node[:type].gsub(/#{@schema_prefix}:/, '')
end
end
end
|
/**
* Trait class
*/
function Trait(methods, allTraits) {
allTraits = allTraits || [];
this.traits = [methods];
var extraTraits = methods.$traits;
if (extraTraits) {
if (typeof extraTraits === "string") {
extraTraits = extraTraits.replace(/ /g, '').split(',');
}
for (var i = 0, c = extraTraits.length; i < c; i++) {
this.use(allTraits[extraTraits[i]]);
}
}
}
Trait.prototype = {
constructor: Trait,
use: function (trait) {
if (trait) {
this.traits = this.traits.concat(trait.traits);
}
return this;
},
useBy: function (obj) {
for (var i = 0, c = this.traits.length; i < c; i++) {
var methods = this.traits[i];
for (var prop in methods) {
if (prop !== '$traits' && !obj[prop] && methods.hasOwnProperty(prop)) {
obj[prop] = methods[prop];
}
}
}
}
};
module.exports = Trait;
|
require 'integrity'
require 'fileutils'
module Integrity
class Notifier
class Artifacts < Notifier::Base
def initialize(commit, config={})
@project = commit.project
super
end
def deliver!
return unless self.commit.successful?
self.publish_artifacts
self.generate_indexes if <API key>
end
def generate_indexes
Artifacts.generate_index(self.artifact_root, false)
Artifacts.generate_index(File.join(self.artifact_root, @project.name), true)
Artifacts.generate_index(self.<API key>, true)
end
def publish_artifacts
self.artifacts.each do |name, config|
next if config.has_key?('disabled') && config['disabled']
artifact_output_dir = File.expand_path(File.join(self.working_dir, config['output_dir']))
if File.exists?(artifact_output_dir)
FileUtils::Verbose.mkdir_p(self.<API key>) unless File.exists?(self.<API key>)
FileUtils::Verbose.mv artifact_output_dir, self.<API key>, :force => true
end
end
end
def artifacts
# If the configuration is missing, try rcov for kicks
@artifacts ||= self.load_config_yaml
@artifacts ||= {'rcov' => { 'output_dir' => 'coverage' }}
@artifacts
end
def <API key>
@<API key> ||= File.expand_path(File.join(self.artifact_root, @project.name, self.commit.short_identifier))
@<API key>
end
def artifact_root
# If the configuration is missing, assume that the export_directory is {integrity_dir}/builds
@artifact_root ||= self.load_artifact_root
@artifact_root ||= Artifacts.<API key>
@artifact_root
end
def working_dir
@working_dir ||= Integrity.config[:export_directory] / "#{Integrity::SCM.working_tree_path(@project.uri)}-#{@project.branch}"
@working_dir
end
def <API key>
@config.has_key?('generate_indexes') ? @config['generate_indexes'] == '1' : false
end
protected
def load_artifact_root
if @config.has_key?('artifact_root')
root_path = @config['artifact_root']
unless File.exists?(root_path)
default_path = Artifacts.<API key>
Integrity.log "WARNING: Configured artifact_root: #{root_path} does not exist. Using default: #{default_path}"
root_path = default_path
end
end
root_path
end
def load_config_yaml
config = nil
if @config.has_key?('config_yaml')
config_yaml = File.expand_path(File.join(working_dir, @config['config_yaml']))
if File.exists?(config_yaml)
config = YAML.load_file(config_yaml)
else
Integrity.log "WARNING: Configured yaml file: #{config_yaml} does not exist! Using default configuration."
end
end
config
end
class << self
def to_haml
File.read(File.dirname(__FILE__) + "/config.haml")
end
def <API key>
File.expand_path(File.join(Integrity.config[:export_directory], '..', 'public', 'artifacts'))
end
def generate_index(dir, link_to_parent)
hrefs = build_hrefs(dir, link_to_parent)
rendered = render_index(dir, hrefs)
write_index(dir, rendered)
end
def build_hrefs(dir, link_to_parent)
hrefs = {}
Dir.entries(dir).each do |name|
# skip dot files
next if name.match(/^\./)
hrefs[name] = name
hrefs[name] << "/index.html" if File.directory?(File.join(dir, name))
end
hrefs['..'] = '../index.html' if link_to_parent
hrefs
end
def render_index(dir, hrefs)
index_haml = File.read(File.dirname(__FILE__) + '/index.haml')
engine = ::Haml::Engine.new(index_haml, {})
engine.render(nil, {:dir => dir, :hrefs => hrefs})
end
def write_index(dir, content)
index_path = File.join(dir, 'index.html')
File.open(index_path, 'w') {|f| f.write(content) }
end
end
end
register Artifacts
end
end
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="http:
<title>oh-my-zsh Präsentation von Php-Schulung Entwicklungshilfe</title>
<meta name="description" content="oh-my-zsh - Terminal effektiv mit Plugins nutzen PHP-Schulung">
<meta name="author" content="Entwicklungshilfe NRW">
<meta name="<API key>" content="yes" />
<meta name="<API key>" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<link rel="stylesheet" href="css/theme/eh.css">
<link rel="stylesheet" href="#" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.<API key>( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]
<script type="text/javascript">
if(window.location.search.substring(1)){
document.getElementById("theme").href = "css/theme/"+window.location.search.substring(1)+".css";
}
</script>
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>oh-my-zsh</h1>
<h3>Entwicklungshilfe</h3>
<p>
<a href="http:
<a href="https:
<small>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/black.css'); return false;">Black</a>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/white.css'); return false;">White</a>
<a href="#" onclick="document.getElementById('theme').setAttribute('href',''); return false;">EH</a>
</small>
</p>
<aside class="notes">
Don't forget notes
</aside>
</section>
<section>
<section>
<p>
<h3>Powerline font</h3>
<a href="https://github.com/powerline/fonts/blob/master/Meslo/Meslo%20LG%20L%20DZ%20Regular%20for%20Powerline.otf" target="_blank">
https://github.com/powerline/fonts/blob/master/Meslo/Meslo%20LG%20L%20DZ%20Regular%20for%20Powerline.otf
</a><br>
press raw and install <br>
<h4>ZSH installieren</h4>
<a href="https:
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh<br>
or<br>
wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O - | sh
</p>
</section>
<section>
<h2>Installation</h2>
<h3>Solarized Theme</h3>
<a href="http:
unpack and in folder "<API key>" the "Solrized Dark.itermcolors" double click
</section>
<section>
<h2>Installation</h2>
Open iTerm and pres "cmd + ," at colors "Load Presents" dropdown "Solarized dark".
<p>
<img src="img/oh-my-zsh/SOLARIZED-THEME.png" alt="SOLARIZED THEME iTerm">
</p>
</section>
<section>
<h2>Installation</h2>
Set the new font
<p>
<img src="img/oh-my-zsh/font-settings.png" alt="iTerm font setting">
</p>
</section>
<section>
<h2>Installation</h2>
brew install fortune <br>
brew install cowsay <br>
vim .zshrc<br>
ZSH_THEME="agnoster"<br>
plugins=(git jump jira osx z extract chucknorris history <API key> vi-mode web-search <API key>)<br>
Iterm restart or open new tab. Enter this command<br>
echo -e "\ue0a0 \ue0a1 \ue0a2 \ue0b0 \ue0b1 \ue0b2"
<p>
<img src="img/oh-my-zsh/test-output.png" alt="oh-my-zsh output">
</p>
</section>
</section>
<section>
<section>
<h2>Sources</h2>
Plugin wiki<br>
<a href="https:
Cheatsheet<br>
<a href="https:
</section>
<section>
<h2>Directories</h2>
<table>
<thead>
<tr>
<th>Alias</th>
<th>Command</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>alias</em></td>
<td align="left">list all aliases</td>
</tr>
<tr>
<td align="left">..</td>
<td align="left">cd ..</td>
</tr>
<tr>
<td align="left">...</td>
<td align="left">cd ../..</td>
</tr>
<tr>
<td align="left">....</td>
<td align="left">cd ../../..</td>
</tr>
<tr>
<td align="left">.....</td>
<td align="left">cd ../../../..</td>
</tr>
<tr>
<td align="left">/</td>
<td align="left">cd /</td>
</tr>
<tr>
<td align="left"><em>md</em></td>
<td align="left">mkdir -p</td>
</tr>
<tr>
<td align="left"><em>rd</em></td>
<td align="left">rmdir</td>
</tr>
<tr>
<td align="left"><em>d</em></td>
<td align="left">dirs -v (lists last used directories)</td>
</tr>
<tr>
<td align="left"><em>~3</em></td>
<td align="left">cd to dir -v 3</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Usefull git alias</h2>
<table>
<thead>
<tr>
<th>Alias</th>
<th>Command</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>gst</em></td>
<td align="left">git status</td>
</tr>
<tr>
<td align="left"><em>gf</em></td>
<td align="left">git fetch</td>
</tr>
<tr>
<td align="left"><em>gl</em></td>
<td align="left">git pull</td>
</tr>
<tr>
<td align="left"><em>gp</em></td>
<td align="left">git push</td>
</tr>
<tr>
<td align="left"><em>gaa</em></td>
<td align="left">git add --all</td>
</tr>
<tr>
<td align="left"><em>gco</em></td>
<td align="left">git checkout</td>
</tr>
<tr>
<td align="left"><em>gcmsg</em></td>
<td align="left">git commit -m</td>
</tr>
<tr>
<td align="left"><em>gclean</em></td>
<td align="left">git clean -fd</td>
</tr>
<tr>
<td align="left"><em>gcb</em></td>
<td align="left">git checkout -b</td>
</tr>
<tr>
<td align="left"><em>gcm</em></td>
<td align="left">git checkout master</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Jump plugin</h2>
<table>
<thead>
<tr>
<th>Alias</th>
<th>Command</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>mark</em></td>
<td align="left">mark actual folder with name as mark</td>
</tr>
<tr>
<td align="left"><em>mark yourname</em></td>
<td align="left">mark actual folder with yourname as mark</td>
</tr>
<tr>
<td align="left"><em>jump yourname</em></td>
<td align="left">jump to folder yourname</td>
</tr>
<tr>
<td align="left"><em>unmark yourname</em></td>
<td align="left">remove</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>OSX plugin</h2>
<table>
<thead>
<tr>
<th align="left">Command</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>tab</em></td>
<td align="left">open the current directory in a new tab</td>
</tr>
<tr>
<td align="left"><em>cdf</em></td>
<td align="left">cd to the current Finder directory</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>JIRA plugin</h2>
<table>
<thead>
<tr>
<th align="left">Command</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>jira</em></td>
<td align="left">Open new issue form in browser</td>
</tr>
<tr>
<td align="left"><em>jira ABC-123</em></td>
<td align="left">Open issue in browser</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>History plugin</h2>
<table>
<thead>
<tr>
<th align="left">Alias</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>h</em></td>
<td align="left">List your command history. Equivalent to using <code>history</code>
</td>
</tr>
<tr>
<td align="left"><em>hsi</em></td>
<td align="left">When called without an argument you will get help on <code>grep</code> arguments</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Extract plugin</h2>
<table>
<thead>
<tr>
<th align="left">Alias</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>extract filename</em></td>
<td align="left">Extract any compressed file<code>history</code>
</td>
</tr>
</tbody>
</table>
</section>
</section>
<section style="text-align: left;">
<h1>Questions?</h1>
</section>
<section style="text-align: left;">
<h1>Thanks</h1>
</section>
<section style="text-align: left;">
<h1>Follow us!</h1>
<div class="col"><i class="follow-icon"><img src="img/twitter.png" alt="Entwicklungshilfe NRW Twitter"></i> <a href="https:
<div class="col"><i class="follow-icon"><img src="img/facebook.png" alt="Entwicklungshilfe NRW Facebook"></i> <a href="https:
<div class="col"><i class="follow-icon"><img src="img/github.png" alt="Entwicklungshilfe NRW Github"></i> <a href="https:
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.<API key>(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
<script src="js/ga.js"></script>
</body>
</html>
|
import {Component, Input} from '@angular/core';
import {CORE_DIRECTIVES} from '@angular/common';
import {ROUTER_DIRECTIVES, Router} from '@angular/router-deprecated';
import {AuthService} from '../common/auth.service';
@Component({
selector: 'todo-navbar',
templateUrl: 'app/navbar/navbar.component.html',
directives: [ROUTER_DIRECTIVES, CORE_DIRECTIVES]
})
export class NavbarComponent {
@Input() brand: string;
@Input() routes: any[];
name: string;
constructor(private _authService: AuthService, private _router: Router) {
this._authService.profile.subscribe(profile => this.name = profile && profile.name);
}
getName() {
console.log('getName');
return this.name;
}
logout($event: Event) {
$event.preventDefault();
this._authService.logout();
this._router.navigateByUrl('/');
}
isLoggedIn() {
return Boolean(this.name);
}
}
|
'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Game = mongoose.model('Game'),
Team = mongoose.model('Team'),
Player = mongoose.model('Player'),
async = require('async');
exports.all = function(req, res) {
Game.find({'played': true}).exec(function(err, games) {
if (err) {
return res.json(500, {
error: 'fucked up grabbing dem games'
});
}
res.json(games);
});
};
exports.logGame = function(req, res, next) {
var loggedGame = req.body;
Game.<API key>([loggedGame.teams[0].teamId, loggedGame.teams[1].teamId], function(err, games) {
if (err) {
console.log('error finding matchups\n' + err);
res.json(500, 'fucked up finding dem games');
return;
}
var matchedGame;
var teamOneIndex;
var teamTwoIndex;
for (var gameIdx = 0; gameIdx < games.length; gameIdx += 1) {
if (games[gameIdx].teams[0].home === loggedGame.teams[0].home && games[gameIdx].teams[0].teamId.toString() === loggedGame.teams[0].teamId) {
matchedGame = games[gameIdx];
teamOneIndex = 0;
teamTwoIndex = 1;
break;
} else if (games[gameIdx].teams[1].home === loggedGame.teams[0].home && games[gameIdx].teams[1].teamId.toString() === loggedGame.teams[0].teamId) {
matchedGame = games[gameIdx];
teamOneIndex = 1;
teamTwoIndex = 0;
break;
}
}
if (!matchedGame) {
res.json(500, 'no matchup between those teams found');
return;
}
if (matchedGame.played) {
console.log('match already played!');
res.json(500, 'game already played');
return;
}
matchedGame.teams[teamOneIndex].goals = loggedGame.teams[0].goals;
matchedGame.teams[teamOneIndex].events = loggedGame.teams[0].events;
matchedGame.teams[teamTwoIndex].goals = loggedGame.teams[1].goals;
matchedGame.teams[teamTwoIndex].events = loggedGame.teams[1].events;
matchedGame.played = true;
var datePlayed = new Date();
matchedGame.datePlayed = datePlayed;
matchedGame.save(function(err) {
if (err) {
console.log('failed to save game -- ' + matchedGame + ' -- ' + err );
res.json(500, 'error saving game -- ' + err);
} else {
async.series([
function(callback) {
console.log('PROCESSING EVENTS');
processEvents(matchedGame, callback);
},
function(callback) {
console.log('UPDATING STANDINGS');
updateStandings(callback);
}
],
function(err, results) {
if (err) {
res.sendStatus(400);
console.log(err);
} else {
res.sendStatus(200);
}
});
}
});
});
var processEvents = function(game, callback) {
/*jshint -W083 */
var updatePlayerEvents = function(playerEvents, playerCallback) {
console.log('UPDATING EVENTS FOR PLAYER ' + playerEvents.events[0].player);
<API key>(playerEvents, playerEvents.teamId, playerCallback);
};
var <API key> = function(team, teamCallback) {
console.log('PROCESSING EVENTS FOR ' + team);
var playerEventMap = {};
for (var eventIdx = 0; eventIdx < team.events.length; eventIdx += 1) {
var playerEvent = team.events[eventIdx];
console.log('PROCESSING EVENT ' + playerEvent);
if (playerEventMap[playerEvent.player] === undefined) {
console.log('PLAYER NOT IN MAP, ADDING ' + playerEvent.player);
playerEventMap[playerEvent.player] = {teamId: team.teamId, events: [], gameDate: game.datePlayed};
}
playerEventMap[playerEvent.player].events.push(playerEvent);
}
console.log('player event map created: ' + playerEventMap);
var <API key> = [];
for (var key in playerEventMap) {
<API key>.push(playerEventMap[key]);
}
async.each(<API key>, updatePlayerEvents, function(err) {
if (err) {
teamCallback(err);
} else {
teamCallback();
}
});
};
async.each(game.teams, <API key>, function(err) {
if (err) {
callback(err);
} else {
callback();
}
});
};
var <API key> = function(playerEvents, teamId, playerCallback) {
console.log('finding/creating player -- ' + playerEvents + ' -- ' + teamId);
Player.findOne({name: playerEvents.events[0].player, teamId: teamId}, function(err, player) {
if (err) {
console.log('error processing events -- ' + JSON.stringify(playerEvents) + ' -- ' + err);
playerCallback(err);
}
if (!player) {
<API key>(playerEvents, teamId, playerCallback);
} else {
incrementEvents(player, playerEvents, playerCallback);
}
});
};
var <API key> = function(playerEvents, teamId, playerCallback) {
Player.create({name: playerEvents.events[0].player, teamId: teamId}, function(err, createdPlayer) {
if (err) {
console.log('error creating player while processing event -- ' + JSON.stringify(playerEvents) + ' -- ' + err);
}
incrementEvents(createdPlayer, playerEvents, playerCallback);
});
};
var incrementEvents = function(player, playerEvents, playerCallback) {
var suspended = false;
for (var eventIdx = 0; eventIdx < playerEvents.events.length; eventIdx += 1) {
var eventType = playerEvents.events[eventIdx].eventType;
if (eventType === 'yellow card') {
player.yellows += 1;
if (player.yellows % 5 === 0) {
suspended = true;
}
} else if (eventType === 'red card') {
player.reds += 1;
suspended = true;
} else if (eventType === 'goal') {
player.goals += 1;
} else if (eventType === 'own goal') {
player.ownGoals += 1;
}
}
player.save(function(err) {
if (err) {
console.log('error incrementing event for player -- ' + JSON.stringify(player) + ' -- ' + eventType);
playerCallback(err);
} else {
if (suspended) {
suspendPlayer(player, playerEvents.gameDate, playerCallback);
} else {
playerCallback();
}
}
});
};
var updateStandings = function(callback) {
Team.find({}, function(err, teams) {
if (err) {
console.log('error retrieving teams for standings update -- ' + err);
callback(err);
} else {
resetStandings(teams);
Game.find({'played': true}, null, {sort: {datePlayed : 1}}, function(err, games) {
if (err) {
console.log('error retrieving played games for standings update -- ' + err);
callback(err);
} else {
for (var gameIdx = 0; gameIdx < games.length; gameIdx += 1) {
<API key>(games[gameIdx], teams);
}
saveStandings(teams, callback);
}
});
}
});
};
var saveStandings = function(teams, standingsCallback) {
var saveTeam = function(team, saveCallback) {
team.save(function(err){
if (err) {
console.log('error saving team -- ' + team + ' -- ' + err);
saveCallback(err);
} else {
saveCallback();
}
});
};
async.each(teams, saveTeam, function(err) {
if (err) {
standingsCallback(err);
} else {
standingsCallback();
}
});
};
var resetStandings = function(teams) {
for (var teamIdx in teams) {
teams[teamIdx].wins = 0;
teams[teamIdx].losses = 0;
teams[teamIdx].draws = 0;
teams[teamIdx].points = 0;
teams[teamIdx].goalsFor = 0;
teams[teamIdx].goalsAgainst = 0;
//teams[teamIdx].suspensions = [];
}
};
var <API key> = function(game, teams) {
for (var teamResultIdx = 0; teamResultIdx < game.teams.length; teamResultIdx += 1) {
var teamResult = game.teams[teamResultIdx];
var opponentResult = game.teams[1 - teamResultIdx];
var team;
for (var teamIdx = 0; teamIdx < teams.length; teamIdx += 1) {
if (teams[teamIdx]._id.equals(teamResult.teamId)) {
team = teams[teamIdx];
break;
}
}
team.lastGamePlayed = game.datePlayed;
team.goalsFor += teamResult.goals;
team.goalsAgainst += opponentResult.goals;
if (teamResult.goals > opponentResult.goals) {
team.wins += 1;
team.points += 3;
} else if (teamResult.goals === opponentResult.goals) {
team.draws += 1;
team.points += 1;
} else {
team.losses += 1;
}
}
// game.played=false;
// game.datePlayed=undefined;
// for (var teamIdx = 0; teamIdx < game.teams.length; teamIdx += 1) {
// game.teams[teamIdx].goals = 0;
// game.teams[teamIdx].events = [];
// game.save();
};
var suspendPlayer = function(player, gameDate, suspensionCallback) {
Team.findOne({_id: player.teamId}, function(err, team){
if (err) {
console.log('error loading team to suspend a dude -- ' + player);
suspensionCallback(err);
} else {
if (!team.suspensions) {
team.suspensions = [];
}
team.suspensions.push({player: player.name, dateSuspended: gameDate});
team.save(function(err) {
if (err) {
console.log('error saving suspension 4 dude -- ' + player + ' -- ' + team);
suspensionCallback(err);
} else {
suspensionCallback();
}
});
}
});
};
};
|
package championpicker.console;
import com.googlecode.lanterna.gui.*;
import com.googlecode.lanterna.TerminalFacade;
import com.googlecode.lanterna.terminal.Terminal;
import com.googlecode.lanterna.terminal.TerminalSize;
import com.googlecode.lanterna.terminal.swing.SwingTerminal;
import com.googlecode.lanterna.gui.GUIScreen;
import com.googlecode.lanterna.gui.dialog.DialogButtons;
import com.googlecode.lanterna.gui.component.Button;
import com.googlecode.lanterna.gui.component.Panel;
import com.googlecode.lanterna.gui.component.Label;
import com.googlecode.lanterna.gui.Window;
import com.googlecode.lanterna.screen.Screen;
import com.googlecode.lanterna.screen.Screen;
import championpicker.Main;
import championpicker.console.mainStartUp;
import championpicker.console.queueWindow;
import javax.swing.JFrame;
public class mainMenu extends Window{
public mainMenu(String name){
super(name);
queueWindow win = new queueWindow();
addComponent(new Button("Queue!", new Action(){
public void doAction(){
System.out.println("Success!");
mainStartUp.gui.showWindow(win, GUIScreen.Position.CENTER);
}}));
}
}
|
(function(){
'use strict';
angular.module('GamemasterApp')
.controller('DashboardCtrl', function ($scope, $timeout, $mdSidenav, $http) {
$scope.users = ['Fabio', 'Leonardo', 'Thomas', 'Gabriele', 'Fabrizio', 'John', 'Luis', 'Kate', 'Max'];
})
})();
|
require 'byebug'
module Vorm
module Validatable
class ValidationError
def clear_all
@errors = Hash.new { |k, v| k[v] = [] }
end
end
end
end
class Valid
include Vorm::Validatable
def self.reset!
@validators = nil
end
end
describe Vorm::Validatable do
before { Valid.reset! }
context "class methods" do
subject { Valid }
describe ".validates" do
it { is_expected.to respond_to(:validates) }
it "raises argument error when given arg is not string" do
expect { subject.validates(:email) }
.to raise_error(ArgumentError, "Field name must be a string")
end
it "raises argument error when no block given" do
expect { subject.validates("email") }
.to raise_error(ArgumentError, "You must provide a block")
end
it "stores a validator" do
subject.validates("email") { "required" }
expect(subject.<API key>('@validators')["email"].length).to be(1)
end
it "stores multiple validators" do
subject.validates("email") { "required" }
subject.validates("email") { "not valid" }
subject.validates("password") { "required" }
expect(subject.<API key>('@validators')["email"].length).to be(2)
expect(subject.<API key>('@validators')["password"].length).to be(1)
end
end
end
context "instance methods" do
subject { Valid.new }
before { subject.errors.clear_all }
describe ".validate!" do
it { is_expected.to respond_to(:validate!) }
it "adds errors when invalid" do
Valid.validates("email") { true }
expect { subject.validate! }.to change { subject.errors.on("email").length }.by(1)
end
it "adds the validation messages to errors for the right field" do
Valid.validates("email") { "not valid" }
subject.valid?
expect(subject.errors.on("email")).to eq(["not valid"])
end
it "adds validation messages to each field when invalid" do
Valid.validates("email") { "required" }
Valid.validates("email") { "not valid" }
Valid.validates("password") { "too short" }
subject.validate!
expect(subject.errors.on("email").length).to be(2)
expect(subject.errors.on("password").length).to be(1)
expect(subject.errors.on("email")).to eq(["required", "not valid"])
expect(subject.errors.on("password")).to eq(["too short"])
end
end
describe ".valid?" do
it { is_expected.to respond_to(:valid?) }
it "calls .validate!" do
expect(subject).to receive(:validate!)
subject.valid?
end
it "calls .errors.empty?" do
expect(subject.errors).to receive(:empty?)
subject.valid?
end
it "returns true when no validations" do
expect(subject).to be_valid
end
it "returns true when validations pass" do
Valid.validates("email") { nil }
expect(subject).to be_valid
end
it "returns false when validations fail" do
Valid.validates("email") { "required" }
expect(subject).not_to be_valid
end
end
end
end
|
module Embratel
class PhoneBill
attr_reader :payables
def initialize(path)
@payables = CSVParser.parse(path)
end
def calls
@calls ||= payables.select(&:call?)
end
def fees
@fees ||= payables.select(&:fee?)
end
def total
@total ||= payables.inject(0) { |sum, payable| sum += payable.cost.to_f }
end
end
end
|
const express = require('express');
const router = express.Router();
const routes = require('./routes')(router);
module.exports = router;
|
package simulation.generators;
import simulation.data.PetrolStation;
import simulation.data.Road;
public class <API key> {
private Road road;
private int <API key> = 50;
private int <API key> = 200;
private float minimalFuelPrice = 3.5f;
private float maximumFuelPrice = 4f;
public <API key>(Road road) {
this.road = road;
}
public void <API key>(){
<API key> generator = new <API key>();
int lastStationPosition = 0;
road.addPetrolStation(generateStation(lastStationPosition));
while (lastStationPosition < road.getDistance()){
int nextStationDistance = generator.<API key>(<API key>,<API key>);
if(lastStationPosition+nextStationDistance <= road.getDistance()){
road.addPetrolStation(generateStation(lastStationPosition+nextStationDistance));
lastStationPosition += nextStationDistance;
}else{
break;
}
}
}
private PetrolStation generateStation(int positionOnRoad){
float fuelPrice = new <API key>().<API key>(minimalFuelPrice,maximumFuelPrice);
return new PetrolStation(positionOnRoad,fuelPrice);
}
public Road getRoad() {
return road;
}
public void setRoad(Road road) {
this.road = road;
}
public int <API key>() {
return <API key>;
}
public void <API key>(int <API key>) {
this.<API key> = <API key>;
}
public int <API key>() {
return <API key>;
}
public void <API key>(int <API key>) {
this.<API key> = <API key>;
}
public float getMinimalFuelPrice() {
return minimalFuelPrice;
}
public void setMinimalFuelPrice(float minimalFuelPrice) {
this.minimalFuelPrice = minimalFuelPrice;
}
public float getMaximumFuelPrice() {
return maximumFuelPrice;
}
public void setMaximumFuelPrice(float maximumFuelPrice) {
this.maximumFuelPrice = maximumFuelPrice;
}
}
|
var HDWalletProvider = require("<API key>");
var mnemonic = "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat";
module.exports = {
networks: {
development: {
provider: function () {
return new HDWalletProvider(mnemonic, "http://127.0.0.1:7545/", 0, 50);
},
network_id: "*",
},
},
compilers: {
solc: {
version: "^0.5.2",
},
},
};
|
<!DOCTYPE html>
<!--[if lt IE 9]><html class="no-js lt-ie9" lang="en" dir="ltr"><![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en" dir="ltr">
<!--<![endif]-->
<!-- Usage: /eic/site/ccc-rec.nsf/tpl-eng/template-1col.html?Open&id=3 (optional: ?Open&page=filename.html&id=x) -->
<!-- Created: ; Product Code: 536; Server: stratnotes2.ic.gc.ca -->
<head>
<title>
Groupe Giroux -
Complete profile - Canadian Company Capabilities - Industries and Business - Industry Canada
</title>
<!-- Title ends / Fin du titre -->
<meta charset="utf-8" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.title" content="" />
<meta name="description" content="" />
<meta name="dcterms.description" content="" />
<meta name="dcterms.type" content="report, data set" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.issued" title="W3CDTF" content="" />
<meta name="dcterms.modified" title="W3CDTF" content="" />
<meta name="keywords" content="" />
<meta name="dcterms.creator" content="" />
<meta name="author" content="" />
<meta name="dcterms.created" title="W3CDTF" content="" />
<meta name="dcterms.publisher" content="" />
<meta name="dcterms.audience" title="icaudience" content="" />
<meta name="dcterms.spatial" title="ISO3166-1" content="" />
<meta name="dcterms.spatial" title="gcgeonames" content="" />
<meta name="dcterms.format" content="HTML" />
<meta name="dcterms.identifier" title="ICsiteProduct" content="536" />
<!-- EPI-11240 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- MCG-202 -->
<meta content="width=device-width,initial-scale=1" name="viewport">
<!-- EPI-11567 -->
<meta name = "format-detection" content = "telephone=no">
<!-- EPI-12603 -->
<meta name="robots" content="noarchive">
<!-- EPI-11190 - Webtrends -->
<script>
var startTime = new Date();
startTime = startTime.getTime();
</script>
<!--[if gte IE 9 | !IE ]><!-->
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/wet-boew.min.css">
<!--<![endif]-->
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/theme.min.css">
<!--[if lt IE 9]>
<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="shortcut icon" />
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/ie8-wet-boew.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew.min.js"></script>
<![endif]
<!--[if lte IE 9]>
<![endif]
<noscript><link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/noscript.min.css" /></noscript>
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<script>dataLayer1 = [];</script>
<!-- End Google Tag Manager -->
<!-- EPI-11235 -->
<link rel="stylesheet" href="/eic/home.nsf/css/<API key>.css">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="/app/ccc/srch/css/print.css" media="print" rel="stylesheet" type="text/css" />
</head>
<body class="home" vocab="http://schema.org/" typeof="WebPage">
<!-- EPIC HEADER BEGIN -->
<!-- Google Tag Manager DO NOT REMOVE OR MODIFY - NE PAS SUPPRIMER OU MODIFIER -->
<noscript><iframe title="Google Tag Manager" src="
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.<API key>(s)[0], j=d.createElement(s),dl=l!='dataLayer1'?'&l='+l:'';j.async=true;j.src='
<!-- End Google Tag Manager -->
<!-- EPI-12801 -->
<span typeof="Organization"><meta property="legalName" content="<API key>"></span>
<ul id="wb-tphp">
<li class="wb-slc">
<a class="wb-sl" href="#wb-cont">Skip to main content</a>
</li>
<li class="wb-slc visible-sm visible-md visible-lg">
<a class="wb-sl" href="#wb-info">Skip to "About this site"</a>
</li>
</ul>
<header role="banner">
<div id="wb-bnr" class="container">
<section id="wb-lng" class="visible-md visible-lg text-right">
<h2 class="wb-inv">Language selection</h2>
<div class="row">
<div class="col-md-12">
<ul class="list-inline mrgn-bttm-0">
<li><a href="nvgt.do?V_TOKEN=1492289850357&V_SEARCH.docsCount=3&V_DOCUMENT.docRank=20428&V_SEARCH.docsStart=20427&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=/prfl.do&lang=fra&redirectUrl=/app/scr/imbs/ccc/rgstrtn/updt.sec?_flId?_flxKy=e1s1&estblmntNo=234567041301&profileId=61&_evId=bck&lang=eng&V_SEARCH.showStricts=false&prtl=1&_flId?_flId?_flxKy=e1s1" title="Français" lang="fr">Français</a></li>
</ul>
</div>
</div>
</section>
<div class="row">
<div class="brand col-xs-8 col-sm-9 col-md-6">
<a href="http:
</div>
<section class="wb-mb-links col-xs-4 col-sm-3 visible-sm visible-xs" id="wb-glb-mn">
<h2>Search and menus</h2>
<ul class="list-inline text-right chvrn">
<li><a href="#mb-pnl" title="Search and menus" aria-controls="mb-pnl" class="overlay-lnk" role="button"><span class="glyphicon glyphicon-search"><span class="glyphicon glyphicon-th-list"><span class="wb-inv">Search and menus</span></span></span></a></li>
</ul>
<div id="mb-pnl"></div>
</section>
<!-- Site Search Removed -->
</div>
</div>
<nav role="navigation" id="wb-sm" class="wb-menu visible-md visible-lg" data-trgt="mb-pnl" data-ajax-fetch="//cdn.canada.ca/gcweb-cdn-dev/sitemenu/sitemenu-en.html" typeof="<API key>">
<h2 class="wb-inv">Topics menu</h2>
<div class="container nvbar">
<div class="row">
<ul class="list-inline menu">
<li><a href="https:
<li><a href="http:
<li><a href="https://travel.gc.ca/">Travel</a></li>
<li><a href="https:
<li><a href="https:
<li><a href="http://healthycanadians.gc.ca/index-eng.php">Health</a></li>
<li><a href="https:
<li><a href="https:
</ul>
</div>
</div>
</nav>
<!-- EPIC BODY BEGIN -->
<nav role="navigation" id="wb-bc" class="" property="breadcrumb">
<h2 class="wb-inv">You are here:</h2>
<div class="container">
<div class="row">
<ol class="breadcrumb">
<li><a href="/eic/site/icgc.nsf/eng/home" title="Home">Home</a></li>
<li><a href="/eic/site/icgc.nsf/eng/h_07063.html" title="Industries and Business">Industries and Business</a></li>
<li><a href="/eic/site/ccc-rec.nsf/tpl-eng/../eng/home" >Canadian Company Capabilities</a></li>
</ol>
</div>
</div>
</nav>
</header>
<main id="wb-cont" role="main" property="mainContentOfPage" class="container">
<!-- End Header -->
<!-- Begin Body -->
<!-- Begin Body Title -->
<!-- End Body Title -->
<!-- Begin Body Head -->
<!-- End Body Head -->
<!-- Begin Body Content -->
<br>
<!-- Complete Profile -->
<!-- Company Information above tabbed area-->
<input id="showMore" type="hidden" value='more'/>
<input id="showLess" type="hidden" value='less'/>
<h1 id="wb-cont">
Company profile - Canadian Company Capabilities
</h1>
<div class="profileInfo hidden-print">
<ul class="list-inline">
<li><a href="cccSrch.do?lang=eng&profileId=&prtl=1&key.hitsPerPage=25&searchPage=%252Fapp%252Fccc%252Fsrch%252FcccBscSrch.do%253Flang%253Deng%2526amp%253Bprtl%253D1%2526amp%253Btagid%253D&V_SEARCH.scopeCategory=CCC.Root&V_SEARCH.depth=1&V_SEARCH.showStricts=false&V_SEARCH.sortSpec=title+asc&rstBtn.x=" class="btn btn-link">New Search</a> |</li>
<li><form name="searchForm" method="post" action="/app/ccc/srch/bscSrch.do">
<input type="hidden" name="lang" value="eng" />
<input type="hidden" name="profileId" value="" />
<input type="hidden" name="prtl" value="1" />
<input type="hidden" name="searchPage" value="%2Fapp%2Fccc%2Fsrch%2FcccBscSrch.do%3Flang%3Deng%26amp%3Bprtl%3D1%26amp%3Btagid%3D" />
<input type="hidden" name="V_SEARCH.scopeCategory" value="CCC.Root" />
<input type="hidden" name="V_SEARCH.depth" value="1" />
<input type="hidden" name="V_SEARCH.showStricts" value="false" />
<input id="repeatSearchBtn" class="btn btn-link" type="submit" value="Return to search results" />
</form></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=20426&V_DOCUMENT.docRank=20427&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492289857012&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567088754&profileId=&key.newSearchLabel=">Previous Company</a></li>
<li>| <a href="nvgt.do?V_SEARCH.docsStart=20428&V_DOCUMENT.docRank=20429&V_SEARCH.docsCount=3&lang=eng&prtl=1&sbPrtl=&profile=cmpltPrfl&V_TOKEN=1492289857012&V_SEARCH.command=navigate&V_SEARCH.resultsJSP=%2fprfl.do&estblmntNo=234567144903&profileId=&key.newSearchLabel=">Next Company</a></li>
</ul>
</div>
<details>
<summary>Third-Party Information Liability Disclaimer</summary>
<p>Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.</p>
</details>
<h2>
Groupe Giroux
</h2>
<div class="row">
<div class="col-md-5">
<h2 class="h5 mrgn-bttm-0">Legal/Operating Name:</h2>
<p>Groupe Giroux</p>
<div class="mrgn-tp-md"></div>
<p class="mrgn-bttm-0" ><a href="http:
target="_blank" title="Website URL">http:
<p><a href="mailto:grg@arpentage.com" title="grg@arpentage.com">grg@arpentage.com</a></p>
</div>
<div class="col-md-4 mrgn-sm-sm">
<h2 class="h5 mrgn-bttm-0">Mailing Address:</h2>
<address class="mrgn-bttm-md">
675, boul. Alphonse-Desjardins<br/>
Bureau 102<br/>
LÉVIS,
Quebec<br/>
G6V 5T3
<br/>
</address>
<h2 class="h5 mrgn-bttm-0">Location Address:</h2>
<address class="mrgn-bttm-md">
675, boul. Alphonse-Desjardins<br/>
Bureau 102<br/>
LÉVIS,
Quebec<br/>
G6V 5T3
<br/>
</address>
<p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>:
(418) 652-8838
</p>
<p class="mrgn-bttm-0"><abbr title="Telephone">Tel.</abbr>:
(866) 838-9961</p>
<p class="mrgn-bttm-lg"><abbr title="Facsimile">Fax</abbr>:
(418) 652-0119</p>
</div>
<div class="col-md-3 mrgn-tp-md">
</div>
</div>
<div class="row mrgn-tp-md mrgn-bttm-md">
<div class="col-md-12">
<h2 class="wb-inv">Company Profile</h2>
<br> Services en arpentage foncier et de construction.
<br>Cadastres, certificats de localisation, relevés topographiques,
<br>Mesurage d&
</div>
</div>
<!-- <div class="wb-tabs ignore-session update-hash wb-eqht-off print-active"> -->
<div class="wb-tabs ignore-session">
<div class="tabpanels">
<details id="details-panel1">
<summary>
Full profile
</summary>
<!-- Tab 1 -->
<h2 class="wb-invisible">
Full profile
</h2>
<!-- Contact Information -->
<h3 class="page-header">
Contact information
</h3>
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
ALAIN
GOSSELIN
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
ARPENTEUR-GEOMETRE <br>
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Telephone:
</strong>
</div>
<div class="col-md-7">
(418) 838-9961
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Facsimile:
</strong>
</div>
<div class="col-md-7">
(418) 832-7180
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Email:
</strong>
</div>
<div class="col-md-7">
agosseli@riq.qc.ca
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Company Description -->
<h3 class="page-header">
Company description
</h3>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Year Established:
</strong>
</div>
<div class="col-md-7">
1971
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
541370 - Surveying and Mapping (except Geophysical) Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Number of Employees:
</strong>
</div>
<div class="col-md-7">
12
</div>
</div>
</section>
<!-- Products / Services / Licensing -->
<h3 class="page-header">
Product / Service / Licensing
</h3>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Service Name:
</strong>
</div>
<div class="col-md-9">
Land surveying <br>
</div>
</div>
</section>
<p class="mrgn-tp-lg text-right small hidden-print">
<a href="#wb-cont">top of page</a>
</p>
<!-- Technology Profile -->
<!-- Market Profile -->
<!-- Sector Information -->
<details class="mrgn-tp-md mrgn-bttm-md">
<summary>
Third-Party Information Liability Disclaimer
</summary>
<p>
Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.
</p>
</details>
</details>
<details id="details-panel2">
<summary>
Contacts
</summary>
<h2 class="wb-invisible">
Contact information
</h2>
<!-- Contact Information -->
<section class="container-fluid">
<div class="row mrgn-tp-lg">
<div class="col-md-3">
<strong>
ALAIN
GOSSELIN
</strong></div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Title:
</strong>
</div>
<div class="col-md-7">
ARPENTEUR-GEOMETRE <br>
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Telephone:
</strong>
</div>
<div class="col-md-7">
(418) 838-9961
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Facsimile:
</strong>
</div>
<div class="col-md-7">
(418) 832-7180
</div>
</div>
<div class="row mrgn-lft-md">
<div class="col-md-5">
<strong>
Email:
</strong>
</div>
<div class="col-md-7">
agosseli@riq.qc.ca
</div>
</div>
</section>
</details>
<details id="details-panel3">
<summary>
Description
</summary>
<h2 class="wb-invisible">
Company description
</h2>
<section class="container-fluid">
<div class="row">
<div class="col-md-5">
<strong>
Country of Ownership:
</strong>
</div>
<div class="col-md-7">
Canada
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Year Established:
</strong>
</div>
<div class="col-md-7">
1971
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Exporting:
</strong>
</div>
<div class="col-md-7">
No
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Industry (NAICS):
</strong>
</div>
<div class="col-md-7">
541370 - Surveying and Mapping (except Geophysical) Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Primary Business Activity:
</strong>
</div>
<div class="col-md-7">
Services
</div>
</div>
<div class="row">
<div class="col-md-5">
<strong>
Number of Employees:
</strong>
</div>
<div class="col-md-7">
12
</div>
</div>
</section>
</details>
<details id="details-panel4">
<summary>
Products, services and licensing
</summary>
<h2 class="wb-invisible">
Product / Service / Licensing
</h2>
<section class="container-fluid">
<div class="row mrgn-bttm-md">
<div class="col-md-3">
<strong>
Service Name:
</strong>
</div>
<div class="col-md-9">
Land surveying <br>
</div>
</div>
</section>
</details>
</div>
</div>
<div class="row">
<div class="col-md-12 text-right">
Last Update Date 2017-03-03
</div>
</div>
<!
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z
<!-- End Body Content -->
<!-- Begin Body Foot -->
<!-- End Body Foot -->
<!-- END MAIN TABLE -->
<!-- End body -->
<!-- Begin footer -->
<div class="row pagedetails">
<div class="col-sm-5 col-xs-12 datemod">
<dl id="wb-dtmd">
<dt class=" hidden-print">Date Modified:</dt>
<dd class=" hidden-print">
<span><time>2017-03-02</time></span>
</dd>
</dl>
</div>
<div class="clear visible-xs"></div>
<div class="col-sm-4 col-xs-6">
</div>
<div class="col-sm-3 col-xs-6 text-right">
</div>
<div class="clear visible-xs"></div>
</div>
</main>
<footer role="contentinfo" id="wb-info">
<nav role="navigation" class="container wb-navcurr">
<h2 class="wb-inv">About government</h2>
<!-- EPIC FOOTER BEGIN -->
<!-- EPI-11638 Contact us -->
<ul class="list-unstyled colcount-sm-2 colcount-md-3">
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07026.html#pageid=E048-H00000&from=Industries">Contact us</a></li>
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="https:
<li><a href="http://pm.gc.ca/eng">Prime Minister</a></li>
<li><a href="https:
<li><a href="http://open.canada.ca/en/">Open government</a></li>
</ul>
</nav>
<div class="brand">
<div class="container">
<div class="row">
<nav class="col-md-10 ftr-urlt-lnk">
<h2 class="wb-inv">About this site</h2>
<ul>
<li><a href="https:
<li><a href="https:
<li><a href="http://www1.canada.ca/en/newsite.html">About Canada.ca</a></li>
<li><a href="http:
<li><a href="http://www.ic.gc.ca/eic/site/icgc.nsf/eng/h_07033.html#p1">Privacy</a></li>
</ul>
</nav>
<div class="col-xs-6 visible-sm visible-xs tofpg">
<a href="#wb-cont">Top of Page <span class="glyphicon <API key>"></span></a>
</div>
<div class="col-xs-6 col-md-2 text-right">
<object type="image/svg+xml" tabindex="-1" role="img" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/wmms-blk.svg" aria-label="Symbol of the Government of Canada"></object>
</div>
</div>
</div>
</div>
</footer>
<!--[if gte IE 9 | !IE ]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/wet-boew.min.js"></script>
<!--<![endif]-->
<!--[if lt IE 9]>
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/ie8-wet-boew2.min.js"></script>
<![endif]
<script src="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/js/theme.min.js"></script>
<!-- EPI-10519 -->
<span class="wb-sessto"
data-wb-sessto='{"inactivity": 1800000, "reactionTime": 180000, "sessionalive": 1800000, "logouturl": "/app/ccc/srch/cccSrch.do?lang=eng&prtl=1"}'></span>
<script src="/eic/home.nsf/js/jQuery.<API key>.js"></script>
<!-- EPI-11190 - Webtrends -->
<script src="/eic/home.nsf/js/webtrends.js"></script>
<script>var endTime = new Date();</script>
<noscript>
<div><img alt="" id="DCSIMG" width="1" height="1" src="
</noscript>
<!-- /Webtrends -->
<!-- JS deps -->
<script src="/eic/home.nsf/js/jquery.imagesloaded.js"></script>
<!-- EPI-11262 - Util JS -->
<script src="/eic/home.nsf/js/<API key>.min.js"></script>
<!-- EPI-11383 -->
<script src="/eic/home.nsf/js/jQuery.icValidationErrors.js"></script>
<span style="display:none;" id='app-info' <API key>='' <API key>='' <API key>='' <API key>='' data-issue-tracking='' data-scm-sha1='' <API key>='' data-scm-branch='' <API key>=''></span>
</body></html>
<!-- End Footer -->
<!
- Artifact ID: CBW - IMBS - CCC Search WAR
- Group ID: ca.gc.ic.strategis.imbs.ccc.search
- Version: 3.26
- Built-By: bamboo
- Build Timestamp: 2017-03-02T21:29:28Z
|
# What is fakeLoader.js
fakeLoader.js is a lightweight jQuery plugin that helps you create an animated spinner with a fullscreen loading mask to simulate the page preloading effect.
Check out the demo [http:
## Current Version
`V2.0.0`
1. Installing
js
yarn add jq-fakeloader
or
npm i jq-fakeloader
2. Include CSS
css
<link rel="stylesheet" href="../node_modules/dist/fakeLoader.min.css">
3. Include `javascript` dependencies
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js">
<script src="../node_modules/dist/fakeLoader.min.js">
4. Include `fakeLoader` placeholder in the HTML Document
<div class="fakeLoader"></div>
5. Basic Initialize
js
<script>
$.fakeLoader();
</script>
6. Options
`timeToHide` //Time in milliseconds for fakeLoader disappear
`spinner` //'spinner1', 'spinner2', 'spinner3', 'spinner4', 'spinner5', 'spinner6', 'spinner7'
`bgColor` //Hex, RGB or RGBA colors
Support
If you encounter an issue or want to request a feature, you can create an [issue](https://github.com/joaopereirawd/fakeLoader.js/issues)
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>alternative Standard Libary: Elementverzeichnis</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="../../Logo128x128.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">alternative Standard Libary
 <span id="projectnumber">0.29.8</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Erzeugt von Doxygen 1.8.13 -->
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('../../',false,false,'search.php','Suchen');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('da/d13/classstd_1_1_sys.html','../../');});
</script>
<div id="doc-content">
<div class="header">
<div class="headertitle">
<div class="title">std::Sys Elementverzeichnis</div> </div>
</div><!--header
<div class="contents">
<p>Vollständige Aufstellung aller Elemente für <a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a> einschließlich aller geerbten Elemente.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fClose</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fEOF</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fError</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fFlush</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fGetc</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fIsFile</a>(const char *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fOpen</a>(const char *file, const char *fmt)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fPrintf</a>(void *file, const char *str)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fPutc</a>(int c, void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fPuts</a>(const char *str, void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fRead</a>(void *data, const int count, const int size, void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fSeek</a>(void *file, int off, int org)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fTell</a>(void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">fWrite</a>(void *data, const int count, const int size, void *file)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mAlloc</a>(size_t size)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mAllocE</a>(int elements)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">MemCpy</a>(void *to, const void *from, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">MemMove</a>(void *to, const void *from, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">MemSet</a>(void *buf, unsigned char value, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mFree</a>(void *mem)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mReAlloc</a>(void *old, size_t newSize)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutex_init_t</a> enum-Bezeichner</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutex_type</a> typedef</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutexDestroy</a>(mutex_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutexInit</a>(mutex_type *mutex, mutex_init_t type=mutex_init_t::Normal, bool shared=false, bool robust=false)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutexLock</a>(mutex_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutexTryLock</a>(mutex_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">mutexUnLock</a>(mutex_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">pTotalMem</a>()</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlk_type</a> typedef</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlockDestroy</a>(spinlk_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlockInit</a>(spinlk_type *mutex, const void *attr)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlockLock</a>(spinlk_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlockTryLock</a>(spinlk_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">spinlockUnLock</a>(spinlk_type *mutex)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">vsnPrintf</a>(char *buffer, size_t count, const char *format, va_list argptr)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">wMemCpy</a>(void *to, const void *from, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">wMemMove</a>(void *to, const void *from, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html#<API key>">wMemSet</a>(void *buf, unsigned char value, size_t bytes)</td><td class="entry"><a class="el" href="../../da/d13/classstd_1_1_sys.html">std::Sys</a></td><td class="entry"><span class="mlabel">static</span></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Erzeugt von
<a href="http:
<img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
</ul>
</div>
</body>
</html>
|
var ExtractTextPlugin = require("<API key>");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var path = require("path");
var webpack = require("webpack");
var <API key> = "../../ppb/templates/";
module.exports = {
context: path.resolve(__dirname, "src"),
entry: {
app: "./js/main.js"
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "js/site.js?[hash]",
publicPath: "/site_media/static"
},
module: {
loaders: [
{
test: /\.(gif|png|ico|jpg|svg)$/,
include: [
path.resolve(__dirname, "src/images")
],
loader: "file-loader?name=/images/[name].[ext]"
},
{ test: /\.less$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") },
{
test: /\.(woff|woff2|ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
include: [
path.resolve(__dirname, "/src/fonts"),
path.resolve(__dirname, "../node_modules")
],
loader: "file-loader?name=/fonts/[name].[ext]?[hash]"
},
{ test: /\.jsx?$/, loader: "babel-loader", query: {compact: false} },
]
},
resolve: {
extensions: ["", ".js", ".jsx"],
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new ExtractTextPlugin("css/site.css?[hash]"),
new HtmlWebpackPlugin({
filename: <API key> + "_styles.html",
templateContent: function(templateParams, compilation) {
var link = "";
for (var css in templateParams.htmlWebpackPlugin.files.css) {
link += "<link href='" + templateParams.htmlWebpackPlugin.files.css[css] + "' rel='stylesheet' />\n"
}
return link;
}
}),
new HtmlWebpackPlugin({
filename: <API key> + "_scripts.html",
templateContent: function(templateParams, compilation) {
var script = "";
for (var js in templateParams.htmlWebpackPlugin.files.js) {
script += "<script src='" + templateParams.htmlWebpackPlugin.files.js[js] + "'></script>\n"
}
return script;
}
})
]
};
|
var h = require('hyperscript')
var human = require('human-time')
exports.needs = {}
exports.gives = 'message_meta'
exports.create = function () {
function updateTimestampEl(el) {
el.firstChild.nodeValue = human(new Date(el.timestamp))
return el
}
setInterval(function () {
var els = [].slice.call(document.querySelectorAll('.timestamp'))
els.forEach(updateTimestampEl)
}, 60e3)
return function (msg) {
return updateTimestampEl(h('a.enter.timestamp', {
href: '#'+msg.key,
timestamp: msg.value.timestamp,
title: new Date(msg.value.timestamp)
}, ''))
}
}
|
import { HookContext, Application, createContext, getServiceOptions } from '@feathersjs/feathers';
import { NotFound, MethodNotAllowed, BadRequest } from '@feathersjs/errors';
import { createDebug } from '@feathersjs/commons';
import isEqual from 'lodash/isEqual';
import { CombinedChannel } from '../channels/channel/combined';
import { RealTimeConnection } from '../channels/channel/base';
const debug = createDebug('@feathersjs/transport-commons');
export const <API key> = 1;
export const paramsPositions: { [key: string]: number } = {
find: 0,
update: 2,
patch: 2
};
export function normalizeError (e: any) {
const hasToJSON = typeof e.toJSON === 'function';
const result = hasToJSON ? e.toJSON() : {};
if (!hasToJSON) {
Object.getOwnPropertyNames(e).forEach(key => {
result[key] = e[key];
});
}
if (process.env.NODE_ENV === 'production') {
delete result.stack;
}
delete result.hook;
return result;
}
export function getDispatcher (emit: string, socketMap: WeakMap<RealTimeConnection, any>, socketKey?: any) {
return function (event: string, channel: CombinedChannel, context: HookContext, data?: any) {
debug(`Dispatching '${event}' to ${channel.length} connections`);
channel.connections.forEach(connection => {
// The reference between connection and socket is set in `app.setup`
const socket = socketKey ? connection[socketKey] : socketMap.get(connection);
if (socket) {
const eventName = `${context.path || ''} ${event}`.trim();
let result = channel.dataFor(connection) || context.dispatch || context.result;
// If we are getting events from an array but try to dispatch individual data
// try to get the individual item to dispatch from the correct index.
if (!Array.isArray(data) && Array.isArray(context.result) && Array.isArray(result)) {
result = context.result.find(resultData => isEqual(resultData, data));
}
debug(`Dispatching '${eventName}' to Socket ${socket.id} with`, result);
socket[emit](eventName, result);
}
});
};
}
export async function runMethod (app: Application, connection: RealTimeConnection, path: string, method: string, args: any[]) {
const trace = `method '${method}' on service '${path}'`;
const methodArgs = args.slice(0);
const callback = typeof methodArgs[methodArgs.length - 1] === 'function'
? methodArgs.pop() : function () {};
debug(`Running ${trace}`, connection, args);
const handleError = (error: any) => {
debug(`Error in ${trace}`, error);
callback(normalizeError(error));
};
try {
const lookup = app.lookup(path);
// No valid service was found throw a NotFound error
if (lookup === null) {
throw new NotFound(`Service '${path}' not found`);
}
const { service, params: route = {} } = lookup;
const { methods } = getServiceOptions(service);
// Only service methods are allowed
if (!methods.includes(method)) {
throw new MethodNotAllowed(`Method '${method}' not allowed on service '${path}'`);
}
const position = paramsPositions[method] !== undefined ? paramsPositions[method] : <API key>;
const query = methodArgs[position] || {};
// `params` have to be re-mapped to the query and added with the route
const params = Object.assign({ query, route, connection }, connection);
// `params` is always the last parameter. Error if we got more arguments.
if (methodArgs.length > (position + 1)) {
throw new BadRequest(`Too many arguments for '${method}' method`);
}
methodArgs[position] = params;
const ctx = createContext(service, method);
const returnedCtx: HookContext = await (service as any)[method](...methodArgs, ctx);
const result = returnedCtx.dispatch || returnedCtx.result;
debug(`Returned successfully ${trace}`, result);
callback(null, result);
} catch (error: any) {
handleError(error);
}
}
|
#import <CoreData/NSSQLIntermediate.h>
// Not exported
@interface <API key> : NSSQLIntermediate
{
unsigned long long _limit;
}
- (id)<API key>:(id)arg1;
- (id)initWithLimit:(unsigned long long)arg1 inScope:(id)arg2;
@end
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Stranger Things Wall</title>
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>
<img src="img/vacio.gif" alt="" id="img" class="img"/>
<p class="txt">Presiona una tecla</p>
<script src="js/script.js"></script>
</body>
</html>
|
<?php
class Thread extends Eloquent {
public static $table = 'threads';
public static $timestamps = true;
public function replies()
{
return $this->has_many('Reply');
}
}
|
<html>
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<title>Blog | Guilherme Matheus Costa</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link href="/css/essentials.min.css" rel="stylesheet" type="text/css"/>
<meta property="og:site_name" content="Guilherme Matheus Costa"/>
</head>
<body>
<h1>Guilherme Matheus Costa</h1>
<h2>Resume</h2>
</body>
</html>
|
#!/usr/bin/env python
from hdf5handler import HDF5Handler
handler = HDF5Handler('mydata.hdf5')
handler.open()
for i in range(100):
handler.put(i, 'numbers')
handler.close()
|
'use strict';
import { Geometry } from '../Geometry';
import { GeometryHelper } from '../GeometryHelper';
/**
* This function generates custom buffers and passes them to
* a new static geometry, which is returned to the user.
*
* @class Tetrahedron
* @constructor
*
* @param {Object} options Parameters that alter the
* vertex buffers of the generated geometry.
*
* @return {Object} constructed geometry
*/
class Tetrahedron extends Geometry {
constructor(options) {
//handled by es6 transpiler
//if (!(this instanceof Tetrahedron)) return new Tetrahedron(options);
var textureCoords = [];
var normals = [];
var detail;
var i;
var t = Math.sqrt(3);
var vertices = [
// Back
1, -1, -1 / t,
-1, -1, -1 / t,
0, 1, 0,
// Right
0, 1, 0,
0, -1, t - 1 / t,
1, -1, -1 / t,
// Left
0, 1, 0,
-1, -1, -1 / t,
0, -1, t - 1 / t,
// Bottom
0, -1, t - 1 / t,
-1, -1, -1 / t,
1, -1, -1 / t
];
var indices = [
0, 1, 2,
3, 4, 5,
6, 7, 8,
9, 10, 11
];
for (i = 0; i < 4; i++) {
textureCoords.push(
0.0, 0.0,
0.5, 1.0,
1.0, 0.0
);
}
options = options || {};
while (--detail) GeometryHelper.subdivide(indices, vertices, textureCoords);
normals = GeometryHelper.computeNormals(vertices, indices);
options.buffers = [
{
name: 'a_pos',
data: vertices
},
{
name: 'a_texCoord',
data: textureCoords,
size: 2
},
{
name: 'a_normals',
data: normals
},
{
name: 'indices',
data: indices,
size: 1
}
];
super(options);
}
}
export { Tetrahedron };
|
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using libldt3.attributes;
using libldt3.model.enums;
using libldt3.model.regel;
using libldt3.model.regel.kontext;
using libldt3.model.saetze;
using NodaTime;
namespace libldt3
{
/**
* Simple, reflection and annotation based reader for LDT 3.0.
*
* @author Christoph Brill <egore911@gmail.com>
*/
public class LdtReader
{
readonly IDictionary<Type, Regel> regelCache = new Dictionary<Type, Regel>();
readonly LdtConstants.Mode mode;
public LdtReader(LdtConstants.Mode mode)
{
this.mode = mode;
}
/**
* Read the LDT found on a given path.
*
* @param path
* the path of the LDT file (any format handled by NIO
* {@link Path})
* @return the list of Satz elements found in the LDT file
* @throws IOException
* thrown if reading the file failed
*/
public IList<Satz> Read(string path)
{
using (var f = File.Open(path, FileMode.Open))
{
return Read(f);
}
}
/**
* Read the LDT found on a given path.
*
* @param path
* the path of the LDT file
* @return the list of Satz elements found in the LDT file
* @throws IOException
* thrown if reading the file failed
*/
public IList<Satz> Read(FileStream path)
{
var stream = new StreamReader(path, Encoding.GetEncoding("ISO-8859-1"));
return Read(stream);
}
/**
* Read the LDT from a given string stream.
*
* @param stream
* the LDT lines as string stream
* @return the list of Satz elements found in the LDT file
*/
public IList<Satz> Read(StreamReader stream)
{
Stack<object> stack = new Stack<object>();
IList<Satz> data = new List<Satz>();
string line;
int integer = 0;
while ((line = stream.ReadLine()) != null)
{
HandleInput(line, stack, data, integer++);
}
return data;
}
void HandleInput(string line, Stack<object> stack, IList<Satz> data, int lineNo)
{
Trace.TraceInformation("Reading line {0}", line);
// Check if the line meets the minimum requirements (3 digits for
// length, 4 digits for the identifier)
if (line.Length < 7)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException("Line '" + line + "' (" + lineNo + ") was less than 7 characters, aborting");
}
else
{
Trace.TraceInformation("Line '{0}' ({1}) was less than 7 characters, continuing anyway", line, lineNo);
}
}
// Read the length and check whether it had the correct length
int length = int.Parse(line.Substring(0, 3));
if (length != line.Length + 2)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException(
"Line '" + line + "' (" + lineNo + ") should have length " + (line.Length + 2) + ", but was " + length);
}
else
{
Trace.TraceInformation("Line '{0}' ({1}) should have length {2}, but was {3}. Ignoring specified length", line, lineNo,
(line.Length + 2), length);
length = line.Length + 2;
}
}
// Read identifier and payload
string identifier = line.Substring(3, 7 - 3);
string payload = line.Substring(7, length - 2 - 7);
switch (identifier)
{
case "8000":
{
// Start: Satz
AssureLength(line, length, 13);
if (stack.Count > 0)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new <API key>(
"Stack must be empty when starting a new Satz, but was " + stack.Count + " long");
}
else
{
Trace.TraceInformation("Stack must be empty when starting a new Satz, but was {0}. Clearing and continuing",
stack);
stack.Clear();
}
}
// Extract Satzart from payload and create Satz matching it
Satzart satzart = GetSatzart(payload);
switch (satzart)
{
case Satzart.Befund:
stack.Push(new Befund());
break;
case Satzart.Auftrag:
stack.Push(new Auftrag());
break;
case Satzart.<API key>:
stack.Push(new <API key>());
break;
case Satzart.<API key>:
stack.Push(new <API key>());
break;
case Satzart.<API key>:
stack.Push(new <API key>());
break;
case Satzart.<API key>:
stack.Push(new <API key>());
break;
default:
throw new ArgumentException("Unsupported Satzart '" + payload + "' found");
}
break;
}
case "8001":
{
// End: Satz
AssureLength(line, length, 13);
object o = stack.Pop();
Datenpaket datenpaket = o.GetType().GetCustomAttribute<Datenpaket>();
if (datenpaket != null)
{
<API key>(o, datenpaket.Kontextregeln);
}
if (stack.Count == 0)
{
data.Add((Satz)o);
}
break;
}
case "8002":
{
// Start: Objekt
AssureLength(line, length, 17);
object currentObject1 = PeekCurrentObject(stack);
Objekt annotation1 = currentObject1.GetType().GetCustomAttribute<Objekt>();
if (annotation1 != null)
{
if (annotation1.Value.Length == 0)
{
// If annotation is empty, the parent object would actually
// be the one to deal with
}
else
{
// Match found, everything is fine
if (payload.Equals("Obj_" + annotation1.Value))
{
break;
}
// No match found, abort or inform the developer
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException(
"In line '" + line + "' (" + lineNo + ") expected Obj_" + annotation1.Value + ", got " + payload);
}
else
{
Trace.TraceError("In line {0} ({1}) expected Obj_{2}, got {3}", line, lineNo, annotation1.Value, payload);
break;
}
}
}
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException("Line '" + line + "' (" + lineNo + ") started an unexpeted object, stack was " + stack.ToArray());
}
else
{
Trace.TraceWarning("Line '{0}' ({1}) started an unexpeted object, stack was {2}", line, lineNo, stack);
}
break;
}
case "8003":
{
// End: Objekt
AssureLength(line, length, 17);
object o;
Objekt annotation1;
do
{
o = stack.Pop();
annotation1 = o.GetType().GetCustomAttribute<Objekt>();
if (annotation1 != null)
{
if (annotation1.Value.Length != 0 && !("Obj_" + annotation1.Value).Equals(payload)) {
Trace.TraceWarning("Line: {0} ({1}), annotation {2}, payload {3}", line, lineNo, annotation1.Value, payload);
}
<API key>(o, annotation1.Kontextregeln);
}
} while (annotation1 != null && annotation1.Value.Length == 0);
if (stack.Count == 0)
{
data.Add((Satz)o);
}
break;
}
default:
// Any line not starting or completing a Satz or Objekt
object currentObject = PeekCurrentObject(stack);
if (currentObject == null)
{
throw new <API key>("No object when appplying line " + line + " (" + lineNo + ")");
}
// XXX iterating the fields could be replaced by a map to be a bit
// faster when dealing with the same class
foreach (FieldInfo info in currentObject.GetType().GetFields())
{
// Check if we found a Feld annotation, if not this is not our
// field
Feld annotation2 = info.GetCustomAttribute<Feld>();
if (annotation2 == null)
{
continue;
}
// Check if the annotation matches the identifier, if not, this
// is not our field
if (!identifier.Equals(annotation2.Value))
{
continue;
}
try
{
// Check if there is currently a value set
object o = info.GetValue(currentObject);
if (o != null && GetGenericList(info.FieldType) == null)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new <API key>(
"Line '" + line + "' (" + lineNo + ") would overwrite existing value " + o + " of " + currentObject + "." + info.Name);
}
else
{
Trace.TraceWarning("Line '{0}' ({1}) would overwrite existing value {2} in object {3}.{4}", line, lineNo, o, currentObject, info);
}
}
<API key>(info, payload);
// Convert the value to its target type ...
object value = ConvertType(info, info.FieldType, payload, stack);
// .. and set the value on the target object
info.SetValue(currentObject, value);
}
catch (Exception e)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new <API key>(e.Message, e);
}
else
{
Trace.TraceError(e.Message);
}
}
// We are done with this line
return;
}
// No field with a matching Feld annotation found, check if we are
// an Objekt with an empty value (anonymous object), if so try our
// parent
Objekt annotation = currentObject.GetType().GetCustomAttribute<Objekt>();
if (annotation != null && annotation.Value.Length == 0)
{
stack.Pop();
HandleInput(line, stack, data, lineNo);
return;
}
// Neither we nor our parent could deal with this line
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException("Failed reading line " + line + " (" + lineNo + "), current stack: " + string.Join(" ", stack.ToArray()));
}
else
{
Trace.TraceWarning("Failed reading line {0} ({1}), current stack: {2}, skipping line", line, lineNo, string.Join(" ", stack.ToArray()));
}
break;
}
}
private void <API key>(object o, Type[] kontextRegeln)
{
foreach (Type kontextregel in kontextRegeln)
{
try
{
if (!((Kontextregel)Activator.CreateInstance(kontextregel)).IsValid(o))
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException("Context rule " + kontextregel.Name + " failed on object " + o);
}
else
{
Trace.TraceWarning("Context rule {} failed on object {}", kontextregel.Name, o);
}
}
}
catch (Exception e)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException("Context rule " + kontextregel.Name + " failed on object " + o, e);
}
else
{
Trace.TraceWarning("Context rule {} failed on object {}", kontextregel.Name, o, e);
}
}
}
}
void <API key>(FieldInfo field, string payload)
{
foreach (Regelsatz regelsatz in field.GetCustomAttributes<Regelsatz>())
{
if (regelsatz.Laenge >= 0)
{
if (payload.Length != regelsatz.Laenge)
{
ValidationFailed(field.DeclaringType.Name + "." + field.Name + ": Value " + payload + " did not match expected length "
+ regelsatz.Laenge + ", was " + payload.Length);
}
}
if (regelsatz.MinLaenge >= 0)
{
if (payload.Length < regelsatz.MinLaenge)
{
ValidationFailed(field.DeclaringType.Name + "." + field.Name + ": Value " + payload + " did not match expected minimum length "
+ regelsatz.MinLaenge + ", was " + payload.Length);
}
}
if (regelsatz.MaxLaenge >= 0)
{
if (payload.Length > regelsatz.MaxLaenge)
{
ValidationFailed(field.DeclaringType.Name + "." + field.Name + ": Value " + payload + " did not match expected maximum length "
+ regelsatz.MaxLaenge + ", was " + payload.Length);
}
}
// No specific rules given, likely only length checks
if (regelsatz.Value.Length == 0)
{
continue;
}
bool found = false;
foreach (Type regel in regelsatz.Value)
{
if (GetRegel(regel).IsValid(payload))
{
found = true;
break;
}
}
if (!found)
{
ValidationFailed(field.DeclaringType.Name + "." + field.Name + ": Value " + payload + " did not confirm to any rule of "
+ ToString(regelsatz.Value));
}
}
}
void ValidationFailed(string message)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new <API key>(message);
}
else
{
Trace.TraceWarning(message);
}
}
string ToString(Type[] regeln)
{
StringBuilder buffer = new StringBuilder();
foreach (Type regel in regeln)
{
if (buffer.Length > 0)
{
buffer.Append(" or ");
}
buffer.Append(regel.Name);
}
return buffer.ToString();
}
Regel GetRegel(Type regel)
{
Regel instance;
regelCache.TryGetValue(regel, out instance);
if (instance == null)
{
instance = (Regel)Activator.CreateInstance(regel);
regelCache[regel] = instance;
}
return instance;
}
/**
* Extract the Satzart form a given payload
*
* @param payload
* the payload of the line
* @return the Satzart or {@code null}
*/
Satzart GetSatzart(string payload)
{
foreach (Satzart sa in Enum.GetValues(typeof(Satzart)).Cast<Satzart>())
{
if (sa.GetCode().Equals(payload))
{
return sa;
}
}
throw new ArgumentException("Unsupported Satzart '" + payload + "' found");
}
/**
* Peek the current objekt from the stack, if any.
*
* @param stack
* the stack to peek the object from
* @return the current top level element of the stack or {@code null}
*/
static object PeekCurrentObject(Stack<object> stack)
{
if (stack.Count == 0)
{
return null;
}
return stack.Peek();
}
/**
* Check if the line matches the expected length.
*
* @param line
* the line to check
* @param length
* the actual length
* @param target
* the length specified by the line
*/
void AssureLength(string line, int length, int target)
{
if (length != target)
{
if (mode == LdtConstants.Mode.STRICT)
{
throw new ArgumentException(
"Line '" + line + "' must have length " + target + ", was " + length);
}
else
{
Trace.TraceInformation("Line '{0}' must have length {1}, was {2}", line, target, length);
}
}
}
/**
* Convert the string payload into a target class. (Note: There are
* certainly better options out there but this one is simple enough for our
* needs.)
*/
static object ConvertType(FieldInfo field, Type type, string payload, Stack<object> stack)
{
if (type == typeof(string))
{
return payload;
}
if (type == typeof(float) || type == typeof(float?))
{
return float.Parse(payload);
}
if (type == typeof(int) || type == typeof(int?))
{
return int.Parse(payload);
}
if (type == typeof(long) || type == typeof(long?))
{
return long.Parse(payload);
}
if (type == typeof(bool) || type == typeof(bool?))
{
return "1".Equals(payload);
}
if (type == typeof(LocalDate?))
{
return LdtConstants.FORMAT_DATE.Parse(payload).Value;
}
if (type == typeof(LocalTime?))
{
return LdtConstants.FORMAT_TIME.Parse(payload).Value;
}
if (IsNullableEnum(type))
{
Type enumType = Nullable.GetUnderlyingType(type);
MethodInfo method = Type.GetType(enumType.FullName + "Extensions").GetMethod("GetCode");
if (method != null)
{
foreach (object e in Enum.GetValues(enumType))
{
string code = (string)method.Invoke(e, new object[] { e });
if (payload.Equals(code))
{
return e;
}
}
return null;
}
}
if (type.IsEnum)
{
MethodInfo method = Type.GetType(type.FullName + "Extensions").GetMethod("GetCode");
if (method != null)
{
foreach (object e in Enum.GetValues(type))
{
string code = (string)method.Invoke(e, new object[] { e });
if (payload.Equals(code))
{
return e;
}
}
return null;
}
}
Type genericType = GetGenericList(type);
if (genericType != null)
{
object currentObject = PeekCurrentObject(stack);
var o = (System.Collections.IList) field.GetValue(currentObject);
if (o == null)
{
o = (System.Collections.IList) Activator.CreateInstance(typeof(List<>).MakeGenericType(genericType.GetGenericArguments()[0]));
field.SetValue(currentObject, o);
}
o.Add(ConvertType(field, type.<API key>[0], payload, stack));
return o;
}
if (type.GetCustomAttribute<Objekt>() != null)
{
object instance = Activator.CreateInstance(type);
stack.Push(instance);
FieldInfo declaredField = type.GetField("Value");
if (declaredField != null)
{
declaredField.SetValue(instance, ConvertType(declaredField, declaredField.FieldType, payload, stack));
}
return instance;
}
throw new ArgumentException("Don't know how to handle type " + type);
}
static bool IsNullableEnum(Type t)
{
Type u = Nullable.GetUnderlyingType(t);
return (u != null) && u.IsEnum;
}
static Type GetGenericList(Type type)
{
if (type.IsGenericType && type.<API key>() == typeof(IList<>))
{
return type;
}
foreach (Type interfaceType in type.GetInterfaces())
{
if (interfaceType.IsGenericType && interfaceType.<API key>() == typeof(IList<>))
{
return interfaceType;
}
}
return null;
}
}
}
|
var map;
var bounds;
var markers = {};
var cluster_polygons = {};
var zoomTimeout;
var <API key>;
var white_overlay;
var overlay_opacity = 50;
var OPACITY_MAX_PIXELS = 57;
var active_cluster_poly;
var marker_image;
var center_marker;
var <API key>;
function createMap() {
bounds = new google.maps.LatLngBounds ();
markers;
cluster_polygons;
marker_image = {
url: STATIC_URL + "images/red_marker.png",
anchor: new google.maps.Point(4,4)};
center_marker = {
url: STATIC_URL + "images/black_marker.png",
size: new google.maps.Size(20, 20),
anchor: new google.maps.Point(10,10)};
<API key> = {
url: STATIC_URL + "images/<API key>.gif",
size: new google.maps.Size(20, 20),
anchor: new google.maps.Point(10,10)};
var mapOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 4,
mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true
};
map = new google.maps.Map(document.getElementById("canvas"),
mapOptions);
// google.maps.event.addListener(map, 'bounds_changed', function(e) {
// if (zoomTimeout) {
// window.clearTimeout(zoomTimeout);
// zoomTimeout = window.setTimeout(<API key>, 5000);
$.getScript(STATIC_URL + "script/CustomTileOverlay.js", function() {
white_overlay = new CustomTileOverlay(map, overlay_opacity);
white_overlay.show();
google.maps.event.addListener(map, 'tilesloaded', function () {
white_overlay.deleteHiddenTiles(map.getZoom());
});
<API key>(map, overlay_opacity);
});
}
function <API key>(map, opacity) {
var sliderImageUrl = STATIC_URL + "images/opacity-slider3d14.png";
// Create main div to hold the control.
var opacityDiv = document.createElement('DIV');
opacityDiv.setAttribute("style", "margin:5px;overflow-x:hidden;overflow-y:hidden;background:url(" + sliderImageUrl + ") no-repeat;width:71px;height:21px;cursor:pointer;");
// Create knob
var opacityKnobDiv = document.createElement('DIV');
opacityKnobDiv.setAttribute("style", "padding:0;margin:0;overflow-x:hidden;overflow-y:hidden;background:url(" + sliderImageUrl + ") no-repeat -71px 0;width:14px;height:21px;");
opacityDiv.appendChild(opacityKnobDiv);
var opacityCtrlKnob = new ExtDraggableObject(opacityKnobDiv, {
restrictY: true,
container: opacityDiv
});
google.maps.event.addListener(opacityCtrlKnob, "dragend", function () {
set_overlay_opacity(opacityCtrlKnob.valueX());
});
// google.maps.event.addDomListener(opacityDiv, "click", function (e) {
// var left = findPosLeft(this);
// var x = e.pageX - left - 5; // - 5 as we're using a margin of 5px on the div
// opacityCtrlKnob.setValueX(x);
// set_overlay_opacity(x);
map.controls[google.maps.ControlPosition.TOP_RIGHT].push(opacityDiv);
// Set initial value
var initialValue = OPACITY_MAX_PIXELS / (100 / opacity);
opacityCtrlKnob.setValueX(initialValue);
set_overlay_opacity(initialValue);
}
function findPosLeft(obj) {
var curleft = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
} while (obj = obj.offsetParent);
return curleft;
}
return undefined;
}
function set_overlay_opacity(value) {
overlay_opacity = (100.0 / OPACITY_MAX_PIXELS) * value;
if (value < 0) value = 0;
if (value == 0) {
if (white_overlay.visible == true) {
white_overlay.hide();
}
}
else {
white_overlay.setOpacity(overlay_opacity);
if (white_overlay.visible == false) {
white_overlay.show();
}
}
}
function <API key>() {
var bounds = map.getBounds();
var x0 = bounds.getNorthEast().lng();
var y0 = bounds.getNorthEast().lat();
var x1 = bounds.getSouthWest().lng();
var y1 = bounds.getSouthWest().lat();
// Remove stuff off screen
var to_remove = [];
// What to remove
$.each(markers, function(idx, marker){
if (!bounds.contains(marker.getPosition()))
{
marker.setMap(null);
to_remove.push(idx);
}
});
$.each(to_remove, function(i, idx){
delete markers[idx];
})
// $.getJSON("/rest/photos_box_contains?x0=" + x0 + "&y0=" + y0 + "&x1=" + x1 + "&y1=" + y1, function(data){
// console.log("got " + data.features.length);
// add_photo_to_map(data.features, 0, 128);
$.getJSON("/rest/<API key>?x0=" + x0 + "&y0=" + y0 + "&x1=" + x1 + "&y1=" + y1, function(data){
console.log("got " + data.features.length);
add_cluster_to_map(data.features, 0);
})
}
function create_photo_marker(photo_info) {
var loc = new google.maps.LatLng(photo_info.geometry.coordinates[1], photo_info.geometry.coordinates[0]);
var marker = new google.maps.Marker({
map: map,
position: loc,
icon: marker_image
});
var infowindow = new google.maps.InfoWindow({
content: "<div style='width:200px;height:200px'><a href='" + photo_info.properties.photo_url + "'><img src='" + photo_info.properties.photo_thumb_url + "' style='max-width:100%;max-height:100%;'/></div>"
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
markers[photo_info.id] = marker;
}
function add_photo_to_map(photos, i, step) {
for (var j = 0; j < step; j++) {
if (i + j >= photos.length)
{
break;
}
var photo_info = photos[i + j];
if (!markers[photo_info.id]) {
create_photo_marker(photo_info);
}
}
i += step;
if (i < photos.length) {
window.setTimeout(function(){add_photo_to_map(photos, i, step);}, 1);
}
}
function <API key>(data){
$.each(cluster_polygons, function(idx, poly){
poly.setMap(null);
});
bounds = new google.maps.LatLngBounds ();
cluster_polygons = [];
<API key> = new google.maps.OverlayView();
<API key>.onAdd = function() {
var layer = d3.select(this.getPanes().overlayMouseTarget).append("div")
.attr("class", "cluster_center");
var projection = this.getProjection();
var max_size = 300;
var max_size_per_2 = max_size / 2;
var marker = layer.selectAll("svg")
.data(data.features)
.each(transform)
.enter().append("svg:svg")
.each(transform)
.each(tie_to_g_marker)
.attr("class", "marker")
.style("z-index", function(cluster) {
return set_default_z_index(cluster);
})
.append("svg:g");
function set_default_z_index(cluster) {
return parseInt(cluster.properties.<API key> * 1000 + 100000);
}
marker.append("svg:polygon")
.attr("points", function(cluster){
var out = [];
var last_phase = 0.0;
var last_length = 1.0 / 12.0 * (max_size_per_2 - 1);
var min_l = 0.0;//0.3 * max_size_per_2 * (Math.sqrt(cluster.properties.<API key>) * 0.7 + 0.3);
for (var j = 1.0; j <= 12.0; j += 1.0){
var phase = j / 12.0 * 2 * Math.PI;
out.push([max_size_per_2 + Math.sin(last_phase) * min_l, max_size_per_2 - Math.cos(last_phase) * min_l]);
out.push([max_size_per_2 + Math.sin(phase) * min_l, max_size_per_2 - Math.cos(phase) * min_l]);
var second_poly = [];
var l = ( (cluster.properties["points_month_" + parseInt(j) + "_relative"]) * 0.9 + 0.1) *
max_size_per_2 * (cluster.properties.<API key> * 0.8 + 0.2);
second_poly.push([max_size_per_2 + Math.sin(last_phase) * min_l, max_size_per_2 - Math.cos(last_phase) * min_l]);
second_poly.push([max_size_per_2 + Math.sin(last_phase) * l, max_size_per_2 - Math.cos(last_phase) * l]);
second_poly.push([max_size_per_2 + Math.sin(phase) * l, max_size_per_2 - Math.cos(phase) * l]);
second_poly.push([max_size_per_2 + Math.sin(phase) * min_l, max_size_per_2 - Math.cos(phase) * min_l]);
second_poly.push(second_poly[0]);
last_phase = phase;
d3.select(this.parentElement)
.append("svg:polygon")
.attr("points", second_poly.join(" "))
.attr("class", "month_" + parseInt(j));
}
return out.join(" ");
})
.attr("class", "<API key>");
function transform(cluster) {
var coords = cluster.geometry.geometries[0].coordinates;
var d = new google.maps.LatLng(coords[1], coords[0]);
d = projection.<API key>(d);
return d3.select(this)
.style("left", (d.x - max_size_per_2) + "px")
.style("top", (d.y - max_size_per_2) + "px");
}
function tie_to_g_marker(cluster){
var coords = cluster.geometry.geometries[0].coordinates;
var d = new google.maps.LatLng(coords[1], coords[0]);
var marker = new google.maps.Marker({
map: map,
position: d,
icon: <API key>,
zIndex: set_default_z_index(d3.select(this).data()[0])
});
var cluster_center = this;
google.maps.event.addListener(marker, 'mouseover', function() {
d3_cluster_center = d3.select(cluster_center);
d3_cluster_center
.style("transform", "scale(3.0)")
.style("animation-name", "<API key>")
.style("z-index", 1001001);
});
google.maps.event.addListener(marker, 'click', function() {
if (active_cluster_poly) {
active_cluster_poly.setMap(null);
}
<API key>(d3_cluster_center.data()[0]["id"]);
d3_cluster_center = d3.select(cluster_center);
poly_bounds = new google.maps.LatLngBounds ();
// Define the LatLng coordinates for the polygon's path.
var coords = d3_cluster_center.data()[0].geometry.geometries[1].coordinates[0];
var g_coords = [];
for (j in coords)
{
var c = coords[j];
var co = new google.maps.LatLng(c[1], c[0]);
g_coords.push(co);
poly_bounds.extend(co);
}
// Construct the polygon.
var poly = new google.maps.Polygon({
paths: g_coords,
strokeColor: '#FF0000',
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: '#FF0000',
fillOpacity: 0.35
});
poly.setMap(map);
active_cluster_poly = poly;
map.fitBounds(poly_bounds);
});
google.maps.event.addListener(marker, 'mouseout', function() {
d3.select(cluster_center)
.style("transform", "scale(1.0)")
.style("animation-name", "<API key>")
.style("z-index", function(cluster) {
return set_default_z_index(cluster);
});
});
bounds.extend(d);
}
map.fitBounds(bounds);
<API key>.draw = function() {
var projection = this.getProjection();
layer.selectAll("svg")
.data(data.features)
.each(transform);
};
};
<API key>.setMap(map);
}
function <API key>(clusters){
console.log("finalizing");
map.fitBounds(bounds);
}
function show_clusters_lame() {
var $form = $("#<API key>"), url = $form.attr("action");
// Fire some AJAX!
$.ajax({
type: "GET",
url: url,
dataType: "json",
data: {id: $("#<API key>").val()}
})
.done(function(msg){
add_cluster_to_map(msg.features, 0);
});
}
function <API key>() {
var $form = $("#<API key>"), url = $form.attr("action");
// Fire some AJAX!
$.ajax({
type: "GET",
url: url,
dataType: "json",
data: {id: $("#<API key>").val()}
})
.done(function(msg){
<API key>(msg.features, 0);
});
}
function add_cluster_to_map(clusters, i){
// Define the LatLng coordinates for the polygon's path.
var cluster = clusters[i];
var coords = [];
var points = cluster.geometry.geometries[1].coordinates[0];
for (var j = 0; j < points.length; j += 1)
{
coords.push(new google.maps.LatLng(
points[j][1], points[j][0]));
}
var center = cluster.geometry.geometries[0].coordinates;
var loc = new google.maps.LatLng(
center[1],
center[0])
bounds.extend(loc);
// Construct the polygon.
var poly = new google.maps.Polygon({
paths: coords,
strokeColor: '#000000',
strokeOpacity: 1.0,
strokeWeight: 1,
fillColor: '#FF0000',
fillOpacity: 0.1
});
poly.setMap(map);
// cluster_polygons.push(poly);
if (i < clusters.length - 1) {
window.setTimeout(function(){add_cluster_to_map(clusters, i + 1);}, 1);
} else {
<API key>(clusters);
}
}
function <API key>(clusters, i){
// Define the LatLng coordinates for the polygon's path.
var cluster = clusters[i];
var coords = [];
var center = cluster.geometry.geometries[0].coordinates;
var loc = new google.maps.LatLng(
center[1],
center[0])
bounds.extend(loc);
var marker = new google.maps.Marker({
map: map,
position: loc
});
if (i < clusters.length - 1) {
window.setTimeout(function(){<API key>(clusters, i + 1);}, 1);
} else {
<API key>(clusters);
}
}
function show_all() {
map.fitBounds(bounds);
}
|
#include "sendcoinsdialog.h"
#include "ui_sendcoinsdialog.h"
#include "walletmodel.h"
#include "bitcoinunits.h"
#include "addressbookpage.h"
#include "optionsmodel.h"
#include "sendcoinsentry.h"
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include "base58.h"
#include <QMessageBox>
#include <QLocale>
#include <QTextDocument>
#include <QScrollBar>
SendCoinsDialog::SendCoinsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::SendCoinsDialog),
model(0)
{
ui->setupUi(this);
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
ui->addButton->setIcon(QIcon());
ui->clearButton->setIcon(QIcon());
ui->sendButton->setIcon(QIcon());
#endif
addEntry();
connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry()));
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
<API key> = true;
}
void SendCoinsDialog::setModel(WalletModel *model)
{
this->model = model;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
entry->setModel(model);
}
}
if(model && model->getOptionsModel())
{
setBalance(model->getBalance(), model->getStake(), model-><API key>(), model->getImmatureBalance());
connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
}
}
SendCoinsDialog::~SendCoinsDialog()
{
delete ui;
}
void SendCoinsDialog::<API key>()
{
QList<SendCoinsRecipient> recipients;
bool valid = true;
if(!model)
return;
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
if(entry->validate())
{
recipients.append(entry->getValue());
}
else
{
valid = false;
}
}
}
if(!valid || recipients.isEmpty())
{
return;
}
// Format confirmation message
QStringList formatted;
foreach(const SendCoinsRecipient &rcp, recipients)
{
#if QT_VERSION < 0x050000
formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address));
#else
formatted.append(tr("<b>%1</b> to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), rcp.label.toHtmlEscaped(), rcp.address));
#endif
}
<API key> = false;
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"),
tr("Are you sure you want to send %1?").arg(formatted.join(tr(" and "))),
QMessageBox::Yes|QMessageBox::Cancel,
QMessageBox::Cancel);
if(retval != QMessageBox::Yes)
{
<API key> = true;
return;
}
WalletModel::UnlockContext ctx(model->requestUnlock());
if(!ctx.isValid())
{
// Unlock wallet was cancelled
<API key> = true;
return;
}
WalletModel::SendCoinsReturn sendstatus = model->sendCoins(recipients);
switch(sendstatus.status)
{
case WalletModel::InvalidAddress:
QMessageBox::warning(this, tr("Send Coins"),
tr("The recipient address is not valid, please recheck."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::InvalidAmount:
QMessageBox::warning(this, tr("Send Coins"),
tr("The amount to pay must be larger than 0."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::<API key>:
QMessageBox::warning(this, tr("Send Coins"),
tr("The amount exceeds your balance."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::<API key>:
QMessageBox::warning(this, tr("Send Coins"),
tr("The total exceeds your balance when the %1 transaction fee is included.").
arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, sendstatus.fee)),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::DuplicateAddress:
QMessageBox::warning(this, tr("Send Coins"),
tr("Duplicate address found, can only send to each address once per send operation."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::<API key>:
QMessageBox::warning(this, tr("Send Coins"),
tr("Error: Transaction creation failed."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::<API key>:
QMessageBox::warning(this, tr("Send Coins"),
tr("Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."),
QMessageBox::Ok, QMessageBox::Ok);
break;
case WalletModel::Aborted: // User aborted, nothing to do
break;
case WalletModel::OK:
accept();
break;
}
<API key> = true;
}
void SendCoinsDialog::clear()
{
// Remove entries until only one left
while(ui->entries->count())
{
delete ui->entries->takeAt(0)->widget();
}
addEntry();
updateRemoveEnabled();
ui->sendButton->setDefault(true);
}
void SendCoinsDialog::reject()
{
clear();
}
void SendCoinsDialog::accept()
{
clear();
}
SendCoinsEntry *SendCoinsDialog::addEntry()
{
SendCoinsEntry *entry = new SendCoinsEntry(this);
entry->setModel(model);
ui->entries->addWidget(entry);
connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*)));
updateRemoveEnabled();
// Focus the field, so that entry can start immediately
entry->clear();
entry->setFocus();
ui-><API key>->resize(ui-><API key>->sizeHint());
QCoreApplication::instance()->processEvents();
QScrollBar* bar = ui->scrollArea->verticalScrollBar();
if(bar)
bar->setSliderPosition(bar->maximum());
return entry;
}
void SendCoinsDialog::updateRemoveEnabled()
{
// Remove buttons are enabled as soon as there is more than one send-entry
bool enabled = (ui->entries->count() > 1);
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
entry->setRemoveEnabled(enabled);
}
}
setupTabChain(0);
}
void SendCoinsDialog::removeEntry(SendCoinsEntry* entry)
{
delete entry;
updateRemoveEnabled();
}
QWidget *SendCoinsDialog::setupTabChain(QWidget *prev)
{
for(int i = 0; i < ui->entries->count(); ++i)
{
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
prev = entry->setupTabChain(prev);
}
}
QWidget::setTabOrder(prev, ui->addButton);
QWidget::setTabOrder(ui->addButton, ui->sendButton);
return ui->sendButton;
}
void SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)
{
if(!<API key>)
return;
SendCoinsEntry *entry = 0;
// Replace the first entry if it is still unused
if(ui->entries->count() == 1)
{
SendCoinsEntry *first = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(0)->widget());
if(first->isClear())
{
entry = first;
}
}
if(!entry)
{
entry = addEntry();
}
entry->setValue(rv);
}
bool SendCoinsDialog::handleURI(const QString &uri)
{
SendCoinsRecipient rv;
// URI has to be valid
if (GUIUtil::parseBitcoinURI(uri, &rv))
{
CBitcoinAddress address(rv.address.toStdString());
if (!address.IsValid())
return false;
pasteEntry(rv);
return true;
}
return false;
}
void SendCoinsDialog::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance)
{
Q_UNUSED(stake);
Q_UNUSED(unconfirmedBalance);
Q_UNUSED(immatureBalance);
if(!model || !model->getOptionsModel())
return;
int unit = model->getOptionsModel()->getDisplayUnit();
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance));
}
void SendCoinsDialog::updateDisplayUnit()
{
if(model && model->getOptionsModel())
{
// Update labelBalance with the current balance and the current unit
ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->getBalance()));
}
}
|
{!!
Form::select(
'routes[]',
$allRoutes,
(isset($routes) ? array_keys($routes) : []),
array(
'class' => 'form-control select2',
'placeholder' => 'Enter Routes',
'multiple' => true
)
)
!!}
|
<?php
namespace Aquatic;
use Aquatic\FedEx\Contract\Address;
use Aquatic\FedEx\Contract\Shipment;
use Aquatic\FedEx\Response\Contract as ResponseContract;
use Aquatic\FedEx\Request\ValidateAddress as <API key>;
use Aquatic\FedEx\Response\ValidateAddress as <API key>;
use Aquatic\FedEx\Request\Shipment\Track as <API key>;
use Aquatic\FedEx\Response\Shipment\Track as <API key>;
use Aquatic\FedEx\Request\Shipment\CustomsAndDuties as <API key>;
use Aquatic\FedEx\Response\Shipment\CustomsAndDuties as <API key>;
// Facade for FedEx requests
class FedEx
{
public static function trackShipment(int $tracking_number): ResponseContract
{
return (new <API key>($tracking_number))
->setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('<API key>'), getenv('FEDEX_METER_NUMBER'))
->send(new <API key>);
}
public static function customsAndDuties(Shipment $shipment, Address $shipper)
{
return (new <API key>($shipment, $shipper))
->setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('<API key>'), getenv('FEDEX_METER_NUMBER'))
->send(new <API key>($shipment->getItems()));
}
public static function validateAddress(Address $address)
{
return (new <API key>($address))
->setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('<API key>'), getenv('FEDEX_METER_NUMBER'))
->send(new <API key>);
}
}
|
@charset "utf-8";
/* CSS Document */
/* Div layer for the entire banner. */
/* Invisible button for background clickthrough. */
/* Your ad styles here */
|
<article class="home_single_post gallery_post_type" typeof="BlogPosting">
{{ partial "post/image_area.html" . }}
<div class="post_content_area">
<div class="row">
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 col-xs-offset-0 col-sm-offset-2 col-md-offset-2 col-lg-offset-2">
<div class="post_list" property="articleBody">
<header><h2><a href="{{ .Permalink }}" property="headline">{{ .Title }}</a></h2></header>
</div>
{{ partial "post/info.html" . }}
</div>
</div>
</div>
</article>
|
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { MultiSelect } from '../../src'
class <API key> extends Component {
constructor(props) {
super(props)
this.state = {
value: []
}
}
handleChange = (event) => {
const { valueKey } = this.props
this.setState({ value: event.value.map((val) => val[valueKey]) })
}
render() {
const { value } = this.state
return <MultiSelect {...this.props} onChange={this.handleChange} value={value} />
}
}
<API key>.propTypes = {
valueKey: PropTypes.string.isRequired
}
export default <API key>
|
#ifndef __OPERATORS_HPP__
#define __OPERATORS_HPP__
template< typename T >
struct EqualComparable
{
friend bool operator!=(const T &a,const T &b) { return !(a == b); }
};
template< typename T >
struct Comparable : public EqualComparable< T >
{
friend bool operator<=(const T &a, const T &b) { return (a < b) || (a == b); }
friend bool operator>(const T &a,const T &b) { return !(a <= b); }
friend bool operator>=(const T &a,const T &b) { return !(a < b); }
};
#endif
|
def main():
pass
if __name__ == "__main__":
main()
|
package com.boyuanitsm.pay.unionpay.config;
public class SDKConstants {
public final static String COLUMN_DEFAULT = "-";
public final static String KEY_DELIMITER = "
/** memeber variable: blank. */
public static final String BLANK = "";
/** member variabel: space. */
public static final String SPACE = " ";
/** memeber variable: unline. */
public static final String UNLINE = "_";
/** memeber varibale: star. */
public static final String STAR = "*";
/** memeber variable: line. */
public static final String LINE = "-";
/** memeber variable: add. */
public static final String ADD = "+";
/** memeber variable: colon. */
public final static String COLON = "|";
/** memeber variable: point. */
public final static String POINT = ".";
/** memeber variable: comma. */
public final static String COMMA = ",";
/** memeber variable: slash. */
public final static String SLASH = "/";
/** memeber variable: div. */
public final static String DIV = "/";
/** memeber variable: left . */
public final static String LB = "(";
/** memeber variable: right. */
public final static String RB = ")";
/** memeber variable: rmb. */
public final static String CUR_RMB = "RMB";
/** memeber variable: .page size */
public static final int PAGE_SIZE = 10;
/** memeber variable: String ONE. */
public static final String ONE = "1";
/** memeber variable: String ZERO. */
public static final String ZERO = "0";
/** memeber variable: number six. */
public static final int NUM_SIX = 6;
/** memeber variable: equal mark. */
public static final String EQUAL = "=";
/** memeber variable: operation ne. */
public static final String NE = "!=";
/** memeber variable: operation le. */
public static final String LE = "<=";
/** memeber variable: operation ge. */
public static final String GE = ">=";
/** memeber variable: operation lt. */
public static final String LT = "<";
/** memeber variable: operation gt. */
public static final String GT = ">";
/** memeber variable: list separator. */
public static final String SEP = "./";
/** memeber variable: Y. */
public static final String Y = "Y";
/** memeber variable: AMPERSAND. */
public static final String AMPERSAND = "&";
/** memeber variable: SQL_LIKE_TAG. */
public static final String SQL_LIKE_TAG = "%";
/** memeber variable: @. */
public static final String MAIL = "@";
/** memeber variable: number zero. */
public static final int NZERO = 0;
public static final String LEFT_BRACE = "{";
public static final String RIGHT_BRACE = "}";
/** memeber variable: string true. */
public static final String TRUE_STRING = "true";
/** memeber variable: string false. */
public static final String FALSE_STRING = "false";
/** memeber variable: forward success. */
public static final String SUCCESS = "success";
/** memeber variable: forward fail. */
public static final String FAIL = "fail";
/** memeber variable: global forward success. */
public static final String GLOBAL_SUCCESS = "$success";
/** memeber variable: global forward fail. */
public static final String GLOBAL_FAIL = "$fail";
public static final String UTF_8_ENCODING = "UTF-8";
public static final String GBK_ENCODING = "GBK";
public static final String CONTENT_TYPE = "Content-type";
public static final String APP_XML_TYPE = "application/xml;charset=utf-8";
public static final String APP_FORM_TYPE = "application/<API key>;charset=";
public static final String param_version = "version";
public static final String param_certId = "certId";
public static final String param_signature = "signature";
public static final String param_encoding = "encoding";
public static final String param_txnType = "txnType";
public static final String param_txnSubType = "txnSubType";
public static final String param_bizType = "bizType";
public static final String param_frontUrl = "frontUrl";
public static final String param_backUrl = "backUrl";
public static final String param_accessType = "accessType";
public static final String param_acqInsCode = "acqInsCode";
public static final String param_merCatCode = "merCatCode";
public static final String param_merType = "merType";
public static final String param_merId = "merId";
public static final String param_merName = "merName";
public static final String param_merAbbr = "merAbbr";
public static final String param_subMerId = "subMerId";
public static final String param_subMerName = "subMerName";
public static final String param_subMerAbbr = "subMerAbbr";
/** Cupsecure . */
public static final String param_csMerId = "csMerId";
public static final String param_orderId = "orderId";
public static final String param_txnTime = "txnTime";
public static final String param_txnSendTime = "txnSendTime";
public static final String <API key> = "<API key>";
public static final String <API key> = "payTimeoutTime";
public static final String <API key> = "defaultPayType";
public static final String param_supPayType = "supPayType";
public static final String param_payType = "payType";
public static final String param_customPayType = "customPayType";
public static final String param_shippingFlag = "shippingFlag";
public static final String <API key> = "shippingCountryCode";
public static final String <API key> = "<API key>";
public static final String <API key> = "shippingCityCode";
public static final String <API key> = "<API key>";
public static final String <API key> = "shippingStreet";
public static final String <API key> = "commodityCategory";
public static final String param_commodityName = "commodityName";
/** URL. */
public static final String param_commodityUrl = "commodityUrl";
public static final String <API key> = "commodityUnitPrice";
public static final String param_commodityQty = "commodityQty";
public static final String param_isPreAuth = "isPreAuth";
public static final String param_currencyCode = "currencyCode";
public static final String param_accType = "accType";
public static final String param_accNo = "accNo";
public static final String param_payCardType = "payCardType";
public static final String param_issInsCode = "issInsCode";
public static final String param_customerInfo = "customerInfo";
public static final String param_txnAmt = "txnAmt";
public static final String param_balance = "balance";
public static final String param_districtCode = "districtCode";
public static final String <API key> = "<API key>";
public static final String param_billType = "billType";
public static final String param_billNo = "billNo";
public static final String param_billMonth = "billMonth";
public static final String param_billQueryInfo = "billQueryInfo";
public static final String <API key> = "billDetailInfo";
public static final String param_billAmt = "billAmt";
public static final String param_billAmtSign = "billAmtSign";
public static final String param_bindId = "bindId";
public static final String param_riskLevel = "riskLevel";
public static final String param_bindInfoQty = "bindInfoQty";
public static final String param_bindInfoList = "bindInfoList";
public static final String param_batchNo = "batchNo";
public static final String param_totalQty = "totalQty";
public static final String param_totalAmt = "totalAmt";
public static final String param_fileType = "fileType";
public static final String param_fileName = "fileName";
public static final String param_fileContent = "fileContent";
public static final String param_merNote = "merNote";
// public static final String param_merReserved = "merReserved";//
public static final String param_reqReserved = "reqReserved";
public static final String param_reserved = "reserved";
public static final String param_termId = "termId";
public static final String param_termType = "termType";
public static final String param_interactMode = "interactMode";
// public static final String <API key> = "recognitionMode";
public static final String <API key> = "issuerIdentifyMode";
public static final String param_merUserId = "merUserId";
public static final String param_customerIp = "customerIp";
public static final String param_queryId = "queryId";
public static final String param_origQryId = "origQryId";
public static final String param_traceNo = "traceNo";
public static final String param_traceTime = "traceTime";
public static final String param_settleDate = "settleDate";
public static final String <API key> = "settleCurrencyCode";
public static final String param_settleAmt = "settleAmt";
public static final String param_exchangeRate = "exchangeRate";
public static final String param_exchangeDate = "exchangeDate";
public static final String param_respTime = "respTime";
public static final String param_origRespCode = "origRespCode";
public static final String param_origRespMsg = "origRespMsg";
public static final String param_respCode = "respCode";
public static final String param_respMsg = "respMsg";
// merUserRegDt merUserEmail checkFlag activateStatus
public static final String param_merUserRegDt = "merUserRegDt";
public static final String param_merUserEmail = "merUserEmail";
public static final String param_checkFlag = "checkFlag";
public static final String <API key> = "activateStatus";
public static final String param_encryptCertId = "encryptCertId";
/** MACIMEISSID. */
public static final String param_userMac = "userMac";
// public static final String <API key> = "relationTxnType";
public static final String param_smsType = "smsType";
public static final String param_riskCtrlInfo = "riskCtrlInfo";
public static final String param_ICTransData = "ICTransData";
/** VPC */
public static final String param_VPCTransData = "VPCTransData";
public static final String param_securityType = "securityType";
public static final String param_tn = "tn";
public static final String param_instalRate = "instalRate";
public static final String <API key> = "mchntFeeSubsidy";
}
|
require 'faraday'
require 'simple_ratings/foursquare/meta/venue'
module SimpleRatings
class Foursquare < Faraday::Connection
def initialize
super(url: 'https://api.foursquare.com/v2/')
end
def default_params
{
client_id: ENV['<API key>'],
client_secret: ENV['<API key>'],
v: 20130214
}
end
def search(params)
get('venues/search', default_params.merge(params))
end
def get(url = nil, params = nil, headers = nil)
params ||= {}
params = default_params.merge(params)
super(url, params, headers)
end
# def get(*args)
# super(*<API key>(*args))
# end
# def <API key>(url = nil, params = nil, headers = nil)
# params ||= {}
# params = default_params.merge(params)
# [url, params, headers]
# end
end
end
|
#ifndef <API key>
#define <API key>
#if defined(_MSC_VER) || defined(__MINGW32__)
#define LL_FMT_FLAGS "I64"
#else
#define LL_FMT_FLAGS "ll"
#endif
// Portability hacks for Microsoft Visual C++ compiler
#ifdef _MSC_VER
#include <stdlib.h>
// Define if you have the vsnprintf variants.
#if _MSC_VER < 1500
# define vsnprintf _vsnprintf
#endif
// Define if you have the snprintf variants.
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
// Define if you have the strtoll and strtoull variants.
#if _MSC_VER < 1300
# error "Visual C++ versions prior 1300 don't support _strtoi64 and _strtoui64"
#elif _MSC_VER >= 1300 && _MSC_VER < 1800
namespace std {
inline long long strtoll(char const* str, char** str_end, int base)
{
return _strtoi64(str, str_end, base);
}
inline unsigned long long strtoull(char const* str, char** str_end, int base)
{
return _strtoui64(str, str_end, base);
}
}
#endif // _MSC_VER < 1800
#endif // _MSC_VER
#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <stdlib.h>
namespace std {
using ::strtoll;
using ::strtoull;
}
#endif
#endif // <API key>
|
using System;
using System.Text;
namespace ExifLibrary
{
<summary>
Represents an enumerated value.
</summary>
public class ExifEnumProperty<T> : ExifProperty
{
protected T mValue;
protected bool mIsBitField;
protected override object _Value { get { return Value; } set { Value = (T)value; } }
public new T Value { get { return mValue; } set { mValue = value; } }
public bool IsBitField { get { return mIsBitField; } }
static public implicit operator T(ExifEnumProperty<T> obj) { return (T)obj.mValue; }
public override string ToString() { return mValue.ToString(); }
public ExifEnumProperty(ExifTag tag, T value, bool isbitfield)
: base(tag)
{
mValue = value;
mIsBitField = isbitfield;
}
public ExifEnumProperty(ExifTag tag, T value)
: this(tag, value, false)
{
;
}
public override <API key> Interoperability
{
get
{
ushort tagid = ExifTagFactory.GetTagID(mTag);
Type type = typeof(T);
Type basetype = Enum.GetUnderlyingType(type);
if (type == typeof(FileSource) || type == typeof(SceneType))
{
// UNDEFINED
return new <API key>(tagid, 7, 1, new byte[] { (byte)((object)mValue) });
}
else if (type == typeof(GPSLatitudeRef) || type == typeof(GPSLongitudeRef) ||
type == typeof(GPSStatus) || type == typeof(GPSMeasureMode) ||
type == typeof(GPSSpeedRef) || type == typeof(GPSDirectionRef) ||
type == typeof(GPSDistanceRef))
{
// ASCII
return new <API key>(tagid, 2, 2, new byte[] { (byte)((object)mValue), 0 });
}
else if (basetype == typeof(byte))
{
// BYTE
return new <API key>(tagid, 1, 1, new byte[] { (byte)((object)mValue) });
}
else if (basetype == typeof(ushort))
{
// SHORT
return new <API key>(tagid, 3, 1, ExifBitConverter.GetBytes((ushort)((object)mValue), BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder));
}
else
throw new <API key>();
}
}
}
<summary>
Represents an ASCII string. (EXIF Specification: UNDEFINED) Used for the UserComment field.
</summary>
public class ExifEncodedString : ExifProperty
{
protected string mValue;
private Encoding mEncoding;
protected override object _Value { get { return Value; } set { Value = (string)value; } }
public new string Value { get { return mValue; } set { mValue = value; } }
public Encoding Encoding { get { return mEncoding; } set { mEncoding = value; } }
static public implicit operator string(ExifEncodedString obj) { return obj.mValue; }
public override string ToString() { return mValue; }
public ExifEncodedString(ExifTag tag, string value, Encoding encoding)
: base(tag)
{
mValue = value;
mEncoding = encoding;
}
public override <API key> Interoperability
{
get
{
string enc = "";
if (mEncoding == null)
enc = "\0\0\0\0\0\0\0\0";
else if (mEncoding.EncodingName == "US-ASCII")
enc = "ASCII\0\0\0";
else if (mEncoding.EncodingName == "Japanese (JIS 0208-1990 and 0212-1990)")
enc = "JIS\0\0\0\0\0";
else if (mEncoding.EncodingName == "Unicode")
enc = "Unicode\0";
else
enc = "\0\0\0\0\0\0\0\0";
byte[] benc = Encoding.ASCII.GetBytes(enc);
byte[] bstr = (mEncoding == null ? Encoding.ASCII.GetBytes(mValue) : mEncoding.GetBytes(mValue));
byte[] data = new byte[benc.Length + bstr.Length];
Array.Copy(benc, 0, data, 0, benc.Length);
Array.Copy(bstr, 0, data, benc.Length, bstr.Length);
return new <API key>(ExifTagFactory.GetTagID(mTag), 7, (uint)data.Length, data);
}
}
}
<summary>
Represents an ASCII string formatted as DateTime. (EXIF Specification: ASCII) Used for the date time fields.
</summary>
public class ExifDateTime : ExifProperty
{
protected DateTime mValue;
protected override object _Value { get { return Value; } set { Value = (DateTime)value; } }
public new DateTime Value { get { return mValue; } set { mValue = value; } }
static public implicit operator DateTime(ExifDateTime obj) { return obj.mValue; }
public override string ToString() { return mValue.ToString("yyyy.MM.dd HH:mm:ss"); }
public ExifDateTime(ExifTag tag, DateTime value)
: base(tag)
{
mValue = value;
}
public override <API key> Interoperability
{
get
{
return new <API key>(ExifTagFactory.GetTagID(mTag), 2, (uint)20, ExifBitConverter.GetBytes(mValue, true));
}
}
}
<summary>
Represents the exif version as a 4 byte ASCII string. (EXIF Specification: UNDEFINED)
Used for the ExifVersion, FlashpixVersion, <API key> and GPSVersionID fields.
</summary>
public class ExifVersion : ExifProperty
{
protected string mValue;
protected override object _Value { get { return Value; } set { Value = (string)value; } }
public new string Value { get { return mValue; } set { mValue = value.Substring(0, 4); } }
public ExifVersion(ExifTag tag, string value)
: base(tag)
{
if (value.Length > 4)
mValue = value.Substring(0, 4);
else if (value.Length < 4)
mValue = value + new string(' ', 4 - value.Length);
else
mValue = value;
}
public override string ToString()
{
return mValue;
}
public override <API key> Interoperability
{
get
{
if (mTag == ExifTag.ExifVersion || mTag == ExifTag.FlashpixVersion || mTag == ExifTag.<API key>)
return new <API key>(ExifTagFactory.GetTagID(mTag), 7, 4, Encoding.ASCII.GetBytes(mValue));
else
{
byte[] data = new byte[4];
for (int i = 0; i < 4; i++)
data[i] = byte.Parse(mValue[0].ToString());
return new <API key>(ExifTagFactory.GetTagID(mTag), 7, 4, data);
}
}
}
}
<summary>
Represents the location and area of the subject (EXIF Specification: 2xSHORT)
The coordinate values, width, and height are expressed in relation to the
upper left as origin, prior to rotation processing as per the Rotation tag.
</summary>
public class <API key> : ExifUShortArray
{
protected new ushort[] Value { get { return mValue; } set { mValue = value; } }
public ushort X { get { return mValue[0]; } set { mValue[0] = value; } }
public ushort Y { get { return mValue[1]; } set { mValue[1] = value; } }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("({0:d}, {1:d})", mValue[0], mValue[1]);
return sb.ToString();
}
public <API key>(ExifTag tag, ushort[] value)
: base(tag, value)
{
;
}
public <API key>(ExifTag tag, ushort x, ushort y)
: base(tag, new ushort[] { x, y })
{
;
}
}
<summary>
Represents the location and area of the subject (EXIF Specification: 3xSHORT)
The coordinate values, width, and height are expressed in relation to the
upper left as origin, prior to rotation processing as per the Rotation tag.
</summary>
public class <API key> : <API key>
{
public ushort Diamater { get { return mValue[2]; } set { mValue[2] = value; } }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("({0:d}, {1:d}) {2:d}", mValue[0], mValue[1], mValue[2]);
return sb.ToString();
}
public <API key>(ExifTag tag, ushort[] value)
: base(tag, value)
{
;
}
public <API key>(ExifTag tag, ushort x, ushort y, ushort d)
: base(tag, new ushort[] { x, y, d })
{
;
}
}
<summary>
Represents the location and area of the subject (EXIF Specification: 4xSHORT)
The coordinate values, width, and height are expressed in relation to the
upper left as origin, prior to rotation processing as per the Rotation tag.
</summary>
public class <API key> : <API key>
{
public ushort Width { get { return mValue[2]; } set { mValue[2] = value; } }
public ushort Height { get { return mValue[3]; } set { mValue[3] = value; } }
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("({0:d}, {1:d}) ({2:d} x {3:d})", mValue[0], mValue[1], mValue[2], mValue[3]);
return sb.ToString();
}
public <API key>(ExifTag tag, ushort[] value)
: base(tag, value)
{
;
}
public <API key>(ExifTag tag, ushort x, ushort y, ushort w, ushort h)
: base(tag, new ushort[] { x, y, w, h })
{
;
}
}
<summary>
Represents GPS latitudes and longitudes (EXIF Specification: 3xRATIONAL)
</summary>
public class <API key> : ExifURationalArray
{
protected new MathEx.UFraction32[] Value { get { return mValue; } set { mValue = value; } }
public MathEx.UFraction32 Degrees { get { return mValue[0]; } set { mValue[0] = value; } }
public MathEx.UFraction32 Minutes { get { return mValue[1]; } set { mValue[1] = value; } }
public MathEx.UFraction32 Seconds { get { return mValue[2]; } set { mValue[2] = value; } }
public static explicit operator float(<API key> obj) { return obj.ToFloat(); }
public float ToFloat()
{
return (float)Degrees + ((float)Minutes) / 60.0f + ((float)Seconds) / 3600.0f;
}
public override string ToString()
{
return string.Format("{0:F2}°{1:F2}'{2:F2}\"", (float)Degrees, (float)Minutes, (float)Seconds);
}
public <API key>(ExifTag tag, MathEx.UFraction32[] value)
: base(tag, value)
{
;
}
public <API key>(ExifTag tag, float d, float m, float s)
: base(tag, new MathEx.UFraction32[] { new MathEx.UFraction32(d), new MathEx.UFraction32(m), new MathEx.UFraction32(s) })
{
;
}
}
<summary>
Represents a GPS time stamp as UTC (EXIF Specification: 3xRATIONAL)
</summary>
public class GPSTimeStamp : ExifURationalArray
{
protected new MathEx.UFraction32[] Value { get { return mValue; } set { mValue = value; } }
public MathEx.UFraction32 Hour { get { return mValue[0]; } set { mValue[0] = value; } }
public MathEx.UFraction32 Minute { get { return mValue[1]; } set { mValue[1] = value; } }
public MathEx.UFraction32 Second { get { return mValue[2]; } set { mValue[2] = value; } }
public override string ToString()
{
return string.Format("{0:F2}:{1:F2}:{2:F2}\"", (float)Hour, (float)Minute, (float)Second);
}
public GPSTimeStamp(ExifTag tag, MathEx.UFraction32[] value)
: base(tag, value)
{
;
}
public GPSTimeStamp(ExifTag tag, float h, float m, float s)
: base(tag, new MathEx.UFraction32[] { new MathEx.UFraction32(h), new MathEx.UFraction32(m), new MathEx.UFraction32(s) })
{
;
}
}
<summary>
Represents an ASCII string. (EXIF Specification: BYTE)
Used by Windows XP.
</summary>
public class WindowsByteString : ExifProperty
{
protected string mValue;
protected override object _Value { get { return Value; } set { Value = (string)value; } }
public new string Value { get { return mValue; } set { mValue = value; } }
static public implicit operator string(WindowsByteString obj) { return obj.mValue; }
public override string ToString() { return mValue; }
public WindowsByteString(ExifTag tag, string value)
: base(tag)
{
mValue = value;
}
public override <API key> Interoperability
{
get
{
byte[] data = Encoding.Unicode.GetBytes(mValue);
return new <API key>(ExifTagFactory.GetTagID(mTag), 1, (uint)data.Length, data);
}
}
}
}
|
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using ShowFinder.Models;
namespace ShowFinder.Repositories.Interfaces
{
public interface IMongoRepository
{
IMongoDatabase Database(string name);
Task<BsonDocument> GetUserProfile(IMongoCollection<BsonDocument> <API key>, string hash);
Task<bool> UpdateShows(IMongoCollection<BsonDocument> <API key>, string userHash, IEnumerable<string> showList);
Task<bool> <API key>(IMongoCollection<BsonDocument> <API key>, string profileId,
string episodeId, string filteredShowName, DownloadedEpisode <API key>);
Task<bool> <API key>(IMongoCollection<BsonDocument> <API key>, string profileId,
string episodeId, string filtereShowdName);
Task<bool> UpdateTimeSpan(IMongoCollection<BsonDocument> <API key>, UserProfile profile);
Task<BsonDocument> GetFromCache(IMongoCollection<BsonDocument> collection, string id);
Task<bool> SetToCache(IMongoCollection<BsonDocument> collection, string id, BsonDocument doc, int daysToExpire);
}
}
|
<!DOCTYPE html PUBLIC "-
<html xmlns="http:
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>/home/pavm/programming/lib/gft/src/gft_stack.cpp File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="<API key>.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#namespaces">Namespaces</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">gft_stack.cpp File Reference</div> </div>
</div><!--header
<div class="contents">
<div class="textblock"><code>#include "<a class="el" href="<API key>.html">gft_stack.h</a>"</code><br/>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:namespacegft"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegft.html">gft</a></td></tr>
<tr class="memdesc:namespacegft"><td class="mdescLeft"> </td><td class="mdescRight">Base namespace for common definitions and prototypes. <br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html">gft::Stack</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">Stack * </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">gft::Stack::Create</a> (int n)</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">gft::Stack::Destroy</a> (Stack **S)</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">gft::Stack::Push</a> (Stack *S, int p)</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:<API key>"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="<API key>.html#<API key>">gft::Stack::Pop</a> (Stack *S)</td></tr>
<tr class="separator:<API key>"><td class="memSeparator" colspan="2"> </td></tr>
</table>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Feb 25 2015 10:27:50 by &
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
|
// BABAudioPlaylist.h
// Pods
#import <Foundation/Foundation.h>
@interface BABAudioPlaylist : NSObject
+ (instancetype)<API key>:(NSArray *)array;
- (instancetype)initWithArray:(NSArray *)array;
- (id)<API key>:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
@property (nonatomic, readonly) NSInteger count;
@end
|
/*!
* Module dependencies.
*/
var util = require('util'),
moment = require('moment'),
super_ = require('../Type');
/**
* Date FieldType Constructor
* @extends Field
* @api public
*/
function datearray(list, path, options) {
this._nativeType = [Date];
this._defaultSize = 'medium';
this._underscoreMethods = ['format'];
this._properties = ['formatString'];
this.parseFormatString = options.parseFormat || 'YYYY-MM-DD';
this.formatString = (options.format === false) ? false : (options.format || 'Do MMM YYYY');
if (this.formatString && 'string' !== typeof this.formatString) {
throw new Error('FieldType.Date: options.format must be a string.');
}
datearray.super_.call(this, list, path, options);
}
/*!
* Inherit from Field
*/
util.inherits(datearray, super_);
/**
* Formats the field value
*
* @api public
*/
datearray.prototype.format = function(item, format) {
if (format || this.formatString) {
return item.get(this.path) ? moment(item.get(this.path)).format(format || this.formatString) : '';
} else {
return item.get(this.path) || '';
}
};
/**
* Checks that a valid array of dates has been provided in a data object
*
* An empty value clears the stored value and is considered valid
*
* @api public
*/
datearray.prototype.inputIsValid = function(data, required, item) {
var value = this.getValueFromData(data);
var parseFormatString = this.parseFormatString;
if ('string' === typeof value) {
if (!moment(value, parseFormatString).isValid()) {
return false;
}
value = [value];
}
if (required) {
if (value === undefined && item && item.get(this.path) && item.get(this.path).length) {
return true;
}
if (value === undefined || !Array.isArray(value)) {
return false;
}
if (Array.isArray(value) && !value.length) {
return false;
}
}
if (Array.isArray(value)) {
// filter out empty fields
value = value.filter(function(date) {
return date.trim() !== '';
});
// if there are no values left, and requried is true, return false
if (required && !value.length) {
return false;
}
// if any date in the array is invalid, return false
if (value.some(function (dateValue) { return !moment(dateValue, parseFormatString).isValid(); })) {
return false;
}
}
return (value === undefined || Array.isArray(value));
};
/**
* Updates the value for this field in the item from a data object
*
* @api public
*/
datearray.prototype.updateItem = function(item, data, callback) {
var value = this.getValueFromData(data);
if (value !== undefined) {
if (Array.isArray(value)) {
// Only save valid dates
value = value.filter(function(date) {
return moment(date).isValid();
});
}
if (value === null) {
value = [];
}
if ('string' === typeof value) {
if (moment(value).isValid()) {
value = [value];
}
}
if (Array.isArray(value)) {
item.set(this.path, value);
}
} else item.set(this.path, []);
process.nextTick(callback);
};
/*!
* Export class
*/
module.exports = datearray;
|
# -*- coding: utf-8 -*-
require "em-websocket"
require "eventmachine-tail"
module Tailer
# Extends FileTail to push data tailed to an EM::Channel. All open websockets
# subscribe to a channel for the request stack and this pushes the data to
# all of them at once.
class StackTail < EventMachine::FileTail
def initialize(filename, channel, startpos=-1)
super(filename, startpos)
@channel = channel
@buffer = BufferedTokenizer.new
end
# This method is called whenever FileTail receives an inotify event for
# the tailed file. It breaks up the data per line and pushes a line at a
# time. This is to prevent the last javascript line from being broken up
# over 2 pushes thus breaking the eval on the front end.
def receive_data(data)
# replace non UTF-8 characters with ?
data.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '')
@buffer.extract(data).each do |line|
@channel.push line
end
end
end
# Checks if stack log symlink exists and creates Tailer for it
def self.stack_tail(stack, channel, channel_count)
if Deployinator.get_visible_stacks.include?(stack)
filename = "#{Deployinator::Helpers::RUN_LOG_PATH}current-#{stack}"
start_pos = (channel_count == 0) ? 0 : -1
File.exists?(filename) ? StackTail.new(filename, channel, start_pos) : false
end
end
end
|
<!DOCTYPE HTML PUBLIC "-
<!--NewPage
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_05) on Thu Jul 03 13:49:54 PDT 2008 -->
<TITLE>
edu.sdsc.inca
</TITLE>
<META NAME="keywords" CONTENT="edu.sdsc.inca package">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<FONT size="+1" CLASS="FrameTitleFont">
<A HREF="../../../edu/sdsc/inca/package-summary.html" target="classFrame">edu.sdsc.inca</A></FONT>
<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
<TR>
<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
Classes</FONT>
<FONT CLASS="FrameItemFont">
<BR>
<A HREF="Consumer.html" title="class in edu.sdsc.inca" target="classFrame">Consumer</A>
<BR>
<A HREF="ConsumerTest.html" title="class in edu.sdsc.inca" target="classFrame">ConsumerTest</A>
<BR>
<A HREF="ConsumerTest.ConsumerTester.html" title="class in edu.sdsc.inca" target="classFrame">ConsumerTest.ConsumerTester</A>
<BR>
<A HREF="ConsumerTest.MockAgent.html" title="class in edu.sdsc.inca" target="classFrame">ConsumerTest.MockAgent</A>
<BR>
<A HREF="ConsumerTest.MockDepot.html" title="class in edu.sdsc.inca" target="classFrame">ConsumerTest.MockDepot</A></FONT></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|
namespace DotNetty.Transport.Channels.Sockets
{
using System;
using System.Diagnostics.Contracts;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
public class <API key> : <API key>, <API key>
{
const int <API key> = 2048;
readonly Socket socket;
public <API key>(IDatagramChannel channel, Socket socket)
: base(channel, new <API key>(<API key>))
{
Contract.Requires(socket != null);
this.socket = socket;
}
public override T GetOption<T>(ChannelOption<T> option)
{
if (ChannelOption.SoBroadcast.Equals(option))
{
return (T)(object)this.Broadcast;
}
if (ChannelOption.SoRcvbuf.Equals(option))
{
return (T)(object)this.ReceiveBufferSize;
}
if (ChannelOption.SoSndbuf.Equals(option))
{
return (T)(object)this.SendBufferSize;
}
if (ChannelOption.SoReuseaddr.Equals(option))
{
return (T)(object)this.ReuseAddress;
}
if (ChannelOption.<API key>.Equals(option))
{
return (T)(object)this.<API key>;
}
if (ChannelOption.IpMulticastTtl.Equals(option))
{
return (T)(object)this.TimeToLive;
}
if (ChannelOption.IpMulticastAddr.Equals(option))
{
return (T)(object)this.Interface;
}
if (ChannelOption.IpMulticastIf.Equals(option))
{
return (T)(object)this.NetworkInterface;
}
if (ChannelOption.IpTos.Equals(option))
{
return (T)(object)this.TrafficClass;
}
return base.GetOption(option);
}
public override bool SetOption<T>(ChannelOption<T> option, T value)
{
if (base.SetOption(option, value))
{
return true;
}
if (ChannelOption.SoBroadcast.Equals(option))
{
this.Broadcast = (bool)(object)value;
}
else if (ChannelOption.SoRcvbuf.Equals(option))
{
this.ReceiveBufferSize = (int)(object)value;
}
else if (ChannelOption.SoSndbuf.Equals(option))
{
this.SendBufferSize = (int)(object)value;
}
else if (ChannelOption.SoReuseaddr.Equals(option))
{
this.ReuseAddress = (bool)(object)value;
}
else if (ChannelOption.<API key>.Equals(option))
{
this.<API key> = (bool)(object)value;
}
else if (ChannelOption.IpMulticastTtl.Equals(option))
{
this.TimeToLive = (short)(object)value;
}
else if (ChannelOption.IpMulticastAddr.Equals(option))
{
this.Interface = (EndPoint)(object)value;
}
else if (ChannelOption.IpMulticastIf.Equals(option))
{
this.NetworkInterface = (NetworkInterface)(object)value;
}
else if (ChannelOption.IpTos.Equals(option))
{
this.TrafficClass = (int)(object)value;
}
else
{
return false;
}
return true;
}
public int SendBufferSize
{
get
{
try
{
return this.socket.SendBufferSize;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.SendBufferSize = value;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public int ReceiveBufferSize
{
get
{
try
{
return this.socket.ReceiveBufferSize;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.ReceiveBufferSize = value;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public int TrafficClass
{
get
{
try
{
return (int)this.socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.TypeOfService);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.TypeOfService, value);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public bool ReuseAddress
{
get
{
try
{
return (int)this.socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress) != 0;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, value ? 1 : 0);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public bool Broadcast
{
get
{
try
{
return this.socket.EnableBroadcast;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.EnableBroadcast = value;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public bool <API key>
{
get
{
try
{
return !this.socket.MulticastLoopback;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.MulticastLoopback = !value;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public short TimeToLive
{
get
{
try
{
return (short)this.socket.GetSocketOption(
this.<API key>,
SocketOptionName.MulticastTimeToLive);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
try
{
this.socket.SetSocketOption(
this.<API key>,
SocketOptionName.MulticastTimeToLive,
value);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public EndPoint Interface
{
get
{
try
{
return this.socket.LocalEndPoint;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
Contract.Requires(value != null);
try
{
this.socket.Bind(value);
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
public NetworkInterface NetworkInterface
{
get
{
try
{
NetworkInterface[] interfaces = NetworkInterface.<API key>();
int value = (int)this.socket.GetSocketOption(
this.<API key>,
SocketOptionName.MulticastInterface);
int index = IPAddress.NetworkToHostOrder(value);
if (interfaces.Length > 0
&& index >= 0
&& index < interfaces.Length)
{
return interfaces[index];
}
return null;
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
set
{
Contract.Requires(value != null);
try
{
int index = this.<API key>(value);
if (index >= 0)
{
this.socket.SetSocketOption(
this.<API key>,
SocketOptionName.MulticastInterface,
index);
}
}
catch (<API key> ex)
{
throw new ChannelException(ex);
}
catch (SocketException ex)
{
throw new ChannelException(ex);
}
}
}
internal SocketOptionLevel <API key>
{
get
{
if (this.socket.AddressFamily == AddressFamily.InterNetwork)
{
return SocketOptionLevel.IP;
}
if (this.socket.AddressFamily == AddressFamily.InterNetworkV6)
{
return SocketOptionLevel.IPv6;
}
throw new <API key>($"Socket address family {this.socket.AddressFamily} not supported, expecting InterNetwork or InterNetworkV6");
}
}
internal int <API key>(NetworkInterface networkInterface)
{
Contract.Requires(networkInterface != null);
NetworkInterface[] interfaces = NetworkInterface.<API key>();
for (int index = 0; index < interfaces.Length; index++)
{
if (interfaces[index].Id == networkInterface.Id)
{
return index;
}
}
return -1;
}
}
}
|
#include "Search.h"
static int NextState(int m, char* pattern, int state, int symbol) {
if (state < m && pattern[state] == symbol) {
return state + 1;
}
for (int next = state, prev = next - 1, i = 0; next > 0; next
if (pattern[prev] == symbol) {
for (i = 0; i < prev; i++) {
if (pattern[i] != pattern[state - next + 1 + i]) {
break;
}
}
if (i == prev) {
return next;
}
}
}
return 0;
}
static void GenerateTable(int m, char* pattern, int Table[m][CHAR_MAX]) {
for (int state = 0, symbol = 0; symbol < CHAR_MAX || (symbol = 0, ++state) < m; symbol++) {
Table[state][symbol] = NextState(m, pattern, state, symbol);
}
}
int Search(int n, char* haystack, int m, char* needle) {
int Table[m + 1][CHAR_MAX], state = 0;
GenerateTable(m + 1, needle, Table);
for (int i = 0; i < n; i++) {
state = Table[state][haystack[i]];
if (state == m) {
return (i - m + 1);
}
}
return -1;
}
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
class Video
include Claire::Client::Item
end
describe Claire::Client::Item do
#@session.should_receive(:post).with("url", "data", "headers")
#@session = mock("session")
before do
Claire::Client.stub(:get).with('videos/id').and_return xml :item
@video = Video.new(hash_from_xml(:item))
end
describe "its initializer" do
describe "its base_url class attribute" do
it "should default to the class name, pluralized" do
Video.base_url.should == "videos"
end
it "should accept manual overwrite on the class" do
Video.base_url = "lists"
Video.base_url.should == "lists"
Video.base_url = nil
Video.base_url.should == "videos"
end
it "if the class is in a module, it should get the class name only" do
eval %(
module Testing
class Video
include Claire::Client::Item
end
end
)
Testing::Video.base_url.should == "videos"
end
end
context "upon receiving a Hash" do
before :each do
@video = Video.new(hash_from_xml(:item))
end
it "should set partial do true" do
@video.should be_partial
end
it "should skip the <rss> container if it is present" do
@video.title.should be_a_kind_of String
@video.should_not respond_to :rss
end
it "should skip the <channel> container if its present" do
video = Video.new(hash_from_xml(:item_with_channel))
video.title.should be_a_kind_of String
video.should_not respond_to :channel
end
it "should never set 'items' attributes " do
%w(item item_with_channel).each do |type|
video = Video.new(hash_from_xml(type))
video.should_not respond_to :item
video.title.should be_a_kind_of String
end
end
it "should set the link attribute properly (eg ignoring links to other objects/pages)" do
video = Video.new hash_from_xml :item_with_channel
video.link.should be_a_kind_of String
end
it "should set its key/values as properties of the element" do
%w(title link category keywords description).each do |item|
@video.send(item).should be_a_kind_of String
end
%w(thumbnail content).each{ |item| @video.send(item).should be_a_kind_of Array }
end
it "should fail if there is not a link attribute" do
lambda { Video.new( {:rss => {:item => {:name => 'bla'}}} ) }.should raise_error Claire::Error
end
end
context "upon receiving a String" do
before { @video = Video.new 'id' }
it "should open the given string" do
lambda { Video.new "" }.should raise_error
lambda { Video.new "id" }.should_not raise_error
end
it "should parse the result using the XML parsing rules" do
@video.title.should be_a_kind_of String
end
it "should set partial to false" do
@video.should_not be_partial
end
end
end
describe "its comparison (spaceship) operator" do
it "should be defined" do
@video.should respond_to '<=>'
end
it "should compare items by title" do
@video2 = @video.clone
(@video <=> @video2).should be 0
end
end
context "when an undefined method is called" do
it "it should raise error if partial is false"
context "if the item is partial" do
it "should request the full object from server, and replace itself"
it "should return the asked attribute"
end
end
it "should have a list of its children as the children class attribute" do
Claire::Client::Item.children.include?(Video).should be true
end
end
|
<?php
namespace Zanson\SMParser\Traits\Song;
use Zanson\SMParser\SMException;
trait Banner
{
public $banner = '';
/**
* @return string
*/
public function getBanner() {
return $this->banner;
}
/**
* @param string $banner
*
* @return $this
* @throws SMException
*/
public function setBanner($banner) {
if (!is_string($banner)) {
throw new SMException("Banner must be a string");
}
$this->banner = $banner;
return $this;
}
}
|
if ( !window.console ) window.console = { log:function(){} };
jQuery(document).ready(function($) {
console.log('Keep being awesome.');
});
|
package parser
import (
"monkey/ast"
"monkey/token"
)
func (p *Parser) <API key>() ast.Expression {
return &ast.StringLiteral{Token: p.curToken, Value: p.curToken.Literal}
}
func (p *Parser) <API key>() ast.Expression {
is := &ast.InterpolatedString{Token: p.curToken, Value: p.curToken.Literal, ExprMap: make(map[byte]ast.Expression)}
key := "0"[0]
for {
if p.curTokenIs(token.LBRACE) {
p.nextToken()
expr := p.parseExpression(LOWEST)
is.ExprMap[key] = expr
key++
}
p.nextInterpToken()
if p.curTokenIs(token.ISTRING) {
break
}
}
return is
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;
using System.Diagnostics;
namespace ForumHelper
{
public partial class ToastForm : Form
{
public ToastForm()
{
InitializeComponent();
TopMost = true;
ShowInTaskbar = false;
timer = new System.Windows.Forms.Timer();
timer.Interval = 500;
timer.Tick += timer_Tick;
}
private System.Windows.Forms.Timer timer;
private int startPosX;
private int startPosY;
private void ToastForm_Load(object sender, EventArgs e)
{
}
protected override void OnLoad(EventArgs e)
{
startPosX = Screen.PrimaryScreen.WorkingArea.Width - Width;
startPosY = Screen.PrimaryScreen.WorkingArea.Height - Height;
SetDesktopLocation(startPosX, startPosY);
pageLinkLabel.Text = URLEventArgs.Url;
// base.OnLoad(e);
timer.Start();
}
void timer_Tick(object sender, EventArgs e)
{
startPosY -= 50;
if (startPosY < Screen.PrimaryScreen.WorkingArea.Height - Height) timer.Stop();
else
{
SetDesktopLocation(startPosX, startPosY);
timer.Stop();
}
}
private void ToastForm_Click(object sender, EventArgs e)
{
this.Close();
}
private void pageLinkLabelClick(object sender, EventArgs e)
{
Process.Start(this.pageLinkLabel.Text);
this.Close();
}
}
}
|
<?php
use Base64Url\Base64Url;
use Jose\Decrypter;
use Jose\Encrypter;
use Jose\Factory\JWEFactory;
use Jose\Loader;
use Jose\Object\JWEInterface;
use Jose\Object\JWK;
use Jose\Object\JWKSet;
use Jose\Test\Stub\FakeLogger;
use Jose\Test\BaseTestCase;
/**
* Class EncrypterTest.
*
* @group Encrypter
* @group Functional
*/
class EncrypterBaseTest extends BaseTestCase
{
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
'FOO',
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>($this->getRSARecipientKey());
$encrypter->encrypt($jwe);
$encrypted = $jwe->toFlattenedJSON(0);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($encrypted);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('RSA-OAEP-256', $loaded-><API key>('alg'));
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertEquals('DEF', $loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertEquals('FOO', $loaded->getPayload());
}
public function <API key>()
{
$jwe = JWEFactory::<API key>(
'FOO',
$this->getRSARecipientKey(),
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
]
);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('RSA-OAEP-256', $loaded-><API key>('alg'));
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertEquals('DEF', $loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertEquals('FOO', $loaded->getPayload());
}
public function <API key>()
{
$jwe = JWEFactory::<API key>(
'FOO',
$this->getRSARecipientKey(),
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
],
[
'foo' => 'bar',
],
[
'plic' => 'ploc',
],
'A,B,C,D'
);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('RSA-OAEP-256', $loaded-><API key>('alg'));
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertEquals('DEF', $loaded-><API key>('zip'));
self::assertEquals('bar', $loaded->getSharedHeader('foo'));
self::assertEquals('A,B,C,D', $loaded->getAAD('foo'));
self::assertEquals('ploc', $loaded->getRecipient(0)->getHeader('plic'));
self::assertNull($loaded->getPayload());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertEquals('FOO', $loaded->getPayload());
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
$this->getKeyToEncrypt(),
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>($this->getRSARecipientKey());
$encrypter->encrypt($jwe);
$encrypted = $jwe->toFlattenedJSON(0);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($encrypted);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('RSA-OAEP-256', $loaded-><API key>('alg'));
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertEquals('DEF', $loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_array($loaded->getPayload()));
self::assertEquals($this->getKeyToEncrypt(), new JWK($loaded->getPayload()));
}
/**
* @expectedException \<API key>
* @<API key> Compression method "FIP" not supported
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
$this->getKeyToEncrypt(),
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'FIP',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>($this->getRSARecipientKey());
$encrypter->encrypt($jwe);
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP', 'RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE('Live long and Prosper.');
$jwe = $jwe-><API key>([
'enc' => 'A256CBC-HS512',
]);
$jwe = $jwe-><API key>($this-><API key>(), ['alg' => 'RSA-OAEP']);
$jwe = $jwe-><API key>($this->getRSARecipientKey(), ['alg' => 'RSA-OAEP-256']);
$encrypter->encrypt($jwe);
self::assertEquals(2, $jwe->countRecipients());
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE('Live long and Prosper.');
$jwe = $jwe-><API key>([
'enc' => 'A256CBC-HS512',
]);
$jwe = $jwe-><API key>(
$this-><API key>(),
['kid' => '<API key>', 'alg' => 'ECDH-ES+A256KW']
);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey(),
['kid' => '123456789', 'alg' => 'RSA-OAEP-256']
);
$encrypter->encrypt($jwe);
self::assertEquals(2, $jwe->countRecipients());
}
/**
* @expectedException \<API key>
* @<API key> Foreign key management mode forbidden.
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['dir', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE('Live long and Prosper.');
$jwe = $jwe-><API key>([
'enc' => 'A256CBC-HS512',
]);
$jwe = $jwe-><API key>(
$this-><API key>(),
['kid' => '<API key>', 'alg' => 'ECDH-ES+A256KW']
);
$jwe = $jwe-><API key>(
$this->getDirectKey(),
['kid' => 'DIR_1', 'alg' => 'dir']
);
$encrypter->encrypt($jwe);
}
/**
* @expectedException \<API key>
* @<API key> Key cannot be used to encrypt
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
'Foo',
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>(
$this->getSigningKey()
);
$encrypter->encrypt($jwe);
}
/**
* @expectedException \<API key>
* @<API key> Key is only allowed for algorithm "RSA-OAEP".
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
'FOO',
[
'enc' => 'A256CBC-HS512',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>(
$this-><API key>()
);
$encrypter->encrypt($jwe);
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A128CBC-HS256'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A128CBC-HS256'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeySetToEncrypt());
$jwe = $jwe-><API key>([
'kid' => '123456789',
'enc' => 'A128CBC-HS256',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
]);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey()
);
$encrypter->encrypt($jwe);
$encrypted = $jwe->toCompactJSON(0);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($encrypted);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('RSA-OAEP-256', $loaded-><API key>('alg'));
self::assertEquals('A128CBC-HS256', $loaded-><API key>('enc'));
self::assertEquals('DEF', $loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_array($loaded->getPayload()));
self::assertEquals($this->getKeySetToEncrypt(), new JWKSet($loaded->getPayload()));
}
/**
* @expectedException \<API key>
* @<API key> Parameter "alg" is missing.
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['A256CBC-HS512'], [], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeyToEncrypt());
$jwe = $jwe-><API key>([
'kid' => '123456789',
'enc' => 'A256CBC-HS512',
'zip' => 'DEF',
]);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey()
);
$encrypter->encrypt($jwe);
}
/**
* @expectedException \<API key>
* @<API key> Parameter "enc" is missing.
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], [], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeyToEncrypt());
$jwe = $jwe-><API key>([
'kid' => '123456789',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
]);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey()
);
$encrypter->encrypt($jwe);
}
/**
* @expectedException \<API key>
* @<API key> The key encryption algorithm "A256CBC-HS512" is not supported or not a key encryption algorithm instance.
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['A256CBC-HS512'], [], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeyToEncrypt());
$jwe = $jwe-><API key>([
'kid' => '123456789',
'enc' => 'A256CBC-HS512',
'alg' => 'A256CBC-HS512',
'zip' => 'DEF',
]);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey()
);
$encrypter->encrypt($jwe);
}
/**
* @expectedException \<API key>
* @<API key> The content encryption algorithm "RSA-OAEP-256" is not supported or not a content encryption algorithm instance.
*/
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], [], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeyToEncrypt());
$jwe = $jwe-><API key>([
'kid' => '123456789',
'enc' => 'RSA-OAEP-256',
'alg' => 'RSA-OAEP-256',
'zip' => 'DEF',
]);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey()
);
$encrypter->encrypt($jwe);
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['dir'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['dir'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE($this->getKeyToEncrypt());
$jwe = $jwe-><API key>([
'kid' => 'DIR_1',
'enc' => 'A192CBC-HS384',
'alg' => 'dir',
]);
$jwe = $jwe-><API key>(
$this->getDirectKey()
);
$encrypter->encrypt($jwe);
$encrypted = $jwe->toFlattenedJSON(0);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($encrypted);
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('dir', $loaded-><API key>('alg'));
self::assertEquals('A192CBC-HS384', $loaded-><API key>('enc'));
self::assertFalse($loaded->hasSharedHeader('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getSymmetricKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_array($loaded->getPayload()));
self::assertEquals($this->getKeyToEncrypt(), new JWK($loaded->getPayload()));
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['ECDH-ES'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['ECDH-ES'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(['user_id' => '1234', 'exp' => time() + 3600]);
$jwe = $jwe-><API key>([
'kid' => '<API key>',
'enc' => 'A192CBC-HS384',
'alg' => 'ECDH-ES',
]);
$jwe = $jwe-><API key>(
$this-><API key>()
);
$encrypter->encrypt($jwe);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe->toFlattenedJSON(0));
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('ECDH-ES', $loaded-><API key>('alg'));
self::assertEquals('A192CBC-HS384', $loaded-><API key>('enc'));
self::assertFalse($loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue($loaded->hasClaims());
self::assertTrue($loaded->hasClaim('user_id'));
self::assertEquals('1234', $loaded->getClaim('user_id'));
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE('Live long and Prosper.');
$jwe = $jwe-><API key>([
'kid' => '<API key>',
'enc' => 'A256CBC-HS512',
'alg' => 'ECDH-ES+A256KW',
]);
$jwe = $jwe-><API key>(
$this-><API key>()
);
$encrypter->encrypt($jwe);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe->toFlattenedJSON(0));
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('ECDH-ES+A256KW', $loaded-><API key>('alg'));
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertFalse($loaded-><API key>('zip'));
self::assertFalse($loaded->hasSharedHeader('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_string($loaded->getPayload()));
self::assertEquals('Live long and Prosper.', $loaded->getPayload());
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['ECDH-ES+A256KW'], ['A256GCM'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE(
'Live long and Prosper.',
[
'kid' => '<API key>',
'enc' => 'A256GCM',
'alg' => 'ECDH-ES+A256KW',
],
[],
'foo,bar,baz'
);
$jwe = $jwe-><API key>(
$this-><API key>()
);
$encrypter->encrypt($jwe);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe->toFlattenedJSON(0));
$decrypter = Decrypter::createDecrypter(['A256GCM'], ['ECDH-ES+A256KW'], ['DEF'], new FakeLogger());
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('ECDH-ES+A256KW', $loaded-><API key>('alg'));
self::assertEquals('A256GCM', $loaded-><API key>('enc'));
self::assertFalse($loaded-><API key>('zip'));
self::assertFalse($loaded->hasSharedHeader('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_string($loaded->getPayload()));
self::assertEquals('Live long and Prosper.', $loaded->getPayload());
}
public function <API key>()
{
$encrypter = Encrypter::createEncrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$decrypter = Decrypter::createDecrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());
$jwe = JWEFactory::createJWE('Live long and Prosper.');
$jwe = $jwe-><API key>(['enc' => 'A256CBC-HS512']);
$jwe = $jwe-><API key>(
$this-><API key>(),
['kid' => '<API key>', 'alg' => 'ECDH-ES+A256KW']
);
$jwe = $jwe-><API key>(
$this->getRSARecipientKey(),
['kid' => '123456789', 'alg' => 'RSA-OAEP-256']
);
$encrypter->encrypt($jwe);
$loader = new Loader(new FakeLogger());
$loaded = $loader->load($jwe->toJSON());
self::assertEquals(2, $loaded->countRecipients());
self::assertInstanceOf(JWEInterface::class, $loaded);
self::assertEquals('A256CBC-HS512', $loaded-><API key>('enc'));
self::assertEquals('ECDH-ES+A256KW', $loaded->getRecipient(0)->getHeader('alg'));
self::assertEquals('RSA-OAEP-256', $loaded->getRecipient(1)->getHeader('alg'));
self::assertFalse($loaded->hasSharedHeader('zip'));
self::assertFalse($loaded-><API key>('zip'));
self::assertNull($loaded->getPayload());
$decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);
self::assertEquals(0, $index);
self::assertTrue(is_string($loaded->getPayload()));
self::assertEquals('Live long and Prosper.', $loaded->getPayload());
}
/**
* @return JWK
*/
private function getKeyToEncrypt()
{
$key = new JWK([
'kty' => 'EC',
'use' => 'enc',
'crv' => 'P-256',
'x' => '<API key>',
'y' => '<API key>',
'd' => '<API key>',
]);
return $key;
}
/**
* @return JWKSet
*/
private function getKeySetToEncrypt()
{
$key = new JWK([
'kty' => 'EC',
'use' => 'enc',
'crv' => 'P-256',
'x' => '<API key>',
'y' => '<API key>',
'd' => '<API key>',
]);
$key_set = new JWKSet();
$key_set->addKey($key);
return $key_set;
}
/**
* @return JWK
*/
private function getRSARecipientKey()
{
$key = new JWK([
'kty' => 'RSA',
'use' => 'enc',
'n' => 'tpS1ZmfVKVP5KofIhMBP0tSWc4qlh6fm2lrZSkuKxUjEaWjzZSzs72gEIGxraWusMdoRuV54xsWRyf5KeZT0S<API key><API key>hvGti5Jt2DMnH1JjoXdDXfxvSP_0gjUYb0ektudYFXoA6wekmQyJeImvgx4Myz1I4iHtkY_Cp7J4Mn1ejZ6HNmyvoTE_4OuY1uCeYv4UyXFc1s1uUyYtj4z57qsHGsS4dQ3A2MJsw',
'e' => 'AQAB',
]);
return $key;
}
/**
* @return JWK
*/
private function <API key>()
{
$key = new JWK([
'kty' => 'RSA',
'use' => 'enc',
'alg' => 'RSA-OAEP',
'n' => 'tpS1ZmfVKVP5KofIhMBP0tSWc4qlh6fm2lrZSkuKxUjEaWjzZSzs72gEIGxraWusMdoRuV54xsWRyf5KeZT0S<API key><API key>hvGti5Jt2DMnH1JjoXdDXfxvSP_0gjUYb0ektudYFXoA6wekmQyJeImvgx4Myz1I4iHtkY_Cp7J4Mn1ejZ6HNmyvoTE_4OuY1uCeYv4UyXFc1s1uUyYtj4z57qsHGsS4dQ3A2MJsw',
'e' => 'AQAB',
]);
return $key;
}
/**
* @return JWK
*/
private function getSigningKey()
{
$key = new JWK([
'kty' => 'EC',
'key_ops' => ['sign', 'verify'],
'crv' => 'P-256',
'x' => '<API key>',
'y' => '<API key>',
'd' => '<API key>',
]);
return $key;
}
/**
* @return JWK
*/
private function <API key>()
{
$key = new JWK([
'kty' => 'EC',
'key_ops' => ['encrypt', 'decrypt'],
'crv' => 'P-256',
'x' => '<API key>',
'y' => '<API key>',
]);
return $key;
}
/**
* @return JWK
*/
private function getDirectKey()
{
$key = new JWK([
'kid' => 'DIR_1',
'key_ops' => ['encrypt', 'decrypt'],
'kty' => 'oct',
'k' => Base64Url::encode(hex2bin('<API key>')),
]);
return $key;
}
}
|
using UnrealBuildTool;
using System.Collections.Generic;
public class UnrealCamDemoTarget : TargetRules
{
public UnrealCamDemoTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.AddRange( new string[] { "UnrealCamDemo" } );
}
}
|
package br.com.gamemods.tutorial.ctf;
import org.bukkit.plugin.java.JavaPlugin;
public class CTFGameMods extends JavaPlugin
{
}
|
#include <stdio.h>
#include <stdlib.h>
typedef int ElemType;
void swap(ElemType *left,ElemType *right){
ElemType temp = *left;
*left = *right;
*right = temp;
}
void BubbleSort(ElemType *array,int num){
if(num == 1) return;
ElemType *left = array,*right = array + 1;
int key = num;
while(--key){
if(*left > *right)
swap(left,right);
left++;
right++;
}
BubbleSort(array,--num);
}
int main(){
int a[14];
int *b=a;
int num = 14;
srand((unsigned)time(NULL));
while (num--) *b++ = rand()%10;
b=a;
num=14;
while(num
printf("%d ",*b++ );
}
printf("\n");
BubbleSort(a,14);
num = 14;
b=a;
while(num
printf("%d ",*b++ );
}
printf("\n");
return 0;
}
|
/**
* Keyframes.
*/
@-webkit-keyframes rotation {
0% {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes rotation {
0% {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@-webkit-keyframes rotation-reverse {
0% {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-webkit-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
@keyframes rotation-reverse {
0% {
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-moz-transform: rotate(-360deg);
-ms-transform: rotate(-360deg);
-webkit-transform: rotate(-360deg);
transform: rotate(-360deg);
}
}
body {
background-color: #000;
}
#sun {
background-color: #aa0;
height: 50px;
left: calc(50% - 25px);
position: absolute;
top: calc(50% - 25px);
width: 50px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: 0 0 10px 2px #aa5500;
-webkit-box-shadow: 0 0 10px 2px #aa5500;
box-shadow: 0 0 10px 2px #aa5500;
}
#mercury-orbit {
-webkit-animation: rotation 8s linear infinite;
animation: rotation 8s linear infinite;
height: 10%;
left: 45%;
position: absolute;
top: 45%;
width: 10%;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
}
#mercury {
background: #953;
height: 10px;
width: 10px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 5px 1px #222222;
-webkit-box-shadow: inset 0 0 5px 1px #222222;
box-shadow: inset 0 0 5px 1px #222222;
}
#venus-orbit {
-webkit-animation: rotation-reverse 16s linear infinite;
animation: rotation-reverse 16s linear infinite;
height: 14%;
left: 43%;
position: absolute;
top: 43%;
width: 14%;
}
#venus {
background: #db5;
height: 15px;
width: 15px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: 0 0 3px 0 #ffff88;
-webkit-box-shadow: 0 0 3px 0 #ffff88;
box-shadow: 0 0 3px 0 #ffff88;
}
#earth-orbit {
-webkit-animation: rotation 24s linear infinite;
animation: rotation 24s linear infinite;
height: 20%;
left: 40%;
position: absolute;
top: 40%;
width: 20%;
}
#earth {
background-color: #0bf;
height: 20px;
width: 20px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: 0 0 8px 1px white;
-webkit-box-shadow: 0 0 8px 1px white;
box-shadow: 0 0 8px 1px white;
}
#mars-orbit {
-webkit-animation: rotation 44s linear infinite;
animation: rotation 44s linear infinite;
height: 30%;
left: 35%;
position: absolute;
top: 35%;
width: 30%;
}
#mars {
background-color: #833;
height: 18px;
width: 18px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 5px #220000;
-webkit-box-shadow: inset 0 0 5px #220000;
box-shadow: inset 0 0 5px #220000;
}
#jupiter-orbit {
-webkit-animation: rotation 68s linear infinite;
animation: rotation 68s linear infinite;
height: 40%;
left: 30%;
position: absolute;
top: 30%;
width: 40%;
}
#jupiter {
background-color: #ffa500;
height: 40px;
width: 40px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 10px 1px black;
-webkit-box-shadow: inset 0 0 10px 1px black;
box-shadow: inset 0 0 10px 1px black;
}
#jupiter-spot {
background-color: rgba(160, 0, 0, 0.5);
height: 8px;
left: 20px;
position: absolute;
top: 19px;
width: 8px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: 0 0 5px 0 #990000;
-webkit-box-shadow: 0 0 5px 0 #990000;
box-shadow: 0 0 5px 0 #990000;
}
#saturn-orbit {
-webkit-animation: rotation 80s linear infinite;
animation: rotation 80s linear infinite;
height: 48%;
left: 26%;
position: absolute;
top: 26%;
width: 48%;
}
#saturn {
background-color: #ab5;
height: 36px;
width: 36px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 5px #445511;
-webkit-box-shadow: inset 0 0 5px #445511;
box-shadow: inset 0 0 5px #445511;
}
#uranus-orbit {
-webkit-animation: rotation 100s linear infinite;
animation: rotation 100s linear infinite;
height: 60%;
left: 20%;
position: absolute;
top: 20%;
width: 60%;
}
#uranus {
background-color: #3da;
height: 30px;
width: 30px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 5px #445511;
-webkit-box-shadow: inset 0 0 5px #445511;
box-shadow: inset 0 0 5px #445511;
}
#neptune-orbit {
-webkit-animation: rotation 120s linear infinite;
animation: rotation 120s linear infinite;
height: 70%;
left: 15%;
position: absolute;
top: 15%;
width: 70%;
}
#neptune {
background-color: #05a;
height: 32px;
width: 32px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 10px 1px black;
-webkit-box-shadow: inset 0 0 10px 1px black;
box-shadow: inset 0 0 10px 1px black;
}
#pluto-orbit {
-webkit-animation: rotation 120s linear infinite;
animation: rotation 120s linear infinite;
height: 70%;
left: 15%;
position: absolute;
top: 15%;
width: 70%;
}
#pluto {
background-color: #7a7474;
height: 10px;
width: 10px;
-moz-border-radius: 50%;
-<API key>: 50%;
border-radius: 50%;
-moz-box-shadow: inset 0 0 10px 1px black;
-webkit-box-shadow: inset 0 0 10px 1px black;
box-shadow: inset 0 0 10px 1px black;
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>18 --> 19</title>
<link href="./../../assets/style.css" rel="stylesheet">
</head>
<body>
<h2>You have to be fast</h2>
<a href="./<SHA256-like>.html">Teleport</a>
<hr>
<a href="./../../about.md">About</a> (Spoilers! )
<script src="./../../assets/md5.js"></script>
<script>
window.currentLevel = 7;
</script>
<script src="./../../assets/script.js"></script>
</body>
</html>
|
//{{{ include files
#include <stdio.h>
#include <sys/socket.h>
#include <sys/wait.h> // waitpid()
#include <stdlib.h> // exit();
#include <string.h> // bzero();
#include <netinet/in.h> // struct sockaddr_in;
#include <time.h> // time();
#include <arpa/inet.h> // inet_pton();
#include <unistd.h> // write();
#include <errno.h> // errno
#include <signal.h> // SIGCHLD
#define MAXLINE 4096 /* max text line length */
#define LISTENQ 1024 /* 2nd argument to listen() , */
#define LISTEN_PORT 9669
//: socket.
//: echosocket;
//, socket.
void str_echo(int sockfd);
void sig_child(int signo);
int main(int argc, char **argv)
{
int listenfd, connfd;
struct sockaddr_in server_addr, client_addr;
socklen_t addr_len;
char buffer[MAXLINE];
pid_t child_pid;
listenfd = socket(AF_INET, SOCK_STREAM, 0);
bzero(&server_addr, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
server_addr.sin_port = htons(LISTEN_PORT);
// int bind(int sockfd, struct sockaddr * my_addr, int addrlen);
// bind()sockfd socket .
// my_addr sockaddr , socket domain
bind(listenfd, (struct sockaddr *) &server_addr, sizeof(server_addr));
// int listen(int s, int backlog);
// listen()s socket.
// backlog , client ECONNREFUSED .
// listen(), socket listen ,client accept().
// listen()socket(), bind(), accept().
// 0, -1, errno
// listen()SOCK_STREAM SOCK_SEQPACKET socket .
// socket AF_INET backlog 128.
listen(listenfd, LISTENQ);
signal(SIGCHLD, sig_child); //SIGCHLD, .
//, fork.
for ( ; ; ) {
addr_len = sizeof(client_addr);
// int accept(int s, struct sockaddr * addr, int * addrlen);
// accept()s socket.
// socket bind()listen(),
// , accept()socket , socket,
// s socket accept().
// , addr , addrlen scokaddr .
// socket , -1, errno .
connfd = accept(listenfd, (struct sockaddr *) &client_addr, &addr_len);
child_pid = fork();
if(child_pid < 0) //failed to fork a process.
{
fprintf(stderr, "error: failed in fork()\n");
exit(1);
}
else if(child_pid == 0) //the child process.
{
close(listenfd); //close listenfd in child process.
str_echo(connfd); //the task of child process - As a echo server.
exit(0);
}
else // the parent process.
close(connfd); //close connfd in parent process.
//close()socket, 0socket.
}
}
void str_echo(int sockfd)
{
ssize_t n;
char buf[1024];
again:
while( (n = read(sockfd, buf, 1024)) > 0) //sockfd
write(sockfd, buf, n);
if(n < 0 && errno == EINTR) //(EINTR), while.
goto again;
else if( n < 0)
perror("str_echo: read error");
}
void sig_child(int signo)
{
pid_t pid;
int state;
//pid = wait(&state); //
while( (pid = waitpid(-1, &state, WNOHANG)) > 0) //waitpid
printf("child pid[%d] terminated.\n", pid);
}
|
'use strict';
var emojiArr = require('./emojis');
var i = 0;
var existingRules = {};
var generateEmoji = function(selector) {
if (!existingRules[selector]) {
existingRules[selector] = emojiArr[i];
if (i !== emojiArr.length) {
i++
} else {
i = 0;
}
}
return existingRules[selector];
}
module.exports = generateEmoji;
|
// **NOTE** This file was generated by a tool and any changes will be overwritten.
// Template Source: Templates\CSharp\Requests\MethodRequest.cs.tt
namespace Microsoft.Graph
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Threading;
<summary>
The type <API key>.
</summary>
public partial class <API key> : BaseRequest, <API key>
{
<summary>
Constructs a new <API key>.
</summary>
public <API key>(
string requestUrl,
IBaseClient client,
IEnumerable<Option> options)
: base(requestUrl, client, options)
{
this.ContentType = "application/json";
this.RequestBody = new <API key>();
}
<summary>
Gets the request body.
</summary>
public <API key> RequestBody { get; private set; }
<summary>
Issues the POST request.
</summary>
public System.Threading.Tasks.Task<<API key>> PostAsync()
{
return this.PostAsync(CancellationToken.None);
}
<summary>
Issues the POST request.
</summary>
<param name="cancellationToken">The <see cref="CancellationToken"/> for the request.</param>
<returns>The task to await for async call.</returns>
public System.Threading.Tasks.Task<<API key>> PostAsync(
Cancellation<API key>)
{
this.Method = "POST";
return this.SendAsync<<API key>>(this.RequestBody, cancellationToken);
}
<summary>
Adds the specified expand value to the request.
</summary>
<param name="value">The expand value.</param>
<returns>The request object to send.</returns>
public <API key> Expand(string value)
{
this.QueryOptions.Add(new QueryOption("$expand", value));
return this;
}
<summary>
Adds the specified select value to the request.
</summary>
<param name="value">The select value.</param>
<returns>The request object to send.</returns>
public <API key> Select(string value)
{
this.QueryOptions.Add(new QueryOption("$select", value));
return this;
}
}
}
|
# -*- coding: utf-8 -*-
require 'helper'
class <API key> < Test::Unit::TestCase
def setup
setup_dir_var
end
def teardown
File.delete(@xlsx) if File.exist?(@xlsx)
end
def test_set_column07
@xlsx = 'set_column07.xlsx'
workbook = WriteXLSX.new(@xlsx)
worksheet = workbook.add_worksheet
bold = workbook.add_format(:bold => 1)
italic = workbook.add_format(:italic => 1)
bold_italic = workbook.add_format(:bold => 1, :italic => 1)
data = [
[1, 2, 3, 4, 5],
[2, 4, 6, 8, 10],
[3, 6, 9, 12, 15]
]
worksheet.write('A1', 'Foo', italic)
worksheet.write('B1', 'Bar', bold)
worksheet.write('A2', data)
worksheet.set_row(12, nil, italic)
worksheet.set_column('F:F', nil, bold)
worksheet.write('F13', nil, bold_italic)
worksheet.insert_image('E12',
File.join(@test_dir, 'regression', 'images/logo.png'))
workbook.close
<API key>(File.join(@regression_output, @xlsx), @xlsx)
end
end
|
var fractal = fractal || {};
fractal.workerPaths = {
"mandelbrot": "public/js/mandel.js",
};
fractal.Fractal = function (canvas, workerCount) {
this.canvas = canvas;
this.workerCount = workerCount;
this.workerDoneCount = 0;
this.ctx = canvas.getContext("2d");
this.width = canvas.width;
this.height = canvas.height;
this.workerPath = fractal.workerPaths["mandelbrot"];
this.topLeft = new Complex(-1.5, 1.1);
this.bottomRight = new Complex(0.8, -1.1);
this.maxIter = 1200;
var lingrad = this.ctx.<API key>(0, 0, this.width, 0);
lingrad.addColorStop(0, '#00f');
lingrad.addColorStop(0.1, '#fa0');
lingrad.addColorStop(0.5, '#ff0');
lingrad.addColorStop(0.7, '#f1b');
lingrad.addColorStop(1, '#fff');
this.ctx.fillStyle = lingrad;
this.ctx.fillRect(0, 0, this.width, 2);
this.gradientImage = this.ctx.getImageData(0, 0, this.width, 1);
this.imgData = this.ctx.getImageData(0, 0, this.width, this.height);
this.ondone = null;
this.workers = [];
};
fractal.Fractal.prototype = function () {
var computeRow = function (workerIndex, row) {
var args = {
action: "computeRow",
row: row,
workerIndex: workerIndex
};
this.workers[workerIndex].postMessage(args);
};
var initializeWorker = function (workerIndex) {
var drow = (this.bottomRight.imag - this.topLeft.imag) / this.height;
var dcol = (this.bottomRight.real - this.topLeft.real) / this.width;
var args = {
action: "setup",
maxIter: this.maxIter,
width: this.width,
height: this.height,
topLeft: this.topLeft,
bottomRight: this.bottomRight,
drow: drow,
dcol: dcol,
workerIndex: workerIndex,
juliaPoint: this.juliaPoint
};
this.workers[workerIndex].postMessage(args);
};
var createWorkers = function (workerPath) {
var obj = this;
var rowData = obj.ctx.createImageData(obj.width, 1);
for (var workerIndex = 0; workerIndex < obj.workerCount; workerIndex++) {
obj.workers[workerIndex] = new Worker(obj.workerPath);
this.workers[workerIndex].onmessage = function (event) {
if (event.data.logData) {
console.log("Worker: " + event.data.logData);
}
if (event.data.row >= 0) {
var wIndex = event.data.workerIndex;
for (var index = 0; index < obj.width; index++) {
var color = getColor.call(obj, event.data.iterData[index]);
var destIndex = 4 * index;
rowData.data[destIndex] = color.red;
rowData.data[destIndex + 1] = color.green;
rowData.data[destIndex + 2] = color.blue;
rowData.data[destIndex + 3] = color.alpha;
}
obj.ctx.putImageData(rowData, 0, event.data.row);
if (obj.nextRow < obj.height) {
console.log("Worker: " + wIndex, " nextRow: " + obj.nextRow);
computeRow.call(obj, wIndex, obj.nextRow);
obj.nextRow = obj.nextRow + 1;
} else {
obj.workerDoneCount++;
if (obj.workerDoneCount == obj.workerCount) {
var duration = new Date().getTime() - obj.startTime;
if (typeof obj.ondone === 'function') {
obj.ondone(duration);
}
}
}
}
};
}
};
var getColor = function (iter) {
if (iter == this.maxIter) {
return { red: 0, green: 0, blue: 0, alpha: 255 };
}
var index = (iter % this.gradientImage.width) * 4;
return {
red: this.gradientImage.data[index],
green: this.gradientImage.data[index + 1],
blue: this.gradientImage.data[index + 2],
alpha: this.gradientImage.data[index + 3]
};
},
render = function () {
this.startTime = new Date().getTime();
this.workerDoneCount = 0;
createWorkers.call(this, this.workerPath);
this.nextRow = this.workerCount;
for (var workerIndex = 0; workerIndex < this.workerCount; workerIndex++) {
initializeWorker.call(this, workerIndex);
computeRow.call(this, workerIndex, workerIndex);
}
}
return {
render: render
};
} ();
jQuery(function($) {
var fra = new fractal.Fractal(document.getElementById("fractal"), 2);
$('#draw-fractal').on('click',function() {
fra.render();
});
});
|
describe('raureif', function () {
it('test', function () {
});
});
|
/**
* @file ui/core/styleguide/index//html/01-body/40-main/main.js
* @description Listeners on the body, iframe, and rightpull bar.
*/
/* istanbul ignore if */
if (typeof window === 'object') {
document.addEventListener('DOMContentLoaded', () => {
const $orgs = FEPPER_UI.requerio.$orgs;
const {
uiFns,
uiProps
} = FEPPER_UI;
$orgs['#sg-rightpull'].on('mouseenter', function () {
$orgs['#sg-cover'].dispatchAction('addClass', '<API key>');
});
$orgs['#sg-rightpull'].on('mouseleave', function () {
$orgs['#sg-cover'].dispatchAction('removeClass', '<API key>');
});
// Handle manually resizing the viewport.
// 1. On "mousedown" store the click location.
// 2. Make a hidden div visible so that the cursor doesn't get lost in the iframe.
// 3. On "mousemove" calculate the math, save the results to a cookie, and update the viewport.
$orgs['#sg-rightpull'].on('mousedown', function (e) {
uiProps.sgRightpull.posX = e.pageX;
uiProps.sgRightpull.vpWidth = uiProps.vpWidth;
// Show the cover.
$orgs['#sg-cover'].dispatchAction('addClass', '<API key>');
});
// Add the mouse move event and capture data. Also update the viewport width.
$orgs['#patternlab-body'].on('mousemove', function (e) {
if ($orgs['#sg-cover'].getState().classArray.includes('<API key>')) {
let vpWidthNew = uiProps.sgRightpull.vpWidth;
if (uiProps.dockPosition === 'bottom') {
vpWidthNew += 2 * (e.pageX - uiProps.sgRightpull.posX);
}
else {
vpWidthNew += e.pageX - uiProps.sgRightpull.posX;
}
if (vpWidthNew > uiProps.minViewportWidth) {
uiFns.sizeIframe(vpWidthNew, false);
}
}
});
// Handle letting go of rightpull bar after dragging to resize.
$orgs['#patternlab-body'].on('mouseup', function () {
uiProps.sgRightpull.posX = null;
uiProps.sgRightpull.vpWidth = null;
$orgs['#sg-cover'].dispatchAction('removeClass', '<API key>');
$orgs['#sg-cover'].dispatchAction('removeClass', '<API key>');
});
});
}
|
<div>
<table class="table table-bordered">
<tr>
<td>
<div km-term-check name="root-traits" locales="locales" required ng-change="onRootTraitsChange()"
ng-model="rootTraits" terms="options.rootTraits()" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Resistencia a enfermedades y plagas</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Resistencia a herbicidas</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Resistencia a los antibióticos</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Tolerancia al estrés abiótico</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Cambios en la fisiología y/o producción</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Cambios en la calidad y/o el contenido metabólico</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Producción de compuestos médicos o farmacéuticos (humanos o animales)</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Uso en aplicaciones industriales</legend>
<div km-term-check name="traits" locales="locales" required
ng-model="traits['<API key>'].items" ng-change="onTraitsChange()"
terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
<legend>Modificación genética por aplicación de impulsores genéticos</legend>
<div km-term-check name="traits" locales="locales" required ng-change="onTraitsChange()"
ng-model="traits['<API key>'].items" terms="options.traits('<API key>')" binding-type="term[]"></div>
</td>
</tr>
<tr ng-if="traits['traitsOtherSection'].selected">
<td>
<div km-term-check name="traits" locales="locales" required ng-change="onTraitsChange()"
ng-model="traits['traitsOtherSection'].items" terms="options.traitsOtherSection()" binding-type="term[]">
</div>
</td>
</tr>
<tr ng-if="traits['<API key>'].selected">
<td>
</td>
</tr>
</table>
</div>
|
<?php
namespace Checkdomain\Holiday;
use Checkdomain\Holiday\Model\Holiday;
/**
* Class Util
*/
class Util
{
/**
* Instantiates a provider for a given iso code
*
* @param string $iso
*
* @return ProviderInterface
*/
protected function getProvider($iso)
{
$instance = null;
$class = '\\Checkdomain\\Holiday\\Provider\\' . $iso;
if (class_exists($class)) {
$instance = new $class;
}
return $instance;
}
/**
* @param \DateTime|string $date
*
* @return \DateTime
*/
protected function getDateTime($date)
{
if (!$date instanceof \DateTime) {
$date = new \DateTime($date);
}
return $date;
}
/**
* @param string $iso
*
* @return string
*/
protected function getIsoCode($iso)
{
return strtoupper($iso);
}
/**
* Checks wether a given date is a holiday
*
* This method can be used to check whether a specific date is a holiday
* in a specified country and state
*
* @param string $iso
* @param \DateTime|string $date
* @param string $state
*
* @return bool
*/
public function isHoliday($iso, $date = 'now', $state = null)
{
return ($this->getHoliday($iso, $date, $state) !== null);
}
/**
* Provides detailed information about a specific holiday
*
* @param string $iso
* @param \DateTime|string $date
* @param string $state
*
* @return Holiday|null
*/
public function getHoliday($iso, $date = 'now', $state = null)
{
$iso = $this->getIsoCode($iso);
$date = $this->getDateTime($date);
$provider = $this->getProvider($iso);
$holiday = $provider->getHolidayByDate($date, $state);
return $holiday;
}
}
|
namespace Votter.Services
{
using System;
using System.Linq;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(Votter.Services.Startup))]
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
this.ConfigureAuth(app);
}
}
}
|
#ifndef BUTTONS_H
#define BUTTONS_H
#include "FreeRTOS.h"
/* hardware button state */
struct button_state_t {
/* STATE WRITTEN IN IRQ HANDLER */
/* current button state: 0 (up, released) or 1 (down, pressed) */
int st;
/* the cpu-tick time when the current state (up or down) was recorded */
TickType_t tick;
/* STATE UPDATED IN OS TASK */
/* the cpu-tick time when the button was last pressed;
* used for detecting short and long button clicks in ButtonTask */
TickType_t kdwn_tick;
/* the cpu-tick time when the event BTN_LONGCLICK was last sent */
TickType_t longclick_sent_tick;
};
/* buttons identification */
#define BTN0 0
#define BTN1 1
#define BTN2 2
/* mask for BTNx */
#define BTNx_M 0xFF
/* button event */
#define BTN_DOWN 0x100
#define BTN_UP 0x200
#define BTN_SHORTCLICK 0x400
#define BTN_LONGCLICK 0x800
/* hardware ports and pins */
#define HW_BTN0_Port GPIOB
#define HW_BTN1_Port GPIOB
#define HW_BTN2_Port GPIOB
#define HW_BTN0_Pin GPIO_Pin_5
#define HW_BTN1_Pin GPIO_Pin_6
#define HW_BTN2_Pin GPIO_Pin_7
/* dead time in milliseconds - supress hardware glitches */
#define BUTTON_DEAD_TM 10
/* max short click time in miliseconds */
#define <API key> 1000
/* repetition time of BTN_LONGCLICK events once long-click is recognized */
#define <API key> 800
/* current button state */
extern struct button_state_t btnsts[3];
/* IRQ handler for button state change */
void EXTI9_5_IRQHandler(void);
/* OS task handling buttons events */
void ButtonsTask(void *pvParameters);
#endif
|
<div class="panel panel-default movie-container">
<div class="panel-body">
<div class="row top-part">
<div class="col-xs-12 col-md-4 movie-image">
<img ng-show="movie.Poster" class="img-rounded" src="{{movie.Poster}}" />
<div ng-show="!movie.Poster" class="img-rounded img-alt">
<span>{{movie.Title}}</span>
</div>
</div>
<div class="col-xs-12 col-md-8 movie-desc">
<h2 ng-show="movie.Title">{{movie.Title}}<span ng-show="movie.Year">-{{movie.Year}}</span></h2>
<p ng-show="movie.Plot"><span ng-show="movie.Type"><strong>In this {{movie.Type}}, </strong></span>{{movie.Plot}}</p>
<p ng-hide="!movie.Released && !movie.Runtime && !movie.Rated">
<span ng-show="movie.Released && movie.Released!=='N/A'" class="badge">{{movie.Released}}</span>
<span ng-show="movie.Runtime && movie.Runtime!=='N/A'" class="badge">{{movie.Runtime}}</span>
<span ng-show="movie.Rated && movie.Rated!=='N/A'" class="badge">{{movie.Rated}}</span>
</p>
<p class="movieGenra" ng-show="movie.Genre[0]!==''">
<span ng-repeat="Genre in movie.Genre" class="badge">{{Genre}}</span>
</p>
<p class="movieActors" ng-show="movie.Actors[0]!==''">
<span><strong>Starring - </strong></span>
<span ng-repeat="Actors in movie.Actors">{{Actors}}<span ng-hide="$index===(movie.Actors.length-1)">,</span></span>
</p>
<p class="movieDirector" ng-show="movie.Director[0] !== ''">
<span><strong>Directed By - </strong></span>
<span ng-repeat="Director in movie.Director">{{Director}}</span>
</p>
<p class="movieWriter" ng-show="movie.Writer[0] !== ''">
<span><strong>Written By -</strong></span>
<span ng-repeat="Writer in movie.Writer">{{Writer}}<span ng-hide="$index===(movie.Writer.length-1)">,</span></span>
</p>
</div>
</div>
<div class="bottom-part">
<div class="row">
<div class="col-xs-12 col-md-6 languageAc">
<div class="panel-group" id="langAccordion" role="tablist" <API key>="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="langHeading">
<h4 class="panel-title">
<a data-toggle="collapse" onclick="return false;" data-parent="#langAccordion" href="#Lcollapse" aria-expanded="true" aria-controls="Lcollapse">
Language Availability
</a>
</h4>
</div>
<div id="Lcollapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="langHeading">
<div class="panel-body">
<span ng-repeat="lan in movie.Language">{{lan}}<span ng-hide="$index===(movie.Language.length-1)">,</span></span>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 countryAc">
<div class="panel-group" id="counAccordion" role="tablist" <API key>="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="conHeading">
<h4 class="panel-title">
<a data-toggle="collapse" onclick="return false;" data-parent="#counAccordion" href="#Ccollapse" aria-expanded="true" aria-controls="Ccollapse">
Country Availability
</a>
</h4>
</div>
<div id="Ccollapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="conHeading">
<div class="panel-body">
<span ng-repeat="con in movie.Country">{{con}}<span ng-hide="$index===(movie.Country.length-1)">,</span></span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row imdbrow">
<div class="col-xs-12 col-md-12 imdbAc">
<div class="panel-group" id="imdbAccordion" role="tablist" <API key>="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="imdbHeading">
<h4 class="panel-title">
<a data-toggle="collapse" onclick="return false;" data-parent="#imdbAccordion" href="#imdbcollapse" aria-expanded="true" aria-controls="imdbcollapse">
IMDB DATA
</a>
</h4>
</div>
<div id="imdbcollapse" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="imdbHeading">
<div class="panel-body">
<div class="col-xs-12 col-md-6">
<span>IMDB Rating -</span><span>> {{movie.imdbRating}}</span>
<!-- rating -->
<div class="critic-rating">
<h5>Relative Star Rating</h5>
<div class="rating star-{{movie.imdbRating | getRatingClass}}">
<i class="fa fa-star star-1-on"></i>
<i class="fa fa-star star-off star-1-off"></i>
<i class="fa fa-star-half star-1-half"></i>
<i class="fa fa-star star-2-on"></i>
<i class="fa fa-star star-off star-2-off"></i>
<i class="fa fa-star-half star-2-half"></i>
<i class="fa fa-star star-3-on"></i>
<i class="fa fa-star star-off star-3-off"></i>
<i class="fa fa-star-half star-3-half"></i>
<i class="fa fa-star star-4-on"></i>
<i class="fa fa-star star-off star-4-off"></i>
<i class="fa fa-star-half star-4-half"></i>
<i class="fa fa-star star-5-on"></i>
<i class="fa fa-star star-off star-5-off"></i>
<i class="fa fa-star-half star-5-half"></i>
<!-- commented as we created half equivalent 5 star according to IMDB data
<i class="fa fa-star star-6-on"></i>
<i class="fa fa-star star-off star-6-off"></i>
<i class="fa fa-star-half star-6-half"></i>
<i class="fa fa-star star-7-on"></i>
<i class="fa fa-star star-off star-7-off"></i>
<i class="fa fa-star-half star-7-half"></i>
<i class="fa fa-star star-8-on"></i>
<i class="fa fa-star star-off star-8-off"></i>
<i class="fa fa-star-half star-8-half"></i>
<i class="fa fa-star star-9-on"></i>
<i class="fa fa-star star-off star-9-off"></i>
<i class="fa fa-star-half star-9-half"></i>
<i class="fa fa-star star-10-on"></i>
<i class="fa fa-star star-off star-10-off"></i>
<i class="fa fa-star-half star-10-half"></i>
</div>
</div>
<!-- end rating-->
</div>
<div class="col-xs-12 col-md-6">
<span>IMDB Votes-</span><span>> {{movie.imdbVotes}}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
|
import java.io.BufferedReader;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
public class CharCounterMain{
final static Charset enc = StandardCharsets.US_ASCII ;
public CharCounterMain(String ch, String filedir){
if(ch.length() != 1){
System.out.println("The first argument needs to be a char, found string of length "+ch.length());
System.exit(1);
}
char c = ch.charAt(0);
if( c != ' ' && c != '.' && Character.getNumericValue(c) < 97 && Character.getNumericValue(c) > 122 ){ //compare against the ascii integer values
System.out.println("Need a character in range a-z (lowercase only) or a whitespace or a dot, found "+c+"!");
System.exit(1);
}
Path p = Paths.get(filedir);
try {
BufferedReader bf = Files.newBufferedReader(p,enc);
String line;
String line2 = null ;
while((line = bf.readLine()) != null){
line2 += line ;
}
CharCounter cc = new CharCounter(c,line2);
int freq = cc.getFrequency();
System.out.println(String.format("Frequency of character %c was %d", c,freq));
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("Finished, exiting...");
}
public static void main(String[] args){
if(args.length != 2){
System.out.println("Usage : CharCounterMain <char-to-look-for> <text-file-dir>");
}else{
new CharCounterMain(args[0],args[1]);
}
}
}
|
"use strict";
(function() {
// "todos-angular" is just a hard-code id for storage
var LOCAL_STORAGE_KEY = 'todos-angular';
var ENTER_KEY = 13;
var ESC_KEY = 27;
var internalFilters = {
active: function(toDoItem) {
return !toDoItem.completed;
},
completed: function(toDoItem) {
return toDoItem.completed;
}
};
angular.module('ToDoAngular', ['ngRoute'])
.service('storage', function($q) {
// Storage service
return {
save: function(toDoCollection) {
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(toDoCollection));
},
load: function() {
var <API key> = localStorage.getItem(LOCAL_STORAGE_KEY);
return <API key> && JSON.parse(<API key>) || [];
}
}
})
.directive('escHandler', function() {
// Define directive for esc key
return {
restrict: 'A',
link: function(scope, iElement, iAttrs) {
function keyEventHandler(event) {
if (event.keyCode === ESC_KEY) {
scope.$apply(iAttrs.escHandler);
}
}
iElement.on('keydown', keyEventHandler);
scope.$on('$destroy', function() {
iElement.off('keydown', keyEventHandler);
});
}
};
})
.directive('enterHandler', function() {
// Define directive for enter key
return {
restrict: 'A',
link: function (scope, iElement, iAttrs) {
function keyEventHandler(event) {
if (event.keyCode === ENTER_KEY) {
scope.$apply(iAttrs.enterHandler);
}
}
iElement.on('keydown', keyEventHandler);
scope.$on('$destroy', function () {
iElement.off('keydown', keyEventHandler);
});
}
};
})
.directive('selectAndFocus', function($timeout) {
// Define directive for focus
return {
restrict: 'A',
link: function(scope, iElement, iAttrs) {
var focusPromise;
scope.$watch(iAttrs.selectAndFocus, function(newValue) {
if (newValue && !focusPromise) {
focusPromise = $timeout(function focus() {
focusPromise = null;
iElement[0].focus();
}, 0, false);
}
});
scope.$on('$destroy', function() {
if (focusPromise) {
$timeout.cancel(focusPromise);
focusPromise = null;
}
});
}
};
})
.directive('toDoItem', function() {
// Define directive for to-do item
return {
restrict: 'A',
templateUrl: '<API key>.html',
scope: {
itemViewModel: '=toDoItem'
},
link: function (scope, iElement, iAttrs) {
scope.editing = false;
scope.originalTitle = '';
scope.$watch('itemViewModel.toDoItem.completed', function(newCompleted) {
iElement.toggleClass('completed', newCompleted);
});
scope.$watch('editing', function(newEditing) {
iElement.toggleClass('editing', newEditing);
});
scope.$watch('itemViewModel.isHidden', function(newHidden) {
iElement.toggleClass('hidden', newHidden);
});
scope.$watchGroup([
'itemViewModel.toDoItem.title',
'itemViewModel.toDoItem.completed'], function() {
scope.$emit('item-updated');
});
scope.destroy = function() {
scope.$emit('remove-item', scope.itemViewModel);
};
scope.edit = function() {
scope.originalTitle = scope.itemViewModel.toDoItem.title;
scope.editing = true;
};
scope.update = function() {
var title = scope.itemViewModel.toDoItem.title || '';
var trimmedTitle = title.trim();
if (scope.editing) {
if (title !== trimmedTitle) {
scope.itemViewModel.toDoItem.title = trimmedTitle;
}
if (!trimmedTitle) {
scope.destroy();
}
scope.editing = false;
}
};
scope.revert = function() {
scope.editing = false;
scope.itemViewModel.toDoItem.title = scope.originalTitle;
};
}
};
})
.controller('AppController', function AppController(
$scope, $routeParams, <API key>, storage) {
// Define app controller
$scope.toDoCollection = <API key>.map(function(storedToDo) {
return {
toDoItem: storedToDo,
isHidden: $scope.filter ? !$scope.filter(storedToDo): false
};
});
$scope.currentTitle = '';
$scope.$on('$routeChangeSuccess', function() {
var filterString = $routeParams.filter;
if (filterString && (filterString in internalFilters)) {
$scope.filterString = filterString;
$scope.filter = internalFilters[filterString];
} else {
$scope.filterString = '';
$scope.filter = null;
}
});
function save() {
storage.save($scope.toDoCollection.map(function(toDoViewModel) {
return toDoViewModel.toDoItem;
}));
}
$scope.$watch('filter', function(newFilter) {
$scope.toDoCollection.forEach(function(toDoViewModel) {
toDoViewModel.isHidden = newFilter ? !newFilter(toDoViewModel.toDoItem) : false;
});
});
$scope.$watch(function() {
return $scope.toDoCollection.filter(function(toDoViewModel){
return !toDoViewModel.toDoItem.completed;
}).length;
}, function(newValue) {
if (newValue == null) {
$scope.remainingLabel = '';
} else {
$scope.remainingLabel = newValue === 1 ?
(newValue + ' item left') :
(newValue + ' items left');
}
});
$scope.$watchCollection('toDoCollection', function() {
save();
});
$scope.$on('item-updated', function() {
save();
});
$scope.$on('remove-item', function(scope, toDoViewModel) {
for(var index = 0; index < $scope.toDoCollection.length; index++) {
if ($scope.toDoCollection[index] === toDoViewModel) {
$scope.toDoCollection.splice(index, 1);
return;
}
}
});
$scope.create = function() {
var currentTitle = $scope.currentTitle.trim();
if (currentTitle) {
var toDoItem = {
title: currentTitle,
completed: false
};
var toDoItemViewModel = {
toDoItem: toDoItem,
isHidden: $scope.filter ? !$scope.filter(toDoItem): false
};
$scope.toDoCollection.push(toDoItemViewModel);
$scope.currentTitle = '';
}
};
})
.config(function($routeProvider) {
// Define routing
var routeConfig = {
controller: 'AppController',
templateUrl: '<API key>.html',
resolve: {
<API key>: function(storage) {
return storage.load();
}
}
};
$routeProvider
.when('/', routeConfig)
.when('/:filter', routeConfig)
.otherwise({
redirectTo: '/'
});
});
})();
|
<?php
namespace Params;
/**
* @codeCoverageIgnore
*/
trait SafeAccess
{
public function __set($name, $value)
{
throw new \Exception("Property [$name] doesn't exist for class [".get_class($this)."] so can't set it");
}
public function __get($name)
{
throw new \Exception("Property [$name] doesn't exist for class [".get_class($this)."] so can't get it");
}
}
|
html{
height: 100%;
margin: 0;
background-color:#323232;
}
body{
font-family: 'Lato', sans-serif;
font-size: 11pt;
font-weight: 300;
color: #C8C8C8
}
ul {
list-style: none;
}
a:link {color:#6c6c6c;}
a:visited {color:#757575;}
a:hover {color:white;}
a:active {color:white;}
.header{
text-align: center;
padding-top: 10%;
color: white;
}
.user_info{
text-align: center;
padding-top: 1%
}
.profile_pic{
height: 25%;
width: auto;
}
input:not([type=submit]):not([type=file]) {
border: none;
padding: 5px;
background: rgba(255,255,255,0.08);
margin: 0 0 10px 0;
}
|
from decimal import Decimal
from django import forms
from django.template.loader import render_to_string
from django.template.defaultfilters import slugify
class BaseWidget(forms.TextInput):
"""
Base widget. Do not use this directly.
"""
template = None
instance = None
def get_parent_id(self, name, attrs):
final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
return final_attrs['id']
def get_widget_id(self, prefix, name, key=''):
if self.instance:
opts = self.instance._meta
widget_id = '%s-%s-%s_%s-%s' % (prefix, name, opts.app_label, opts.module_name, self.instance.pk)
else:
widget_id = '%s-%s' % (prefix, name)
if key:
widget_id = '%s_%s' % (widget_id, slugify(key))
return widget_id
def get_values(self, min_value, max_value, step=1):
decimal_step = Decimal(str(step))
value = Decimal(str(min_value))
while value <= max_value:
yield value
value += decimal_step
class SliderWidget(BaseWidget):
"""
Slider widget.
In order to use this widget you must load the jQuery.ui slider
javascript.
This widget triggers the following javascript events:
- *slider_change* with the vote value as argument
(fired when the user changes his vote)
- *slider_delete* without arguments
(fired when the user deletes his vote)
It's easy to bind these events using jQuery, e.g.::
$(document).bind('slider_change', function(event, value) {
alert('New vote: ' + value);
});
"""
def __init__(self, min_value, max_value, step, instance=None,
can_delete_vote=True, key='', read_only=False, default='',
template='ratings/slider_widget.html', attrs=None):
"""
The argument *default* is used when the initial value is None.
"""
super(SliderWidget, self).__init__(attrs)
self.min_value = min_value
self.max_value = max_value
self.step = step
self.instance = instance
self.can_delete_vote = can_delete_vote
self.read_only = read_only
self.default = default
self.template = template
self.key = key
def get_context(self, name, value, attrs=None):
# here we convert *min_value*, *max_value*, *step* and *value*
# to string to avoid odd behaviours of Django localization
# in the template (and, for backward compatibility we do not
# want to use the *unlocalize* filter)
attrs['type'] = 'hidden'
return {
'min_value': str(self.min_value),
'max_value': str(self.max_value),
'step': str(self.step),
'can_delete_vote': self.can_delete_vote,
'read_only': self.read_only,
'default': self.default,
'parent': super(SliderWidget, self).render(name, value, attrs),
'parent_id': self.get_parent_id(name, attrs),
'value': str(value),
'has_value': bool(value),
'slider_id': self.get_widget_id('slider', name, self.key),
'label_id': 'slider-label-%s' % name,
'remove_id': 'slider-remove-%s' % name,
}
def render(self, name, value, attrs=None):
context = self.get_context(name, value, attrs or {})
return render_to_string(self.template, context)
class StarWidget(BaseWidget):
def __init__(self, min_value, max_value, step, instance=None,
can_delete_vote=True, key='', read_only=False,
template='ratings/star_widget.html', attrs=None):
super(StarWidget, self).__init__(attrs)
self.min_value = min_value
self.max_value = max_value
self.step = step
self.instance = instance
self.can_delete_vote = can_delete_vote
self.read_only = read_only
self.template = template
self.key = key
def get_context(self, name, value, attrs=None):
# here we convert *min_value*, *max_value* and *step*
# to string to avoid odd behaviours of Django localization
# in the template (and, for backward compatibility we do not
# want to use the *unlocalize* filter)
attrs['type'] = 'hidden'
split_value = int(1 / self.step)
if split_value == 1:
values = range(1, self.max_value+1)
split = u''
else:
values = self.get_values(self.min_value, self.max_value, self.step)
split = u' {split:%d}' % split_value
return {
'min_value': str(self.min_value),
'max_value': str(self.max_value),
'step': str(self.step),
'can_delete_vote': self.can_delete_vote,
'read_only': self.read_only,
'values': values,
'split': split,
'parent': super(StarWidget, self).render(name, value, attrs),
'parent_id': self.get_parent_id(name, attrs),
'value': self._get_value(value, split_value),
'star_id': self.get_widget_id('star', name, self.key),
}
def _get_value(self, original, split):
if original:
value = round(original * split) / split
return Decimal(str(value))
def render(self, name, value, attrs=None):
context = self.get_context(name, value, attrs or {})
return render_to_string(self.template, context)
class LikeWidget(BaseWidget):
def __init__(self, min_value, max_value, instance=None,
can_delete_vote=True, template='ratings/like_widget.html', attrs=None):
super(LikeWidget, self).__init__(attrs)
self.min_value = min_value
self.max_value = max_value
self.instance = instance
self.can_delete_vote = can_delete_vote
self.template = template
def get_context(self, name, value, attrs=None):
# here we convert *min_value*, *max_value* and *step*
# to string to avoid odd behaviours of Django localization
# in the template (and, for backward compatibility we do not
# want to use the *unlocalize* filter)
attrs['type'] = 'hidden'
return {
'min_value': str(self.min_value),
'max_value': str(self.max_value),
'can_delete_vote': self.can_delete_vote,
'parent': super(LikeWidget, self).render(name, value, attrs),
'parent_id': self.get_parent_id(name, attrs),
'value': str(value),
'like_id': self.get_widget_id('like', name),
}
def render(self, name, value, attrs=None):
context = self.get_context(name, value, attrs or {})
return render_to_string(self.template, context)
|
define(function() {
return {
draw: function(context, t) {
var x = this.getNumber("x", t, 100),
y = this.getNumber("y", t, 100),
size = this.getNumber("size", t, 60),
h = this.getNumber("h", t, 40),
colorLeft = this.getColor("colorLeft", t, "#999999"),
colorRight = this.getColor("colorRight", t, "#cccccc"),
colorTop = this.getColor("colorTop", t, "#eeeeee"),
scaleX = this.getNumber("scaleX", t, 1),
scaleY = this.getNumber("scaleY", t, 1);
context.translate(x, y);
context.scale(scaleX, scaleY);
if(h >= 0) {
context.fillStyle = colorTop;
context.beginPath();
context.moveTo(-size / 2, -h);
context.lineTo(0, -size / 4 - h);
context.lineTo(size / 2, -h);
context.lineTo(size / 2, -1);
context.lineTo(0, size / 4 - 1);
context.lineTo(-size / 2, -1);
context.lineTo(-size / 2, -h);
this.drawFillAndStroke(context, t, true, false);
context.fillStyle = colorLeft;
context.beginPath();
context.moveTo(-size / 2, 0);
context.lineTo(0, size / 4);
context.lineTo(0, size / 4 - h);
context.lineTo(-size / 2, -h);
context.lineTo(-size / 2, 0);
this.drawFillAndStroke(context, t, true, false);
context.fillStyle = colorRight;
context.beginPath();
context.moveTo(size / 2, 0);
context.lineTo(0, size / 4);
context.lineTo(0, size / 4 - h);
context.lineTo(size / 2, -h);
context.lineTo(size / 2, 0);
this.drawFillAndStroke(context, t, true, false);
}
else {
// clip path
context.beginPath();
context.moveTo(-size / 2, 0);
context.lineTo(0, -size / 4);
context.lineTo(size / 2, 0);
context.lineTo(0, size / 4);
context.lineTo(-size / 2, 0);
context.clip();
context.fillStyle = colorRight;
context.beginPath();
context.moveTo(-size / 2, 0);
context.lineTo(0, -size / 4);
context.lineTo(0, -size / 4 -h);
context.lineTo(-size / 2, -h);
context.lineTo(-size / 2, 0);
this.drawFillAndStroke(context, t, true, false);
context.fillStyle = colorLeft;
context.beginPath();
context.moveTo(size / 2, 0);
context.lineTo(0, -size / 4);
context.lineTo(0, -size / 4 -h);
context.lineTo(size / 2, -h);
context.lineTo(size / 2, 0);
this.drawFillAndStroke(context, t, true, false);
context.fillStyle = colorTop;
context.beginPath();
context.moveTo(-size / 2, -h);
context.lineTo(0, -size / 4 - h);
context.lineTo(size / 2, -h);
context.lineTo(0, size / 4 - h);
context.lineTo(-size / 2, -h);
this.drawFillAndStroke(context, t, true, false);
}
}
}
});
|
<?php namespace BoundedContext\Contracts\Generator;
use BoundedContext\Contracts\ValueObject\Identifier as IdentifierVO;
interface Identifier extends ValueObject
{
/**
* Generates a new random Identifier.
*
* @return IdentifierVO
*/
public function generate();
/**
* Generates a null Identifier.
*
* @return IdentifierVO
*/
public function null();
/**
* Generates a new Identifier from a string.
*
* @param string $identifier
* @return IdentifierVO
*/
public function string($identifier);
}
|
<?php
return array (
'id' => '<API key>',
'fallback' => 'softbank_generic',
'capabilities' =>
array (
'<API key>' => '41',
'columns' => '15',
'<API key>' => '34',
'max_image_width' => '176',
'rows' => '6',
'resolution_width' => '176',
'resolution_height' => '208',
'max_image_height' => '173',
'colors' => '262144',
'max_deck_size' => '357000',
'mms_max_size' => '307200',
'mms_max_width' => '640',
'mms_max_height' => '480',
'nokia_series' => '60',
'nokia_feature_pack' => '2',
'nokia_edition' => '2',
'model_name' => '702NKII(NOKIA 6680)',
'uaprof' => 'http://nds1.nds.nokia.com/uaprof/N6680r100-VFKK3G.xml',
'model_extra_info' => 'Vodafone',
'release_date' => '2005_may',
'<API key>' => 'true',
'oma_support' => 'true',
'aac' => 'true',
'mp3' => 'true',
'<API key>' => 'true',
'flash_lite_version' => '',
'xhtml_file_upload' => 'supported',
),
);
|
<!DOCTYPE html><html><head><title>https:
|
package com.company;
import java.util.Scanner;
public class Greeting {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String firstName = scanner.nextLine();
String lastName = scanner.nextLine();
int age = Integer.parseInt(scanner.nextLine());
System.out.printf("Hello, %s %s. You are %d years old.", firstName, lastName, age);
}
}
|
package sbahjsic.runtime;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import sbahjsic.core.Warnings;
import sbahjsic.core.Warnings.Level;
import sbahjsic.runtime.Operator.BiOperator;
import sbahjsic.runtime.Operator.UnOperator;
import sbahjsic.runtime.Operator.VarargOperator;
import sbahjsic.runtime.type.AnyType;
import sbahjsic.runtime.type.SVoid;
/** Describes a Sbahjsic type.
*
* <p>For all subclasses, there must only exist one instance. To enforce
* this, this class implements final {@code equals()} and {@code hashCode()}
* methods as they are defined in {@code Object}.*/
public abstract class Type {
private final Map<String, Operator> operators = new HashMap<>();
private final Set<Type> supertypes = new HashSet<>();
private final Set<String> fields = new HashSet<>();
private final Map<String, Method> methods = new HashMap<>();
private int priority = 0;
protected Type() {
// Fixes a bug where AnyType tried to add AnyType.INSTANCE, which
// was null at that point, to its own supertypes
if(!getClass().equals(AnyType.class)) {
addSupertype(AnyType.INSTANCE);
}
}
/** Registers a new supertype for this type.
* @param supertype the new supertype*/
public final void addSupertype(Type supertype) {
if(getSupertypes().contains(supertype) || supertype.getSupertypes().contains(this)) {
throw new <API key>(this.toString());
}
if(this != supertype) {
supertypes.add(supertype);
}
}
/** Removes a supertype from this type if it exists.
* @param supertype the supertype to remove*/
public final void removeSupertype(Type supertype) {
supertypes.remove(supertype);
}
/** Registers an unary operator for this type.
* @param op the operator to register
* @param func a function that applies this operator*/
public final void addUnOperator(String op, UnOperator func) {
operators.put(op, Operator.unaryOperator(func));
}
/** Registers a binary operator for this type.
* @param op the operator to register
* @param func a function that applies this operator*/
public final void addBiOperator(String op, BiOperator func) {
operators.put(op, Operator.binaryOperator(func));
}
/** Adds an operator that can accept one or two arguments.
* @param op the operator
* @param unary the unary operator
* @param binary the binary operator*/
protected final void addDoubleOperator(String op, UnOperator unary, BiOperator binary) {
operators.put(op, (con, args) -> {
if(args.length == 1)
return unary.apply(con, args[0]);
else if(args.length == 2)
return binary.apply(con, args[0], args[1]);
throw new <API key>("Called with " + args.length +
" arguments, expected 1 or 2");
});
}
/** Registers a vararg operator for this type.*/
public void addVarargOperator(String op, VarargOperator func) {
operators.put(op, Operator.varargOperator(func));
}
/** Adds a field to this type.
* @param field the field to add*/
protected final void addField(String field) {
fields.add(field);
}
/** Returns a specific operator of this type.
* @param op the operator to search
* @return the operator matching {@code op}
* @throws <API key> if {@code op} isn't defined*/
public final Operator getOperator(String op) {
if(operators.containsKey(op)) {
return operators.get(op);
}
Operator operator = operatorLookup(op);
if(operator == null) {
throw new <API key>("Operator " + op + " not defined on type " + getName());
}
return operator;
}
private final Operator operatorLookup(String op) {
for(Type supertype : supertypes) {
if(supertype.operators.containsKey(op)) {
return supertype.operators.get(op);
}
}
for(Type supertype : supertypes) {
Operator operator = supertype.operatorLookup(op);
if(operator != null) { return operator; }
}
return null;
}
/** Returns a set of all defined operators of this type.
* @return a set of the defined operators of this type*/
public final Set<String> getDefinedOperators() {
Set<String> ops = new HashSet<>();
ops.addAll(operators.keySet());
for(Type supertype : getSupertypes()) {
ops.addAll(supertype.getDefinedOperators());
}
return ops;
}
/** Returns a set of the supertypes of this type.
* @return a set of the supertypes of this type*/
public final Set<Type> getSupertypes() {
Set<Type> types = new HashSet<>();
types.addAll(supertypes);
for(Type supertype : supertypes) {
types.addAll(supertype.getSupertypes());
}
return types;
}
/** Returns the fields declared for this type.
* @return a set of fields declared for this type*/
public final Set<String> getFields() {
Set<String> allFields = new HashSet<>();
allFields.addAll(fields);
for(Type supertype : getSupertypes()) {
allFields.addAll(supertype.getFields());
}
return allFields;
}
/** Adds a method to this type.
* @param name the name of the method
* @param method the method*/
public final void addMethod(String name, Method method) {
methods.put(name, method);
}
/** Returns all methods defined for this type.
* @return all methods defined for this type*/
public final Set<String> getMethods() {
Map<String, Method> allMethods = new HashMap<>();
allMethods.putAll(methods);
for(Type supertype : getSupertypes()) {
allMethods.putAll(supertype.methods);
}
return allMethods.keySet();
}
/** Returns a method of this type.
* @param name the name of the method
* @return the method
* @throws MethodCallException if the method isn't defined for this type*/
public final Method getMethod(String name) {
if(methods.containsKey(name)) {
return methods.get(name);
}
Method method = methodLookup(name);
if(method == null) {
throw new MethodCallException("Method " + name + " not defined for type " + getName());
}
return method;
}
private final Method methodLookup(String name) {
for(Type supertype : supertypes) {
if(supertype.methods.containsKey(name)) {
return supertype.methods.get(name);
}
}
for(Type supertype : supertypes) {
Method method = supertype.methodLookup(name);
if(method != null) { return method; }
}
return null;
}
/** Returns the name of this type.
* @return the name of this type*/
public abstract String getName();
/** Casts a value to this type.
* @param object the value to cast
* @return the casted value*/
public SValue cast(SValue object) {
Warnings.warn(Level.ADVICE, "Undefined cast from " + object.getType() + " to " + this);
return object;
}
/** Returns whether this type is the subtype of some other type. That is
* true if this type or any if its supertypes is the other type.
* @param other the other type
* @return whether this type is the subtype of the other type */
public boolean isSubtype(Type other) {
return this.equals(other) || getSupertypes().contains(other);
}
/** Constructs an instance of this type
* @param context the RuntimeContext
* @param args the arguments passed to the constructor*/
public SValue construct(RuntimeContext context, SValue...args) {
Warnings.warn(Level.NOTIFICATION, "Cannot instantiate " + getName());
return SVoid.VOID;
}
/** Returns the priority of this type, used to determine which operand
* should choose the implementation of a binary operator. Defaults to zero.*/
public int priority() { return priority; }
/** Sets the priority for this type.*/
public void setPriority(int p) {
priority = p;
}
@Override
public final boolean equals(Object o) {
return super.equals(o);
}
@Override
public final int hashCode() {
return super.hashCode();
}
@Override
public final String toString() {
return getName();
}
}
|
{
"date": "2018-02-19",
"type": "post",
"title": "Report for Monday 19th of February 2018",
"slug": "2018\/02\/19",
"categories": [
"Daily report"
],
"images": [],
"health": {
"weight": 79.6,
"height": 173,
"age": 13578
},
"nutrition": {
"calories": 1939.89,
"fat": 142.55,
"carbohydrates": 101.78,
"protein": 65.78
},
"exercise": {
"pushups": 0,
"crunches": 0,
"steps": 12906
},
"media": {
"books": [],
"podcast": [],
"youtube": [],
"movies": [],
"photos": []
}
}
Today I am <strong>13578 days</strong> old and my weight is <strong>79.6 kg</strong>. During the day, I consumed <strong>1939.89 kcal</strong> coming from <strong>142.55 g</strong> fat, <strong>101.78 g</strong> carbohydrates and <strong>65.78 g</strong> protein. Managed to do <strong>0 push-ups</strong>, <strong>0 crunches</strong> and walked <strong>12906 steps</strong> during the day which is approximately <strong>9.83 km</strong>.
|
#!/bin/sh
# CYBERWATCH SAS - 2017
# Security fix for USN-2166-1
# Operating System: Ubuntu 12.04 LTS
# Architecture: x86_64
# - libsnmp15:5.4.3~dfsg-2.4ubuntu1.2
# Last versions recommanded by security team:
# - libsnmp15:5.4.3~dfsg-2.4ubuntu1.3
# CVE List:
# - CVE-2012-6151
# - CVE-2014-2284
# - CVE-2014-2285
# - CVE-2014-2310
# More details:
sudo apt-get install --only-upgrade libsnmp15=5.4.3~dfsg-2.4ubuntu1.3 -y
|
class Person < ActiveRecord::Base
has_many :addresses, dependent: :destroy
<API key> :addresses
end
|
import React from 'react';
import {connect} from 'cerebral-view-react';
import styles from './styles.css';
import {
isObject,
isArray,
isString,
isBoolean,
isNumber,
isNull
} from 'common/utils';
import JSONInput from './JSONInput';
import connector from 'connector';
function isInPath(source, target) {
if (!source || !target) {
return false;
}
return target.reduce((isInPath, key, index) => {
if (!isInPath) {
return false;
}
return String(source[index]) === String(key);
}, true);
}
function renderType(value, hasNext, path, propertyKey, highlightPath) {
if (value === undefined) {
return null;
}
if (isArray(value)) {
return (
<ArrayValue
value={value}
hasNext={hasNext}
path={path}
propertyKey={propertyKey}
highlightPath={highlightPath}/>
);
}
if (isObject(value)) {
return (
<ObjectValue
value={value}
hasNext={hasNext}
path={path}
propertyKey={propertyKey}
highlightPath={highlightPath}/>
);
}
return (
<Value
value={value}
hasNext={hasNext}
path={path}
propertyKey={propertyKey}
highlightPath={highlightPath}/>
);
}
class ObjectValue extends React.Component {
static contextTypes = {
options: React.PropTypes.object.isRequired
}
constructor(props, context) {
super(props);
const numberOfKeys = Object.keys(props.value).length;
const isHighlightPath = !!(this.props.highlightPath && isInPath(this.props.highlightPath, this.props.path));
const preventCollapse = this.props.path.length === 0 && context.options.expanded;
this.state = {
isCollapsed: !preventCollapse && !isHighlightPath && (numberOfKeys > 3 || numberOfKeys === 0 ? true : context.options.expanded ? false : true)
};
this.onCollapseClick = this.onCollapseClick.bind(this);
this.onExpandClick = this.onExpandClick.bind(this);
}
<API key>(nextProps, nextState) {
return (
nextState.isCollapsed !== this.state.isCollapsed ||
this.context.options.canEdit ||
nextProps.path !== this.props.path ||
nextProps.highlightPath !== this.props.highlightPath
);
}
<API key>(nextProps) {
const context = this.context;
const props = nextProps;
const numberOfKeys = Object.keys(props.value).length;
const isHighlightPath = !!(props.highlightPath && isInPath(props.highlightPath, props.path));
const preventCollapse = props.path.length === 0 && context.options.expanded;
if (this.state.isCollapsed) {
this.setState({
isCollapsed: !preventCollapse && !isHighlightPath && (numberOfKeys > 3 || numberOfKeys === 0 ? true : context.options.expanded ? false : true)
});
}
}
onExpandClick() {
this.setState({isCollapsed: false})
}
onCollapseClick() {
this.setState({isCollapsed: true});
}
renderProperty(key, value, index, hasNext, path) {
this.props.path.push(key);
const property = (
<div className={styles.objectProperty} key={index}>
<div className={styles.objectPropertyValue}>{renderType(value, hasNext, path.slice(), key, this.props.highlightPath)}</div>
</div>
);
this.props.path.pop();
return property;
}
renderKeys(keys) {
if (keys.length > 3) {
return keys.slice(0, 3).join(', ') + '...'
}
return keys.join(', ');
}
render() {
const {value, hasNext} = this.props;
const <API key> = this.props.highlightPath && String(this.props.highlightPath) === String(this.props.path);
if (this.state.isCollapsed) {
return (
<div className={<API key> ? styles.highlightObject : styles.object} onClick={this.onExpandClick}>
{this.props.propertyKey ? this.props.propertyKey + ': ' : null}
<strong>{'{ '}</strong>{this.renderKeys(Object.keys(value))}<strong>{' }'}</strong>
{hasNext ? ',' : null}
</div>
);
} else if (this.props.propertyKey) {
const keys = Object.keys(value);
return (
<div className={<API key> ? styles.highlightObject : styles.object}>
<div onClick={this.onCollapseClick}>{this.props.propertyKey}: <strong>{'{ '}</strong></div>
{keys.map((key, index) => this.renderProperty(key, value[key], index, index < keys.length - 1, this.props.path))}
<div><strong>{' }'}</strong>{hasNext ? ',' : null}</div>
</div>
);
} else {
const keys = Object.keys(value);
return (
<div className={<API key> ? styles.highlightObject : styles.object}>
<div onClick={this.onCollapseClick}><strong>{'{ '}</strong></div>
{keys.map((key, index) => this.renderProperty(key, value[key], index, index < keys.length - 1, this.props.path, this.props.highlightPath))}
<div><strong>{' }'}</strong>{hasNext ? ',' : null}</div>
</div>
);
}
}
}
class ArrayValue extends React.Component {
static contextTypes = {
options: React.PropTypes.object.isRequired
}
constructor(props, context) {
super(props);
const numberOfItems = props.value.length;
const isHighlightPath = this.props.highlightPath && isInPath(this.props.highlightPath, this.props.path);
this.state = {
isCollapsed: !isHighlightPath && (numberOfItems > 3 || numberOfItems === 0) ? true : context.options.expanded ? false : true
};
this.onCollapseClick = this.onCollapseClick.bind(this);
this.onExpandClick = this.onExpandClick.bind(this);
}
<API key>(nextProps, nextState) {
return (
nextState.isCollapsed !== this.state.isCollapsed ||
this.context.options.canEdit ||
nextProps.path !== this.props.path ||
nextProps.highlightPath !== this.props.highlightPath
);
}
<API key>(nextProps) {
const context = this.context;
const props = nextProps;
const numberOfItems = props.value.length;
const isHighlightPath = props.highlightPath && isInPath(props.highlightPath, props.path);
if (this.state.isCollapsed) {
this.setState({
isCollapsed: !isHighlightPath && (numberOfItems > 3 || numberOfItems === 0) ? true : context.options.expanded ? false : true
});
}
}
onExpandClick() {
this.setState({isCollapsed: false})
}
onCollapseClick() {
this.setState({isCollapsed: true});
}
renderItem(item, index, hasNext, path) {
this.props.path.push(index);
const arrayItem = (
<div className={styles.arrayItem} key={index}>
{renderType(item, hasNext, path.slice())}
</div>
);
this.props.path.pop();
return arrayItem;
}
render() {
const {value, hasNext} = this.props;
const <API key> = this.props.highlightPath && String(this.props.highlightPath) === String(this.props.path);
if (this.state.isCollapsed) {
return (
<div className={<API key> ? styles.highlightArray : styles.array} onClick={this.onExpandClick}>
{this.props.propertyKey ? this.props.propertyKey + ': ' : null}
<strong>{'[ '}</strong>{value.length}<strong>{' ]'}</strong>
{hasNext ? ',' : null}
</div>
);
} else if (this.props.propertyKey) {
const keys = Object.keys(value);
return (
<div className={<API key> ? styles.highlightArray : styles.array}>
<div onClick={this.onCollapseClick}>{this.props.propertyKey}: <strong>{'[ '}</strong></div>
{value.map((item, index) => this.renderItem(item, index, index < value.length - 1, this.props.path))}
<div><strong>{' ]'}</strong>{hasNext ? ',' : null}</div>
</div>
);
} else {
return (
<div className={<API key> ? styles.highlightArray : styles.array}>
<div onClick={this.onCollapseClick}><strong>{'[ '}</strong></div>
{value.map((item, index) => this.renderItem(item, index, index < value.length - 1, this.props.path))}
<div><strong>{' ]'}</strong>{hasNext ? ',' : null}</div>
</div>
);
}
}
}
@connect()
class Value extends React.Component {
static contextTypes = {
options: React.PropTypes.object.isRequired
}
constructor(props) {
super(props);
this.state = {
isEditing: false,
path: props.path.slice()
};
this.onSubmit = this.onSubmit.bind(this);
this.onBlur = this.onBlur.bind(this);
this.onClick = this.onClick.bind(this);
}
<API key>(nextProps, nextState) {
return (
nextProps.value !== this.props.value ||
nextState.isEditing !== this.state.isEditing ||
nextProps.path !== this.props.path
);
}
onClick() {
this.setState({
isEditing: this.context.options.canEdit ? true : false
});
}
onSubmit(value) {
this.props.signals.debugger.modelChanged({
path: this.state.path,
value
})
this.setState({isEditing: false});
connector.sendEvent('changeModel', {
path: this.state.path,
value: value
});
}
onBlur() {
this.setState({isEditing: false});
}
renderValue(value, hasNext) {
const <API key> = this.props.highlightPath && String(this.props.highlightPath) === String(this.props.path);
if (this.state.isEditing) {
return (
<div className={<API key> ? styles.highlightValue : null}>
{this.props.propertyKey ? this.props.propertyKey + ': ' : <span/>}
<span>
<JSONInput
value={value}
onBlur={this.onBlur}
onSubmit={this.onSubmit}/>
</span>
{hasNext ? ',' : null}
</div>
);
} else {
return (
<div className={<API key> ? styles.highlightValue : null}>
{this.props.propertyKey ? this.props.propertyKey + ': ' : <span/>}
<span onClick={this.onClick}>{isString(value) ? '"' + value + '"' : String(value)}</span>
{hasNext ? ',' : null}
</div>
);
}
}
render() {
let className = styles.string;
if (isNumber(this.props.value)) className = styles.number;
if (isBoolean(this.props.value)) className = styles.boolean;
if (isNull(this.props.value)) className = styles.null;
return (
<div className={className}>
{this.renderValue(this.props.value, this.props.hasNext)}
</div>
);
}
}
class Inspector extends React.Component {
static childContextTypes = {
options: React.PropTypes.object.isRequired
}
getChildContext() {
return {
options: {
expanded: this.props.expanded || false,
canEdit: this.props.canEdit || false
}
}
}
render() {
return renderType(this.props.value, false, [], null, this.props.path);
}
}
export default Inspector;
|
// Package storagedatalake implements the Azure ARM Storagedatalake service API version 2019-10-31.
// Azure Data Lake Storage provides storage for Hadoop and other big data workloads.
package storagedatalake
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// DefaultDNSSuffix is the default value for dns suffix
DefaultDNSSuffix = "dfs.core.windows.net"
)
// BaseClient is the base client for Storagedatalake.
type BaseClient struct {
autorest.Client
XMsVersion string
AccountName string
DNSSuffix string
}
// New creates an instance of the BaseClient client.
func New(xMsVersion string, accountName string) BaseClient {
return NewWithoutDefaults(xMsVersion, accountName, DefaultDNSSuffix)
}
// NewWithoutDefaults creates an instance of the BaseClient client.
func NewWithoutDefaults(xMsVersion string, accountName string, dNSSuffix string) BaseClient {
return BaseClient{
Client: autorest.<API key>(UserAgent()),
XMsVersion: xMsVersion,
AccountName: accountName,
DNSSuffix: dNSSuffix,
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.