Skip to content

Instantly share code, notes, and snippets.

View tamimibrahim17's full-sized avatar
🎯
Focusing

Tamim Ibrahim tamimibrahim17

🎯
Focusing
  • Tikweb
  • Bangladesh
View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@mattattui
mattattui / gist:879259
Last active July 11, 2017 08:03
Example PHP cURL function
<?php
// See https://lazycat.org/php-curl.html for license & known issues
// P.S. You'd better have a very good reason for using this instead of http://guzzlephp.org/
function httpGet($url, $ttl = 86400)
{
/* Change this or make it an option as appropriate. If you're
* getting urls that shouldn't be visible to the public, put the
* cache folder somewhere it can't be accessed from the web
*/
@jorgepedret
jorgepedret / gist:1016695
Created June 9, 2011 13:07
Gravity Forms Custom Fields
<?php
add_action("gform_field_input", "ih_gform_field_input", 10, 5);
function ih_gform_field_input($input, $field, $value, $lead_id, $form_id){
//wp_debug($field);
if($field["type"] == "vehicleyear"){
//wp_debug($field['choices']);
//$input = 'Aha!';
}
return $input;
}
@niieani
niieani / gist:1213709
Created September 13, 2011 12:33
PHP Camel Case functions
<?php
// source: http://www.paulferrett.com/2009/php-camel-case-functions/
/**
* Translates a camel case string into a string with underscores (e.g. firstName -&gt; first_name)
* @param string $str String in camel case format
* @return string $str Translated into underscore format
*/
function from_camel_case($str) {
$str[0] = strtolower($str[0]);
@mikejolley
mikejolley / functions.php
Last active April 23, 2018 13:31
WooCommerce - Custom tracking code
add_action( 'woocommerce_thankyou', 'my_custom_tracking' );
function my_custom_tracking( $order_id ) {
// Lets grab the order
$order = wc_get_order( $order_id );
/**
* Put your tracking code here
* You can get the order total etc e.g. $order->get_total();
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@mikejolley
mikejolley / gist:3097073
Last active January 18, 2024 17:54
WooCommerce - Unhook/Disable emails
/**
* Code goes in functions.php or a custom plugin.
*/
add_action( 'woocommerce_email', 'unhook_those_pesky_emails' );
function unhook_those_pesky_emails( $email_class ) {
/**
* Hooks for sending emails during store events
**/
@gbarrancos
gbarrancos / gist:3277138
Created August 6, 2012 17:57
7 Tips for Successful Self Learning

7 Tips for Successful Self Learning - by Bradford Cross

No matter what, you're going to have to learn most everything on your own anyway. Self-learning is hard. Regardless of where, when or how you learn - being a good self-learner will maximize your potential.

In this post, Hamilton Ulmer (an almost-done Stanford stats masters student) and I, will explore seven ways to become a great self-learner.

The longest path is the shortest and the shortest path is the longest

@ChromeOrange
ChromeOrange / functions.php
Created August 20, 2012 10:21
Managing WooCommerce Product Tabs
<?php
/**
* Standard Tab Code from woocommerce-hooks.php
*/
/* Product page tabs */
add_action( 'woocommerce_product_tabs', 'woocommerce_product_description_tab', 10 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_attributes_tab', 20 );
add_action( 'woocommerce_product_tabs', 'woocommerce_product_reviews_tab', 30 );
add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_description_panel', 10 );
@deanet
deanet / google.sh
Created August 22, 2012 16:09
Uploading File into Google Drive (because grive too many dependencies qt, xorg ? )
#!/bin/bash
## uploading to google
## rev: 22 Aug 2012 16:07
det=`date +%F`
browser="Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:13.0) Gecko/20100101 Firefox/13.0.1"
username="user@domain-apps.com"
password="password"
accountype="HOSTED" #gooApps = HOSTED , gmail=GOOGLE