Skip to content

Instantly share code, notes, and snippets.

View xhezairbey's full-sized avatar

Arian Xhezairi xhezairbey

View GitHub Profile
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
@xhezairbey
xhezairbey / maintenance.php
Created March 8, 2017 22:52
OSclass Theme Maintenance File
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
@xhezairbey
xhezairbey / gist:5b25ec0fdbc4bc6a21cf31d3ec33d430
Created February 13, 2017 21:01 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@xhezairbey
xhezairbey / dropzonejs-wp-rest-api.js
Created May 15, 2016 11:00 — forked from soderlind/dropzonejs-wp-rest-api.js
DropzoneJS & WordPress REST API
/*
Uploading images is a two step process (from https://github.com/WP-API/WP-API/issues/1768#issuecomment-160540932):
POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created.
PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}).
I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){}
*/
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute
// dropzoneWordpressForm is the configuration for the element that has an id attribute
// with the value dropzone-wordpress-form (or dropzoneWordpressForm)
Dropzone.options.dropzoneWordpressForm = {
//acceptedFiles: "image/*", // all image mime types
acceptedFiles: ".jpg", // only .jpg files
maxFiles: 1,
uploadMultiple: false,
maxFilesize: 5, // 5 MB
//addRemoveLinks: true,
//dictRemoveFile: 'X (remove)',
@xhezairbey
xhezairbey / uri.js
Created February 28, 2016 22:25 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@xhezairbey
xhezairbey / meta-data-serialization.php
Created November 30, 2015 18:23 — forked from tommcfarlin/meta-data-serialization.php
An example function used to demonstrate how meta data is typically saved in a WordPress theme or plugin. The gist is made public so that developers can contribute to the standard security boilerplate functionality in order to simplify, reduce, and improve our serialization functions.
<?php
/**
* An example function used to demonstrate how to use the `user_can_save` function
* that provides boilerplate security checks when saving custom post meta data.
*
* The ultimate goal is provide a simple helper function to be used in themes and
* plugins without the need to use a set of complex conditionals and constants.
*
* Instead, the aim is to have a simplified function that's easy to read and that uses
* WordPress APIs.
@xhezairbey
xhezairbey / pi.youtube.php
Last active November 2, 2015 18:10
Simple Statamic Plugin to embed YouTube videos from a given link.
<?php
class Plugin_youtube extends Plugin
{
var $meta = array(
'name' => 'Youtube',
'version' => '0.0.1',
'author' => 'Arian Xhezairi',
'author_url' => 'http://xhezairi.com'
);
@xhezairbey
xhezairbey / gist:26a23de617ea2d166d2b
Last active July 2, 2016 14:21 — forked from corsonr/gist:4648007
pre_get_posts 5
<?php
// http://www.remicorson.com/modifying-the-current-query-with-pre_get_posts/
// Load our function when hook is set
add_action( 'pre_get_posts', 'rc_modify_query_get_posts_by_date' );
// Modify the current query
function rc_modify_query_get_posts_older_than_today( $query ) {
// Check if on frontend and main query is modified
if( ! is_admin() && $query->is_main_query() ) {
@xhezairbey
xhezairbey / gist:7f037e8ee4537053b2a5
Last active August 29, 2015 14:27 — forked from urre/gist:44f6c6d87cc3c201122f
WordPress: Get posts from multisite sites (not main site)
<?php
$sites = wp_get_sites();
foreach($sites as $site) :
// Only subsites
if (!is_main_site($site['blog_id'])) :
// Connect to new multisite