Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <!DOCTYPE html> | |
| <!-- Helpful things to keep in your <head/> | |
| // Brian Blakely, 360i | |
| // http://twitter.com/brianblakely/ | |
| --> | |
| <head> | |
| <!-- Disable automatic DNS prefetching. | |
| # Clone rbenv into ~/.rbenv | |
| git clone [email protected]:sstephenson/rbenv.git ~/.rbenv | |
| # Add rbenv to your PATH | |
| # NOTE: rbenv is *NOT* compatible with rvm, so you'll need to | |
| # remove rvm from your profile if it's present. (This is because | |
| # rvm overrides the `gem` command.) | |
| echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.bash_profile | |
| exec $SHELL |
| <div class="test"><!-- Adding text using | results in a newline AFTER (not before) each line-->foo | |
| bar | |
| baz | |
| </div> | |
| <div class="test"><!--I thought I could use extra | lines to insert additional whitespace but | |
| this currently outputs | characters into the result. | |
| -->| | |
| foo | |
| | |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| function countCSSRules() { | |
| var results = '', | |
| log = ''; | |
| if (!document.styleSheets) { | |
| return; | |
| } | |
| for (var i = 0; i < document.styleSheets.length; i++) { | |
| countSheet(document.styleSheets[i]); | |
| } | |
| function countSheet(sheet) { |
Here's how this works:
git_hooks/ directory in your project, with these two files (plus other hooks if you want, written in a similar style)."npm" to your devDependencies in package.json, so that the pre-commit hook can do its magic.test and lint scripts to your package.json, e.g. "scripts": {
"test": "mocha",
"lint": "jshint ./lib --show-non-errors"| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| <?php | |
| namespace Widop\Mink\Extension; | |
| /** | |
| * Dictionary to manage popups. | |
| * | |
| * @author Benjamin Lazarecki <[email protected]> | |
| */ | |
| trait PopupDictionary |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');