Skip to content

Instantly share code, notes, and snippets.

Chris O'Donnell codfish

Block or report user

Report or block codfish

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@codfish
codfish / textRendering.css
Last active Dec 20, 2015
Improve text legibility for webkit browsers
View textRendering.css
text-rendering: optimizeLegibility;
@codfish
codfish / gitDiffBranches.sh
Last active Dec 21, 2015
Compare Git Branches, Compare Two Files in Different Branches
View gitDiffBranches.sh
# 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
@codfish
codfish / gist:6624919
Last active Dec 23, 2015
Browser caching your scripts and styles intelligently
View gist:6624919
<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;
@codfish
codfish / gist:6993840
Created Oct 15, 2013
Flush DNS on mac
View gist:6993840
sudo killall -HUP mDNSResponder
@codfish
codfish / webkit-line-clamp.css
Created Oct 24, 2013
"-webkit-line-clamp is an unsupported WebKit property that limits the number of lines of text displayed in a block element. In order to achieve the effect, it needs to be combo-ed with a couple of other exotic WebKit properties."
View webkit-line-clamp.css
/**
* 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;
View dotallRegex.js
// 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, '');
@codfish
codfish / symlinkAll.sh
Last active Dec 28, 2015
Symlink every file in one directory into another directory
View symlinkAll.sh
# 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/* .
@codfish
codfish / bash_notebook.md
Last active Aug 7, 2019
Helpful bash commands & reference. Some commands specific to Debian-based distros.
View bash_notebook.md

Bash Notebook

Popular

  • $ mkdir -p /path/to/dir/to/create - Recursively create directories if necessary
  • $ scp -r <host>:</source/path> <host>:</destination/path> - Recursively copy files & directories over ssh
  • $ printenv - List all environment variables
  • $ lsof -i :<port> - Find out which process is listening upon a port

Conditional Logic

@codfish
codfish / rm_autocomplete_chrome.md
Last active Aug 29, 2015
Remove an auto-complete URL from Chrome
View rm_autocomplete_chrome.md

How to remove an auto-complete URL from Chrome

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 just Shift + Del for some people it seems (not me).

Original Source

@codfish
codfish / rm_local_gems.sh
Created Jul 29, 2014
Delete all local gems with this one liner. Source: http://stackoverflow.com/a/8095234
View rm_local_gems.sh
# 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
You can’t perform that action at this time.