Tutorial by Examples: code

enclosing shortcode The enclosing shortcode allows you to embed content within your shortcode, just like BBCode if you’ve ever used that. <?php function button_shortcode( $attr, $content = null ) { return '<a href="http://twitter.com/filipstefansson" class="twitter-button&qu...
By default, WordPress does not support shortcodes within Sidebar Widgets. It only expands the shortcodes within the content of a Post, Page, or custom post type. To add shortcode support to sidebar widgets, you can install a plugin, or use the below code: add_filter( 'widget_text', 'shortcode_unaut...
void DispatchToMainThread(std::function<void()> callback) { // any thread QTimer* timer = new QTimer(); timer->moveToThread(qApp->thread()); timer->setSingleShot(true); QObject::connect(timer, &QTimer::timeout, [=]() { // main thread ...
<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.goog...
<div> <form id="form1" runat="server"> <% for (int i = 1; i <= 10; j++) { Response.Write(i) + " "; } %> </form> <div>
public class Example { private FileLogging _logging; public Example() { this._logging = new FileLogging(); } }
On error move to labelled code and see if there is a specific error that needs to be handled. Public Const cErrCodeNotNumber = 2262 ' This value must be a number. Public Const cErrCodeNumericOverflow = 2263 ' The number is too large. Private Sub MySub() Dim objConn As ADODB.Connection ...
AWS Codecommit can be used as storage for private GIT repositories. The setup involves a few steps, assuming you have a valid AWS account already. Sign up for AWS Codecommit. Currently only region us-east-1 is available. Create a IAM user who will have access to the repositories, eg codecommit-u...
Atlassian SourceTree is a visual tool for Mac and Windows to manage source code repositories. This can be used with Codecommit as a remote repository but need to add an extra configuration option to the local repository in SourceTree to be able to connect with codecommit. First, setup Codecommit fo...
[MetadataType(typeof(RoleMetaData))] public partial class ROLE { } public class RoleMetaData { [Display(Name = "Role")] public string ROLE_DESCRIPTION { get; set; } [Display(Name = "Username")] public string ROLE_USERNAME { get; set; } } If you us...
add_shortcode is wp keyword. // recent-posts is going to be our shortcode. add_shortcode('recent-posts', 'recent_posts_function'); // This function is taking action when recent post shortcode is called. function recent_posts_function() { query_posts(array('orderby' => 'date', 'order' =&...
This functions takes parameter for how many recent posts you want to display. Ex : you want to display only five recent posts. Just passed the arguments with posts="5" (you can pass any number of recent posts that you want to display). Function fetch only five recent posts from database....
import pygame pygame.init() WIDTH = 300 HEIGHT = 200 SCREEN = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption('My Game') WHITE = (255, 255, 255) BLACK = (0, 0, 0) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 255) SCREEN.fill(R...
You'll first send the user to the Twitch authorization endpoint. This URL is made up of a the base authorization URL (https://api.twitch.tv/kraken/oauth2/authorize) and query string parameters that define what you're requesting. The required parameters are response_type, client_id, redirect_uri, and...
When the user goes to the authorization endpoint, they will be asked to give your application permission to the scopes that you've requested. They can decline this, so you must make sure to take that into consideration in your code. After they've allowed your application access, the user will be red...
Now that you have an authorization code, you can make a POST to the token endpoint (https://api.twitch.tv/kraken/oauth2/token) to get an OAuth token. You will receive a JSON-encoded access token, refresh token, and a list of the scopes approved by the user. You can now use that token to make authent...
if true; then echo Always executed fi if false; then echo Never executed fi
Go to Codeship.com and create an account (or login) Create a new project Import your project via Github or Bitbucket On the screen "Configure Your Tests" use these commands: Select "I want to create my own custom commands" from the "Select your technology to prepop...
Append the following command to the Codeship setup commands: meteor npm run mgp Now, we need to give Codeship access to these private repositories. There is a Codeship documentation article describing this process in detail but here are the steps that you have to take for Github: Create a new...
using Google.Contacts; using Google.GData.Client; using Google.GData.Contacts; using Google.GData.Extensions; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Web; using System.Web...

Page 13 of 21