This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "bufio" | |
| "encoding/json" | |
| "encoding/xml" | |
| "fmt" | |
| "io" | |
| "os" | |
| "strings" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| forEach = function (percentages) { | |
| //1st we select fields we want add new values | |
| var fields = document.querySelectorAll(DOMStrings.expensesPercentageLabel); | |
| //The we pass a function on var eg nodeListForeach | |
| // we pass the fields list and we retrunt a callback function on secont parameter | |
| // we loop inside of fields and we pass on callback function the field index no and second | |
| // the current field value. | |
| var nodeListForeach = function (fields, callback) { | |
| for (var i = 0; i < fields.length; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Convert a template string into HTML DOM nodes | |
| * @param {String} str The template string | |
| * @return {Node} The template HTML | |
| */ | |
| stringToHTML (str) { | |
| let dom = document.createElement('div'); | |
| dom.innerHTML = str; | |
| return dom; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Select Needed Dom Elements | |
| const boxes = document.querySelectorAll('.box'); | |
| // ES5 | |
| var boxesArr5 =Array.prototype.slice.call(boxes); | |
| // ES6 | |
| const boxesArray6 = Array.from(boxes); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function assignArrayPropertiesToObject($array) | |
| { | |
| $class = new self::$get_class; | |
| if (!empty($array)) { | |
| foreach ($array as $prop => $value) { | |
| $class->$prop = $value; | |
| } | |
| } | |
| return $class; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Similar to`jQuery.get()`,`jQuery.post()`loads data from the server using a HTTP POST request. The code below demonstrates how to send a POST request to`page.php`when`button`is clicked. | |
| jQuery("button").click(function(){ | |
| jQuery.post("page.php", function(data, status){ | |
| alert("Data: " + data + "\\\\nStatus: " + status); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function selectRandomArrayItem(array) { | |
| return array[Math.floor(Math.random() * array.length)]; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| formatMoney = (amount, decimalCount = 2, decimal = ",", thousands = ".") => { | |
| try { | |
| decimalCount = Math.abs(decimalCount); | |
| decimalCount = isNaN(decimalCount) ? 2 : decimalCount; | |
| const negativeSign = amount < 0 ? "-" : ""; | |
| let i = parseInt(amount = Math.abs(Number(amount) || 0).toFixed(decimalCount)).toString(); | |
| let j = (i.length > 3) ? i.length % 3 : 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery( document ).ready(function() { | |
| jQuery( "#submit" ).click(function() { | |
| jQuery.post( "https://yoursite.com/yourpage.php", jQuery('#form').serialize()) | |
| .done(function( data ) { | |
| alert(data); | |
| }); | |
| return false; | |
| }); | |
| }); |
NewerOlder