This file contains hidden or 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 fresh_media_preprocess_views_views_json_style_simple(&$vars) { | |
global $pager_total, $pager_page_array; | |
$element = $vars['view']->pager['element']; | |
$vars['rows']['pager'] = array( | |
'total' => $pager_total[$element], | |
'current' => $pager_page_array[$element] | |
); | |
} |
This file contains hidden or 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
# configure npm | |
touch ~/.npmrc | |
echo root=$HOME/root >> ~/.npmrc | |
echo binroot=$HOME/bin >> ~/.npmrc | |
echo manroot=$HOME/man >> ~/.npmrc | |
mkdir $HOME/root | |
mkdir $HOME/bin | |
mkdir $HOME/man | |
# install npm |
This file contains hidden or 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
var sys = require('sys'), | |
rest = require('restler-aaronblohowiak'), | |
item, | |
node | |
rest.get('http://mikecantelon.com/jsontest/News') | |
.addListener('complete', function(data) { | |
for(item in data.nodes) { | |
node = data.nodes[item].node |
This file contains hidden or 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
# Rate limiting for SSH requests -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 22 -m recent --set -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 22 -m recent --update --seconds 60 --hitcount 4 -j DROP |
This file contains hidden or 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
/** | |
* Module dependencies. | |
*/ | |
var mongoose = require('mongoose') | |
, Schema = mongoose.Schema | |
mongoose.connect('mongodb://localhost/BB') | |
/** |
This file contains hidden or 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
jim: Hey there. | |
bob: | | |
I am the law! | |
You will kneel! | |
rick: Sure |
This file contains hidden or 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
var yaml = require('yaml') | |
, fs = require('fs') | |
, should = require('should') | |
var ideal = { | |
jim: 'Hey there.', | |
bob: 'I am the law!\nYou will kneel!', | |
rick: 'Sure' | |
} |
This file contains hidden or 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
check process node with pidfile /var/run/node.pid | |
start program = "start/node/app" | |
stop program = "stop/noe/app" | |
if failed host www.myappcom port 80 protocol http | |
with timeout 25 seconds | |
then restart | |
group server |
This file contains hidden or 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
var connect = require('connect'), | |
form = require('connect-form'); | |
var server = connect.createServer( | |
form({ keepExtensions: true }), | |
function(req, res, next){ | |
// Form was submitted | |
if (req.form) { | |
// Do something when parsing is finished | |
// and respond, or respond immediately |
This file contains hidden or 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
// from Horofox in #node.js | |
var mongoose = require('mongoose'); | |
var db = mongoose.connect('mongodb://localhost/mydb'); | |
function allowPosts(mongoose) { | |
var Schema = mongoose.Schema; | |
var Posts = new Schema({ | |
name : String, | |
subject: String, | |
comment : String, |