This file contains 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
# ** you need to have an apache instance running already for this command to work. | |
sudo apachectl start | |
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist |
This file contains 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
// Execute *before* angular is included on page | |
// @see http://goo.gl/nqNGKG | |
$('a[target!=_blank], a[target!=_new]').attr('target', '_self'); |
This file contains 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
$rootScope.safeApply = function (fn) { | |
var phase = this.$root.$$phase; | |
if (phase == '$apply' || phase == '$digest') { | |
if (fn && (typeof(fn) === 'function')) { | |
fn(); | |
} | |
} else { | |
this.$apply(fn); | |
} | |
}; |
This file contains 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
# choose a box as a starting point | |
vagrant init hashicorp/precise64 | |
vagrant up | |
vagrant ssh | |
# customize the box to your liking, for example: | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install vim | |
sudo apt-get install apache2 |
This file contains 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
-- only thing you need to supply is the database name in the WHERE statement | |
SELECT TABLE_NAME AS "Table", | |
round(((data_length + index_length) / 1024 / 1024), 2) AS Size_in_MB | |
FROM information_schema.TABLES | |
WHERE table_schema = '%%database%%' | |
ORDER BY Size_in_MB DESC |
This file contains 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
/** | |
* This function strips incompatible iso characters | |
* from ms office documents. If no ascii conversion is found | |
* the character is ignored. | |
* | |
* @author hannuraina | |
* @param array|string $replace value(s) to replace | |
* @return array|string $items | |
*/ | |
function msword_to_ascii($replace) { |
This file contains 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
# returns whois info for the domain, including name servers | |
whois codfish.io | |
# use dig to lookup any subdomain on a name server(s) | |
dig @ns-371.awsdns-46.com codly.codfish.io | |
# dig will output details of the lookup. If configured properly you should see | |
# the details in the ANSWER SECTION ... e.g. | |
;; ANSWER SECTION: | |
codly.codfish.io. 300 IN CNAME codly.herokuapp.com. |
This file contains 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
curl -I | |
# or curl --head |
This file contains 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
RewriteEngine On | |
RewriteBase / | |
# http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html | |
# "If you wish to match against the full URL-path in a per-directory (htaccess) RewriteRule, | |
# use the %{REQUEST_URI} variable in a RewriteCond." | |
RewriteCond %{HTTP_HOST} ^admin.superblog.com$ | |
RewriteCond %{REQUEST_URI} !^(/wp-admin|/wp-login|/wp-content|/wp-includes) | |
RewriteCond %{QUERY_STRING} !^(.*?)preview=true(.*?)$ | |
RewriteRule (.*) http://superblog.com? [R=301,L] # the trailing ? after the domain makes sure to remove any query string params from the original request |
This file contains 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
cat example.com-access.log | awk '{print $9}' | sort | uniq -c | sort -nr | |
# Example Output: | |
# 545475 200 | |
# 153819 304 | |
# 99102 301 | |
# 13346 404 | |
# 8027 206 | |
# 3822 302 |