Skip to content

Instantly share code, notes, and snippets.

View v9n's full-sized avatar
🛫
forward email at mailwip.com

Vinh v9n

🛫
forward email at mailwip.com
View GitHub Profile
@v9n
v9n / wordpress_get_current_category.php
Created December 29, 2010 01:46
Get current category ID in Wordpress outside the loop
<?php
$current = get_query_var('cat');
?>
@v9n
v9n / comic_download.sh
Created March 4, 2011 00:03
Comic Download
#!/bin/sh
#http://60s.com.vn/image/truyentranh/comic/1zdsssdfxfdyhxjtgiu87xaxz65tx0dfgtthyux761xx/daubeptrudanh/tap9/img/Untitled-24.jpg
hashKey='1zdsssdfxfdyhxjtgiu87xaxz65tx0dfgtthyux761xx'
comicName='daubeptrudanh'
episode=1
maxEpisode=37
startPage=1
@v9n
v9n / fixhtml5.js
Created March 18, 2011 20:52
Fix IE error when getting HTML5 content via XHR
function fixHTML5(content) {
var html5element = ['nav','section', 'header','article','footer'];
var attributes = ['id', 'class'];
$.each(html5element, function (index, tag) {
var re = new RegExp('<(\/?)'+tag+'([^>]*)>', 'g');
content = content.replace(re, '<$1span tag="'+tag+'"$2>');
})
$('#context-panel').html(content);
<?php
Route::set('profile', '<username>', array('username' => '([a-zA-Z0-9\-_\.]+)') )
->defaults(array(
'controller' => 'profile',
'action' => 'index'
));
Route::set('default', '(<controller>(/<action>))')
->defaults(array(
'controller' => 'welcome',
<?php
$username = 'kureikain';
$apikey = 'xxx';
class Axcoto_Envato_Api {
public function __construct($attb) {
$this->_attb = $attb;
}
public function fetch($method, $param = array()) {
@v9n
v9n / gist:933491
Created April 21, 2011 01:42
media_row_actíons hook
add_filter ('media_row_actions','add_direct_link', 10, 3 );
function add_direct_link( $actions, $post, $detached ) {
$actions['file_url'] = '<a href="' . wp_get_attachment_url($post->ID) . '">Link</a>';
return $actions;
}
@v9n
v9n / paypal_secret.php
Created June 4, 2011 05:29
Generate checkout link and use with Secret Paypal
<?php
include '../secretpaypal/paypal.php';
$paypal = new SecretPaypal();
$checkoutLink1 = $paypal->getLink('book1.pdf',
array(
'amount' => 29.99,
'item_name' => 'My Book',
'return' => 'http://house.axcoto.com/example/return.html',
'cancel_return' => 'http://house.axcoto.com/example/cancel.html',
)
@v9n
v9n / error.log
Created June 19, 2011 18:26
nginx
2011/06/19 11:32:58 [emerg] 7210#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2011/06/19 11:32:58 [emerg] 7210#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2011/06/19 11:32:58 [emerg] 7210#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2011/06/19 11:32:58 [emerg] 7210#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2011/06/19 11:32:58 [emerg] 7210#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2011/06/19 11:32:58 [emerg] 7210#0: still could not bind()
~
@v9n
v9n / Apache
Created June 19, 2011 19:56
Nginx vs Apache
[kureikain@axcoto ~]$ /usr/local/apache2/bin/ab -n 10000 -c 20 http://live.axcoto.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking live.axcoto.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@v9n
v9n / LICENSE.txt
Created August 2, 2011 14:53 — forked from 140bytes/LICENSE.txt
Element Filter
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE