Skip to content

Instantly share code, notes, and snippets.

View amostajo's full-sized avatar
💣
I may be slow to respond.

Ale Mostajo amostajo

💣
I may be slow to respond.
View GitHub Profile
@amostajo
amostajo / sample.php
Last active May 7, 2019 16:50
Displaying license information
<?php
$license = get_option( WNT_FUNCTION );
if ( empty( $license ) ) {
// No license has been activated
// You can display the activation form
@amostajo
amostajo / script.php
Last active March 12, 2019 07:54
PHP license key client: Quick script tutorial
<?php
use LicenseKeys\Utility\Api;
use LicenseKeys\Utility\Client;
use LicenseKeys\Utility\LicenseRequest;
// -------------------------------------
// -------------------------------------
// -------------------------------------
// -------------------------------------
@amostajo
amostajo / plugin.php
Created October 2, 2018 17:47
Add order / customer data on License Key response.
<?php
/*
Plugin Name: Customizations
Description: Customizations made to plugins or theme using Wordpress hooks.
Version: 9000
*/
// -----------------------------------------------
// ADD CUSTOMER & ORDER INFORMATION TO RESPONSE
// -----------------------------------------------
@amostajo
amostajo / functions.php
Created May 29, 2018 16:37
Post Gallery: Enqueues everything.
<?php
add_action( 'post_gallery_enqueue', function() {
// CSS
wp_enqueue_style(
'lightgallery', // Name / slug
get_stylesheet_directory_uri() . '/node_modules/lightgallery/dist/css/lightgallery.min.css', // File location
[], // Dependency
'1.6.11' // Version
);
// js
@amostajo
amostajo / lightbox-init.js
Created May 29, 2018 16:34
Post Gallery: Initialize custom lightbox.
(function($) { $(document).ready(function() {
//Initialize for every .post-gallery found.
$('.post-gallery').each(function() {
// Init lightGallery with thumbnail option set to true.
$(this).lightGallery({
thumbnail:true
});
});
@amostajo
amostajo / functions.php
Created May 29, 2018 16:06
Post Gallery: Enqueue custom lightbox
<?php
add_action( 'post_gallery_enqueue', function() {
// CSS
wp_enqueue_style(
'lightgallery', // Name / slug
get_stylesheet_directory_uri() . '/node_modules/lightgallery/dist/css/lightgallery.min.css', // File location
[], // Dependency
'1.6.11' // Version
);
@amostajo
amostajo / timezone-fix.java
Created March 31, 2018 16:55
Android's date time value fix based on timezone differences.
// Needed
import java.util.Calendar;
import java.util.TimeZone;
// Initialize calendar instance and set your datetime value
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(dateTimeValue);
// Initialize timezone with your timezone value
TimeZone tz = TimeZone.getTimeZone("America/New_York");
@amostajo
amostajo / gallery.php
Created March 23, 2018 15:08
Lightbox2 in Post Gallery plugin view
@amostajo
amostajo / enqueue.php
Last active March 23, 2018 15:01
Enqueue Lightbox2 in Post Gallery Plugin
<?php
/**
* @hook post_gallery_enqueue
*/
function enqueue_lightbox() {
wp_enqueue_style(
'lightbox',
'https://cdnjs.cloudflare.com/ajax/libs/lightbox2/2.10.0/css/lightbox.min.css',
[],
'2.10.0'
@amostajo
amostajo / functions.js
Last active March 14, 2018 15:50
Plexus sample / firebase
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const bigquery = require('@google-cloud/bigquery')();
const cors = require('cors')({ origin: true });
admin.initializeApp(functions.config().firebase);
const db = admin.database();
/**