Skip to content

Instantly share code, notes, and snippets.

View kostasx's full-sized avatar
💭
Uncaught ReferenceError

Kostas Minaidis kostasx

💭
Uncaught ReferenceError
View GitHub Profile
remove_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30);
remove_action( 'woocommerce_product_tab_panels', 'woocommerce_product_reviews_panel', 30);
@kostasx
kostasx / wordpress-get-categories
Created April 24, 2014 15:47
Wordpress - Get product categories
global $post;
$product_categories = get_the_terms( $post->ID, 'product_cat' );
foreach ( $product_categories as $product_category ) {
echo $product_category->name;
echo $product_category->slug;
echo $product_category->term_id;
@kostasx
kostasx / nw-package.json.sublime-snippet
Last active August 29, 2015 14:00
SublimeText - package.json for Node-Webkit Snippet
<snippet>
<content><![CDATA[
{
// REQUIRED (BASIC) FIELDS
"main": "${1:index.html}",
"name": "${2:nw-demo}",
// OPTIONAL FIELDS
@kostasx
kostasx / chrome search settings
Last active August 29, 2015 14:01
Chrome Search Engine Settings
/* DEVELOPMENT */
NPM (npm)
https://www.npmjs.org/search?q=%s
Unheap (unheap)
http://www.unheap.com/?s=%s
/* GENERAL */
Search for english word on StackExchange
@kostasx
kostasx / mailchimp-login.js
Created June 3, 2014 09:58
MailChimp - Auto Login Bookmark
javascript:(function(){email=document.getElementById("username");email.value="enter_username_here";pass=document.getElementById("password");pass.value="enter_password_here";document.getElementsByTagName('form')[0].submit();})()
(function(RGX_COMMENT, RGX_TRIM) {
getComments = function (fn, opt_trim) {
var comments = [];
(fn + '').replace(RGX_COMMENT, function(m, a, b, c) {
if (!c) {
m = a == undefined ? b : a;
comments.push(opt_trim ? m.replace(RGX_TRIM, '') : m);
}
});
return comments;
@kostasx
kostasx / gist:361da6eca0480d57c97e
Created September 18, 2014 02:38
Javascript boolean caster
/*
* Convert values: 1, 0, true, false, "1", "0", "true", "false", "TRUE", "FALSE", "True", "False"
* "ON", "OFF", "On", "Off", negative numbers, positive numbers, to booleans with a single JS line.
* Easily extensible with new truthy values.
*/
function checkBool(val){
return ({1:1,true:1,on:1,yes:1}[(((typeof val !=="number")?val:(val>0))+"").toLowerCase()])?true:false;
};
@kostasx
kostasx / gist:c03ae460676c2bb77570
Created October 6, 2014 09:37
Node.js - Get File using HTTP
var http = require('http');
var fs = require('fs');
var file = fs.createWriteStream("image.jpg");
var request = http.get("http://domain.com/custom.jpg", function(res) {
res.pipe(file);
});
@kostasx
kostasx / gist:f5b020c3fbd31e0bb428
Last active August 29, 2015 14:07
Node.js - Get File using HTTPS
var https = require('https');
var fs = require('fs');
var options = {
hostname : 'wordpress.org',
port : 443,
path : '/latest.zip',
method : 'GET'
};
var file = fs.createWriteStream("wp_latest.zip");