Skip to content

Instantly share code, notes, and snippets.

@GabrielGil
GabrielGil / footer.html
Last active August 29, 2015 14:06
Using Addthis with Jetpack Infinite Scroll
@GabrielGil
GabrielGil / GG_Woocommerce_Product_Tab.php
Last active August 29, 2015 14:06
WooCoommerce Simple Product Tabs
<?php
/**
* GGWooCommerceProductTab class.
*
* Displays a new tab with an editor for every instance created and controls it saving.
*/
class GGWooCommerceProductTab
{
/**
<?php
// Add to functions.php
/*===================================================
Created by sk from Renegade Empire with help
from these sources:
http://docs.woothemes.com/document/editing-product-data-tabs/
http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N
@GabrielGil
GabrielGil / create_user_and_database.sh
Last active August 29, 2015 14:07
Bash recipe for MySQL creating user and database with privileges
#!/bin/bash
# CONNECTION to MySQL
DB_CON_USER=""
DB_CON_PASS=""
# THIS is what we want to create.
# @see http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
DB_NAME="" # Max. length. [1-9] (For unquoted)
DB_USER="" # Max. length. [1-9] (For unquoted)
@GabrielGil
GabrielGil / remove_user_and_database.sh
Created October 1, 2014 15:00
Bash recipe for MySQL removing user and database
#!/bin/bash
# MySQL connection details
DB_CON_USER=""
DB_CON_PASS=""
# What to delete?
DB_NAME=""
DB_USER=""
.config(function($stateProvider) {
$stateProvider.state('books.single.content.chapter.page', {
url: '/page/{pageId:int}',
resolve: {
Page: function(Chapter, $stateParams) {
return Chapter.one('pages', $stateParams.pageId).get()
}
},
onEnter: function(Page, Restangular, $document, $state, $mdDialog) {
//console.log("Entering state", Chapter.one('pages', $stateParams.pageId).get())
@GabrielGil
GabrielGil / postman-pre-request-script.js
Last active June 2, 2020 13:17
Refresh a JWT on Postman without having to input the token constantly on the header.
// Data location
const ENV_EMAIL = 'email';
const ENV_HOST = 'hostname';
const ENV_PASS = 'password';
const ENV_TOKEN = 'idToken';
/**
* Determine if a token is expired already
*/
function isTokenExpired(idToken) {