Our crawling system can not be perfect of course and many of you recently complained about missing important links in your own home pages on Twhois.
During last days we managed to improve our editing script, increasing the personalization possibilities by enabling the ‘Add profiles’ button.
After you logged in via twitter and pressed the button, it would open a nice popup containing a simple form. Needed parameters are the Link, a Description and the Type of url you’re adding. If you select a social website you probably need to complete even the last field (Username).
After submitting the form you should be able to see your brand new profile at the top of the list of your links.
This feature is highly experimental so please expect some bugs and remember to fill out feedbacks!
We obviously understand that even ‘delete’ and ‘sort’ functions are needed and we’re working to them right now!
(via kindelling)
LOL
They’re probably watching 2012
How to target a single CSS instruction to IE and also to a single version of IE.
element {
/* All Browsers */
property: value;
/* IE 7 and below */
*property: value;
/* IE 6 and below */
_property: value;
/* IE 6 only */
_pr\operty: value;
}
This is a simple example showing how to change any <br> contained in an HTML string into a space, avoiding double spaces.
<?php
$string = 'Lorem <br>ipsum<br style="border:1px solid #CCC" />dolor<br /> sit<br style="height:1000px;">amet';
/* Stripping all other tags
* [optional, depends on what you want to do
*/
$string = strip_tags($string,'<br>');
/* Changing all <br> types into spaces */
$string = preg_replace('/<br[^>]*>/',' ',$string);
/* Avoiding double spaces */
$string = preg_replace('/[\ ]+/',' ',$string);
echo $string;
/* Will output: 'Lorem ipsum dolor sit amet' */
?>
Here’s how I get rid of annoying error ‘no space left on device’ while restarting apache webserver on Debian Lenny
fuser -k -n tcp 80
This is a quick replacement for the ‘show tables’ #mysql command when using #postgres. If you’re on a psql shell you can just do ‘\d’ the following scripts refers to the case you need to show tables from an external script.
select tablename from pg_tables where tableowner='yourname';
Either this analytics is dead or my watch has stopped.
Useful for be sure nobody steals your resources (cpu ecc) this script checks if the ajax call started from your domain. If not… dies.
$ref_domain = parse_url($_SERVER['HTTP_REFERER']);
if ( $_SERVER['SERVER_NAME'] != $ref_domain['host'])
die;
Simple way to re-order an array by random in php.
<?php
/* First of all I create an array */
$array = Array(1,2,3,4);
/* Now I shuffle it */
shuffle($array);
/* Here's the disordered result */
echo implode(', ',$array);
?>
The following examples are not difficult coding examples, but just quick reminders to make working with bash easier and quicker.
# Use last argument of previous command
touch somefile
vim !$
# Monitor code execution
/bin/bash -x command
# or declare it at the top of the script
#!/bin/bash -x
# Repeat previous command changing a world with an other
for i in $(seq 0 10); do mv somefile.somext somefile.newext; done;
^ somext ^ somotherext^
# Rename a file to file.bak
mv file{,.bak}
# Create a directory and all the needed path if not exists yet
mkdir -p /non-existing/path/to/dir
# Lists all backgrounded processes in this shell
jobs