Skip to content

Instantly share code, notes, and snippets.

View sajdoko's full-sized avatar

Sajmir Doko sajdoko

View GitHub Profile
@sajdoko
sajdoko / pdo_db.php
Created May 11, 2018 08:50 — forked from bradtraversy/pdo_db.php
PDO Class
<?php
/*
* PDO DATABASE CLASS
* Connects Database Using PDO
* Creates Prepeared Statements
* Binds params to values
* Returns rows and results
*/
class Database {
private $host = DB_HOST;
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@sajdoko
sajdoko / Theme_Customization_API.php
Created June 26, 2018 15:46
Wordpress Customizer API Sanitization Examples
<?php
///////////////////////////////
// HOW TO SANITIZE RADIO BOX //
///////////////////////////////
function theme_slug_customizer($wp_customize) {
//your section
$wp_customize->add_section(
'theme_slug_customizer_your_section',
array(
'title' => esc_html__('Your Section', 'theme_slug'),
@sajdoko
sajdoko / sample.md
Last active May 16, 2019 12:29 — forked from bradtraversy/sample.md
Markdown Cheat Sheet

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

This text is italic

@sajdoko
sajdoko / pdocrash.php
Created July 8, 2018 11:41 — forked from bradtraversy/pdocrash.php
PDO & Prepared Statements Snippets
<?php
$host = 'localhost';
$user = 'root';
$password = '123456';
$dbname = 'pdoposts';
// Set DSN
$dsn = 'mysql:host='. $host .';dbname='. $dbname;
// Create a PDO instance
@sajdoko
sajdoko / ssh.txt
Created July 8, 2018 18:35 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets
# Login via SSH with password (LOCAL SERVER)
> ssh brad@192.168.1.29
# Create folder, file, install Apache (Just messing around)
mkdir test
cd test
touch hello.txt
sudo apt-get install apache2
# Generate Keys
@sajdoko
sajdoko / webdev_online_resources.md
Created July 17, 2018 12:45 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)
function ImportCSV2Array($filename) {
$row = 0;
$col = 0;
$handle = @fopen($filename, "r");
if ($handle) {
while (($row = fgetcsv($handle, 4096)) !== false) {
if (empty($fields)) {
$fields = $row;
continue;
}
@sajdoko
sajdoko / app.js
Last active June 24, 2020 19:58
Custom HTTP Library (Ajax With Callbacks)
const http = new easyHTTP();
// Get Posts
http.get("https://jsonplaceholder.typicode.com/posts", function(err, posts) {
if (err) {
console.log(err);
} else {
console.log(posts);
}
});
@sajdoko
sajdoko / group.php
Last active December 28, 2020 08:34
Skript qe krijon grupet dhe grupon sitet sipas plugineve
<?php
$host = '';
$dbname = '';
$user = '';
$password = '';
try {
$pdo = new PDO("mysql:host=" . $host . ";dbname=" . $dbname, $user, $password);
} catch (PDOException $e) {
die("ERROR: Could not connect. " . $e->getMessage());