Here's a way to show a GIF preloader while an AJAX call is executing.
We need to prepare our add and remove preloader functions:
function addPreloader() {
// if the preloader doesn't already exist, add one to the page
if(!document.querySelector('#preloader')) {
var preloaderHTML = '<...
The number that follows the associativity information describes in what order the operators are applied. It must always be between 0 and 9 inclusive. This is commonly referred to as how tightly the operator binds. For example, consider the following fixity declarations (in base)
infixl 6 +
infixl ...
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='user')
website = models.URLField(default='', ...
/*add this code to your function.php file
now your api will include transaction_id
*/
add_action( 'woocommerce_api_order_response', 'my_woocommerce_api_order', 10, 2);
function my_woocommerce_api_order( $data ) {
//you can do anything with the $data here lets add the transaction id
...
If you want to show local notification immediately, you should call:
Swift 3
UIApplication.shared.presentLocalNotificationNow(notification)
Swift 2
UIApplication.sharedApplication().presentLocalNotificationNow(notification)
Objective-C
[[UIApplication sharedApplication] presentLocalNotific...
2.1.3
1. Preview Different Devices
There is a preview panel at the right of the android studio. In thispanel there is a button with device name with which you are previewing the UI of your app like this .
Click on small dropdown indicator of this and a floating panel will appear with all the pr...
Find meaningful names for computation units.
Use for comprehensions or map to combine computations together.
Let's say you have something like this:
if (userAuthorized.nonEmtpy) {
makeRequest().map {
case Success(respone) =>
someProcessing(..)
if (resendToUser) {
...
By default:
Use val, not var, wherever possible. This allows you to take seamless advantage of a number of functional utilities, including work distribution.
Use recursion and comprehensionss, not loops.
Use immutable collections. This is a corrolary to using val whenever possible.
Focus on da...
In Solution Explorer go to your project, right click on References then Add reference…
Search for Compression and select System.IO.Compression.FileSystem then press OK.
Add Imports System.IO.Compression to the top of your code file (before any class or module, with the other Imports statements)....
.default-settings() {
padding: 4px;
margin: 4px;
font-size: 16px;
border: 1px solid gray;
}
#demo {
.default-settings;
}
The above example when compiled would only produce the following output. The .default-settings() mixin definition would not be output in the compiled CSS fi...
If you have a modern CPU or graphics card (GPU) inside your machine, chances are you have everything ready for first steps in OpenCL.
Finding out if your processor is OpenCL capable can be usually done via the manufacturer's homepage, a good first start is the official documentation at
https://www...
To obtain an instance of an HTTP Request, class Illuminate\Http\Request need to be type hint either in the constructor or the method of the controller.
Example code:
<?php
namespace App\Http\Controllers;
/* Here how we illuminate the request class in controller */
use Illuminate\Http\Re...
Each signed integer type may be represented in any one of three formats; it is implementation-defined which one is used. The implementation in use for any given signed integer type at least as wide as int can be determined at runtime from the two lowest-order bits of the representation of value -1 ...
[footag foo="value of 1" attribute-2="value of 2"]
In wordpress admin we use pre defined shortcodes by writing the shortcode name inside square brackets and optionally adding attributes to it separating by space.
However, x in the generator expression is not just variable, but can be any pattern. In cases of pattern mismatch the generated element is skipped over, and processing of the list continues with the next element, thus acting like a filter:
[x | Just x <- [Just 1, Nothing, Just 3]] -- [1, 3]
...
With Parallel List Comprehensions language extension,
[(x,y) | x <- xs | y <- ys]
is equivalent to
zip xs ys
Example:
[(x,y) | x <- [1,2,3] | y <- [10,20]]
-- [(1,10),(2,20)]
$ mplayer Lecture_video_part1.mkv
$ ^1^2^
mplayer Lecture_video_part2.mkv
This command will replace 1 with 2 in the previously executed command. It will only replace the first occurrence of the string and is equivalent to !!:s/1/2/.
If you want to replace all occurrences, you have to use !!:gs...
$ apt-get install r-base
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
$ sudo !!
sudo apt-get install r-base
[sudo] password for <user>: