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
function wc(value) { | |
return value.trim().replace(/\s+/gi, ' ').split(' ').length; | |
} |
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
/* Technique of serving SVG to browsers that support it and PNG to the others */ | |
background: url(icon.png) no-repeat 50% 50%, #ccc); | |
background: url(icon.svg) no-repeat 50% 50%, -webkit-linear-gradient(to bottom, #ccc, #ccc); | |
background: url(icon.svg) no-repeat 50% 50%, linear-gradient(to bottom, #ccc, #ccc); | |
/* background-size for WebKit (otherwise it may distort the SVG) */ | |
background-size: 1.2em auto; | |
-webkit-background-size: 1.2em; |
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
/**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
* Anchor Smooth Scroll - Smooth scroll to the given anchor on click | |
* https://gist.github.com/justinmc/d72f38339e0c654437a2 | |
* adapted from this stackoverflow answer: http://stackoverflow.com/a/21918502/257494 | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
angular.module('yourapp').directive('anchorSmoothScroll', function($location) { | |
'use strict'; | |
return { | |
restrict: 'A', |
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 python -m smtpd -n -c DebuggingServer localhost:25 |
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
-- Updating MySQL user host | |
UPDATE mysql.user SET host = '%' WHERE host = 'localhost' AND user = 'username'; | |
UPDATE mysql.db SET host = '%' WHERE host = 'localhost' AND user = 'username'; | |
FLUSH PRIVILEGES; |
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
# Vim cheatsheet | |
### Duplicating a line | |
yy p #paste after | |
yy P #paste before | |
### Getting and setting file higlight | |
:set filetype #get |