mkdir -p /path/to/dir/to/create
- Recursively create directories if necessaryscp -r <host>:</source/path> <host>:</destination/path>
- Recursively copy files & directories over sshprintenv
- List all environment variableslsof -i :<port>
- Find out which process is listening upon a port
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
text-rendering: optimizeLegibility; |
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
# http://blog.firsthand.ca/2011/05/compare-git-branches-compare-two-files.html | |
# diff two branches | |
$ git diff --name-status branch1..branch2 | |
# diff of a specific file between two commits/branchs | |
$ git diff feature-branch master -- myfile.css | |
$ git diff eaa241d 4d49814 -- myfile.css |
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
<link rel="stylesheet" type="text/css" href="/css/main.<?php echo filemtime('/path/to/css/main.css'); ?>.css" /> | |
<script language="javascript" src="/js/common.<?php echo filemtime('/path/to/js/common.js'); ?>.js"> | |
</script> | |
# Add a rewrite in apache | |
RewriteRule ^(css|js)/(.*)\.[0-9]+\.(.*)$ /$1/$2.$3 [L] | |
# nginx | |
rewrite ^(css|js)/(.*)\.[0-9]+\.(.*)$ /$1/$2.$3 last; |
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
sudo killall -HUP mDNSResponder |
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
/** | |
* Truncate paragraph with an ellipsis, while specifying exactly how many lines you want | |
* source: http://dropshado.ws/post/1015351370/webkit-line-clamp | |
*/ | |
#content-body { | |
overflow : hidden; | |
text-overflow: ellipsis; | |
display: -webkit-box; |
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 are looking for the /.../s modifier, also known as the dotall modifier. It forces the dot . to also match newlines, which it does not do by default. | |
// The bad news is that it does not exist in Javascript. The good news is that you can work around it by using a character class (e.g. \s) and its negation (\S) together, like this: | |
var htmlStringWithScriptTags = "sdf <script>test fsajkdfn</script> a sdasda <script> sdfsdfsdf \n \ | |
sdfsdfsd </script> sjkndfjkasnd <script> sdfsdfsdf \n \ | |
sdfsdfsd </script>sjkndfjkasnd <script> sdfsdfsdf \n \ | |
sdfsdfsd </script>"; | |
// incorrect | |
htmlStringWithScriptTags.replace(/<script.*?<\/script>/g, ''); |
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
# for instance, if you want to link all of your nginx config files | |
# from sites-available/ to sites-enabled/ in one fell swoop | |
# the trick here is to go into the target directory before issuing the ln command | |
cd /etc/nginx/sites-enabled | |
sudo ln -sfnv /etc/nginx/sites-available/* . |
Mac: highlight the entry and then press Fn + Shift + Del
PC: highlight the entry and press Shift + Delete
- Update, 7/29/14 - From my own personal trial and error, this is only working for me on items specifically in my history, either URL's or previous Omnibox google searches, but not google's auto suggestions. To delete an item from the omnibox on mac, arrow over it and hit
Fn + Shift + Del
or justShift + Del
for some people it seems (not me).
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
# In Ruby 2.0 there are protected default gems that wont get uninstalled by this. | |
$ for i in `gem list --no-versions`; do gem uninstall -aIx $i; done |
OlderNewer