This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Drupal 7 | |
| */ | |
| $fid = 1; | |
| $uri = file_load($fid)->uri; // or fetched via the uri property of a field | |
| $image_url = image_style_url('thumbnail', $uri); | |
| $image = theme_image(array( | |
| 'path' => $image_url, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <audio controls> | |
| <source src="http://yourdomain.net/folder-path/audio.mp4" type="audio/mp4"> | |
| <source src="http://yourdomain.net/folder-path/audio.oga" type="audio/ogg; codecs=vorbis"> | |
| </audio> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * @modxDescription Group a list of items into columns where the items are stored in separate placeholders (zero-based). | |
| */ | |
| /** | |
| * getColumnized | |
| * | |
| * Group a list of items into columns where the items are stored in separate placeholders (zero-based). | |
| * | |
| * @author John Yau |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash -e | |
| #### | |
| # Helper script to update the Last modified timestamp of files in a Git SCM | |
| # Projects working Copy | |
| # | |
| # When you clone a Git repository, it sets the timestamp of all the files to the | |
| # time when you cloned the repository. | |
| # | |
| # This becomes a problem when you want the cloned repository, which is part of a | |
| # Web application have a proper cacheing mechanism so that it can re-cache files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT TABLE_NAME AS "Table", | |
| round(((data_length + index_length) / 1024 / 1024), 2) AS Size_in_MB | |
| FROM information_schema.TABLES | |
| WHERE table_schema = 'my_db_name' | |
| ORDER BY Size_in_MB DESC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setwd("/path/to/data") | |
| Data <- read.table("sample_data.txt", header=TRUE, sep="\t") | |
| total_cat <- length(levels(Data$Cat)) | |
| means <- by(Data$Val, Data$Cat, mean) | |
| boxplot(Data$Val ~ Data$Cat) | |
| points(1:total_cat, means, pch = 23, bg = "red") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ wget \ | |
| --recursive \ | |
| --no-clobber \ | |
| --page-requisites \ | |
| --html-extension \ | |
| --convert-links \ | |
| --restrict-file-names=windows \ | |
| --domains website.org \ | |
| --no-parent \ | |
| www.website.org/tutorials/html/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Install Apache 2.2.26, PHP 5.4.23 and MySQL 5.5.33 | |
| # | |
| ## RHEL/CentOS 5 64-Bit ## | |
| # rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm | |
| ## Other Repos | |
| #rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm | |
| #rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # check for swap space | |
| swapon -s | |
| # check filesystem | |
| df -h | |
| # create and enabled the swap file (e.g. 512MB) | |
| sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k | |
| sudo mkswap /swapfile |
NewerOlder