Skip to content

Instantly share code, notes, and snippets.

View error.out
{ [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }
Error: read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
View out
>>>> In-memory PM2 is out-of-date, do:
>>>> $ pm2 updatePM2
In memory PM2 version: 0.14.0
Local PM2 version: 0.12.16
[PM2] Process app.js launched
@qcom
qcom / package.json
Created May 19, 2015
admire my tests ;)
View package.json
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build-css": "cat public/css/global.css public/css/newLayout/*.css > public/css/style.css",
"build-js": "browserify public/js/newLayout/main.js > public/js/newLayout/bundle.js",
"build": "npm run build-css & npm run build-js",
"start": "npm run build && NODE_ENV=production pm2 start app.js",
"watch-css": "catw public/css/global.css public/css/newLayout/*.css -o public/css/style.css",
"watch-js": "watchify public/js/newLayout/main.js -o public/js/newLayout/bundle.js",
"watch": "npm run watch-css & npm run watch-js",
"start-dev": "npm run watch & nodemon app.js"
View .bashrc
export PS1="\u:\W –> "
export GITAWAREPROMPT=~/.bash/git-aware-prompt
source $GITAWAREPROMPT/main.sh
export PS1="\[$txtpur\][\!] \[$txtgrn\](\u) \[$bldred\]\w \[$bldpur\]\$\[$txtrst\]\[$txtrst\]\[$bldblu\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]"
export EDITOR='vim'
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
PATH=$PATH:$HOME/bin
View clean.sql
select * from (
select C3.ObjectId, C3.CategoryId, C3.CategorizationId, TheCount,
ROW_NUMBER() OVER (ORDER BY C3.ObjectId, C3.CategoryId, C3.Categorizationid desc) as RowNumber
from Categorization as C3 right outer join (
select (select Code from Product where ProductId = ObjectId) as Code, C1.ObjectId, C1.CategoryId, (
select count(*) from Categorization as C2 where C2.ObjectId = C1.ObjectId and C2.CategoryId = C1.CategoryId
) as TheCount
from Categorization as C1
where (select count(*) from Categorization as C2 where C2.ObjectId = C1.ObjectId and C2.CategoryId = C1.CategoryId) > 1
group by C1.CategoryId, C1.ObjectId
View flow.js
async.waterfall([
soap.createClient.bind(null, process.cwd() + '/util/usaepay.wsdl'),
function(client, cb) {
client.runSale(args, cb);
},
function(result, body, cb) {
if (result.runSaleReturn.ResultCode.$value === 'E') {
return new Error('failed to process');
} else if (result.runSaleReturn.ResultCode.$value === 'A') {
return cb(null, result);
@qcom
qcom / OrderedVector.java
Created Sep 24, 2014
ordered vector implementation
View OrderedVector.java
package data_structures;
import java.util.Iterator;
import java.util.NoSuchElementException;
import data_structures.*;
public class OrderedVector<E> implements Iterable<E> {
private E[] arr;
private int size;
@qcom
qcom / OrderedVector.java
Last active Aug 29, 2015
vector implementation
View OrderedVector.java
package data_structures;
import java.util.Iterator;
import java.util.Arrays;
import java.lang.*;
public class OrderedVector<E> implements Iterable<E> {
private E[] arr;
private int size;
private static final int DEFAULT_MAX_CAPACITY = 2;
View schema.sql
CREATE TYPE feedback_type AS ENUM('rolloffs', 'waste', 'hauling', 'commerical', 'residential');
CREATE TABLE IF NOT EXISTS company_feedback (
id serial PRIMARY KEY,
company integer REFERENCES companies(id) NOT NULL,
ip text NOT NULL,
"type" feedback_type NOT NULL,
affirmative boolean NOT NULL
);
View schema.sql
CREATE TABLE IF NOT EXISTS items_industries (
item integer REFERENCES items(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
industry integer REFERENCES industries(id) ON DELETE CASCADE
);