Tutorial by Examples

To add ws to your file's simply use: var ws = require('ws');
To open a new WebSocket, simply add something like: var WebSocket = require("ws"); var ws = new WebSocket("ws://host:8080/OptionalPathName); // Continue on with your code... Or to open a server, use: var WebSocketServer = require("ws").Server; var ws = new WebSocketS...
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({ port: 8080 }); // If you want to add a path as well, use path: "PathName" wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { console.log('received: %s', message); ...
Spinner It is a type of dropdown input. Firstly in layout <Spinner android:id="@+id/spinner" <!-- id to refer this spinner from JAVA--> android:layout_width="match_parent" android:layout_height="wrap_content"> </Spinner> ...
add_filter('comment_text','before_comment'); add_filter('comment_text','after_comment'); function before_comment($comment_text){ return 'input before comment'.$comment_text; } function after_comment($comment_text){ return $comment_text.'input after comment'; ...
add_action('wp_head','hook_javascript'); function hook_javascript() { $output="<script> alert('Page is loading...'); </script>"; echo $output; }
Using composer, execute the following command in the directory in which the application will be installed: composer create-project zendframework/zend-expressive-skeleton expressive-skeleton. During installation process, you will be asked to make various decisions. For the default installation qu...
<cfinvoke method="#somePrivateMethodName#"> <cfinvokeargument name="argument1" value="one"> </cfinvoke>
invoke("", somePrivateMethodName, {argument1='one'});
Assuming that you have node and npm installed and available, create a project folder with a valid package.json. Install the necessary dependencies: npm install --save-dev metalsmith metalsmith-in-place handlebars Create a file called build.js at the root of your project folder, containing the fo...
Basic docs can be found here app.get('/path/:id(\\d+)', function (req, res, next) { // please note: "next" is passed if (req.params.id == 0) // validate param return next(new Error('Id is 0')); // go to first Error handler, see below // Catch error on sync operation ...
app.use() and middleware can be used for "before" and a combination of the close and finish events can be used for "after". app.use(function (req, res, next) { function afterResponse() { res.removeListener('finish', afterResponse); res.removeListener('clos...
Unlike some other Bootstrap components like Buttons, the Alerts do not come with a default or primary styling, because they are meant to alert the user in a specific way. <div class="alert alert-success" role="alert"> Some action was completed successfully </div&g...
When required you can tell Docker to execute additional commands on an already running container using the exec command. You need the container's ID which you can get with docker ps. docker exec 294fbc4c24b3 echo "Hello World" You can attach an interactive shell if you use the -it option...
esc_html should be used anytime we're outputting data inside HTML code. <h4><?php echo esc_html( $title ); ?></h4>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">Home</a> <img src="<?php echo esc_url( $user_picture_url ); ?>" />
esc_js() is intended to be used for inline JS, inside a tag attribute. For data inside a <script> tag use wp_json_encode(). <input type="text" onfocus="if( this.value == '<?php echo esc_js( $fields['input_text'] ); ?>' ) { this.value = ''; }" name="name&quot...
<input type="text" value="<?php echo esc_attr($_POST['username']); ?>" />
<textarea><?php echo esc_textarea( $text ); ?></textarea>
String base64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; void setup() { Serial.begin(9600); // Turn the serial protocol ON Serial.println("Start Typing"); } void loop() { if (Serial.available() > 0) { // Check if data has bee...

Page 844 of 1336