Skip to content

Instantly share code, notes, and snippets.

View gdarko's full-sized avatar
🤖
grinding

Darko Gjorgjijoski gdarko

🤖
grinding
View GitHub Profile
@gdarko
gdarko / cloudflare-update-record.sh
Last active March 2, 2018 00:20 — forked from benkulbertis/cloudflare-update-record.sh
Cloudflare API v4 Dynamic DNS Update in Bash
#!/bin/bash
# CHANGE THESE
auth_email="user@example.com"
auth_key="c2547eb745079dac9320b638f5e225cf483cc5cfdda41" # found in cloudflare account settings
zone_name="$1"
record_name="$2"
# MAYBE CHANGE THESE
ip=$(curl -s http://ipv4.icanhazip.com)
@gdarko
gdarko / methods.php
Last active May 2, 2018 14:23
WordPress REST Route Example
<?php
function dg_get_data() {
return array(
'name' => 'Darko Gjorgjijoski',
'age' => 23
);
}
@gdarko
gdarko / create_user.sh
Created October 28, 2017 16:22 — forked from divyavanmahajan/create_user.sh
Turnkey OpenVPN - Add new users. It creates two OVPN files - with and without proxy and also generates the URLs to download them. Safely use for existing users - it just creates the OVPN files.
#!/bin/bash -e
fatal() { echo "FATAL: $@" 1>&2; exit 1; }
warn() { echo "WARN: $@"; }
info() { echo "INFO: $@"; }
usage() {
cat <<EOF
Usage: sudo $0 client_or_profile_name
This will create two ovpn files in this directory (proxy and noproxy).
@gdarko
gdarko / DG_PageTemplater.php
Last active October 20, 2017 07:56
Register WordPress page templates outside the theme
<?php
/**
* This class can be used to register a template outside WordPress theme.
*
* NOTE: This class is fork of the original class which was hardcoded to look for
* the template in the plugin directory. After the modifications i added
* the possiblity new templates to be registered using hook.
*
* @author gdarko
*
@gdarko
gdarko / style.css
Created October 11, 2017 20:03
WordPress Awesome Comment Styling
ol.comment-list {
list-style: none;
background: #f7f7f7;
padding: 10px;
float: left;
width: 100%;
}
.comment-metadata {
text-align: right;
@gdarko
gdarko / unzip_download.php
Last active May 2, 2022 18:42
Unzip php file
<?php
set_time_limit(0);
function unzipFile( $file, $dir = null ) {
if ( is_null( $dir ) ) {
$dir = dirname( __FILE__ );
}
$dir = $dir . DIRECTORY_SEPARATOR . 'unzipped';
@gdarko
gdarko / backup.sh
Created September 4, 2017 10:02
VestaCP / BackupWordPress simple backup tool
#!/bin/bash
site=$1
absdir=`pwd`
fulldir="$absdir/$site/public_html/wp-content/backupwordpress*backups"
pubdir="$absdir/$site/public_html"
echo "Running backup"
echo $fulldir
@gdarko
gdarko / square-hover-boces.html
Last active August 19, 2017 09:12
Beautiful CSS Hover Boxes
<!DOCTYPE html>
<html>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Playball" rel="stylesheet">
<!-- Bootstrap CSS -->
@gdarko
gdarko / style.css
Last active July 23, 2017 13:06
WordPress Social Sharing Icons
/**
* This is very basic styling
*/
.dg-sharing-icons ul.dg-sharing-icons-inner li i.fa {
color: gray;
}
.dg-sharing-icons ul.dg-sharing-icons-inner li {
display: inline-block;
margin-right: 15px;
}
@gdarko
gdarko / file-upload.css
Last active March 11, 2023 21:11
WordPress Custom Profile Image Ajax Upload
.upload-thumb {
display: inline-block;
width: 120px;
height: 120px;
overflow: hidden;
background: #e2e2e2;
border: 1px solid #cdcdcd;
line-height: 120px;
margin-bottom: 10px;
}