Skip to content

Instantly share code, notes, and snippets.

Avatar

Gabriel GabrielGil

View GitHub Profile
@GabrielGil
GabrielGil / postman-pre-request-script.js
Last active Jun 2, 2020
Refresh a JWT on Postman without having to input the token constantly on the header.
View postman-pre-request-script.js
// 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) {
View gist:0e2428610decfb10f8ab0ee5e0a5f0dc
.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 / remove_user_and_database.sh
Created Oct 1, 2014
Bash recipe for MySQL removing user and database
View remove_user_and_database.sh
#!/bin/bash
# MySQL connection details
DB_CON_USER=""
DB_CON_PASS=""
# What to delete?
DB_NAME=""
DB_USER=""
@GabrielGil
GabrielGil / create_user_and_database.sh
Last active Aug 29, 2015
Bash recipe for MySQL creating user and database with privileges
View create_user_and_database.sh
#!/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)
View Woocommerce - output product variations in tab.php
<?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 / GG_Woocommerce_Product_Tab.php
Last active Aug 29, 2015
WooCoommerce Simple Product Tabs
View GG_Woocommerce_Product_Tab.php
<?php
/**
* GGWooCommerceProductTab class.
*
* Displays a new tab with an editor for every instance created and controls it saving.
*/
class GGWooCommerceProductTab
{
/**
@GabrielGil
GabrielGil / footer.html
Last active Aug 29, 2015
Using Addthis with Jetpack Infinite Scroll
View footer.html
You can’t perform that action at this time.