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
// Server side, BarController | |
module.exports = { | |
foo: function (req, res) { | |
res.view('foo'); | |
}, | |
save: function (req, res) { | |
Bar.create({ | |
name: 'bar' |
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
/** | |
* Javascript - | |
* Array multiple groupBy function | |
* Forked from http://codereview.stackexchange.com/questions/37028/grouping-elements-in-array-by-multiple-properties | |
* | |
* Usage: | |
* var list = [ | |
* { foo: "bar", id: 1 }, | |
* { foo: "barbar", id: 2 }, | |
* { foo: "bar", id: 1 }, |
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
# | |
# A virtual host using mix of IP-, name-, and port-based configuration. | |
# This is based on using Homebrew for OS X. You can use this in other | |
# cases though, but you'll likely need to adjust some of the paths below. | |
# | |
server { | |
# Replace this port with the right one for your requirements | |
# listen 80 [default|default_server]; #could also be 1.2.3.4:80 |
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
/** | |
* Replace last occurance of a token | |
* Slightly modified from SO answer. | |
* http://stackoverflow.com/a/2729681/2167601 | |
* | |
* @param needle | |
* @param target | |
* @return string | |
*/ | |
String.prototype.replaceLast = function (needle, target) { |
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
// Generate random characters, | |
// http://stackoverflow.com/a/8084248/2167601 | |
var randomChars = function (length) { | |
if (typeof length === 'undefined') { | |
length = 8; | |
} | |
return (Math.random() +1).toString(36).substr(2, 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
$ cd /usr/local/src | |
$ wget http://nodejs.org/dist/v0.10.33/node-v0.10.33.tar.gz | |
$ tar -xvzf node-v0.10.33.tar.gz | |
$ cd node-v0.10.33 | |
$ ./configure | |
$ make | |
$ sudo make install | |
$ which node |
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
RedirectMatch 404 (?i)\.git | |
RedirectMatch 404 (?i)\.svn | |
# all hidden file | |
RedirectMatch 404 (?i)/\..+ |
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
<configuration> | |
<system.webServer> | |
<security> | |
<requestFiltering> | |
<hiddenSegments> | |
<add segment=".git" /> | |
<add segment=".svn" /> | |
</hiddenSegments> | |
</requestFiltering> | |
</security> |
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
tell application "iTunes" | |
activate | |
set newPreset to make new EQ preset | |
set name of newPreset to "Perfect" | |
set band 1 of newPreset to 3 | |
set band 2 of newPreset to 6 | |
set band 3 of newPreset to 9 | |
set band 4 of newPreset to 7 | |
set band 5 of newPreset to 6 | |
set band 6 of newPreset to 5 |
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
tell application "iTunes" | |
activate | |
set newPreset to make new EQ preset | |
set name of newPreset to "Eargasm Explosion" | |
set band 1 of newPreset to 3 | |
set band 2 of newPreset to 6 | |
set band 3 of newPreset to 9 | |
set band 4 of newPreset to 7 | |
set band 5 of newPreset to 6 | |
set band 6 of newPreset to 5 |