Quick hack for using google translate (or other services) in Nuxt/Vue.js

Hey guys, here’s a quick way of making google translate play nice using setInterval. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 export default { mounted: function() { this.$nextTick(() => { this.googleTranslateInit(); }); }, methods: { googleTranslateInit: function() { let checkIfGoogleLoaded = setInterval(() => { if (google.translate.TranslateElement !...

26 May, 2018 · 1 min · 145 words · Alexandru Bucur

How to get the user role for the current logged in user in Wordpress

Quick and easy way of getting the current role in a Wordpress Setup 1 2 $current_user = wp_get_current_user(); $current_user_role = ($current_user->roles);

20 September, 2012 · 1 min · 21 words · Alexandru Bucur

Simple-Mvc-System-Drupal-6

I’ve recently started working on a custom module in Drupal 6 and I really disliked the idea to use built in functions for tables and/or to use embedded html into my module. So I’ve made a simple system on having a view like system in Drupal 6. Create a new module, and in the module folder create a directory called views (for eg:). Add the following function in your module...

24 May, 2012 · 1 min · 163 words · Alexandru Bucur

Mysql Alter Table Select all Tables

In case you wanted for example to change all your MyISAM tables into InnoDB , and you didn’t want to go over the tables one by one, you can do the following queries. First check that you’re doing it on the proper database. 1 2 3 4 USE information_schema; SELECT TABLE_SCHEMA, TABLE_NAME FROM TABLES WHERE TABLE_SCHEMA = "your_db_name"; If it returns what you need you can then run: 1 2 3 SELECT CONCAT("ALTER TABLE `", TABLE_SCHEMA,"`....

07 March, 2012 · 1 min · 90 words · Alexandru Bucur

How to Change or Remove Views2 Exposed Button From Drupal

Add this to your template file: 1 2 3 4 5 6 7 8 9 10 11 12 13 function YOUR_THEME_NAME_preprocess_views_exposed_form(&$vars, $hook) { //this is important // only alter the required form based on id if ($vars['form']['#id'] == 'views-exposed-form-where-to-buy-page-1') { // Change the text on the submit button $vars['form']['submit']['#value'] = t('Search'); // Rebuild the rendered version (submit button, rest remains unchanged) unset($vars['form']['submit']['#printed']); $vars['button'] = drupal_render($vars['form']['submit']); } }

15 June, 2009 · 1 min · 67 words · Alexandru Bucur

Drupal Ubercart Get Add to Form

Quick and easy way on how to get ubercart’s form output for a node. 1 $output .= drupal_get_form('uc_product_add_to_cart_form_'. $node->nid, $node);

15 June, 2009 · 1 min · 20 words · Alexandru Bucur

Drupal 6 Custom Content Type Page Theme

If you ever wondered how to change the page.tpl.php for a custom content type you’ve found out that by default Drupal 6 doesn’t know how to do it. It’s “fixed” easily by adding the following code: 1 2 3 4 5 6 7 8 9 10 11 /** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { // Add per content type pages if (isset($vars['node'])) { // Add template naming suggestion....

04 June, 2009 · 1 min · 98 words · Alexandru Bucur

T_PAAMAYIM_NEKUDOTAYIM PHP Error

Ok so i’ve hit this nasty php error T_PAAMAYIM_NEKUDOTAYIM that sounded like a language from another planet for me (found out that it’s Hebrew for “missing double dots”) The problem is that with static class functions you can’t do dynamic loading (or at least it didn’t work for me) So while this 1 2 3 $module = $_GET['module'] $stuff = new $module(); $stuff->data; works, you can’t do 1 $module::data() even if the name of the module is the name of the class....

02 February, 2009 · 1 min · 82 words · Alexandru Bucur

Interview with the lead developer of Exaile Music Player

Ok so this is my first interview so please be gentile :). For those of you that don’t know Exaile is the default music player in the yet to be released Xfce version of Foresight Linux. Alexandru: ok. first question. So tell me a bit about yourself. (this isn’t really a question no ? :)) but we have to start the “interview” somehow) Adam: Well, my name is Adam Olsen. I grew up in Utah and have lived...

12 April, 2008 · 2 min · 364 words · Alexandru Bucur