#CURL Connections with Tor
Install Apache, PHP, CURL & Tor with apt-get
sudo apt-get install -y apache2 php php-curl torTor creates a proxy on your mashine with port 9050 for SOCKS5 connections.
| <?php | |
| function get_url_contents($url){ | |
| if (function_exists('file_get_contents')) { | |
| $result = @file_get_contents($url); | |
| } | |
| if ($result == '') { | |
| $ch = curl_init(); | |
| $timeout = 30; | |
| curl_setopt($ch, CURLOPT_URL, $url); |
| { | |
| "01-01": ["Afra", "Afrodīte", "Agunda", "Agurs", "Januārija", "Laimstars", "Soleda", "Solita", "Solveta"], | |
| "01-02": ["Induls", "Īva", "Ivaise", "Ivija", "Īvija", "Ivika", "Īvis", "Ivisa", "Ivs"], | |
| "01-03": ["Ambrozijs", "Ammonārija", "Ammunārija", "Mežvaldis", "Mieriņš", "Miermīlis", "Miernesis", "Miervalds", "Ringla", "Ringo", "Rinolds"], | |
| "01-04": ["Amina", "Amīna", "Amirans", "Amirs", "Blāzma", "Ilveta", "Ilvis", "Spodrīte"], | |
| "01-05": ["Amrita", "Amunds", "Anarita", "Saimona", "Saimons", "Seimanis", "Semions", "Semjons", "Simeons", "Simions", "Zintauts", "Zinturs"], | |
| "01-06": ["Arams", "Aranta", "Arfa", "Arnīda", "Arnija", "Arnika"], | |
| "01-07": ["Julians", "Jūlians", "Jūliāns", "Sigmars", "Sigmārs", "Zigmāra", "Zigmāris", "Zigmars"], | |
| "01-08": ["Ants", "Aristarhs", "Aristida", "Aristīda", "Aristids", "Aristīds", "Aristons", "Aristrīds", "Arjana", "Arlands", "Arleta", "Arlēna", "Arlijs", "Arlita", "Gatiņš", "Īvande", "Ivanna", "Ivase", "Ivena"], | |
| "01-09": ["Aksela", "Akselis", |
| // http://wordpress.stackexchange.com/questions/9394/getting-all-values-for-a-custom-field-key-cross-post | |
| function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) { | |
| global $wpdb; | |
| if( empty( $key ) ) | |
| return; | |
| $r = $wpdb->get_col( $wpdb->prepare( " | |
| SELECT pm.meta_value FROM {$wpdb->postmeta} pm | |
| LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id | |
| WHERE pm.meta_key = '%s' |
#CURL Connections with Tor
Install Apache, PHP, CURL & Tor with apt-get
sudo apt-get install -y apache2 php php-curl torTor creates a proxy on your mashine with port 9050 for SOCKS5 connections.
| <?php | |
| /** | |
| * Get the hash of the current git HEAD | |
| * @param str $branch The git branch to check | |
| * @return mixed Either the hash or a boolean false | |
| */ | |
| function get_current_git_commit( $branch='master' ) { | |
| if ( $hash = file_get_contents( sprintf( '.git/refs/heads/%s', $branch ) ) ) { | |
| return $hash; | |
| } else { |
| cd ~ | |
| wget -O - http://debian.neo4j.org/neotechnology.gpg.key >> key.pgp | |
| sudo apt-key add key.pgp | |
| echo 'deb http://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list > /dev/null | |
| sudo apt-get update && sudo apt-get install neo4j | |
| sudo service neo4j (stop|start|restart) |
| /*JSHint Options*/ | |
| /*global _gaq */ | |
| /* | |
| Google Analytics Event Tracking - JSHint Checked | |
| Written By Cheyne Wallace - 19th Nov 2012 | |
| Click Usage: <a href="http://somewhere" | |
| class="ga-track" | |
| event_category="Event Category" | |
| event_action="Specific Action" | |
| event_label="Optional Message" |
| via http://wordpress.stackexchange.com/questions/2623/include-custom-taxonomy-term-in-search/5404#5404 | |
| function atom_search_where($where){ | |
| global $wpdb; | |
| if ( is_search() ) | |
| $where .= "OR (t.name LIKE '%".get_search_query() . "%' AND {$wpdb->posts} . post_status = 'publish')"; | |
| return $where; | |
| } |
| <?php | |
| if ( ! function_exists( 'ucc_nav_menu_css_class' ) ) { | |
| function ucc_nav_menu_css_class( $classes, $item, $args ) { | |
| $class = sanitize_title( $item->title ); | |
| $classes[] = 'menu-item-' . $class; | |
| return $classes; | |
| } } | |
| add_filter( 'nav_menu_css_class', 'ucc_nav_menu_css_class', 10, 3 ); |
| /* | |
| * goes in theme functions.php or a custom plugin | |
| **/ | |
| // add item to cart on visit | |
| add_action( 'init', 'add_product_to_cart' ); | |
| function add_product_to_cart() { | |
| if ( ! is_admin() ) { | |
| global $woocommerce; | |
| $product_id = 64; | |
| $found = false; |