Register a production/sandbox account at https://dashboard.stripe.com/register
Insert below code into your webpage where you want to have a checkout button.
<form action="/charge" method="POST">
<script
src="https://checkout.stripe.com/checkout.js" cl...
The unchecked keyword prevents the compiler from checking for overflows/underflows.
For example:
const int ConstantMax = int.MaxValue;
unchecked
{
int1 = 2147483647 + 10;
}
int1 = unchecked(ConstantMax + 10);
Without the unchecked keyword, neither of the two addition operations will co...
enable_shared_from_this enables you to get a valid shared_ptr instance to this.
By deriving your class from the class template enable_shared_from_this, you inherit a method shared_from_this that returns a shared_ptr instance to this.
Note that the object must be created as a shared_ptr in first pl...
The most feasible way is to use, the DateTime class.
An example:
<?php
// Create a date time object, which has the value of ~ two years ago
$twoYearsAgo = new DateTime("2014-01-18 20:05:56");
// Create a date time object, which has the value of ~ now
$now = new DateTime("2016...
Large fluent assertions do become harder to read, but when combined with classes that have good implementations of ToString(), they can generate very useful error messages.
[Test]
public void AdvancedContraintsGiveUsefulErrorMessages() {
Assert.That(actualCollection, Has
.Count.Equa...
[1, 2, [[3, 4], [5]], 6].flatten # => [1, 2, 3, 4, 5, 6]
If you have a multi-dimensional array and you need to make it a simple (i.e. one-dimensional) array, you can use the #flatten method.
If targeting Flash Player 11+, the built-in removeChildren method is the best way to remove all children:
removeChildren(); //a start and end index can be passed
For legacy applications, the same can be accomplished with a loop:
while (numChildren > 0) {
removeChildAt(0);
}
3.0
Swift 3 introduces the CountedSet class (it's the Swift version of the NSCountedSet Objective-C class).
CountedSet, as suggested by the name, keeps track of how many times a value is present.
let countedSet = CountedSet()
countedSet.add(1)
countedSet.add(1)
countedSet.add(1)
countedSet.a...
The List.fold_left and List.fold_right functions are higher-order functions that implement the outer logic of list aggregation. Aggregating a list, sometimes also referred to as reducing a list, means computing a value derived from the sequential inspection of all items in that list.
The documenta...
In Elm, reducing functions are called "folds", and there are two standard methods to "fold" values up: from the left, foldl, and from the right, foldr.
> List.foldl (+) 0 [1,2,3]
6 : number
The arguments to foldl and foldr are:
reducing function: newValue -> accumul...
Unfortunately ActionScript 3 does not have a concept of generics, so it follows that there is no way to define a typed array as Array<T>. There is however a special class Vector.<T> which works in a similar way except you must provide a reference to a concrete class when instantiating th...
This is MATLAB's long-winded way of saying that it cannot find the function that you're trying to call. There are a number of reasons you could get this error:
That function was introduced after your current version of MATLAB
The MATLAB online documentation provides a very nice feature which allow...
It is also possible to create archives of other items than HEAD, such as branches, commits, tags, and directories.
To create an archive of a local branch dev:
git archive --output=archive-dev.zip --prefix=src-directory-name dev
To create an archive of a remote branch origin/dev:
git archive --...
Sometimes you just need a diff to apply using patch. The regular git --diff does not work. Try this instead:
git diff --no-prefix > some_file.patch
Then somewhere else you can reverse it:
patch -p0 < some_file.patch
It's a regular pattern in design these days to vertically align call to actions inside its containing cards like this:
This can be achieved using a special trick with flexbox
HTML
<div class="cards">
<div class="card">
<p>Lorem ipsum Magna proident ...
Screen shot: Option 1 (pure adb)
The shell adb command allows us to execute commands using a device's built-in shell. The screencap shell command captures the content currently visible on a device and saves it into a given image file, e.g. /sdcard/screen.png:
adb shell screencap /sdcard/screen.png...
If you want to create multiple uploads, first thing you might want to do is create new model and set up relations
Let's say you want an multiple images for the Product model. Create an new model and make it belongs_to your parent model
rails g model ProductPhoto
#product.rb
has_many :product_p...