Skip to content

Instantly share code, notes, and snippets.

View gedex's full-sized avatar
🏠
Working from home

Akeda Bagus gedex

🏠
Working from home
View GitHub Profile
@gedex
gedex / main.go
Created April 17, 2015 17:52
HTTP server that increments counter and serves the page with the counter rendered. Useful for verification if you've component that fetch external content with TTL.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"time"
)
<?php
/**
* Generate Data (users and posts).
*/
class Gen_Data_Command extends WP_CLI_Command {
const DEFAULT_GEN_NUM_USERS = 2;
const DEFAULT_GEN_NUM_POSTS = 1;
const GEN_USERS_OPTION = 'gen_data_users';
<?php
function bench_get_user_unpublished_posts( $n = 100 ) {
$text = "| %-20.20s | %-20.20s | %-20.20s\n";
printf( $text, 'Method', 'MemUsage', 'ExecTime' );
printf( $text, 'WP_Query', get_user_unpublished_posts_mem_usage_avg( $n, 'get_user_unpublished_posts_using_wp_query' ), get_user_unpublished_posts_exec_time_avg( $n, 'get_user_unpublished_posts_using_wp_query' ) );
printf( $text, 'WPDB', get_user_unpublished_posts_mem_usage_avg( $n, 'get_user_unpublished_posts_using_wpdb' ), get_user_unpublished_posts_exec_time_avg( $n, 'get_user_unpublished_posts_using_wpdb' ) );
}
function my_stripe_custom_callback( data ) {
alert( data.response.error.message );
data.form.unblock();
}
This file has been truncated, but you can view the full file.
Index: braintree_sdk/CHANGELOG.md
===================================================================
--- braintree_sdk/CHANGELOG.md (revision 1387260)
+++ braintree_sdk/CHANGELOG.md (working copy)
@@ -1,3 +1,25 @@
+## 3.8.0
+* Add payment method revoke
+* Add support for options in `submit_for_settlement` transaction flows
+* Add verification create API
+* Update https certificate bundle
@gedex
gedex / README.md
Last active April 17, 2016 06:20
Max clients in net/http
@gedex
gedex / -
Created April 27, 2016 05:21
Archive: trunk/product-packages/woocommerce-subscriptions/woocommerce-subscriptions.zip 1119640 249
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptionsassets/
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/
-rw---- 0.0 fat 4006 tx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/about.css
-rw---- 0.0 fat 20355 tx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/admin.css
-rw---- 0.0 fat 419 tx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/checkout.css
-rw---- 0.0 fat 867 tx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/wcs-upgrade.css
-rw---- 0.0 fat 2193 tx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/css/woocommerce-subscriptions.css
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptionsassets/images/
-rw---- 0.0 fat 40200 bx defN 23-Apr-16 04:55 woocommerce-subscriptionsassets/images/add-edit-subscription-screen.png
@gedex
gedex / -
Created April 27, 2016 05:23
Archive: trunk/product-packages/woocommerce-subscriptions/woocommerce-subscriptions.zip 1120284 250
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/
-rw---- 0.0 fat 4006 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/about.css
-rw---- 0.0 fat 20355 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/admin.css
-rw---- 0.0 fat 419 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/checkout.css
-rw---- 0.0 fat 867 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/wcs-upgrade.css
-rw---- 0.0 fat 2193 tx defN 23-Apr-16 04:55 woocommerce-subscriptions/assets/css/woocommerce-subscriptions.css
drwx--- 0.0 fat 0 bx stor 23-Apr-16 04:55 woocommerce-subscriptions/assets/images/
@gedex
gedex / colorized_tail
Last active May 3, 2016 12:13
Colorized PHP logs via tail
coloirzed_tail() {
tail -100f $1 | awk '
/PHP Fatal/ {print "\033[1;31m" $0 "\033[39m"; next}
/WordPress database error/ {print "\033[1;31m" $0 "\033[39m"; next}
/PHP Notice/ {print "\033[1;33m" $0 "\033[39m"; next}
/PHP Warning/ {print "\033[1;33m" $0 "\033[39m"; next}
1 {print}
'
1c1
< !function(){function t(e,n){e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}function e(t,e,n,i,o){this.stream=t,this.header=e,this.length=n,this.tag=i,this.sub=o}function n(t){var e,n,i="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),i+=et.charAt(n>>6)+et.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),i+=et.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),i+=et.charAt(n>>2)+et.charAt((3&n)<<4));(3&i.length)>0;)i+=nt;return i}function i(t){var e,n,i,o="",r=0;for(e=0;e<t.length&&t.charAt(e)!=nt;++e)i=et.indexOf(t.charAt(e)),0>i||(0==r?(o+=l(i>>2),n=3&i,r=1):1==r?(o+=l(n<<2|i>>4),n=15&i,r=2):2==r?(o+=l(n),o+=l(i>>2),n=3&i,r=3):(o+=l(n<<2|i>>4),o+=l(15&i),r=0));return 1==r&&(o+=l(n<<2)),o}function o(t){var e,n=i(t),o=new Array;for(e=0;2*e<n.length;++e)o[e]=parseInt(n.substring(2*e,2*e+2),16);return o}function r(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(