Skip to content

Instantly share code, notes, and snippets.

View amiut's full-sized avatar
🎯
Focusing

Amin Abdolrezapoor amiut

🎯
Focusing
View GitHub Profile
@0xnbk
0xnbk / .php
Created October 7, 2010 03:38
PHP code to query goo.gl to shorten an url ( your php api for google url shortening )
<?php
// uses Google's http://goo.gl/ URL shortener
/* Enter your url below */
$url = "aroundtheweb.info";
/* Function to get the short url */
function get_short_url($url) {
$ch = curl_init("http://goo.gl/api/url?url=" . urlencode($url));
curl_setopt($ch, CURLOPT_POST ,1);
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@igorbenic
igorbenic / clauses.php
Last active February 21, 2024 21:34
Extending WP_Query with Custom Queries and Tables | https://www.ibenic.com/extending-wp-query-custom-queries-tables
<?php
add_filter( 'posts_clauses', 'filter_clauses', 10, 2 );
/**
* Filtering everything.
*
* @param array $clauses Array with all parts of the query.
* @param WP_Query $wp_query Object.
* @return string
# Delete missing files
svn status | ? { $_ -match '^!\s+(.*)' } | % { svn rm $Matches[1] }
# Added new files
svn status | ? { $_ -match '^\?\s+(.*)' } | % { svn add $Matches[1] }
# Commit repository
svn commit -m "This commit is done by a PowerShell bat"
@siaeb
siaeb / woocommerce_scripts_cleaner.php
Last active February 12, 2023 08:40
Restrict WooCommerce Scripts
function woo_scripts_cleaner() {
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
$woo_styles = [
'woocommerce_frontend_styles',
'woocommerce-general',
'woocommerce-layout',
'woocommerce-smallscreen',
'woocommerce_fancybox_styles',
'woocommerce_chosen_styles',