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
<?php | |
function slug($data, $max_length = 100){ | |
// Convert the string to lowercase | |
$string = mb_strtolower($data, 'UTF-8'); | |
// Create a transliterator for UTF-8 to ASCII | |
$transliterator = Transliterator::create('NFD; [:Nonspacing Mark:] Remove; NFC; Any-Latin; Latin-ASCII;'); | |
// Transliterate the string | |
$string = $transliterator->transliterate($string); |
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
var consoleLog = document.getElementById('console_log'); | |
console = { | |
log: function (text) { | |
let consoleLine = document.createElement('pre'); | |
consoleLine.setAttribute('class', 'console-line'); | |
consoleLine.innerText = (typeof text === 'object' ? JSON.stringify(text, null, 4) : text); | |
consoleLog.appendChild(consoleLine); | |
} | |
}; |
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 buildJsonFromUrlQuery(query){ | |
if(!query || typeof query !== 'string' || !query.length) return {}; | |
var partsArray = query.split('&'); | |
var partsObject = {}; | |
for(let i in partsArray){ | |
let thisPart = partsArray[i]; | |
let keyValue = thisPart.split('='); | |
let key = decodeURI(keyValue[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
function buildUrlQueryFromJson(data, opening_array, encode){ | |
let output = []; | |
if(typeof encode === 'undefined') encode = false; | |
if(typeof opening_array !== 'string') opening_array = ''; | |
let next_opening_array = ''; | |
if((typeof data === 'object' || Array.isArray(data)) && data !== null){ | |
for(var i in data){ | |
if(opening_array.length) | |
next_opening_array = opening_array+'['+encodeURIComponent(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
function regexMatchAll(regex, subject){ | |
let matches = [...subject.matchAll(regex)]; | |
let result = []; | |
for(let i=0;i<matches.length;i++){ | |
result.push(matches[i][0]); | |
} | |
return result; | |
} |
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
//jsFiddle link: https://jsfiddle.net/tanmayszone/rvpbdc9u/ | |
function buildJsonFromUrlQuery(query){ | |
if(!query || typeof query !== 'string' || !query.length) return {}; | |
var partsArray = query.split('&'); | |
var partsObject = {}; | |
for(let i in partsArray){ | |
let thisPart = partsArray[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
/* | |
Perceptron Leanrning Algorithm | |
By Tanmay Chakrabarty | |
Compiled and Ran succesfully with C++ compiler @https://www.onlinegdb.com/ | |
*/ | |
#include<iostream> | |
using namespace std; |
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
<?php | |
function _process_toposort($pointer, &$dependency, &$order, &$pre_processing, &$reportError){ | |
if(in_array($pointer, $pre_processing)) return false; | |
else $pre_processing[] = $pointer; | |
if(isset($dependency[$pointer])){ | |
if(is_array($dependency[$pointer])){ | |
foreach($dependency[$pointer] as $master){ | |
if(isset($dependency[$master])){ | |
if(!_process_toposort($master, $dependency, $order, $pre_processing, $reportError)) { |
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
Imports | |
MySql.Data | |
Public Class Form1 | |
Dim sql As String | |
Dim sql_connection As MySqlClient.MySqlConnection | |
Dim sql_command As MySqlClient.MySqlCommand | |
Dim sql_reader As MySqlClient.MySqlDataReader | |
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load | |
sql_connection = New MySqlClient.MySqlConnection("Data Source=localhost;user id=root;database=my_test_projects;") |
NewerOlder