Convert file to utf-8 on Unix based OS
A little snippet that I needed today. I didn't found what I needed so I wrote it.
-
cp originalFile backupFile
-
iconv -f fromEncoding -t utf-8 originalFile > originalFile
Cheers
TYPO3 Referrer
If, as me, you've encountered some problems to log in to your TYPO3 installation from differents locations, by having the error message :
This host address ("******") and the referer host ("") mismatches!
The solution is to add the next line to your localconf.php :
$TYPO3_CONF_VARS['SYS']['doNotCheckReferer'] = 1;
JS – setInterval tip
You want to use the Javascript function setInterval() but you dont know how ?
Or you tried but it doesn't work ?
I think you do the thing like this :
var timerId = setInterval('myFunction', 200);
but it doesn't works.
Try like this :
var timerId = setInterval(function() { myFunction(); } , 200);
Hope this snippet helps you.
See ya !
jQuery – Element exists ?
Here's a very small snippet about how to know if a Dom element is on the document with jQuery
-
var myElement = $('#myElement');
-
if (myElement.size() == 0) {
-
// Element doesn't exists
-
} else {
-
// Element exists
-
}
FsCharts – Goals for 1.1.0
I'm currently working on the version 1.1.0, with new usable features.
Here're major the goals :
- Localisation
- Widget configuration panel
- Display of visits on the chart
Take a look too on the svn for the development version if you're interested. I regulary commit the sources
Including JS and CSS in WP Header
Lot of people add Javascript and Css file by "echoing" them from theyre extension.
WordPress allow you to add correctly them to the page's head by using two functions :
// Add a new script file wp_enqueue_script($handle, $src, $deps, $ver, $in_footer); wp_enqueue_script('jsfoo', '/wp-content/plugins/myplugin/JS/foo.js'); // Add a new stylesheet wp_enqueue_style($handle, $src, $deps, $ver, $media); wp_enqueue_style('main', '/wp-content/plugins/myplugin/main.css');
For more informations :
wp_enqueue_style();
wp_enqueue_script();