Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| /** | |
| * Remove any non-ASCII characters and convert known non-ASCII characters | |
| * to their ASCII equivalents, if possible. | |
| * | |
| * @param string $string | |
| * @return string $string | |
| * @author Jay Williams <myd3.com> | |
| * @license MIT License | |
| * @link http://gist.github.com/119517 |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
| # The MySQL database server configuration file. | |
| # | |
| # DESC: InnoDB mainly, heavy queries, fewer connections, 4GB RAM | |
| # | |
| # Remember to edit /etc/mysql/debian.cnf when changing the socket location. | |
| [client] | |
| port = 3306 | |
| socket = /var/run/mysqld/mysqld.sock | |
| # This was formally known as [safe_mysqld]. Both versions are currently parsed. |
| function slugify(text) | |
| { | |
| return text.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
| .replace(/\-\-+/g, '-') // Replace multiple - with single - | |
| .replace(/^-+/, '') // Trim - from start of text | |
| .replace(/-+$/, ''); // Trim - from end of text | |
| } |
| /** | |
| * PE to use SVG as CSS background image with fallback for IE8/7/6 | |
| * | |
| * Using SVG as CSS background image to display | |
| * resolution-independent logos or icons is pretty | |
| * awesome but does completely fail on IE8/7/6 | |
| * | |
| * The trick: | |
| * All three IE versions don't support rgba color values. | |
| * By defining a rgba background color together with the |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| .ui-autocomplete { | |
| position: absolute; | |
| top: 100%; | |
| left: 0; | |
| z-index: 1000; | |
| float: left; | |
| display: none; | |
| min-width: 160px; | |
| _width: 160px; | |
| padding: 4px 0; |
| <?php | |
| $fileName = $_FILES['afile']['name']; | |
| $fileType = $_FILES['afile']['type']; | |
| $fileContent = file_get_contents($_FILES['afile']['tmp_name']); | |
| $dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent); | |
| $json = json_encode(array( | |
| 'name' => $fileName, | |
| 'type' => $fileType, | |
| 'dataUrl' => $dataUrl, |
| /** | |
| * HTML Email buttons that work in Outlook 2007+ | |
| * | |
| * This is a really weird hacked up piece of crap but basically the technique is the containing element has some solid color background, | |
| * and the inner <a> has a solid border which acts like padding which is the same color as the background color | |
| */ |
Update: please note that I have since switched to using a set of bash scripts instead of poluting the Git repository with git svn.
Author: Kaspars Dambis
kaspars.net / @konstruktors