Skip to content

Instantly share code, notes, and snippets.

View neopunisher's full-sized avatar
🎯
Focusing

Carter Cole neopunisher

🎯
Focusing
View GitHub Profile
@max-mapper
max-mapper / couch-transform.js
Created January 14, 2012 02:27
streaming functional transformer for couchdb using node
var request = require('request').defaults({json: true}),
transfuse = require('transfuse'),
JSONStream = require('JSONStream');
function transform(couchdb, funcString, headers) {
var down = request({url: couchdb + '/_all_docs?include_docs=true'}),
up = request({url: couchdb + '/_bulk_docs', method: "POST", headers: headers}),
tr = transfuse(['rows', /./, 'doc'], funcString, JSONStream.stringify("{\"docs\":[\n", "\n,\n", "\n]}\n"));
down.pipe(tr)
tr.pipe(up)
@yeysus
yeysus / utils
Created June 12, 2012 21:34
utils file (1.8.M04) modified so Neo4j can be installed under CentOS
#!/bin/bash
# Copyright (c) 2002-2012 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Neo4j is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@yeysus
yeysus / neo4j
Created June 12, 2012 21:32
neo4j file (1.8.M04) modified so Neo4j can be installed under CentOS
#!/bin/bash
### BEGIN INIT INFO
# Provides: neo4j-service
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# Copyright (c) 2002-2012 "Neo Technology,"
var fs = require('fs')
, jade = require('jade')
var task = fs.readFileSync('task.jade')
var fn = jade.compile(fs.readFileSync('task.jade'), {pretty: true})
console.log(fn({
"settings" : {
"foo" : "low"
, "bar" : "high"
@neopunisher
neopunisher / cento-sius.sh
Last active October 12, 2015 21:39
Setup a centos with ius
# to autorun: curl -L http://j.mp/iusinstall | sh
ask4 () {
echo -n "$1 [Y]es/[N]o? "
read answer
finish="-1"
while [ "$finish" = '-1' ]
do
finish="1"
if [ "$answer" = '' ];
@voodootikigod
voodootikigod / migrate.js
Created January 3, 2012 22:45
Schema (SQL) and Data (JS) Migrations for node.js (specifically PostgreSQL, but could be MySQL)
#!/usr/bin/env node
// this file is stored in a directory of APP_ROOT/script for me, all things are relative to that
var APP_ROOT = __dirname+"/../";
// this assumes there is a file stored in APP_ROOT called "config.js" with the following structure:
//
// module.exports = {
// "development: {
// "postgresql": "tcp://postgres@localhost/dev-db"
@neopunisher
neopunisher / injectUnderscore.js
Created February 6, 2013 15:22
Injects the underscore library into the page
(function(){var a=document.createElement("script");a.type="text/javascript";a.src="http://bit.ly/latestUnderscore";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)})();
@neopunisher
neopunisher / getnode.sh
Last active December 17, 2015 02:08
get the 64 bit version of node 0.9.9
cd /usr/local/src/
wget http://nodejs.org/dist/v0.9.9/node-v0.9.9-linux-x64.tar.gz
tar zxvf node-v0.9.9-linux-x64.tar.gz
cd node-v0.9.9-linux-x64
ln -s /usr/local/src/node-v0.9.9-linux-x64/bin/node /usr/local/bin/node
ln -s /usr/local/src/node-v0.9.9-linux-x64/bin/npm /usr/local/bin/npm
ln -s /usr/local/src/node-v0.9.9-linux-x64/bin/node /usr/bin
@neopunisher
neopunisher / enablePhpShortTags.sh
Last active December 18, 2015 12:48
Does an inline replace to enable php short tags (<?)
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
grep -n short_open_tag /etc/php.ini
/sbin/service httpd restart
@neopunisher
neopunisher / extsel.js
Created July 1, 2013 12:03
Creating custom :external selector
// Creating custom :external selector
$.expr[':'].external = function(obj){
return (obj.hostname != location.hostname);
};
$(document).ready(function(){
// Add 'external' CSS class to all external links
$('a:external').addClass('external');
});